diff --git a/config/overlays/us/data.tsv b/config/overlays/us/data.tsv index ac75dcc9c2..0a65bc7e4b 100644 --- a/config/overlays/us/data.tsv +++ b/config/overlays/us/data.tsv @@ -3466,8 +3466,99 @@ D_001D2AF4 28 D_L00_00161BE8 4 D_L00_00169C80 880 D_L00_0016A040 2048 +D_L00_0017A722 2 +D_L00_0017A724 4 +D_L00_0017A728 4 +D_L00_0017A7D4 4 +D_L00_0017A884 4 +D_L00_0017A934 4 +D_L00_0017A964 4 +D_L00_0017AA14 4 +D_L00_0017ACA4 4 D_L00_00180640 8192 +D_L00_00184420 4 +D_L00_00184424 4 +D_L00_00184470 4 +D_L00_00184474 4 D_L00_00186D40 32256 +D_L00_001B1E84 4 +D_L00_001B1E88 4 +D_L00_001B1E8C 4 +D_L00_001B1E90 4 +D_L00_001B1E94 4 +D_L00_001B1E98 4 +D_L00_001B1E9C 4 +D_L00_001B1EA0 4 +D_L00_001B1EA4 4 +D_L00_001B1EA8 4 +D_L00_001B1EAC 4 +D_L00_001B1EB0 4 +D_L00_001B1EB4 4 +D_L00_001B1EB8 4 +D_L00_001B1EBC 4 +D_L00_001B1EC0 4 +D_L00_001B1EC4 4 +D_L00_001B1EC8 4 +D_L00_001B1ECC 4 +D_L00_001B1ED0 4 +D_L00_001B1ED4 4 +D_L00_001B1ED8 4 +D_L00_001B1EDC 4 +D_L00_001B1EE0 4 +D_L00_001B1EE4 4 +D_L00_001B1EE8 4 +D_L00_001B1EEC 4 +D_L00_001B1EF0 4 +D_L00_001B1EF8 4 +D_L00_001B1EFC 4 +D_L00_001B1F00 4 +D_L00_001B1F04 4 +D_L00_001B1F08 4 +D_L00_001B1F0C 4 +D_L00_001B1F10 4 +D_L00_001B1F14 4 +D_L00_001B1F18 4 +D_L00_001B1F1C 4 +D_L00_001B1F20 4 +D_L00_001B1F24 4 +D_L00_001B1F28 4 +D_L00_001B1F2C 4 +D_L00_001B1F30 4 +D_L00_001B1F34 4 +D_L00_001B1F38 4 +D_L00_001B1F3C 4 +D_L00_001B1F40 4 +D_L00_001B1F44 4 +D_L00_001B1F48 4 +D_L00_001B1F4C 4 +D_L00_001B1F50 4 +D_L00_001B1F54 4 +D_L00_001B1F58 4 +D_L00_001B1F5C 4 +D_L00_001B1F60 4 +D_L00_001B1F64 4 +D_L00_001B1F70 4 +D_L00_001B1F74 4 +D_L00_001B1F78 4 +D_L00_001B1F7C 4 +D_L00_001B1F80 4 +D_L00_001B1F84 4 +D_L00_001B1F88 4 +D_L00_001B1F8C 4 +D_L00_001B1F90 4 +D_L00_001B1F94 4 +D_L00_001B1F98 4 +D_L00_001B1F9C 4 +D_L00_001B1FA0 4 +D_L00_001B1FA4 4 +D_L00_001B1FA8 4 +D_L00_001B1FAC 4 +D_L00_001B1FB0 4 +D_L00_001B1FB4 4 +D_L00_001B1FB8 4 +D_L00_001B1FBC 4 +D_L00_001B9DDC 4 +D_L00_001CA514 4 D_L00_001CB7E0 19200 D_L00_001D02E0 4800 D_L00_001D15A0 4800 @@ -3478,6 +3569,7 @@ D_L00_001D4480 4800 D_L00_001D5740 2400 D_L00_001D60A0 2400 D_L00_001D6A00 2400 +D_L00_001D7460 4 D_L00_001D9470 3136 D_L00_001DA0B0 1568 D_L00_001DA6D0 784 @@ -3502,10 +3594,79 @@ D_L01_00161C40 12 D_L01_00161C84 4 D_L01_00161CE0 4 D_L01_00161E90 4 +D_L01_0016736C 4 D_L01_0016A100 880 D_L01_0016A4C0 2048 +D_L01_0016EED8 4 +D_L01_00179590 4 +D_L01_001798CC 4 +D_L01_0017ABA2 2 +D_L01_0017ABA4 4 +D_L01_0017ABA8 4 +D_L01_0017AC14 4 +D_L01_0017AC54 4 +D_L01_0017AD04 4 +D_L01_0017ADB4 4 +D_L01_0017ADE4 4 +D_L01_0017AE94 4 +D_L01_0017E0A0 4 +D_L01_0017E984 4 D_L01_00180AC0 8192 +D_L01_00182C60 8 +D_L01_00182C68 8 +D_L01_00182C78 8 +D_L01_0018489C 4 +D_L01_001848A0 4 +D_L01_001848F0 4 +D_L01_001848F4 4 +D_L01_001848F8 4 +D_L01_00184904 4 +D_L01_00184908 4 D_L01_001871C0 32256 +D_L01_001B23C0 4 +D_L01_001B23C4 4 +D_L01_001B23C8 4 +D_L01_001B23CC 4 +D_L01_001B23D0 4 +D_L01_001B23D4 4 +D_L01_001B23D8 4 +D_L01_001B23DC 4 +D_L01_001B23E0 4 +D_L01_001B23E4 4 +D_L01_001B23E8 4 +D_L01_001B23EC 4 +D_L01_001B23F0 4 +D_L01_001B23F4 4 +D_L01_001B2408 4 +D_L01_001B2428 4 +D_L01_001B242C 4 +D_L01_001B2430 4 +D_L01_001B2434 4 +D_L01_001B2438 4 +D_L01_001B243C 4 +D_L01_001B2548 4 +D_L01_001B2554 4 +D_L01_001B2558 4 +D_L01_001B2560 4 +D_L01_001B2564 4 +D_L01_001B2568 4 +D_L01_001B256C 4 +D_L01_001B2570 4 +D_L01_001B2588 4 +D_L01_001BA248 4 +D_L01_001BA258 4 +D_L01_001BA25C 4 +D_L01_001BA310 4 +D_L01_001CA900 4 +D_L01_001CA994 4 +D_L01_001CAD28 4 +D_L01_001CAD2C 4 +D_L01_001CAD30 4 +D_L01_001CAD34 4 +D_L01_001CAD38 4 +D_L01_001CADA0 2 +D_L01_001CAE00 2 +D_L01_001CBC4C 2 D_L01_001CBC60 19200 D_L01_001D0760 4800 D_L01_001D1A20 4800 @@ -3516,6 +3677,7 @@ D_L01_001D4900 4800 D_L01_001D5BC0 2400 D_L01_001D6520 2400 D_L01_001D6E80 2400 +D_L01_001D78E0 4 D_L01_001D98F0 3136 D_L01_001DA530 1568 D_L01_001DAB50 784 @@ -3528,7 +3690,10 @@ D_L01_001DC340 20 D_L01_001DC358 20 D_L01_001DC620 3840 D_L01_001E3440 44 +D_L01_001FA840 4 +D_L01_001FA880 4 D_L01_001FF5E0 4800 +D_L01_00200968 2 D_L01_0020AF50 24 D_L01_0020AF68 24 D_L01_0020B4F0 24 @@ -3596,10 +3761,142 @@ D_L02_00162150 4 D_L02_00162154 4 D_L02_00162158 4 D_L02_00162164 4 +D_L02_001674EC 4 +D_L02_00167604 4 +D_L02_00167608 4 +D_L02_00167610 4 D_L02_0016A280 880 D_L02_0016A640 2048 +D_L02_0016CE74 4 +D_L02_0016CE9C 4 +D_L02_0016F058 4 +D_L02_0017441C 4 +D_L02_00179710 4 +D_L02_00179A4C 4 +D_L02_0017AD24 4 +D_L02_0017AD28 4 +D_L02_0017AD94 4 +D_L02_0017ADD4 4 +D_L02_0017AE84 4 +D_L02_0017AF34 4 +D_L02_0017AF64 4 +D_L02_0017B014 4 +D_L02_0017B2A4 4 +D_L02_0017B984 4 +D_L02_0017B988 4 +D_L02_0017C960 4 +D_L02_0017C964 4 +D_L02_0017E220 4 +D_L02_0017EB04 4 +D_L02_0017EB18 4 +D_L02_0017EB1C 4 D_L02_00180C40 8192 +D_L02_00182DE0 8 +D_L02_00182DE8 8 +D_L02_00182DF8 8 +D_L02_00184A1C 4 +D_L02_00184A20 4 +D_L02_00184A70 4 +D_L02_00184A74 4 +D_L02_00184A78 4 +D_L02_00184A84 4 +D_L02_00184A88 4 D_L02_00187340 32256 +D_L02_001B0220 4 +D_L02_001B0280 4 +D_L02_001B2484 4 +D_L02_001B2488 4 +D_L02_001B24A4 4 +D_L02_001B24A8 4 +D_L02_001B24AC 4 +D_L02_001B24B0 4 +D_L02_001B24B4 4 +D_L02_001B24B8 4 +D_L02_001B24BC 4 +D_L02_001B24C0 4 +D_L02_001B24C4 4 +D_L02_001B24C8 4 +D_L02_001B24CC 4 +D_L02_001B24D0 4 +D_L02_001B24D4 4 +D_L02_001B24D8 4 +D_L02_001B24DC 4 +D_L02_001B24E0 4 +D_L02_001B24E4 4 +D_L02_001B24E8 4 +D_L02_001B24EC 4 +D_L02_001B24F0 4 +D_L02_001B24F4 4 +D_L02_001B24F8 4 +D_L02_001B2504 4 +D_L02_001B2508 4 +D_L02_001B2514 4 +D_L02_001B2520 4 +D_L02_001B2524 4 +D_L02_001B2528 4 +D_L02_001B252C 4 +D_L02_001B2530 4 +D_L02_001B2534 4 +D_L02_001B2538 4 +D_L02_001B253C 4 +D_L02_001B2540 4 +D_L02_001B2544 4 +D_L02_001B2548 4 +D_L02_001B254C 4 +D_L02_001B2550 4 +D_L02_001B2554 4 +D_L02_001B2558 4 +D_L02_001B255C 4 +D_L02_001B2560 4 +D_L02_001B2564 4 +D_L02_001B2568 4 +D_L02_001B256C 4 +D_L02_001B2570 4 +D_L02_001B2574 4 +D_L02_001B2578 4 +D_L02_001B2584 4 +D_L02_001B2588 4 +D_L02_001B258C 4 +D_L02_001B2590 4 +D_L02_001B2594 4 +D_L02_001B2598 4 +D_L02_001B259C 4 +D_L02_001B25A0 4 +D_L02_001B25A4 4 +D_L02_001B25A8 4 +D_L02_001B25AC 4 +D_L02_001B25B0 4 +D_L02_001B25B4 4 +D_L02_001B25B8 4 +D_L02_001B25BC 4 +D_L02_001B2690 4 +D_L02_001B26B0 4 +D_L02_001B26BC 4 +D_L02_001B26C8 4 +D_L02_001B26D4 4 +D_L02_001B26D8 4 +D_L02_001B26E0 4 +D_L02_001B26E4 4 +D_L02_001B26E8 4 +D_L02_001B26EC 4 +D_L02_001B26F0 4 +D_L02_001B26F4 4 +D_L02_001B2708 4 +D_L02_001B2730 4 +D_L02_001B2774 4 +D_L02_001B2788 4 +D_L02_001BA3C8 4 +D_L02_001BA3D8 4 +D_L02_001BA3DC 4 +D_L02_001BA490 4 +D_L02_001CAA80 4 +D_L02_001CAAC8 4 +D_L02_001CAAD8 4 +D_L02_001CAAE4 4 +D_L02_001CAAE8 4 +D_L02_001CAB14 4 +D_L02_001CBDCC 2 +D_L02_001CBEE0 4 D_L02_001CDEF0 3136 D_L02_001CEB30 1568 D_L02_001CF150 784 @@ -3612,15 +3909,141 @@ D_L02_001D0940 20 D_L02_001D0958 20 D_L02_001D0C20 3840 D_L02_001D7750 4800 +D_L02_001D8AD8 2 D_L03_0015F678 4 D_L03_0015F6D8 16 D_L03_0015F6E8 12 D_L03_001618D0 1 D_L03_001618F4 4 +D_L03_00166FEC 4 +D_L03_00167100 4 +D_L03_00167104 4 +D_L03_00167108 4 +D_L03_0016710C 4 +D_L03_00167110 4 D_L03_00169D80 880 D_L03_0016A140 2048 +D_L03_0016CAE4 4 +D_L03_0016EB58 4 +D_L03_00173F1C 4 +D_L03_00173F54 4 +D_L03_00173F64 4 +D_L03_0017954C 4 +D_L03_0017A822 2 +D_L03_0017A824 4 +D_L03_0017A828 4 +D_L03_0017A894 4 +D_L03_0017A8D4 4 +D_L03_0017A984 4 +D_L03_0017AA34 4 +D_L03_0017AA64 4 +D_L03_0017AB14 4 +D_L03_0017ADA4 4 +D_L03_0017C460 4 +D_L03_0017C464 4 +D_L03_0017DD20 4 +D_L03_0017E604 4 +D_L03_0017E618 4 +D_L03_0017E61C 4 D_L03_00180740 8192 +D_L03_001828E0 8 +D_L03_001828E8 8 +D_L03_001828F8 8 +D_L03_0018451C 4 +D_L03_00184520 4 +D_L03_00184570 4 +D_L03_00184574 4 +D_L03_00184578 4 +D_L03_00184584 4 +D_L03_00184588 4 D_L03_00186E40 32256 +D_L03_001B1F84 4 +D_L03_001B1F88 4 +D_L03_001B1F8C 4 +D_L03_001B1F90 4 +D_L03_001B1F94 4 +D_L03_001B1F98 4 +D_L03_001B1F9C 4 +D_L03_001B1FA0 4 +D_L03_001B1FA4 4 +D_L03_001B1FA8 4 +D_L03_001B1FAC 4 +D_L03_001B1FB0 4 +D_L03_001B1FB4 4 +D_L03_001B1FB8 4 +D_L03_001B1FBC 4 +D_L03_001B1FC0 4 +D_L03_001B1FC4 4 +D_L03_001B1FC8 4 +D_L03_001B1FCC 4 +D_L03_001B1FD0 4 +D_L03_001B1FD4 4 +D_L03_001B1FD8 4 +D_L03_001B1FE4 4 +D_L03_001B1FE8 4 +D_L03_001B1FEC 4 +D_L03_001B1FF0 4 +D_L03_001B2000 4 +D_L03_001B2004 4 +D_L03_001B2008 4 +D_L03_001B200C 4 +D_L03_001B2010 4 +D_L03_001B2014 4 +D_L03_001B2018 4 +D_L03_001B2020 4 +D_L03_001B2024 4 +D_L03_001B2028 4 +D_L03_001B202C 4 +D_L03_001B2034 4 +D_L03_001B203C 4 +D_L03_001B2040 4 +D_L03_001B2044 4 +D_L03_001B2048 4 +D_L03_001B2054 4 +D_L03_001B2058 4 +D_L03_001B205C 4 +D_L03_001B2060 4 +D_L03_001B2064 4 +D_L03_001B207C 4 +D_L03_001B2080 4 +D_L03_001B2084 4 +D_L03_001B2088 4 +D_L03_001B208C 4 +D_L03_001B2090 4 +D_L03_001B2094 4 +D_L03_001B2098 4 +D_L03_001B209C 4 +D_L03_001B20A0 4 +D_L03_001B20A4 4 +D_L03_001B20A8 4 +D_L03_001B20AC 4 +D_L03_001B20B0 4 +D_L03_001B20B4 4 +D_L03_001B20B8 4 +D_L03_001B20BC 4 +D_L03_001B2190 4 +D_L03_001B21B0 4 +D_L03_001B21BC 4 +D_L03_001B21C8 4 +D_L03_001B21CC 4 +D_L03_001B21D4 4 +D_L03_001B21D8 4 +D_L03_001B21F0 4 +D_L03_001B9EC8 4 +D_L03_001B9ED8 4 +D_L03_001B9EDC 4 +D_L03_001B9F90 4 +D_L03_001CA580 4 +D_L03_001CA5C8 4 +D_L03_001CA5D8 4 +D_L03_001CA5E4 4 +D_L03_001CA5E8 4 +D_L03_001CA614 4 +D_L03_001CB4C4 4 +D_L03_001CB4C8 4 +D_L03_001CB4CC 4 +D_L03_001CB8CC 2 +D_L03_001CB9E0 4 D_L03_001CD9F0 3136 D_L03_001CE630 1568 D_L03_001CEC50 784 @@ -3632,16 +4055,123 @@ D_L03_001D0120 800 D_L03_001D0440 20 D_L03_001D0458 20 D_L03_001D0720 3840 +D_L03_001D2C10 4 +D_L03_001D2C14 4 +D_L03_001D2C18 4 +D_L03_001D2C1C 4 +D_L03_001D2C20 4 +D_L03_001D2C34 4 +D_L03_001D2C48 4 +D_L03_001D2C4C 4 +D_L03_001D2C50 4 +D_L03_001D2C54 4 D_L03_001D6550 4800 +D_L03_001D78D8 2 D_L04_00161878 2 D_L04_00161890 16 D_L04_001618A0 16 D_L04_00166130 32 +D_L04_0016706C 4 +D_L04_00167180 4 +D_L04_00167184 4 +D_L04_00167188 4 +D_L04_0016718C 4 +D_L04_00167190 4 D_L04_00169E00 880 D_L04_0016A1C0 2048 +D_L04_0016EBD8 4 +D_L04_00173F9C 4 +D_L04_0017A8A2 2 +D_L04_0017A8A4 4 +D_L04_0017A8A8 4 +D_L04_0017A954 4 +D_L04_0017AA04 4 +D_L04_0017AAB4 4 +D_L04_0017AAE4 4 +D_L04_0017AB94 4 +D_L04_0017AE24 4 +D_L04_0017C4E0 4 +D_L04_0017C4E4 4 +D_L04_0017C5E0 4 +D_L04_0017C5E4 4 +D_L04_0017DDA0 4 +D_L04_0017DDC0 4 D_L04_001807C0 8192 +D_L04_00182960 8 +D_L04_00182968 8 +D_L04_00182978 8 +D_L04_0018459C 4 +D_L04_001845A0 4 +D_L04_001845F0 4 +D_L04_001845F4 4 +D_L04_001845F8 4 +D_L04_00184604 4 +D_L04_00184608 4 D_L04_00186EC0 32256 +D_L04_001B2004 4 +D_L04_001B2008 4 +D_L04_001B200C 4 +D_L04_001B2010 4 +D_L04_001B2014 4 +D_L04_001B2018 4 +D_L04_001B2020 4 +D_L04_001B2024 4 +D_L04_001B2028 4 +D_L04_001B202C 4 +D_L04_001B2034 4 +D_L04_001B203C 4 +D_L04_001B2040 4 +D_L04_001B2044 4 +D_L04_001B2048 4 +D_L04_001B2054 4 +D_L04_001B2058 4 +D_L04_001B205C 4 +D_L04_001B2060 4 +D_L04_001B2064 4 +D_L04_001B207C 4 +D_L04_001B2080 4 +D_L04_001B2084 4 +D_L04_001B2088 4 +D_L04_001B208C 4 +D_L04_001B2090 4 +D_L04_001B2094 4 +D_L04_001B2098 4 +D_L04_001B209C 4 +D_L04_001B20A0 4 +D_L04_001B20A4 4 +D_L04_001B20A8 4 +D_L04_001B20AC 4 +D_L04_001B20B0 4 +D_L04_001B20B4 4 +D_L04_001B20B8 4 +D_L04_001B20BC 4 +D_L04_001B20C0 4 +D_L04_001B20C4 4 +D_L04_001B20C8 4 +D_L04_001B20CC 4 +D_L04_001B20D4 4 +D_L04_001B20D8 4 +D_L04_001B20F0 4 +D_L04_001B2108 4 +D_L04_001B210C 4 +D_L04_001B2110 4 +D_L04_001B2114 4 +D_L04_001B2118 4 +D_L04_001B2134 4 +D_L04_001B220C 4 +D_L04_001B2210 4 +D_L04_001B9F48 4 +D_L04_001B9F58 4 +D_L04_001B9F5C 4 +D_L04_001BA010 4 +D_L04_001CA600 4 +D_L04_001CA648 4 +D_L04_001CA658 4 +D_L04_001CA664 4 +D_L04_001CA668 4 +D_L04_001CA694 4 D_L04_001CA938 52 +D_L04_001CBA60 4 D_L04_001CDA70 3136 D_L04_001CE6B0 1568 D_L04_001CECD0 784 @@ -3653,7 +4183,12 @@ D_L04_001D01A0 800 D_L04_001D04C0 20 D_L04_001D04D8 20 D_L04_001D07A0 3840 +D_L04_001D3010 4 +D_L04_001D3020 4 +D_L04_001D3030 4 +D_L04_001D3040 4 D_L04_001D7390 4800 +D_L04_001D8718 2 D_L04_001DC450 24 D_L04_001DC468 20 D_L05_0015F678 4 @@ -3680,10 +4215,110 @@ D_L05_00161D1C 4 D_L05_00161D20 4 D_L05_00161D28 4 D_L05_00161D2C 4 +D_L05_001672EC 4 +D_L05_00167400 4 +D_L05_00167404 4 +D_L05_00167408 4 +D_L05_0016740C 4 +D_L05_00167410 4 D_L05_0016A080 880 D_L05_0016A440 2048 +D_L05_0016CC74 4 +D_L05_0016EE58 4 +D_L05_0017421C 4 +D_L05_00179510 4 +D_L05_0017984C 4 +D_L05_0017AB82 2 +D_L05_0017AB84 4 +D_L05_0017AB88 4 +D_L05_0017ABF4 4 +D_L05_0017AC34 4 +D_L05_0017ACE4 4 +D_L05_0017AD50 4 +D_L05_0017AD94 4 +D_L05_0017ADC4 4 +D_L05_0017AE74 4 +D_L05_0017B7E4 4 +D_L05_0017B7E8 4 +D_L05_0017C7C0 4 +D_L05_0017C7C4 4 +D_L05_0017E0A0 4 +D_L05_0017E984 4 D_L05_00180AC0 8192 +D_L05_00182C60 8 +D_L05_00182C68 8 +D_L05_00182C78 8 +D_L05_0018489C 4 +D_L05_001848A0 4 +D_L05_001848F0 4 +D_L05_001848F4 4 +D_L05_001848F8 4 +D_L05_00184904 4 +D_L05_00184908 4 D_L05_001871C0 32256 +D_L05_001B23C0 4 +D_L05_001B23C4 4 +D_L05_001B23C8 4 +D_L05_001B23CC 4 +D_L05_001B23D0 4 +D_L05_001B23D4 4 +D_L05_001B23D8 4 +D_L05_001B23DC 4 +D_L05_001B23E0 4 +D_L05_001B23E4 4 +D_L05_001B23E8 4 +D_L05_001B23EC 4 +D_L05_001B23F0 4 +D_L05_001B23F4 4 +D_L05_001B2408 4 +D_L05_001B2428 4 +D_L05_001B242C 4 +D_L05_001B2430 4 +D_L05_001B2434 4 +D_L05_001B2438 4 +D_L05_001B243C 4 +D_L05_001B2514 4 +D_L05_001B2530 4 +D_L05_001B253C 4 +D_L05_001B2548 4 +D_L05_001B2554 4 +D_L05_001B2558 4 +D_L05_001B2560 4 +D_L05_001B2564 4 +D_L05_001B2568 4 +D_L05_001B256C 4 +D_L05_001B2570 4 +D_L05_001B2588 4 +D_L05_001B25B0 4 +D_L05_001B25B4 4 +D_L05_001B25B8 4 +D_L05_001B25BC 4 +D_L05_001B25C0 4 +D_L05_001B25D0 4 +D_L05_001B2608 4 +D_L05_001BA248 4 +D_L05_001BA258 4 +D_L05_001BA25C 4 +D_L05_001BA310 4 +D_L05_001CA900 4 +D_L05_001CA948 4 +D_L05_001CA958 4 +D_L05_001CA964 4 +D_L05_001CA968 4 +D_L05_001CA994 4 +D_L05_001CAD28 4 +D_L05_001CAD2C 4 +D_L05_001CAD30 4 +D_L05_001CAD34 4 +D_L05_001CAD38 4 +D_L05_001CADA0 2 +D_L05_001CAE00 2 +D_L05_001CAFE0 4 +D_L05_001CB844 4 +D_L05_001CB848 4 +D_L05_001CB84C 4 +D_L05_001CBC4C 2 +D_L05_001CBD60 4 D_L05_001CDD70 32 D_L05_001CDD90 3136 D_L05_001CE9D0 1568 @@ -3696,7 +4331,19 @@ D_L05_001D04C0 800 D_L05_001D07E0 20 D_L05_001D07F8 20 D_L05_001D0AC0 3840 +D_L05_001D2FB0 4 +D_L05_001D2FB4 4 +D_L05_001D2FB8 4 +D_L05_001D2FBC 4 +D_L05_001D2FC0 4 +D_L05_001D2FD4 4 +D_L05_001D2FE8 4 +D_L05_001D2FEC 4 +D_L05_001D2FF0 4 +D_L05_001D2FF4 4 +D_L05_0020B740 32 D_L05_0020BEC0 4800 +D_L05_0020D248 2 D_L06_0015F678 4 D_L06_0015F68C 4 D_L06_0015F6D8 16 @@ -3729,10 +4376,143 @@ D_L06_00162368 4 D_L06_0016236C 4 D_L06_00162370 4 D_L06_0016237C 4 +D_L06_0016766C 4 D_L06_0016A400 880 D_L06_0016A7C0 2048 +D_L06_0016C7E4 4 +D_L06_0016C860 4 +D_L06_0016C864 4 +D_L06_0016C86C 4 +D_L06_0016C870 4 +D_L06_0016C874 4 +D_L06_0016F1D8 4 +D_L06_0017459C 4 +D_L06_0017AEA2 2 +D_L06_0017AEA4 4 +D_L06_0017AEA8 4 +D_L06_0017AF14 4 +D_L06_0017AF54 4 +D_L06_0017B004 4 +D_L06_0017B0E4 4 +D_L06_0017B194 4 +D_L06_0017CAE0 4 +D_L06_0017CAE4 4 +D_L06_0017CBE0 4 +D_L06_0017CBE4 4 +D_L06_0017E3A0 4 +D_L06_0017E3C0 4 +D_L06_0017EC98 4 +D_L06_0017EC9C 4 D_L06_00180DC0 8192 +D_L06_00184B9C 4 +D_L06_00184BA0 4 +D_L06_00184BF0 4 +D_L06_00184BF4 4 +D_L06_00184BF8 4 +D_L06_00184C04 4 +D_L06_00184C08 4 D_L06_001874C0 32256 +D_L06_001B2604 4 +D_L06_001B2608 4 +D_L06_001B260C 4 +D_L06_001B2610 4 +D_L06_001B2614 4 +D_L06_001B2618 4 +D_L06_001B261C 4 +D_L06_001B2620 4 +D_L06_001B2624 4 +D_L06_001B2628 4 +D_L06_001B262C 4 +D_L06_001B2630 4 +D_L06_001B2634 4 +D_L06_001B2638 4 +D_L06_001B263C 4 +D_L06_001B2640 4 +D_L06_001B2644 4 +D_L06_001B2648 4 +D_L06_001B264C 4 +D_L06_001B2650 4 +D_L06_001B2654 4 +D_L06_001B2658 4 +D_L06_001B265C 4 +D_L06_001B2660 4 +D_L06_001B2664 4 +D_L06_001B2668 4 +D_L06_001B266C 4 +D_L06_001B2670 4 +D_L06_001B2674 4 +D_L06_001B2688 4 +D_L06_001B268C 4 +D_L06_001B2690 4 +D_L06_001B2694 4 +D_L06_001B2698 4 +D_L06_001B269C 4 +D_L06_001B26A0 4 +D_L06_001B26A4 4 +D_L06_001B26A8 4 +D_L06_001B26AC 4 +D_L06_001B26B0 4 +D_L06_001B26B4 4 +D_L06_001B26B8 4 +D_L06_001B26BC 4 +D_L06_001B26C0 4 +D_L06_001B26C4 4 +D_L06_001B26C8 4 +D_L06_001B26CC 4 +D_L06_001B26D0 4 +D_L06_001B26D4 4 +D_L06_001B26D8 4 +D_L06_001B26DC 4 +D_L06_001B26E0 4 +D_L06_001B26E4 4 +D_L06_001B26E8 4 +D_L06_001B26EC 4 +D_L06_001B26F0 4 +D_L06_001B26F4 4 +D_L06_001B2708 4 +D_L06_001B270C 4 +D_L06_001B2710 4 +D_L06_001B2714 4 +D_L06_001B2718 4 +D_L06_001B271C 4 +D_L06_001B2720 4 +D_L06_001B2724 4 +D_L06_001B2728 4 +D_L06_001B272C 4 +D_L06_001B2730 4 +D_L06_001B2734 4 +D_L06_001B2738 4 +D_L06_001B273C 4 +D_L06_001B2810 4 +D_L06_001B2814 4 +D_L06_001B2830 4 +D_L06_001B2834 4 +D_L06_001B2838 4 +D_L06_001B283C 4 +D_L06_001B2848 4 +D_L06_001B2854 4 +D_L06_001B2858 4 +D_L06_001B2860 4 +D_L06_001B2864 4 +D_L06_001B2868 4 +D_L06_001B286C 4 +D_L06_001B2870 4 +D_L06_001B2888 4 +D_L06_001B28B0 4 +D_L06_001B28F4 4 +D_L06_001B2908 4 +D_L06_001BA548 4 +D_L06_001BA558 4 +D_L06_001BA55C 4 +D_L06_001BA610 4 +D_L06_001CAC00 4 +D_L06_001CAC48 4 +D_L06_001CAC58 4 +D_L06_001CAC64 4 +D_L06_001CAC68 4 +D_L06_001CAC94 4 +D_L06_001CBF4C 2 +D_L06_001CC060 4 D_L06_001CE070 3136 D_L06_001CECB0 1568 D_L06_001CF2D0 784 @@ -3744,9 +4524,40 @@ D_L06_001D07A0 800 D_L06_001D0AC0 20 D_L06_001D0AD8 20 D_L06_001D0DA0 3840 +D_L06_001D48C0 4 +D_L06_001D48C4 4 +D_L06_001D48C8 4 +D_L06_001D48CC 4 +D_L06_001D48D0 4 +D_L06_001D48E4 4 +D_L06_001D48F8 4 +D_L06_001D48FC 4 +D_L06_001D4900 4 +D_L06_001D4904 4 +D_L06_001D4AC0 4 +D_L06_001D4AD0 4 +D_L06_001D4AE0 4 +D_L06_001D4AF0 4 D_L06_001D8E40 4800 +D_L06_001DA1C8 2 D_L06_001DB0F0 1920 D_L06_001DB870 1920 +D_L06_001DBFF0 14080 +D_L06_001DF6F0 13824 +D_L06_001E2CF0 7480 +D_L06_001E4A30 13824 +D_L06_001EB730 13824 +D_L06_001EED30 1504 +D_L06_001EF310 928 +D_L06_001EF6B0 1320 +D_L06_001EFBE0 928 +D_L06_001F0560 928 +D_L06_001F0900 2336 +D_L06_001F1220 800 +D_L06_001F1540 1168 +D_L06_001F19D0 800 +D_L06_001F2610 800 +D_L06_001FE9D0 4 D_L06_001FFBA0 41 D_L06_001FFBE8 23 D_L06_001FFC00 23 @@ -3778,10 +4589,139 @@ D_L06_002019A0 24 D_L07_00161B74 4 D_L07_00161B78 4 D_L07_00161B7C 4 +D_L07_00166F6C 4 +D_L07_00167090 4 D_L07_00169D00 880 D_L07_0016A0C0 2048 +D_L07_0016EAD8 4 +D_L07_00173E9C 4 +D_L07_001794CC 4 +D_L07_0017A7A2 2 +D_L07_0017A7A4 4 +D_L07_0017A7A8 4 +D_L07_0017A854 4 +D_L07_0017A904 4 +D_L07_0017A9B4 4 +D_L07_0017A9E4 4 +D_L07_0017AA94 4 +D_L07_0017AD24 4 +D_L07_0017C3E0 4 +D_L07_0017C3E4 4 +D_L07_0017DCA0 4 +D_L07_0017DCC0 4 +D_L07_0017E598 4 +D_L07_0017E59C 4 D_L07_001806C0 8192 +D_L07_0018449C 4 +D_L07_001844A0 4 +D_L07_001844F0 4 +D_L07_001844F4 4 +D_L07_001844F8 4 +D_L07_00184504 4 +D_L07_00184508 4 D_L07_00186DC0 32256 +D_L07_001B1F04 4 +D_L07_001B1F08 4 +D_L07_001B1F0C 4 +D_L07_001B1F10 4 +D_L07_001B1F14 4 +D_L07_001B1F18 4 +D_L07_001B1F1C 4 +D_L07_001B1F20 4 +D_L07_001B1F24 4 +D_L07_001B1F28 4 +D_L07_001B1F2C 4 +D_L07_001B1F30 4 +D_L07_001B1F34 4 +D_L07_001B1F38 4 +D_L07_001B1F3C 4 +D_L07_001B1F40 4 +D_L07_001B1F44 4 +D_L07_001B1F48 4 +D_L07_001B1F4C 4 +D_L07_001B1F50 4 +D_L07_001B1F54 4 +D_L07_001B1F58 4 +D_L07_001B1F5C 4 +D_L07_001B1F60 4 +D_L07_001B1F64 4 +D_L07_001B1F70 4 +D_L07_001B1F74 4 +D_L07_001B1F78 4 +D_L07_001B1F7C 4 +D_L07_001B1F80 4 +D_L07_001B1F84 4 +D_L07_001B1F88 4 +D_L07_001B1F8C 4 +D_L07_001B1F90 4 +D_L07_001B1F94 4 +D_L07_001B1F98 4 +D_L07_001B1F9C 4 +D_L07_001B1FA0 4 +D_L07_001B1FA4 4 +D_L07_001B1FA8 4 +D_L07_001B1FAC 4 +D_L07_001B1FB0 4 +D_L07_001B1FB4 4 +D_L07_001B1FB8 4 +D_L07_001B1FBC 4 +D_L07_001B1FC0 4 +D_L07_001B1FC4 4 +D_L07_001B1FC8 4 +D_L07_001B1FCC 4 +D_L07_001B1FD0 4 +D_L07_001B1FD4 4 +D_L07_001B1FD8 4 +D_L07_001B1FE4 4 +D_L07_001B1FE8 4 +D_L07_001B1FEC 4 +D_L07_001B1FF0 4 +D_L07_001B2000 4 +D_L07_001B2004 4 +D_L07_001B2008 4 +D_L07_001B200C 4 +D_L07_001B2010 4 +D_L07_001B2014 4 +D_L07_001B2018 4 +D_L07_001B2020 4 +D_L07_001B2024 4 +D_L07_001B2028 4 +D_L07_001B202C 4 +D_L07_001B2034 4 +D_L07_001B203C 4 +D_L07_001B2110 4 +D_L07_001B2134 4 +D_L07_001B2154 4 +D_L07_001B2158 4 +D_L07_001B2188 4 +D_L07_001B21B0 4 +D_L07_001B21B4 4 +D_L07_001B21B8 4 +D_L07_001B21C8 4 +D_L07_001B9E48 4 +D_L07_001B9E58 4 +D_L07_001B9E5C 4 +D_L07_001B9F10 4 +D_L07_001CA500 4 +D_L07_001CA548 4 +D_L07_001CA558 4 +D_L07_001CA564 4 +D_L07_001CA568 4 +D_L07_001CA594 4 +D_L07_001CA928 4 +D_L07_001CA92C 4 +D_L07_001CA930 4 +D_L07_001CA934 4 +D_L07_001CA938 4 +D_L07_001CA940 2 +D_L07_001CA9A0 2 +D_L07_001CAA00 2 +D_L07_001CABE0 4 +D_L07_001CB444 4 +D_L07_001CB448 4 +D_L07_001CB44C 4 +D_L07_001CB84C 2 +D_L07_001CB960 4 D_L07_001CD970 3136 D_L07_001CE5B0 1568 D_L07_001CEBD0 784 @@ -3794,6 +4734,7 @@ D_L07_001D03C0 20 D_L07_001D03D8 20 D_L07_001D06A0 3840 D_L07_001DAE00 4800 +D_L07_001DC188 2 D_L07_0020FA40 41 D_L07_0020FA88 23 D_L07_0020FAA0 23 @@ -3818,10 +4759,14 @@ D_L07_0020FC70 23 D_L07_0020FC88 23 D_L07_0020FCA0 23 D_L07_0020FCD0 23 +D_L07_00211580 77 D_L07_00211720 51 D_L07_00211758 54 D_L07_00211790 48 D_L07_002117C0 56 +D_L07_002117F8 61 +D_L07_00211B30 26 +D_L07_00211B78 47 D_L08_0015F678 4 D_L08_0015F68C 4 D_L08_0015F6D8 16 @@ -3833,8 +4778,146 @@ D_L08_001623D8 8 D_L08_001623E8 8 D_L08_0016A480 880 D_L08_0016A840 2048 +D_L08_0016C864 4 +D_L08_0016C8E0 4 +D_L08_0016C8E4 4 +D_L08_0016C8EC 4 +D_L08_0016C8F0 4 +D_L08_0016C8F4 4 +D_L08_0016D09C 4 +D_L08_0016F258 4 +D_L08_0017461C 4 +D_L08_00179910 4 +D_L08_00179C4C 4 +D_L08_0017AF24 4 +D_L08_0017AF28 4 +D_L08_0017AF94 4 +D_L08_0017AFD4 4 +D_L08_0017B164 4 +D_L08_0017B214 4 +D_L08_0017CB60 4 +D_L08_0017CB64 4 +D_L08_0017E420 4 +D_L08_0017ED04 4 +D_L08_0017ED18 4 +D_L08_0017ED1C 4 D_L08_00180E40 8192 +D_L08_00182FE0 8 +D_L08_00182FE8 8 +D_L08_00182FF8 8 +D_L08_00184C1C 4 +D_L08_00184C20 4 +D_L08_00184C70 4 +D_L08_00184C74 4 +D_L08_00184C78 4 +D_L08_00184C84 4 +D_L08_00184C88 4 D_L08_00187540 32256 +D_L08_001B0420 4 +D_L08_001B0480 4 +D_L08_001B2688 4 +D_L08_001B268C 4 +D_L08_001B2690 4 +D_L08_001B2694 4 +D_L08_001B2698 4 +D_L08_001B269C 4 +D_L08_001B26A0 4 +D_L08_001B26A4 4 +D_L08_001B26A8 4 +D_L08_001B26AC 4 +D_L08_001B26B0 4 +D_L08_001B26B4 4 +D_L08_001B26B8 4 +D_L08_001B26BC 4 +D_L08_001B26C0 4 +D_L08_001B26C4 4 +D_L08_001B26C8 4 +D_L08_001B26CC 4 +D_L08_001B26D0 4 +D_L08_001B26D4 4 +D_L08_001B26D8 4 +D_L08_001B26DC 4 +D_L08_001B26E0 4 +D_L08_001B26E4 4 +D_L08_001B26E8 4 +D_L08_001B26EC 4 +D_L08_001B26F0 4 +D_L08_001B26F4 4 +D_L08_001B2708 4 +D_L08_001B270C 4 +D_L08_001B2710 4 +D_L08_001B2714 4 +D_L08_001B2718 4 +D_L08_001B271C 4 +D_L08_001B2720 4 +D_L08_001B2724 4 +D_L08_001B2728 4 +D_L08_001B272C 4 +D_L08_001B2730 4 +D_L08_001B2734 4 +D_L08_001B2738 4 +D_L08_001B273C 4 +D_L08_001B2740 4 +D_L08_001B2744 4 +D_L08_001B2748 4 +D_L08_001B274C 4 +D_L08_001B2750 4 +D_L08_001B2754 4 +D_L08_001B2758 4 +D_L08_001B275C 4 +D_L08_001B2760 4 +D_L08_001B2764 4 +D_L08_001B2768 4 +D_L08_001B276C 4 +D_L08_001B2770 4 +D_L08_001B2774 4 +D_L08_001B2778 4 +D_L08_001B2784 4 +D_L08_001B2788 4 +D_L08_001B278C 4 +D_L08_001B2790 4 +D_L08_001B2794 4 +D_L08_001B27A0 4 +D_L08_001B27A4 4 +D_L08_001B27A8 4 +D_L08_001B27AC 4 +D_L08_001B27B8 4 +D_L08_001B27BC 4 +D_L08_001B2890 4 +D_L08_001B28B0 4 +D_L08_001B28B4 4 +D_L08_001B28B8 4 +D_L08_001B28BC 4 +D_L08_001B28C8 4 +D_L08_001B28D4 4 +D_L08_001B28D8 4 +D_L08_001B28E0 4 +D_L08_001B28E4 4 +D_L08_001B28E8 4 +D_L08_001B28EC 4 +D_L08_001B28F0 4 +D_L08_001B2908 4 +D_L08_001B2930 4 +D_L08_001B2934 4 +D_L08_001B2938 4 +D_L08_001B2974 4 +D_L08_001B2988 4 +D_L08_001B29A0 4 +D_L08_001BA5C8 4 +D_L08_001BA5D8 4 +D_L08_001BA5DC 4 +D_L08_001BA690 4 +D_L08_001CAC80 4 +D_L08_001CACC8 4 +D_L08_001CACD8 4 +D_L08_001CACE4 4 +D_L08_001CACE8 4 +D_L08_001CAD14 4 +D_L08_001CBBC4 4 +D_L08_001CBBC8 4 +D_L08_001CBBCC 4 +D_L08_001CBFCC 2 +D_L08_001CC0E0 4 D_L08_001CE0F0 3136 D_L08_001CED30 1568 D_L08_001CF350 784 @@ -3846,12 +4929,127 @@ D_L08_001D0820 800 D_L08_001D0B40 20 D_L08_001D0B58 20 D_L08_001D0E20 3840 +D_L08_001DB300 4 +D_L08_001DB304 4 +D_L08_001DB308 4 +D_L08_001DB30C 4 +D_L08_001DB310 4 +D_L08_001DB324 4 +D_L08_001DB338 4 +D_L08_001DB33C 4 +D_L08_001DB340 4 +D_L08_001DB344 4 +D_L08_001E93A0 4 +D_L08_001E93B0 4 +D_L08_001E93C0 4 +D_L08_001E93D0 4 D_L08_001ED720 4800 +D_L08_001EEAA8 2 D_L08_001FC250 79 +D_L09_0016706C 4 +D_L09_00167180 4 +D_L09_00167184 4 +D_L09_00167188 4 +D_L09_0016718C 4 +D_L09_00167190 4 D_L09_00169E00 880 D_L09_0016A1C0 2048 +D_L09_0016EBD8 4 +D_L09_00173F9C 4 +D_L09_00173FD4 4 +D_L09_00173FE4 4 +D_L09_001795CC 4 +D_L09_0017A8A2 2 +D_L09_0017A8A4 4 +D_L09_0017A8A8 4 +D_L09_0017A954 4 +D_L09_0017AA04 4 +D_L09_0017AAB4 4 +D_L09_0017AAE4 4 +D_L09_0017AB94 4 +D_L09_0017AE24 4 +D_L09_0017C4E0 4 +D_L09_0017C4E4 4 +D_L09_0017DDA0 4 +D_L09_0017DDC0 4 D_L09_001807C0 8192 +D_L09_00182960 8 +D_L09_00182968 8 +D_L09_00182978 8 +D_L09_0018459C 4 +D_L09_001845A0 4 +D_L09_001845F0 4 +D_L09_001845F4 4 +D_L09_001845F8 4 +D_L09_00184604 4 +D_L09_00184608 4 D_L09_00186EC0 32256 +D_L09_001B2004 4 +D_L09_001B2008 4 +D_L09_001B200C 4 +D_L09_001B2010 4 +D_L09_001B2014 4 +D_L09_001B2018 4 +D_L09_001B2020 4 +D_L09_001B2024 4 +D_L09_001B2028 4 +D_L09_001B202C 4 +D_L09_001B2034 4 +D_L09_001B203C 4 +D_L09_001B2040 4 +D_L09_001B2044 4 +D_L09_001B2048 4 +D_L09_001B2054 4 +D_L09_001B2058 4 +D_L09_001B205C 4 +D_L09_001B2060 4 +D_L09_001B2064 4 +D_L09_001B207C 4 +D_L09_001B2080 4 +D_L09_001B2084 4 +D_L09_001B2088 4 +D_L09_001B208C 4 +D_L09_001B2090 4 +D_L09_001B2094 4 +D_L09_001B2098 4 +D_L09_001B209C 4 +D_L09_001B20A0 4 +D_L09_001B20A4 4 +D_L09_001B20A8 4 +D_L09_001B20AC 4 +D_L09_001B20B0 4 +D_L09_001B20B4 4 +D_L09_001B20B8 4 +D_L09_001B20BC 4 +D_L09_001B20C0 4 +D_L09_001B20C4 4 +D_L09_001B20C8 4 +D_L09_001B20CC 4 +D_L09_001B20D4 4 +D_L09_001B20D8 4 +D_L09_001B20F0 4 +D_L09_001B2108 4 +D_L09_001B210C 4 +D_L09_001B2110 4 +D_L09_001B2114 4 +D_L09_001B2118 4 +D_L09_001B2134 4 +D_L09_001B2210 4 +D_L09_001B9F48 4 +D_L09_001B9F58 4 +D_L09_001B9F5C 4 +D_L09_001BA010 4 +D_L09_001CA600 4 +D_L09_001CA648 4 +D_L09_001CA658 4 +D_L09_001CA664 4 +D_L09_001CA668 4 +D_L09_001CA694 4 +D_L09_001CB544 4 +D_L09_001CB548 4 +D_L09_001CB54C 4 +D_L09_001CB94C 2 +D_L09_001CBA60 4 D_L09_001CDA70 3136 D_L09_001CE6B0 1568 D_L09_001CECD0 784 @@ -3864,6 +5062,7 @@ D_L09_001D04C0 20 D_L09_001D04D8 20 D_L09_001D07A0 3840 D_L09_00204100 4800 +D_L09_00205488 2 D_L09_00208B00 24 D_L09_00208B18 24 D_L09_00208F90 35 @@ -3884,10 +5083,86 @@ D_L10_00162028 4 D_L10_0016202C 4 D_L10_00162030 4 D_L10_0016204C 4 +D_L10_0016736C 4 +D_L10_00167490 4 D_L10_0016A100 880 D_L10_0016A4C0 2048 +D_L10_0016EED8 4 +D_L10_0017429C 4 +D_L10_0017ABA2 2 +D_L10_0017ABA4 4 +D_L10_0017ABA8 4 +D_L10_0017AC54 4 +D_L10_0017AD04 4 +D_L10_0017ADB4 4 +D_L10_0017ADE4 4 +D_L10_0017AE94 4 +D_L10_0017C7E0 4 +D_L10_0017C7E4 4 +D_L10_0017E0A0 4 +D_L10_0017E0C0 4 D_L10_00180AC0 8192 +D_L10_00182C60 8 +D_L10_00182C68 8 +D_L10_00182C78 8 +D_L10_0018489C 4 +D_L10_001848A0 4 +D_L10_001848F0 4 +D_L10_001848F4 4 +D_L10_001848F8 4 +D_L10_00184904 4 +D_L10_00184908 4 D_L10_001871C0 32256 +D_L10_001B23C0 4 +D_L10_001B23C4 4 +D_L10_001B23C8 4 +D_L10_001B23CC 4 +D_L10_001B23D0 4 +D_L10_001B23D4 4 +D_L10_001B23D8 4 +D_L10_001B23DC 4 +D_L10_001B23E0 4 +D_L10_001B23E4 4 +D_L10_001B23E8 4 +D_L10_001B23EC 4 +D_L10_001B23F0 4 +D_L10_001B23F4 4 +D_L10_001B2408 4 +D_L10_001B2428 4 +D_L10_001B242C 4 +D_L10_001B2430 4 +D_L10_001B2434 4 +D_L10_001B2438 4 +D_L10_001B243C 4 +D_L10_001B2514 4 +D_L10_001B2530 4 +D_L10_001B253C 4 +D_L10_001B2548 4 +D_L10_001B2554 4 +D_L10_001B2558 4 +D_L10_001B2560 4 +D_L10_001B2564 4 +D_L10_001B2568 4 +D_L10_001B256C 4 +D_L10_001B2570 4 +D_L10_001B2588 4 +D_L10_001B25B0 4 +D_L10_001B25B4 4 +D_L10_001B25B8 4 +D_L10_001B25D0 4 +D_L10_001B2608 4 +D_L10_001BA248 4 +D_L10_001BA258 4 +D_L10_001BA25C 4 +D_L10_001BA310 4 +D_L10_001CA900 4 +D_L10_001CA948 4 +D_L10_001CA958 4 +D_L10_001CA964 4 +D_L10_001CA968 4 +D_L10_001CA994 4 +D_L10_001CBC4C 2 +D_L10_001CBD60 4 D_L10_001CDD70 3136 D_L10_001CE9B0 1568 D_L10_001CEFD0 784 @@ -3899,7 +5174,13 @@ D_L10_001D04A0 800 D_L10_001D07C0 20 D_L10_001D07D8 20 D_L10_001D0AA0 3840 +D_L10_001D4060 4 +D_L10_001D4064 4 D_L10_001D7F00 4800 +D_L10_001D9288 2 +D_L10_001D9F20 4 +D_L10_001DA10C 4 +D_L10_001DA210 4 D_L10_001DD160 79 D_L11_0015F678 4 D_L11_0015F68C 4 @@ -3942,8 +5223,136 @@ D_L11_00162170 4 D_L11_001622C0 4 D_L11_0016A680 880 D_L11_0016AA40 2048 +D_L11_0016CAE0 4 +D_L11_0016CAE4 4 +D_L11_0016CAEC 4 +D_L11_0016CAF0 4 +D_L11_0016CAF4 4 +D_L11_00179B10 4 +D_L11_00179E4C 4 +D_L11_0017B194 4 +D_L11_0017B6A4 4 +D_L11_0017BD84 4 +D_L11_0017BD88 4 +D_L11_0017E620 4 D_L11_00181040 8192 +D_L11_001831E0 8 +D_L11_001831E8 8 +D_L11_001831F8 8 +D_L11_00184E1C 4 +D_L11_00184E20 4 +D_L11_00184E70 4 +D_L11_00184E74 4 +D_L11_00184E78 4 +D_L11_00184E84 4 +D_L11_00184E88 4 D_L11_00187740 32256 +D_L11_001B0620 4 +D_L11_001B0680 4 +D_L11_001B2888 4 +D_L11_001B288C 4 +D_L11_001B2890 4 +D_L11_001B2894 4 +D_L11_001B2898 4 +D_L11_001B289C 4 +D_L11_001B28A0 4 +D_L11_001B28A4 4 +D_L11_001B28A8 4 +D_L11_001B28AC 4 +D_L11_001B28B0 4 +D_L11_001B28B4 4 +D_L11_001B28B8 4 +D_L11_001B28BC 4 +D_L11_001B28C0 4 +D_L11_001B28C4 4 +D_L11_001B28C8 4 +D_L11_001B28CC 4 +D_L11_001B28D0 4 +D_L11_001B28D4 4 +D_L11_001B28D8 4 +D_L11_001B28DC 4 +D_L11_001B28E0 4 +D_L11_001B28E4 4 +D_L11_001B28E8 4 +D_L11_001B28EC 4 +D_L11_001B28F0 4 +D_L11_001B28F4 4 +D_L11_001B28F8 4 +D_L11_001B28FC 4 +D_L11_001B2900 4 +D_L11_001B2904 4 +D_L11_001B2908 4 +D_L11_001B290C 4 +D_L11_001B2910 4 +D_L11_001B2914 4 +D_L11_001B2918 4 +D_L11_001B291C 4 +D_L11_001B2920 4 +D_L11_001B2924 4 +D_L11_001B2928 4 +D_L11_001B292C 4 +D_L11_001B2930 4 +D_L11_001B2934 4 +D_L11_001B2938 4 +D_L11_001B293C 4 +D_L11_001B2940 4 +D_L11_001B2944 4 +D_L11_001B2948 4 +D_L11_001B294C 4 +D_L11_001B2950 4 +D_L11_001B2954 4 +D_L11_001B2958 4 +D_L11_001B295C 4 +D_L11_001B2960 4 +D_L11_001B2964 4 +D_L11_001B2968 4 +D_L11_001B296C 4 +D_L11_001B2970 4 +D_L11_001B2974 4 +D_L11_001B2978 4 +D_L11_001B297C 4 +D_L11_001B2980 4 +D_L11_001B2984 4 +D_L11_001B2988 4 +D_L11_001B298C 4 +D_L11_001B2990 4 +D_L11_001B2994 4 +D_L11_001B2998 4 +D_L11_001B299C 4 +D_L11_001B29A0 4 +D_L11_001B29A4 4 +D_L11_001B29A8 4 +D_L11_001B29AC 4 +D_L11_001B29B0 4 +D_L11_001B29B4 4 +D_L11_001B29B8 4 +D_L11_001B29BC 4 +D_L11_001B2AC8 4 +D_L11_001B2AD4 4 +D_L11_001B2AD8 4 +D_L11_001B2AE0 4 +D_L11_001B2AE4 4 +D_L11_001B2AE8 4 +D_L11_001B2AEC 4 +D_L11_001B2AF0 4 +D_L11_001B2B08 4 +D_L11_001B2B30 4 +D_L11_001B2B34 4 +D_L11_001B2B50 4 +D_L11_001B2B74 4 +D_L11_001B2B88 4 +D_L11_001CAE80 4 +D_L11_001CAEC8 4 +D_L11_001CAED8 4 +D_L11_001CAEE4 4 +D_L11_001CAEE8 4 +D_L11_001CAF14 4 +D_L11_001CB2C0 2 +D_L11_001CB320 2 +D_L11_001CB380 2 +D_L11_001CB560 4 +D_L11_001CC1CC 2 +D_L11_001CC2E0 4 D_L11_001CE2F0 3136 D_L11_001CEF30 1568 D_L11_001CF550 784 @@ -3955,7 +5364,17 @@ D_L11_001D0A20 800 D_L11_001D0D40 20 D_L11_001D0D58 20 D_L11_001D1020 3840 +D_L11_001D3574 4 +D_L11_001D3588 4 +D_L11_001D358C 4 +D_L11_001D3590 4 +D_L11_001D3594 4 +D_L11_001D3750 4 +D_L11_001D3760 4 +D_L11_001D3770 4 +D_L11_001D3780 4 D_L11_001D7AD0 4800 +D_L11_001D8E58 2 D_L11_0021B4C0 77 D_L11_0021B530 35 D_L12_0015F678 4 @@ -3978,10 +5397,97 @@ D_L12_00161A14 4 D_L12_00161A18 4 D_L12_00161A1C 4 D_L12_00161A20 4 +D_L12_0016736C 4 +D_L12_00167480 4 +D_L12_00167484 4 +D_L12_00167488 4 +D_L12_0016748C 4 +D_L12_00167490 4 D_L12_0016A100 880 D_L12_0016A4C0 2048 +D_L12_0016EED8 4 +D_L12_0017429C 4 +D_L12_00179590 4 +D_L12_001798CC 4 +D_L12_0017ABA2 2 +D_L12_0017ABA4 4 +D_L12_0017ABA8 4 +D_L12_0017AC54 4 +D_L12_0017AD04 4 +D_L12_0017AD70 4 +D_L12_0017ADB4 4 +D_L12_0017ADE4 4 +D_L12_0017AE94 4 +D_L12_0017C7E0 4 +D_L12_0017C7E4 4 +D_L12_0017E0A0 4 +D_L12_0017E984 4 D_L12_00180AC0 8192 +D_L12_00182C60 8 +D_L12_00182C68 8 +D_L12_00182C78 8 +D_L12_0018489C 4 +D_L12_001848A0 4 +D_L12_001848F0 4 +D_L12_001848F4 4 +D_L12_001848F8 4 +D_L12_00184904 4 +D_L12_00184908 4 D_L12_001871C0 32256 +D_L12_001B23C0 4 +D_L12_001B23C4 4 +D_L12_001B23C8 4 +D_L12_001B23CC 4 +D_L12_001B23D0 4 +D_L12_001B23D4 4 +D_L12_001B23D8 4 +D_L12_001B23DC 4 +D_L12_001B23E0 4 +D_L12_001B23E4 4 +D_L12_001B23E8 4 +D_L12_001B23EC 4 +D_L12_001B23F0 4 +D_L12_001B23F4 4 +D_L12_001B2408 4 +D_L12_001B2428 4 +D_L12_001B242C 4 +D_L12_001B2430 4 +D_L12_001B2434 4 +D_L12_001B2438 4 +D_L12_001B243C 4 +D_L12_001B2514 4 +D_L12_001B2530 4 +D_L12_001B253C 4 +D_L12_001B2548 4 +D_L12_001B2554 4 +D_L12_001B2558 4 +D_L12_001B2560 4 +D_L12_001B2564 4 +D_L12_001B2568 4 +D_L12_001B256C 4 +D_L12_001B2570 4 +D_L12_001B2588 4 +D_L12_001B25B0 4 +D_L12_001B25B4 4 +D_L12_001B25D0 4 +D_L12_001B2608 4 +D_L12_001B2620 4 +D_L12_001B2624 4 +D_L12_001BA248 4 +D_L12_001BA258 4 +D_L12_001BA25C 4 +D_L12_001BA310 4 +D_L12_001CA900 4 +D_L12_001CA948 4 +D_L12_001CA958 4 +D_L12_001CA964 4 +D_L12_001CA968 4 +D_L12_001CA994 4 +D_L12_001CADA0 2 +D_L12_001CAE00 2 +D_L12_001CAFE0 4 +D_L12_001CBC4C 2 +D_L12_001CBD60 4 D_L12_001E0990 3136 D_L12_001E15D0 1568 D_L12_001E1BF0 784 @@ -3993,7 +5499,19 @@ D_L12_001E30C0 800 D_L12_001E33E0 20 D_L12_001E33F8 20 D_L12_001E36C0 3840 +D_L12_001F5B60 4 +D_L12_001F5B64 4 +D_L12_001F5B68 4 +D_L12_001F5B6C 4 +D_L12_001F5B70 4 +D_L12_001F5B84 4 +D_L12_001F5B98 4 +D_L12_001F5B9C 4 +D_L12_001F5BA0 4 +D_L12_001F5BA4 4 D_L12_001F94A0 4800 +D_L12_001FA828 2 +D_L12_001FB6CC 4 D_L13_0016138C 4 D_L13_001613A0 2 D_L13_001613C0 4 @@ -4022,10 +5540,95 @@ D_L13_00161EB0 4 D_L13_00161EB4 4 D_L13_00161EEC 4 D_L13_00161EF0 4 +D_L13_001671EC 4 D_L13_00169F80 880 D_L13_0016A340 2048 +D_L13_0016CB9C 4 +D_L13_0016ED58 4 +D_L13_0017411C 4 +D_L13_0017AA24 4 +D_L13_0017AA28 4 +D_L13_0017AAD4 4 +D_L13_0017AB84 4 +D_L13_0017AC34 4 +D_L13_0017AC64 4 +D_L13_0017AD14 4 +D_L13_0017AFA4 4 +D_L13_0017B684 4 +D_L13_0017B688 4 +D_L13_0017C660 4 +D_L13_0017C664 4 +D_L13_0017DF20 4 +D_L13_0017DF40 4 D_L13_00180940 8192 +D_L13_00182AE0 8 +D_L13_00182AE8 8 +D_L13_00182AF8 8 +D_L13_0018471C 4 +D_L13_00184720 4 +D_L13_00184770 4 +D_L13_00184774 4 +D_L13_00184778 4 +D_L13_00184784 4 +D_L13_00184788 4 D_L13_00187040 32256 +D_L13_001B2184 4 +D_L13_001B2188 4 +D_L13_001B2190 4 +D_L13_001B2198 4 +D_L13_001B21A8 4 +D_L13_001B21AC 4 +D_L13_001B21B0 4 +D_L13_001B21B4 4 +D_L13_001B21B8 4 +D_L13_001B21BC 4 +D_L13_001B21C0 4 +D_L13_001B21C4 4 +D_L13_001B21C8 4 +D_L13_001B21CC 4 +D_L13_001B21D4 4 +D_L13_001B21D8 4 +D_L13_001B21F0 4 +D_L13_001B220C 4 +D_L13_001B2210 4 +D_L13_001B23C8 4 +D_L13_001B23D4 4 +D_L13_001B23D8 4 +D_L13_001B23E0 4 +D_L13_001B23E4 4 +D_L13_001B23E8 4 +D_L13_001B23EC 4 +D_L13_001B23F0 4 +D_L13_001B23F4 4 +D_L13_001B2408 4 +D_L13_001B2430 4 +D_L13_001B2434 4 +D_L13_001B2438 4 +D_L13_001B2448 4 +D_L13_001B244C 4 +D_L13_001B2450 4 +D_L13_001B2474 4 +D_L13_001B2488 4 +D_L13_001BA0C8 4 +D_L13_001BA0D8 4 +D_L13_001BA0DC 4 +D_L13_001BA190 4 +D_L13_001CA780 4 +D_L13_001CA7C8 4 +D_L13_001CA7D8 4 +D_L13_001CA7E4 4 +D_L13_001CA814 4 +D_L13_001CABA8 4 +D_L13_001CABAC 4 +D_L13_001CABB0 4 +D_L13_001CABB4 4 +D_L13_001CABB8 4 +D_L13_001CABC0 2 +D_L13_001CAC20 2 +D_L13_001CAC80 2 +D_L13_001CAE60 4 +D_L13_001CBACC 2 +D_L13_001CBBE0 4 D_L13_001CE200 3136 D_L13_001CEE40 1568 D_L13_001CF460 784 @@ -4037,12 +5640,18 @@ D_L13_001D0930 800 D_L13_001D0C50 20 D_L13_001D0C68 20 D_L13_001D0F30 3840 +D_L13_001D3780 4 +D_L13_001D3790 4 +D_L13_001D37A0 4 +D_L13_001D37B0 4 D_L13_001D7B00 4800 +D_L13_001D8E88 2 D_L13_001D9B70 32 D_L13_001F4950 24 D_L13_001F4968 24 D_L13_001F4D90 26 D_L13_001F4DB0 26 +D_L13_001F4F38 25 D_L13_001F5590 43 D_L14_0015F678 4 D_L14_0015F68C 4 @@ -4050,10 +5659,159 @@ D_L14_0015F6D8 16 D_L14_0015F6E8 12 D_L14_00161A3C 4 D_L14_00161FA4 4 +D_L14_001675EC 4 D_L14_0016A380 880 D_L14_0016A740 2048 +D_L14_0016C7E0 4 +D_L14_0016C7E4 4 +D_L14_0016C7EC 4 +D_L14_0016C7F0 4 +D_L14_0016C7F4 4 +D_L14_0016CF9C 4 +D_L14_0016F158 4 +D_L14_0017451C 4 +D_L14_00174554 4 +D_L14_00179810 4 +D_L14_00179B4C 4 +D_L14_0017AE24 4 +D_L14_0017AE28 4 +D_L14_0017AED4 4 +D_L14_0017AF84 4 +D_L14_0017AFF0 4 +D_L14_0017B034 4 +D_L14_0017B064 4 +D_L14_0017B114 4 +D_L14_0017B3A4 4 +D_L14_0017BA84 4 +D_L14_0017BA88 4 +D_L14_0017CA60 4 +D_L14_0017CA64 4 +D_L14_0017CB60 4 +D_L14_0017CB64 4 +D_L14_0017E320 4 +D_L14_0017EC04 4 +D_L14_0017EC18 4 +D_L14_0017EC1C 4 D_L14_00180D40 8192 +D_L14_00182EE0 8 +D_L14_00182EE8 8 +D_L14_00182EF8 8 +D_L14_00184B1C 4 +D_L14_00184B20 4 +D_L14_00184B70 4 +D_L14_00184B74 4 +D_L14_00184B78 4 +D_L14_00184B84 4 +D_L14_00184B88 4 D_L14_00187440 32256 +D_L14_001B0320 4 +D_L14_001B0380 4 +D_L14_001B2584 4 +D_L14_001B2588 4 +D_L14_001B258C 4 +D_L14_001B2590 4 +D_L14_001B2594 4 +D_L14_001B2598 4 +D_L14_001B259C 4 +D_L14_001B25A0 4 +D_L14_001B25A4 4 +D_L14_001B25A8 4 +D_L14_001B25AC 4 +D_L14_001B25B0 4 +D_L14_001B25B4 4 +D_L14_001B25B8 4 +D_L14_001B25BC 4 +D_L14_001B25C0 4 +D_L14_001B25C4 4 +D_L14_001B25C8 4 +D_L14_001B25CC 4 +D_L14_001B25D0 4 +D_L14_001B25D4 4 +D_L14_001B25D8 4 +D_L14_001B25DC 4 +D_L14_001B25E0 4 +D_L14_001B25E4 4 +D_L14_001B25E8 4 +D_L14_001B25EC 4 +D_L14_001B25F0 4 +D_L14_001B25F8 4 +D_L14_001B2604 4 +D_L14_001B2608 4 +D_L14_001B260C 4 +D_L14_001B2610 4 +D_L14_001B2614 4 +D_L14_001B2618 4 +D_L14_001B261C 4 +D_L14_001B2620 4 +D_L14_001B2624 4 +D_L14_001B2628 4 +D_L14_001B262C 4 +D_L14_001B2630 4 +D_L14_001B2634 4 +D_L14_001B2638 4 +D_L14_001B263C 4 +D_L14_001B2640 4 +D_L14_001B2644 4 +D_L14_001B2648 4 +D_L14_001B264C 4 +D_L14_001B2650 4 +D_L14_001B2654 4 +D_L14_001B2658 4 +D_L14_001B265C 4 +D_L14_001B2660 4 +D_L14_001B2664 4 +D_L14_001B2668 4 +D_L14_001B266C 4 +D_L14_001B2670 4 +D_L14_001B2674 4 +D_L14_001B2688 4 +D_L14_001B268C 4 +D_L14_001B2690 4 +D_L14_001B2694 4 +D_L14_001B2698 4 +D_L14_001B269C 4 +D_L14_001B26A0 4 +D_L14_001B26A4 4 +D_L14_001B26A8 4 +D_L14_001B26AC 4 +D_L14_001B26B0 4 +D_L14_001B26B4 4 +D_L14_001B26B8 4 +D_L14_001B26BC 4 +D_L14_001B278C 4 +D_L14_001B2790 4 +D_L14_001B2794 4 +D_L14_001B27BC 4 +D_L14_001B27D4 4 +D_L14_001B27D8 4 +D_L14_001B27E0 4 +D_L14_001B27E4 4 +D_L14_001B27E8 4 +D_L14_001B27EC 4 +D_L14_001B27F0 4 +D_L14_001B2808 4 +D_L14_001B2830 4 +D_L14_001B2848 4 +D_L14_001B2874 4 +D_L14_001B2880 4 +D_L14_001B2888 4 +D_L14_001B2894 4 +D_L14_001B28A0 4 +D_L14_001B28A4 4 +D_L14_001BA4C8 4 +D_L14_001BA4D8 4 +D_L14_001BA4DC 4 +D_L14_001BA590 4 +D_L14_001CAB80 4 +D_L14_001CABC8 4 +D_L14_001CABD8 4 +D_L14_001CABE4 4 +D_L14_001CABE8 4 +D_L14_001CAC14 4 +D_L14_001CBAC4 4 +D_L14_001CBAC8 4 +D_L14_001CBACC 4 +D_L14_001CBECC 2 D_L14_001CBEE0 19200 D_L14_001D09E0 4800 D_L14_001D1CA0 4800 @@ -4066,6 +5824,7 @@ D_L14_001D67A0 2400 D_L14_001D7100 2400 D_L14_001D8600 64 D_L14_001D8640 64 +D_L14_001D87D0 4 D_L14_001DA8B0 3136 D_L14_001DB4F0 1568 D_L14_001DBB10 784 @@ -4078,8 +5837,25 @@ D_L14_001DD300 20 D_L14_001DD318 20 D_L14_001DD5E0 3840 D_L14_001DE540 64 +D_L14_001DFB50 4 +D_L14_001DFB54 4 +D_L14_001DFB58 4 +D_L14_001DFB5C 4 +D_L14_001DFB60 4 +D_L14_001DFB74 4 +D_L14_001DFB88 4 +D_L14_001DFB8C 4 +D_L14_001DFB90 4 +D_L14_001DFB94 4 D_L14_001DFD40 64 +D_L14_001E0050 768 +D_L14_001E0350 96 +D_L14_001E04D0 4 +D_L14_001E0510 4 D_L14_001E3FB0 4800 +D_L14_001E5338 2 +D_L14_001FBD50 39 +D_L14_001FBD78 39 D_L14_001FBDF0 38 D_L14_001FBE18 57 D_L14_001FBE58 38 @@ -4136,10 +5912,147 @@ D_L15_00162250 4 D_L15_00162254 4 D_L15_00162258 4 D_L15_0016225C 4 +D_L15_001674EC 4 +D_L15_00167600 4 +D_L15_00167604 4 +D_L15_00167608 4 +D_L15_0016760C 4 +D_L15_00167610 4 D_L15_0016A280 880 D_L15_0016A640 2048 +D_L15_0016F058 4 +D_L15_0017441C 4 +D_L15_00179710 4 +D_L15_0017AD24 4 +D_L15_0017AD28 4 +D_L15_0017AD94 4 +D_L15_0017ADD4 4 +D_L15_0017AE84 4 +D_L15_0017AF34 4 +D_L15_0017AF64 4 +D_L15_0017B014 4 +D_L15_0017B2A4 4 +D_L15_0017B984 4 +D_L15_0017B988 4 +D_L15_0017C960 4 +D_L15_0017C964 4 +D_L15_0017CA60 4 +D_L15_0017CA64 4 +D_L15_0017E220 4 +D_L15_0017EB04 4 +D_L15_0017EB18 4 +D_L15_0017EB1C 4 D_L15_00180C40 8192 +D_L15_00182DE0 8 +D_L15_00182DE8 8 +D_L15_00182DF8 8 +D_L15_00184A1C 4 +D_L15_00184A20 4 +D_L15_00184A70 4 +D_L15_00184A74 4 +D_L15_00184A78 4 +D_L15_00184A84 4 +D_L15_00184A88 4 D_L15_00187340 32256 +D_L15_001B0220 4 +D_L15_001B0280 4 +D_L15_001B2484 4 +D_L15_001B2488 4 +D_L15_001B24A4 4 +D_L15_001B24A8 4 +D_L15_001B24AC 4 +D_L15_001B24B0 4 +D_L15_001B24B4 4 +D_L15_001B24B8 4 +D_L15_001B24BC 4 +D_L15_001B24C0 4 +D_L15_001B24C4 4 +D_L15_001B24C8 4 +D_L15_001B24CC 4 +D_L15_001B24D0 4 +D_L15_001B24D4 4 +D_L15_001B24D8 4 +D_L15_001B24DC 4 +D_L15_001B24E0 4 +D_L15_001B24E4 4 +D_L15_001B24E8 4 +D_L15_001B24EC 4 +D_L15_001B24F0 4 +D_L15_001B24F4 4 +D_L15_001B24F8 4 +D_L15_001B2504 4 +D_L15_001B2508 4 +D_L15_001B2514 4 +D_L15_001B2520 4 +D_L15_001B2524 4 +D_L15_001B2528 4 +D_L15_001B252C 4 +D_L15_001B2530 4 +D_L15_001B2534 4 +D_L15_001B2538 4 +D_L15_001B253C 4 +D_L15_001B2540 4 +D_L15_001B2544 4 +D_L15_001B2548 4 +D_L15_001B254C 4 +D_L15_001B2550 4 +D_L15_001B2554 4 +D_L15_001B2558 4 +D_L15_001B255C 4 +D_L15_001B2560 4 +D_L15_001B2564 4 +D_L15_001B2568 4 +D_L15_001B256C 4 +D_L15_001B2570 4 +D_L15_001B2574 4 +D_L15_001B2578 4 +D_L15_001B2584 4 +D_L15_001B2588 4 +D_L15_001B258C 4 +D_L15_001B2590 4 +D_L15_001B2594 4 +D_L15_001B2598 4 +D_L15_001B259C 4 +D_L15_001B25A0 4 +D_L15_001B25A4 4 +D_L15_001B25A8 4 +D_L15_001B25AC 4 +D_L15_001B25B0 4 +D_L15_001B25B4 4 +D_L15_001B25B8 4 +D_L15_001B25BC 4 +D_L15_001B2690 4 +D_L15_001B26B0 4 +D_L15_001B26B4 4 +D_L15_001B26B8 4 +D_L15_001B26BC 4 +D_L15_001B26C8 4 +D_L15_001B26D4 4 +D_L15_001B26D8 4 +D_L15_001B26E0 4 +D_L15_001B26E4 4 +D_L15_001B26E8 4 +D_L15_001B26EC 4 +D_L15_001B26F0 4 +D_L15_001B26F4 4 +D_L15_001B2708 4 +D_L15_001B2730 4 +D_L15_001B2734 4 +D_L15_001B2738 4 +D_L15_001B2788 4 +D_L15_001B2794 4 +D_L15_001BA3C8 4 +D_L15_001BA3D8 4 +D_L15_001BA3DC 4 +D_L15_001BA490 4 +D_L15_001CAA80 4 +D_L15_001CAAC8 4 +D_L15_001CAAD8 4 +D_L15_001CAAE4 4 +D_L15_001CAAE8 4 +D_L15_001CAB14 4 +D_L15_001CBDCC 2 +D_L15_001CBEE0 4 D_L15_001CE370 3136 D_L15_001CEFB0 1568 D_L15_001CF5D0 784 @@ -4147,11 +6060,28 @@ D_L15_001CF8E0 64 D_L15_001CF920 64 D_L15_001CF960 32 D_L15_001CF980 2352 +D_L15_001D034C 4 D_L15_001D0AA0 800 D_L15_001D0DC0 20 D_L15_001D0DD8 20 D_L15_001D10A0 3840 D_L15_001D74D0 4800 +D_L15_001D8858 2 +D_L15_001DDBA0 816 +D_L15_001DDED0 544 +D_L15_001DE200 816 +D_L15_001DE530 544 +D_L15_001DE750 272 +D_L15_001DE860 552 +D_L15_001DEA88 368 +D_L15_001DECB0 552 +D_L15_001DEED8 368 +D_L15_001DF048 184 +D_L15_001DF100 1056 +D_L15_001DF520 704 +D_L15_001DF940 1056 +D_L15_001DFD60 704 +D_L15_001E0020 352 D_L16_0015F678 4 D_L16_0015F68C 4 D_L16_0015F6E8 16 @@ -4192,10 +6122,96 @@ D_L16_00161FE8 16 D_L16_00161FF8 16 D_L16_00162008 16 D_L16_00162018 16 +D_L16_001672EC 4 +D_L16_00167400 4 +D_L16_00167404 4 +D_L16_00167408 4 +D_L16_0016740C 4 +D_L16_00167410 4 D_L16_0016A080 880 D_L16_0016A440 2048 +D_L16_0016CDE4 4 +D_L16_0016EE58 4 +D_L16_0017421C 4 +D_L16_00179510 4 +D_L16_0017984C 4 +D_L16_0017AB82 2 +D_L16_0017AB84 4 +D_L16_0017AB88 4 +D_L16_0017ABF4 4 +D_L16_0017AC34 4 +D_L16_0017ACE4 4 +D_L16_0017AD50 4 +D_L16_0017AD94 4 +D_L16_0017ADC4 4 +D_L16_0017AE74 4 +D_L16_0017B7E4 4 +D_L16_0017B7E8 4 +D_L16_0017C7C0 4 +D_L16_0017C7C4 4 +D_L16_0017E0A0 4 +D_L16_0017E984 4 D_L16_00180AC0 8192 +D_L16_00182C60 8 +D_L16_00182C68 8 +D_L16_00182C78 8 +D_L16_0018489C 4 +D_L16_001848A0 4 +D_L16_001848F0 4 +D_L16_001848F4 4 +D_L16_001848F8 4 +D_L16_00184904 4 +D_L16_00184908 4 D_L16_001871C0 32256 +D_L16_001B23C0 4 +D_L16_001B23C4 4 +D_L16_001B23C8 4 +D_L16_001B23CC 4 +D_L16_001B23D0 4 +D_L16_001B23D4 4 +D_L16_001B23D8 4 +D_L16_001B23DC 4 +D_L16_001B23E0 4 +D_L16_001B23E4 4 +D_L16_001B23E8 4 +D_L16_001B23EC 4 +D_L16_001B23F0 4 +D_L16_001B23F4 4 +D_L16_001B2408 4 +D_L16_001B2428 4 +D_L16_001B242C 4 +D_L16_001B2430 4 +D_L16_001B2434 4 +D_L16_001B2438 4 +D_L16_001B243C 4 +D_L16_001B2514 4 +D_L16_001B2530 4 +D_L16_001B253C 4 +D_L16_001B2548 4 +D_L16_001B2554 4 +D_L16_001B2558 4 +D_L16_001B2560 4 +D_L16_001B2564 4 +D_L16_001B2568 4 +D_L16_001B256C 4 +D_L16_001B2570 4 +D_L16_001B2588 4 +D_L16_001B25B0 4 +D_L16_001B25B4 4 +D_L16_001B25B8 4 +D_L16_001B2608 4 +D_L16_001BA248 4 +D_L16_001BA258 4 +D_L16_001BA25C 4 +D_L16_001BA310 4 +D_L16_001CA900 4 +D_L16_001CA948 4 +D_L16_001CA958 4 +D_L16_001CA964 4 +D_L16_001CA968 4 +D_L16_001CA994 4 +D_L16_001CBC4C 2 +D_L16_001CBD60 4 D_L16_001CDD70 3136 D_L16_001CE9B0 1568 D_L16_001CEFD0 784 @@ -4209,6 +6225,19 @@ D_L16_001D07D8 20 D_L16_001D0AA0 3840 D_L16_001D3130 64 D_L16_001D69F0 4800 +D_L16_001D7D78 2 +D_L16_001D8A28 4 +D_L16_001D8A2C 4 +D_L16_001D8A30 4 +D_L16_001D8A34 4 +D_L16_001D8A38 4 +D_L16_001D8A3C 4 +D_L16_001D8D28 4 +D_L16_001D8D2C 4 +D_L16_001D9230 4 +D_L16_001D9234 4 +D_L16_001D9238 4 +D_L16_001D923C 4 D_L16_001D96C0 32 D_L17_0015F678 4 D_L17_0015F68C 4 @@ -4268,8 +6297,133 @@ D_L17_00162450 8 D_L17_00162458 8 D_L17_0016A580 880 D_L17_0016A940 2048 +D_L17_0016C964 4 +D_L17_0016D19C 4 +D_L17_0016F358 4 +D_L17_0017B024 4 +D_L17_0017B028 4 +D_L17_0017B1F0 4 +D_L17_0017B264 4 +D_L17_0017B314 4 +D_L17_0017BC84 4 +D_L17_0017BC88 4 +D_L17_0017CC60 4 +D_L17_0017CC64 4 +D_L17_0017E520 4 +D_L17_0017E540 4 +D_L17_0017EE18 4 +D_L17_0017EE1C 4 D_L17_00180F40 8192 +D_L17_001830E0 8 +D_L17_001830E8 8 +D_L17_001830F8 8 +D_L17_00184D1C 4 +D_L17_00184D20 4 +D_L17_00184D70 4 +D_L17_00184D74 4 +D_L17_00184D78 4 +D_L17_00184D84 4 +D_L17_00184D88 4 D_L17_00187640 32256 +D_L17_001B0520 4 +D_L17_001B0580 4 +D_L17_001B2784 4 +D_L17_001B2788 4 +D_L17_001B278C 4 +D_L17_001B2790 4 +D_L17_001B2794 4 +D_L17_001B27A0 4 +D_L17_001B27A4 4 +D_L17_001B27A8 4 +D_L17_001B27AC 4 +D_L17_001B27B8 4 +D_L17_001B27BC 4 +D_L17_001B27C0 4 +D_L17_001B27C4 4 +D_L17_001B27D0 4 +D_L17_001B27D4 4 +D_L17_001B27D8 4 +D_L17_001B27DC 4 +D_L17_001B27E0 4 +D_L17_001B27E4 4 +D_L17_001B27E8 4 +D_L17_001B27EC 4 +D_L17_001B27F0 4 +D_L17_001B27F4 4 +D_L17_001B27F8 4 +D_L17_001B27FC 4 +D_L17_001B2808 4 +D_L17_001B280C 4 +D_L17_001B2810 4 +D_L17_001B2814 4 +D_L17_001B2820 4 +D_L17_001B2824 4 +D_L17_001B2828 4 +D_L17_001B282C 4 +D_L17_001B2830 4 +D_L17_001B2834 4 +D_L17_001B2838 4 +D_L17_001B283C 4 +D_L17_001B2840 4 +D_L17_001B2844 4 +D_L17_001B2848 4 +D_L17_001B284C 4 +D_L17_001B2850 4 +D_L17_001B2854 4 +D_L17_001B2858 4 +D_L17_001B285C 4 +D_L17_001B2860 4 +D_L17_001B2864 4 +D_L17_001B2868 4 +D_L17_001B286C 4 +D_L17_001B2870 4 +D_L17_001B2874 4 +D_L17_001B2878 4 +D_L17_001B287C 4 +D_L17_001B2880 4 +D_L17_001B2888 4 +D_L17_001B288C 4 +D_L17_001B2890 4 +D_L17_001B2894 4 +D_L17_001B2898 4 +D_L17_001B289C 4 +D_L17_001B28A0 4 +D_L17_001B28A4 4 +D_L17_001B28A8 4 +D_L17_001B28AC 4 +D_L17_001B28B0 4 +D_L17_001B28B4 4 +D_L17_001B28B8 4 +D_L17_001B28BC 4 +D_L17_001B2990 4 +D_L17_001B29B0 4 +D_L17_001B29B4 4 +D_L17_001B29B8 4 +D_L17_001B29BC 4 +D_L17_001B29C8 4 +D_L17_001B29D4 4 +D_L17_001B29D8 4 +D_L17_001B29E0 4 +D_L17_001B29E4 4 +D_L17_001B29E8 4 +D_L17_001B29EC 4 +D_L17_001B29F0 4 +D_L17_001B2A08 4 +D_L17_001B2A30 4 +D_L17_001B2A34 4 +D_L17_001B2A38 4 +D_L17_001B2A70 4 +D_L17_001B2A88 4 +D_L17_001BA6C8 4 +D_L17_001BA6D8 4 +D_L17_001CAD80 4 +D_L17_001CADC8 4 +D_L17_001CADD8 4 +D_L17_001CADE4 4 +D_L17_001CADE8 4 +D_L17_001CAE14 4 +D_L17_001CC0CC 2 +D_L17_001CC1E0 4 D_L17_001CE5F0 3136 D_L17_001CF230 1568 D_L17_001CF850 784 @@ -4282,6 +6436,17 @@ D_L17_001D1040 20 D_L17_001D1058 20 D_L17_001D1320 3840 D_L17_001D77F0 4800 +D_L17_001D8B78 2 +D_L17_001DD100 4 +D_L17_001DD104 4 +D_L17_001DD320 4 +D_L17_001DD328 4 +D_L17_001DD6A8 4 +D_L17_001DD760 540 +D_L17_001DD980 360 +D_L17_001DDBA0 540 +D_L17_001DDDC0 360 +D_L17_001DDF28 180 D_L17_001E6E38 54 D_L18_0015F678 4 D_L18_0015F68C 4 @@ -4298,8 +6463,128 @@ D_L18_00161A38 4 D_L18_00161A3C 4 D_L18_0016A680 880 D_L18_0016AA40 2048 +D_L18_0016CAE0 4 +D_L18_0016CAE4 4 +D_L18_0016CAEC 4 +D_L18_0016CAF0 4 +D_L18_0016CAF4 4 +D_L18_0017B194 4 +D_L18_0017B6A4 4 +D_L18_0017BD84 4 +D_L18_0017BD88 4 +D_L18_0017E620 4 D_L18_00181040 8192 +D_L18_00184E1C 4 +D_L18_00184E20 4 +D_L18_00184E70 4 +D_L18_00184E74 4 +D_L18_00184E78 4 +D_L18_00184E84 4 +D_L18_00184E88 4 D_L18_00187740 32256 +D_L18_001B2888 4 +D_L18_001B288C 4 +D_L18_001B2890 4 +D_L18_001B2894 4 +D_L18_001B2898 4 +D_L18_001B289C 4 +D_L18_001B28A0 4 +D_L18_001B28A4 4 +D_L18_001B28A8 4 +D_L18_001B28AC 4 +D_L18_001B28B0 4 +D_L18_001B28B4 4 +D_L18_001B28B8 4 +D_L18_001B28BC 4 +D_L18_001B28C0 4 +D_L18_001B28C4 4 +D_L18_001B28C8 4 +D_L18_001B28CC 4 +D_L18_001B28D0 4 +D_L18_001B28D4 4 +D_L18_001B28D8 4 +D_L18_001B28DC 4 +D_L18_001B28E0 4 +D_L18_001B28E4 4 +D_L18_001B28E8 4 +D_L18_001B28EC 4 +D_L18_001B28F0 4 +D_L18_001B28F4 4 +D_L18_001B28F8 4 +D_L18_001B28FC 4 +D_L18_001B2900 4 +D_L18_001B2904 4 +D_L18_001B2908 4 +D_L18_001B290C 4 +D_L18_001B2910 4 +D_L18_001B2914 4 +D_L18_001B2918 4 +D_L18_001B291C 4 +D_L18_001B2920 4 +D_L18_001B2924 4 +D_L18_001B2928 4 +D_L18_001B292C 4 +D_L18_001B2930 4 +D_L18_001B2934 4 +D_L18_001B2938 4 +D_L18_001B293C 4 +D_L18_001B2940 4 +D_L18_001B2944 4 +D_L18_001B2948 4 +D_L18_001B294C 4 +D_L18_001B2950 4 +D_L18_001B2954 4 +D_L18_001B2958 4 +D_L18_001B295C 4 +D_L18_001B2960 4 +D_L18_001B2964 4 +D_L18_001B2968 4 +D_L18_001B296C 4 +D_L18_001B2970 4 +D_L18_001B2974 4 +D_L18_001B2978 4 +D_L18_001B297C 4 +D_L18_001B2980 4 +D_L18_001B2984 4 +D_L18_001B2988 4 +D_L18_001B298C 4 +D_L18_001B2990 4 +D_L18_001B2994 4 +D_L18_001B2998 4 +D_L18_001B299C 4 +D_L18_001B29A0 4 +D_L18_001B29A4 4 +D_L18_001B29A8 4 +D_L18_001B29AC 4 +D_L18_001B29B0 4 +D_L18_001B29B4 4 +D_L18_001B29B8 4 +D_L18_001B29BC 4 +D_L18_001B2A90 4 +D_L18_001B2AB0 4 +D_L18_001B2ABC 4 +D_L18_001B2AC8 4 +D_L18_001B2AD4 4 +D_L18_001B2AD8 4 +D_L18_001B2AE0 4 +D_L18_001B2AE4 4 +D_L18_001B2AE8 4 +D_L18_001B2AEC 4 +D_L18_001B2AF0 4 +D_L18_001B2B08 4 +D_L18_001B2B30 4 +D_L18_001B2B34 4 +D_L18_001B2B38 4 +D_L18_001B2B74 4 +D_L18_001B2B88 4 +D_L18_001CAE80 4 +D_L18_001CAEC8 4 +D_L18_001CAED8 4 +D_L18_001CAEE4 4 +D_L18_001CAEE8 4 +D_L18_001CAF14 4 +D_L18_001CC1CC 2 +D_L18_001CC2E0 4 D_L18_001CE2F0 3136 D_L18_001CEF30 1568 D_L18_001CF550 784 @@ -4313,7 +6598,12 @@ D_L18_001D0D58 20 D_L18_001D1020 3840 D_L18_001D3630 64 D_L18_001D3670 32 +D_L18_001D3770 4 +D_L18_001D3780 4 +D_L18_001D3790 4 +D_L18_001D37A0 4 D_L18_001D7B30 4800 +D_L18_001D8EB8 2 D_L18_001DA350 32 D_L18_001DFB90 64 D_L18_001F0ED0 41 diff --git a/config/us/rnc1.us.yaml b/config/us/rnc1.us.yaml index b61a515cfd..0b89d65c77 100644 --- a/config/us/rnc1.us.yaml +++ b/config/us/rnc1.us.yaml @@ -650,7 +650,7 @@ segments: - [0x2ac6c, textbin, text_gap_00129b60_post_sdk_worker] - [0x2ac70, c, sdk/library/_dispRefImage] - [0x2ad80, c, sdk/library/disprefimagefield] - - [0x2af38, c, assembly/sdk/dma/dma_ref_image] + - [0x2af38, c, sdk/dma/dma_ref_image] - [0x2b0a4, textbin, text_gap_00129fb8_post_sdk_worker] - [0x2b0a8, c, sdk/dma/receive_data_from_ipu] - [0x2b12c, textbin, text_gap_0012a128_post_sdk_worker] diff --git a/configure.py b/configure.py index b6393e9ad8..e0703fb833 100755 --- a/configure.py +++ b/configure.py @@ -1677,6 +1677,33 @@ def rewrite(match: re.Match[str]) -> str: fixed += 1 return fixed +def fix_mirror_symbols(asm_root: Path) -> int: + """Write splat's ``%lo(D_2xxxxxxx)`` / ``%hi(...)`` operands as immediates. + + Code that ORs 0x20000000 into a RAM address (the uncached mirror) gets the + sum paired into a symbol, e.g. ``addiu $10, $10, %lo(D_20000020)`` for a + plain pointer step of 0x20. No symbol lives there; the relocation only + makes objdiff reject a compiler object that emits the bare immediate. + The same words are written the way splat spells its other immediates. + """ + pattern = re.compile(r"%(?Plo|hi)\(D_(?P[23][0-9A-F]{7})\)") + + def rewrite(match: re.Match[str]) -> str: + if int(match.group("addr"), 16) & 0x8000: + return match.group(0) # a negative %lo: leave the pair to splat + if match.group("op") == "lo": + return f"(0x{match.group('addr')} & 0xFFFF)" + return f"(0x{match.group('addr')} >> 16)" + + fixed = 0 + for asm_file in asm_root.rglob("*.s"): + text = asm_file.read_text() + updated = pattern.sub(rewrite, text) + if updated != text: + asm_file.write_text(updated) + fixed += 1 + return fixed + def make_asm(config_path: Path, config: dict[str, Any]): with tempfile.TemporaryDirectory(dir=config_path, prefix="tmp_") as tmp_dir: tmp_path = Path(tmp_dir) @@ -1740,6 +1767,9 @@ def make_asm(config_path: Path, config: dict[str, Any]): rewritten = fix_gp_rel_stores(dst_path) if rewritten: print(f"normalized gp-relative stores in {rewritten} expected asm files") + rewritten = fix_mirror_symbols(dst_path) + if rewritten: + print(f"unpaired uncached-mirror immediates in {rewritten} expected asm files") print(f"expected asm extracted to '{dst_path}'") @@ -1760,6 +1790,7 @@ def make_asm(config_path: Path, config: dict[str, Any]): split.main([yaml_path], modes=["all"], verbose=False) rename_locals(asm_path) + fix_mirror_symbols(tmp_path / "asm") dst_path = dst_path.parent / "obj" tmp_obj_path = tmp_path / "obj" @@ -2251,6 +2282,7 @@ class ArgsProtocol: clean(config_dir) split.main([args.YAML_FILE], modes=["all"], verbose=False) + fix_mirror_symbols(config_dir / "asm") fix_assets(config_dir, config) diff --git a/include/rnc/gameplay/camera/follow_cam.h b/include/rnc/gameplay/camera/follow_cam.h index 710c23aeba..fbca84d5f5 100644 --- a/include/rnc/gameplay/camera/follow_cam.h +++ b/include/rnc/gameplay/camera/follow_cam.h @@ -6,7 +6,7 @@ /* * State of the follow camera: the saved state of its camera record - * (UpdateCam.saved_state, +0x70). FUN_L00_002e4fe8 writes `velocity`, + * (UpdateCam.saved_state, +0x70). follow_cam_focus_velocity writes `velocity`, * follow_camera_transition reads `follow` for its spring constants, and * fast_dec_timer counts `blend_timer` down. The follow_camera_set_* setters * (FUN_L00_002e8450..002e8680) each write one field and do nothing while the diff --git a/include/rnc/gameplay/entities/moby.h b/include/rnc/gameplay/entities/moby.h index a3cd022f96..7c4cffa5a9 100644 --- a/include/rnc/gameplay/entities/moby.h +++ b/include/rnc/gameplay/entities/moby.h @@ -45,7 +45,7 @@ struct Moby { u16 flags; u16 occlusion; /* occlusion bits; 0x7F80 set by spawners */ u64 spawn_frame; /* frame count at which it may respawn */ - Vec4f rot; /* z: yaw (FUN_L00_00266448 compares it with atan2 to the hero) */ + Vec4f rot; /* z: yaw (update_npc_dialogue compares it with atan2 to the hero) */ u8 frame; /* animation frame */ u8 prev_frame; /* frame index in prev_seq */ u8 seq; /* animation sequence id */ @@ -65,13 +65,13 @@ struct Moby { u8 unk7C; u8 sound_slot; /* 0x7D: D_0013E550 slot of its looping sound, 0xFF: none (FUN_L00_00232670) */ u8 anim_trigger_count; - u8 shadow_range; /* shadow range in units of 1024; 0x17 from FUN_L09_002c5990 near D_L09_00166F40 */ + u8 shadow_range; /* shadow range in units of 1024; 0x17 from seeker_update near D_L09_00166F40 */ u8 pad80[6]; s16 unk86; u8 pad88[8]; s32 glow_color; /* glow colour (class header + 0x40) */ u32 collision; /* collision data, from the class header (MobyClass.collision) */ - s32 collision_disable; /* per-primitive collision disable bits; 1 while a carrier holds the moby (FUN_L00_002c7a58) */ + s32 collision_disable; /* per-primitive collision disable bits; 1 while a carrier holds the moby (glove_of_doom_update) */ u8 pad9C[8]; u8 hit_slot; /* hit-message slot (0xFF: none) */ u8 padA5; diff --git a/include/rnc/gameplay/hero.h b/include/rnc/gameplay/hero.h index 4e9c1a401b..a7b7d6d04a 100644 --- a/include/rnc/gameplay/hero.h +++ b/include/rnc/gameplay/hero.h @@ -327,7 +327,7 @@ struct Hero { f32 unk414; /* 0x414 */ s32 unk418; /* 0x418: set when velocity.z clamps to unk500.z, counts up */ s16 unk41C; /* 0x41C */ - s16 unk41E; /* 0x41E: set to 1 when FUN_L00_00233a78(velocity) < 0.001 */ + s16 unk41E; /* 0x41E: set to 1 when gravity_z(velocity) < 0.001 */ s32 unk420; /* 0x420: per-state scale_game_frames(N), compared with state_timer */ f32 unk424; /* 0x424 */ f32 unk428; /* 0x428 */ @@ -662,7 +662,7 @@ struct Hero { u8 unk12ED; /* 0x12ED */ u8 unk12EE; /* 0x12EE */ u8 pad_12EF[0x301]; - struct Moby *ship_moby; /* 0x15F0: the ship the hero is flying (l17 FUN_L17_002ed018) */ + struct Moby *ship_moby; /* 0x15F0: the ship the hero is flying (l17 fighter_jet_update) */ s16 ship_oclass; /* 0x15F4: its oclass, -1 when none */ u8 ship_ammo; /* 0x15F6: shots left in the space levels; firing needs one and takes it (FUN_L11_003126f8) */ u8 ship_ammo_max; /* 0x15F7: ammo pips the ship HUD draws, lit while below ship_ammo */ @@ -732,7 +732,7 @@ struct Hero { u8 pad_1FF8[0x28]; u8 *unk2020[6]; /* 0x2020: six moby slots, filled at the index a moby carries at +0x54 */ u8 pad_2038[0x8]; - struct Moby *unk2040; /* 0x2040: nearest oclass 0x25D moby (FUN_L00_002d2ee8) */ + struct Moby *unk2040; /* 0x2040: nearest oclass 0x25D moby (metal_detector_update) */ f32 unk2044; /* 0x2044: distance to unk2040; 100000 when none */ s32 unk2048; /* 0x2048 */ u8 pad_204C[0x4]; @@ -797,7 +797,7 @@ struct Hero { f32 unk22A4; /* 0x22A4 */ struct HeroHealth health; /* 0x22A8 */ s32 unk22B4; /* 0x22B4 */ - f32 unk22B8; /* 0x22B8: distance to the nearest carrying path this frame (FUN_L01_002f3120 keeps the minimum) */ + f32 unk22B8; /* 0x22B8: distance to the nearest carrying path this frame (water_current_update keeps the minimum) */ u8 pad_22BC[0x8]; s32 unk22C4; /* 0x22C4 */ s16 unk22C8; /* 0x22C8 */ diff --git a/include/rnc/input/pad_state.h b/include/rnc/input/pad_state.h index c7f5d0a0ac..498ab8e876 100644 --- a/include/rnc/input/pad_state.h +++ b/include/rnc/input/pad_state.h @@ -36,7 +36,7 @@ struct PadState { f32 analog[16]; /* 0x100: [0..3] stick axes (-1..1), [4..15] pressure (0..1) */ f32 analog_prev[16]; /* 0x140: copy of analog */ u8 pad_180[0x9]; - u8 unk189; /* 0x189: copied by FUN_L00_002d2ee8 on spawn */ + u8 unk189; /* 0x189: copied by metal_detector_update on spawn */ u8 pad_18A[0x4]; s16 unk18E; /* 0x18E: cleared with unk190 by reset_global_state_fields */ s32 unk190; /* 0x190 */ diff --git a/include/rnc/overlay/collision.h b/include/rnc/overlay/collision.h index 06cdeadbe2..69c3aae689 100644 --- a/include/rnc/overlay/collision.h +++ b/include/rnc/overlay/collision.h @@ -6,14 +6,14 @@ /* * Collision hit record filled by the overlay collision queries - * (FUN_L00_001f0d60, FUN_L00_001f19a0, coll_line_fix) at D_L00_00173E40 + * (coll_sphere, rig_probe, coll_line_fix) at D_L00_00173E40 * (per-level copies at other addresses). FUN_L00_002133a8 copies +0x30 into * hero.motion.pos, +0x40 into hero.unk200, +0x20 into hero.unk210 and +0x18 into * hero.coll_hit_moby. */ typedef struct { u8 pad0[0x18]; - s32 moby; /* 0x18: passed to FUN_002141f8 (reads moby+0x34, moby+0x78); 0 when no moby was hit */ + s32 moby; /* 0x18: passed to suck_get_aim_height (reads moby+0x34, moby+0x78); 0 when no moby was hit */ s32 unk1C; /* 0x1C: > 0 gates copying point and the normal into the hero (shared/gameplay/hero/air_accel.c) */ union { OvlQuad q; diff --git a/include/rnc/overlay/leg_rig.h b/include/rnc/overlay/leg_rig.h index d09f80301f..fd207cb5f0 100644 --- a/include/rnc/overlay/leg_rig.h +++ b/include/rnc/overlay/leg_rig.h @@ -11,7 +11,7 @@ typedef struct { /* 0x00 */ u8 unk0; /* 0x01 */ u8 attached; /* 0x02 */ u8 pad2[0xE]; - /* 0x10 */ sceVu0FVECTOR rot; /* quaternion, turned by FUN_L04_00292d48 */ + /* 0x10 */ sceVu0FVECTOR rot; /* quaternion, turned by rig_animate */ /* 0x20 */ u8 pad20[0x20]; } LegRigManip; @@ -46,8 +46,8 @@ typedef struct { /* 0x00 */ s32 id; /* animation sequence id */ /* 0x04 */ f32 unk4; /* 0x08 */ f32 rate; /* unk4 / multiply_global_factor_ed64(len * 2) */ - /* 0x0C */ f32 start; /* FUN_L04_002418b0(class slot, id) */ - /* 0x10 */ f32 len; /* FUN_L04_00241910(class slot, id) - start */ + /* 0x0C */ f32 start; /* animation_start(class slot, id) */ + /* 0x10 */ f32 len; /* animation_end(class slot, id) - start */ /* 0x14 */ u8 pad14[0xC]; /* 0x20 */ LegRigPhase phase[2]; } LegRigAnim; diff --git a/scripts/materialize-textbin-oracles.py b/scripts/materialize-textbin-oracles.py index 7e646cd6a5..19a4967b8b 100755 --- a/scripts/materialize-textbin-oracles.py +++ b/scripts/materialize-textbin-oracles.py @@ -29,6 +29,17 @@ PROJECT_ROOT = Path(__file__).resolve().parents[1] +def _oracle_word(word: int, address: int, starts: dict[int, str]) -> str: + """One raw word, except a `jal` to a function of the same unit: that one is + written as `jal ` so the oracle carries the relocation our object + has (a recursive call would otherwise differ only in its relocation).""" + if word >> 26 == 3: + target = (address & 0xF0000000) | ((word & 0x3FFFFFF) << 2) + if target in starts: + return f" jal {starts[target]}\n" + return f" .word 0x{word:08X}\n" + + def parse_main_subsegments(path: Path) -> list[dict[str, object]]: """Read the project's simple `main.subsegments` YAML without PyYAML.""" boundary = re.compile( @@ -271,6 +282,7 @@ def install( obj.parent.mkdir(parents=True, exist_ok=True) try: body = "" + starts = {int(f["address"]): str(f["symbol"]) for f in row["functions"]} for function in row["functions"]: name = str(function["symbol"]) start = int(function["address"]) @@ -294,7 +306,7 @@ def install( else: labels += retail body += "".join(f"glabel {label}\n" for label in labels) - body += "".join(f" .word 0x{word:08X}\n" for word in words) + body += "".join(_oracle_word(word, start + 4 * i, starts) for i, word in enumerate(words)) body += f".size {name}, . - {name}\n" rendered = ( '.include "macro.inc"\n.set noreorder\n.text\n' diff --git a/src/assembly/math/convert_integer_to_float.c b/src/assembly/math/convert_integer_to_float.c index 2219131e3d..5f4d99bec7 100644 --- a/src/assembly/math/convert_integer_to_float.c +++ b/src/assembly/math/convert_integer_to_float.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/math/convert_integer_to_float/func_001FA6C0.s", - func_001FA6C0); + convert_integer_to_float); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/math/multiply_global_factor_ed64.c b/src/assembly/math/multiply_global_factor_ed64.c index 234f15a61f..f1d2c81540 100644 --- a/src/assembly/math/multiply_global_factor_ed64.c +++ b/src/assembly/math/multiply_global_factor_ed64.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/math/multiply_global_factor_ed64/func_001F96B0.s", - func_001F96B0); + scale_time); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/math/multiply_global_factor_ed70.c b/src/assembly/math/multiply_global_factor_ed70.c index a8e70f4e21..600c1437d2 100644 --- a/src/assembly/math/multiply_global_factor_ed70.c +++ b/src/assembly/math/multiply_global_factor_ed70.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/math/multiply_global_factor_ed70/func_001F9730.s", - func_001F9730); + multiply_global_factor_ed70); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/math/multiply_global_scale.c b/src/assembly/math/multiply_global_scale.c index 1c6e8f77c9..9029560254 100644 --- a/src/assembly/math/multiply_global_scale.c +++ b/src/assembly/math/multiply_global_scale.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/math/multiply_global_scale/func_001F96E8.s", - func_001F96E8); + multiply_global_scale); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/sdk/library/sceFsInit.c b/src/assembly/sdk/library/sceFsInit.c index 609f4809f5..4eb34f799b 100644 --- a/src/assembly/sdk/library/sceFsInit.c +++ b/src/assembly/sdk/library/sceFsInit.c @@ -28,7 +28,7 @@ struct FsWord4 { }; /* Incomplete arrays keep these small globals on the absolute-address path. */ -extern u8 D_0011B980[]; +extern void invoke_sif_file_command_callback(void *, void *) __asm__("func_0011B980"); extern s32 D_0012FC94[]; extern s32 D_0012FC98[]; extern s32 D_0012FCA0[]; @@ -62,11 +62,11 @@ s32 sceFsInit(void) { struct FsWord4 response_word; sceSifInitRpc(0); - *init_request++ = 0; - *init_request-- = 0; + init_request[0] = 0; + init_request[1] = 0; irq_state = DIntr(); sceSifAddCmdHandler(0x80000011, &_sceFs_Rcv_Intr, D_00157FC0); - sceSifAddCmdHandler(0x80000013, D_0011B980, init_request); + sceSifAddCmdHandler(0x80000013, invoke_sif_file_command_callback, init_request); if (irq_state != 0) { EnableInterrupts(); diff --git a/src/assembly/textbin/audio/voices/sound_update.c b/src/assembly/textbin/audio/voices/sound_update.c index a24f0f291f..5243c1823f 100644 --- a/src/assembly/textbin/audio/voices/sound_update.c +++ b/src/assembly/textbin/audio/voices/sound_update.c @@ -103,8 +103,8 @@ extern void scale_vector_xyz(void *out, void *a, f32 scale) __asm__("FUN_001f9a6 extern f32 dot_vectors_xyz(void *a, void *b) __asm__("FUN_001f9ab0"); extern f32 vector_length_xyz(void *a) __asm__("FUN_001f9af0"); extern void normalize_vector_xyz(void *out, void *a, f32 len) __asm__("FUN_001f9bf8"); -extern void func_001F9CF8(void *out, void *a, void *b) __asm__("FUN_001f9cf8"); -extern void func_001FA2D8(void *out, void *a) __asm__("FUN_001fa2d8"); +extern void transform_vector_by_basis(void *out, void *a, void *b) __asm__("FUN_001f9cf8"); +extern void transpose_rotation_matrix(void *out, void *a) __asm__("FUN_001fa2d8"); extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern void music_update() __asm__("FUN_00216290"); @@ -265,7 +265,7 @@ s32 sound_update(void) { if (D_0013E550.voices[slot_index].moby != NULL && !(D_0013E550.voices[slot_index].flags & 8)) { if (D_0013E550.voices[slot_index].flags & 0x40) { - func_001F9CF8(&direction, &D_0013E550.voices[slot_index].position_offset, + transform_vector_by_basis(&direction, &D_0013E550.voices[slot_index].position_offset, &moby->rotation); add_vector_xyz(&direction, &direction, &moby->position); subtract_vector_xyz(&relative_velocity, &direction, @@ -385,7 +385,7 @@ s32 sound_update(void) { } } - func_001FA2D8(listener_matrix, camera_rows); + transpose_rotation_matrix(listener_matrix, camera_rows); for (slot_index = 0; slot_index < 30; slot_index++) { command_flags = voice_flags[slot_index]; if (command_flags == 0) { diff --git a/src/assembly/textbin/build_shrub_texture_dma.c b/src/assembly/textbin/build_shrub_texture_dma.c index 89adce077d..d676f09ce1 100644 --- a/src/assembly/textbin/build_shrub_texture_dma.c +++ b/src/assembly/textbin/build_shrub_texture_dma.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/build_shrub_texture_dma/FUN_0022a330.s", - FUN_0022a330); + build_shrub_texture_dma); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/build_tfrag_texture_dma.c b/src/assembly/textbin/build_tfrag_texture_dma.c index e9d3bac292..102cd659b4 100644 --- a/src/assembly/textbin/build_tfrag_texture_dma.c +++ b/src/assembly/textbin/build_tfrag_texture_dma.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/build_tfrag_texture_dma/FUN_00234d48.s", - FUN_00234d48); + build_tfrag_texture_dma); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/build_tie_texture_dma.c b/src/assembly/textbin/build_tie_texture_dma.c index 759435e439..72f7a9a7ab 100644 --- a/src/assembly/textbin/build_tie_texture_dma.c +++ b/src/assembly/textbin/build_tie_texture_dma.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/build_tie_texture_dma/FUN_002370c0.s", - FUN_002370c0); + build_tie_texture_dma); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/compute_tfrag_texture_usage.c b/src/assembly/textbin/compute_tfrag_texture_usage.c index fde75ca3d9..0862b7a09c 100644 --- a/src/assembly/textbin/compute_tfrag_texture_usage.c +++ b/src/assembly/textbin/compute_tfrag_texture_usage.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/compute_tfrag_texture_usage/FUN_00234bd8.s", - FUN_00234bd8); + compute_tfrag_texture_usage); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/fast_bsphere_check.c b/src/assembly/textbin/fast_bsphere_check.c index 90130c3fc8..2b0e1a23cf 100644 --- a/src/assembly/textbin/fast_bsphere_check.c +++ b/src/assembly/textbin/fast_bsphere_check.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/fast_bsphere_check/FUN_001fa728.s", - FUN_001fa728); + fast_bsphere_check); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/fast_dec_timer_s16.c b/src/assembly/textbin/fast_dec_timer_s16.c index 0e4b06939c..ff4574f1cc 100644 --- a/src/assembly/textbin/fast_dec_timer_s16.c +++ b/src/assembly/textbin/fast_dec_timer_s16.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/fast_dec_timer_s16/FUN_001f9770.s", - FUN_001f9770); + fast_dec_timer_s16); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/fast_draw_quad_real.c b/src/assembly/textbin/fast_draw_quad_real.c index e5ebb1ae02..831cfbead0 100644 --- a/src/assembly/textbin/fast_draw_quad_real.c +++ b/src/assembly/textbin/fast_draw_quad_real.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/fast_draw_quad_real/FUN_001f7d30.s", - FUN_001f7d30); + draw_geometry_quad); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/fast_intersect_vert.c b/src/assembly/textbin/fast_intersect_vert.c index 6c5a86e0ef..4b66d19c14 100644 --- a/src/assembly/textbin/fast_intersect_vert.c +++ b/src/assembly/textbin/fast_intersect_vert.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/fast_intersect_vert/FUN_001f7a98.s", - FUN_001f7a98); + fast_intersect_vert); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/fast_tween_color.c b/src/assembly/textbin/fast_tween_color.c index de59c5f3a4..7e9af8b158 100644 --- a/src/assembly/textbin/fast_tween_color.c +++ b/src/assembly/textbin/fast_tween_color.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/fast_tween_color/FUN_001fa6e0.s", - FUN_001fa6e0); + fast_tween_color); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/fast_vec_normalize.c b/src/assembly/textbin/fast_vec_normalize.c index 7cb3835fad..df47a7fa92 100644 --- a/src/assembly/textbin/fast_vec_normalize.c +++ b/src/assembly/textbin/fast_vec_normalize.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/fast_vec_normalize/FUN_001f9bf8.s", - FUN_001f9bf8); + fast_vec_normalize); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/fast_vector_from_packed_chars.c b/src/assembly/textbin/fast_vector_from_packed_chars.c index ce83717039..8f15cb92d1 100644 --- a/src/assembly/textbin/fast_vector_from_packed_chars.c +++ b/src/assembly/textbin/fast_vector_from_packed_chars.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/fast_vector_from_packed_chars/FUN_001f9d50.s", - FUN_001f9d50); + fast_vector_from_packed_chars); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/fast_vector_to_packed_chars.c b/src/assembly/textbin/fast_vector_to_packed_chars.c index 621213b8b6..31f37e6e2d 100644 --- a/src/assembly/textbin/fast_vector_to_packed_chars.c +++ b/src/assembly/textbin/fast_vector_to_packed_chars.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/fast_vector_to_packed_chars/FUN_001f9d68.s", - FUN_001f9d68); + fast_vector_to_packed_chars); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/math/rotations/fast_add_rotations.c b/src/assembly/textbin/math/rotations/fast_add_rotations.c index fce9ec582f..c8bf505449 100644 --- a/src/assembly/textbin/math/rotations/fast_add_rotations.c +++ b/src/assembly/textbin/math/rotations/fast_add_rotations.c @@ -4,7 +4,7 @@ #ifndef NON_MATCHING INCLUDE_ASM( "config/us/expected/asm/assembly/textbin/math/rotations/fast_add_rotations/FUN_001fa580.s", - FUN_001fa580); + fast_add_rotations); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/math/rotations/fast_difference_between_rotations.c b/src/assembly/textbin/math/rotations/fast_difference_between_rotations.c index 4d536fe89d..fbd0ad3646 100644 --- a/src/assembly/textbin/math/rotations/fast_difference_between_rotations.c +++ b/src/assembly/textbin/math/rotations/fast_difference_between_rotations.c @@ -4,7 +4,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/math/rotations/" "fast_difference_between_rotations/FUN_001fa688.s", - FUN_001fa688); + fast_difference_between_rotations); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/math/rotations/fast_normalize_angle.c b/src/assembly/textbin/math/rotations/fast_normalize_angle.c index 7ce7eb54fb..61576d7b17 100644 --- a/src/assembly/textbin/math/rotations/fast_normalize_angle.c +++ b/src/assembly/textbin/math/rotations/fast_normalize_angle.c @@ -4,7 +4,7 @@ #ifndef NON_MATCHING INCLUDE_ASM( "config/us/expected/asm/assembly/textbin/math/rotations/fast_normalize_angle/FUN_001fa610.s", - FUN_001fa610); + fast_normalize_angle); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), like its fastfunc neighbours diff --git a/src/assembly/textbin/math/rotations/fast_subtract_rotations.c b/src/assembly/textbin/math/rotations/fast_subtract_rotations.c index c87ac0b34d..a42a25fc46 100644 --- a/src/assembly/textbin/math/rotations/fast_subtract_rotations.c +++ b/src/assembly/textbin/math/rotations/fast_subtract_rotations.c @@ -4,7 +4,7 @@ #ifndef NON_MATCHING INCLUDE_ASM( "config/us/expected/asm/assembly/textbin/math/rotations/fast_subtract_rotations/FUN_001fa5c8.s", - FUN_001fa5c8); + fast_subtract_rotations); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/rendering/init_dma.c b/src/assembly/textbin/rendering/init_dma.c index 2a74bc3397..d399b82649 100644 --- a/src/assembly/textbin/rendering/init_dma.c +++ b/src/assembly/textbin/rendering/init_dma.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/rendering/init_dma/FUN_0020b418.s", - FUN_0020b418); + init_dma); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/runtime/memory/clear_u64_value.c b/src/assembly/textbin/runtime/memory/clear_u64_value.c index a7fa67fc71..d224082feb 100644 --- a/src/assembly/textbin/runtime/memory/clear_u64_value.c +++ b/src/assembly/textbin/runtime/memory/clear_u64_value.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/runtime/memory/clear_u64_value/FUN_001f99f8.s", - FUN_001f99f8); + clear_u64_value); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/sky_bsphere_check.c b/src/assembly/textbin/sky_bsphere_check.c index 8931c999f1..ec63b1df7a 100644 --- a/src/assembly/textbin/sky_bsphere_check.c +++ b/src/assembly/textbin/sky_bsphere_check.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/sky_bsphere_check/FUN_0022c4c8.s", - FUN_0022c4c8); + sky_bsphere_check); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/update_moby_grids.c b/src/assembly/textbin/update_moby_grids.c index 882da1433c..13009a692f 100644 --- a/src/assembly/textbin/update_moby_grids.c +++ b/src/assembly/textbin/update_moby_grids.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/update_moby_grids/FUN_0020dc20.s", - FUN_0020dc20); + update_moby_grids); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/assembly/textbin/write_setup_block.c b/src/assembly/textbin/write_setup_block.c index b0dde231e9..6b3437285f 100644 --- a/src/assembly/textbin/write_setup_block.c +++ b/src/assembly/textbin/write_setup_block.c @@ -3,7 +3,7 @@ #ifndef NON_MATCHING INCLUDE_ASM("config/us/expected/asm/assembly/textbin/write_setup_block/FUN_001f82e4.s", - FUN_001f82e4); + write_setup_block); #else /* No C body on purpose: this unit is intentional low-level assembly (config/us/unit_categories.json), so it has no C goal and no public diff --git a/src/audio/music/music_update_stream.c b/src/audio/music/music_update_stream.c index 0d49166ce8..447074317a 100644 --- a/src/audio/music/music_update_stream.c +++ b/src/audio/music/music_update_stream.c @@ -11,7 +11,7 @@ typedef struct { } MusicPlaying; extern void snd_stop_sound(int) __asm__("func_0012E368"); extern void snd_pause_vag_stream(int) __asm__("FUN_0012ec70"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern void snd_get_vag_stream_time_remaining_cb(int, void (*)(int, long), long) __asm__("FUN_0012ecd0"); extern void snd_sound_is_still_playing_cb(int, void (*)(int, long), long) __asm__("FUN_0012e448"); @@ -57,7 +57,7 @@ void music_update_stream(MusicPlaying *p) { snd_pause_vag_stream(p->handle); p->state |= 0x8000; } - if (FUN_001f9770(&p->fadeT) == 2) { + if (fast_dec_timer_s16(&p->fadeT) == 2) { p->fade = 4; } } else if (p->state & 0x8000) { diff --git a/src/audio/sound/clamp_voice_position_to_collision.c b/src/audio/sound/clamp_voice_position_to_collision.c index b133804f79..a3d79e4c1d 100644 --- a/src/audio/sound/clamp_voice_position_to_collision.c +++ b/src/audio/sound/clamp_voice_position_to_collision.c @@ -2,7 +2,7 @@ extern s32 D_0013E5BC[]; extern u8 D_00187080[]; extern char D_00194120[]; -extern s32 func_001EFA68(); +extern s32 collision_line() __asm__("func_001EFA68"); extern void add_vector_xyz() __asm__("func_001F9A10"); extern void subtract_vector_xyz() __asm__("func_001F9A28"); extern void fast_vec_scale(s32, s32, f32) __asm__("func_001F9A68"); @@ -13,7 +13,7 @@ void clamp_voice_position_to_collision(s32 position) __asm__("FUN_0022c5a8"); void clamp_voice_position_to_collision(s32 position) { random_spherical_offset(0.5f, 6.0f); add_vector_xyz(position, position, D_00187080); - if (func_001EFA68(D_00187080, position, 0x82, D_0013E5BC[0], 0) != 0) { + if (collision_line(D_00187080, position, 0x82, D_0013E5BC[0], 0) != 0) { subtract_vector_xyz(position, D_00194120, D_00187080); fast_vec_scale(position, position, 0.75f); add_vector_xyz(position, position, D_00187080); diff --git a/src/audio/sound/test_voice_occlusion.c b/src/audio/sound/test_voice_occlusion.c index 34767d8602..c57fe1c3a1 100644 --- a/src/audio/sound/test_voice_occlusion.c +++ b/src/audio/sound/test_voice_occlusion.c @@ -1,7 +1,7 @@ /* Ported from rac1-decomp (src/game/sound.c, func_0022D970). */ extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern char D_00187080[]; extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void clamp_vector_length(void *, void *, float) __asm__("FUN_001f9c90"); @@ -17,7 +17,7 @@ int test_voice_occlusion(void *voice, void *listener_position) { fast_vec_scale(test_position, test_position, 0.75f); clamp_vector_length(test_position, test_position, 64.0f); add_vector_xyz(test_position, test_position, D_00187080); - return FUN_001efa68(listener_position, test_position, 0x82, *(int *)((char *)voice + 0x18), 0); + return collision_line(listener_position, test_position, 0x82, *(int *)((char *)voice + 0x18), 0); } extern __typeof__(test_voice_occlusion) func_0022C658 __attribute__((alias("FUN_0022c658"))); diff --git a/src/gameplay/animation/blend_moby_animation_ex.c b/src/gameplay/animation/blend_moby_animation_ex.c index 867b7de426..bb94516758 100644 --- a/src/gameplay/animation/blend_moby_animation_ex.c +++ b/src/gameplay/animation/blend_moby_animation_ex.c @@ -36,7 +36,7 @@ extern void FUN_0020ede8(void *, int); old seq in unkA5 (unless it was already 0xFF), then marks seq 0xFF and frame = slot. Either way it then sets nextFrame/prevSeq from arg2/arg1, refreshes frame pointers (update_moby_animation_state), arms the timer (unk58 = 1), - resets unk54, clears unk70 bit 1, stores 1/func_001FA6C0(arg3) into + resets unk54, clears unk70 bit 1, stores 1/convert_integer_to_float(arg3) into unk5C, and copies a not-yet-named byte (offset 0x11) out of pClass->seqs[arg1] into unk7C. */ void blend_moby_animation_ex(MobyAnim *moby, int new_seq, int frame_index, int blend_frames, diff --git a/src/gameplay/camera/update_camera_tracking_state.c b/src/gameplay/camera/update_camera_tracking_state.c index 5401c7afc4..81578c0b59 100644 --- a/src/gameplay/camera/update_camera_tracking_state.c +++ b/src/gameplay/camera/update_camera_tracking_state.c @@ -36,7 +36,7 @@ extern f32 cam_interp_values(f32 *vel, f32 from, f32 to, f32 stiffness, f32 damp extern float absolute_float(float input) __asm__("func_001F99C0"); extern void subtract_vector_xyz(void *out, void *a, void *b) __asm__("FUN_001f9a28"); extern void fast_vec_scale(void *out, void *a, f32 s) __asm__("FUN_001f9a68"); -extern f32 FUN_001f9ab0(void *a, void *b); +extern f32 fast_vec_dot(void *a, void *b) __asm__("FUN_001f9ab0"); extern f32 fast_vec_length(void *a) __asm__("FUN_001f9af0"); extern void fast_vec_normalize(void *out, void *a, f32 len) __asm__("FUN_001f9bf8"); @@ -54,7 +54,7 @@ void update_camera_tracking_state(void) { fast_vec_normalize(&dir, &hero.gravity_dir, -1.0f); qcopy(&cam->unk40, &cam->unk30); qcopy(&cam->unk30, &dir); - if (FUN_001f9ab0(&cam->dir, &dir) < -0.98f) { + if (fast_vec_dot(&cam->dir, &dir) < -0.98f) { dir.f[0] += 0.2f; dir.f[1] += 0.2f; dir.f[2] += 0.2f; @@ -69,7 +69,7 @@ void update_camera_tracking_state(void) { subtract_vector_xyz(&cam->unk70, &hero.motion.pos, &cam->unk60); cam->unkA0 = fast_vec_length(&cam->unk70); - d = FUN_001f9ab0(&cam->unk70, &dir); + d = fast_vec_dot(&cam->unk70, &dir); cam->unkA8 = d; fast_vec_normalize(&proj, &dir, d); qcopy(&cam->unk90, &proj); diff --git a/src/gameplay/camera/update_camera_underwater_flag.c b/src/gameplay/camera/update_camera_underwater_flag.c index 83316eb4a9..2eb6004c44 100644 --- a/src/gameplay/camera/update_camera_underwater_flag.c +++ b/src/gameplay/camera/update_camera_underwater_flag.c @@ -4,8 +4,8 @@ #include "types.h" #include "rnc/data_labels.h" #include "rnc/ui/menus/menu_globals.h" -extern int FUN_001efa68(void *, void *, int, int, int); -extern int FUN_001f0b58(void); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern float resolve_camera_surface_height(void *, int) __asm__("func_002135F0"); /* Camera-inside-water test: cast a ray through the camera focus from 0.75 above to 0.75 below (up to six hits); on the first hit that is @@ -30,8 +30,8 @@ void update_camera_underwater_flag(void) { a[2] += 0.75f; b[2] -= 0.75f; i = 0; - while (i < 6 && FUN_001efa68(a, b, 0x12, 0, 0) != 0) { - if (FUN_001f0b58() == 0) { + while (i < 6 && collision_line(a, b, 0x12, 0, 0) != 0) { + if (collision_hit_material() == 0) { float h = resolve_camera_surface_height(D_00194120, 0) + 0.04f; char *c2 = preview_camera; diff --git a/src/gameplay/entities/fun_002141f8.c b/src/gameplay/entities/fun_002141f8.c index 59adf02c6a..8e990e598d 100644 --- a/src/gameplay/entities/fun_002141f8.c +++ b/src/gameplay/entities/fun_002141f8.c @@ -1,7 +1,8 @@ /* Ported from rac1-decomp (src/game/mobyutil.c, func_00215048). */ /* A goto into the first `return 0` gives retail's backward beqz; the two nops before it are short-loop padding (tools/ps2eeas_nops.py). */ -int FUN_002141f8(char *moby) { +int suck_get_aim_height(char *moby) __asm__("FUN_002141f8"); +int suck_get_aim_height(char *moby) { if (moby == 0) { ret0: return 0; @@ -12,4 +13,4 @@ int FUN_002141f8(char *moby) { return **(int **)(moby + 0x78); } -extern __typeof__(FUN_002141f8) func_002141F8 __attribute__((alias("FUN_002141f8"))); +extern __typeof__(suck_get_aim_height) func_002141F8 __attribute__((alias("FUN_002141f8"))); diff --git a/src/gameplay/entities/probe_ground_height.c b/src/gameplay/entities/probe_ground_height.c index b371281b5b..8c800cfe6a 100644 --- a/src/gameplay/entities/probe_ground_height.c +++ b/src/gameplay/entities/probe_ground_height.c @@ -2,7 +2,7 @@ typedef int s32; typedef float f32; #include "qcopy.h" -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern char D_00194120[]; /* Builds two 16-byte copies of *pos: one with byte offset 8 (a float) forced to 0.01f, the other with its offset-8 float bumped by height_offset. @@ -19,7 +19,7 @@ f32 probe_ground_height(void *pos, s32 flags, f32 height_offset) { *(f32 *)(low_point + 8) = 0.01f; qcopy(raised_point, pos); *(f32 *)(raised_point + 8) = *(f32 *)(raised_point + 8) + height_offset; - if (FUN_001efa68(raised_point, low_point, flags | 2, 0, 0) != 0) { + if (collision_line(raised_point, low_point, flags | 2, 0, 0) != 0) { return *(f32 *)(D_00194120 + 8); } return 0.0f; diff --git a/src/gameplay/entities/resolve_camera_surface_height.c b/src/gameplay/entities/resolve_camera_surface_height.c index 9471432482..ba0a90976d 100644 --- a/src/gameplay/entities/resolve_camera_surface_height.c +++ b/src/gameplay/entities/resolve_camera_surface_height.c @@ -13,7 +13,7 @@ extern s32 D_001611A0; extern f32 D_001611AC; extern f32 absolute_float(f32) __asm__("func_001F99C0"); extern void set_vector_unit_z(s32) __asm__("FUN_001f9a00"); -extern f32 FUN_001f9b80(struct CameraProbePosition *, s32 *); +extern f32 vector_distance(struct CameraProbePosition *, s32 *) __asm__("FUN_001f9b80"); extern s32 sample_surface_height_map(f32 *, f32, f32, f32) __asm__("func_00239F58"); f32 resolve_camera_surface_height(struct CameraProbePosition *position, @@ -30,7 +30,7 @@ f32 resolve_camera_surface_height(struct CameraProbePosition *position, s32 opti } if (moby_occl_cluster_count != 0) { if (absolute_float(position->z - *(f32 *)0x1611A8) < 0.5f) { - if (FUN_001f9b80(position, &D_001611A0) < D_001611AC) { + if (vector_distance(position, &D_001611A0) < D_001611AC) { if (optional_output != 0) { set_vector_unit_z(optional_output); } diff --git a/src/gameplay/entities/update_moby_shadow_range.c b/src/gameplay/entities/update_moby_shadow_range.c index dd846c257f..c73753942a 100644 --- a/src/gameplay/entities/update_moby_shadow_range.c +++ b/src/gameplay/entities/update_moby_shadow_range.c @@ -4,7 +4,7 @@ extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern float D_001CAA80[] NOT_SDA; -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern char coll_output[] __asm__("D_00194100"); extern void set_vector_length_xy(float *, float *, float) __asm__("FUN_001f9c48"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); @@ -34,7 +34,7 @@ void update_moby_shadow_range(char *m) { a[1] -= dir[1] * *(float *)(m + 0xC) * 0.000732421875f; qcopy(b, a); b[2] -= 8.0f; - if (FUN_001efa68(a, b, 0x22, 0, 0) != 0) { + if (collision_line(a, b, 0x22, 0, 0) != 0) { qcopy(a, p); hit = coll_output; h1 = *(float *)(hit + 0x28); @@ -44,7 +44,7 @@ void update_moby_shadow_range(char *m) { fast_vec_normalize(dir, dir, (a[2] - h1) / -dir[2]); add_vector_xyz(b, a, dir); h2 = h1; - if (FUN_001efa68(a, b, 0x22, 0, 0) != 0) { + if (collision_line(a, b, 0x22, 0, 0) != 0) { h2 = *(float *)(hit + 0x28); } *(float *)(m + 0x84) = min_float(h1, h2) - 0.25f; diff --git a/src/gameplay/fun_00213928.c b/src/gameplay/fun_00213928.c index 7207cf250e..d04c0766bf 100644 --- a/src/gameplay/fun_00213928.c +++ b/src/gameplay/fun_00213928.c @@ -29,9 +29,9 @@ extern u8 D_0013E533[]; extern f32 D_0015FFC8[2] __attribute__((sda)); extern f32 D_001CC0C8[][8]; extern u8 D_001CC080[][4]; -extern Q_25a478 *func_002141F8(void *); +extern Q_25a478 *suck_get_aim_height(void *) __asm__("FUN_002141f8"); extern Q_25a478 *ReadStateField(void *); -extern s32 func_001F9770(s16 *); +extern s32 fast_dec_timer_s16(s16 *) __asm__("func_001F9770"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern f32 fast_arc_tan(f32, f32) __asm__("func_001F9E90"); extern f32 fast_cos(f32) __asm__("func_001F9DC8"); @@ -67,7 +67,7 @@ s32 fun_00213928(O_25a478 *obj, P_25a478 *p, Q_25a478 *q, u32 flags, s32 *out, f return 0; } if (!q) { - q = func_002141F8(obj); + q = suck_get_aim_height(obj); if (!q) { *out = 0; return 0; @@ -76,7 +76,7 @@ s32 fun_00213928(O_25a478 *obj, P_25a478 *p, Q_25a478 *q, u32 flags, s32 *out, f if (idx == 4) idx = q->b8; if (!p) { if (q) { - func_001F9770(&q->h1C); + fast_dec_timer_s16(&q->h1C); q->h16 = -1; } *out = 1; @@ -139,7 +139,7 @@ s32 fun_00213928(O_25a478 *obj, P_25a478 *p, Q_25a478 *q, u32 flags, s32 *out, f if (kp) *kp = kind; res = D_001CC080[r][q->b8]; if (q->h14 != kind) q->h1C = 0; - if (func_001F9770(&q->h1C)) { + if (fast_dec_timer_s16(&q->h1C)) { switch (r) { case 0: q->h1C = scale_game_frames(0x25); break; case 1: q->h1C = scale_game_frames(0xF); break; diff --git a/src/gameplay/state/compute_interpolated_record_value.c b/src/gameplay/state/compute_interpolated_record_value.c index 975cf5a953..6f1d7599ae 100644 --- a/src/gameplay/state/compute_interpolated_record_value.c +++ b/src/gameplay/state/compute_interpolated_record_value.c @@ -21,7 +21,7 @@ struct InterpKeyframeA { s16 unk4; }; -extern float func_001FA6C0(); +extern float convert_integer_to_float() __asm__("func_001FA6C0"); f32 compute_interpolated_record_value(struct InterpolatedStateEntry *anim) __asm__("FUN_0020c9e0"); f32 compute_interpolated_record_value(struct InterpolatedStateEntry *anim) { @@ -36,19 +36,19 @@ f32 compute_interpolated_record_value(struct InterpolatedStateEntry *anim) { cur_record = anim->unk6C; } if (anim->unk54 == 0.0f) { - return func_001FA6C0(cur_record->unk4) * 0.0625f; + return convert_integer_to_float(cur_record->unk4) * 0.0625f; } if (anim->unk52 != anim->unk53) { - return (func_001FA6C0(cur_record->unk4) * 0.0625f) + anim->unk54; + return (convert_integer_to_float(cur_record->unk4) * 0.0625f) + anim->unk54; } u50 = anim->unk50; u51 = anim->unk51; if ((u8)u51 >= (u8)u50) { next_record = anim->unk6C; - temp_f20_55 = func_001FA6C0(cur_record->unk4) * (1.0f - anim->unk54); - return (temp_f20_55 + (func_001FA6C0(next_record->unk4) * anim->unk54)) * 0.0625f; + temp_f20_55 = convert_integer_to_float(cur_record->unk4) * (1.0f - anim->unk54); + return (temp_f20_55 + (convert_integer_to_float(next_record->unk4) * anim->unk54)) * 0.0625f; } - return (func_001FA6C0(cur_record->unk4) * 0.0625f) + anim->unk54; + return (convert_integer_to_float(cur_record->unk4) * 0.0625f) + anim->unk54; } extern f32 func_0020C9E0(struct InterpolatedStateEntry *) __attribute__((alias("FUN_0020c9e0"))); diff --git a/src/overlays/l00/gameplay/entities/clank_cutscene_trigger.c b/src/overlays/l00/gameplay/entities/clank_cutscene_trigger.c index 456135c61c..a1ff399fcb 100644 --- a/src/overlays/l00/gameplay/entities/clank_cutscene_trigger.c +++ b/src/overlays/l00/gameplay/entities/clank_cutscene_trigger.c @@ -270,12 +270,13 @@ typedef struct { extern u8 D_0013D388[]; extern s16 D_00141628[]; -extern s32 FUN_L00_002668a0(DoorMoby *, void *); -extern s32 FUN_L00_00266448(DoorMoby *, void *); +extern s32 initialize_npc_dialogue(DoorMoby *, void *) __asm__("FUN_L00_002668a0"); +extern s32 update_npc_dialogue(DoorMoby *, void *) __asm__("FUN_L00_00266448"); extern void initialize_global_state_entry(s32) __asm__("FUN_0022e188"); s32 is_point_inside_clip_volume(s32 arg0, s32 arg1) __asm__("FUN_00214720"); -void FUN_L00_002d9dc8(DoorMoby *m) { +void clank_cutscene_trigger_update(DoorMoby *m) __asm__("FUN_L00_002d9dc8"); +void clank_cutscene_trigger_update(DoorMoby *m) { DoorVars *vars; vars = m->vars; @@ -289,7 +290,7 @@ void FUN_L00_002d9dc8(DoorMoby *m) { switch (m->state) { case 0: D_00141628[0] = 1; - FUN_L00_002668a0(m, vars->unk20); + initialize_npc_dialogue(m, vars->unk20); if (D_0013D388[8] != 0) { vars->unk56 = 1; vars->unk2C = 3.0f; @@ -309,7 +310,7 @@ void FUN_L00_002d9dc8(DoorMoby *m) { vars->unk2C = 3.0f; } } - if (FUN_L00_00266448(m, vars->unk20) != 0) { + if (update_npc_dialogue(m, vars->unk20) != 0) { m->state = 2; vars->unk2C = 3.0f; } diff --git a/src/overlays/l00/gameplay/entities/veldin_robot_enemy.c b/src/overlays/l00/gameplay/entities/veldin_robot_enemy.c index afd1702f10..06b6b2c862 100644 --- a/src/overlays/l00/gameplay/entities/veldin_robot_enemy.c +++ b/src/overlays/l00/gameplay/entities/veldin_robot_enemy.c @@ -184,20 +184,20 @@ extern s32 D_L00_0015F580[] MACRO_ADDR; extern void FUN_L00_002e1678(); extern void FUN_L00_00263b38(void *, f32); -extern void FUN_L00_002628d8(VendMoby *, void *, s32, f32, f32); +extern void update_joint_animation(VendMoby *, void *, s32, f32, f32) __asm__("FUN_L00_002628d8"); extern void FUN_L00_0025a120(VendMoby *); extern f32 FUN_001f9b48(void *, void *); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern s32 random_integer_below(s32) __asm__("FUN_00213260"); extern void blend_moby_animation(VendMoby *, s32, s32, s32) __asm__("FUN_00212f90"); extern void mark_moby_for_removal(VendMoby *) __asm__("FUN_0020c828"); extern s32 vend_rand(s32) __asm__("FUN_001f96f8"); extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); -extern void FUN_L00_0025be00(void *, f32, void *, f32, f32, f32); +extern void approach_angle(void *, f32, void *, f32, f32, f32) __asm__("FUN_L00_0025be00"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 advance_accelerated_scalar(f32, f32, f32, f32, f32 *, f32 *) __asm__("FUN_00213f38"); extern void fast_vec_normalize(void *, void *, f32) __asm__("FUN_001f9bf8"); extern s32 FUN_L00_002e1f28(VendMoby *, s32, s32); @@ -207,25 +207,26 @@ extern void build_moby_bone_transform(VendMoby *, s32, void *) __asm__("FUN_0020 extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern f32 compute_interpolated_record_value(VendMoby *) __asm__("FUN_0020c9e0"); -extern s32 FUN_001efa68(void *, void *, s32, VendMoby *, VendQuery *); -extern s32 vend_2040(VendMoby *) __asm__("FUN_L00_002e2040"); +extern s32 collision_line(void *, void *, s32, VendMoby *, VendQuery *) __asm__("FUN_001efa68"); +extern s32 FUN_L00_002e2040_c(VendMoby *) __asm__("FUN_L00_002e2040"); extern s32 FUN_L00_002e2190(VendMoby *, void *, void *); -extern s32 FUN_L00_0025c698(VendMoby *, void *); -extern void FUN_L00_0025f090(VendMoby *, void *, s32, f32, f32); +extern s32 mine_fall(VendMoby *, void *) __asm__("FUN_L00_0025c698"); +extern void cart_burst(VendMoby *, void *, s32, f32, f32) __asm__("FUN_L00_0025f090"); extern void FUN_L00_00263e30(VendMoby *, s32, s32, s32, s32, s32, s32); extern void FUN_L00_00263fd8(VendMoby *, s32, void *, void *, s32, s32, f32, void *, void *, void *); extern void FUN_L00_002e1aa8(); #define VEND_TURN(m, v, ang, k) \ - FUN_L00_0025be00(&(m)->unk40.f[2], ang, &(v)->turnVel, frame_time_sq *(k), frame_time_sq *(k), \ + approach_angle(&(m)->unk40.f[2], ang, &(v)->turnVel, frame_time_sq *(k), frame_time_sq *(k), \ frame_time * 12.566371f) #define VEND_ANIM(m, a, t) \ if ((m)->anim != (a)) \ blend_moby_animation((m), (a), 0, (t)) extern f32 frame_scale_sq_gp __asm__("D_0015ED64") __attribute__((sda)); -void FUN_L00_002e0b88(VendMoby *moby) { +void veldin_robot_enemy_update(VendMoby *moby) __asm__("FUN_L00_002e0b88"); +void veldin_robot_enemy_update(VendMoby *moby) { VendVars *vars; VendTarget *target; VendPath *path; @@ -242,7 +243,7 @@ void FUN_L00_002e0b88(VendMoby *moby) { target = vars->target; FUN_L00_00263b38(vars->unk120, 2.5f); if (*(u8 *)0x15EDB7 != 0) { - FUN_L00_002628d8(moby, vars->unk120, 2, frame_scale_sq_gp * 0.03f, frame_scale_sq_gp * 0.3f); + update_joint_animation(moby, vars->unk120, 2, frame_scale_sq_gp * 0.03f, frame_scale_sq_gp * 0.3f); } if (moby->unk31 != 0 && FUN_001f9b48(&moby->pos, &D_L00_00166DC0) < 27.0f) { FUN_L00_0025a120(moby); @@ -298,7 +299,7 @@ void FUN_L00_002e0b88(VendMoby *moby) { advance_accelerated_scalar(FUN_001f9b48(&moby->pos, &path->pts[path->count - 1]), frame_time_sq * 8.0f, frame_time_sq * 16.0f, frame_time * 12.0f, &vel, &vars->speed); - if (FUN_001f9af0(&dir) < vars->speed + vars->speed) { + if (fast_vec_length(&dir) < vars->speed + vars->speed) { vars->pathPt++; if (vars->pathPt == path->count) { moby->state = 3; @@ -313,7 +314,7 @@ void FUN_L00_002e0b88(VendMoby *moby) { moby, vars, fast_arc_tan(target->pos.f[0] - moby->pos.f[0], target->pos.f[1] - moby->pos.f[1]), 12.566371f); - if (FUN_001f9b80(&moby->pos, &hero.motion.pos) < 20.0f) { + if (vector_distance(&moby->pos, &hero.motion.pos) < 20.0f) { VEND_ANIM(moby, 4, vend_rand(20)); } else if (moby->unk70 & 2) { VEND_ANIM(moby, random_integer_below(2) + 1, vend_rand(20)); @@ -367,16 +368,16 @@ void FUN_L00_002e0b88(VendMoby *moby) { } qcopy(&probe, &moby->pos); probe.f[2] += 0.5f; - if (FUN_001efa68(&mtx[3], &probe, 0, moby, &query) != 0 && hit != 0 && + if (collision_line(&mtx[3], &probe, 0, moby, &query) != 0 && hit != 0 && D_L00_00173E58.moby == (*(s32 *)&D_001413D0_lui)) { - vend_2040(moby); + FUN_L00_002e2040_c(moby); moby->state = 6; VEND_ANIM(moby, 7, vend_rand(10)); } - if (FUN_001efa68(&mtx[3], &dir, 0, moby, &query) != 0) { + if (collision_line(&mtx[3], &dir, 0, moby, &query) != 0) { qcopy(&dir, D_L00_00173E58.pos); if (hit != 0 && D_L00_00173E58.moby == (*(s32 *)&D_001413D0_lui)) { - vend_2040(moby); + FUN_L00_002e2040_c(moby); moby->state = 6; VEND_ANIM(moby, 7, vend_rand(10)); } @@ -384,7 +385,7 @@ void FUN_L00_002e0b88(VendMoby *moby) { FUN_L00_002e2190(moby, mtx, &dir); if (moby->unk70 & 2) { if (vars->timer++ == D_L00_00161BE8) { - vend_2040(moby); + FUN_L00_002e2040_c(moby); moby->state = 6; VEND_ANIM(moby, 12, vend_rand(10)); } @@ -402,14 +403,14 @@ void FUN_L00_002e0b88(VendMoby *moby) { } break; case 7: - if (FUN_L00_0025c698(moby, vars->unk70) & 0x140) { + if (mine_fall(moby, vars->unk70) & 0x140) { moby->state = 3; VEND_ANIM(moby, 1, vend_rand(10)); } break; case 8: - if (FUN_L00_0025c698(moby, vars->unk70) & 0x140) { - FUN_L00_0025f090(moby, &moby->pos, -1, 0.75f, 13.0f); + if (mine_fall(moby, vars->unk70) & 0x140) { + cart_burst(moby, &moby->pos, -1, 0.75f, 13.0f); FUN_L00_00263e30(moby, 0x7AB, 1, 0x7AB, 1, 4, 0); FUN_L00_00263fd8(moby, 0x78D, &moby->pos, &moby->unk40, 0, 0, 0.0f, D_L00_0015F580, D_L00_0015F580, D_L00_0015F580); @@ -497,16 +498,16 @@ typedef struct { extern s16 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern void FUN_L00_00257470(TrollMoby *, s32, s32); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern TrollColl *find_moby_hit(TrollMoby *, s32, s32) __asm__("FUN_L00_0025a420"); extern void hit_reaction(TrollMoby *, TrollColl *, void *, s32, s32 *, f32 *, s32, s32) __asm__("FUN_L00_0025a478"); -extern void FUN_L00_0025ab48(TrollVec *, f32 *, f32 *, f32 *); -extern void FUN_L00_0025c558(TrollMoby *, void *, s32, s32, s32, f32); -extern void FUN_L00_0025d458(TrollMoby *, void *); -extern void FUN_L00_0025d538(TrollMoby *, void *); +extern void trooper_knockback_arc(TrollVec *, f32 *, f32 *, f32 *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(TrollMoby *, void *, s32, s32, s32, f32) __asm__("FUN_L00_0025c558"); +extern void trooper_anim_update(TrollMoby *, void *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(TrollMoby *, void *) __asm__("FUN_L00_0025d538"); extern s32 FUN_L00_0025fcb8(TrollMoby *, f32, void *); extern void FUN_L00_0025ff38(TrollMoby *, void *, s32, s32, void *, s32, f32); extern void FUN_L00_002e2040(TrollMoby *); @@ -559,31 +560,31 @@ void FUN_L00_002e1678(TrollMoby *m) { vars->unk94 = 0x29; m->flags &= ~0x1000; v.q = coll->pos.q; - FUN_L00_0025ab48(&v, &angle, &vars->unk88, &vars->unk8C); - FUN_L00_0025c558(m, vars->unk70, 0xB, 1, 0, angle); + trooper_knockback_arc(&v, &angle, &vars->unk88, &vars->unk8C); + trooper_start_knockback(m, vars->unk70, 0xB, 1, 0, angle); vars->unkC0 = 7.0f; vars->unkC4 = 16.0f; m->state = 8; m->unk94 = 0; vars->unk67 = 0x78; - FUN_L00_0025d458(m, anim); + trooper_anim_update(m, anim); FUN_L00_00257470(m, 0, -1); } else { vars->unk88 = D_L00_00161BDC * frame_time * 0.35f; vars->unk8C = D_L00_00161BE0 * frame_time * 0.5f; v.q = coll->pos.q; - FUN_L00_0025ab48(&v, &unused, &vars->unk88, &vars->unk8C); - FUN_L00_0025c558(m, vars->unk70, 8, 1, 0, fast_arc_tan(coll->pos.f[0], coll->pos.f[1])); + trooper_knockback_arc(&v, &unused, &vars->unk88, &vars->unk8C); + trooper_start_knockback(m, vars->unk70, 8, 1, 0, fast_arc_tan(coll->pos.f[0], coll->pos.f[1])); vars->unkC4 = vars->unkC0 = -1.0f; m->state = 7; vars->unk67 = 0xFA; vars->unk26 = scale_game_frames(0x3C); - FUN_L00_0025d458(m, anim); + trooper_anim_update(m, anim); } FUN_L00_002e2040(m); } m->unkA4 = 0xFF; - FUN_L00_0025d538(m, anim); + trooper_anim_finish(m, anim); if (m->state == 1) { a = D_L00_001B04B0[vars->unk1B4]; FUN_L00_0025ff38(m, &vars->target, 0, 0, a->data, a->unk0, 64.0f); @@ -593,7 +594,7 @@ void FUN_L00_002e1678(TrollMoby *m) { range = 37.0f; } if (FUN_L00_0025fcb8(m, range, &vars->target) != 2 && - range < FUN_001f9b80(&m->pos, &vars->target)) { + range < vector_distance(&m->pos, &vars->target)) { vars->unk114 = 2; } } @@ -607,8 +608,8 @@ void FUN_L00_002e1678(TrollMoby *m) { if (t == 0 || t->state == 0xFE || t->state == 0xFD) { vars->unk1BC = -1; } else { - range = FUN_001f9b80(&m->pos, &t->pos); - if (range < FUN_001f9b80(&m->pos, &vars->targetMoby->pos)) { + range = vector_distance(&m->pos, &t->pos); + if (range < vector_distance(&m->pos, &vars->targetMoby->pos)) { vars->targetMoby = t; qcopy(&vars->target, &t->pos); vars->unk114 = 1; @@ -849,9 +850,9 @@ typedef struct { extern FlockGame D_L00_0016C860; -extern void FUN_L00_002637f8(void *); +extern void cutscene_set_camera_target(void *) __asm__("FUN_L00_002637f8"); extern void moby_point_position(void *, s32, void *) __asm__("FUN_L00_0024f7c8"); -extern void FUN_L00_00263b70(void *, void *, void *, f32, f32); +extern void draw_trail(void *, void *, void *, f32, f32) __asm__("FUN_L00_00263b70"); extern FlockPart *FUN_L00_0026d000(void *, s32, void *, s32, f32, f32, f32, f32); void FUN_L00_002e3800(FlockMoby *moby) { @@ -881,14 +882,14 @@ void FUN_L00_002e3800(FlockMoby *moby) { } else if (phase == 3) { idx = 2; } - FUN_L00_002637f8(D_L00_0016C860.mobys[idx]); + cutscene_set_camera_target(D_L00_0016C860.mobys[idx]); } if (D_L00_0015F5C4 == 2 && D_L00_0016C860.phase == 4) { src = D_L00_0016C860.mobys[3]; if (src != 0 && vend_rand(150) <= D_L00_0016C860.level && D_L00_0016C860.level <= vend_rand(220)) { moby_point_position(src, 0, pos); - FUN_L00_00263b70(pos, pos, D_L00_0015F580, 120000.0f, 50000.0f); + draw_trail(pos, pos, D_L00_0015F580, 120000.0f, 50000.0f); for (i = 0; i < 10; i++) { color = (random_int_between(0x40, 0x80) << 24) | 0x787878; v = random_int_between(0, 4); diff --git a/src/overlays/l01/gameplay/entities/00262618.c b/src/overlays/l01/gameplay/entities/00262618.c index 6cd0897e48..294cdb28a7 100644 --- a/src/overlays/l01/gameplay/entities/00262618.c +++ b/src/overlays/l01/gameplay/entities/00262618.c @@ -11,11 +11,11 @@ INCLUDE_ASM("config/us/overlays/asm/FUN_L01_00262618.s", FUN_L01_00262618); #include "sda.h" extern u8 D_L01_001E3380[]; -void FUN_L00_002371e0(void); +void mine_blend_color(void) __asm__("FUN_L00_002371e0"); void FUN_L01_002b96e0(s32, void *); void FUN_L01_002f6150(void) { - FUN_L00_002371e0(); + mine_blend_color(); FUN_L01_002b96e0(0x2, D_L01_001E3380); } #include "eetypes.h" @@ -26,6 +26,6 @@ void FUN_L01_002f6150(void) { extern u8 D_L01_001FBC80[]; void FUN_L01_002feb28(void) { - FUN_L00_002371e0(); + mine_blend_color(); FUN_L01_002b96e0(0x4, D_L01_001FBC80); } diff --git a/src/overlays/l01/gameplay/entities/birdbot.c b/src/overlays/l01/gameplay/entities/birdbot.c index d3841f28f1..e56841c769 100644 --- a/src/overlays/l01/gameplay/entities/birdbot.c +++ b/src/overlays/l01/gameplay/entities/birdbot.c @@ -141,12 +141,12 @@ typedef struct { Emitter *vars; } EmitterMoby; -extern int FUN_001fa728(void *, f32); +extern int fast_bsphere_check(void *, f32) __asm__("FUN_001fa728"); extern f32 random_float_between(f32, f32) __asm__("FUN_002132a8"); extern f32 fast_add_rotations(f32 a, f32 b) __asm__("FUN_001fa580"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void FUN_L01_0027e900(void *, void *, f32, f32, f32, f32, f32, f32, f32, f32, f32, s32, u8, u8, u8); @@ -172,7 +172,7 @@ void FUN_L01_002bd100(EmitterMoby *self) { if (current_level_index == 1) { p.q = self->pos.q; p.f[3] = 20.0f; - if (FUN_001fa728(&p, 240.0f) == -1) { + if (fast_bsphere_check(&p, 240.0f) == -1) { return; } } @@ -188,7 +188,7 @@ void FUN_L01_002bd100(EmitterMoby *self) { euler_rotation_matrix(&u.rot.m, self->rot); transform_vector(&off, &off, &u.rot.m); } - FUN_001f9a10(&p, &p, &off); + fast_vec_add(&p, &p, &off); if (v->flags & 0x1000) { u.rot.ang.f[0] = random_float_between(-v->vel_range[0], v->vel_range[0]) * 3.1415927f / 180.0f; @@ -251,10 +251,10 @@ extern f32 random_float_between(f32, f32) __asm__("FUN_002132a8"); extern s32 random_integer_below(s32) __asm__("FUN_00213260"); extern void moby_point_position(void *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); -extern void FUN_001f9a28(void *, void *, void *); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern int random_int_between(int lo, int hi) __asm__("FUN_L00_00257b90"); -extern s32 FUN_001f96f8(s32); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern void FUN_L00_0026ced0(void *, void *, u32, u32, f32, s32); void FUN_L01_002e6518(SplashMoby_u *m, u128 *origin) { @@ -282,12 +282,12 @@ void FUN_L01_002e6518(SplashMoby_u *m, u128 *origin) { outer = D_L01_0020AF68; moby_point_position(m, 1, &tmp); transform_vector_by_basis(&vel, &vel, m->mtx); - FUN_001f9a28(&rel, &m->pos, bp); - FUN_001f9a10(&vel, &vel, &rel); + fast_vec_sub(&rel, &m->pos, bp); + fast_vec_add(&vel, &vel, &rel); c1 = &inner.c[random_integer_below(6)]; c2 = &outer.c[random_integer_below(6)]; size = random_float_between(105000.0f, 157500.0f); - FUN_L00_0026ced0(&tmp, &vel, *c1, *c2, size, FUN_001f96f8(random_int_between(5, 0xF))); + FUN_L00_0026ced0(&tmp, &vel, *c1, *c2, size, scale_game_frames(random_int_between(5, 0xF))); } } #include "qcopy.h" @@ -339,7 +339,7 @@ typedef struct { extern void FUN_L01_00274b78(void *, void *, f32); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); @@ -392,7 +392,7 @@ int FUN_L01_002e6790(void *arg, int *idx) { last = 0; for (i = 0; i < f->path->count; i++) { if (v->stops_only == 0 || f->path->pts[i].w == 1.0f) { - dist = FUN_001f9b80(&f->path->pts[i], &m->pos); + dist = vector_distance(&f->path->pts[i], &m->pos); if (dist < best_d) { prev = last; best_d = dist; @@ -632,12 +632,12 @@ extern char *FUN_L01_002fa068(void *, void *, void *, float, float, int); extern char D_L01_0020AF80[]; extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L01_0015F580[] __attribute__((section(".sdata"))); -extern float FUN_001f96b0(float); +extern float FUN_L04_001f1978(float); extern float square_root(float) __asm__("FUN_001f9988"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float FUN_001f9e90_cf(float, float) __asm__("FUN_001f9e90"); -extern float FUN_001fa688(float, float); +extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float spring_turn(float *vel, float cur, float target, float k, float d, float max) __asm__("FUN_L00_00258110"); extern float compute_interpolated_record_value(void *); extern float fast_cos(float); @@ -647,12 +647,12 @@ extern float vector_length_xy_cf(void *) __asm__("FUN_001f9b20"); extern float vector_length_xyz(void *); extern int cutscene_active __asm__("D_L01_0015F404"); extern int DebugPrint(); -extern int FUN_001efa68(void *, void *, int, void *, void *); -extern int FUN_001f0b58(void); -extern int FUN_001f9770(void *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_0025a478_u(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_L00_0025a478"); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int hero_set_state(int, int) __asm__("FUN_L01_0023cf98"); extern int FUN_L01_002e6790(void *, int *); extern int is_point_inside_clip_volume(void *arg0, int arg1) __asm__("FUN_00214720"); @@ -672,12 +672,12 @@ extern void FUN_L00_00258278_cf(char *moby, float *vel, float target, float k, f extern void FUN_L00_0025ab48_u(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); extern void FUN_L00_0025c558_u(float, void *, void *, int, int, int) __asm__("FUN_L00_0025c558"); extern void FUN_L00_0025d458_u(void *m, short *p) __asm__("FUN_L00_0025d458"); -extern void FUN_L00_0025d538(void *, void *); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, float, int, float, int, int, int, int); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_0025fcb8(void *, void *, float); extern void FUN_L00_00263ac8_u(float, int, int, unsigned char *) __asm__("FUN_L00_00263ac8"); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void FUN_L00_002eac18(int); extern void FUN_L01_0026d930_u(char *p) __asm__("FUN_L01_0026d930"); extern void FUN_L01_0026eff8(char *arg, float value); @@ -691,7 +691,8 @@ extern void subtract_vector_xyz(void *, void *, void *); void FUN_L01_002e6518_c(SplashMoby *m, u128 *origin) __asm__("FUN_L01_002e6518"); extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); -void FUN_L01_002e6bf0(PeMoby *m) { +void birdbot_update(PeMoby *m) __asm__("FUN_L01_002e6bf0"); +void birdbot_update(PeMoby *m) { PeVars *v; PeVec old; PeTarget tgt; @@ -730,7 +731,7 @@ void FUN_L01_002e6bf0(PeMoby *m) { FUN_L00_0025fcb8(m, &tgt, r); hit = find_moby_hit(m, 0x210000, 0); kind = FUN_L00_0025a478_u(m, hit, &v->f20, 0, &hits, &dmg, 0, 4); - FUN_001f9770(&v->h26); + fast_dec_timer_s16(&v->h26); if (hit != 0 && v->h26 == 0) { if (hit->src != 0) { struct Hero *player = &hero; @@ -824,7 +825,7 @@ void FUN_L01_002e6bf0(PeMoby *m) { v->h1E2 = scale_game_frames(0x258); } v->w38 = 0; - FUN_001f9770(&v->h1E2); + fast_dec_timer_s16(&v->h1E2); switch (m->state) { case 0: { PeCursor *c; @@ -898,16 +899,16 @@ void FUN_L01_002e6bf0(PeMoby *m) { a = FUN_001f9e90_cf(tgt.pos.f[0] - m->pos.f[0], tgt.pos.f[1] - m->pos.f[1]); FUN_L00_00258278_cf((char *)m, &v->f194, a, 0.02f, 0.3f, 0.1f); tick_countdown_32(&v->w190); - d = FUN_001f9b80(&m->pos, &tgt); + d = vector_distance(&m->pos, &tgt); if ((flag ? d < v->f1A0 * 2.0f : d < v->f1A0) && absolute_float(m->pos.f[2] - tgt.pos.f[2]) < 2.0f && m->b31 != 0 && (!flag || res == 0) && v->w190 == 0 && - FUN_001fa688(m->rot.f[2], FUN_001f9e90_cf(tgt.pos.f[0] - m->pos.f[0], + fast_difference_between_rotations(m->rot.f[2], FUN_001f9e90_cf(tgt.pos.f[0] - m->pos.f[0], tgt.pos.f[1] - m->pos.f[1])) < 0.08726646f) { moby_point_position(m, 0, &va); *(u128 *)&vb = *(u128 *)&m->pos; vb.f[2] = va.f[2]; - if (FUN_001efa68(&vb, &va, 0, m, 0) == 0) { + if (collision_line(&vb, &va, 0, m, 0) == 0) { v->h1A4 = 0; v->f198 = 4.0f; m->state = 6; @@ -918,7 +919,7 @@ void FUN_L01_002e6bf0(PeMoby *m) { } else { v->w190 = scale_game_frames(0x3C); } - } else if (flag || (FUN_001f9b80(&m->pos, &tgt) < 4.0f && + } else if (flag || (vector_distance(&m->pos, &tgt) < 4.0f && absolute_float(m->pos.f[2] - tgt.pos.f[2]) < 6.0f)) { if (res != 0 && FUN_001f9b48(&m->pos, (PeVec *)c->path + (idx + 1)) > 0.25f) { if (v->h1AC == 0 || c->idx < c->path->count - 1) { @@ -945,14 +946,14 @@ void FUN_L01_002e6bf0(PeMoby *m) { break; } case 2: - if (FUN_001f9b80(&m->pos, &tgt) < v->f1A8 || + if (vector_distance(&m->pos, &tgt) < v->f1A8 || is_point_inside_clip_volume(&hero.motion.pos, v->w1C0) != 0 || v->w1E8 != 0) { if (v->w1C4 != -1) { char *p; hero_set_state(0x1F, 0); p = D_L01_001600EC + (v->w1C4 << 7); - FUN_L00_002eaaa0(p + 0x30, p + 0x70, 0, 0, 0); + jet_mount(p + 0x30, p + 0x70, 0, 0, 0); cutscene_active = 1; v->w1C8 = scale_game_frames(0x168); } @@ -1014,7 +1015,7 @@ void FUN_L01_002e6bf0(PeMoby *m) { normalize_vector_xyz(&vb, &v->v1D0, frame_time_sq * 5.0f); add_vector_xyz(&v->v1D0, &v->v1D0, &vb); } - if (FUN_001f9770(&v->h1EC) == 0) { + if (fast_dec_timer_s16(&v->h1EC) == 0) { v->v1D0.f[2] = z; } add_vector_xyz(&m->pos, &m->pos, &v->v1D0); @@ -1050,7 +1051,7 @@ void FUN_L01_002e6bf0(PeMoby *m) { a = m->rot.f[2]; moby_point_position(m, 0, &va); qcopy(&v->v180, &va); - if (FUN_001fa688(FUN_001f9e90_cf(tgt.pos.f[0] - va.f[0], tgt.pos.f[1] - va.f[1]), a) < + if (fast_difference_between_rotations(FUN_001f9e90_cf(tgt.pos.f[0] - va.f[0], tgt.pos.f[1] - va.f[1]), a) < 0.08726646f) { a = FUN_001f9e90_cf(tgt.pos.f[0] - va.f[0], tgt.pos.f[1] - va.f[1]); } @@ -1061,10 +1062,10 @@ void FUN_L01_002e6bf0(PeMoby *m) { vb.f[2] += 0.0f; *(u128 *)&vc = *(u128 *)&m->pos; vc.f[2] = va.f[2]; - if (FUN_001efa68(&vc, &va, 0, m, 0) == 0) { + if (collision_line(&vc, &va, 0, m, 0) == 0) { yaw = FUN_001f9e90_cf(vb.f[0], vb.f[1]); pitch = FUN_001f9e90_cf(vector_length_xy_cf(&vb), vb.f[2]); - FUN_L01_002fa068(m, &va, &vb, yaw, pitch, func_001FA898_r(FUN_001f96b0(10.0f))); + FUN_L01_002fa068(m, &va, &vb, yaw, pitch, func_001FA898_r(FUN_L04_001f1978(10.0f))); v->h1A4++; } else { if (m->b53 != 0) { @@ -1075,7 +1076,7 @@ void FUN_L01_002e6bf0(PeMoby *m) { } } if (frame < 2.0f) { - if (v->h1A4 >= 4 || FUN_001f9b80(&m->pos, &tgt) > (flag ? v->f1A0 * 2.0f : v->f1A0) || + if (v->h1A4 >= 4 || vector_distance(&m->pos, &tgt) > (flag ? v->f1A0 * 2.0f : v->f1A0) || absolute_float(m->pos.f[2] - tgt.pos.f[2]) > 6.0f) { if (m->b53 != 5) { blend_moby_animation_cf(m, 5, 5, scale_game_frames(10)); @@ -1098,7 +1099,7 @@ void FUN_L01_002e6bf0(PeMoby *m) { } } else if (m->b70 & 2) { m->f58 = 1.0f; - if ((flag || (FUN_001f9b80(&m->pos, &tgt) < 8.0f && + if ((flag || (vector_distance(&m->pos, &tgt) < 8.0f && absolute_float(m->pos.f[2] - tgt.pos.f[2]) < 6.0f)) && res != 0 && FUN_001f9b48(&m->pos, (PeVec *)v->main.path + (idx + 1)) > 0.25f) { v->main.idx = idx; @@ -1110,17 +1111,17 @@ void FUN_L01_002e6bf0(PeMoby *m) { } else { float d; - d = FUN_001f9b80(&m->pos, &tgt); + d = vector_distance(&m->pos, &tgt); if ((flag ? d < v->f1A0 * 2.0f : d < v->f1A0) && absolute_float(m->pos.f[2] - tgt.pos.f[2]) < 2.0f && m->b31 != 0 && (!flag || res == 0) && v->w190 == 0 && - FUN_001fa688(m->rot.f[2], FUN_001f9e90_cf(tgt.pos.f[0] - m->pos.f[0], + fast_difference_between_rotations(m->rot.f[2], FUN_001f9e90_cf(tgt.pos.f[0] - m->pos.f[0], tgt.pos.f[1] - m->pos.f[1])) < 0.08726646f) { moby_point_position(m, 0, &va); *(u128 *)&vb = *(u128 *)&m->pos; vb.f[2] = va.f[2]; - if (FUN_001efa68(&vb, &va, 0, m, 0) == 0) { + if (collision_line(&vb, &va, 0, m, 0) == 0) { v->h1A4 = 0; v->f198 = 4.0f; m->state = 6; @@ -1178,14 +1179,14 @@ void FUN_L01_002e6bf0(PeMoby *m) { FUN_L00_00258278_cf( (char *)m, &v->f194, FUN_001f9e90_cf(va.f[0] - m->pos.f[0], va.f[1] - m->pos.f[1]), frame_time_sq * 6.2831855f, frame_time_sq * 3.1415927f, frame_time * 6.2831855f); - if (FUN_001fa688(m->rot.f[2], FUN_001f9e90_cf(va.f[0] - m->pos.f[0], + if (fast_difference_between_rotations(m->rot.f[2], FUN_001f9e90_cf(va.f[0] - m->pos.f[0], va.f[1] - m->pos.f[1])) < 0.7853982f) { if (v->f1B8 < *(float *)&D_L01_00161954 * frame_time) { v->f1B8 = v->f1B8 + *(float *)&D_L01_00161954 * frame_time_sq; } build_spherical_offset_cf( &vb, v->f1B8, m->rot.f[2], - FUN_001f9e90_cf(FUN_001f9b80(&m->pos, &va), va.f[2] - m->pos.f[2])); + FUN_001f9e90_cf(vector_distance(&m->pos, &va), va.f[2] - m->pos.f[2])); add_vector_xyz(&m->pos, &m->pos, &vb); m->rot.f[1] = spring_turn( &v->f1BC, m->rot.f[1], @@ -1224,7 +1225,7 @@ void FUN_L01_002e6bf0(PeMoby *m) { frame_time * 6.2831855f); } if (m->b53 != 0xA && v->f1B8 <= 0.0f && - FUN_001fa688(m->rot.f[2], FUN_001f9e90_cf(tgt.pos.f[0] - m->pos.f[0], + fast_difference_between_rotations(m->rot.f[2], FUN_001f9e90_cf(tgt.pos.f[0] - m->pos.f[0], tgt.pos.f[1] - m->pos.f[1])) < 0.034906585f) { v->f1B8 = 0.0f; if (m->b53 != 0xA) { @@ -1239,7 +1240,7 @@ void FUN_L01_002e6bf0(PeMoby *m) { FUN_L01_002e6518_c((SplashMoby *)m, (u128 *)&old); break; case 12: - if (FUN_L00_0025c698(m, v->x70) & 0x40) { + if (mine_fall(m, v->x70) & 0x40) { if (FUN_001f9b48(&m->pos, (PeVec *)v->main.path + (idx + 1)) > 0.25f) { int i; float f; @@ -1261,7 +1262,7 @@ void FUN_L01_002e6bf0(PeMoby *m) { } if (m->pos.f[0] < 2.0f || m->pos.f[0] > 1021.0f || m->pos.f[1] < 2.0f || m->pos.f[1] > 1021.0f || m->pos.f[2] < 2.0f || m->pos.f[2] > 1021.0f) { - FUN_L00_0025e450(m, &v->v40, &m->pos, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, 4, + spawn_explosion(m, &v->v40, &m->pos, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, 4, 15.0f, 1, 1, -1, 0); FUN_L00_00257470(m, 0, -1); mark_moby_for_removal(m); @@ -1270,10 +1271,10 @@ void FUN_L01_002e6bf0(PeMoby *m) { break; case 14: m->h34 &= 0xEFFF; - if ((FUN_L00_0025c698(m, v->x70) & 6) || m->pos.f[0] < 2.0f || m->pos.f[0] > 1021.0f || + if ((mine_fall(m, v->x70) & 6) || m->pos.f[0] < 2.0f || m->pos.f[0] > 1021.0f || m->pos.f[1] < 2.0f || m->pos.f[1] > 1021.0f || m->pos.f[2] < 2.0f || m->pos.f[2] > 1021.0f) { - FUN_L00_0025e450(m, &v->v40, &m->pos, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, 4, + spawn_explosion(m, &v->v40, &m->pos, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, 4, 15.0f, 1, 1, -1, 0); FUN_L00_00263fd8_u((char *)m, 0x6C8, m->pos.f, &m->rot, 0, 0, 0.0f, D_L01_0015F580, D_L01_0015F580, D_L01_0015F580); @@ -1289,7 +1290,7 @@ void FUN_L01_002e6bf0(PeMoby *m) { } break; } - FUN_L00_0025d538(m, v->x60); + trooper_anim_finish(m, v->x60); v->f1CC = frame; if (m->state == 1 || m->state == 5 || m->state == 6 || m->state == 7 || m->state == 0xB) { v->fE8 += frame_time_sq * 9.8f; @@ -1304,8 +1305,8 @@ void FUN_L01_002e6bf0(PeMoby *m) { ground = probe_ground_height(&m->pos, 0, 0.5f); } FUN_L01_0026eff8((char *)m, ground); - if (FUN_001f0b58() == 0 && m->pos.f[2] < ground + 1.0f) { - FUN_L00_0025e450(m, &v->v40, &m->pos, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, 4, 15.0f, + if (collision_hit_material() == 0 && m->pos.f[2] < ground + 1.0f) { + spawn_explosion(m, &v->v40, &m->pos, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, 4, 15.0f, 1, 1, -1, 0); FUN_L00_00263fd8_u((char *)m, 0x6C8, m->pos.f, &m->rot, 0, 0, 0.0f, D_L01_0015F580, D_L01_0015F580, D_L01_0015F580); @@ -1470,22 +1471,22 @@ extern MobyNode *D_L01_0015FFE4; extern u8 D_L01_00161A80[] __attribute__((section(".sdata"))); extern s32 FUN_001160d8(); -extern f32 FUN_001f96b0(f32); -extern s32 FUN_001f96f8(s32); -extern int FUN_001f9740(void *); -extern int FUN_001f9770(void *); +extern f32 FUN_L04_001f1978(f32); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); +extern int tick_countdown_32(void *) __asm__("FUN_001f9740"); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); f32 FUN_001f99c0(f32); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); -extern f32 FUN_001f9af0(void *); -extern f32 FUN_001f9b80(void *, void *); -extern f32 FUN_001f9dc8(f32); -extern f32 FUN_001f9de0(f32); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); +extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); f32 fast_add_rotations(f32 a, f32 b) __asm__("FUN_001fa580"); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); -extern f32 FUN_001fa688(f32, f32); -extern f32 FUN_001fa6c0(s32); +extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); +extern f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern f32 FUN_0020c9e0(void *); extern void blend_moby_animation(void *, s32, s32, s32) __asm__("FUN_00212f90"); @@ -1501,17 +1502,17 @@ extern f32 FUN_L00_001ff8b0_cf(f32, f32) __asm__("FUN_001f9e90"); extern void FUN_L00_00257470(void *, s32, s32); extern void FUN_L00_00258278(void *, void *, f32, f32, f32, f32); extern s32 FUN_L00_00258b50(void *, void *, void *, void *, f32); -extern void FUN_L00_00259bc8(void *, void *, s32, void *, void *, f32); +extern void spawn_nearby_effect(void *, void *, s32, void *, void *, f32) __asm__("FUN_L00_00259bc8"); extern void FUN_L00_0025a120(void *); extern void *find_moby_hit(void *, s32, s32) __asm__("FUN_L00_0025a420"); extern void hit_reaction(void *, void *, void *, s32, void *, void *, s32, s32) __asm__("FUN_L00_0025a478"); -extern void FUN_L00_0025ab48(void *, void *, void *, void *); +extern void trooper_knockback_arc(void *, void *, void *, void *) __asm__("FUN_L00_0025ab48"); extern f32 FUN_L00_0025abf0(void *, void *, void *, f32, f32); -extern void FUN_L00_0025c558(void *, void *, s32, s32, s32, f32); -extern s32 FUN_L00_0025c698(void *, void *); -extern void FUN_L00_0025d458(void *, void *); -extern void FUN_L00_0025d538(void *, void *); -extern void FUN_L00_0025f090(void *, void *, s32, f32, f32); +extern void trooper_start_knockback(void *, void *, s32, s32, s32, f32) __asm__("FUN_L00_0025c558"); +extern s32 mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); +extern void trooper_anim_update(void *, void *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); +extern void cart_burst(void *, void *, s32, f32, f32) __asm__("FUN_L00_0025f090"); extern void FUN_L00_0025f730(void *, f32); extern void FUN_L00_0025fcb8(void *, void *, f32); extern void FUN_L00_00263ac8(void *, s32, void *, f32); @@ -1526,7 +1527,8 @@ extern s32 FUN_L01_002efbf8(void *, s32, s32); if ((m)->anim != (a)) \ blend_moby_animation((m), (a), (b), (c)) -void FUN_L01_002efc60(Mob577 *self) { +void peckbot_update(Mob577 *self) __asm__("FUN_L01_002efc60"); +void peckbot_update(Mob577 *self) { Vec577 oldpos; Mob577Target target; Vec577 v70; @@ -1573,11 +1575,11 @@ void FUN_L01_002efc60(Mob577 *self) { p60 = target.p40; qcopy(&oldpos, &self->pos); if (v->x38 != 0) { - v->x214 = FUN_001f96f8(0xF0); + v->x214 = scale_game_frames(0xF0); } v->x38 = 0; - FUN_001f9770(&v->x208); - if (FUN_001f9770(&v->x214) != 0) { + fast_dec_timer_s16(&v->x208); + if (fast_dec_timer_s16(&v->x214) != 0) { v->range = 12.0f; } else { v->range = 24.0f; @@ -1585,8 +1587,8 @@ void FUN_L01_002efc60(Mob577 *self) { hitA4 = 0.0f; hit = find_moby_hit(self, 0x330000, 0); hit_reaction(self, hit, &v->health, 0, &hitA0, &hitA4, 0, 4); - FUN_001f9770(&v->flee_timer); - if (v->flee_timer < FUN_001f96f8(0x2D) && hit != NULL && self->state != 0x63) { + fast_dec_timer_s16(&v->flee_timer); + if (v->flee_timer < scale_game_frames(0x2D) && hit != NULL && self->state != 0x63) { if ((hit->cls->oclass == 0xB0 || hit->cls->oclass == 0xB1) && v->flee_timer != 0) { hit->dmg = 0.0f; } @@ -1608,24 +1610,24 @@ void FUN_L01_002efc60(Mob577 *self) { self->flags &= ~0x1000; v->x13C = v->x138 = frame_time * 11.0f; v70.q = hit->pos; - FUN_L00_0025ab48(&v70, &angle, &v->x138, &v->x13C); - FUN_L00_0025c558(self, v->knock, 7, 1, 0, angle); + trooper_knockback_arc(&v70, &angle, &v->x138, &v->x13C); + trooper_start_knockback(self, v->knock, 7, 1, 0, angle); v->x170 = 11.0f; v->x174 = 18.0f; self->state = 0x63; v->x117 = 0x78; - FUN_L00_0025d458(self, v->fx110); + trooper_anim_update(self, v->fx110); FUN_L00_00257470(self, 0, -1); } else { v70.q = hit->pos; - FUN_L00_0025ab48(&v70, &angle, &v->x138, &v->x13C); - FUN_L00_0025c558(self, v->knock, 6, 1, 0, angle); + trooper_knockback_arc(&v70, &angle, &v->x138, &v->x13C); + trooper_start_knockback(self, v->knock, 6, 1, 0, angle); v->x170 = 5.0f; v->x174 = 10.0f; self->state = 6; v->x117 = 0xFA; - v->flee_timer = FUN_001f96f8(0x3C); - FUN_L00_0025d458(self, v->fx110); + v->flee_timer = scale_game_frames(0x3C); + trooper_anim_update(self, v->fx110); } } } @@ -1659,8 +1661,8 @@ void FUN_L01_002efc60(Mob577 *self) { v->xD0 = &D_L01_00161A70; break; case 14: - FUN_001f9a28(&v70, &target.pos, &self->pos); - if (FUN_001f9740(&v->x228) != 0 && FUN_001f9af0(&v70) < v->range + 4.0f && + fast_vec_sub(&v70, &target.pos, &self->pos); + if (tick_countdown_32(&v->x228) != 0 && fast_vec_length(&v70) < v->range + 4.0f && FUN_001f99c0(self->pos.f[2] - target.pos.f[2]) < 8.0f && random_integer_below(0x13) == 0) { self->state = 17; @@ -1669,35 +1671,35 @@ void FUN_L01_002efc60(Mob577 *self) { v->turn_deg = -v->turn_deg; } v->turn_off = v->turn_deg * DEG_TO_RAD; - v->turn_timer = FUN_001f96f8(random_float_between(30.0f, 90.0f)); + v->turn_timer = scale_game_frames(random_float_between(30.0f, 90.0f)); self->state = 17; clear_u64_value(&v->vel); self->hit = 0; - } else if (FUN_001f9740(&v->idle_timer) != 0) { - v->idle_timer = FUN_001f96f8(0x78); + } else if (tick_countdown_32(&v->idle_timer) != 0) { + v->idle_timer = scale_game_frames(0x78); rad = random_float_between(0.0f, 3.0f); dir = random_angle_radians(); - v80.f[0] = FUN_001f9dc8(dir) * rad; - v80.f[1] = FUN_001f9de0(dir) * rad; + v80.f[0] = fast_cos(dir) * rad; + v80.f[1] = fast_sin(dir) * rad; v80.f[2] = 0.0f; v80.f[2] = random_float_between(5.0f, 7.0f); - FUN_001f9a10(&v->dest, &v80, &v->home); + fast_vec_add(&v->dest, &v80, &v->home); self->state = 15; } break; case 15: ang = FUN_L00_001ff8b0_cf(v->dest.f[0] - self->pos.f[0], v->dest.f[1] - self->pos.f[1]); FUN_L00_00258278(self, v->turn, ang, 0.05f, 0.3f, 0.2f); - FUN_001f9a28(&v->vel, &v->dest, &self->pos); + fast_vec_sub(&v->vel, &v->dest, &self->pos); FUN_L00_0025f730(&v->vel, frame_time * 4.0f); - FUN_001f9a10(&v70, &v->vel, &self->pos); + fast_vec_add(&v70, &v->vel, &self->pos); if (coll_sphere(&v70, 0, self, 0.4f) != 0) { clear_u64_value(&v->vel); self->state = 14; } else { qcopy(&self->pos, &v70); } - if (FUN_001f9af0(&v->vel) == 0.0f) { + if (fast_vec_length(&v->vel) == 0.0f) { self->state = 14; } break; @@ -1705,8 +1707,8 @@ void FUN_L01_002efc60(Mob577 *self) { g17 = FUN_00213508(&self->pos, 0, 0.5f); approach_value(&v->vel.f[2], -(frame_time * 8.0f), frame_time_sq * 10.8f); self->pos.f[2] = self->pos.f[2] + v->vel.f[2]; - if (self->anim != 1 && self->pos.f[2] - g17 <= frame_time * 8.0f * FUN_001f96b0(45.0f)) { - SET_ANIM(self, 1, 0, FUN_001f96f8(5)); + if (self->anim != 1 && self->pos.f[2] - g17 <= frame_time * 8.0f * FUN_L04_001f1978(45.0f)) { + SET_ANIM(self, 1, 0, scale_game_frames(5)); } if (self->pos.f[2] <= g17) { self->pos.f[2] = g17; @@ -1714,10 +1716,10 @@ void FUN_L01_002efc60(Mob577 *self) { v->turn_deg = -v->turn_deg; } v->turn_off = v->turn_deg * DEG_TO_RAD; - v->turn_timer = FUN_001f96f8(random_float_between(30.0f, 90.0f)); + v->turn_timer = scale_game_frames(random_float_between(30.0f, 90.0f)); self->state = 3; clear_u64_value(&v->vel); - SET_ANIM(self, 2, 0, FUN_001f96f8(3)); + SET_ANIM(self, 2, 0, scale_game_frames(3)); } break; case 16: @@ -1727,73 +1729,73 @@ void FUN_L01_002efc60(Mob577 *self) { if (g16 + 6.0f <= self->pos.f[2]) { self->pos.f[2] = g16 + 6.0f; self->state = 14; - v->x228 = FUN_001f96f8(0xB4); + v->x228 = scale_game_frames(0xB4); clear_u64_value(&v->vel); } break; case 1: - FUN_001f9a28(&v70, &target.pos, &self->pos); - if (FUN_001f9af0(&v70) < v->range + 4.0f && + fast_vec_sub(&v70, &target.pos, &self->pos); + if (fast_vec_length(&v70) < v->range + 4.0f && FUN_001f99c0(self->pos.f[2] - target.pos.f[2]) < 8.0f && random_integer_below(0x13) == 0) { self->state = 2; - SET_ANIM(self, 5, 0, FUN_001f96f8(3)); + SET_ANIM(self, 5, 0, scale_game_frames(3)); } else if (self->hit == 1 && random_integer_below(0x13) == 0) { if (random_integer_below(0x100) & 1) { v->turn_deg = -v->turn_deg; } v->turn_off = v->turn_deg * DEG_TO_RAD; - v->turn_timer = FUN_001f96f8(random_float_between(30.0f, 90.0f)); + v->turn_timer = scale_game_frames(random_float_between(30.0f, 90.0f)); self->state = 3; - SET_ANIM(self, 2, 0, FUN_001f96f8(3)); + SET_ANIM(self, 2, 0, scale_game_frames(3)); self->hit = 0; - } else if (FUN_001f9af0(&v70) > v->range + 6.0f && v->x20A == 0) { + } else if (fast_vec_length(&v70) > v->range + 6.0f && v->x20A == 0) { self->state = 16; - SET_ANIM(self, 0, 0, FUN_001f96f8(3)); + SET_ANIM(self, 0, 0, scale_game_frames(3)); } break; case 8: - FUN_001f9a28(&v70, &target.pos, &self->pos); - if (FUN_001f9af0(&v70) < v->range - 4.0f && + fast_vec_sub(&v70, &target.pos, &self->pos); + if (fast_vec_length(&v70) < v->range - 4.0f && FUN_001f99c0(self->pos.f[2] - target.pos.f[2]) < 8.0f && random_integer_below(0x13) == 0) { self->state = 2; self->pos.f[2] = self->pos.f[2] + 1.0f; - SET_ANIM(self, 5, 0, FUN_001f96f8(3)); + SET_ANIM(self, 5, 0, scale_game_frames(3)); } break; case 10: ang = FUN_L00_001ff8b0_cf(v->home.f[0] - self->pos.f[0], v->home.f[1] - self->pos.f[1]); FUN_L00_00258278(self, v->turn, ang, 0.05f, 0.3f, 0.2f); - FUN_001f9a28(&v70, &target.pos, &v->home); - if ((FUN_001f9af0(&v70) < v->range && + fast_vec_sub(&v70, &target.pos, &v->home); + if ((fast_vec_length(&v70) < v->range && FUN_001f99c0(v->home.f[2] - target.pos.f[2]) < 8.0f) || self->hit == 2) { if (self->group != 0xFF) { FUN_L01_0026e090(self->group, 2); } - SET_ANIM(self, 6, 0, FUN_001f96f8(3)); + SET_ANIM(self, 6, 0, scale_game_frames(3)); v->x134 = 0.0f; v->x130 = D_L01_00161A6C; v->x138 = D_L01_00161A68 * frame_time; v->x13C = FUN_L00_0025abf0(&self->pos, &v->home, &tmpAC, v->x138, -D_L01_00161A6C); v->x144 = 13; v->x15D = 0; - FUN_L00_0025c558(self, v->knock, 6, 1, 0, self->rot.f[2]); + trooper_start_knockback(self, v->knock, 6, 1, 0, self->rot.f[2]); v->x170 = 5.0f; v->x174 = 10.0f; self->state = 11; } break; case 11: - if (FUN_L00_0025c698(self, v->knock) & 1) { + if (mine_fall(self, v->knock) & 1) { self->state = 3; if (random_integer_below(0x100) & 1) { v->turn_deg = -v->turn_deg; } v->turn_off = v->turn_deg * DEG_TO_RAD; - v->turn_timer = FUN_001f96f8(random_float_between(30.0f, 90.0f)); - SET_ANIM(self, 2, 8, FUN_001f96f8(3)); + v->turn_timer = scale_game_frames(random_float_between(30.0f, 90.0f)); + SET_ANIM(self, 2, 8, scale_game_frames(3)); return; } else if (self->pos.f[2] < 5.0f) { FUN_L00_00257470(self, 0, -1); @@ -1805,8 +1807,8 @@ void FUN_L01_002efc60(Mob577 *self) { ang = FUN_L00_001ff8b0_cf(self->pos.f[0] - target.pos.f[0], self->pos.f[1] - target.pos.f[1]); FUN_L00_00258278(self, v->turn, ang, 0.02f, 0.3f, 0.1f); - FUN_001f9a28(&v70, &target.pos, &self->pos); - if (FUN_001f9af0(&v70) < v->range && + fast_vec_sub(&v70, &target.pos, &self->pos); + if (fast_vec_length(&v70) < v->range && FUN_001f99c0(self->pos.f[2] - target.pos.f[2]) < 8.0f && random_integer_below(0x13) == 0) { if (self->group != 0xFF) { @@ -1816,30 +1818,30 @@ void FUN_L01_002efc60(Mob577 *self) { v->turn_deg = -v->turn_deg; } v->turn_off = v->turn_deg * DEG_TO_RAD; - v->turn_timer = FUN_001f96f8(random_float_between(30.0f, 90.0f)); + v->turn_timer = scale_game_frames(random_float_between(30.0f, 90.0f)); self->state = 3; - SET_ANIM(self, 2, 0, FUN_001f96f8(3)); + SET_ANIM(self, 2, 0, scale_game_frames(3)); self->hit = 0; } else if (self->hit == 1 && random_integer_below(0x13) == 0) { if (random_integer_below(0x100) & 1) { v->turn_deg = -v->turn_deg; } v->turn_off = v->turn_deg * DEG_TO_RAD; - v->turn_timer = FUN_001f96f8(random_float_between(30.0f, 90.0f)); + v->turn_timer = scale_game_frames(random_float_between(30.0f, 90.0f)); self->state = 3; - SET_ANIM(self, 2, 0, FUN_001f96f8(3)); + SET_ANIM(self, 2, 0, scale_game_frames(3)); self->hit = 0; - } else if (FUN_001f9af0(&v70) > v->range + 6.0f && v->x20A == 0) { + } else if (fast_vec_length(&v70) > v->range + 6.0f && v->x20A == 0) { self->state = 16; - SET_ANIM(self, 0, 0, FUN_001f96f8(3)); + SET_ANIM(self, 0, 0, scale_game_frames(3)); } if (self->anim == 5 && (self->anim_flags & 2)) { - blend_moby_animation(self, 4, 0, FUN_001f96f8(3)); + blend_moby_animation(self, 4, 0, scale_game_frames(3)); } break; case 3: r3 = FUN_001f99c0(self->pos.f[2] - target.pos.f[2]); - r3 = r3 / FUN_001f9b80(&self->pos, &target.pos); + r3 = r3 / vector_distance(&self->pos, &target.pos); if (v->path != -1) { FUN_L01_0028b5e0(self, D_L01_001B0930[v->path], &target.pos, &v80); } else { @@ -1848,24 +1850,24 @@ void FUN_L01_002efc60(Mob577 *self) { ang = FUN_L00_001ff8b0_cf(v80.f[0] - self->pos.f[0], v80.f[1] - self->pos.f[1]) + v->turn_off; FUN_L00_00258278(self, v->turn, ang, 0.05f, 0.3f, 0.2f); - v70.f[0] = FUN_001f9dc8(self->rot.f[2]) * 2.0f; - v70.f[1] = FUN_001f9de0(self->rot.f[2]) * 2.0f; + v70.f[0] = fast_cos(self->rot.f[2]) * 2.0f; + v70.f[1] = fast_sin(self->rot.f[2]) * 2.0f; v70.f[2] = 0.0f; res = FUN_L00_00258b50(self, &v->x180, &v70, &v80, 1.0f); - if (FUN_001f9740(&v->turn_timer) != 0) { - v->turn_timer = FUN_001f96f8(random_float_between(30.0f, 90.0f)); + if (tick_countdown_32(&v->turn_timer) != 0) { + v->turn_timer = scale_game_frames(random_float_between(30.0f, 90.0f)); v->turn_off = -v->turn_off; } - FUN_001f9a28(&v90, &target.pos, &v->home); - if (FUN_001f9b80(&self->pos, &target.pos) < 1.5f && !(res & 2)) { + fast_vec_sub(&v90, &target.pos, &v->home); + if (vector_distance(&self->pos, &target.pos) < 1.5f && !(res & 2)) { self->state = 4; - SET_ANIM(self, 3, 0, FUN_001f96f8(3)); + SET_ANIM(self, 3, 0, scale_game_frames(3)); } else if (r3 > 1.0f || (res & 2)) { self->pos.f[0] = oldpos.f[0]; self->pos.f[1] = oldpos.f[1]; self->state = 12; - SET_ANIM(self, 5, 0, FUN_001f96f8(3)); - } else if (FUN_001f9af0(&v90) < v->range + 4.0f && + SET_ANIM(self, 5, 0, scale_game_frames(3)); + } else if (fast_vec_length(&v90) < v->range + 4.0f && FUN_001f99c0(self->pos.f[2] - target.pos.f[2]) < 8.0f) { if (self->group != 0xFF) { FUN_L01_0026e090(self->group, 1); @@ -1876,7 +1878,7 @@ void FUN_L01_002efc60(Mob577 *self) { FUN_00213508(&self->pos, 0, 0.5f); if (FUN_L00_001f35d8_cf() == 0 || FUN_L00_001f35d8_cf() == 8) { self->state = 16; - SET_ANIM(self, 0, 0, FUN_001f96f8(3)); + SET_ANIM(self, 0, 0, scale_game_frames(3)); } self->hit = 0; break; @@ -1886,22 +1888,22 @@ void FUN_L01_002efc60(Mob577 *self) { FUN_L00_00258278(self, v->turn, ang, 0.05f, 0.3f, 0.2f); if (self->anim_next == self->anim && FUN_0020c9e0(self) == 13.0f && FUN_001f99c0(self->pos.f[2] - target.pos.f[2]) < 0.5f && - FUN_001f9b80(&self->pos, &target.pos) < 2.0f && - FUN_001fa688(FUN_L00_001ff8b0_cf(target.pos.f[0] - self->pos.f[0], + vector_distance(&self->pos, &target.pos) < 2.0f && + fast_difference_between_rotations(FUN_L00_001ff8b0_cf(target.pos.f[0] - self->pos.f[0], target.pos.f[1] - self->pos.f[1]), self->rot.f[2]) < 0.2617994f) { - v70.f[0] = FUN_001f9dc8(self->rot.f[2]) * 0.2f; - v70.f[1] = FUN_001f9de0(self->rot.f[2]) * 0.2f; + v70.f[0] = fast_cos(self->rot.f[2]) * 0.2f; + v70.f[1] = fast_sin(self->rot.f[2]) * 0.2f; v70.f[2] = 0.0f; qcopy(&v80, &target.pos); v80.f[2] = v80.f[2] + 0.75f; if (p60 != NULL) { - FUN_L00_00259bc8(p60, self, 1, &v80, &v70, 1.0f); + spawn_nearby_effect(p60, self, 1, &v80, &v70, 1.0f); } } - if ((self->anim_flags & 2) && FUN_001f9b80(&self->pos, &target.pos) > 1.5f) { + if ((self->anim_flags & 2) && vector_distance(&self->pos, &target.pos) > 1.5f) { self->state = 3; - SET_ANIM(self, 2, 0, FUN_001f96f8(3)); + SET_ANIM(self, 2, 0, scale_game_frames(3)); } g4 = FUN_00213508(&self->pos, 0, 0.5f); v->x198 = v->x198 - frame_time_sq * 9.8f; @@ -1919,41 +1921,41 @@ void FUN_L01_002efc60(Mob577 *self) { } ang = FUN_L00_001ff8b0_cf(v80.f[0] - self->pos.f[0], v80.f[1] - self->pos.f[1]); FUN_L00_00258278(self, v->turn, ang, 0.02f, 0.3f, 0.1f); - v70.f[0] = FUN_001f9dc8(self->rot.f[2]) * 2.0f; - v70.f[1] = FUN_001f9de0(self->rot.f[2]) * 2.0f; + v70.f[0] = fast_cos(self->rot.f[2]) * 2.0f; + v70.f[1] = fast_sin(self->rot.f[2]) * 2.0f; v70.f[2] = 0.0f; res = FUN_L00_00258b50(self, &v->x180, &v70, &v80, 1.0f); - if (FUN_001f9b80(&self->pos, &v->home) < 2.0f) { + if (vector_distance(&self->pos, &v->home) < 2.0f) { self->state = 1; - SET_ANIM(self, 4, 0, FUN_001f96f8(3)); + SET_ANIM(self, 4, 0, scale_game_frames(3)); } - FUN_001f9a28(&v90, &target.pos, &v->home); - if (FUN_001f9af0(&v90) < v->range) { + fast_vec_sub(&v90, &target.pos, &v->home); + if (fast_vec_length(&v90) < v->range) { if (self->group != 0xFF) { FUN_L01_0026e090(self->group, 1); } self->state = 3; - SET_ANIM(self, 2, 0, FUN_001f96f8(3)); + SET_ANIM(self, 2, 0, scale_game_frames(3)); } else if (self->hit == 1) { self->state = 3; - SET_ANIM(self, 2, 0, FUN_001f96f8(3)); + SET_ANIM(self, 2, 0, scale_game_frames(3)); } else if (res & 2) { self->pos.f[0] = oldpos.f[0]; self->pos.f[1] = oldpos.f[1]; self->state = 12; - SET_ANIM(self, 5, 0, FUN_001f96f8(3)); + SET_ANIM(self, 5, 0, scale_game_frames(3)); } FUN_00213508(&self->pos, 0, 0.5f); if (FUN_L00_001f35d8_cf() == 0 || FUN_L00_001f35d8_cf() == 8) { self->state = 16; - SET_ANIM(self, 0, 0, FUN_001f96f8(3)); + SET_ANIM(self, 0, 0, scale_game_frames(3)); } self->hit = 0; break; case 6: - if (FUN_L00_0025c698(self, v->knock) & 1) { + if (mine_fall(self, v->knock) & 1) { self->state = 3; - SET_ANIM(self, 2, 0, FUN_001f96f8(3)); + SET_ANIM(self, 2, 0, scale_game_frames(3)); return; } else if (self->pos.f[2] < 5.0f) { FUN_L00_00257470(self, 0, -1); @@ -1964,18 +1966,18 @@ void FUN_L01_002efc60(Mob577 *self) { case 7: if (FUN_L00_002dc9f0(self, v->knock) != 0) { self->state = 14; - v->x228 = FUN_001f96f8(0xB4); + v->x228 = scale_game_frames(0xB4); SET_ANIM(self, 0, 0, 0); v->xC8 = 0; } break; case 0x63: self->flags &= ~0x1000; - if (FUN_L00_0025c698(self, v->knock) & 0x140) { + if (mine_fall(self, v->knock) & 0x140) { clear_u64_value(&v70); - n = FUN_001f96f8(1) * 60.0f; + n = scale_game_frames(1) * 60.0f; if (FUN_L01_002efbf8(D_L01_00161A80, 3, n) >= 0) { - FUN_L00_0025f090(self, &self->pos, 4, 0.5f, 13.0f); + cart_burst(self, &self->pos, 4, 0.5f, 13.0f); } FUN_L00_00263fd8(self, 0x6D3, &self->pos, &self->rot, 0, 0, 0.0f, D_L01_0015F580, D_L01_0015F580, D_L01_0015F580); @@ -1998,7 +2000,7 @@ void FUN_L01_002efc60(Mob577 *self) { break; case 12: r12 = FUN_001f99c0(self->pos.f[2] - target.pos.f[2]); - r12 = r12 / FUN_001f9b80(&self->pos, &target.pos); + r12 = r12 / vector_distance(&self->pos, &target.pos); if (v->path != -1) { FUN_L01_0028b5e0(self, D_L01_001B0930[v->path], &v->home, &v80); } else { @@ -2006,46 +2008,46 @@ void FUN_L01_002efc60(Mob577 *self) { } ang = FUN_L00_001ff8b0_cf(v80.f[0] - self->pos.f[0], v80.f[1] - self->pos.f[1]); FUN_L00_00258278(self, v->turn, ang, 0.05f, 0.3f, 0.2f); - v70.f[0] = FUN_001f9dc8(self->rot.f[2]) * 2.0f; - v70.f[1] = FUN_001f9de0(self->rot.f[2]) * 2.0f; + v70.f[0] = fast_cos(self->rot.f[2]) * 2.0f; + v70.f[1] = fast_sin(self->rot.f[2]) * 2.0f; v70.f[2] = 0.0f; res12 = FUN_L00_00258b50(self, &v->x180, &v70, &v80, 1.0f); - FUN_001f9a28(&v90, &target.pos, &v->home); - if (FUN_001f9b80(&self->pos, &target.pos) < 1.5f && r12 <= 1.0f) { + fast_vec_sub(&v90, &target.pos, &v->home); + if (vector_distance(&self->pos, &target.pos) < 1.5f && r12 <= 1.0f) { self->state = 4; - SET_ANIM(self, 3, 0, FUN_001f96f8(3)); + SET_ANIM(self, 3, 0, scale_game_frames(3)); } else if (r12 <= 1.0f && !(res12 & 2)) { self->state = 5; - SET_ANIM(self, 2, 0, FUN_001f96f8(3)); - } else if (FUN_001f9b80(&self->pos, &target.pos) > v->range + 6.0f) { + SET_ANIM(self, 2, 0, scale_game_frames(3)); + } else if (vector_distance(&self->pos, &target.pos) > v->range + 6.0f) { self->state = 16; - SET_ANIM(self, 0, 0, FUN_001f96f8(3)); + SET_ANIM(self, 0, 0, scale_game_frames(3)); } else if (self->anim_flags & 2) { random_integer_below(4); n = random_integer_below(4) ? 4 : 5; - blend_moby_animation(self, n, 0, FUN_001f96f8(3)); + blend_moby_animation(self, n, 0, scale_game_frames(3)); } FUN_00213508(&self->pos, 0, 0.5f); if (FUN_L00_001f35d8_cf() == 0 || FUN_L00_001f35d8_cf() == 8) { self->state = 16; - SET_ANIM(self, 0, 0, FUN_001f96f8(3)); + SET_ANIM(self, 0, 0, scale_game_frames(3)); } self->hit = 0; break; case 13: if (self->anim_next != 2) { - SET_ANIM(self, 2, 0, FUN_001f96f8(3)); + SET_ANIM(self, 2, 0, scale_game_frames(3)); } - v70.f[0] = FUN_001f9dc8(self->rot.f[2]) * (v->speed * frame_time); - v70.f[1] = FUN_001f9de0(self->rot.f[2]) * (v->speed * frame_time); + v70.f[0] = fast_cos(self->rot.f[2]) * (v->speed * frame_time); + v70.f[1] = fast_sin(self->rot.f[2]) * (v->speed * frame_time); v70.f[2] = 0.0f; - FUN_001f9a10(&v80, &self->pos, &v70); + fast_vec_add(&v80, &self->pos, &v70); for (m = D_L01_0015FFE4; m != NULL; m = m->next) { if (m == (MobyNode *)self || m->state < 0) { continue; } if (m->oclass == 0 || m->oclass == 0x241) { - if (FUN_001f9b80(&v80, &m->pos) < 2.0f) { + if (vector_distance(&v80, &m->pos) < 2.0f) { z = self->pos.f[2]; d13 = fast_subtract_rotations( self->rot.f[2], FUN_L00_001ff8b0_cf(m->pos.f[0] - self->pos.f[0], @@ -2055,9 +2057,9 @@ void FUN_L01_002efc60(Mob577 *self) { turn = -turn; } self->rot.f[2] = fast_add_rotations(self->rot.f[2], turn); - FUN_001f9a28(&v80, &self->pos, &m->pos); + fast_vec_sub(&v80, &self->pos, &m->pos); FUN_L00_001ff500_cf(&v80, &v80, 2.0f); - FUN_001f9a10(&v80, &v80, &m->pos); + fast_vec_add(&v80, &v80, &m->pos); v80.f[2] = z; } } @@ -2071,14 +2073,14 @@ void FUN_L01_002efc60(Mob577 *self) { self->pos.f[2] = g13; } if (v->leader == NULL || - FUN_001f9b80(&self->pos, &v->leader->pos) > FUN_001fa6c0(v->x216)) { + vector_distance(&self->pos, &v->leader->pos) > convert_integer_to_float(v->x216)) { self->state = 5; - SET_ANIM(self, 2, 0, FUN_001f96f8(3)); + SET_ANIM(self, 2, 0, scale_game_frames(3)); } self->hit = 0; break; } - FUN_L00_0025d538(self, v->fx110); + trooper_anim_finish(self, v->fx110); FUN_L00_0025a120(self); } typedef struct Moby { @@ -2115,7 +2117,7 @@ typedef struct { } PathCarrierVars; extern f32 FUN_001f9b48(void *, void *); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); @@ -2125,9 +2127,10 @@ extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); /* nearest point of the path to pos, with its segment and position on it */ extern void FUN_L00_0025df68(PePath *, void *, void *, f32 *, s32 *, s32, f32, f32, f32); /* the point a step further along the path; nonzero at the path's end */ -extern s32 FUN_L00_0025d808(PePath *, void *, f32 *, s32 *, s32, f32); +extern s32 sample_path(PePath *, void *, f32 *, s32 *, s32, f32) __asm__("FUN_L00_0025d808"); -void FUN_L01_002f3120(Moby *self) +void water_current_update(Moby *self) __asm__("FUN_L01_002f3120"); +void water_current_update(Moby *self) { PathCarrierVars *v; PePath *path; @@ -2165,8 +2168,8 @@ void FUN_L01_002f3120(Moby *self) return; } FUN_L00_0025df68(path, &hero.motion.pos, &nearest, &t, &seg, 0, 999.0f, 5.0f, 0.0f); - at_end = FUN_L00_0025d808(path, &ahead, &t, &seg, 0, 2.0f); - dist = FUN_001f9b80(&hero.motion.pos, &nearest); + at_end = sample_path(path, &ahead, &t, &seg, 0, 2.0f); + dist = vector_distance(&hero.motion.pos, &nearest); if (v->radius < dist) { return; } @@ -2231,7 +2234,8 @@ extern Moby *D_L01_0015FFD8; f32 fast_add_rotations(f32 a, f32 b) __asm__("FUN_001fa580"); f32 fast_normalize_angle(f32 a) __asm__("FUN_001fa610"); -void FUN_L01_002f4348(Moby *self) { +void cave_door_update(Moby *self) __asm__("FUN_L01_002f4348"); +void cave_door_update(Moby *self) { RotVars *v; Moby *m; f32 *mv; @@ -2272,9 +2276,9 @@ extern short D_L01_00161AF4 __attribute__((sda)); extern short D_L01_00161AF8 __attribute__((sda)); extern short D_L01_00161AFC __attribute__((sda)); extern void *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_00263d40(int, int); -extern void FUN_L01_002f5168(char *); +extern void gunship_follow_path(char *) __asm__("FUN_L01_002f5168"); extern void FUN_L01_0030be70(char *, void *, float); extern void allocate_voice_for_bank_entry_alt(int, int, int) __asm__("FUN_0022db10"); extern void mark_moby_for_removal(void *) __asm__("func_0020C828"); @@ -2282,7 +2286,8 @@ extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); /* Per-frame update of a breakable moby: scales its speed by distance, and on a hit spawns the break effect, frees its child mobys and removes itself; otherwise fades its alpha by height. */ -void FUN_L01_002f4428(char *moby) { +void fighter_jet_update(char *moby) __asm__("FUN_L01_002f4428"); +void fighter_jet_update(char *moby) { float hit_dir[4]; float hit_vec[4]; char *data = *(char **)(moby + 0x78); @@ -2316,7 +2321,7 @@ void FUN_L01_002f4428(char *moby) { subtract_vector_xyz(hit_vec, data + 0xD0, data + 0xE0); moby[0x20] = 0x65; *(u128 *)hit_dir = *(u128 *)hit_vec; - FUN_L00_0025e450(moby, hit_dir, moby + 0x10, 0.0f, 0.0f, 0x14, 3, 4, 4.0f, 2.0f, 100000.0f, 3.0f, 1, 15.0f, 1, 1, -1, 0); + spawn_explosion(moby, hit_dir, moby + 0x10, 0.0f, 0.0f, 0x14, 3, 4, 4.0f, 2.0f, 100000.0f, 3.0f, 1, 15.0f, 1, 1, -1, 0); FUN_L01_0030be70(moby, hit_dir, speed_scale); child_ids = (int *)(data + 0x140); for (i = 0; i < 4; i++) { @@ -2328,7 +2333,7 @@ void FUN_L01_002f4428(char *moby) { return; } if (((unsigned char *)moby)[0x20] == 0x65) return; - FUN_L01_002f5168(moby); + gunship_follow_path(moby); *(unsigned short *)(moby + 0x34) |= 0x1000; data[0x2B] = 1; data[0x2C] = 0x64; @@ -2379,7 +2384,8 @@ extern int voice_is_playing_for(void *moby, int handle) __asm__("FUN_L00_0028d8c extern void release_voice_slot(int) __asm__("FUN_0022d798"); extern s32 allocate_voice_for_target_entry(s32, s32, void *) __asm__("FUN_0022da68"); -void FUN_L01_002f4710(Moby *self) +void door_half_update(Moby *self) __asm__("FUN_L01_002f4710"); +void door_half_update(Moby *self) { struct SliderVars *v; Moby *driver; @@ -2438,7 +2444,7 @@ void FUN_L01_002f4710(Moby *self) break; } } -/* pvars of the rider carrier FUN_L01_002f4960 runs */ +/* pvars of the rider carrier stationary_ship_update runs */ typedef struct { u8 pad0[0x60]; s32 node; /* 0x60: path node it is at */ @@ -2536,12 +2542,13 @@ extern f32 fast_subtract_rotations_f49(f32, f32) __asm__("FUN_001fa5c8"); extern void transform_vector_f49(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void advance_moby_animation(void *) __asm__("FUN_0020d580"); extern void FUN_L00_00250df8(void *); -extern void FUN_L01_002f5168(char *); +extern void gunship_follow_path(char *) __asm__("FUN_L01_002f5168"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); /* Rider carrier: waits for the hero in its clip volume, then follows its path carrying up to eight rider mobys (and steers its camera moby), drops them off one by one at the marked node and removes itself at the end of the path. */ -void FUN_L01_002f4960(CarrierMoby *m) { +void stationary_ship_update(CarrierMoby *m) __asm__("FUN_L01_002f4960"); +void stationary_ship_update(CarrierMoby *m) { CarrierVars *v; CarrierCamVars *cv; PePath *p; @@ -2593,7 +2600,7 @@ void FUN_L01_002f4960(CarrierMoby *m) { } break; case 2: - FUN_L01_002f5168((char *)m); + gunship_follow_path((char *)m); if (v->camera != -1) { cv = (CarrierCamVars *)D_L01_0015FFD8_m[v->camera].pvars; a = FUN_001f9e90_cf(m->pos.x - D_L01_00167100_c.x, m->pos.y - D_L01_00167100_c.y); @@ -2624,7 +2631,7 @@ void FUN_L01_002f4960(CarrierMoby *m) { } break; } - FUN_001f9770(&v->timer); + fast_dec_timer_s16(&v->timer); if (v->arrived == 0 || v->timer != 0 || m->seq != 2) { for (i = 0; i < 8; i++) { offs = D_L01_0020B360; @@ -2633,7 +2640,7 @@ void FUN_L01_002f4960(CarrierMoby *m) { D_L01_0015FFD8_m[v->riders[i]].flags &= ~0x41; } transform_vector_f49(&offs.v[i], &offs.v[i], &m->unkC0); - FUN_001f9a10(&D_L01_0015FFD8_m[v->riders[i]].pos, &m->pos, &offs.v[i]); + fast_vec_add(&D_L01_0015FFD8_m[v->riders[i]].pos, &m->pos, &offs.v[i]); qcopy_nc(&D_L01_0015FFD8_m[v->riders[i]].rot, &m->rot); D_L01_0015FFD8_m[v->riders[i]].rot.z = fast_add_rotations(D_L01_0015FFD8_m[v->riders[i]].rot.z, 3.1415927f); @@ -2674,11 +2681,11 @@ void FUN_L01_002f4960(CarrierMoby *m) { } } extern ScrollLayer D_L01_001E2FC0[]; -void FUN_L00_002371e0(void); +void mine_blend_color(void) __asm__("FUN_L00_002371e0"); void FUN_L01_002b96e0(s32, ScrollLayer *); void FUN_L01_002f60f8(void) { - FUN_L00_002371e0(); + mine_blend_color(); FUN_L01_002b96e0(8, D_L01_001E2FC0); } #include "eetypes.h" @@ -2697,11 +2704,11 @@ typedef struct { s32 D_L01_00161BA0 = 0; extern BoundGroup D_L01_001E3380[]; -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); -extern void FUN_001f9a28(void *, void *, void *); -extern f32 FUN_001f9af0(void *); -extern f32 FUN_001fa6c0(s32); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); +extern f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); extern void FUN_L01_002f6150(void); void enqueue_callback_list_1(void *fn, void *arg) __asm__("FUN_001f4600"); @@ -2720,15 +2727,15 @@ void FUN_L01_002f6180(void *arg) { qzero(&c); p = (D_L01_001E3380 + i)->pts; for (j = 0; j < (D_L01_001E3380 + i)->count; j++) { - FUN_001f9a10(&c, &c, p); + fast_vec_add(&c, &c, p); p++; } - fast_vec_scale(&c, &c, 1.0f / FUN_001fa6c0((D_L01_001E3380 + i)->count)); + fast_vec_scale(&c, &c, 1.0f / convert_integer_to_float((D_L01_001E3380 + i)->count)); c.f[3] = 0.0f; p = (D_L01_001E3380 + i)->pts; for (k = 0; k < (D_L01_001E3380 + i)->count; k++) { - FUN_001f9a28(&d, &c, p); - r = FUN_001f9af0(&d); + fast_vec_sub(&d, &c, p); + r = fast_vec_length(&d); if (c.f[3] < r) { c.f[3] = r; } @@ -2771,9 +2778,9 @@ typedef struct { extern void *create_moby(s32 oclass) __asm__("FUN_0020c4f8"); extern void FUN_L00_00250df8(); extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); -extern s32 FUN_001f96f8(s32); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern void FUN_L00_0026daa0(void *, u32, s32, s32, f32); extern s32 allocate_voice_for_target_entry(s32, s32, void *) __asm__("FUN_0022da68"); @@ -2808,9 +2815,9 @@ BeamMoby *FUN_L01_002f68a0(void *owner, u128 *pos, u128 *dir, u128 *color, s32 k qcopy(&v->dir, pd); qcopy(&v->color, pc); v->kind = kind; - v->len = FUN_001f9af0(pd); - FUN_L00_0026daa0(m, 0x2F4F7F7F, FUN_001f96f8(0x78), -1, 420000.0f); - FUN_L00_0026daa0(m, 0x4F6F7F7F, FUN_001f96f8(0x78), -1, 210000.0f); + v->len = fast_vec_length(pd); + FUN_L00_0026daa0(m, 0x2F4F7F7F, scale_game_frames(0x78), -1, 420000.0f); + FUN_L00_0026daa0(m, 0x4F6F7F7F, scale_game_frames(0x78), -1, 210000.0f); allocate_voice_for_target_entry(0, 0, m); FUN_L00_00250df8(m); } @@ -2946,7 +2953,8 @@ extern GunshipMoby *spawn_beam(void *, void *, void *, void *, s32, s32) __asm__ extern s32 current_level_index_macro __asm__("D_0015ED84") __attribute__((section(".sdata"))); extern f32 frame_time_macro __asm__("D_0015ED6C") __attribute__((section(".sdata"))); /* Ported from rac1-decomp src/overlays/l01_novalis/vendor_002BA898.c (func_L01_002F8B00) */ -void FUN_L01_002f7728(GunshipMoby *m) { +void bomber_jet_update(GunshipMoby *m) __asm__("FUN_L01_002f7728"); +void bomber_jet_update(GunshipMoby *m) { GunshipVars *d = m->vars; GunshipFollow *sub = &d->sub; float s; @@ -3215,16 +3223,17 @@ extern f32 D_L01_00161BF8 __attribute__((sda)); extern f32 D_L01_00161BFC __attribute__((sda)); extern f32 D_L01_00161C00 __attribute__((sda)); extern f32 spring_axis_to(f32 *, f32, f32 *, f32, f32, f32) __asm__("FUN_L01_002f81c8"); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); f32 FUN_001f99c0(f32); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern void FUN_L00_00258490(void *, void *, void *, s32, f32, f32, f32, f32); extern f32 FUN_001f9b48(void *, void *); extern void fast_vec_normalize(void *, void *, f32) __asm__("FUN_001f9bf8"); extern f32 resolve_camera_surface_height(void *, s32) __asm__("FUN_002135f0"); -void FUN_L01_002f8268(HoverMoby *m) { +void water_lily_update(HoverMoby *m) __asm__("FUN_L01_002f8268"); +void water_lily_update(HoverMoby *m) { HoverVars *v; struct Hero *pl; HoverVec old; @@ -3251,12 +3260,12 @@ void FUN_L01_002f8268(HoverMoby *m) { D_L01_00161BF4, 3.0f); spring_axis_to(&m->pos.v.y, v->home_y, &v->vel_y, D_L01_00161BF0 * frame_time_sq, D_L01_00161BF4, 3.0f); - if (FUN_001f9b80(&m->pos, &hero.motion.pos) < D_L01_00161BF8) { + if (vector_distance(&m->pos, &hero.motion.pos) < D_L01_00161BF8) { if (FUN_001f99c0(m->pos.v.z - hero.motion.pos.f[2]) < 0.7f) { ang = fast_arc_tan(m->pos.v.x - hero.motion.pos.f[0], m->pos.v.y - hero.motion.pos.f[1]); - m->pos.v.x = FUN_001f9dc8(ang) * D_L01_00161BF8; - m->pos.v.y = FUN_001f9de0(ang) * D_L01_00161BF8; + m->pos.v.x = fast_cos(ang) * D_L01_00161BF8; + m->pos.v.y = fast_sin(ang) * D_L01_00161BF8; m->pos.v.x += hero.motion.pos.f[0]; m->pos.v.y += hero.motion.pos.f[1]; } @@ -3266,10 +3275,10 @@ void FUN_L01_002f8268(HoverMoby *m) { m->pos.v.y = tgt.v.y; m->pos.v.z = old.v.z; if (FUN_001f9b48(&old, &m->pos) > D_L01_00161BFC * frame_time_macro) { - FUN_001f9a28(&d, &m->pos, &old); + fast_vec_sub(&d, &m->pos, &old); step.q = d.q; fast_vec_normalize(&step, &step, D_L01_00161BFC * frame_time_macro); - FUN_001f9a10(&d, &old, &step); + fast_vec_add(&d, &old, &step); m->pos.q = d.q; } dz = resolve_camera_surface_height(&m->pos, 0) - m->pos.v.z; @@ -3314,13 +3323,13 @@ typedef struct { SteamColors D_L01_00161C08 = {{0x2b8, 0x2b9, 0x2ba}}; extern SteamColors D_L01_00161C18; -extern int FUN_001f9770(void *); -extern s32 FUN_001f9740(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +extern s32 tick_countdown_32(void *) __asm__("FUN_001f9740"); extern f32 random_angle_radians(void) __asm__("FUN_00213308"); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); -extern void FUN_L01_002f8530(void *, void *, u32, s32, f32, f32, f32, f32, s32); -extern void *FUN_L00_0026bed0(void *, void *, u32, u32, f32, s32, u32); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); +extern void spawn_debris_chunk(void *, void *, u32, s32, f32, f32, f32, f32, s32) __asm__("FUN_L01_002f8530"); +extern void *mine_debris(void *, void *, u32, u32, f32, s32, u32) __asm__("FUN_L00_0026bed0"); void FUN_L01_002f8c58(SteamMoby *m) { SteamVars *v; @@ -3336,13 +3345,13 @@ void FUN_L01_002f8c58(SteamMoby *m) { s32 i; v = m->pvars; - FUN_001f9770(&v->puff_timer); - FUN_001f9770(&v->burst_timer); + fast_dec_timer_s16(&v->puff_timer); + fast_dec_timer_s16(&v->burst_timer); if (v->active == 0) { return; } - if (FUN_001f9740(v)) { - v->puff_timer = FUN_001f96f8(0x78); + if (tick_countdown_32(v)) { + v->puff_timer = scale_game_frames(0x78); } if (v->burst_timer == 0 && random_integer_below(100) < 5) { colors = D_L01_00161C08; @@ -3352,12 +3361,12 @@ void FUN_L01_002f8c58(SteamMoby *m) { vel.q = pos.q; r = random_float_between(0.0f, 0.25f); ang = random_angle_radians(); - pos.f[0] = FUN_001f9dc8(ang) * r; - pos.f[1] = FUN_001f9de0(ang) * r; + pos.f[0] = fast_cos(ang) * r; + pos.f[1] = fast_sin(ang) * r; pos.f[2] = 0.0f; - FUN_001f9a10(&pos, &pos, &m->pos); + fast_vec_add(&pos, &pos, &m->pos); pos.f[2] += v->height; - FUN_L01_002f8530(&pos, &vel, colors.c[random_integer_below(3)], + spawn_debris_chunk(&pos, &vel, colors.c[random_integer_below(3)], random_int_between(0xB4, 0x12C), 0.05f, 1.0f, 1.0f, 0.75f, 0); } for (i = 0; i < 2; i++) { @@ -3369,17 +3378,17 @@ void FUN_L01_002f8c58(SteamMoby *m) { vel.q = puff.q; r = random_float_between(0.0f, 0.25f); ang = random_angle_radians(); - puff.f[0] = FUN_001f9dc8(ang) * r; - puff.f[1] = FUN_001f9de0(ang) * r; + puff.f[0] = fast_cos(ang) * r; + puff.f[1] = fast_sin(ang) * r; puff.f[2] = 0.0f; - FUN_001f9a10(&puff, &puff, &m->pos); + fast_vec_add(&puff, &puff, &m->pos); r *= frame_time_macro; r *= 8.0f; puff.f[2] += v->height; vel.f[2] += r; size = random_float_between(70000.0f, 140000.0f); - life = FUN_001f96f8(0xB4); - p = FUN_L00_0026bed0(&puff, &vel, 0x0F081020, 0x00081020, size, life, + life = scale_game_frames(0xB4); + p = mine_debris(&puff, &vel, 0x0F081020, 0x00081020, size, life, colors.c[random_integer_below(3)]); if (p != 0) { p->floor_z = m->pos.f[2] - 0.5f; @@ -3486,12 +3495,13 @@ void FUN_L01_002f9000(Obj *obj); extern void FUN_L00_002eac18(s32); extern int hero_set_state(int, int) __asm__("FUN_L01_0023cf98"); -void FUN_L01_002f9080(CapMoby *m) { +void falling_rock_update(CapMoby *m) __asm__("FUN_L01_002f9080"); +void falling_rock_update(CapMoby *m) { CapVars *v; u8 *e; v = m->pvars; - if (m->state != 1 && !FUN_001f9770(&v->wait) && random_integer_below(100) < 5) { + if (m->state != 1 && !fast_dec_timer_s16(&v->wait) && random_integer_below(100) < 5) { CapColors colors; CapVec vel; CapVec pos; @@ -3505,11 +3515,11 @@ void FUN_L01_002f9080(CapMoby *m) { vel.q = pos.q; r = random_float_between(2.0f, 3.0f); ang = random_angle_radians(); - pos.f[0] = FUN_001f9dc8(ang) * r; - pos.f[1] = FUN_001f9de0(ang) * r; + pos.f[0] = fast_cos(ang) * r; + pos.f[1] = fast_sin(ang) * r; pos.f[2] = 0.0f; - FUN_001f9a10(&pos, &pos, &v->home); - FUN_L01_002f8530(&pos, &vel, colors.c[random_integer_below(3)], + fast_vec_add(&pos, &pos, &v->home); + spawn_debris_chunk(&pos, &vel, colors.c[random_integer_below(3)], random_int_between(0xB4, 0x12C), 0.05f, 1.0f, 1.0f, 0.75f, 0); } switch (m->state) { @@ -3532,22 +3542,22 @@ void FUN_L01_002f9080(CapMoby *m) { if (v->cam != -1) { e = (u8 *)(v->cam * 128 + (s32)D_L01_001600EC_u); if (hero.motion.pos.f[2] >= *(f32 *)(e + 0x38) && - FUN_001f9b80(&hero.motion.pos, e + 0x30) < 10.0f && + vector_distance(&hero.motion.pos, e + 0x30) < 10.0f && ((u32)hero.state.control_mode < 2 || hero.state.control_mode == 9)) { - v->wait = random_int_between(FUN_001f96f8(300), FUN_001f96f8(600)); - v->rise = FUN_001f96f8(v->rise_len); + v->wait = random_int_between(scale_game_frames(300), scale_game_frames(600)); + v->rise = scale_game_frames(v->rise_len); m->state = 2; D_L01_00167100.shake = 0.4f; - D_L01_00167100.shake_time = FUN_001f96f8(30); + D_L01_00167100.shake_time = scale_game_frames(30); allocate_voice_for_target_entry(1, 0, m); } } break; case 2: FUN_L01_002f9000((Obj *)m); - if (FUN_001f9770(&v->rise)) { + if (fast_dec_timer_s16(&v->rise)) { clear_u64_value(&v->rot); - v->hold = FUN_001f96f8(0x2D); + v->hold = scale_game_frames(0x2D); m->state = 3; } break; @@ -3558,10 +3568,10 @@ void FUN_L01_002f9080(CapMoby *m) { m->pos.f[2] -= 0.0f; qcopy(&old, &m->pos); v->rot.f[2] -= frame_time_sq * 30.0f; - FUN_001f9a10(&m->pos, &m->pos, &v->rot); - if (FUN_001f9770(&v->hold) && 20.0f < v->home.f[2] - m->pos.f[2]) { + fast_vec_add(&m->pos, &m->pos, &v->rot); + if (fast_dec_timer_s16(&v->hold) && 20.0f < v->home.f[2] - m->pos.f[2]) { D_L01_00167100.shake = 0.1f; - D_L01_00167100.shake_time = FUN_001f96f8(20); + D_L01_00167100.shake_time = scale_game_frames(20); clear_u64_value(&v->rot); m->state = 4; allocate_voice_for_target_entry(0, 0, m); @@ -3617,11 +3627,12 @@ typedef struct { u8 mode; } LiftMoby; -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern s32 truncate_float_to_s32_u(f32) __asm__("FUN_001fa6d0"); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); -void FUN_L01_002f95c0(LiftMoby *m) { +void piston_platform_update(LiftMoby *m) __asm__("FUN_L01_002f95c0"); +void piston_platform_update(LiftMoby *m) { LiftVars *v; u128 old; u128 delta; @@ -3629,7 +3640,7 @@ void FUN_L01_002f95c0(LiftMoby *m) { v = m->pvars; qcopy(&old, &m->pos); - FUN_001f9770(&v->timer); + fast_dec_timer_s16(&v->timer); if (m->state == 0) { v->x28 = 4; v->x3e = 0xD; @@ -3637,7 +3648,7 @@ void FUN_L01_002f95c0(LiftMoby *m) { v->x24 = 0; v->home_z = ((f32 *)&m->pos)[2]; m->mode = v->home_mode; - v->timer = FUN_001f96f8(0x78); + v->timer = scale_game_frames(0x78); m->state = 1; m->b30 = 0xFF; m->h32 = 0xFF; @@ -3648,8 +3659,8 @@ void FUN_L01_002f95c0(LiftMoby *m) { if (v->timer == 0) { m->mode = 2; v->speed = - v->travel / FUN_001fa6c0(FUN_001f96f8(truncate_float_to_s32_u(v->period * 60.0f))); - v->timer = FUN_001f96f8(truncate_float_to_s32_u(v->period * 60.0f)); + v->travel / convert_integer_to_float(scale_game_frames(truncate_float_to_s32_u(v->period * 60.0f))); + v->timer = scale_game_frames(truncate_float_to_s32_u(v->period * 60.0f)); allocate_voice_for_target_entry(0, 0, m); } break; @@ -3657,8 +3668,8 @@ void FUN_L01_002f95c0(LiftMoby *m) { if (v->timer == 0) { m->mode = 2; v->speed = -(v->travel / - FUN_001fa6c0(FUN_001f96f8(truncate_float_to_s32_u(v->period * 60.0f)))); - v->timer = FUN_001f96f8(truncate_float_to_s32_u(v->period * 60.0f)); + convert_integer_to_float(scale_game_frames(truncate_float_to_s32_u(v->period * 60.0f)))); + v->timer = scale_game_frames(truncate_float_to_s32_u(v->period * 60.0f)); allocate_voice_for_target_entry(1, 0, m); } break; @@ -3673,11 +3684,11 @@ void FUN_L01_002f95c0(LiftMoby *m) { if (m->mode == v->home_mode) { ((f32 *)&m->pos)[2] = v->home_z; } - v->timer = FUN_001f96f8(0x78); + v->timer = scale_game_frames(0x78); } break; } dp = δ - FUN_001f9a28(dp, &m->pos, &old); - FUN_L00_00260738(v->x60, dp, m->x40, m->x40); + fast_vec_sub(dp, &m->pos, &old); + update_entity_matrix(v->x60, dp, m->x40, m->x40); } diff --git a/src/overlays/l01/gameplay/entities/rock_formation.c b/src/overlays/l01/gameplay/entities/rock_formation.c index 3351afc8f4..a59d8ce183 100644 --- a/src/overlays/l01/gameplay/entities/rock_formation.c +++ b/src/overlays/l01/gameplay/entities/rock_formation.c @@ -29,19 +29,20 @@ extern void *trooper_find_hit(void *, s32, s32) __asm__("FUN_L00_0025a420"); extern s32 FUN_0022da68(s32, s32, void *); extern f32 random_float_between(f32, f32) __asm__("FUN_002132a8"); extern s32 random_integer_below(s32) __asm__("FUN_00213260"); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern void fast_vec_normalize(void *, void *, f32) __asm__("FUN_001f9bf8"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern int FUN_L00_00257b90(int lo, int hi); -extern s32 FUN_001f96f8(s32); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern void FUN_L00_0026ced0(void *, void *, int, int, float, int); extern struct Moby *spawn_debris_chunk(void *, void *, s32, f32, s32, f32, f32, f32, s32) __asm__("FUN_L01_002f8530"); extern void FUN_L00_00257470(void *, s32, s32); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); /* Once hit hard enough: bursts into 200 smoke puffs and 40 debris chunks, then removes itself. */ -void FUN_L01_002f9810(struct Moby *m) { +void rock_formation_update(struct Moby *m) __asm__("FUN_L01_002f9810"); +void rock_formation_update(struct Moby *m) { DebrisHit *hit; s32 i; s32 j; @@ -65,17 +66,17 @@ void FUN_L01_002f9810(struct Moby *m) { off.q = 0; vel.q = pos.q; s = random_float_between(-1.0f, 1.0f); - s *= FUN_001f9dc8(m->rot.z); + s *= fast_cos(m->rot.z); off.f[0] = s; s = random_float_between(-0.3f, 0.3f); - s *= FUN_001f9de0(m->rot.z); + s *= fast_sin(m->rot.z); off.f[1] = s; off.f[2] = random_float_between(0.0f, 2.0f); pos.q = off.q; - FUN_001f9a10(&pos, &pos, &m->pos); + fast_vec_add(&pos, &pos, &m->pos); fast_vec_normalize(&vel, &vel, random_float_between(0.5f, 1.5f) * frame_time); s = random_float_between(0.5f, 1.0f) * 210000.0f; - FUN_L00_0026ced0(&pos, &vel, 0x5F787878, 0x181818, s, FUN_001f96f8(FUN_L00_00257b90(30, 90))); + FUN_L00_0026ced0(&pos, &vel, 0x5F787878, 0x181818, s, scale_game_frames(FUN_L00_00257b90(30, 90))); } } for (j = 0; j < 40; j++) { @@ -92,14 +93,14 @@ void FUN_L01_002f9810(struct Moby *m) { off.q = 0; vel.q = pos.q; s = random_float_between(-1.2f, 1.2f); - s *= FUN_001f9dc8(m->rot.z); + s *= fast_cos(m->rot.z); off.f[0] = s; s = random_float_between(-0.4f, 0.4f); - s *= FUN_001f9de0(m->rot.z); + s *= fast_sin(m->rot.z); off.f[1] = s; off.f[2] = random_float_between(0.5f, 2.0f); pos.q = off.q; - FUN_001f9a10(&pos, &pos, &m->pos); + fast_vec_add(&pos, &pos, &m->pos); fast_vec_normalize(&vel, &vel, random_float_between(1.0f, 5.0f) * frame_time); spawn_debris_chunk(&pos, &vel, colors.c[random_integer_below(3)], random_float_between(0.04f, 0.09f), FUN_L00_00257b90(60, 180), 1.0f, 1.0f, 0.75f, 0); @@ -139,11 +140,12 @@ extern f32 random_float_between(f32, f32) __asm__("FUN_002132a8"); extern s32 rand(void) __asm__("FUN_001160d8"); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); extern void collect_mobies_in_sphere(void *, s32, void *, void *, f32) __asm__("FUN_L00_001f2868"); -extern s32 FUN_001f9740(void *); -extern s32 FUN_001f96f8(s32); +extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); -void FUN_L01_002f9bf0(SwayMoby *m) { +void fan_update(SwayMoby *m) __asm__("FUN_L01_002f9bf0"); +void fan_update(SwayMoby *m) { SwayVars *v; CollQuery q; @@ -161,9 +163,9 @@ void FUN_L01_002f9bf0(SwayMoby *m) { q.x20 = 0; collect_mobies_in_sphere(m->pos, 0x10, m, &q, 1.2f); if (v->dir == v->sway) { - if (FUN_001f9740(&v->timer)) { + if (fast_dec_timer(&v->timer)) { v->dir = -v->dir; - v->timer = FUN_001f96f8(0x5A); + v->timer = scale_game_frames(0x5A); } } v->sway += frame_time * 4.0f * v->dir; @@ -215,15 +217,16 @@ extern void *trooper_find_hit(void *, s32, s32) __asm__("FUN_L00_0025a420"); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern f32 random_angle_radians(void) __asm__("FUN_00213308"); extern s32 random_integer_below(s32) __asm__("FUN_00213260"); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern void fast_vec_normalize(void *, void *, f32) __asm__("FUN_001f9bf8"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern int FUN_L00_00257b90(int lo, int hi); extern void FUN_L01_002f8530(void *, void *, u32, s32, f32, f32, f32, f32, s32); extern s32 D_0014C190_257218[][64] __asm__("D_0014C190"); -void FUN_L01_002f9d80(BurstMoby *self) { +void bridge_piece_1_update(BurstMoby *self) __asm__("FUN_L01_002f9d80"); +void bridge_piece_1_update(BurstMoby *self) { BurstTarget *t; BurstColors colors; BurstVec dir; @@ -247,11 +250,11 @@ void FUN_L01_002f9d80(BurstMoby *self) { dir.q = pos.q; r = random_float_between(2.0f, 3.0f); ang = random_angle_radians(); - pos.f[0] = FUN_001f9dc8(ang) * r; - pos.f[1] = FUN_001f9de0(ang) * r; + pos.f[0] = fast_cos(ang) * r; + pos.f[1] = fast_sin(ang) * r; pos.f[2] = 0.0f; fast_vec_normalize(&dir, &dir, random_float_between(frame_time * 5.0f, frame_time * 20.0f)); - FUN_001f9a10(&pos, &pos, &self->pos); + fast_vec_add(&pos, &pos, &self->pos); FUN_L01_002f8530(&pos, &dir, colors.c[random_integer_below(3)], FUN_L00_00257b90(0xB4, 0x12C), 0.05f, 1.0f, 1.0f, 0.75f, 0); } @@ -286,7 +289,7 @@ typedef struct { extern void *spawn_beam_moby(s32 oclass) __asm__("FUN_0020c4f8"); extern f32 random_angle_radians(void) __asm__("FUN_00213308"); -void FUN_L00_002502f0(void *, s32, s32, s32); +void set_moby_color(void *, s32, s32, s32) __asm__("FUN_L00_002502f0"); void FUN_L00_0026daa0(void *, u32, s32, s32, f32); extern void FUN_L00_00250df8(); @@ -310,7 +313,7 @@ BeamMoby *FUN_L01_002fa068(s32 owner, u128 *pos, u128 *target, s32 color) { m->h32 = 0x7F; m->b31 = 1; m->scale *= 0.5f; - FUN_L00_002502f0(m, 0x7F, 0x7F, 0x7F); + set_moby_color(m, 0x7F, 0x7F, 0x7F); m->rx = random_angle_radians(); m->ry = random_angle_radians(); m->rz = random_angle_radians(); @@ -334,7 +337,7 @@ typedef struct { u32 c[6]; } BurstPalette; -/* Light used by the flash; FUN_L00_002d3838 places it at a position. */ +/* Light used by the flash; mine_camera_blast places it at a position. */ typedef struct { u8 pad_00[0x20]; f32 r; @@ -352,7 +355,7 @@ extern void FUN_L00_0026a9f0(void *, void *, u32, u32, f32, s32, s32, f32, s32, extern s32 spawn_glow_particle(void *, void *, void *, f32, s32, s32, s32, s32, s32) __asm__("FUN_L00_002ac910"); /* allocate_voice_for_target_entry; the unit declares it under this name */ extern s32 FUN_0022da68(s32, s32, void *); -extern void FUN_L00_002d3838(void *, void *, s32, s32); +extern void mine_camera_blast(void *, void *, s32, s32) __asm__("FUN_L00_002d3838"); void FUN_L01_002fa1b0(struct Moby *moby, u128 *where, s32 sound, f32 scale, f32 light) { @@ -379,14 +382,14 @@ void FUN_L01_002fa1b0(struct Moby *moby, u128 *where, s32 sound, f32 scale, f32 FUN_L00_0026a9f0(pos_p, &vel, inner_p->c[random_integer_below(6)], outer.c[random_integer_below(6)], size, - random_int_between(FUN_001f96f8(0xF), FUN_001f96f8(0x14)), - random_int_between(FUN_001f96f8(0x19), FUN_001f96f8(0x1E)), + random_int_between(scale_game_frames(0xF), scale_game_frames(0x14)), + random_int_between(scale_game_frames(0x19), scale_game_frames(0x1E)), speed * scale, 0, 0); } if (moby != 0) { - spawn_glow_particle(moby, pos_p, &vel, scale + scale, FUN_001f96f8(0x14), 0x7F, 0, 0x40, 0x30); - spawn_glow_particle(moby, pos_p, &vel, scale * 1.5f, FUN_001f96f8(0x1D), 0x20, 0, 0x20, 0); + spawn_glow_particle(moby, pos_p, &vel, scale + scale, scale_game_frames(0x14), 0x7F, 0, 0x40, 0x30); + spawn_glow_particle(moby, pos_p, &vel, scale * 1.5f, scale_game_frames(0x1D), 0x20, 0, 0x20, 0); if (moby->state != 0xFE) { if (moby->state != 0xFD && sound != -1) { FUN_0022da68(sound, 0, moby); @@ -404,7 +407,7 @@ void FUN_L01_002fa1b0(struct Moby *moby, u128 *where, s32 sound, f32 scale, f32 D_L01_001E3440.b = 13.0f; D_L01_001E3440.r = 13.0f; } - FUN_L00_002d3838(&D_L01_001E3440, pos_p, 0, 0); + mine_camera_blast(&D_L01_001E3440, pos_p, 0, 0); } } #include "rnc/math/vector.h" @@ -437,9 +440,9 @@ typedef struct { } DropProbe; extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); -extern void FUN_001f9a10(void *, void *, void *); -extern f32 FUN_001f9b80(void *, void *); -extern s32 FUN_001efa68(void *, void *, s32, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern s32 collision_line(void *, void *, s32, void *, void *) __asm__("FUN_001efa68"); extern s32 probe_world_sphere(f32, void *, s32, void *, void *) __asm__("FUN_L00_001f2868"); void FUN_L01_002fa1b0(struct Moby *moby, u128 *where, s32 sound, f32 scale, f32 light); void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); @@ -470,9 +473,9 @@ void update_birdbot_projectile(DropMoby *m) { b = multiply_global_factor_ed64(ten); b = b * multiply_global_factor_ed64(ten); ((f32 *)&v->vel)[2] -= (a * zero + one) * 2.0f / b; - FUN_001f9a10(pos, pos, &v->vel); + fast_vec_add(pos, pos, &v->vel); if (m->pos.f[0] < zero || m->pos.f[1] < zero || m->pos.f[2] < zero || - FUN_001f9b80(pos, D_L01_00167240) > 64.0f) { + vector_distance(pos, D_L01_00167240) > 64.0f) { mark_moby_for_removal(m); return; } @@ -486,11 +489,11 @@ void update_birdbot_projectile(DropMoby *m) { probe.b28 = 1; probe.b29 = 1; probe.id = m->hA6; - if (FUN_001f9740(v->sound) != 0) { + if (fast_dec_timer(v->sound) != 0) { tmp = m->pos.q; FUN_L01_002fa1b0(m, &tmp, 0, 0.5f, zero); mark_moby_for_removal(m); - } else if (FUN_001efa68(&prev, pos, 0, v->coll, &probe) != 0) { + } else if (collision_line(&prev, pos, 0, v->coll, &probe) != 0) { qcopy(pos, &D_L01_001742E0); tmp = m->pos.q; FUN_L01_002fa1b0(m, &tmp, 0, 0.5f, zero); @@ -508,7 +511,8 @@ extern DebrisColors D_L01_00161C70; extern u8 D_0013D388[]; /* Removed once collected; when hit, bursts into 500 smoke puffs and 100 chunks, marks itself collected and sets D_0013D388[0xE] (an item-availability flag). */ -void FUN_L01_002fa800(struct Moby *m) { +void destroyable_cave_wall_update(struct Moby *m) __asm__("FUN_L01_002fa800"); +void destroyable_cave_wall_update(struct Moby *m) { s32 i; s32 j; f32 s; @@ -534,17 +538,17 @@ void FUN_L01_002fa800(struct Moby *m) { off.q = 0; vel.q = pos.q; s = random_float_between(-4.0f, 4.0f); - s *= FUN_001f9dc8(m->rot.z); + s *= fast_cos(m->rot.z); off.f[0] = s; s = random_float_between(-1.0f, 1.0f); - s *= FUN_001f9de0(m->rot.z); + s *= fast_sin(m->rot.z); off.f[1] = s; off.f[2] = random_float_between(0.0f, 8.0f); pos.q = off.q; - FUN_001f9a10(&pos, &pos, &m->pos); + fast_vec_add(&pos, &pos, &m->pos); fast_vec_normalize(&vel, &vel, random_float_between(1.5f, 3.5f) * frame_time); s = random_float_between(1.5f, 3.5f) * 210000.0f; - FUN_L00_0026ced0(&pos, &vel, 0x5F787878, 0x181818, s, FUN_001f96f8(FUN_L00_00257b90(120, 240))); + FUN_L00_0026ced0(&pos, &vel, 0x5F787878, 0x181818, s, scale_game_frames(FUN_L00_00257b90(120, 240))); } } for (j = 0; j < 100; j++) { @@ -561,14 +565,14 @@ void FUN_L01_002fa800(struct Moby *m) { off.q = 0; vel.q = pos.q; s = random_float_between(-4.0f, 4.0f); - s *= FUN_001f9dc8(m->rot.z); + s *= fast_cos(m->rot.z); off.f[0] = s; s = random_float_between(-1.0f, 1.0f); - s *= FUN_001f9de0(m->rot.z); + s *= fast_sin(m->rot.z); off.f[1] = s; off.f[2] = random_float_between(1.0f, 8.0f); pos.q = off.q; - FUN_001f9a10(&pos, &pos, &m->pos); + fast_vec_add(&pos, &pos, &m->pos); fast_vec_normalize(&vel, &vel, random_float_between(1.0f, 5.0f) * frame_time); spawn_debris_chunk(&pos, &vel, colors.c[random_integer_below(3)], random_float_between(0.05f, 0.15f), FUN_L00_00257b90(60, 180), 1.0f, 1.0f, 0.75f, 0); @@ -714,7 +718,8 @@ extern void func_L01_002A3680_2FC140(void) __asm__("FUN_L01_002a2480"); extern unsigned char D_L01_0015FC88[] __attribute__((section(".sdata"))); extern f32 frame_time_macro __asm__("D_0015ED6C") __attribute__((section(".sdata"))); extern s32 current_level_index_macro __asm__("D_0015ED84") __attribute__((section(".sdata"))); -void FUN_L01_002fad68(Moby_2FC140 *moby) { +void agnogg_ship_front_update(Moby_2FC140 *moby) __asm__("FUN_L01_002fad68"); +void agnogg_ship_front_update(Moby_2FC140 *moby) { Data_2FC140 *data; Link_2FC140 *q; int r16; @@ -934,14 +939,15 @@ typedef struct { extern u8 D_0014C050[]; extern u8 D_0013E550[]; -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern void release_voice_slot(int) __asm__("FUN_0022d798"); extern s32 FUN_0022da68(s32, s32, void *); -extern void FUN_001f9a10(void *, void *, void *); -extern f32 FUN_001f9dc8(f32); -extern f32 FUN_001f9de0(f32); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); +extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); -void FUN_L01_002fb8a8(PendulumMoby *self) { +void bridge_half_update(PendulumMoby *self) __asm__("FUN_L01_002fb8a8"); +void bridge_half_update(PendulumMoby *self) { PendulumVars *v; PendVec4 arm; PendVec4 d; @@ -977,7 +983,7 @@ void FUN_L01_002fb8a8(PendulumMoby *self) { } v->sound = -1; self->state = 1; - } else if (!FUN_L00_0028d8c0(self, v->sound)) { + } else if (!voice_is_playing(self, v->sound)) { v->sound = FUN_0022da68(0, 4, self); } break; @@ -985,11 +991,11 @@ void FUN_L01_002fb8a8(PendulumMoby *self) { self->rot_x = v->swing * 0.62831855f; arm.q = 0; arm.f[2] = -11.0f; - FUN_001f9a10(&arm, &arm, &v->pivot); - d.f[0] = FUN_001f9dc8(self->rot_z) * 11.0f * FUN_001f9de0(self->rot_x); - d.f[1] = FUN_001f9de0(self->rot_z) * 11.0f * FUN_001f9de0(self->rot_x); - d.f[2] = FUN_001f9dc8(self->rot_x) * 11.0f; - FUN_001f9a10(&self->pos, &arm, &d); + fast_vec_add(&arm, &arm, &v->pivot); + d.f[0] = fast_cos(self->rot_z) * 11.0f * fast_sin(self->rot_x); + d.f[1] = fast_sin(self->rot_z) * 11.0f * fast_sin(self->rot_x); + d.f[2] = fast_cos(self->rot_x) * 11.0f; + fast_vec_add(&self->pos, &arm, &d); } #include "sda.h" @@ -1248,11 +1254,12 @@ extern void FUN_L01_002787a0(); extern void *FUN_L00_00263fd8(void *, s32, void *, void *, s32, s32, void *, void *, f32, void *); extern void FUN_L01_00278e20(); void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); -extern void FUN_001f9a10(void *, void *, void *); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); -void FUN_L01_002fd9a0(SparkMoby *m) { +void green_mushroom_update(SparkMoby *m) __asm__("FUN_L01_002fd9a0"); +void green_mushroom_update(SparkMoby *m) { SparkHit *hit; s32 flag; s32 i; @@ -1283,10 +1290,10 @@ void FUN_L01_002fd9a0(SparkMoby *m) { ang = (f32)i * 1.5707964f; clear_u64_value(&rot); rot.z = fast_add_rotations(ang, 0.87266463f); - off.x = FUN_001f9dc8(ang) * -0.57f * s; - off.y = FUN_001f9de0(ang) * -0.57f * s; + off.x = fast_cos(ang) * -0.57f * s; + off.y = fast_sin(ang) * -0.57f * s; off.z = 0.0f; - FUN_001f9a10(&off, &off, &m->pos); + fast_vec_add(&off, &off, &m->pos); off.z += s * 1.2f; FUN_L00_00263fd8(m, 0x719, &off, &rot, 0, 0, &D_L01_0015F580, &D_L01_0015F580, 0.0f, &D_L01_0015F580); @@ -1309,7 +1316,7 @@ extern WaterLayer D_L01_001FBC80[]; s32 D_L01_00161CE0 = 0; extern s32 level_frame_count __asm__("D_L01_0015F5CC"); extern f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); -extern f32 FUN_001f9de0(f32); +extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern void FUN_L01_002feb28(void); extern int enqueue_callback_list_1(void (*)(void), void *) __asm__("FUN_001f4600"); @@ -1355,7 +1362,7 @@ void FUN_L01_002feb58(void *arg) { } } } - s = FUN_001f9de0((convert_integer_to_float(level_frame_count & 0x3F) - 32.0f) * 0.09817477f); + s = fast_sin((convert_integer_to_float(level_frame_count & 0x3F) - 32.0f) * 0.09817477f); s = s * 0.5f + 0.5f; for (g = 3; g >= 0; g--) { D_L01_001FBC80[g].glow = s; @@ -1382,7 +1389,8 @@ typedef struct { extern f32 FUN_001f99c0(f32); -void FUN_L01_002fed68(HoverMoby *m) { +void door_left_update(HoverMoby *m) __asm__("FUN_L01_002fed68"); +void door_left_update(HoverMoby *m) { HoverVars *v; Vec4 *player; Vec4 off; @@ -1397,7 +1405,7 @@ void FUN_L01_002fed68(HoverMoby *m) { break; case 1: player = &hero.motion.pos; - if (FUN_001f9b80(v, player) < v->radius && + if (vector_distance(v, player) < v->radius && FUN_001f99c0(m->pos.f[2] - player->f[2]) < 2.0f) { m->state = 2; if (m->oclass == 0x300) { @@ -1414,8 +1422,8 @@ void FUN_L01_002fed68(HoverMoby *m) { break; case 3: k = 1.1f; - if (FUN_001f9b80(v, &hero.motion.pos) > v->radius * k && - FUN_001f9b80(v, D_L01_00167240) > v->radius * k) { + if (vector_distance(v, &hero.motion.pos) > v->radius * k && + vector_distance(v, D_L01_00167240) > v->radius * k) { m->state = 4; if (m->oclass == 0x300) { FUN_0022da68(0, 0, m); @@ -1424,7 +1432,7 @@ void FUN_L01_002fed68(HoverMoby *m) { break; case 4: player = &hero.motion.pos; - if (FUN_001f9b80(v, player) < v->radius && + if (vector_distance(v, player) < v->radius && FUN_001f99c0(m->pos.f[2] - player->f[2]) < 2.0f) { m->state = 2; } else { @@ -1436,8 +1444,8 @@ void FUN_L01_002fed68(HoverMoby *m) { } break; } - off.f[0] = FUN_001f9dc8(m->rot_z) * v->t * (m->oclass == 0x300 ? 2.0f : -2.0f); - off.f[1] = FUN_001f9de0(m->rot_z) * v->t * (m->oclass == 0x300 ? 2.0f : -2.0f); + off.f[0] = fast_cos(m->rot_z) * v->t * (m->oclass == 0x300 ? 2.0f : -2.0f); + off.f[1] = fast_sin(m->rot_z) * v->t * (m->oclass == 0x300 ? 2.0f : -2.0f); off.f[2] = 0.0f; m->pos.f[0] = v->home.f[0] + off.f[0]; m->pos.f[1] = v->home.f[1] + off.f[1]; @@ -1464,7 +1472,8 @@ extern void FUN_L00_0026ced0(void *, void *, int, int, float, int); extern void add_vector_xyz(void *, void *, void *); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); -void FUN_L01_002ff860(struct Moby *m) { +void pipe_update(struct Moby *m) __asm__("FUN_L01_002ff860"); +void pipe_update(struct Moby *m) { char *d = (char *)m->pvars; char *t = find_moby_hit(m, 0x10000, 0); m->hit_slot = 0xFF; @@ -1554,10 +1563,10 @@ typedef struct { u128 mtx[4]; } SmokeMoby; -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern s32 FUN_0022da68(s32, s32, void *); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern int FUN_L00_00257b90(int lo, int hi); extern void FUN_L00_0026ced0_u(void *, void *, u32, u32, f32, s32) __asm__("FUN_L00_0026ced0"); @@ -1570,7 +1579,7 @@ void FUN_L01_002ffb28(SmokeMoby *self) { s32 i; v = self->vars; - if (FUN_L00_0028d8c0(self, v->sound) == 0) { + if (voice_is_playing(self, v->sound) == 0) { v->sound = FUN_0022da68(0, 4, self); } for (i = 0; i < 2; i++) { @@ -1582,10 +1591,10 @@ void FUN_L01_002ffb28(SmokeMoby *self) { tmp.f[2] = random_float_between(0.8f, 1.2f) * (frame_time + frame_time); vel.q = tmp.q; transform_vector_by_basis(&vel, &vel, self->mtx); - FUN_001f9a10(&pos, &pos, &self->pos); + fast_vec_add(&pos, &pos, &self->pos); size = random_float_between(125000.0f, 175000.0f); FUN_L00_0026ced0_u(&pos, &vel, 0x207F7F7F, 0x272727, size, - FUN_001f96f8(FUN_L00_00257b90(0x2D, 0x3C))); + scale_game_frames(FUN_L00_00257b90(0x2D, 0x3C))); } } typedef struct { @@ -1654,8 +1663,8 @@ extern f32 random_float_between(f32, f32) __asm__("func_002132A8"); extern int pool_draw_count __asm__("D_L01_001612D8"); /* no foreign declaration */ extern int D_L01_001612D0; /* no foreign declaration */ extern float D_L01_001742E8 __attribute__((section(".data"))); /* no foreign declaration */ -extern int FUN_001efa68(void *, void *, int, void *, void *); -extern int FUN_001f0b58(void); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern int FUN_L00_00257b90(int lo, int hi); extern int allocate_voice_for_target_entry_alt(int, int, int) __asm__("FUN_0022da68"); extern int tick_countdown_32_alt(int *) __asm__("FUN_001f9740"); @@ -1674,10 +1683,10 @@ void FUN_L01_002ffdc0(struct Moby *moby) { *(float *)(data + 8) -= *(float *)(data + 0x10); moby->rot.x += *(float *)(data + 0x1C); add_vector_xyz(next_pos, &moby->pos, data); - if (FUN_001efa68(&moby->pos, next_pos, 2, 0, 0)) { + if (collision_line(&moby->pos, next_pos, 2, 0, 0)) { int i; char *effect; - if (!FUN_001f0b58()) { + if (!collision_hit_material()) { if (*(int *)(data + 0x18) == 0) { allocate_voice_for_target_entry_alt(0, 0, (int)moby); } @@ -1796,10 +1805,11 @@ extern s32 FUN_L01_0026e008(s32, s32); extern ClonedMoby *FUN_L01_00302328(ClonedMoby *); extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); -extern void FUN_L00_0025c558(void *, void *, s32, s32, s32, f32); +extern void trooper_start_knockback(void *, void *, s32, s32, s32, f32) __asm__("FUN_L00_0025c558"); s32 D_L01_00161E90 = 5; -void FUN_L01_003021b8(SpawnerMoby *m) { +void beehive_update(SpawnerMoby *m) __asm__("FUN_L01_003021b8"); +void beehive_update(SpawnerMoby *m) { SpawnerVars *v = m->pvars; SpawnerMoby *n; CloneAiVars *nv; @@ -1831,7 +1841,7 @@ void FUN_L01_003021b8(SpawnerMoby *m) { nv->fB4 = 13.0f; nv->w78 = 0; nv->w7C = 0; - FUN_L00_0025c558( + trooper_start_knockback( n, nv->path, 5, 8, 0, fast_add_rotations(fast_arc_tan(hero.motion.pos.f[0] - m->x, hero.motion.pos.f[1] - m->y), 3.1415927f)); @@ -1870,7 +1880,8 @@ ClonedMoby *FUN_L01_00302328(ClonedMoby *src) { void *trooper_find_hit(void *, s32, s32) __asm__("FUN_L00_0025a420"); void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); -void FUN_L01_00307c48(void *self) { +void mushroom_underside_update(void *self) __asm__("FUN_L01_00307c48"); +void mushroom_underside_update(void *self) { u8 *p; p = trooper_find_hit(self, 0x10000, 0); @@ -1882,3 +1893,9 @@ void FUN_L01_00307c48(void *self) { BurstPalette D_L01_0020B4F0 = {{0x4f008fff, 0x4f008fff, 0x4f007fff, 0x4f006fff, 0x2fffffff, 0x2fffffff}}; BurstPalette D_L01_0020B508 = {{0x2f005f7f, 0x2f004f7f, 0x2f003f7f, 0x2f00004f, 0x2f000000, 0x3f000000}}; + +s32 D_L01_001CAD28[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001CAD2C[1] __attribute__((section(".data"))) = {0}; +f32 D_L01_001CAD30[1] __attribute__((section(".data"))) = {0}; +f32 D_L01_001CAD34[1] __attribute__((section(".data"))) = {0}; +f32 D_L01_001CAD38[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/l01/gameplay/entities/tall_shroom.c b/src/overlays/l01/gameplay/entities/tall_shroom.c index a7bc6a6f41..ed13f724a3 100644 --- a/src/overlays/l01/gameplay/entities/tall_shroom.c +++ b/src/overlays/l01/gameplay/entities/tall_shroom.c @@ -13,18 +13,18 @@ typedef struct { extern Ent D_L01_00202D80[]; extern s32 level_frame_count __asm__("D_L01_0015F5CC"); -void FUN_L00_002371e0(void); +void mine_blend_color(void) __asm__("FUN_L00_002371e0"); void FUN_L01_002b96e0(s32, void *); extern float convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); -extern float FUN_001f9de0(float); +extern float fast_sin(float) __asm__("FUN_001f9de0"); void FUN_L01_00309bf8(void) { f32 v; s32 i; - FUN_L00_002371e0(); + mine_blend_color(); FUN_L01_002b96e0(3, D_L01_00202D80); - v = FUN_001f9de0((convert_integer_to_float(level_frame_count & 0x3F) - 32.0f) * 0.09817477f); + v = fast_sin((convert_integer_to_float(level_frame_count & 0x3F) - 32.0f) * 0.09817477f); v = v * 0.5f + 0.5f; for (i = 2; i >= 0; i--) { D_L01_00202D80[i].f5c = v; @@ -590,7 +590,8 @@ extern void *FUN_L00_00263fd8(void *, s32, void *, void *, s32, s32, void *, voi extern void FUN_L01_00278e20(); void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); -void FUN_L01_0030d0f0(TriggerMoby *obj) { +void tall_shroom_update(TriggerMoby *obj) __asm__("FUN_L01_0030d0f0"); +void tall_shroom_update(TriggerMoby *obj) { TriggerHit *hit; s32 flag; @@ -624,7 +625,7 @@ typedef struct { extern EnvVec D_L01_00167240; extern f32 D_L01_00162110[2]; -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern f32 fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); @@ -642,7 +643,7 @@ void FUN_L01_0030ef18(s32 n, f32 (*normals)[3], f32 (*verts)[3], s32 unused, f32 pos.x = verts[i][0]; pos.y = verts[i][1]; pos.z = verts[i][2]; - FUN_001f9a28(&eye, &pos, &D_L01_00167240); + fast_vec_sub(&eye, &pos, &D_L01_00167240); fast_vec_normalize(&eye, &eye, 1.0f); nrm.w = 1.0f; nrm.x = -normals[i][0]; @@ -650,7 +651,7 @@ void FUN_L01_0030ef18(s32 n, f32 (*normals)[3], f32 (*verts)[3], s32 unused, f32 nrm.z = -normals[i][2]; fast_vec_normalize(&nrm, &nrm, 1.0f); fast_vec_scale(&refl, &nrm, fast_vec_dot(&nrm, &eye) * 2.0f); - FUN_001f9a28(&refl, &eye, &refl); + fast_vec_sub(&refl, &eye, &refl); fast_vec_normalize(&refl, &refl, 1.0f); refl.z += 1.0f; len = fast_vec_length(&refl) * 2.0f; diff --git a/src/overlays/l01/gameplay/hero/00233de0.c b/src/overlays/l01/gameplay/hero/00233de0.c index 97f256b241..c0f60a188d 100644 --- a/src/overlays/l01/gameplay/hero/00233de0.c +++ b/src/overlays/l01/gameplay/hero/00233de0.c @@ -186,11 +186,11 @@ typedef union { } HopVec; extern f32 D_L01_0017C250[]; -extern s32 FUN_001f96f8(s32); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_sin(float) __asm__("FUN_001f9de0"); -extern f32 FUN_001fa688(f32, f32); -extern f32 FUN_001f9b20(void *); +extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); +extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); extern f32 approach_value(f32, f32, f32 *) __asm__("FUN_00213ed8"); extern void FUN_L00_002132b8(f32, f32); extern void speed_step(f32, f32) __asm__("FUN_L00_00212088"); @@ -199,7 +199,7 @@ extern void FUN_L00_00233ba0_u(void *, void *, f32) __asm__("FUN_L00_00233ba0"); extern void FUN_L00_00233708(void *, void *, f32); extern void fast_vec_normalize(void *, void *, f32) __asm__("FUN_001f9bf8"); extern void FUN_001f9c48_u(float *, float *, float) __asm__("FUN_001f9c48"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void air_accel(f32) __asm__("FUN_L01_00234358"); void FUN_L01_00234b40(void) { @@ -216,10 +216,10 @@ void FUN_L01_00234b40(void) { qcopy(&hero.motion.unk150, &hero.move_impulse); hero.ground_speed = hero.motion.unk164; } else if (state == 16) { - if (FUN_001f96f8(0x36) < hero.state_timer) { + if (scale_game_frames(0x36) < hero.state_timer) { approach_value(frame_time_sq * 25.0f, frame_time_sq * 7.0f, &hero.unk4A0); } - if (hero.state_timer < FUN_001f96f8(0x37)) { + if (hero.state_timer < scale_game_frames(0x37)) { hero.target_speed = hero.unk3F4; } else { hero.target_speed = frame_time * 3.5f; @@ -228,7 +228,7 @@ void FUN_L01_00234b40(void) { FUN_L00_00233ba0_u(&hero.motion.velocity, &hero.motion.velocity, 0.0f); FUN_L00_00233708(&hero.motion.velocity, &hero.motion.velocity, hero.ground_speed); } else if (state == 0x1C) { - if (FUN_001f96f8(0x28) < hero.state_timer) { + if (scale_game_frames(0x28) < hero.state_timer) { turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 15.009831f); air_accel(frame_time_sq * 20.0f); } @@ -250,7 +250,7 @@ void FUN_L01_00234b40(void) { hero.ground_speed = 0.0f; } if (hero.state.current == HERO_STATE_HIGH_JUMP) { - if (hero.unk41E != 0 && hero.unk44C < FUN_001f96f8(0xC)) { + if (hero.unk41E != 0 && hero.unk44C < scale_game_frames(0xC)) { approach_value(0.0f, frame_time_sq * 8.0f, &hero.unk458); } else { approach_value(frame_time * 4.2f, frame_time_sq * 8.0f, &hero.unk458); @@ -258,7 +258,7 @@ void FUN_L01_00234b40(void) { } hero.motion.velocity.f[0] = fast_cos(hero.unk438) * hero.unk458; hero.motion.velocity.f[1] = fast_sin(hero.unk438) * hero.unk458; - a = hero.unk454 * fast_sin(FUN_001fa688(hero.unk43C, hero.unk438)); + a = hero.unk454 * fast_sin(fast_difference_between_rotations(hero.unk43C, hero.unk438)); hero.motion.velocity.f[0] += fast_cos(hero.unk43C) * a; hero.motion.velocity.f[1] += fast_sin(hero.unk43C) * a; FUN_L00_002132b8(0.7f, frame_time * 0.0f); @@ -266,17 +266,17 @@ void FUN_L01_00234b40(void) { } else if (state == 0x11) { hero.motion.move_yaw = hero.unk470.f[3]; qcopy(&hero.motion.unk170, &hero.unk470); - if (FUN_001f96f8(9) < hero.state_timer) { + if (scale_game_frames(9) < hero.state_timer) { turn_to(-1, frame_scale_sq * 0.042f, frame_scale_sq * 0.2f, frame_time * 11.868238f); } - if (FUN_001f96f8(9) <= hero.state_timer) { + if (scale_game_frames(9) <= hero.state_timer) { if (hero.unk308 == 0) { hero.motion.velocity.f[0] = fast_cos(hero.motion.move_yaw) * (frame_time * 4.9f); hero.motion.velocity.f[1] = fast_sin(hero.motion.move_yaw) * (frame_time * 4.9f); } else { FUN_L00_00233ba0_u(&hero.motion.velocity, &hero.motion.velocity, 0.0f); fast_vec_normalize(&tmp, &hero.motion.unk170, frame_time * 4.9f); - FUN_001f9a10(&hero.motion.velocity, &hero.motion.velocity, &tmp); + fast_vec_add(&hero.motion.velocity, &hero.motion.velocity, &tmp); } } hero.ground_speed = hero.motion.unk164; @@ -288,7 +288,7 @@ void FUN_L01_00234b40(void) { if (hero.target_speed < D_L01_0017C250[0] * frame_time * 0.2f) { if (hero.state.control_mode == 2) { d = hero.unk944; - speed = FUN_001f9b20(&hero.motion.velocity); + speed = vector_length_xy(&hero.motion.velocity); approach_value(0.0f, d, &speed); FUN_001f9c48_u(hero.motion.velocity.f, hero.motion.velocity.f, speed); return; @@ -400,15 +400,15 @@ extern float D_L01_00167258_lui __asm__("D_L01_00167258") __attribute__((section extern float D_L01_0017C440[]; extern float vector_distance_xy(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_001fa688(float, float); +extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_001ff600_cf(void *) __asm__("FUN_001f9b20"); extern float FUN_L00_00208f20(float, float, float, float); extern float FUN_L00_0020a1e0_cf(float) __asm__("FUN_001f9dc8"); extern float FUN_L00_002121c0_cf(float) __asm__("FUN_001f9de0"); -extern float FUN_L00_00213350(void *); +extern float forward_component(void *) __asm__("FUN_L00_00213350"); extern float FUN_L00_00233a78(float *); extern float FUN_L00_0024f7c8_cf(float, float) __asm__("FUN_001fa5c8"); -extern float FUN_L00_0025b8c0(float *, float *, float, float, float, float); +extern float vendor_spring(float *, float *, float, float, float, float) __asm__("FUN_L00_0025b8c0"); extern float FUN_L00_0025bb38(int, float, float); extern float FUN_L00_0025bc00(float *, int, float, float); extern float FUN_L00_00262cf0_cf(float, float) __asm__("FUN_002132a8"); @@ -1409,7 +1409,7 @@ void FUN_L01_002370b8(void) { fast_cos_cf(&hero.anim_speed, 1.0f, 0.2f); if (hero.unkA58 != 0 || ((Moby *)hero.unkA54) != 0) { if (r->kind == 1 && FUN_L00_0024f7c8_cf(hero.unkA5C, hero.motion.rot.f[2]) > 0.0f) { - hero.anim_speed = 1.0f / (FUN_001fa688(hero.unkA5C, hero.motion.rot.f[2]) + 1.0f); + hero.anim_speed = 1.0f / (fast_difference_between_rotations(hero.unkA5C, hero.motion.rot.f[2]) + 1.0f); } hero.motion.move_yaw = hero.unkA5C; turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); @@ -1589,7 +1589,7 @@ void FUN_L01_002370b8(void) { FUN_L00_002132b8(0.7f, 0.0f); *(OvlQuad *)vec[0] = *(OvlQuad *)hero.move_impulse.f; - hero.target_speed = hero.target_speed + FUN_L00_00213350(vec[0]); + hero.target_speed = hero.target_speed + forward_component(vec[0]); if (hero.target_speed < frame_time * 0.7f) { hero.target_speed = frame_time * 0.7f; } @@ -1691,7 +1691,7 @@ void FUN_L01_002370b8(void) { old = hero.motion.rot.f[2]; turn_to(0, sp * 0.125f * frame_scale_sq, frame_scale_sq * 0.2f, frame_time * 4.1887903f); - d = FUN_001fa688(hero.motion.rot.f[2], old); + d = fast_difference_between_rotations(hero.motion.rot.f[2], old); clear_vector(hero.motion.velocity.f); FUN_L00_00216710(frame_time_sq * 5.0f); hero.motion.velocity.f[2] = hero.motion.displacement.f[2] - frame_time_sq * 50.0f; @@ -1762,7 +1762,7 @@ void FUN_L01_002370b8(void) { if (hero.unk4E8 != 0) { qcopy(vec[1], hero.unk4D0.f); a1 = build_spherical_offset_cf(hero.unk4E4, 3.1415927f); - if (!(FUN_001fa688(a0, a1) > 0.5235988f)) { + if (!(fast_difference_between_rotations(a0, a1) > 0.5235988f)) { float mid; float spd; @@ -1857,7 +1857,7 @@ void FUN_L01_002370b8(void) { FUN_L00_002334d0(hero.motion.velocity.f, hero.motion.velocity.f, a * 0.72f); hero.unk304 = hero.motion.velocity.f[2]; } else { - FUN_L00_0025b8c0(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, + vendor_spring(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, frame_scale_sq * 0.35f, frame_time * 2.5f); } } break; @@ -2196,7 +2196,7 @@ void FUN_L01_002370b8(void) { float k; float t; - d = FUN_001fa688(hero.motion.rot.f[2], hero.motion.move_yaw); + d = fast_difference_between_rotations(hero.motion.rot.f[2], hero.motion.move_yaw); stick_target(frame_time * 1.5f, 0); if (hero.target_speed < frame_time * 1.5f * 0.55f) { hero.target_speed = frame_time * 1.5f * 0.55f; diff --git a/src/overlays/l01/gameplay/hero/00242930.c b/src/overlays/l01/gameplay/hero/00242930.c index 1d9f40b133..4d1fa92ebc 100644 --- a/src/overlays/l01/gameplay/hero/00242930.c +++ b/src/overlays/l01/gameplay/hero/00242930.c @@ -48,11 +48,11 @@ extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L01_0015F638; extern float D_L01_00167258_lui __asm__("D_L01_00167258") __attribute__((section(".data"))); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_00208f20(float a, float b, float c, float d); extern float FUN_L00_00232b90(float a, float b, float c); -extern float FUN_L00_00233a78(float *v); +extern float gravity_z(float *v) __asm__("FUN_L00_00233a78"); extern float FUN_L00_00233c30(float *pos, float *vel, int *steps, float step); extern float FUN_L00_00266e80(int); extern float approach_value(float *p, float target, float maxstep) __asm__("FUN_00213ed8"); @@ -106,7 +106,7 @@ extern void FUN_L00_00232628(void); extern void FUN_L00_00232640(int id); extern void FUN_L00_00233288(float a, float b, short c, unsigned char d, unsigned char e, unsigned char f); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void hud_keep_visible(int, int) __asm__("FUN_L00_00235e18"); extern void FUN_L00_00237ae8(void); extern void FUN_L00_00237ba0(void); @@ -862,7 +862,7 @@ void FUN_L01_00242930(void) { } break; case 101: - if (FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { + if (vector_distance(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { if (frame_time * 2.7f > hero.motion.speed_xy) { if (fast_difference_between_rotations( hero.motion.rot.f[2], hero.unk1640.f[3]) < 0.034906585f) { @@ -886,7 +886,7 @@ void FUN_L01_00242930(void) { if ((hero.unkA98 & 2) || hero.unk1650 != 0) { hero_set_state(HERO_STATE_IDLE, 1); } - if (0.2f < FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f)) { + if (0.2f < vector_distance(hero.motion.pos.f, hero.unk1640.f)) { hero_set_state(0x65, 1); } break; @@ -1167,7 +1167,7 @@ void FUN_L01_00242930(void) { if (hero_set_state(HERO_STATE_IDLE, 0)) { set_hero_animation(0xC, 9, -1.0f); } - FUN_L00_00233b20(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); + gravity_set_z(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); FUN_L00_0025f730(hero.motion.unk150.f, frame_time * 7.0f); hero.unk1C4 = scale_game_frames(7); if (hero.state.prev == 0x2D) { @@ -1668,7 +1668,7 @@ void FUN_L01_00242930(void) { scale_game_frames(0xE) < hero.state_timer && (hero.unk41E == 0 || (hero.ground_distance > 0.7f && - absolute_float(FUN_L00_00233a78(hero.motion.velocity.f)) < + absolute_float(gravity_z(hero.motion.velocity.f)) < frame_time * 5.8f))) { hero_set_state(0xE, 1); } else if (D_0013D4C0[2] != 0 && hero_slot_item_id(3) != 4 && diff --git a/src/overlays/l01/gameplay/hero/hero_set_state.c b/src/overlays/l01/gameplay/hero/hero_set_state.c index b9755a801c..f124fb137a 100644 --- a/src/overlays/l01/gameplay/hero/hero_set_state.c +++ b/src/overlays/l01/gameplay/hero/hero_set_state.c @@ -31,7 +31,7 @@ extern float D_L01_0017C270[][25]; extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_0020d658(int back); -extern float FUN_L00_002339d0(float *v); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float vector_length_xy(void *); @@ -62,12 +62,12 @@ extern void FUN_L00_00214ed8(float a, float b, float c); extern void FUN_L00_00216ec0(int, int, int); extern void set_hero_animation(int, int, float) __asm__("FUN_L00_002323b8"); extern void FUN_L00_002325e0(int bank, int seq); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L00_00262500(int a, char *b); extern void FUN_L00_00262528(char *o, int a, int b); extern void FUN_L00_00262840(char *o); -extern void FUN_L00_002a3ec8(int, int, int, float, float, float, float); +extern void pool_splash(int, int, int, float, float, float, float) __asm__("FUN_L00_002a3ec8"); extern void FUN_L01_002405a0(void); extern void fill_transfer_words(void *, int, int) __asm__("func_001F97E8"); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); @@ -288,14 +288,14 @@ int hero_set_state(int a, int b) { if (p->state.prev_control_mode == 0x11) { FUN_L00_00209ca8(3, 0xA, 0); if (pool_draw_tiles != 0) { - FUN_L00_002a3ec8(pool_draw_tiles, pool_draw_count, 0, p->motion.pos.f[0], + pool_splash(pool_draw_tiles, pool_draw_count, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.4f, 0.3f); } } else if (p->motion.displacement.f[2] < frame_time * -0.5f) { int n = truncate_float_to_s32(absolute_float(p->motion.displacement.f[2]) * 300.0f); FUN_L00_00209ca8(3, n < 0x28 ? n : 0x28, 1); if (pool_draw_tiles != 0) { - FUN_L00_002a3ec8(pool_draw_tiles, pool_draw_count, 0, p->motion.pos.f[0], + pool_splash(pool_draw_tiles, pool_draw_count, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.5f, -0.4f); } p->unk90A = scale_game_frames(0x4B); @@ -609,7 +609,7 @@ int hero_set_state(int a, int b) { char *v = (char *)&p->motion.unk110; p->state.control_mode = 1; p->unk2284 = 0; - p->ground_speed = FUN_L00_002339d0((float *)v); + p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.unk150, v); if (b) { int id = 6; @@ -885,7 +885,7 @@ int hero_set_state(int a, int b) { u->unk48C = 1.98f; u->unk430 = 1.95f; } else { - FUN_L00_00233b20((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); + gravity_set_z((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); u->unk41C = 1; u->unk3D0 = scale_game_frames(2); u->unk3D4 = scale_game_frames(0x23) + u->unk3D0; @@ -1605,7 +1605,7 @@ struct HeldGadgetVars { extern int D_00141660 __attribute__((section(".data"))); int r1_double_tap_timer __asm__("D_L01_0015F674") = 0; -extern int FUN_001f9740(int *) __asm__("FUN_001f9740"); +extern int fast_dec_timer(int *) __asm__("FUN_001f9740"); extern int FUN_0022da68(int, int, struct Moby *) __asm__("FUN_0022da68"); extern unsigned int FUN_L00_00266d60(unsigned int, int, int *); extern int FUN_L00_0020d498(int); @@ -1614,7 +1614,7 @@ extern int FUN_L00_0020fe30(void); extern int FUN_L00_00216de8(int, int); extern void FUN_L00_00217658(void); extern int FUN_L00_00233e98(int); -extern int FUN_L00_0028d8c0(struct Moby *, int); +extern int voice_is_playing(struct Moby *, int) __asm__("FUN_L00_0028d8c0"); extern void FUN_L00_0029a6b0(int); int FUN_L01_00240ed8(void) { @@ -1727,7 +1727,7 @@ int FUN_L01_00240ed8(void) { if (hero.unk20A8 == 0) FUN_L00_0020e4c8(); } else if ((controller_state.held & buttons) != 0 && FUN_L00_00233e98(-1) == 0 && - FUN_L00_0028d8c0(hero.items[0].moby, vars->voice) == 0) { + voice_is_playing(hero.items[0].moby, vars->voice) == 0) { vars->voice = FUN_0022da68(0, 0, hero.items[0].moby); } } @@ -1786,7 +1786,7 @@ int FUN_L01_00240ed8(void) { if (hero.state_timer == saved) { if (FUN_L00_0020d498(3) == 3 && hero.state.current != 0x81 && (hero.unk308 == 0 || D_0013D4DC[0] == 0) && hero.unk22D8 == 0) { - FUN_001f9740(&r1_double_tap_timer); + fast_dec_timer(&r1_double_tap_timer); if (r1_double_tap_timer != 0 && ((unsigned int)hero.state.control_mode < 2 || hero.state.control_mode == 0xc || ((hero.state.control_mode == 2 || hero.state.control_mode == 4) && hero.grounded_frames != 0)) && diff --git a/src/overlays/l01/rendering/0027e900.c b/src/overlays/l01/rendering/0027e900.c index 466da25f8b..69a0a492ec 100644 --- a/src/overlays/l01/rendering/0027e900.c +++ b/src/overlays/l01/rendering/0027e900.c @@ -108,7 +108,8 @@ extern s32 random_integer_below(s32) __asm__("FUN_00213260"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern u8 *D_L01_001B25E0[]; -Particle *FUN_L01_00287b00(u128 *pos, u128 *vel, f32 f) { +Particle *pool_bubble(u128 *pos, u128 *vel, f32 f) __asm__("FUN_L01_00287b00"); +Particle *pool_bubble(u128 *pos, u128 *vel, f32 f) { Particle *p; s32 c; u32 col; @@ -135,7 +136,8 @@ s32 random_integer_below(s32) __asm__("FUN_00213260"); s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); f32 random_float_between(f32, f32) __asm__("FUN_002132a8"); -Particle *FUN_L01_00287c80(u128 *pos, u128 *dir, f32 scale, f32 speed) { +Particle *pool_bubbles(u128 *pos, u128 *dir, f32 scale, f32 speed) __asm__("FUN_L01_00287c80"); +Particle *pool_bubbles(u128 *pos, u128 *dir, f32 scale, f32 speed) { Particle *p; PartMotion *m; f32 r; diff --git a/src/overlays/l02/gameplay/entities/constructorbot.c b/src/overlays/l02/gameplay/entities/constructorbot.c index 5e369c33e5..a2e63b4a16 100644 --- a/src/overlays/l02/gameplay/entities/constructorbot.c +++ b/src/overlays/l02/gameplay/entities/constructorbot.c @@ -33,6 +33,7 @@ extern u8 *spawn_particle(void *, void *, s32, s32, s32, s32, f32, f32, f32, f32 extern void rand_vec(void *, f32, f32) __asm__("FUN_L00_00257d78"); /* Shard debris update: drifts along its velocity, sheds particle trails and expires when its timer runs out. */ +void FUN_L02_002ebf20(struct Moby *m); void FUN_L02_002ebf20(struct Moby *m) { ShardVars *v = (ShardVars *)m->pvars; Vec4f p, back, half, jit; diff --git a/src/overlays/l02/gameplay/entities/sand_shark.c b/src/overlays/l02/gameplay/entities/sand_shark.c index 8caf39ed68..a70f9ecee3 100644 --- a/src/overlays/l02/gameplay/entities/sand_shark.c +++ b/src/overlays/l02/gameplay/entities/sand_shark.c @@ -46,18 +46,21 @@ void FUN_L02_002400c8(void) { extern void FUN_L02_002a40d0(void *); +void FUN_L02_002a47f8(void); void FUN_L02_002a47f8(void) { char scratch[0x40]; FUN_L02_002a40d0(scratch); } extern void write_dma_channel(void *, int, int) __asm__("FUN_001f9928"); -extern void write_dma_channel_002101b8(void *, int, int) __asm__("FUN_L02_002101b8"); +extern void FUN_L02_002101b8(void *, int, int); /* Ported from rac1-decomp (src/overlays/l02_aridia/vendor_002A59D8.c: func_L02_002A59F8), where it is exact; names translated to the US level program. */ extern char D_L02_001CB400[]; extern void FUN_L02_002a40f0(void *); +void FUN_L02_002a4818(int a, int b, int c, int d, float x, float y, float z, float w, int e, int f, + int g); void FUN_L02_002a4818(int a, int b, int c, int d, float x, float y, float z, float w, int e, int f, int g) { char scratch[0x40]; @@ -74,15 +77,15 @@ void FUN_L02_002a4818(int a, int b, int c, int d, float x, float y, float z, flo ((unsigned char *)scratch)[0x3F] = 0x80; *(int *)(scratch + 0x1C) = g; FUN_L02_002a40f0(scratch); - write_dma_channel_002101b8(D_L02_001CB400, 0x70002800, 0xF8); + FUN_L02_002101b8(D_L02_001CB400, 0x70002800, 0xF8); } #include "rnc/overlay/quad.h" extern float D_L02_001619D4 __attribute__((sda)); extern float D_L02_001619DC __attribute__((sda)); extern unsigned short D_L02_001619E0 __attribute__((sda)); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern float randf_sym(float, float) __asm__("FUN_L00_00257c48"); @@ -104,7 +107,7 @@ void FUN_L02_002d3a50(void *moby, void *a, void *b, int n, float sa, float sb) { unsigned char *m; unsigned char *p; - FUN_001f9a28(step, b, a); + fast_vec_sub(step, b, a); fast_vec_scale(step, step, 1.0f / (float)n); *(OvlQuad *)vel = (OvlQuad)0; vel[2] = 0.01f; @@ -112,7 +115,7 @@ void FUN_L02_002d3a50(void *moby, void *a, void *b, int n, float sa, float sb) { d = (sb - sa) / (float)n; for (i = 0; i < n; i++) { fast_vec_scale(pos, step, convert_integer_to_float(i)); - FUN_001f9a10(pos, a, pos); + fast_vec_add(pos, a, pos); r = random_int_between(0x40, 0x70); g = random_int_between(0x40, 0x7F); color = g | (g << 16 | g << 8); @@ -142,9 +145,9 @@ void FUN_L02_002d3a50(void *moby, void *a, void *b, int n, float sa, float sb) { extern float D_L02_001D3230[][4] __attribute__((section(".data"))); float D_L02_001619C0[4] __attribute__((section(".sdata"))) = {-3.25f, 0.0f, 0.2f, 0.0f}; extern short D_L02_001619D0 __attribute__((sda)); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); -extern void FUN_001f9cf8(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); +extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void FUN_L02_002d3a50(void *, void *, void *, int, float, float); void FUN_L02_002d3c98(struct Moby *moby, int a, int b, int d) { @@ -154,15 +157,15 @@ void FUN_L02_002d3c98(struct Moby *moby, int a, int b, int d) { float *pb; qcopy(va, pa); va[3] = 1.0f; - FUN_001f9a28(va, va, D_L02_001619C0); - FUN_001f9cf8(va, va, &moby->rot_row0); - FUN_001f9a10(va, va, &moby->pos); + fast_vec_sub(va, va, D_L02_001619C0); + transform_vector_by_basis(va, va, &moby->rot_row0); + fast_vec_add(va, va, &moby->pos); pb = D_L02_001D3230[b]; qcopy(vb, pb); vb[3] = 1.0f; - FUN_001f9a28(vb, vb, D_L02_001619C0); - FUN_001f9cf8(vb, vb, &moby->rot_row0); - FUN_001f9a10(vb, vb, &moby->pos); + fast_vec_sub(vb, vb, D_L02_001619C0); + transform_vector_by_basis(vb, vb, &moby->rot_row0); + fast_vec_add(vb, vb, &moby->pos); FUN_L02_002d3a50(moby, va, vb, d, pa[3] * *(float *)&D_L02_001619D0, pb[3] * *(float *)&D_L02_001619D0); } @@ -181,7 +184,7 @@ void FUN_L02_002d3dd0(void *moby) { FUN_L02_002d3c98(moby, 6, 7, D_L02_001619F4); FUN_L02_002d3c98(moby, 8, 9, D_L02_001619F8); } -/* pvars of the Aridia enemy FUN_L02_002d3e50 updates (it leaves its burrow, walks, jumps and digs back in). */ +/* pvars of the Aridia enemy sand_shark_update updates (it leaves its burrow, walks, jumps and digs back in). */ typedef struct { /* 0x000 */ char pad0[0x20]; /* 0x020 */ float unk20; @@ -255,10 +258,10 @@ extern char D_L02_001FA8C0[]; extern void FUN_001e93b0_e50(char *, short) __asm__("FUN_001e93b0"); extern int rand_e50(void) __asm__("FUN_001160d8"); extern int scale_ticks_e50(int) __asm__("FUN_001f96f8"); -extern int FUN_001f9740(void *); +extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); extern float square_root(float) __asm__("FUN_001f9988"); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern float FUN_001f9af0_e50(void *) __asm__("FUN_001f9af0"); extern float distance_e50(void *, void *) __asm__("FUN_001f9b48"); @@ -281,13 +284,13 @@ extern int sound_e50(int, int, void *) __asm__("FUN_0022da68"); extern void FUN_L00_00257470_e50(void *, int, int) __asm__("FUN_L00_00257470"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern void FUN_L00_00257d78_e50(void *, float, float) __asm__("FUN_L00_00257d78"); -extern void turn_e50(void *, float, float *, float, float, float) __asm__("FUN_L00_00258278"); -extern void walk_e50(void *, void *, void *, void *, float) __asm__("FUN_L00_00258b50"); +extern void FUN_L00_00258278_c(void *, float, float *, float, float, float) __asm__("FUN_L00_00258278"); +extern void FUN_L00_00258b50(void *, void *, void *, void *, float); extern void FUN_L00_002598b0_e50(void *, void *, float, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); extern void FUN_L00_0025a120_e50(void *) __asm__("FUN_L00_0025a120"); extern void turn_angle_e50(float *, float, float *, float, float, float) __asm__("FUN_L00_0025be00"); extern int FUN_L00_0025c698_e50(void *, void *) __asm__("FUN_L00_0025c698"); -extern int path_e50(int, void *, void *, void *) __asm__("FUN_L00_00261b48"); +extern int FUN_L00_00261b48(int, void *, void *, void *); extern void FUN_L00_00263ac8_e50(void *, int, void *, float) __asm__("FUN_L00_00263ac8"); extern void FUN_L00_00269958_e50(void *, void *, int, int, int, int, int, int) __asm__("FUN_L00_00269958"); extern int FUN_L00_002dc9f0_e50(void *, void *) __asm__("FUN_L00_002dc9f0"); @@ -306,7 +309,8 @@ int D_L02_001619B0 = 0xa000000; int D_L02_001619E4 = 0x40306058; int D_L02_001619E8 = 0x306058; /* Aridia burrowing enemy: profiled with EE timer 0 around its state machine. */ -void FUN_L02_002d3e50(struct Moby *moby) { +void sand_shark_update(struct Moby *moby) __asm__("FUN_L02_002d3e50"); +void sand_shark_update(struct Moby *moby) { Varsd3e50 *vars; OvlVec4 v0; OvlVec4 v1; @@ -402,7 +406,7 @@ void FUN_L02_002d3e50(struct Moby *moby) { } break; case 1: - FUN_001f9a28(&v0, &hero.motion.pos, &moby->pos); + fast_vec_sub(&v0, &hero.motion.pos, &moby->pos); moby->state = 0x12; if (moby->prev_seq != 0) { blend_e50(moby, 0, 0, scale_ticks_e50(3)); @@ -411,11 +415,11 @@ void FUN_L02_002d3e50(struct Moby *moby) { case 2: moby->pos.z += D_L02_0016191C; qcopy(&v0, &vars->home); - turn_e50(moby, add_rotations_e50(atan2_e50(v0.f[0] - moby->pos.x, v0.f[1] - moby->pos.y), vars->turn_offset), + FUN_L00_00258278_c(moby, add_rotations_e50(atan2_e50(v0.f[0] - moby->pos.x, v0.f[1] - moby->pos.y), vars->turn_offset), &vars->turn_vel, 0.05f, 0.3f, 0.04f); moby->pos.x += fast_cos_e50(moby->rot.z) * D_0015ED6C; moby->pos.y += fast_sin_e50(moby->rot.z) * D_0015ED6C; - if (FUN_001f9740(&vars->turn_timer)) { + if (fast_dec_timer(&vars->turn_timer)) { vars->turn_timer = scale_ticks_e50(0x3C); f = vars->turn_range * 0.017453292f; vars->turn_offset = rand_between_e50(-f, f); @@ -465,15 +469,15 @@ void FUN_L02_002d3e50(struct Moby *moby) { int hit14; qcopy(&v1, &vars->target); hit14 = 0; - turn_e50(moby, atan2_e50(v1.f[0] - moby->pos.x, v1.f[1] - moby->pos.y) + vars->turn_offset, &vars->turn_vel, + FUN_L00_00258278_c(moby, atan2_e50(v1.f[0] - moby->pos.x, v1.f[1] - moby->pos.y) + vars->turn_offset, &vars->turn_vel, 0.05f, 0.3f, 0.2f); v0.f[0] = 2.0f * fast_cos_e50(moby->rot.z); v0.f[1] = 2.0f * fast_sin_e50(moby->rot.z); v0.f[2] = 0.0f; - FUN_001f9a10(&v0, &v0, &moby->pos); - walk_e50(moby, &vars->walk_mode, &v0, &v2, 1.0f); + fast_vec_add(&v0, &v0, &moby->pos); + FUN_L00_00258b50(moby, &vars->walk_mode, &v0, &v2, 1.0f); FUN_L02_002d63c0_e50(moby); - if (path_e50(vars->path, &moby->pos, &v1, &v3) && distance_e50(&moby->pos, &v3) < vars->unk294) { + if (FUN_L00_00261b48(vars->path, &moby->pos, &v1, &v3) && distance_e50(&moby->pos, &v3) < vars->unk294) { hit14 = 1; } if (vars->unk25E != 0) { @@ -586,13 +590,13 @@ void FUN_L02_002d3e50(struct Moby *moby) { } } qcopy(&v3, &vars->target); - turn_e50(moby, atan2_e50(v3.f[0] - moby->pos.x, v3.f[1] - moby->pos.y) + vars->turn_offset, &vars->turn_vel, + FUN_L00_00258278_c(moby, atan2_e50(v3.f[0] - moby->pos.x, v3.f[1] - moby->pos.y) + vars->turn_offset, &vars->turn_vel, 0.05f, 0.3f, 0.2f); v0.f[0] = 2.0f * fast_cos_e50(moby->rot.z); v0.f[1] = 2.0f * fast_sin_e50(moby->rot.z); v0.f[2] = 0.0f; - FUN_001f9a10(&v0, &v0, &moby->pos); - walk_e50(moby, &vars->walk_mode, &v0, &v1, 1.0f); + fast_vec_add(&v0, &v0, &moby->pos); + FUN_L00_00258b50(moby, &vars->walk_mode, &v0, &v1, 1.0f); FUN_L02_002d63c0_e50(moby); if (moby->state == 0x16) { moby->pos.z -= D_L02_0016191C; @@ -601,7 +605,7 @@ void FUN_L02_002d3e50(struct Moby *moby) { if (vars->unk278 >= 0 && !inside_e50(&vars->target, vars->unk278)) { moby->state = 7; } else { - FUN_001f9a28(&v2, &vars->target, &vars->home); + fast_vec_sub(&v2, &vars->target, &vars->home); if (FUN_001f9b80_e50(&moby->pos, &v3) < 12.0f && moby->state == 0x16) { moby->state = 0x13; sound_e50(4, 0, moby); @@ -624,11 +628,11 @@ void FUN_L02_002d3e50(struct Moby *moby) { } break; case 6: - turn_e50(moby, atan2_e50(vars->target.f[0] - moby->pos.x, vars->target.f[1] - moby->pos.y), &vars->turn_vel, + FUN_L00_00258278_c(moby, atan2_e50(vars->target.f[0] - moby->pos.x, vars->target.f[1] - moby->pos.y), &vars->turn_vel, 0.05f, 0.3f, 0.2f); if (moby->seq == moby->prev_seq && in_window_e50(moby, 13.0f)) { FUN_001f9bf8_e50(&v0, &moby->rot_row0, 0.75f); - FUN_001f9a10(&v0, &v0, &moby->pos); + fast_vec_add(&v0, &v0, &moby->pos); v0.f[2] += 0.5f; FUN_L00_002598b0_e50(moby, &v0, 0.5f, 1, 1.0f, 1.0f, 0, 1, 0); } @@ -658,12 +662,12 @@ void FUN_L02_002d3e50(struct Moby *moby) { } } qcopy(&v3, &vars->home); - turn_e50(moby, atan2_e50(v3.f[0] - moby->pos.x, v3.f[1] - moby->pos.y), &vars->turn_vel, 0.02f, 0.3f, 0.1f); + FUN_L00_00258278_c(moby, atan2_e50(v3.f[0] - moby->pos.x, v3.f[1] - moby->pos.y), &vars->turn_vel, 0.02f, 0.3f, 0.1f); v0.f[0] = 2.0f * fast_cos_e50(moby->rot.z); v0.f[1] = 2.0f * fast_sin_e50(moby->rot.z); v0.f[2] = 0.0f; - FUN_001f9a10(&v0, &v0, &moby->pos); - walk_e50(moby, &vars->walk_mode, &v0, &v1, 1.0f); + fast_vec_add(&v0, &v0, &moby->pos); + FUN_L00_00258b50(moby, &vars->walk_mode, &v0, &v1, 1.0f); if (moby->state == 0x17) { moby->pos.z -= D_L02_0016191C; } @@ -692,7 +696,7 @@ void FUN_L02_002d3e50(struct Moby *moby) { } if (vars->unk298 == 0) { if (vars->unk214 != 2) { - FUN_001f9a28(&v2, &vars->target, &vars->home); + fast_vec_sub(&v2, &vars->target, &vars->home); if (vars->unk278 >= 0) { if (inside_e50(&vars->target, vars->unk278)) { moby->state = 5; @@ -720,7 +724,7 @@ void FUN_L02_002d3e50(struct Moby *moby) { } else { extern float D_0015ED6C_e50s __asm__("D_0015ED6C") __attribute__((sda)); FUN_001f9bf8_e50(&v4, &moby->rot_row0, D_0015ED6C_e50s * 0.5f); - FUN_001f9a10(&moby->pos, &moby->pos, &v4); + fast_vec_add(&moby->pos, &moby->pos, &v4); } break; case 8: @@ -757,7 +761,7 @@ void FUN_L02_002d3e50(struct Moby *moby) { float t = (square_root(2.0f * (frame_time_sq * 10.8f) * dz) + 2.0f * up) / (frame_time_sq * 10.8f); float speed = FUN_001f9b80_e50(&vars->home, &dest->pos) / t; - FUN_001f9a28(&vars->vel, &vars->home, &dest->pos); + fast_vec_sub(&vars->vel, &vars->home, &dest->pos); vars->vel.f[2] = 0.0f; FUN_001f9bf8_e50(&vars->vel, &vars->vel, speed); vars->vel.f[2] = up; @@ -775,7 +779,7 @@ void FUN_L02_002d3e50(struct Moby *moby) { int life; FUN_L00_00257d78_e50(&v1, 0.0f, 0.2f); - FUN_001f9a10(&v0, &v1, &moby->pos); + fast_vec_add(&v0, &v1, &moby->pos); fast_vec_scale(&v1, &v1, D_0015ED6C * 5.0f); life = scale_ticks_e50(random_int_between(0x14, 0x28)); FUN_L00_00269958_e50(&moby->pos, &v1, D_L02_001619E4, D_L02_001619E8, life, 0x64, @@ -785,7 +789,7 @@ void FUN_L02_002d3e50(struct Moby *moby) { case 13: { float sink; moby->rot.y = sub_rotations_e50(moby->rot.y, D_0015ED6C * 12.566371f); - FUN_001f9a10(&moby->pos, &moby->pos, &vars->vel); + fast_vec_add(&moby->pos, &moby->pos, &vars->vel); sink = D_L02_0016191C; vars->vel.f[2] -= frame_time_sq * 10.8f; if (moby->pos.z < vars->home.f[2] - sink) { @@ -1047,11 +1051,11 @@ typedef struct { char pad2F[9]; int i38; /* 0x38 */ char pad3C[0xD4]; - short anim[3]; /* 0x110: passed to FUN_L00_0025d458 / FUN_L00_0025d538 */ + short anim[3]; /* 0x110: passed to trooper_anim_update / trooper_anim_finish */ char pad116; unsigned char b117; /* 0x117 */ char pad118[8]; - char knock[0x10]; /* 0x120: passed to FUN_L00_0025c558 */ + char knock[0x10]; /* 0x120: passed to trooper_start_knockback */ float f130; /* 0x130 */ float f134; float f138; @@ -1095,20 +1099,20 @@ extern float D_L02_0016190C __attribute__((sda)); extern float D_L02_00161914 __attribute__((sda)); extern float D_L02_00161918 __attribute__((sda)); extern int *D_L02_001B0AB0_5c88[] __asm__("D_L02_001B0AB0"); -extern int FUN_001f9770(void *); -extern float FUN_001f9b80(void *, void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float absolute_float_5c88(float) __asm__("func_001F99C0"); extern float FUN_00213508(void *, int, float); -extern void FUN_L00_0025ab48(void *, float *, void *, void *); +extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); extern int FUN_L00_0025ff38(float, void *, void *, int, int, void *, int); extern int FUN_L02_002d5658(void *argp); extern void FUN_L02_002d5728(char *arg); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern int fun_00213928(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_00213928"); extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); -extern void FUN_L00_0025c558(float, void *, void *, int, int, int); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_start_knockback(float, void *, void *, int, int, int) __asm__("FUN_L00_0025c558"); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); /* Path-following enemy: respawns at its home point on request, takes hits (dies and drops to the ground), then follows its path and retargets the hero when it strays. */ @@ -1142,11 +1146,11 @@ void FUN_L02_002d5c88(unsigned char *moby) { *(float *)(moby + 0x18) -= 10.0f; } if (d->i38 != 0 || - (!FUN_001f9770(&d->t25C) && FUN_001f9b80(moby + 0x10, &hero.motion.pos) < 10.0f)) { + (!fast_dec_timer_s16(&d->t25C) && vector_distance(moby + 0x10, &hero.motion.pos) < 10.0f)) { d->t25E = func_001FA898_r(multiply_global_factor_ed64(random_float_between_alt(180.0f, 240.0f))); } d->i38 = 0; - if (FUN_001f9770(&d->t25E)) { + if (fast_dec_timer_s16(&d->t25E)) { d->f250 = d->f24C; } else { d->f250 = d->f24C + 5.0f; @@ -1185,22 +1189,22 @@ void FUN_L02_002d5c88(unsigned char *moby) { d->i144 |= 0x20; *(unsigned short *)(moby + 0x34) &= 0xEFFF; v.q = *(OvlQuad *)(h + 0x10); - FUN_L00_0025ab48(&v, &k, &d->f138, &d->f13C); - FUN_L00_0025c558(k, moby, d->knock, 6, 1, 0); + trooper_knockback_arc(&v, &k, &d->f138, &d->f13C); + trooper_start_knockback(k, moby, d->knock, 6, 1, 0); d->f148 = 0.85f; d->f170 = 7.0f; d->f174 = 14.0f; moby[0x20] = 0x18; *(int *)(moby + 0x94) = 0; d->b117 = 0x78; - FUN_L00_0025d458(moby, d->anim); + trooper_anim_update(moby, d->anim); } } moby[0xA4] = 0xFF; - FUN_L00_0025d538(moby, d->anim); + trooper_anim_finish(moby, d->anim); path = D_L02_001B0AB0_5c88[d->i290]; if (FUN_L00_0025ff38(d->f250, moby, d->tgt, 0, 0, path + 4, *path) != 2 && - (d->f250 < FUN_001f9b80(d->home, d->tgt) || + (d->f250 < vector_distance(d->home, d->tgt) || absolute_float_5c88(*(float *)(moby + 0x18) - d->tgt[2]) > 3.0f)) { d->i214 = 2; } @@ -1351,13 +1355,13 @@ int D_L02_00161A88 = 0x40808080; int D_L02_00161A90 = 0x3c; int D_L02_00161A94 = 0x78; extern float D_L02_00161A98 __attribute__((sda)); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float approach_value_alt(float *p, float target, float maxstep) __asm__("FUN_00213ed8"); extern float fast_difference_between_rotations(float, float) __asm__("func_001FA688"); extern float probe_ground_height(void *, int, float) __asm__("func_00213508"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int FUN_L00_00259028(char *m, char *p, float *pos, char *v); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int is_point_inside_clip_volume(void *arg0, int arg1) __asm__("func_00214720"); extern s32 rand(void); extern s32 random_integer_below_c(s32) __asm__("func_00213260"); @@ -1368,7 +1372,7 @@ extern void FUN_L00_00257470(void *, int, int); extern void FUN_L00_00258278(char *moby, float target, float *vel, float k, float d, float max); extern void make_hit_descriptor(char *arg, int a, int b, void *src, float scale) __asm__("FUN_L00_00259888"); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, float, int, float, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L00_00263ac8(float x, int a, int b, unsigned char *m); extern void FUN_L00_0026cbb0(void *, void *, int, int, int, int, float); @@ -1384,6 +1388,7 @@ extern void mark_moby_for_removal_c(void *) __asm__("func_0020C828"); extern void subtract_vector_xyz_c(void *, void *, void *) __asm__("FUN_001f9a28"); float absolute_float_c(float input) __asm__("func_001F99C0"); +void FUN_L02_002d7748(struct Moby *moby); void FUN_L02_002d7748(struct Moby *moby) { float position[4]; float direction[4]; @@ -1629,7 +1634,7 @@ void FUN_L02_002d7748(struct Moby *moby) { *(float *)(target + 0x14) - moby->pos.y); FUN_L00_00258278((char *)moby, angle, &data->turn_speed, 0.02f, 0.3f, 0.1f); if (moby->anim_flags & 2) { - if (FUN_001f9b80(&moby->pos, data->target + 0x10) < data->attack_range + 1.0f + if (vector_distance(&moby->pos, data->target + 0x10) < data->attack_range + 1.0f && absolute_float_c(*(float *)(data->target + 0x18) - moby->pos.z) < 3.0f) { moby->state = 0xC; if (moby->prev_seq != 9) { @@ -1644,7 +1649,7 @@ void FUN_L02_002d7748(struct Moby *moby) { } break; case 16: - if (FUN_L00_0025c698(moby, data->knockback) & 0x40) { + if (mine_fall(moby, data->knockback) & 0x40) { moby->state = 7; if (moby->prev_seq != 0) { blend_moby_animation_c3(moby, 0, 0, scale_game_frames(6)); @@ -1652,11 +1657,11 @@ void FUN_L02_002d7748(struct Moby *moby) { } break; case 17: - if (FUN_L00_0025c698(moby, data->knockback) & 0x140) { + if (mine_fall(moby, data->knockback) & 0x140) { qcopy(position, &moby->pos); position[2] += 1.0f; FUN_L00_00257470(moby, 0, -1); - FUN_L00_0025e450(moby, data->velocity, position, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, -1, 1.0f, 15.0f, 1, 1, -1, 0); + spawn_explosion(moby, data->velocity, position, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, -1, 1.0f, 15.0f, 1, 1, -1, 0); FUN_L00_00263fd8((char *)moby, 0x6D7, (float *)(&moby->pos), &moby->rot, 0, 0, 0.0f, D_L02_0015F580, D_L02_0015F580, D_L02_0015F580); FUN_L00_00263fd8((char *)moby, 0x6D8, (float *)(&moby->pos), &moby->rot, 0, 0, 0.0f, D_L02_0015F580, D_L02_0015F580, D_L02_0015F580); FUN_L00_00263fd8((char *)moby, 0x6D9, (float *)(&moby->pos), &moby->rot, 0, 0, 0.0f, D_L02_0015F580, D_L02_0015F580, D_L02_0015F580); @@ -1682,20 +1687,20 @@ extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern int trunc_d57f8(float) __asm__("FUN_001fa6d0"); extern int FUN_L02_00261c80(char *a, char *o, float best); extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); -extern void FUN_L00_0025c558(float, void *, void *, int, int, int); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_start_knockback(float, void *, void *, int, int, int) __asm__("FUN_L00_0025c558"); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); /* pvars of the class FUN_L02_002d85b8 serves (only the fields it touches). */ typedef struct { char pad0[0x20]; float hp; /* 0x20 */ char pad24[0x3C]; - short anim[3]; /* 0x60: passed to FUN_L00_0025d458 / FUN_L00_0025d538 */ + short anim[3]; /* 0x60: passed to trooper_anim_update / trooper_anim_finish */ unsigned char pad66; unsigned char flash; /* 0x67 */ char pad68[8]; - char knock[0x10]; /* 0x70: passed to FUN_L00_0025c558 */ + char knock[0x10]; /* 0x70: passed to trooper_start_knockback */ float f80; /* 0x80 */ float f84; float f88; @@ -1749,7 +1754,7 @@ void FUN_L02_002d85b8(void *arg) { d->fA0 = 0.5f; d->i94 = 25; d->bAD = 0; - FUN_L00_0025c558(fast_arc_tan(*(float *)(moby + 0x10) - hero.motion.pos.f[0], + trooper_start_knockback(fast_arc_tan(*(float *)(moby + 0x10) - hero.motion.pos.f[0], *(float *)(moby + 0x14) - hero.motion.pos.f[1]), moby, k, 0xB, 1, 0); d->fC0 = 6.5f; @@ -1765,7 +1770,7 @@ void FUN_L02_002d85b8(void *arg) { d->fBC = D_L02_00161A9C * D_0015ED6C; d->i94 = 9; d->bAD = 0; - FUN_L00_0025c558(fast_arc_tan(*(float *)(moby + 0x10) - hero.motion.pos.f[0], + trooper_start_knockback(fast_arc_tan(*(float *)(moby + 0x10) - hero.motion.pos.f[0], *(float *)(moby + 0x14) - hero.motion.pos.f[1]), moby, k2, 0xE, 1, 0); d->fC0 = 6.5f; @@ -1774,7 +1779,7 @@ void FUN_L02_002d85b8(void *arg) { d->flash = 0xFA; moby[0x20] = 0x11; } - FUN_L00_0025d458(moby, d->anim); + trooper_anim_update(moby, d->anim); } ((unsigned char *)moby)[0xA4] = 0xFF; t = d->target; @@ -1787,14 +1792,14 @@ void FUN_L02_002d85b8(void *arg) { if (d->target == 0) { d->target = ((char *)hero.moby); } - FUN_L00_0025d538(moby, d->anim); + trooper_anim_finish(moby, d->anim); } -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void add_vector_xyz(void *, void *, void *); extern float absolute_float(float) __asm__("func_001F99C0"); -extern int FUN_L00_0028d8c0(void *, int); -extern void FUN_L00_00260738(char *a, void *b, void *c, void *d); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); +extern void update_entity_matrix(char *a, void *b, void *c, void *d) __asm__("FUN_L00_00260738"); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); extern float D_0015ED6C; extern f32 advance_accelerated_scalar(f32 *, f32 *, f32, f32, f32, f32) __asm__("func_00213F38"); @@ -1842,8 +1847,9 @@ extern void enqueue_callback_list_1(void *, void *) __asm__("FUN_001f4600"); extern void transform_vector(void *, void *, void *) __asm__("func_001F9D20"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("func_001F9CF8"); -/* Same platform routine as FUN_L16_002e7f80, with a waiting state (1) and this level's tables. */ -void FUN_L02_002dbd38(L16PlatformMoby *moby) { +/* Same platform routine as elevator_update, with a waiting state (1) and this level's tables. */ +void elevator_update(L16PlatformMoby *moby) __asm__("FUN_L02_002dbd38"); +void elevator_update(L16PlatformMoby *moby) { L16PlatformVector delta, old_rotation, motion; L16PlatformData *d = moby->data; float *position = moby->position; @@ -1868,11 +1874,11 @@ void FUN_L02_002dbd38(L16PlatformMoby *moby) { } break; case 2: - if (FUN_L00_0028d8c0(moby, d->particle)) { + if (voice_is_playing(moby, d->particle)) { release_voice_slot(d->particle); d->particle = -1; } - if (FUN_001f9b80(position, hero.motion.pos.f) < 20.0f) { + if (vector_distance(position, hero.motion.pos.f) < 20.0f) { clear_u64_value(motion.v); if (moby->reverse) { motion.v[2] = -1.0f; @@ -1934,12 +1940,12 @@ void FUN_L02_002dbd38(L16PlatformMoby *moby) { } clear_u64_value(motion.v); motion.v[2] = speed; - FUN_L00_00260738((char *)d->basis, motion.v, moby->rotation, moby->rotation); + update_entity_matrix((char *)d->basis, motion.v, moby->rotation, moby->rotation); if (motion.v[2] != 0.0f) { - if (!FUN_L00_0028d8c0(moby, d->particle)) { + if (!voice_is_playing(moby, d->particle)) { d->particle = allocate_voice_for_target_entry_alt(0, 4, (int)moby); } - } else if (FUN_L00_0028d8c0(moby, d->particle)) { + } else if (voice_is_playing(moby, d->particle)) { release_voice_slot(d->particle); d->particle = -1; } @@ -1955,7 +1961,7 @@ void FUN_L02_002dbd38(L16PlatformMoby *moby) { } } add_vector_xyz(delta.v, delta.v, moby->position); - FUN_L00_00260738((char *)d->basis, delta.v, old_rotation.v, moby->rotation); + update_entity_matrix((char *)d->basis, delta.v, old_rotation.v, moby->rotation); } } @@ -2095,7 +2101,8 @@ extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); void blend_moby_animation(MobyAnim *moby, int new_seq, int frame_index, int blend_frames) __asm__("FUN_00212f90"); extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); -void FUN_L02_002dca10(struct Moby *moby) { +void bulldozer_update(struct Moby *moby) __asm__("FUN_L02_002dca10"); +void bulldozer_update(struct Moby *moby) { switch (moby->prev_seq) { case 0: if (moby->anim_flags & 2) { @@ -2121,7 +2128,7 @@ void FUN_L02_002dca10(struct Moby *moby) { break; } } -/* pvars of the class FUN_L02_002dcb38 updates (only the fields it touches). */ +/* pvars of the class sand_shark_nest_update updates (only the fields it touches). */ typedef struct { char pad0[0x20]; float f20; /* 0x20 */ @@ -2129,9 +2136,9 @@ typedef struct { char pad26[8]; unsigned char b2E; /* 0x2E */ char pad2F[0x11]; - float vel[4]; /* 0x40: passed to FUN_L00_0025e450 */ + float vel[4]; /* 0x40: passed to spawn_explosion */ char pad50[0x20]; - char anim[0x64]; /* 0x70: passed to FUN_L00_0025c698 */ + char anim[0x64]; /* 0x70: passed to mine_fall */ int delay; /* 0xD4: frames between spawns */ int timer; /* 0xD8 */ char padDC[4]; @@ -2148,20 +2155,21 @@ typedef struct { extern unsigned short D_0014D590_cb38[][64][2] __asm__("D_0014D590") __attribute__((section(".data"))); extern int D_0014EE90[]; extern int D_L02_0015FFD8; -extern int FUN_001f9740(void *); -extern void FUN_001f9a28(void *, void *, void *); +extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void set_vector_length_xy(void *, void *, float) __asm__("FUN_001f9c48"); extern float compute_interpolated_record_value(void *) __asm__("FUN_0020c9e0"); extern int scale_ticks(int) __asm__("FUN_001f96f8"); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern void FUN_L02_002dcfe0(struct Moby *m); -extern char *find_group_target_cb38(void *) __asm__("FUN_L02_002dd2a8"); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, float, int, - float, float, int, int, int, int); +extern char *FUN_L02_002dd2a8_c(void *) __asm__("FUN_L02_002dd2a8"); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, float, int, + float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); /* Spawner-fed moby: counts itself in on spawn, hands itself to a group target on a timer, fires a projectile at it (state 2) and bursts into debris when its hit animation flags it (state 4). */ -void FUN_L02_002dcb38(unsigned char *moby) { +void sand_shark_nest_update(unsigned char *moby) __asm__("FUN_L02_002dcb38"); +void sand_shark_nest_update(unsigned char *moby) { Varscb38 *d = *(Varscb38 **)(moby + 0x78); char *o; int n; @@ -2192,8 +2200,8 @@ void FUN_L02_002dcb38(unsigned char *moby) { } break; case 1: - if (FUN_001f9740(&d->timer)) { - if (find_group_target_cb38(moby)) { + if (fast_dec_timer(&d->timer)) { + if (FUN_L02_002dd2a8_c(moby)) { moby[0x20] = 2; if (moby[0x53] != 1) { blend_moby_animation_c3(moby, 1, 0, scale_ticks(10)); @@ -2215,7 +2223,7 @@ void FUN_L02_002dcb38(unsigned char *moby) { n = 20; } d->timer = scale_ticks(d->delay + scale_ticks(n * 15)); - o = find_group_target_cb38(moby); + o = FUN_L02_002dd2a8_c(moby); if (o) { char *od = *(char **)(o + 0x78); if (d->spawner >= 0) { @@ -2223,7 +2231,7 @@ void FUN_L02_002dcb38(unsigned char *moby) { } qcopy(&p, moby + 0x10); p.f[2] += 1.5f; - FUN_001f9a28(&v, od + 0x220, moby + 0x10); + fast_vec_sub(&v, od + 0x220, moby + 0x10); set_vector_length_xy(&v, &v, 2.0f * D_0015ED6C); v.f[2] = D_0015ED6C * 6.0f; FUN_L02_002d6118((unsigned char *)o, &p, v.f); @@ -2231,7 +2239,7 @@ void FUN_L02_002dcb38(unsigned char *moby) { } break; case 3: - FUN_L00_0025c698(moby, d->anim); + mine_fall(moby, d->anim); if (moby[0x70] & 2) { moby[0x20] = 1; if (moby[0x53] != 0) { @@ -2240,13 +2248,13 @@ void FUN_L02_002dcb38(unsigned char *moby) { } break; case 4: - if (FUN_L00_0025c698(moby, d->anim) & 0x40) { + if (mine_fall(moby, d->anim) & 0x40) { if (d->spawner >= 0) { extern int D_L02_0015FFD8_s __asm__("D_L02_0015FFD8") __attribute__((sda)); (*(Spawnercb38 **)((d->spawner << 8) + D_L02_0015FFD8_s + 0x78))->i150 -= 1; } qcopy(&v, moby + 0x10); - FUN_L00_0025e450(moby, d->vel, &v, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, -1, 1.0f, 15.0f, 1, 1, + spawn_explosion(moby, d->vel, &v, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, -1, 1.0f, 15.0f, 1, 1, -1, 0); FUN_L00_00263fd8((char *)moby, 0x6E4, (float *)(moby + 0x10), moby + 0x40, 0, 0, 0.0f, D_L02_0015F580, D_L02_0015F580, D_L02_0015F580); @@ -2267,10 +2275,10 @@ void FUN_L02_002dcb38(unsigned char *moby) { extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern int hit_reaction(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_L00_0025a478"); extern void FUN_L00_00257470(void *, int, int); -extern void FUN_L00_0025ab48(void *, float *, void *, void *); -extern void FUN_L00_0025c558(float, void *, void *, int, int, int); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(float, void *, void *, int, int, int) __asm__("FUN_L00_0025c558"); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern void blend_moby_animation_c2(void *, s32, s32, s32) __asm__("FUN_00212f90"); void mark_moby_for_removal(void *obj) __asm__("FUN_0020c828"); @@ -2309,8 +2317,8 @@ void FUN_L02_002dcfe0(struct Moby *m) { *(float *)(d + 0x8C) = b; } *(OvlQuad *)v = *(OvlQuad *)(h + 0x10); - FUN_L00_0025ab48(v, &k1, d + 0x88, d + 0x8C); - FUN_L00_0025c558(k1, m, d + 0x70, 3, 1, 0); + trooper_knockback_arc(v, &k1, d + 0x88, d + 0x8C); + trooper_start_knockback(k1, m, d + 0x70, 3, 1, 0); if (1.0f <= dmg) { d[0x67] = 0x78; m->state = 3; @@ -2329,18 +2337,18 @@ void FUN_L02_002dcfe0(struct Moby *m) { *(float *)(d + 0x88) = b; } *(OvlQuad *)v = *(OvlQuad *)(h + 0x10); - FUN_L00_0025ab48(v, &k2, d + 0x88, d + 0x8C); - FUN_L00_0025c558(k2, m, d + 0x70, 3, 1, 0); + trooper_knockback_arc(v, &k2, d + 0x88, d + 0x8C); + trooper_start_knockback(k2, m, d + 0x70, 3, 1, 0); *(float *)(d + 0xC0) = 9.0f; *(float *)(d + 0xC4) = 19.0f; if (m->prev_seq != 3) blend_moby_animation_c2(m, 3, 0, 0); FUN_L00_00257470(m, 0, -1); } - FUN_L00_0025d458(m, (short *)(d + 0x60)); + trooper_anim_update(m, (short *)(d + 0x60)); } m->hit_slot = 0xFF; - FUN_L00_0025d538(m, d + 0x60); + trooper_anim_finish(m, d + 0x60); FUN_L00_001fefc8(&m->command); } typedef struct { @@ -2386,33 +2394,34 @@ Level02GroupMoby *FUN_L02_002dd2a8(Level02GroupMoby *owner) { /* four-state update: waits for a flag, plays a transition, and rolls a random heading on entering state 2 or 7 */ /* Ported from rac1-decomp (src/overlays/l02_aridia/vendor_002A59D8.c: func_L02_002DE7A8), where it is exact; names translated to the US level program. */ -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); void blend_moby_animation(MobyAnim *moby, int new_seq, int frame_index, int blend_frames) __asm__("FUN_00212f90"); -void FUN_L02_002dd370(struct Moby *moby) { +void grab_crane_update(struct Moby *moby) __asm__("FUN_L02_002dd370"); +void grab_crane_update(struct Moby *moby) { switch (moby->prev_seq) { case 0: if (moby->anim_flags & 2) { - blend_moby_animation(moby, 2, 0, FUN_001f96f8(5)); + blend_moby_animation(moby, 2, 0, scale_game_frames(5)); moby->command = func_001FA898_r(multiply_global_factor_ed64(random_float_between_alt(60.0f, 180.0f))); } break; case 2: if (FUN_L00_001fefc8(&moby->command)) { if (moby->prev_seq != 3) - blend_moby_animation(moby, 3, 0, FUN_001f96f8(5)); + blend_moby_animation(moby, 3, 0, scale_game_frames(5)); } break; case 3: if (moby->anim_flags & 2) { - blend_moby_animation(moby, 7, 0, FUN_001f96f8(5)); + blend_moby_animation(moby, 7, 0, scale_game_frames(5)); moby->command = func_001FA898_r(multiply_global_factor_ed64(random_float_between_alt(60.0f, 180.0f))); } break; case 7: if (FUN_L00_001fefc8(&moby->command)) { if (moby->prev_seq != 0) - blend_moby_animation(moby, 0, 0, FUN_001f96f8(5)); + blend_moby_animation(moby, 0, 0, scale_game_frames(5)); } break; } @@ -2423,9 +2432,10 @@ void FUN_L02_002dd370(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/l02_aridia/vendor_002A59D8.c: func_L02_002DF038), where it is exact; names translated to the US level program. */ extern float fast_add_rotations_c(float, float) __asm__("func_001FA580"); -extern void FUN_L00_00260738(char *, void *, void *, void *); +extern void update_entity_matrix(char *, void *, void *, void *) __asm__("FUN_L00_00260738"); -void FUN_L02_002ddc00(struct Moby *moby) +void platform_update(struct Moby *moby) __asm__("FUN_L02_002ddc00"); +void platform_update(struct Moby *moby) { char zero[16]; char pos[16]; @@ -2433,14 +2443,14 @@ void FUN_L02_002ddc00(struct Moby *moby) qzero(zero); qcopy(pos, &moby->rot); moby->rot.z = fast_add_rotations_c(moby->rot.z, D_0015ED6C * 0.08726646f); - FUN_L00_00260738(data + 0x20, zero, pos, &moby->rot); + update_entity_matrix(data + 0x20, zero, pos, &moby->rot); } #include "rnc/gameplay/state/usage_stats.h" -/* pvars of the class FUN_L02_002ddc88 updates (the lift: two rail mobys 0x421/0x422 ride with it). */ +/* pvars of the class transport_pod_update updates (the lift: two rail mobys 0x421/0x422 ride with it). */ typedef struct { char pad0[0x20]; - char riders[0x40]; /* 0x20: passed to FUN_L00_00260738 */ + char riders[0x40]; /* 0x20: passed to update_entity_matrix */ int node_a; /* 0x60: D_L02_001600EC node of the lower stop */ int node_b; /* 0x64: node of the upper stop */ int path; /* 0x68: D_L02_001B0AB0 camera path */ @@ -2479,13 +2489,13 @@ extern unsigned char D_0014C050_dc88[] __asm__("D_0014C050"); extern unsigned int D_00141BAC __attribute__((section(".data"))); extern float D_0015ED6C; extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); -extern float FUN_001f9af0(void *); -extern float FUN_001f9b80(void *, void *); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern int FUN_001f9740(void *); +extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); extern float absolute_float_dc88(float) __asm__("func_001F99C0"); extern float FUN_00213f38(float *, float *, float, float, float, float); extern void sample_camera_path(void *, int, void *, void *, int, float) __asm__("FUN_00214e58"); @@ -2497,10 +2507,10 @@ extern void FUN_L00_00216f90(void *, void *, int, int); extern void FUN_L00_00233ee8(void *, int, float); extern int FUN_L00_00233f38(); extern void FUN_L00_00250df8(void *); -extern void FUN_L00_00260738(char *, void *, void *, void *); +extern void update_entity_matrix(char *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void FUN_L00_002ea9d8(void *); extern void FUN_L00_002eaa30(void *); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void FUN_L00_002eac18(int); extern void path_marker_dc88(void *, void *, int, int, int, int, int, float) __asm__("FUN_L01_00285768"); extern void FUN_L02_0022b728(int, int); @@ -2522,7 +2532,8 @@ extern Nodedc88 *D_L02_001600EC_n __asm__("D_L02_001600EC"); extern int D_0015EEA4_gp __asm__("D_0015EEA4") __attribute__((sda)); /* Aridia lift: carries the hero between two stops, with its two rail mobys, gears and a camera path. */ -void FUN_L02_002ddc88(unsigned char *moby) { +void transport_pod_update(unsigned char *moby) __asm__("FUN_L02_002ddc88"); +void transport_pod_update(unsigned char *moby) { Varsdc88 *d = *(Varsdc88 **)(moby + 0x78); int i; int *path; @@ -2580,22 +2591,22 @@ void FUN_L02_002ddc88(unsigned char *moby) { case 2: s = D_0015ED6C * 5.0f; fast_vec_normalize(&a, (char *)D_L02_0015FFD8 + (d->gear[0] << 8) + 0xC0, -s); - FUN_001f9a10((char *)D_L02_0015FFD8 + (d->gear[0] << 8) + 0x10, + fast_vec_add((char *)D_L02_0015FFD8 + (d->gear[0] << 8) + 0x10, (char *)D_L02_0015FFD8 + (d->gear[0] << 8) + 0x10, &a); fast_vec_normalize(&a, (char *)D_L02_0015FFD8 + (d->gear[1] << 8) + 0xC0, s); - FUN_001f9a10((char *)D_L02_0015FFD8 + (d->gear[1] << 8) + 0x10, + fast_vec_add((char *)D_L02_0015FFD8 + (d->gear[1] << 8) + 0x10, (char *)D_L02_0015FFD8 + (d->gear[1] << 8) + 0x10, &a); fast_vec_normalize(&a, (char *)D_L02_0015FFD8 + (d->gear[2] << 8) + 0xC0, -s); - FUN_001f9a10((char *)D_L02_0015FFD8 + (d->gear[2] << 8) + 0x10, + fast_vec_add((char *)D_L02_0015FFD8 + (d->gear[2] << 8) + 0x10, (char *)D_L02_0015FFD8 + (d->gear[2] << 8) + 0x10, &a); fast_vec_normalize(&a, (char *)D_L02_0015FFD8 + (d->gear[3] << 8) + 0xC0, s); - FUN_001f9a10((char *)D_L02_0015FFD8 + (d->gear[3] << 8) + 0x10, + fast_vec_add((char *)D_L02_0015FFD8 + (d->gear[3] << 8) + 0x10, (char *)D_L02_0015FFD8 + (d->gear[3] << 8) + 0x10, &a); FUN_L00_00250df8((char *)D_L02_0015FFD8 + (d->gear[0] << 8)); FUN_L00_00250df8((char *)D_L02_0015FFD8 + (d->gear[1] << 8)); FUN_L00_00250df8((char *)D_L02_0015FFD8 + (d->gear[2] << 8)); FUN_L00_00250df8((char *)D_L02_0015FFD8 + (d->gear[3] << 8)); - if (FUN_001f9740(&d->timer)) { + if (fast_dec_timer(&d->timer)) { moby[0x20] = 3; FUN_0022da68_dc88(1, 0, moby); } @@ -2621,7 +2632,7 @@ void FUN_L02_002ddc88(unsigned char *moby) { break; case 5: if (moby[0xBC] == 0 && - FUN_001f9b80(&hero.motion.pos, D_L02_001600EC_n[d->node_b].pos) < 16.0f) { + vector_distance(&hero.motion.pos, D_L02_001600EC_n[d->node_b].pos) < 16.0f) { qcopy(moby + 0x10, D_L02_001600EC_n[d->node_b].pos); ((struct Moby *)moby)->pos.z -= 6.0f; d->rail_a_off = -1.0f; @@ -2631,7 +2642,7 @@ void FUN_L02_002ddc88(unsigned char *moby) { moby[0xBC] = 1; FUN_0022da68_dc88(1, 0, moby); } else if (moby[0xBC] == 1 && - FUN_001f9b80(&hero.motion.pos, D_L02_001600EC_n[d->node_a].pos) < 16.0f) { + vector_distance(&hero.motion.pos, D_L02_001600EC_n[d->node_a].pos) < 16.0f) { qcopy(moby + 0x10, D_L02_001600EC_n[d->node_a].pos); ((struct Moby *)moby)->pos.z -= 6.0f; d->rail_a_off = -1.0f; @@ -2650,7 +2661,7 @@ void FUN_L02_002ddc88(unsigned char *moby) { qcopy(&c, (char *)D_L02_001B0AB0_dc88[d->path] + trunc_d57f8(d->cam_pos) * 0x10 + 0x10); clear_vec_d57f8(&e); e.f[2] = fast_arc_tan(b.f[0] - c.f[0], b.f[1] - c.f[1]); - e.f[1] = -fast_arc_tan(FUN_001f9b80(&c, &b), b.f[2] - c.f[2]); + e.f[1] = -fast_arc_tan(vector_distance(&c, &b), b.f[2] - c.f[2]); } else { d->cam_goal = *D_L02_001B0AB0_dc88[d->path] - 1; d->cam_pos = 0.0f; @@ -2658,12 +2669,12 @@ void FUN_L02_002ddc88(unsigned char *moby) { qcopy(&c, (char *)D_L02_001B0AB0_dc88[d->path] + trunc_d57f8(d->cam_pos) * 0x10 + 0x10); clear_vec_d57f8(&e); e.f[2] = fast_arc_tan(b.f[0] - c.f[0], b.f[1] - c.f[1]); - e.f[1] = -fast_arc_tan(FUN_001f9b80(&c, &b), b.f[2] - c.f[2]); + e.f[1] = -fast_arc_tan(vector_distance(&c, &b), b.f[2] - c.f[2]); } moby[0x20] = 6; d->ride_timer = scale_ticks(0xB4); FUN_L00_00233ee8(moby + 0x10, 0, a.f[2]); - FUN_L00_002eaaa0(D_L02_001673C0, D_L02_001673C0 + 0x10, 3, scale_ticks(0xF0), 0); + jet_mount(D_L02_001673C0, D_L02_001673C0 + 0x10, 3, scale_ticks(0xF0), 0); FUN_L02_002f8aa0(D_L02_00161C48, D_L02_00161C4C, D_L02_00161C50, D_L02_00161C54, D_L02_00161C58, D_L02_00161C60); FUN_L00_002ea9d8(&c); @@ -2679,7 +2690,7 @@ void FUN_L02_002ddc88(unsigned char *moby) { } else if (r6 == 0) { FUN_L00_002eac18(2); moby[0x20] = 0xD; - } else if (FUN_001f9740(&d->ride_timer)) { + } else if (fast_dec_timer(&d->ride_timer)) { FUN_L00_002eac18(2); moby[0x20] = 0xD; FUN_L02_00237478(); @@ -2706,15 +2717,15 @@ void FUN_L02_002ddc88(unsigned char *moby) { moby[0xBC] = 1; qcopy_nc(moby + 0x10, D_L02_001600EC_n[d->node_b].pos); qcopy_nc(&c, D_L02_001600EC_n[d->node_b].look); - FUN_001f9a28(&a, D_L02_001600EC_n[d->node_b].pos, D_L02_001600EC_n[d->node_a].pos); + fast_vec_sub(&a, D_L02_001600EC_n[d->node_b].pos, D_L02_001600EC_n[d->node_a].pos); } else { moby[0xBC] = 0; qcopy_nc(moby + 0x10, D_L02_001600EC_n[d->node_a].pos); qcopy_nc(&c, D_L02_001600EC_n[d->node_a].look); - FUN_001f9a28(&a, D_L02_001600EC_n[d->node_a].pos, D_L02_001600EC_n[d->node_b].pos); + fast_vec_sub(&a, D_L02_001600EC_n[d->node_a].pos, D_L02_001600EC_n[d->node_b].pos); } ((struct Moby *)moby)->pos.z -= 6.0f; - FUN_001f9a10(&b, &hero.motion.pos, &a); + fast_vec_add(&b, &hero.motion.pos, &a); FUN_L00_00216f90(&b, &c, 0x72, 0); d->speed = -d->speed; moby[0x20] = 9; @@ -2731,7 +2742,7 @@ void FUN_L02_002ddc88(unsigned char *moby) { a.f[2] += 8.0f; clear_vec_d57f8(&b); b.f[2] = fast_arc_tan(a.f[0] - c.f[0], a.f[1] - c.f[1]); - b.f[1] = -fast_arc_tan(FUN_001f9b80(&c, &a), a.f[2] - c.f[2]); + b.f[1] = -fast_arc_tan(vector_distance(&c, &a), a.f[2] - c.f[2]); FUN_L00_002ea9d8(&c); FUN_L00_002eaa30(&b); break; @@ -2825,11 +2836,11 @@ void FUN_L02_002ddc88(unsigned char *moby) { } break; } - FUN_001f9a10(&delta, &delta, moby + 0x10); - if (FUN_001f9af0(&delta) > 4.0f) { + fast_vec_add(&delta, &delta, moby + 0x10); + if (fast_vec_length(&delta) > 4.0f) { clear_vec_d57f8(&delta); } - FUN_L00_00260738(d->riders, &delta, &rot, moby + 0x40); + update_entity_matrix(d->riders, &delta, &rot, moby + 0x40); } /* Ported from rac1-decomp (src/overlays/l02_aridia/vendor_002A59D8.c: func_L02_002E03B8), where it is exact; names translated to the US level program. */ @@ -2867,7 +2878,7 @@ void FUN_L02_002def80(struct Moby *moby) { } /* Ported from rac1-decomp (src/overlays/l02_aridia/vendor_002A59D8.c: func_L02_002E04E8), where it is exact; names translated to the US level program. */ -extern float FUN_001fa580(float, float); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); void FUN_L02_002df0b0(struct Moby *moby) { char *d = (char *)moby->pvars; @@ -2881,12 +2892,12 @@ void FUN_L02_002df0b0(struct Moby *moby) { *(int *)(d + 0x8C) = 0; *(float *)(*(char **)(d + 0x88) + 0x18) = moby->pos.z + *(float *)(d + 0x98); *(int *)(d + 0x90) = 0; - r = FUN_001fa580(moby->rot.z, + r = fast_add_rotations(moby->rot.z, (*(float *)(*(char **)(d + 0x84) + 0x18) - moby->pos.z) * k * DEG_TO_RAD); k2 = *(float *)&D_L02_00161C3C; *(float *)(*(char **)(d + 0x84) + 0x48) = r; - *(float *)(*(char **)(d + 0x88) + 0x48) = FUN_001fa580( + *(float *)(*(char **)(d + 0x88) + 0x48) = fast_add_rotations( moby->rot.z, (*(float *)(*(char **)(d + 0x88) + 0x18) - moby->pos.z) * k2 * DEG_TO_RAD); FUN_L00_00250df8(*(char **)(d + 0x84)); @@ -2903,7 +2914,8 @@ extern void release_voice_slot(s32) __asm__("FUN_0022d798"); void blend_moby_animation(MobyAnim *moby, int new_seq, int frame_index, int blend_frames) __asm__("FUN_00212f90"); extern short D_L02_00161C68 __attribute__((sda)); -void FUN_L02_002df1a8(struct Moby *moby) { +void crane_update(struct Moby *moby) __asm__("FUN_L02_002df1a8"); +void crane_update(struct Moby *moby) { int *d = (int *)moby->pvars; moby->anim_speed = *(float *)&D_L02_00161C68; switch (moby->prev_seq) { @@ -3013,7 +3025,8 @@ extern s32 turret_lerp_colour(f32, s32, s32) __asm__("FUN_001fa6e0"); extern f32 frame_time_sq_macro __asm__("D_0015ED70") __attribute__((section(".sdata"))); /* Swivel turret update: waits a random time, turns to a random heading with a loop sound, then fires one shot with debris and fades its colour while the recoil animation plays. */ -void FUN_L02_002df3d8(struct Moby *m) { +void rocket_launcher_update(struct Moby *m) __asm__("FUN_L02_002df3d8"); +void rocket_launcher_update(struct Moby *m) { SwivelTurretVars *v = (SwivelTurretVars *)m->pvars; Vec4f dir, muzzle; f32 t; @@ -3082,7 +3095,7 @@ extern char D_L02_001673C0[]; extern f32 distance_xyz(void *, void *) __asm__("func_001F9B48"); extern float D_0015ED6C; extern int D_001413D4 __attribute__((section(".data"))); -extern int FUN_L00_0028df38(int, int); +extern int engine_voice_set_pitch(int, int) __asm__("FUN_L00_0028df38"); extern int FUN_L02_0028d618(int, int); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); extern short D_L02_00161C80 __attribute__((sda)); @@ -3140,12 +3153,13 @@ extern s32 D_0015ED84; extern u8 D_0014C050[][16]; extern void FUN_L00_001fff28(void *, int, float); extern void multiply_quaternions(void *, void *, void *) __asm__("FUN_001fa3c0"); -extern float FUN_L00_0025be00(float *, float *, float, float, float, float); +extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); extern void quaternion_nlerp(void *, void *, void *, float) __asm__("FUN_001fa400"); extern void quaternion_rotation_basis(void *, void *) __asm__("FUN_001fa480"); /* Turns the moby from its spawn rotation to the goal angles once it is triggered (unkBC). */ -void FUN_L02_002df948(struct Moby *m) { +void rocket_door1_update(struct Moby *m) __asm__("FUN_L02_002df948"); +void rocket_door1_update(struct Moby *m) { Vec4 qx; Vec4 qy; Vec4 qz; @@ -3192,7 +3206,7 @@ void FUN_L02_002df948(struct Moby *m) { } break; case 2: - FUN_L00_0025be00(&v->t, &v->speed, 1.0f, frame_time_sq_macro * 0.5f, frame_time_sq_macro * 0.5f, D_0015ED6C); + approach_angle(&v->t, &v->speed, 1.0f, frame_time_sq_macro * 0.5f, frame_time_sq_macro * 0.5f, D_0015ED6C); quaternion_nlerp(&qx, &v->start, &v->goal, v->t); quaternion_rotation_basis(&qx, &m->rot_row0); break; @@ -3208,7 +3222,8 @@ extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void normalize_vector_xyz(void *out, void *a, f32 len) __asm__("FUN_001f9bf8"); extern void subtract_vector_xyz(void *out, void *a, void *b) __asm__("FUN_001f9a28"); -void FUN_L02_002dffc8(struct Moby *moby) { +void tresspasser_door1_update(struct Moby *moby) __asm__("FUN_L02_002dffc8"); +void tresspasser_door1_update(struct Moby *moby) { char *d = (char *)moby->pvars; float a[4]; float b[4]; @@ -3248,7 +3263,8 @@ void FUN_L02_002dffc8(struct Moby *moby) { extern char D_L02_0015FFD8_c3 __asm__("D_L02_0015FFD8"); -void FUN_L02_002e0138(struct Moby *moby) { +void tresspasser_door2_update(struct Moby *moby) __asm__("FUN_L02_002e0138"); +void tresspasser_door2_update(struct Moby *moby) { char *data = (char *)moby->pvars; switch (moby->state) { case 0: @@ -3285,7 +3301,7 @@ void FUN_L02_002e0138(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/l02_aridia/vendor_002A59D8.c: func_L02_002E16B8), where it is exact; names translated to the US level program. */ extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern void FUN_L00_00269958(void *, void *, int, int, int, int, int, int); extern void clear_vector(void *) __asm__("func_001F99F8"); void blend_moby_animation_c(void *moby, int new_seq, int frame_index, int blend_frames) __asm__("FUN_00212f90"); @@ -3293,7 +3309,8 @@ void mark_moby_for_removal(void *obj) __asm__("FUN_0020c828"); int D_L02_00161C9C = 0x6f707070; int D_L02_00161CA0 = 0x707070; -void FUN_L02_002e0280(struct Moby *moby) { +void sandshark_egg_update(struct Moby *moby) __asm__("FUN_L02_002e0280"); +void sandshark_egg_update(struct Moby *moby) { float u[4]; float v[4]; char *d = (char *)moby->pvars; @@ -3305,7 +3322,7 @@ void FUN_L02_002e0280(struct Moby *moby) { switch (moby->state) { case 1: clear_vector(u); - if (FUN_L00_0025c698(moby, d) & 1) { + if (mine_fall(moby, d) & 1) { moby->state = 2; } vp = v; @@ -3344,19 +3361,20 @@ int D_L02_00161CC4 = 0x5f243632; int D_L02_00161CC8 = 0x61311; extern Colors0720 D_L02_00161CD0; extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern void FUN_L00_0026ced0(void *, void *, int, int, float, int); /* Spark emitter; the size float is declared before the int lifetime (same registers) so the calls * run in retail order: colour index, size, lifetime. */ -extern void FUN_L01_002f8530(void *, void *, u32, f32, s32, f32, f32, f32, s32); +extern void spawn_debris_chunk(void *, void *, u32, f32, s32, f32, f32, f32, s32) __asm__("FUN_L01_002f8530"); extern int FUN_0022da68(int, int, int); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern int scale_ticks(int) __asm__("FUN_001f96f8"); /* One-shot burst: when hit, flags D_0013D39D, sprays 200 dust puffs and 50 sparks, then removes itself. */ -void FUN_L02_002e0720(struct Moby *moby) { +void rocks_update(struct Moby *moby) __asm__("FUN_L02_002e0720"); +void rocks_update(struct Moby *moby) { char *h; int i; int j; @@ -3389,7 +3407,7 @@ void FUN_L02_002e0720(struct Moby *moby) { tmp.f[1] = random_float_between_alt(-1.0f, 1.0f) * fast_sin_d57f8(moby->rot.z); tmp.f[2] = random_float_between_alt(0.0f, 4.0f); pos.q = tmp.q; - FUN_001f9a10(&pos, &pos, &moby->pos); + fast_vec_add(&pos, &pos, &moby->pos); fast_vec_normalize(&dir, &dir, random_float_between_alt(1.5f, 3.5f) * D_0015ED6C); FUN_L00_0026ced0(&pos, &dir, D_L02_00161CC4, D_L02_00161CC8, random_float_between_alt(1.5f, 3.5f) * 210000.0f, @@ -3411,9 +3429,9 @@ void FUN_L02_002e0720(struct Moby *moby) { tmp.f[1] = random_float_between_alt(-1.0f, 1.0f) * fast_sin_d57f8(moby->rot.z); tmp.f[2] = random_float_between_alt(1.0f, 4.0f); pos.q = tmp.q; - FUN_001f9a10(&pos, &pos, &moby->pos); + fast_vec_add(&pos, &pos, &moby->pos); fast_vec_normalize(&dir, &dir, random_float_between_alt(1.0f, 5.0f) * D_0015ED6C); - FUN_L01_002f8530(&pos, &dir, colors.c[random_integer_below(3)], + spawn_debris_chunk(&pos, &dir, colors.c[random_integer_below(3)], random_float_between_alt(0.05f, 0.15f), random_int_between(0x3C, 0xB4), 1.0f, 1.0f, 0.75f, 0); } diff --git a/src/overlays/l02/gameplay/entities/skids_agent.c b/src/overlays/l02/gameplay/entities/skids_agent.c index fa3d43dd9a..63f3c6c3f0 100644 --- a/src/overlays/l02/gameplay/entities/skids_agent.c +++ b/src/overlays/l02/gameplay/entities/skids_agent.c @@ -63,7 +63,7 @@ extern WatcherReward D_L02_0016CE60; extern char D_L02_00161D00[]; extern void FUN_L02_002e0cd8(struct Moby *); extern void FUN_L02_002e1fb8(struct Moby *); -extern void FUN_L02_0025c758(struct Moby *); +extern void initialize_moby_grounding(struct Moby *) __asm__("FUN_L02_0025c758"); extern void delete_moby(struct Moby *) __asm__("FUN_0020c828"); extern void watcher_init(struct Moby *, WatcherVars *) __asm__("FUN_L00_002668a0"); extern s32 watcher_talk(struct Moby *, WatcherVars *) __asm__("FUN_L00_00266448"); @@ -71,8 +71,8 @@ extern void watcher_face(struct Moby *, f32) __asm__("FUN_L01_002783a8"); extern s32 point_in_clip_volume(void *, s32) __asm__("FUN_00214720"); extern void give_reward(s32, s32) __asm__("FUN_L00_00203908"); extern void FUN_L00_00260860(s32, s32); -extern void FUN_L00_002502a0(s32); -extern void FUN_L00_00284e50(void *, void *); +extern void jet_clear_persistent(s32) __asm__("FUN_L00_002502a0"); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern void end_conversation(s32, s32) __asm__("FUN_0020b178"); extern s32 count_down_16(s16 *) __asm__("FUN_001f9770"); extern s32 count_down(s32 *) __asm__("FUN_001f9740"); @@ -124,7 +124,8 @@ extern void FUN_L00_00250df8(void *); /* Aridia NPC with a carried prop moby (data+0x178): dialogue state machine (the hint in state 1 is usage * record 50), a path-camera ride (3/4) that fades D_L02_0015F3FC in and out, then the shared head-tracking tail. */ -void FUN_L02_002e0dc0(struct Moby *moby) { +void skids_agent_update(struct Moby *moby) __asm__("FUN_L02_002e0dc0"); +void skids_agent_update(struct Moby *moby) { char *data = (char *)moby->pvars; s32 t; f32 fade; @@ -139,7 +140,7 @@ void FUN_L02_002e0dc0(struct Moby *moby) { *(char **)(data + 0x20) = D_L02_00161CF0; moby->state = 1; initialize_npc_dialogue(moby, data); - FUN_L02_0025c758(moby); + initialize_moby_grounding(moby); prop = create_moby(0x38); *(struct Moby **)(data + 0x178) = prop; prop->draw_dist = 0x40; @@ -189,10 +190,10 @@ void FUN_L02_002e0dc0(struct Moby *moby) { if (level_game_mode != 2) { moby->state = 1; if (*(s16 *)(data + 4) == 0) { - FUN_L00_002502a0(moby->mission); + jet_clear_persistent(moby->mission); if (*(s32 *)(data + 0x150) != -1) { char *p = D_L02_001600EC + (*(s32 *)(data + 0x150) << 7); - FUN_L00_00284e50(p + 0x30, p + 0x70); + jet_reset_camera(p + 0x30, p + 0x70); } } else if (*(s16 *)(data + 4) == 2) { moby->visible = 0; @@ -349,8 +350,9 @@ void FUN_L02_002e0dc0(struct Moby *moby) { } extern f32 frame_scale_sq_macro __asm__("D_0015ED64") __attribute__((section(".sdata"))); -/* Watcher NPC update (twin of FUN_L05_00317470): idles with random animations, talks to the hero and drops its reward, and turns its head toward the hero or a random look target. */ -void FUN_L02_002e1950(struct Moby *m) { +/* Watcher NPC update (twin of qwarks_bouncer_update): idles with random animations, talks to the hero and drops its reward, and turns its head toward the hero or a random look target. */ +void skid_mcmarx_update(struct Moby *m) __asm__("FUN_L02_002e1950"); +void skid_mcmarx_update(struct Moby *m) { WatcherVars *v = (WatcherVars *)m->pvars; WatcherLook look; f32 rate; @@ -370,7 +372,7 @@ void FUN_L02_002e1950(struct Moby *m) { m->state = 1; m->update_dist = 0xFF; watcher_init(m, v); - FUN_L02_0025c758(m); + initialize_moby_grounding(m); break; case 1: if (v->zone_check == 1 && point_in_clip_volume(&hero.motion.pos, v->zone)) @@ -384,8 +386,8 @@ void FUN_L02_002e1950(struct Moby *m) { if (v->talk_state == 2) { give_reward(2000, 10); FUN_L00_00260860(30, 1); - FUN_L00_002502a0(*((u8 *)m + 0xB0)); - FUN_L00_00284e50(&hero.motion.pos, &hero.motion.rot); + jet_clear_persistent(*((u8 *)m + 0xB0)); + jet_reset_camera(&hero.motion.pos, &hero.motion.rot); end_conversation(0, -1); delete_moby(m); return; @@ -562,11 +564,12 @@ extern void set_moby_animation(void *, int, int) __asm__("FUN_00212ed8"); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); extern int allocate_voice_for_target(int, int, void *) __asm__("FUN_0022da68"); extern void release_voice_slot(int) __asm__("FUN_0022d798"); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); /* Lift platform carried by an animated driver moby: follows the driver's joint 0, waits at an end (3/5) for the * hero to step on, then plays the driver's up or down animation (2/4) with its loop sound until it ends. */ -void FUN_L02_002e2228(struct Moby *moby) { +void liftcar_platform_update(struct Moby *moby) __asm__("FUN_L02_002e2228"); +void liftcar_platform_update(struct Moby *moby) { char *data = (char *)moby->pvars; struct Moby *driver = &D_L02_0015FFD8[*(int *)(data + 0xA0)]; Vec4 delta; @@ -667,7 +670,7 @@ void FUN_L02_002e2228(struct Moby *moby) { break; } add_vectors(&delta, &delta, &moby->pos); - FUN_L00_00260738(data + 0x60, &delta, &old_rot, &moby->rot); + update_entity_matrix(data + 0x60, &delta, &old_rot, &moby->rot); } extern int D_L02_0015F608; @@ -680,8 +683,8 @@ extern char D_L02_001F3D90[]; extern char D_L02_001F3DD0[]; extern char D_L02_001F3E10[]; extern char D_L02_001F3E80[]; -extern void begin_2ea048(float, float, float, float, int, int, int, int, int, int, void *) __asm__("FUN_L02_002a4818"); -extern void end_2ea048(void) __asm__("FUN_L02_002a47f8"); +extern void FUN_L02_002a4818(float, float, float, float, int, int, int, int, int, int, void *); +extern void FUN_L02_002a47f8_c(void) __asm__("FUN_L02_002a47f8"); extern int in_clip_2ea048(void *, int) __asm__("FUN_00214720"); extern void draw_2ea048(void *) __asm__("FUN_00201f58"); @@ -690,7 +693,7 @@ extern void draw_2ea048(void *) __asm__("FUN_00201f58"); void FUN_L02_002ea048(struct Moby *m) { int *d = (int *)m->pvars; - begin_2ea048(0.0f, 260080.0f, 255.0f, 0.0f, 15, 15, 25, 30, 40, 64, D_L02_001F3E80); + FUN_L02_002a4818(0.0f, 260080.0f, 255.0f, 0.0f, 15, 15, 25, 30, 40, 64, D_L02_001F3E80); if (D_L02_0015F608 != 0 || (d[0] != -1 && in_clip_2ea048(D_L02_001673C0, d[0]))) { draw_2ea048(D_L02_001F3C00); } @@ -704,7 +707,7 @@ void FUN_L02_002ea048(struct Moby *m) { if (D_L02_0015F608 != 0 || (d[2] != -1 && in_clip_2ea048(D_L02_001673C0, d[2]))) { draw_2ea048(D_L02_001F3C60); } - end_2ea048(); + FUN_L02_002a47f8_c(); } extern void add_draw_callback(void *, void *) __asm__("FUN_001f4600"); @@ -718,7 +721,8 @@ extern void add_draw_callback(void *, void *) __asm__("FUN_001f4600"); extern void FUN_L02_002a47f8(float); extern void FUN_L02_002ea048_cb(void) __asm__("FUN_L02_002ea048"); -void FUN_L02_002ea198(struct Moby *moby) { +void ocean_aridia_update(struct Moby *moby) __asm__("FUN_L02_002ea198"); +void ocean_aridia_update(struct Moby *moby) { switch (moby->state) { case 0: FUN_L02_002a47f8(0.16666667f); diff --git a/src/overlays/l02/gameplay/hero/0021b698.c b/src/overlays/l02/gameplay/hero/0021b698.c index e842cc8b8b..5d4ad9e0a0 100644 --- a/src/overlays/l02/gameplay/hero/0021b698.c +++ b/src/overlays/l02/gameplay/hero/0021b698.c @@ -14,7 +14,7 @@ extern int D_0015ED84_c __asm__("D_0015ED84"); extern int D_0015ED84_d __asm__("D_0015ED84"); extern int FUN_001f0b58_c(void) __asm__("FUN_001f0b58"); -extern int FUN_L00_001f0d60(float, void *, int, void *); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern void fast_mem_zero16(void *, int) __asm__("FUN_001f9810"); extern void FUN_L00_0020b930(void); extern int hero_set_state(int, int) __asm__("FUN_L02_0022b728"); @@ -51,7 +51,7 @@ void FUN_L02_0021b698(void) { if (v == 0xD) { struct Hero *q = &hero; if (q->state.current != 0x7B) { - if (FUN_L00_001f0d60(q->unk234 + 0.03f, &q->motion.unkD0, 2, 0)) { + if (coll_sphere(q->unk234 + 0.03f, &q->motion.unkD0, 2, 0)) { if (FUN_001f0b58_c() == 0xB) { hero_set_state(0x7B, 1); return; @@ -292,17 +292,17 @@ extern u8 D_L02_00174460[] __attribute__((section(".data"))); void FUN_001f99f8_c(void *) __asm__("FUN_001f99f8"); void hero_get_collision_ray_endpoints(void *, void *, s32, f32, f32) __asm__("FUN_L00_002126b8"); -s32 FUN_001efa68(void *, void *, s32, s32, s32); +s32 collision_line(void *, void *, s32, s32, s32) __asm__("FUN_001efa68"); s32 coll_sound_class(void) __asm__("FUN_L00_001f3608"); s32 collision_hit_material(void) __asm__("FUN_001f0b58"); f32 resolve_camera_surface_height(void *, void *) __asm__("FUN_002135f0"); s32 FUN_L00_0025e3b8(s32); -u8 *FUN_002141f8(s32); +u8 *suck_get_aim_height(s32) __asm__("FUN_002141f8"); f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); void sceVu0Normalize(void *, void *) __asm__("FUN_00125180"); f32 FUN_L00_00233d30(void *); f32 FUN_001f9e90_c(f32, f32) __asm__("FUN_001f9e90"); -void FUN_001f9a28(void *, void *, void *); +void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); f32 FUN_001f9ab0_c(void *, void *) __asm__("FUN_001f9ab0"); void FUN_001f9a68_c(void *, void *, f32) __asm__("FUN_001f9a68"); void FUN_001f9bf8_c(void *, void *, f32) __asm__("FUN_001f9bf8"); @@ -347,7 +347,7 @@ void FUN_L02_002216a0(void) { g = hero.unk234 * 2.9f; } hero_get_collision_ray_endpoints(&v10, &v0, k, g, -48.0f); - if (FUN_001efa68(&v10, &v0, 2, (s32)hero.moby, 0) == 0) { + if (collision_line(&v10, &v0, 2, (s32)hero.moby, 0) == 0) { goto tail; } r = coll_sound_class(); @@ -361,7 +361,7 @@ void FUN_L02_002216a0(void) { if (hero.motion.pos.f[2] < hero.water_surface_z && hero.unk2F8 <= 0) { hero.unk2F8 = 1; } - if (FUN_001efa68(&v10, &v0, 0x24, (s32)hero.moby, 0) == 0) { + if (collision_line(&v10, &v0, 0x24, (s32)hero.moby, 0) == 0) { goto d1; } r = coll_sound_class(); @@ -373,14 +373,14 @@ void FUN_L02_002216a0(void) { if (hero.ground_type == 0xD) { hero.water_surface_z = HH.point.f[2]; v10.f[2] = HH.point.f[2] - 0.01f; - if (FUN_001efa68(&v10, &v0, 4, (s32)hero.moby, 0) == 0) { + if (collision_line(&v10, &v0, 4, (s32)hero.moby, 0) == 0) { goto d1; } } if (hero.ground_type == 3) { hero.unk2F4 = HH.point.f[2]; v10.f[2] = HH.point.f[2] - 0.01f; - if (FUN_001efa68(&v10, &v0, 4, (s32)hero.moby, 0) == 0) { + if (collision_line(&v10, &v0, 4, (s32)hero.moby, 0) == 0) { goto d1; } } @@ -392,7 +392,7 @@ void FUN_L02_002216a0(void) { if (FUN_L00_0025e3b8(HH.moby)) { hero.unk30A = 1; } - p = FUN_002141f8(HH.moby); + p = suck_get_aim_height(HH.moby); if (p != 0 && (*(u16 *)(p + 0x1E) & 8)) { hero.unk30A = 1; } @@ -405,7 +405,7 @@ void FUN_L02_002216a0(void) { sceVu0Normalize((u8 *)&hero.unk270, (u8 *)&HH.normal_x); hero.ground_slope.f = FUN_L00_00233d30((u8 *)&HH.normal_x); hero.downhill_yaw = FUN_001f9e90_c(HH.normal_x, HH.normal_y); - FUN_001f9a28(&v20, (u8 *)&hero.ground_point, (u8 *)&hero.motion.pos); + fast_vec_sub(&v20, (u8 *)&hero.ground_point, (u8 *)&hero.motion.pos); if (0.0f < FUN_001f9ab0_c(&v20, (u8 *)&hero.unk270)) { hero.ground_distance = -hero.ground_distance; } @@ -438,7 +438,7 @@ void FUN_L02_002216a0(void) { FUN_001f9a68_c((u8 *)&hero.gravity_dir, (u8 *)&hero.gravity_dir, -1.0f); break; case 2: - FUN_001f9a28((u8 *)&hero.gravity_dir, (u8 *)&hero.motion.unkB0, (u8 *)&hero.motion.pos); + fast_vec_sub((u8 *)&hero.gravity_dir, (u8 *)&hero.motion.unkB0, (u8 *)&hero.motion.pos); FUN_001f9bf8_c((u8 *)&hero.gravity_dir, (u8 *)&hero.gravity_dir, 1.0f); break; } @@ -471,7 +471,7 @@ void FUN_L02_002216a0(void) { } FUN_L00_002335c8(&v30, 0.2f, a, 0.45f); FUN_L00_002335c8(&v40, 0.2f, a, -0.45f); - if (FUN_001efa68(&v30, &v0, 0x22, (s32)hero.moby, 0)) { + if (collision_line(&v30, &v0, 0x22, (s32)hero.moby, 0)) { f = HH.point.f[2] - hero.ground_z.f; hero.unk2C0.f[i] = f; if (0.4f < FUN_001f99c0(f)) { @@ -705,9 +705,9 @@ extern float square_root(float) __asm__("FUN_001f9988"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_001ff600_cf(void *) __asm__("FUN_001f9b20"); extern float FUN_L00_00208f20(float, float, float, float); -extern float FUN_L00_00213350(void *); -extern float FUN_L00_00233a78(float *); -extern float FUN_L00_0025b8c0(float *, float *, float, float, float, float); +extern float forward_component(void *) __asm__("FUN_L00_00213350"); +extern float gravity_z(float *) __asm__("FUN_L00_00233a78"); +extern float vendor_spring(float *, float *, float, float, float, float) __asm__("FUN_L00_0025b8c0"); extern float FUN_L00_0025bb38(int, float, float); extern float FUN_L00_0025bc00(float *, int, float, float); extern float FUN_L00_0025bc98(void *, float, void *, int, float, float, float); @@ -761,8 +761,8 @@ extern void FUN_L00_002334d0(float *dst, float *src, float h); extern void FUN_L00_002336e8(float *, float *, float); extern void FUN_L00_00233708_cf(int, int) __asm__("FUN_L00_00216de8"); extern void FUN_L00_00233810_cf(void *, void *, float) __asm__("FUN_L00_00233708"); -extern void FUN_L00_002338d0(float *, float *); -extern void FUN_L00_00233b20(float *, float *, float); +extern void gravity_flatten(float *, float *) __asm__("FUN_L00_002338d0"); +extern void gravity_set_z(float *, float *, float) __asm__("FUN_L00_00233b20"); extern void FUN_L00_00233ba0(float *, float *, float); extern void make_hit_descriptor(void *, void *, int, float, void *) __asm__("FUN_L00_00259888"); extern void FUN_L00_0025e3b8_cf(float *, float, float, float) __asm__("FUN_L00_00233660"); @@ -1168,7 +1168,7 @@ void FUN_L02_00225c20(void) { hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { FUN_L00_002334d0(hero.motion.velocity.f, hero.motion.displacement.f, frame_time_sq * 40.0f); - if (hero.unk9BE != 0 && FUN_L00_00233a78(hero.motion.velocity.f) > 0.0f) { + if (hero.unk9BE != 0 && gravity_z(hero.motion.velocity.f) > 0.0f) { subtract_vector_xyz(vec[3], hero.motion.pos.f, ((Moby *)hero.unk994)->f10); FUN_L00_002334d0(hero.motion.velocity.f, hero.motion.velocity.f, frame_time_sq * 57.0f); } @@ -1214,7 +1214,7 @@ void FUN_L02_00225c20(void) { float d; d = hero.unk9A4; - FUN_L00_0025b8c0(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, + vendor_spring(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); d = hero.unk9A4 - d; if (hero.unk9A4 < vector_length_xyz(vec[12])) { @@ -1229,7 +1229,7 @@ void FUN_L02_00225c20(void) { lim = frame_time * 14.0f; len = FUN_L00_001ff600_cf(hero.motion.velocity.f); if (len < lim) { - FUN_L00_0025b8c0(&len, &hero.unk9B4, lim, frame_scale_sq * 0.047f, + vendor_spring(&len, &hero.unk9B4, lim, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); vec[3][0] = fast_cos(hero.unk9AC) * hero.unk9B4; vec[3][1] = fast_sin(hero.unk9AC) * hero.unk9B4; @@ -1248,7 +1248,7 @@ void FUN_L02_00225c20(void) { up = hero.unk9BC == 1; } else { *(OvlQuad *)vec[3] = *(OvlQuad *)hero.motion.displacement.f; - up = FUN_L00_00213350(vec[3]) > 0.0f; + up = forward_component(vec[3]) > 0.0f; } if (up) { if (moby->f53 != 0x35) { @@ -1285,12 +1285,12 @@ void FUN_L02_00225c20(void) { if (hero.state_timer < t0) { float z; - z = FUN_L00_00233a78(hero.motion.velocity.f); + z = gravity_z(hero.motion.velocity.f); approach_value(&z, a, b); - FUN_L00_00233b20(hero.motion.velocity.f, hero.motion.velocity.f, z); + gravity_set_z(hero.motion.velocity.f, hero.motion.velocity.f, z); } else if (hero.state_timer > t1) { FUN_L00_002334d0(hero.motion.velocity.f, hero.motion.velocity.f, hero.unk4B0); - if (FUN_L00_00233a78(hero.motion.velocity.f) < 0.0f) { + if (gravity_z(hero.motion.velocity.f) < 0.0f) { hero.unk4B8 = 1.0f; } } @@ -1374,16 +1374,16 @@ void FUN_L02_00225c20(void) { if (hero.state_timer < t0) { float z; - z = FUN_L00_00233a78(hero.motion.velocity.f); + z = gravity_z(hero.motion.velocity.f); approach_value(&z, v, acc); - FUN_L00_00233b20(hero.motion.velocity.f, hero.motion.velocity.f, z); + gravity_set_z(hero.motion.velocity.f, hero.motion.velocity.f, z); } else if (hero.state_timer > t1) { FUN_L00_002334d0(hero.motion.velocity.f, hero.motion.velocity.f, frame_time_sq * 130.0f); - if (FUN_L00_00233a78(hero.motion.velocity.f) < 0.0f) { + if (gravity_z(hero.motion.velocity.f) < 0.0f) { hero.unkA70 = 1.0f; } - if (FUN_L00_00233a78(hero.motion.velocity.f) < frame_time * -37.0f) { - FUN_L00_00233b20(hero.motion.velocity.f, hero.motion.velocity.f, frame_time * -37.0f); + if (gravity_z(hero.motion.velocity.f) < frame_time * -37.0f) { + gravity_set_z(hero.motion.velocity.f, hero.motion.velocity.f, frame_time * -37.0f); } } } break; @@ -1733,7 +1733,7 @@ void FUN_L02_00225c20(void) { FUN_L00_002132b8(0.7f, 0.0f); *(OvlQuad *)vec[0] = *(OvlQuad *)hero.move_impulse.f; - hero.target_speed = hero.target_speed + FUN_L00_00213350(vec[0]); + hero.target_speed = hero.target_speed + forward_component(vec[0]); if (hero.target_speed < frame_time * 0.7f) { hero.target_speed = frame_time * 0.7f; } @@ -1891,8 +1891,8 @@ void FUN_L02_00225c20(void) { FUN_L00_00215340(); FUN_L00_002132b8(0.7f, frame_time * 0.0f); FUN_L00_002334d0(hero.motion.velocity.f, hero.motion.velocity.f, hero.unk940); - if (FUN_L00_00233a78(hero.motion.velocity.f) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(hero.motion.velocity.f, hero.motion.velocity.f, -(frame_time * 50.0f)); + if (gravity_z(hero.motion.velocity.f) < -(frame_time * 50.0f)) { + gravity_set_z(hero.motion.velocity.f, hero.motion.velocity.f, -(frame_time * 50.0f)); } break; case 0x77: @@ -1908,8 +1908,8 @@ void FUN_L02_00225c20(void) { hero.motion.velocity.f); } FUN_L00_002334d0(hero.motion.velocity.f, hero.motion.velocity.f, hero.unk940); - if (FUN_L00_00233a78(hero.motion.velocity.f) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(hero.motion.velocity.f, hero.motion.velocity.f, -(frame_time * 50.0f)); + if (gravity_z(hero.motion.velocity.f) < -(frame_time * 50.0f)) { + gravity_set_z(hero.motion.velocity.f, hero.motion.velocity.f, -(frame_time * 50.0f)); } break; case 0x81: { @@ -1948,11 +1948,11 @@ void FUN_L02_00225c20(void) { FUN_L00_00215340(); FUN_L01_00232978(1); if (fast) { - FUN_L00_002338d0(hero.motion.velocity.f, hero.motion.velocity.f); + gravity_flatten(hero.motion.velocity.f, hero.motion.velocity.f); FUN_L00_002334d0(hero.motion.velocity.f, hero.motion.velocity.f, a * 0.72f); hero.unk304 = hero.motion.velocity.f[2]; } else { - FUN_L00_0025b8c0(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, + vendor_spring(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, frame_scale_sq * 0.35f, frame_time * 2.5f); } } break; @@ -1989,7 +1989,7 @@ void FUN_L02_00225c20(void) { speed_step(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); FUN_L00_00215340(); - FUN_L00_002338d0(hero.motion.velocity.f, hero.motion.velocity.f); + gravity_flatten(hero.motion.velocity.f, hero.motion.velocity.f); FUN_L00_002334d0(hero.motion.velocity.f, hero.motion.velocity.f, v * 0.72f); if (hero.motion.pos.f[2] < hero.unk410) { approach_value(&hero.unk410, hero.motion.pos.f[2], frame_time * 4.0f); @@ -2101,7 +2101,7 @@ void FUN_L02_00225c20(void) { if (hero.motion.pos.f[2] < hero.unk410) { hero.unk410 = hero.motion.pos.f[2]; } - if (hero.state_timer > hero.unk420 && FUN_L00_00233a78(hero.motion.velocity.f) < 0.001f && + if (hero.state_timer > hero.unk420 && gravity_z(hero.motion.velocity.f) < 0.001f && (hero.unk41C == 0 || hero.state_timer > hero.unk3D4)) { hero.unk41E = 1; if (hero.unk3F8 != 0.0f) { diff --git a/src/overlays/l02/gameplay/hero/hero_set_state.c b/src/overlays/l02/gameplay/hero/hero_set_state.c index b84a82e92f..56156907f7 100644 --- a/src/overlays/l02/gameplay/hero/hero_set_state.c +++ b/src/overlays/l02/gameplay/hero/hero_set_state.c @@ -35,7 +35,7 @@ extern float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_0020d658(int back); -extern float FUN_L00_002339d0(float *v); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float vector_length_xy(void *); @@ -393,7 +393,7 @@ int hero_set_state(int a, int b) { char *v = (char *)&p->motion.unk110; p->state.control_mode = 1; p->unk2284 = 0; - p->ground_speed = FUN_L00_002339d0((float *)v); + p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.unk150, v); if (b) { int id = 6; @@ -1796,11 +1796,11 @@ extern S17C438 D_L02_0017C3B8; extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L02_0015F638; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_00208f20(float a, float b, float c, float d); extern float FUN_L00_00232b90(float a, float b, float c); -extern float FUN_L00_00233a78(float *v); +extern float gravity_z(float *v) __asm__("FUN_L00_00233a78"); extern float FUN_L00_00233c30(float *pos, float *vel, int *steps, float step); extern float FUN_L00_00266e80(int); extern float approach_value(float *p, float target, float maxstep) __asm__("FUN_00213ed8"); @@ -1850,7 +1850,7 @@ extern void FUN_L00_00232628(void); extern void FUN_L00_00232640(int id); extern void FUN_L00_00233288(float a, float b, short c, unsigned char d, unsigned char e, unsigned char f); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void hud_keep_visible(int, int) __asm__("FUN_L00_00235e18"); extern void FUN_L00_00237ae8(void); extern void FUN_L00_00237ba0(void); @@ -2451,7 +2451,7 @@ void FUN_L02_00230988(void) { } break; case 101: - if (FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { + if (vector_distance(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { if (frame_time * 2.7f > hero.motion.speed_xy) { if (fast_difference_between_rotations( hero.motion.rot.f[2], hero.unk1640.f[3]) < 0.034906585f) { @@ -2475,7 +2475,7 @@ void FUN_L02_00230988(void) { if ((hero.unkA98 & 2) || hero.unk1650 != 0) { hero_set_state(HERO_STATE_IDLE, 1); } - if (0.2f < FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f)) { + if (0.2f < vector_distance(hero.motion.pos.f, hero.unk1640.f)) { hero_set_state(0x65, 1); } break; @@ -2880,7 +2880,7 @@ void FUN_L02_00230988(void) { if (hero_set_state(HERO_STATE_IDLE, 0)) { set_hero_animation(0xC, 9, -1.0f); } - FUN_L00_00233b20(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); + gravity_set_z(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); FUN_L00_0025f730(hero.motion.unk150.f, frame_time * 7.0f); hero.unk1C4 = scale_game_frames(7); if (hero.state.prev == 0x2D) { @@ -3387,7 +3387,7 @@ void FUN_L02_00230988(void) { scale_game_frames(0xE) < hero.state_timer && (hero.unk41E == 0 || (hero.ground_distance > 0.7f && - absolute_float(FUN_L00_00233a78(hero.motion.velocity.f)) < + absolute_float(gravity_z(hero.motion.velocity.f)) < frame_time * 5.8f))) { hero_set_state(0xE, 1); } else if (D_0013D4DC[-0x1A] != 0 && hero_slot_item_id(3) != 4 && diff --git a/src/overlays/l03/gameplay/entities/metropolis_train_locomotive.c b/src/overlays/l03/gameplay/entities/metropolis_train_locomotive.c index 7d87a85272..59bf5fe051 100644 --- a/src/overlays/l03/gameplay/entities/metropolis_train_locomotive.c +++ b/src/overlays/l03/gameplay/entities/metropolis_train_locomotive.c @@ -18,8 +18,8 @@ extern char D_L03_00166EC0[]; extern float FUN_001f9b48(void *, void *); -extern int FUN_001f96f8(int); -extern int FUN_001f9770(void *); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); @@ -38,19 +38,19 @@ void FUN_L03_0029d1b8(struct Moby *moby) { if (*(short *)(data + 0x148) == -1) { int lo = *(short *)(data + 0x14C); *(short *)(data + 0x148) = - FUN_001f96f8(random_int_between(lo, lo + *(short *)(data + 0x14E))); + scale_game_frames(random_int_between(lo, lo + *(short *)(data + 0x14E))); } else { int x, y; - if (!FUN_001f9770(data + 0x148)) { + if (!fast_dec_timer_s16(data + 0x148)) { break; } f = FUN_001f9b48(&moby->pos, D_L03_00166EC0); if (f > 15.0f && f < 90.0f) { allocate_voice_for_target_entry(0, 0, (int)moby); } - x = FUN_001f96f8(0x898); - y = FUN_001f96f8(0x898); - *(short *)(data + 0x148) = FUN_001f96f8(random_int_between(x, y + FUN_001f96f8(0x3E8))); + x = scale_game_frames(0x898); + y = scale_game_frames(0x898); + *(short *)(data + 0x148) = scale_game_frames(random_int_between(x, y + scale_game_frames(0x3E8))); } break; } @@ -106,13 +106,13 @@ int FUN_L03_002c6ca0(struct Moby *moby) { extern f32 fast_cos(f32) __asm__("func_001F9DC8"); extern f32 fast_sin(f32) __asm__("func_001F9DE0"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_add_rotations(float, float) __asm__("func_001FA580"); extern int D_L03_0015FFD8; /* no foreign declaration */ extern short D_L03_00161368 __attribute__((sda)); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); extern void FUN_L00_00250df8(void *); -extern void FUN_L00_00260738(char *, void *, void *, void *); +extern void update_entity_matrix(char *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void advance_moby_animation_alt(void *) __asm__("FUN_0020d580"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); @@ -142,7 +142,7 @@ void FUN_L03_00292578(struct Moby *moby, float *pos, float heading) { moby->rot.z = fast_add_rotations(heading, 3.1415927f); moby->rot.y = 0.0f; subtract_vector_xyz(delta, &moby->pos, old_pos); - FUN_L00_00260738(data + 0x60, delta, old_rot, &moby->rot); + update_entity_matrix(data + 0x60, delta, old_rot, &moby->rot); *(int *)(data + 0xCC) = 0; *(int *)(data + 0xD0) = 0; offset[0] = fast_cos(heading) * -*(float *)(data + 0xBC); @@ -163,14 +163,14 @@ void FUN_L03_00292578(struct Moby *moby, float *pos, float heading) { car_off[2] = 0.0f; add_vector_xyz(car + 0x10, car_off, car_pos); *(float *)(car + 0x18) = moby->pos.z; - *(float *)(car + 0x48) = fast_add_rotations(FUN_001f9e90(car_pos[0] - *(float *)(car + 0x10), car_pos[1] - *(float *)(car + 0x14)), 0.0f); + *(float *)(car + 0x48) = fast_add_rotations(fast_arc_tan(car_pos[0] - *(float *)(car + 0x10), car_pos[1] - *(float *)(car + 0x14)), 0.0f); *(float *)(car + 0x44) = 0.0f; advance_moby_animation_alt(car); FUN_L00_00250df8(car); *(unsigned short *)(car + 0x34) |= 6; moby_point_position(car, 1, offset); subtract_vector_xyz(delta, car + 0x10, car_data + 0xA0); - FUN_L00_00260738(car_data + 0x20, delta, car_data + 0xB0, car + 0x40); + update_entity_matrix(car_data + 0x20, delta, car_data + 0xB0, car + 0x40); qcopy(car_data + 0xA0, car + 0x10); qcopy(car_data + 0xB0, car + 0x40); next_id = *(int *)(car_data + 0xC0); @@ -180,13 +180,13 @@ void FUN_L03_00292578(struct Moby *moby, float *pos, float heading) { } extern char *D_L03_0015FFD8_292890 __asm__("D_L03_0015FFD8"); extern char D_L03_001E2410[]; -extern float FUN_001f9af0(void *); -extern float FUN_001f9b80(void *, void *); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float spring_turn(float *vel, float cur, float target, float k, float d, float max) __asm__("FUN_L00_00258110"); extern void debug_print(void *, int) __asm__("FUN_001e93b0"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void set_vector_length_xy(void *, void *, float) __asm__("FUN_001f9c48"); -extern void FUN_L01_002f5168(char *); +extern void gunship_follow_path(char *) __asm__("FUN_L01_002f5168"); extern void build_spherical_offset(void *, float, float, float) __asm__("FUN_00214db0"); extern void mark_moby_for_removal_292890(void *) __asm__("FUN_0020c828"); @@ -251,24 +251,24 @@ void FUN_L03_00292890(char *moby) { } id = next_id; target = coupling + 0x10; - d = data->fDC - FUN_001f9b80(moby + 0x10, target); + d = data->fDC - vector_distance(moby + 0x10, target); *(float *)(coupling_data + 0xFC) = d; if (d < 0.0f) { *(float *)(coupling_data + 0xFC) = 0.0f; } - FUN_L01_002f5168(coupling); + gunship_follow_path(coupling); build_spherical_offset(delta, data->fC8, fast_add_rotations(*(float *)(moby + 0x48), 3.1415927f), *(float *)(moby + 0x44)); fast_vec_normalize(delta, delta, data->fC8); add_vector_xyz(moby + 0x10, moby + 0x10, delta); - d = fast_add_rotations(FUN_001f9e90(*(float *)(coupling + 0x10) - *(float *)(moby + 0x10), + d = fast_add_rotations(fast_arc_tan(*(float *)(coupling + 0x10) - *(float *)(moby + 0x10), *(float *)(coupling + 0x14) - *(float *)(moby + 0x14)), 3.1415927f); *(float *)(moby + 0x48) = spring_turn(&data->fCC, *(float *)(moby + 0x48), d, (data->fC8 * 60.0f / data->fC0) * 0.25f * DEG_TO_RAD * frame_time_sq, (data->fC8 * 60.0f / data->fC0) * 0.5f * DEG_TO_RAD * frame_time_sq, (data->fC8 * 60.0f / data->fC0) * frame_time); - d = FUN_001f9e90(FUN_001f9b80(moby + 0x10, target), *(float *)(coupling + 0x18) - *(float *)(moby + 0x18)); + d = fast_arc_tan(vector_distance(moby + 0x10, target), *(float *)(coupling + 0x18) - *(float *)(moby + 0x18)); *(float *)(moby + 0x44) = spring_turn(&data->fD0, *(float *)(moby + 0x44), d, (data->fC8 * 60.0f / data->fC0) * 0.25f * DEG_TO_RAD * frame_time_sq, (data->fC8 * 60.0f / data->fC0) * 0.5f * DEG_TO_RAD * frame_time_sq, @@ -284,24 +284,24 @@ void FUN_L03_00292890(char *moby) { add_vector_xyz(hitch, hitch, front); hitch[2] = front[2]; subtract_vector_xyz(dir, hitch, car + 0x10); - fast_vec_normalize(dir, dir, FUN_001f9af0(dir) - car_data->fC4); + fast_vec_normalize(dir, dir, fast_vec_length(dir) - car_data->fC4); add_vector_xyz(car + 0x10, dir, car + 0x10); *(float *)(car + 0x48) = fast_add_rotations( - FUN_001f9e90(hitch[0] - *(float *)(car + 0x10), hitch[1] - *(float *)(car + 0x14)), 0.0f); + fast_arc_tan(hitch[0] - *(float *)(car + 0x10), hitch[1] - *(float *)(car + 0x14)), 0.0f); *(float *)(car + 0x44) = - -FUN_001f9e90(FUN_001f9b80(car + 0x10, front), front[2] - *(float *)(car + 0x18)); + -fast_arc_tan(vector_distance(car + 0x10, front), front[2] - *(float *)(car + 0x18)); advance_moby_animation_alt(car); FUN_L00_00250df8(car); *(unsigned short *)(car + 0x34) |= 6; moby_point_position(car, 1, front); subtract_vector_xyz(delta, car + 0x10, car_data->prev_pos); - FUN_L00_00260738(car_data->motion, delta, car_data->prev_rot, car + 0x40); + update_entity_matrix(car_data->motion, delta, car_data->prev_rot, car + 0x40); qcopy(car_data->prev_pos, car + 0x10); qcopy(car_data->prev_rot, car + 0x40); id = car_data->iC0; } while (id != -1); subtract_vector_xyz(delta, moby + 0x10, old_pos); - FUN_L00_00260738(data->motion, delta, old_rot, moby + 0x40); + update_entity_matrix(data->motion, delta, old_rot, moby + 0x40); } else { debug_print(D_L03_001E2410, data->iB8); mark_moby_for_removal_292890(moby); @@ -346,13 +346,13 @@ void FUN_L03_00292d10(struct Moby *moby) { car_data = *(char **)(car + 0x78); car[0x72] = 0x40; subtract_vector_xyz(delta, car + 0x10, car_data + 0xA0); - FUN_L00_00260738(car_data + 0x20, delta, car_data + 0xB0, car + 0x40); + update_entity_matrix(car_data + 0x20, delta, car_data + 0xB0, car + 0x40); qcopy(car_data + 0xA0, car + 0x10); qcopy(car_data + 0xB0, car + 0x40); id = *(int *)(car_data + 0xC0); } while (id != -1); subtract_vector_xyz(dp, &moby->pos, old_pos); - FUN_L00_00260738(motion, dp, old_rot, &moby->rot); + update_entity_matrix(motion, dp, old_rot, &moby->rot); } else { debug_print(D_L03_001E2410, *(int *)(data + 0xB8)); mark_moby_for_removal(moby); @@ -436,19 +436,19 @@ extern Slot292e98 *D_L03_001600EC_292e98 __asm__("D_L03_001600EC"); extern int D_L03_0015FDFC; extern char D_L03_001E2448[]; extern char D_L03_001E2478[]; -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); -extern int FUN_001f9740(void *); -extern int FUN_L00_0028d8c0(void *, int); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); +extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L00_0025df68(void *, void *, void *, int *, float *, int, float, float, float); extern int FUN_L01_00277fb8(char *); extern int FUN_L03_002c6c60(char *); extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); extern void fade_to_black(int) __asm__("FUN_001f4a58"); extern void FUN_L00_00266858(void *, int); -extern void FUN_L01_0027a248(int, int); -extern void FUN_L01_002f5168(char *); +extern void jet_game_state(int, int) __asm__("FUN_L01_0027a248"); +extern void gunship_follow_path(char *) __asm__("FUN_L01_002f5168"); extern void FUN_L03_002c6c90(char *); extern void clear_vector(void *) __asm__("FUN_001f99f8"); extern void debug_printf_292e98(char *, ...) __asm__("FUN_001e93b0"); @@ -458,26 +458,26 @@ void FUN_L03_00292890(char *moby); /* Heading of a path's first segment. */ #define PATH_HEADING(p) \ - FUN_001f9e90(*(float *)((p) + 0x20) - *(float *)((p) + 0x10), *(float *)((p) + 0x24) - *(float *)((p) + 0x14)) + fast_arc_tan(*(float *)((p) + 0x20) - *(float *)((p) + 0x10), *(float *)((p) + 0x24) - *(float *)((p) + 0x14)) /* Points a turret moby's data (yaw 0x18, pitch 0x14) at the hero, seen from the level camera. */ #define AIM_AT_HERO(t) \ { \ - (t)->f18 = FUN_001f9e90(hero.motion.pos.f[0] - D_L03_00166D80_292e98.pos[0], \ + (t)->f18 = fast_arc_tan(hero.motion.pos.f[0] - D_L03_00166D80_292e98.pos[0], \ hero.motion.pos.f[1] - D_L03_00166D80_292e98.pos[1]); \ - (t)->f14 = -FUN_001f9e90(FUN_001f9b80(D_L03_00166D80_292e98.pos, hero.motion.pos.f), \ + (t)->f14 = -fast_arc_tan(vector_distance(D_L03_00166D80_292e98.pos, hero.motion.pos.f), \ hero.motion.pos.f[2] - D_L03_00166D80_292e98.pos[2]); \ } /* Keeps the engine loop sound playing and restarts the horn at random intervals. */ #define ENGINE_SOUND() \ { \ - if (!FUN_L00_0028d8c0(moby, data->i108)) { \ + if (!voice_is_playing(moby, data->i108)) { \ data->i108 = allocate_voice_for_target_entry(1, 4, (int)moby); \ } \ - if (FUN_001f9740(&data->i104)) { \ + if (fast_dec_timer(&data->i104)) { \ allocate_voice_for_target_entry(0, 0, (int)moby); \ - data->i104 = random_int_between(FUN_001f96f8(900), FUN_001f96f8(400)); \ + data->i104 = random_int_between(scale_game_frames(900), scale_game_frames(400)); \ } \ } @@ -497,7 +497,8 @@ extern char D_0013E550_292e98[] __asm__("D_0013E550"); /* Kerwan train engine: waits for the hero to board (clip volume 0xB4), then runs the ride: accelerates * along its path pulling the cars, keeps the turret cars aimed at the hero, throws him off if he falls * behind, switches to the second path when the cars are done and brakes at its end (state 6 resets). */ -void FUN_L03_00292e98(char *moby) { +void metropolis_train_locomotive_update(char *moby) __asm__("FUN_L03_00292e98"); +void metropolis_train_locomotive_update(char *moby) { float start[4]; int seg; float frac; @@ -541,7 +542,7 @@ void FUN_L03_00292e98(char *moby) { data->b28 = 4; data->s3E = 0xD; moby_point_position(moby, 0, start); - data->fBC = FUN_001f9b80(start, moby + 0x10); + data->fBC = vector_distance(start, moby + 0x10); data->fDC = 20.0f; data->fC8 = data->fC0 = data->fC0 * frame_time; if (data->iAC != -1) { @@ -572,7 +573,7 @@ void FUN_L03_00292e98(char *moby) { FUN_L03_00292578(moby, start, 0.0f); cdata->i74 = data->iA4; cdata->fFC = data->fC0; - FUN_L01_002f5168(coupling); + gunship_follow_path(coupling); moby[0xBC] = 2; break; case 2: @@ -596,13 +597,13 @@ void FUN_L03_00292e98(char *moby) { if (mode < 2 || mode == 9 || mode == 12) { moby[0xBC] = 4; D_L03_0015FDFC = 1; - FUN_L01_0027a248(4, 7); + jet_game_state(4, 7); FUN_L00_00266858(moby, 1); ((char *)&D_L03_0015FFD8_m292[data->i100])[0xBC] = 1; td = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[data->i100] + 0x78); AIM_AT_HERO(td); - td->i2C = FUN_001f96f8(860); - data->i104 = FUN_001f96f8(30); + td->i2C = scale_game_frames(860); + data->i104 = scale_game_frames(30); data->i108 = -1; } break; @@ -617,10 +618,10 @@ void FUN_L03_00292e98(char *moby) { if (hero.air_frames.s != 0 && hero.state.control_mode != 3) { FUN_L00_0025df68(cdata->path, hero.motion.pos.f, start, &seg, &frac, 0, 999.0f, 5.0f, 0.0f); data->i10C += 1; - if (FUN_001f96f8(60) < data->i10C && hero.motion.pos.f[2] < start[2] - 10.0f) { + if (scale_game_frames(60) < data->i10C && hero.motion.pos.f[2] < start[2] - 10.0f) { RELEASE_VOICE(data->i108); data->i108 = -1; - fade_to_black(FUN_001f96f8(16)); + fade_to_black(scale_game_frames(16)); hero.unk20B1 = 1; break; } @@ -662,22 +663,22 @@ void FUN_L03_00292e98(char *moby) { ((char *)&D_L03_0015FFD8_m292[data->iD8])[0xBC] = 1; tdb = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[data->iD8] + 0x78); path = D_L03_001B05B0_292e98[data->iAC]; - tdb->f18 = FUN_001f9e90(*(float *)(path + 0x10) - D_L03_00166D80_292e98.pos[0], + tdb->f18 = fast_arc_tan(*(float *)(path + 0x10) - D_L03_00166D80_292e98.pos[0], *(float *)(path + 0x14) - D_L03_00166D80_292e98.pos[1]); tdb->f14 = - -FUN_001f9e90(FUN_001f9b80(D_L03_00166D80_292e98.pos, D_L03_001B05B0_292e98[data->iAC] + 0x10), + -fast_arc_tan(vector_distance(D_L03_00166D80_292e98.pos, D_L03_001B05B0_292e98[data->iAC] + 0x10), *(float *)(D_L03_001B05B0_292e98[data->iAC] + 0x18) - D_L03_00166D80_292e98.pos[2]); D_L03_001600EC_292e98[tdb->i28].pos[0] = - FUN_001f9dc8(PATH_HEADING(D_L03_001B05B0_292e98[data->iAC])) * -(data->fDC + 4.0f); + fast_cos(PATH_HEADING(D_L03_001B05B0_292e98[data->iAC])) * -(data->fDC + 4.0f); D_L03_001600EC_292e98[tdb->i28].pos[1] = - FUN_001f9de0(PATH_HEADING(D_L03_001B05B0_292e98[data->iAC])) * -(data->fDC + 4.0f); + fast_sin(PATH_HEADING(D_L03_001B05B0_292e98[data->iAC])) * -(data->fDC + 4.0f); D_L03_001600EC_292e98[tdb->i28].pos[2] = 0.0f; add_vector_xyz(D_L03_001600EC_292e98[tdb->i28].pos, D_L03_001600EC_292e98[tdb->i28].pos, D_L03_001B05B0_292e98[data->iAC] + 0x10); D_L03_001600EC_292e98[tdb->i28].pos[2] += 2.7f; clear_vector(D_L03_001600EC_292e98[tdb->i28].v70); D_L03_001600EC_292e98[tdb->i28].v70[2] = PATH_HEADING(D_L03_001B05B0_292e98[data->iAC]); - tdb->i2C = FUN_001f96f8(10000); + tdb->i2C = scale_game_frames(10000); *(OvlQuad *)start = *(OvlQuad *)(D_L03_001B05B0_292e98[data->iAC] + 0x10); FUN_L03_00292578(moby, start, PATH_HEADING(D_L03_001B05B0_292e98[data->iAC])); cdata->i74 = data->iAC; @@ -685,9 +686,9 @@ void FUN_L03_00292e98(char *moby) { cdata->fF0 = 1.0f; data->fC0 = 2.0f * data->fC0; cdata->fFC = data->fC0; - FUN_L01_002f5168(coupling); + gunship_follow_path(coupling); moby[0xBC] = 5; - FUN_L01_0027a248(0, 8); + jet_game_state(0, 8); break; case 5: td = *(Turret292e98 **)((char *)&D_L03_0015FFD8_m292[data->iD8] + 0x78); @@ -736,9 +737,9 @@ extern char *D_L03_001B05B0_294c08[] __asm__("D_L03_001B05B0"); extern char D_0013E550_294c08[] __asm__("D_0013E550"); extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); extern float approach_value(float *p, float target, float maxstep) __asm__("FUN_00213ed8"); -extern int FUN_001f9740(void *); -extern int FUN_L00_0028d8c0(void *, int); -extern int FUN_L00_0028dc90(int, int, int, int); +extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); +extern int trooper_play_sound(int, int, int, int) __asm__("FUN_L00_0028dc90"); extern void noop_main_callback(void *) __asm__("FUN_001e93e8"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void FUN_L00_0025f730(void *, float); @@ -747,7 +748,8 @@ extern void scale_vector_xyz(void *out, void *a, float s) __asm__("FUN_001f9a68" /* Path platform update: waits, then glides along its path one way and back (ease in/out over 240 frames), * or steps node to node towards the path end, pausing between runs and playing its loop sound. */ -void FUN_L03_00294c08(char *moby) { +void moving_platform_small_update(char *moby) __asm__("FUN_L03_00294c08"); +void moving_platform_small_update(char *moby) { float delta[4]; float old_rot[4]; float step[4]; @@ -795,11 +797,11 @@ void FUN_L03_00294c08(char *moby) { *(int *)pa = pa[4] < 0 ? 0 : **(int **)(pa + 0x10) - 1; *(float *)(moby + 0x2C) = *(float *)(*(char **)(moby + 0x24) + 0x24) * *(float *)(data + 0xFC); *(int *)(data + 0x104) = -1; - if (FUN_001f9740(data + 0x100)) { + if (fast_dec_timer(data + 0x100)) { *(float *)(data + 0x110) = FUN_001f9b48(*(char **)(pa + 0x10) + 0x10, *(char **)(pa + 0x10) + **(int **)(pa + 0x10) * 0x10); - t = FUN_001f96f8(240); - *(float *)(data + 0x114) = *(float *)(data + 0x110) * 4.0f / convert_integer_to_float(t * FUN_001f96f8(240)); + t = scale_game_frames(240); + *(float *)(data + 0x114) = *(float *)(data + 0x110) * 4.0f / convert_integer_to_float(t * scale_game_frames(240)); *(int *)(data + 0x10C) = 0; moby[0x20] = 1; } @@ -809,13 +811,13 @@ void FUN_L03_00294c08(char *moby) { speed = *(float *)(data + 0x114); base = 0.0f; if ((*(short *)(moby + 0xA6) == 0x389 || *(short *)(moby + 0xA6) == 0x364) && - !FUN_L00_0028d8c0(moby, *(int *)(data + 0x104))) { - *(int *)(data + 0x104) = FUN_L00_0028dc90(0, 4, (int)moby, 0x389); + !voice_is_playing(moby, *(int *)(data + 0x104))) { + *(int *)(data + 0x104) = trooper_play_sound(0, 4, (int)moby, 0x389); } t = ++*(int *)(data + 0x10C); - if (FUN_001f96f8(240) / 2 < *(int *)(data + 0x10C)) { + if (scale_game_frames(240) / 2 < *(int *)(data + 0x10C)) { speed = -speed; - t = FUN_001f96f8(240) - *(int *)(data + 0x10C); + t = scale_game_frames(240) - *(int *)(data + 0x10C); base = *(float *)(data + 0x110); } base += speed * 0.5f * convert_integer_to_float(t * t); @@ -827,7 +829,7 @@ void FUN_L03_00294c08(char *moby) { fast_vec_normalize(step, step, base); add_vector_xyz(tmp, *(char **)(pb + 0x10) + 0x10, step); *(OvlQuad *)(moby + 0x10) = *(OvlQuad *)tmp; - if (*(int *)(data + 0x10C) >= FUN_001f96f8(240)) { + if (*(int *)(data + 0x10C) >= scale_game_frames(240)) { pb[4] = pb[4] * -1; idx = *(int *)(data + 0x104); if (idx != -1) { @@ -838,11 +840,11 @@ void FUN_L03_00294c08(char *moby) { } *(int *)(data + 0x104) = -1; moby[0x20] = 2; - *(int *)(data + 0xE8) = FUN_001f96f8(*(int *)(data + 0xF0)); + *(int *)(data + 0xE8) = scale_game_frames(*(int *)(data + 0xF0)); } break; case 2: - if (FUN_001f9740(data + 0xE8)) { + if (fast_dec_timer(data + 0xE8)) { *(int *)(data + 0x10C) = 0; moby[0x20] = 1; } @@ -886,28 +888,29 @@ void FUN_L03_00294c08(char *moby) { } *(int *)(data + 0x104) = -1; moby[0x20] = 4; - *(int *)(data + 0xE8) = FUN_001f96f8(*(int *)(data + 0xF0)); + *(int *)(data + 0xE8) = scale_game_frames(*(int *)(data + 0xF0)); } } break; case 4: - if (FUN_001f9740(data + 0xE8)) { + if (fast_dec_timer(data + 0xE8)) { moby[0x20] = 3; } break; } add_vector_xyz(delta, delta, moby + 0x10); - FUN_L00_00260738(data + 0x60, delta, old_rot, moby + 0x40); + update_entity_matrix(data + 0x60, delta, old_rot, moby + 0x40); } #include "qcopy.h" /* Ported from rac1-decomp (src/overlays/l03_kerwan/vendor_00293720.c: func_L03_002965A0), where it is exact; names translated to the US level program. */ extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void FUN_L00_00260738(char *, void *, void *, void *); +extern void update_entity_matrix(char *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void subtract_vector_xyz(void *out, void *a, void *b) __asm__("FUN_001f9a28"); -void FUN_L03_002953f8(struct Moby *moby) { +void metropolis_train_carriage_update(struct Moby *moby) __asm__("FUN_L03_002953f8"); +void metropolis_train_carriage_update(struct Moby *moby) { float a[4]; float v[4]; char *data; @@ -934,7 +937,7 @@ void FUN_L03_002953f8(struct Moby *moby) { moby->update_dist = moby->draw_dist = 0xFF; } subtract_vector_xyz(a, p, d0); - FUN_L00_00260738(data + 0x20, a, d1, q); + update_entity_matrix(data + 0x20, a, d1, q); qcopy(d0, p); qcopy(d1, q); } @@ -942,7 +945,7 @@ void FUN_L03_002953f8(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/l03_kerwan/vendor_00293720.c: func_L03_0029DB88), where it is exact; names translated to the US level program. */ extern int D_L03_0015F5CC; /* no foreign declaration */ -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); void FUN_L03_0029c9d0(struct Moby *moby) { char *data = (char *)moby->pvars; @@ -955,7 +958,7 @@ void FUN_L03_0029c9d0(struct Moby *moby) { if (*(short *)(data + 0x14A) != 0) return; if (*(int *)(data + 0x150) >= 0) { - if (FUN_L00_0028d8c0(moby, *(int *)(data + 0x150)) != 0) + if (voice_is_playing(moby, *(int *)(data + 0x150)) != 0) return; } switch (moby->oclass) { @@ -972,7 +975,7 @@ void FUN_L03_0029c9d0(struct Moby *moby) { break; } } -extern float FUN_001f9af0(void *); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern float random_angle_radians(void) __asm__("FUN_00213308"); extern int FUN_L00_001fefc8(void *); extern void FUN_L00_0026ced0(void *, void *, int, int, int, float); @@ -1013,7 +1016,7 @@ void FUN_L03_0029caa8(char *moby, void *vel_in, int quiet) { b = random_angle_radians(); build_spherical_offset(v, frame_time * 0.15f, a, b); add_vector_xyz(v, v, vp); - FUN_L00_0026ced0(pos, v, 0x8040C0F0, 0x808080, FUN_001f96f8(20), 84000.0f); + FUN_L00_0026ced0(pos, v, 0x8040C0F0, 0x808080, scale_game_frames(20), 84000.0f); } } break; @@ -1022,7 +1025,7 @@ void FUN_L03_0029caa8(char *moby, void *vel_in, int quiet) { case 0x78: case 0x84: if (quiet == 0 && FUN_L00_001fefc8(data + 0x12E)) { - if (FUN_001f9af0(vp) < frame_time * 40.0f && FUN_001f9b48(moby + 0x10, D_L03_00166EC0) < 75.0f) { + if (fast_vec_length(vp) < frame_time * 40.0f && FUN_001f9b48(moby + 0x10, D_L03_00166EC0) < 75.0f) { scale_vector_xyz(vp, vp, 0.7f); for (j = 0; j < 10; j++) { moby_point_position(moby, 0, pos); @@ -1030,15 +1033,15 @@ void FUN_L03_0029caa8(char *moby, void *vel_in, int quiet) { b = random_angle_radians(); build_spherical_offset(v, frame_time * 0.6f, a, b); add_vector_xyz(v, v, vp); - FUN_L00_0026ced0(pos, v, 0x80808080, 0x808080, FUN_001f96f8(35), 105000.0f); + FUN_L00_0026ced0(pos, v, 0x80808080, 0x808080, scale_game_frames(35), 105000.0f); } } - data[0x12E] = random_int_between(FUN_001f96f8(7), FUN_001f96f8(20)); + data[0x12E] = random_int_between(scale_game_frames(7), scale_game_frames(20)); } break; case 0x76: if (quiet == 0 && FUN_L00_001fefc8(data + 0x12E)) { - if (FUN_001f9af0(vp) < frame_time * 40.0f && FUN_001f9b48(moby + 0x10, D_L03_00166EC0) < 90.0f) { + if (fast_vec_length(vp) < frame_time * 40.0f && FUN_001f9b48(moby + 0x10, D_L03_00166EC0) < 90.0f) { scale_vector_xyz(vp, vp, 0.5f); for (k = 0; k < 15; k++) { moby_point_position(moby, 0, pos); @@ -1046,10 +1049,10 @@ void FUN_L03_0029caa8(char *moby, void *vel_in, int quiet) { b = random_angle_radians(); build_spherical_offset(v, frame_time * 1.2f, a, b); add_vector_xyz(v, v, vp); - FUN_L00_0026ced0(pos, v, 0x80808080, 0x808080, FUN_001f96f8(45), 168000.0f); + FUN_L00_0026ced0(pos, v, 0x80808080, 0x808080, scale_game_frames(45), 168000.0f); } } - data[0x12E] = random_int_between(FUN_001f96f8(7), FUN_001f96f8(20)); + data[0x12E] = random_int_between(scale_game_frames(7), scale_game_frames(20)); } break; case 0x4B: @@ -1065,17 +1068,17 @@ void FUN_L03_0029caa8(char *moby, void *vel_in, int quiet) { if (((unsigned char *)data)[0x12E] != 0) { break; } - if (FUN_001f9af0(vp) < frame_time * 40.0f && FUN_001f9b48(moby + 0x10, D_L03_00166EC0) < 90.0f) { + if (fast_vec_length(vp) < frame_time * 40.0f && FUN_001f9b48(moby + 0x10, D_L03_00166EC0) < 90.0f) { color = 0xA040; color2 = 0xA080; if (*(short *)(moby + 0xA6) == 0x4B) { color = 0x30A0; color2 = 0x90A0; } - FUN_L03_002bad40((struct Moby *)moby, (int)(data + 0xF0), color, color2, FUN_001f96f8(50), frame_time * 2.5f, 0.15f); - ((unsigned char *)data)[0x12F] = FUN_001f96f8(50); + FUN_L03_002bad40((struct Moby *)moby, (int)(data + 0xF0), color, color2, scale_game_frames(50), frame_time * 2.5f, 0.15f); + ((unsigned char *)data)[0x12F] = scale_game_frames(50); } - data[0x12E] = FUN_001f96f8(13); + data[0x12E] = scale_game_frames(13); break; } } @@ -1084,9 +1087,9 @@ void FUN_L03_0029caa8(char *moby, void *vel_in, int quiet) { extern f32 fast_add_rotations(f32 a, f32 b) __asm__("FUN_001fa580"); extern f32 fast_subtract_rotations(f32, f32) __asm__("func_001FA5C8"); extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float spring_turn(float *vel, float cur, float target, float k, float d, float max) __asm__("FUN_L00_00258110"); -extern float FUN_L00_0025e310(float); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern void subtract_vector_xyz(void *out, void *a, void *b) __asm__("FUN_001f9a28"); void FUN_L03_0029cff0(struct Moby *m) { @@ -1095,22 +1098,22 @@ void FUN_L03_0029cff0(struct Moby *m) { float ang = (float)*(short *)(d + 0x132) * DEG_TO_RAD; float t, x, y, z, w; fast_subtract_rotations(m->rot.z, ang); - x = FUN_001f9e90(*(float *)(d + 0xD0) - *(float *)(d + 0xE0), + x = fast_arc_tan(*(float *)(d + 0xD0) - *(float *)(d + 0xE0), *(float *)(d + 0xD4) - *(float *)(d + 0xE4)); x = fast_add_rotations(x, ang); y = fast_subtract_rotations(x, m->rot.z); t = y * (1.0f / *(float *)(d + 0x120) * frame_scale); m->rot.z = fast_add_rotations(t, m->rot.z); subtract_vector_xyz(v, d + 0xD0, d + 0xE0); - z = FUN_001f9e90(vector_length_xy(v), v[2]); + z = fast_arc_tan(vector_length_xy(v), v[2]); m->rot.y = spring_turn((float *)(d + 0x11C), m->rot.y, -z, *(float *)(d + 0x118) * 10.0f * DEG_TO_RAD * frame_time_sq, *(float *)(d + 0x118) * 5.0f * DEG_TO_RAD * frame_time_sq, *(float *)(d + 0x118) * DEG_TO_RAD * frame_time); - w = FUN_L00_0025e310(t * *(float *)(d + 0x124)); + w = normalize_angle(t * *(float *)(d + 0x124)); w = fast_subtract_rotations(m->rot.x, w); - w = FUN_L00_0025e310(w * *(float *)(d + 0x128)); + w = normalize_angle(w * *(float *)(d + 0x128)); m->rot.x = spring_turn((float *)(d + 0x114), m->rot.x, w, *(float *)(d + 0x110) * 10.0f * DEG_TO_RAD * frame_time_sq, @@ -1122,22 +1125,22 @@ extern unsigned char D_0013D408_29d2e0[] __asm__("D_0013D408"); extern float D_L03_0015F580_macro[] __asm__("D_L03_0015F580")__attribute__((section(".sdata"))); extern void *D_L03_00160770; extern void *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern int allocate_voice_for_bank_entry(int, int, int) __asm__("FUN_0022db10"); extern void allocate_voice_for_group_entry(int, int, void *) __asm__("FUN_0022dba0"); extern void FUN_L00_00260a88(void *, int, int, int, int); extern void queue_dialogue_message(int, int) __asm__("FUN_L00_00263d40"); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, int, float, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void spawn_debris_29d2e0(char *, int, float *, void *, int, int, float, float *, float *, float *) __asm__("FUN_L00_00263fd8"); extern void clear_vector(void *) __asm__("FUN_001f99f8"); extern void release_voice_slot(int) __asm__("FUN_0022d798"); extern void scale_vector_xyz(void *out, void *a, float s) __asm__("FUN_001f9a68"); -void FUN_L03_0029dba8(char *moby); +void red_ship_1_update(char *moby) __asm__("FUN_L03_0029dba8"); #define SPAWN_DEBRIS(id) \ - spawn_debris_29d2e0(moby, (id), (float *)(moby + 0x10), moby + 0x40, FUN_001f96f8(90), 0, frame_time_sq * 12.0f, push, \ + spawn_debris_29d2e0(moby, (id), (float *)(moby + 0x10), moby + 0x40, scale_game_frames(90), 0, frame_time_sq * 12.0f, push, \ D_L03_0015F580_macro, D_L03_0015F580_macro) /* Wreck reaction for the Kerwan train and turret classes: when hit by a qualifying attack it bursts into @@ -1157,8 +1160,8 @@ void FUN_L03_0029d2e0(char *moby, void *vel_in, int flag) { if (hit != 0 && *(unsigned short *)(hit + 0x28) != 0x102) { clear_vector(spot); if (*(short *)(moby + 0xA6) == 0x4B) { - spot[0] = FUN_001f9dc8(*(float *)(moby + 0x48)) * -2.747f; - spot[1] = FUN_001f9de0(*(float *)(moby + 0x48)) * -2.747f; + spot[0] = fast_cos(*(float *)(moby + 0x48)) * -2.747f; + spot[1] = fast_sin(*(float *)(moby + 0x48)) * -2.747f; spot[2] = 0.0f; } *(OvlQuad *)vel = *(OvlQuad *)vel_in; @@ -1169,8 +1172,8 @@ void FUN_L03_0029d2e0(char *moby, void *vel_in, int flag) { } else { FUN_L00_00260a88(moby, 3, 5, 2, -1); } - *(short *)(data + 0x14A) = FUN_001f96f8(600); - FUN_L00_0025e450(moby, vel, spot, 0.0f, 0.0f, 20, 3, 4, 4.0f, 2.0f, 100000.0f, -1, 3.0f, 15.0f, 1, 1, + *(short *)(data + 0x14A) = scale_game_frames(600); + spawn_explosion(moby, vel, spot, 0.0f, 0.0f, 20, 3, 4, 4.0f, 2.0f, 100000.0f, -1, 3.0f, 15.0f, 1, 1, -1, 0); scale_vector_xyz(push, moby + 0xC0, frame_scale * 0.075f); push[2] += frame_scale * 0.08f; @@ -1218,10 +1221,10 @@ void FUN_L03_0029d2e0(char *moby, void *vel_in, int flag) { } allocate_voice_for_group_entry(0, 0, moby); } - D_L03_00160770 = (void *)FUN_L03_0029dba8; + D_L03_00160770 = (void *)red_ship_1_update; ((unsigned char *)moby)[0xA4] = 0xFF; if (*(short *)(data + 0x14A) != 0) { - if (FUN_001f9770(data + 0x14A) && flag) { + if (fast_dec_timer_s16(data + 0x14A) && flag) { *(int *)(moby + 0x94) = *(int *)(*(char **)(moby + 0x24) + 0x10); *(unsigned short *)(moby + 0x34) = (*(unsigned short *)(moby + 0x34) & 0xFFBE) | 0x1000; } else { @@ -1248,7 +1251,7 @@ extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); extern float add_rotations_29dba8(float, float) __asm__("FUN_001fa580"); extern float random_angle_radians(void) __asm__("FUN_00213308"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); -extern float FUN_001f9de0(float); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern int fast_bsphere_check(void *, float) __asm__("FUN_001fa728"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); extern int FUN_L00_002591d0(int *, int, int, int); @@ -1270,7 +1273,8 @@ extern void report_29dba8(void *, int, int) __asm__("FUN_001e93b0"); /* Train car update: keeps the cars of a group in step (stops them all when none can move), and on its * first frame snaps to the nearest path node and sets up the spline; then runs along the path spline, * steering, banking and spawning its hit/smoke effects; state 2 waits without a path, 3 waits a timer. */ -void FUN_L03_0029dba8(char *moby) { +void red_ship_1_update(char *moby) __asm__("FUN_L03_0029dba8"); +void red_ship_1_update(char *moby) { float zero[4]; float old_rot[4]; float old_pos[4]; @@ -1328,7 +1332,7 @@ void FUN_L03_0029dba8(char *moby) { while (item != 0) { d = *(char **)(item + 0x78); item[0x20] = 3; - *(short *)(d + 0x12C) = FUN_001f96f8(5); + *(short *)(d + 0x12C) = scale_game_frames(5); FUN_L00_002592b8((int *)&item, (int)item, 0, 0); } } @@ -1374,7 +1378,7 @@ void FUN_L03_0029dba8(char *moby) { } *(float *)(pm + 0xC) = FUN_001f9b48(pos0, *(char **)(pm + 0x10) + (*(int *)pm * 0x10 + 0x10)); p = *(char **)(pm + 0x10) + *(int *)pm * 0x10; - *(float *)(pm + 0x18) = FUN_001f9e90(*(float *)(p + 0x10) - *(float *)(moby + 0x10), + *(float *)(pm + 0x18) = fast_arc_tan(*(float *)(p + 0x10) - *(float *)(moby + 0x10), *(float *)(p + 0x14) - *(float *)(moby + 0x14)); pm[5] = 2; *(int *)(pm + 0x8) = 0; @@ -1387,8 +1391,8 @@ void FUN_L03_0029dba8(char *moby) { *(OvlQuad *)(data + 0xB0) = *(OvlQuad *)(data + 0xC0) = *(OvlQuad *)(*(char **)(pm + 0x10) + *(int *)pm * 0x10 + 0x10); *(float *)(moby + 0x40) = 0.0f; - *(float *)(moby + 0x44) = -FUN_001f9e90(vector_length_xy(cur0), *(float *)(data + 0xA8)); - *(float *)(moby + 0x48) = FUN_001f9e90(*(float *)(data + 0xA0) - zero[0], *(float *)(data + 0xA4) - zero[1]); + *(float *)(moby + 0x44) = -fast_arc_tan(vector_length_xy(cur0), *(float *)(data + 0xA8)); + *(float *)(moby + 0x48) = fast_arc_tan(*(float *)(data + 0xA0) - zero[0], *(float *)(data + 0xA4) - zero[1]); *(float *)(data + 0x114) = 0.0f; *(float *)(data + 0x11C) = 0.0f; *(OvlQuad *)(moby + 0x10) = *(OvlQuad *)(data + 0xE0); @@ -1423,7 +1427,7 @@ void FUN_L03_0029dba8(char *moby) { *(int *)(data + 0x150) = -1; break; case 3: - if (FUN_001f9770(data + 0x12C)) { + if (fast_dec_timer_s16(data + 0x12C)) { moby[0x20] = 1; } break; @@ -1439,7 +1443,7 @@ void FUN_L03_0029dba8(char *moby) { *(OvlQuad *)(data + 0xB0) = *(OvlQuad *)(data + 0xC0); *(OvlQuad *)(data + 0xC0) = *(OvlQuad *)(*(char **)(pm + 0x10) + FUN_L01_0028b828(pm, n + 1) * 0x10 + 0x10); } - step = (*(float *)(data + 0x10C) + *(float *)(data + 0x134) * FUN_001f9de0(*(float *)(data + 0x13C))) / + step = (*(float *)(data + 0x10C) + *(float *)(data + 0x134) * fast_sin(*(float *)(data + 0x13C))) / *(float *)(data + 0xBC); *(float *)(data + 0x13C) = add_rotations_29dba8(*(float *)(data + 0x13C), *(float *)(data + 0x138) * DEG_TO_RAD); *(OvlQuad *)(data + 0xE0) = *(OvlQuad *)(data + 0xD0); @@ -1448,7 +1452,7 @@ void FUN_L03_0029dba8(char *moby) { FUN_L03_0029cff0(moby); } else { clear_vector(moby + 0x40); - *(float *)(moby + 0x48) = FUN_001f9e90(*(float *)(data + 0xD0) - *(float *)(data + 0xE0), + *(float *)(moby + 0x48) = fast_arc_tan(*(float *)(data + 0xD0) - *(float *)(data + 0xE0), *(float *)(data + 0xD4) - *(float *)(data + 0xE4)); } cur = moby + 0x10; @@ -1567,33 +1571,33 @@ char D_L03_001618D0 = 3; extern char D_L03_00166EC0[]; extern float D_L03_0015F580_macro[] __asm__("D_L03_0015F580")__attribute__((section(".sdata"))); extern float absolute_float_c5bb8(float) __asm__("FUN_001f99c0"); -extern float FUN_001f96b0(float); -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float FUN_L04_001f1978(float); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float approach_value_c5bb8(float *p, float target, float maxstep) __asm__("FUN_00213ed8"); extern float compute_interpolated_record_value_c5bb8(void *) __asm__("FUN_0020c9e0"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); extern int FUN_001160d8(void); -extern int FUN_001f9740(void *); +extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); extern int FUN_L00_00258b50(void *, void *, void *, void *, float); extern int FUN_L00_00259028(char *m, char *p, char *pos, char *v); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int FUN_L00_0025df68(void *, void *, void *, int *, float *, int, float, float, float); extern int FUN_L00_002dc9f0(void *, void *); extern int FUN_L03_0024e830(char *, char *, float); extern int FUN_L03_002c6ca0(struct Moby *moby); -extern int FUN_L03_002c6d98(int id); +extern int is_point_inside_clip_volume_cf(int id) __asm__("FUN_L03_002c6d98"); extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); extern int random_integer_below(int) __asm__("FUN_00213260"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); extern void FUN_L00_00257470(void *, int, int); extern void FUN_L00_00258278(char *moby, float *vel, float target, float k, float d, float max); -extern void FUN_L00_00259bc8(void *, void *, int, void *, void *, float); +extern void spawn_nearby_effect(void *, void *, int, void *, void *, float) __asm__("FUN_L00_00259bc8"); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025d538(void *, void *); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L00_00263ac8_c5bb8(void *, int, void *, float) __asm__("FUN_L00_00263ac8"); extern void FUN_L00_00263e30(void *, int, int, int, int, int, int); extern void FUN_L01_0026d930(char *p, void *); @@ -1605,7 +1609,8 @@ extern void spawn_debris_c5bb8(char *, int, float *, void *, int, int, float, fl /* Kerwan enemy update: waits at home, walks its path or chases the target picked by FUN_L03_0024e830 * (its partner moby data->0x248 is a class 0x23E), attacks in range, returns home, dies (states 8, 9, 21). */ -void FUN_L03_002c5bb8(char *moby) { +void robot_dog_update(char *moby) __asm__("FUN_L03_002c5bb8"); +void robot_dog_update(char *moby) { Tgt2c5bb8 tgt; float dir[4]; float push[4]; @@ -1624,7 +1629,7 @@ void FUN_L03_002c5bb8(char *moby) { FUN_L03_0024e830(moby, (char *)&tgt, data->f230); FUN_L00_00263ac8_c5bb8(moby, 0, data->m280, 2.1f); FUN_L03_002c6a20((struct Moby *)moby); - FUN_001f9740(&data->i244); + fast_dec_timer(&data->i244); switch (((unsigned char *)moby)[0x20]) { case 0: *(unsigned short *)(moby + 0x34) |= 0x1000; @@ -1644,7 +1649,7 @@ void FUN_L03_002c5bb8(char *moby) { data->f1A4 = data->f234 * frame_time; data->i1B8 |= 0x20; data->f1A8 = 2.0954423f; - a = FUN_001f96b0(6.0f); + a = FUN_L04_001f1978(6.0f); data->f264 = 1.0f; data->i244 = 0; data->i26C = 0; @@ -1669,22 +1674,22 @@ void FUN_L03_002c5bb8(char *moby) { if (data->i270 != -1) { p = D_L03_001B05B0_c5bb8[data->i270]; *(OvlQuad *)(moby + 0x10) = *(OvlQuad *)(p + 0x10); - *(float *)(moby + 0x48) = FUN_001f9e90(*(float *)(p + 0x20) - *(float *)(p + 0x10), + *(float *)(moby + 0x48) = fast_arc_tan(*(float *)(p + 0x20) - *(float *)(p + 0x10), *(float *)(p + 0x24) - *(float *)(p + 0x14)); - if ((random_integer_below(14) == 0 && FUN_L03_002c6d98(((unsigned char *)moby)[0x21])) || + if ((random_integer_below(14) == 0 && is_point_inside_clip_volume_cf(((unsigned char *)moby)[0x21])) || is_point_inside_clip_volume(&tgt, data->i27C) || (FUN_001f9b48(&tgt, moby + 0x10) < data->f274 && absolute_float_c5bb8(tgt.pos[2] - *(float *)(moby + 0x18)) < 4.0f)) { data->i278 = 0; moby[0x20] = 5; if (((unsigned char *)moby)[0x53] != 3) { - blend_moby_animation_c5bb8(moby, 3, 0, FUN_001f96f8(10)); + blend_moby_animation_c5bb8(moby, 3, 0, scale_game_frames(10)); } } } else if (random_integer_below(14) == 0 && FUN_001f9b48(&tgt, data->home) < data->f230 && absolute_float_c5bb8(tgt.pos[2] - *(float *)(moby + 0x18)) < 3.0f) { moby[0x20] = 3; if (((unsigned char *)moby)[0x53] != 2) { - blend_moby_animation_c5bb8(moby, 2, 0, FUN_001f96f8(10)); + blend_moby_animation_c5bb8(moby, 2, 0, scale_game_frames(10)); } *(float *)(moby + 0x58) = 0.8780488f; } @@ -1694,41 +1699,41 @@ void FUN_L03_002c5bb8(char *moby) { idx = data->i248; if (idx == -1 || (m = D_L03_0015FFD8_c5bb8 + (idx << 8)) == 0 || ((unsigned char *)m)[0x20] == 0xFE || ((unsigned char *)m)[0x20] == 0xFD || FUN_L03_002c6ca0((struct Moby *)m)) { - data->i23C = FUN_001f96f8((int)random_float_between(30.0f, 90.0f)); + data->i23C = scale_game_frames((int)random_float_between(30.0f, 90.0f)); moby[0x20] = 4; if (((unsigned char *)moby)[0x53] != 3) { - blend_moby_animation_c5bb8(moby, 3, 0, FUN_001f96f8(10)); + blend_moby_animation_c5bb8(moby, 3, 0, scale_game_frames(10)); } } } break; case 3: - a = FUN_001f9e90(tgt.pos[0] - *(float *)(moby + 0x10), tgt.pos[1] - *(float *)(moby + 0x14)); + a = fast_arc_tan(tgt.pos[0] - *(float *)(moby + 0x10), tgt.pos[1] - *(float *)(moby + 0x14)); FUN_L00_00258278(moby, data->v220, a, 0.02f, 0.3f, 0.1f); if (((unsigned char *)moby)[0x70] & 2) { - data->i23C = FUN_001f96f8((int)random_float_between(30.0f, 90.0f)); + data->i23C = scale_game_frames((int)random_float_between(30.0f, 90.0f)); moby[0x20] = 4; if (((unsigned char *)moby)[0x53] != 3) { - blend_moby_animation_c5bb8(moby, 3, 0, FUN_001f96f8(10)); + blend_moby_animation_c5bb8(moby, 3, 0, scale_game_frames(10)); } } break; case 4: - a = FUN_001f9e90(tgt.pos[0] - *(float *)(moby + 0x10), tgt.pos[1] - *(float *)(moby + 0x14)); + a = fast_arc_tan(tgt.pos[0] - *(float *)(moby + 0x10), tgt.pos[1] - *(float *)(moby + 0x14)); FUN_L00_00258278(moby, data->v220, a, 0.05f, 0.3f, 0.2f); - dir[0] = 2.0f * FUN_001f9dc8(*(float *)(moby + 0x48)); - dir[1] = 2.0f * FUN_001f9de0(*(float *)(moby + 0x48)); + dir[0] = 2.0f * fast_cos(*(float *)(moby + 0x48)); + dir[1] = 2.0f * fast_sin(*(float *)(moby + 0x48)); dir[2] = 0.0f; FUN_L00_00258b50(moby, &data->i180, dir, push, 1.0f); - if (FUN_001f9740(&data->i23C)) { - data->i23C = FUN_001f96f8((int)random_float_between(30.0f, 90.0f)); + if (fast_dec_timer(&data->i23C)) { + data->i23C = scale_game_frames((int)random_float_between(30.0f, 90.0f)); } - d = FUN_001f9b80(moby + 0x10, &tgt); - if (d < data->f234 * frame_time * 0.5f * FUN_001f96b0(40.0f) + - data->f234 * frame_time * FUN_001f96b0(10.0f) + 1.5f) { + d = vector_distance(moby + 0x10, &tgt); + if (d < data->f234 * frame_time * 0.5f * FUN_L04_001f1978(40.0f) + + data->f234 * frame_time * FUN_L04_001f1978(10.0f) + 1.5f) { moby[0x20] = 6; if (((unsigned char *)moby)[0x53] != 5) { - blend_moby_animation_c5bb8(moby, 5, 0, truncate_float_to_s32(FUN_001f96b0(10.0f))); + blend_moby_animation_c5bb8(moby, 5, 0, truncate_float_to_s32(FUN_L04_001f1978(10.0f))); } } else if (data->f230 < FUN_001f9b48(&tgt, data->home) || absolute_float_c5bb8(tgt.pos[2] - *(float *)(moby + 0x18)) > 3.0f) { @@ -1748,11 +1753,11 @@ void FUN_L03_002c5bb8(char *moby) { data->i270 = -1; moby[0x20] = 1; if (((unsigned char *)moby)[0x53] != 1) { - blend_moby_animation_c5bb8(moby, 1, 0, FUN_001f96f8(10)); + blend_moby_animation_c5bb8(moby, 1, 0, scale_game_frames(10)); } if (data->i248 != -1) { if (((unsigned char *)moby)[0x53] != 0) { - blend_moby_animation_c5bb8(moby, 0, 0, FUN_001f96f8(10)); + blend_moby_animation_c5bb8(moby, 0, 0, scale_game_frames(10)); } moby[0x20] = 2; } @@ -1763,73 +1768,73 @@ void FUN_L03_002c5bb8(char *moby) { if (idx == -1 || (m = D_L03_0015FFD8_c5bb8 + (idx << 8)) == 0 || ((unsigned char *)m)[0x20] == 0xFE || ((unsigned char *)m)[0x20] == 0xFD || FUN_L03_002c6ca0((struct Moby *)m)) { data->i270 = -1; - data->i23C = FUN_001f96f8((int)random_float_between(30.0f, 90.0f)); + data->i23C = scale_game_frames((int)random_float_between(30.0f, 90.0f)); moby[0x20] = 4; if (((unsigned char *)moby)[0x53] != 3) { - blend_moby_animation_c5bb8(moby, 3, 0, FUN_001f96f8(10)); + blend_moby_animation_c5bb8(moby, 3, 0, scale_game_frames(10)); } } } break; case 6: - a = FUN_001f9e90(tgt.pos[0] - *(float *)(moby + 0x10), tgt.pos[1] - *(float *)(moby + 0x14)); + a = fast_arc_tan(tgt.pos[0] - *(float *)(moby + 0x10), tgt.pos[1] - *(float *)(moby + 0x14)); FUN_L00_00258278(moby, data->v220, a, 0.05f, 0.3f, 0.2f); - dir[0] = 2.0f * FUN_001f9dc8(*(float *)(moby + 0x48)); - dir[1] = 2.0f * FUN_001f9de0(*(float *)(moby + 0x48)); + dir[0] = 2.0f * fast_cos(*(float *)(moby + 0x48)); + dir[1] = 2.0f * fast_sin(*(float *)(moby + 0x48)); dir[2] = 0.0f; FUN_L00_00258b50(moby, &data->i180, dir, data->v40, 1.0f); if (((unsigned char *)moby)[0x52] == 5) { - approach_value_c5bb8(&data->f1A4, 0.0f, data->f234 * frame_time / FUN_001f96b0(40.0f)); + approach_value_c5bb8(&data->f1A4, 0.0f, data->f234 * frame_time / FUN_L04_001f1978(40.0f)); } if (absolute_float_c5bb8(compute_interpolated_record_value_c5bb8(moby) - 25.0f) <= 0.25f && absolute_float_c5bb8(tgt.pos[2] - *(float *)(moby + 0x18)) < 1.0f && fast_difference_between_rotations( - FUN_001f9e90(tgt.pos[0] - *(float *)(moby + 0x10), tgt.pos[1] - *(float *)(moby + 0x14)), + fast_arc_tan(tgt.pos[0] - *(float *)(moby + 0x10), tgt.pos[1] - *(float *)(moby + 0x14)), *(float *)(moby + 0x48)) < 0.2617994f && - tgt.obj != 0 && FUN_001f9b80(moby + 0x10, &tgt) < 2.0f) { - push[0] = FUN_001f9dc8(*(float *)(moby + 0x48)) * 0.2f; - push[1] = FUN_001f9de0(*(float *)(moby + 0x48)) * 0.2f; + tgt.obj != 0 && vector_distance(moby + 0x10, &tgt) < 2.0f) { + push[0] = fast_cos(*(float *)(moby + 0x48)) * 0.2f; + push[1] = fast_sin(*(float *)(moby + 0x48)) * 0.2f; push[2] = 0.0f; qcopy(at, &tgt); at[2] += 0.75f; - FUN_L00_00259bc8(tgt.obj, moby, 1, at, push, 1.0f); + spawn_nearby_effect(tgt.obj, moby, 1, at, push, 1.0f); } else if (((unsigned char *)moby)[0x70] & 2) { data->f1A4 = data->f234 * frame_time; moby[0x20] = 7; if (((unsigned char *)moby)[0x53] != 3) { - blend_moby_animation_c5bb8(moby, 3, 0, FUN_001f96f8(3)); + blend_moby_animation_c5bb8(moby, 3, 0, scale_game_frames(3)); } - data->i244 = FUN_001f96f8(120); + data->i244 = scale_game_frames(120); } break; case 7: - a = FUN_001f9e90(data->home[0] - *(float *)(moby + 0x10), data->home[1] - *(float *)(moby + 0x14)); + a = fast_arc_tan(data->home[0] - *(float *)(moby + 0x10), data->home[1] - *(float *)(moby + 0x14)); FUN_L00_00258278(moby, data->v220, a, 0.02f, 0.3f, 0.1f); - dir[0] = 2.0f * FUN_001f9dc8(*(float *)(moby + 0x48)); - dir[1] = 2.0f * FUN_001f9de0(*(float *)(moby + 0x48)); + dir[0] = 2.0f * fast_cos(*(float *)(moby + 0x48)); + dir[1] = 2.0f * fast_sin(*(float *)(moby + 0x48)); dir[2] = 0.0f; FUN_L00_00258b50(moby, &data->i180, dir, push, 1.0f); - if (FUN_001f9b80(moby + 0x10, data->home) < 1.0f) { + if (vector_distance(moby + 0x10, data->home) < 1.0f) { moby[0x20] = 1; if (((unsigned char *)moby)[0x53] != 1) { - blend_moby_animation_c5bb8(moby, 1, 0, FUN_001f96f8(3)); + blend_moby_animation_c5bb8(moby, 1, 0, scale_game_frames(3)); } } else if (data->i244 == 0) { - d = FUN_001f9b80(moby + 0x10, &tgt); - if (d < data->f234 * frame_time * 0.5f * FUN_001f96b0(40.0f) + - data->f234 * frame_time * FUN_001f96b0(10.0f) + 1.5f) { + d = vector_distance(moby + 0x10, &tgt); + if (d < data->f234 * frame_time * 0.5f * FUN_L04_001f1978(40.0f) + + data->f234 * frame_time * FUN_L04_001f1978(10.0f) + 1.5f) { moby[0x20] = 6; if (((unsigned char *)moby)[0x53] != 5) { - blend_moby_animation_c5bb8(moby, 5, 0, truncate_float_to_s32(FUN_001f96b0(10.0f))); + blend_moby_animation_c5bb8(moby, 5, 0, truncate_float_to_s32(FUN_L04_001f1978(10.0f))); } } } break; case 8: - if (FUN_L00_0025c698(moby, data->m120) & 0x60) { + if (mine_fall(moby, data->m120) & 0x60) { moby[0x20] = 4; if (((unsigned char *)moby)[0x53] != 3) { - blend_moby_animation_c5bb8(moby, 3, 0, FUN_001f96f8(10)); + blend_moby_animation_c5bb8(moby, 3, 0, scale_game_frames(10)); } break; } @@ -1842,9 +1847,9 @@ void FUN_L03_002c5bb8(char *moby) { break; case 21: *(unsigned short *)(moby + 0x34) &= 0xEFFF; - if (FUN_L00_0025c698(moby, data->m120) & 0x60) { + if (mine_fall(moby, data->m120) & 0x60) { clear_vector(dir); - FUN_L00_0025f090(moby, moby + 0x10, -1, 0.5f, 13.0f); + cart_burst(moby, moby + 0x10, -1, 0.5f, 13.0f); spawn_debris_c5bb8(moby, 0x6CE, (float *)(moby + 0x10), moby + 0x40, 0, 0, 0.0f, D_L03_0015F580_macro, D_L03_0015F580_macro, D_L03_0015F580_macro); spawn_debris_c5bb8(moby, 0x6CF, (float *)(moby + 0x10), moby + 0x40, 0, 0, 0.0f, D_L03_0015F580_macro, D_L03_0015F580_macro, D_L03_0015F580_macro); FUN_L00_00263e30(moby, 0x77D, 1, 0x77D, 1, 3, 2); @@ -1863,7 +1868,7 @@ void FUN_L03_002c5bb8(char *moby) { if (((unsigned char *)moby)[0x31] != 0 && FUN_001f9b48(moby + 0x10, D_L03_00166EC0) < 32.0f) { FUN_L00_0025a120(moby); } - FUN_L00_0025d538(moby, data->m110); + trooper_anim_finish(moby, data->m110); ((unsigned char *)moby)[0xBC] = 0; } /* Applies damage reaction, knockback parameters and animation state. */ @@ -1876,11 +1881,11 @@ extern int FUN_L03_002c6ca0_c(unsigned char *) __asm__("FUN_L03_002c6ca0"); extern int tick_countdown_32_alt(int *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern void *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); -extern void FUN_L00_0025ab48(void *, float *, void *, void *); -extern void FUN_L00_0025c558(float, void *, void *, int, int, int); -extern void FUN_L00_0025d458(void *, short *); +extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(float, void *, void *, int, int, int) __asm__("FUN_L00_0025c558"); +extern void trooper_anim_update(void *, short *) __asm__("FUN_L00_0025d458"); extern void FUN_L01_0026e090(int, int); -extern void FUN_L03_00250a78(float *, float, float); +extern void trooper_set_knockback(float *, float, float) __asm__("FUN_L03_00250a78"); void FUN_L03_002c6a20(struct Moby *moby) { float vector[4]; int result; float damage; float angle; @@ -1903,19 +1908,19 @@ void FUN_L03_002c6a20(struct Moby *moby) { *(float *)(data+0x130)=speed; *(float *)(data+0x20)=health; } other=*(char **)(hit+0x20); - angle=FUN_001f9e90(moby->pos.x-*(float *)(other+0x10),moby->pos.y-*(float *)(other+0x14)); + angle=fast_arc_tan(moby->pos.x-*(float *)(other+0x10),moby->pos.y-*(float *)(other+0x14)); { float rotationSpeed=frame_time*10.0f; moby->flags&=0xEFFF; *(float *)(data+0x13C)=rotationSpeed; } - FUN_L03_00250a78((float *)(data+0x120),4.5f,2.0f); + trooper_set_knockback((float *)(data+0x120),4.5f,2.0f); *(float *)(data+0x170)=5.0f; *(float *)(data+0x174)=12.0f; *(OvlQuad *)vector=*(OvlQuad *)(hit+0x10); - FUN_L00_0025ab48(vector,&angle,data+0x138,data+0x13C); - FUN_L00_0025c558(angle,moby,data+0x120,4,1,0); + trooper_knockback_arc(vector,&angle,data+0x138,data+0x13C); + trooper_start_knockback(angle,moby,data+0x120,4,1,0); moby->state=21; *(unsigned char *)(data+0x117)=240; - FUN_L00_0025d458(moby,(short *)(data+0x110)); + trooper_anim_update(moby,(short *)(data+0x110)); } moby->hit_slot=255; } @@ -1927,7 +1932,8 @@ extern int FUN_L00_002592b8(int *, int, int, int); extern int FUN_L03_002c5b78_c(unsigned char *) __asm__("FUN_L03_002c5b78"); extern int FUN_L03_002c5b78_c_002c6d58(unsigned char *) __asm__("FUN_L03_002c6d58"); -int FUN_L03_002c6d98(int id) { +int is_point_inside_clip_volume_cf(int id) __asm__("FUN_L03_002c6d98"); +int is_point_inside_clip_volume_cf(int id) { unsigned char *item; if (id == 0xFF) goto absent; FUN_L00_002591d0((int *)&item, id, 0, 0); @@ -1941,7 +1947,7 @@ int FUN_L03_002c6d98(int id) { } /* Ported from rac1-decomp (src/overlays/l03_kerwan/vendor_00293720.c: func_L03_002C81E0), where it is exact; names translated to the US level program. */ -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern short D_L03_0015FFD8_u __asm__("D_L03_0015FFD8"); float absolute_float(float input) __asm__("func_001F99C0"); @@ -1968,7 +1974,7 @@ int FUN_L03_002c6e18(float ang, struct Moby *moby, struct Moby *target) { } if (absolute_float(f20) > 1.5707964f) { go: - if (FUN_001f9b80(&moby->pos, target) < 20.0f) { + if (vector_distance(&moby->pos, target) < 20.0f) { if (absolute_float(f20) > 1.1780972f) { blend_moby_animation_u(moby, 1, 0, scale_game_frames(10)); moby->anim_speed = 1.0f; @@ -2166,7 +2172,7 @@ extern char D_L03_00173F70[]; extern char D_L03_00173F80[]; extern float D_L03_0015F580_macro[] __asm__("D_L03_0015F580")__attribute__((section(".sdata"))); extern float FUN_001efa68_cf(void *) __asm__("FUN_001f9af0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float FUN_001f9e90_cf(float, float) __asm__("FUN_001fa5c8"); extern float FUN_L00_00258278_cf(void *) __asm__("FUN_0020c9e0"); extern float FUN_L00_0025a120_cf(int) __asm__("FUN_001fa6c0"); @@ -2242,7 +2248,7 @@ void FUN_L03_002c6fd0(Moby2C8398 *m) { float dist; FUN_L00_0025fcb8(m, &tgt, d->f270); - dist = FUN_001f9b80(m->pos, &tgt); + dist = vector_distance(m->pos, &tgt); FUN_L00_00263b38(&d->look0, 2.5f); if (d->b262 == 1) { if ((visited52)[m->bB0 + (current_level_index << 4)] == 0xFF) { @@ -2546,7 +2552,7 @@ void FUN_L03_002c6fd0(Moby2C8398 *m) { FUN_001f9c48_cf((char *)m, &d->f258, ang, 0.03f, 0.3f, 0.3f); subtract_vector_xyz_cf(m, 0, v); if (25.0f <= fr && fr <= 31.0f && FUN_L03_002c6e18_cf(m->pos[2] - tgt.pos[2]) < 2.0f && - FUN_001f9b80(m->pos, &tgt) < 3.5f && + vector_distance(m->pos, &tgt) < 3.5f && FUN_L03_002c9ca0_cf( FUN_L00_002628d8_cf(tgt.pos[0] - m->pos[0], tgt.pos[1] - m->pos[1]), m->rot[2]) < 0.2617994f) { @@ -3041,7 +3047,7 @@ void FUN_L03_002c6fd0(Moby2C8398 *m) { } } if (d->b262 == 0) { - if (FUN_001f9b80(m->pos, D_L03_00166EC0) < 70.0f && (D_L03_0015F5CC & 7) == d->s28A) { + if (vector_distance(m->pos, D_L03_00166EC0) < 70.0f && (D_L03_0015F5CC & 7) == d->s28A) { PathF2C8398 *pf = &d->pf; float v[4]; int seg; @@ -3078,17 +3084,17 @@ void FUN_L03_002c6fd0(Moby2C8398 *m) { extern float D_L03_001618E0 __attribute__((sda)); extern float D_L03_001618E4 __attribute__((sda)); extern float D_L03_001618E8 __attribute__((sda)); -extern float FUN_001f9988(float); -extern int FUN_001f9770(void *); +extern float square_root(float) __asm__("FUN_001f9988"); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int fun_00213928(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_00213928"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float add_rotations_c95(float, float) __asm__("FUN_001fa580"); extern void set_moby_animation_alt(void *, int, int) __asm__("FUN_00212ed8"); extern void blend_moby_animation_c95(void *, int, int, int) __asm__("FUN_00212f90"); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); /* Launch speed for a jump of height h at gravity g (per-frame units). */ -#define JUMP_SPEED(g, h) FUN_001f9988(2.0f * (g) * (frame_time_sq * (h))) +#define JUMP_SPEED(g, h) square_root(2.0f * (g) * (frame_time_sq * (h))) /* Hit reaction for class 574 (the path-walking enemy): takes damage from the hit, turns towards the * attacker (the hero when hit by the wrench or by nothing) and starts a knock-back jump whose size depends @@ -3107,9 +3113,9 @@ void FUN_L03_002c95a8(Moby2C8398 *m) { d = m->data; if (d->i38 != 0) { d->i38 = 0; - d->s252 = FUN_001f96f8(240); + d->s252 = scale_game_frames(240); } - if (FUN_001f9770(&d->s252)) { + if (fast_dec_timer_s16(&d->s252)) { d->f270 = d->f26C; } else { d->f270 = d->f26C + 5.0f; @@ -3120,12 +3126,12 @@ void FUN_L03_002c95a8(Moby2C8398 *m) { other = *(char **)(hit + 0x20); if (other != 0) { if (other != (char *)hero.items[0].moby) { - angle = FUN_001f9e90(m->pos[0] - *(float *)(other + 0x10), m->pos[1] - *(float *)(other + 0x14)); + angle = fast_arc_tan(m->pos[0] - *(float *)(other + 0x10), m->pos[1] - *(float *)(other + 0x14)); } else { - angle = FUN_001f9e90(m->pos[0] - hero.motion.pos.f[0], m->pos[1] - hero.motion.pos.f[1]); + angle = fast_arc_tan(m->pos[0] - hero.motion.pos.f[0], m->pos[1] - hero.motion.pos.f[1]); } } else { - angle = FUN_001f9e90(m->pos[0] - hero.motion.pos.f[0], m->pos[1] - hero.motion.pos.f[1]); + angle = fast_arc_tan(m->pos[0] - hero.motion.pos.f[0], m->pos[1] - hero.motion.pos.f[1]); } d->f20 -= damage; if (d->f20 <= 0.0f) { @@ -3139,7 +3145,7 @@ void FUN_L03_002c95a8(Moby2C8398 *m) { case 6: d->b67 = 0x78; d->q.f10 = frame_time_sq * 80.0f; - d->q.f18 = (D_L03_001618E4 / (2.0f * FUN_001f9988(2.0f * D_L03_001618E0 * d->q.f10) / (frame_time_sq * 80.0f)) + + d->q.f18 = (D_L03_001618E4 / (2.0f * square_root(2.0f * D_L03_001618E0 * d->q.f10) / (frame_time_sq * 80.0f)) + D_L03_001618E8 * frame_time_sq * 0.5f * (2.0f * JUMP_SPEED(D_L03_001618E0, 80.0f) / (frame_time_sq * 80.0f))) * 0.5f; @@ -3147,11 +3153,11 @@ void FUN_L03_002c95a8(Moby2C8398 *m) { d->q.i24 = 9; d->q.b3D = 0; *(OvlQuad *)vec = *(OvlQuad *)(hit + 0x10); - FUN_L00_0025ab48(vec, &angle, &d->q.f18, &d->q.f1C); + trooper_knockback_arc(vec, &angle, &d->q.f18, &d->q.f1C); if (fast_difference_between_rotations(m->rot[2], angle) < 1.0471976f) { m->rot[2] = add_rotations_c95(angle, 3.1415927f); } - FUN_L00_0025c558(angle, m, (char *)d + 0x70, 5, 5, 0); + trooper_start_knockback(angle, m, (char *)d + 0x70, 5, 5, 0); set_moby_animation_alt(m, 5, 5); d->q.f50 = 14.0f; d->q.f54 = 28.0f; @@ -3164,15 +3170,15 @@ void FUN_L03_002c95a8(Moby2C8398 *m) { d->b67 = 0x78; d->q.f10 = frame_time_sq * 80.0f; d->q.f14 = D_L03_001618E8 * frame_time_sq; - d->q.f18 = D_L03_001618E4 / (2.0f * FUN_001f9988(2.0f * D_L03_001618E0 * d->q.f10) / (frame_time_sq * 80.0f)) + + d->q.f18 = D_L03_001618E4 / (2.0f * square_root(2.0f * D_L03_001618E0 * d->q.f10) / (frame_time_sq * 80.0f)) + D_L03_001618E8 * frame_time_sq * 0.5f * (2.0f * JUMP_SPEED(D_L03_001618E0, 80.0f) / (frame_time_sq * 80.0f)); d->q.f1C = JUMP_SPEED(D_L03_001618E0, 80.0f); d->q.i24 = 9; d->q.b3D = 0; *(OvlQuad *)vec = *(OvlQuad *)(hit + 0x10); - FUN_L00_0025ab48(vec, &angle, &d->q.f18, &d->q.f1C); - FUN_L00_0025c558(angle, m, (char *)d + 0x70, 5, 5, 0); + trooper_knockback_arc(vec, &angle, &d->q.f18, &d->q.f1C); + trooper_start_knockback(angle, m, (char *)d + 0x70, 5, 5, 0); d->q.f50 = 6.0f; d->q.f54 = 13.0f; m->state = 10; @@ -3183,15 +3189,15 @@ void FUN_L03_002c95a8(Moby2C8398 *m) { d->b67 = 0x78; d->q.f10 = frame_time_sq * 80.0f; d->q.f14 = D_L03_001618E8 * frame_time_sq; - d->q.f18 = D_L03_001618E4 / (2.0f * FUN_001f9988(2.0f * D_L03_001618E0 * d->q.f10) / (frame_time_sq * 80.0f)) + + d->q.f18 = D_L03_001618E4 / (2.0f * square_root(2.0f * D_L03_001618E0 * d->q.f10) / (frame_time_sq * 80.0f)) + D_L03_001618E8 * frame_time_sq * 0.5f * (2.0f * JUMP_SPEED(D_L03_001618E0, 80.0f) / (frame_time_sq * 80.0f)); d->q.f1C = JUMP_SPEED(D_L03_001618E0, 80.0f); d->q.i24 = 9; d->q.b3D = 0; *(OvlQuad *)vec = *(OvlQuad *)(hit + 0x10); - FUN_L00_0025ab48(vec, &angle, &d->q.f18, &d->q.f1C); - FUN_L00_0025c558(angle, m, (char *)d + 0x70, 6, 5, 2); + trooper_knockback_arc(vec, &angle, &d->q.f18, &d->q.f1C); + trooper_start_knockback(angle, m, (char *)d + 0x70, 6, 5, 2); d->q.f50 = 5.0f; d->q.f54 = 10.0f; m->state = 10; @@ -3200,15 +3206,15 @@ void FUN_L03_002c95a8(Moby2C8398 *m) { case 1: d->q.f10 = frame_time_sq * 40.0f; d->q.f14 = D_L03_001618E8 * frame_time_sq; - d->q.f18 = 3.0f / (2.0f * FUN_001f9988(2.0f * 2.0f * d->q.f10) / (frame_time_sq * 40.0f)) + + d->q.f18 = 3.0f / (2.0f * square_root(2.0f * 2.0f * d->q.f10) / (frame_time_sq * 40.0f)) + D_L03_001618E8 * frame_time_sq * 0.5f * (2.0f * JUMP_SPEED(2.0f, 40.0f) / (frame_time_sq * 40.0f)); d->q.f1C = JUMP_SPEED(2.0f, 40.0f); d->q.i24 = 9; d->q.b3D = 0; *(OvlQuad *)vec = *(OvlQuad *)(hit + 0x10); - FUN_L00_0025ab48(vec, &angle, &d->q.f18, &d->q.f1C); - FUN_L00_0025c558(angle, m, (char *)d + 0x70, 7, 5, 2); + trooper_knockback_arc(vec, &angle, &d->q.f18, &d->q.f1C); + trooper_start_knockback(angle, m, (char *)d + 0x70, 7, 5, 2); d->q.f50 = 10.0f; d->q.f54 = 20.0f; d->q.f4C = 2.0f * frame_time; @@ -3218,14 +3224,14 @@ void FUN_L03_002c95a8(Moby2C8398 *m) { m->state = 0xD; allocate_voice_for_target_entry(3, 0, (int)m); if (m->anim != 7) { - blend_moby_animation_c95(m, 7, 0, FUN_001f96f8(6)); + blend_moby_animation_c95(m, 7, 0, scale_game_frames(6)); } break; } - FUN_L00_0025d458(m, (short *)((char *)d + 0x60)); + trooper_anim_update(m, (short *)((char *)d + 0x60)); } m->bA4 = 0xFF; - FUN_L00_0025d538(m, (char *)d + 0x60); + trooper_anim_finish(m, (char *)d + 0x60); } extern int FUN_L03_0024e830(char *, char *, float); extern int FUN_L00_0025df68(void *, void *, void *, int *, float *, int, float, float, float); @@ -3258,9 +3264,9 @@ void FUN_L03_002c9ca0(Moby2C8398 *m) { do { if (pf->idx != seg) { qcopy(pt, pf->path + 0x10 + pf->idx * 0x10); - ang = FUN_001f9e90(pt[0] - m->pos[0], pt[1] - m->pos[1]); + ang = fast_arc_tan(pt[0] - m->pos[0], pt[1] - m->pos[1]); ang = fast_difference_between_rotations( - ang, FUN_001f9e90(target.pos[0] - m->pos[0], target.pos[1] - m->pos[1])); + ang, fast_arc_tan(target.pos[0] - m->pos[0], target.pos[1] - m->pos[1])); dist = FUN_001f9b48(&target, pt); if (ang < 1.5707964f) { if (best_ang < ang) { diff --git a/src/overlays/l03/gameplay/entities/taxi.c b/src/overlays/l03/gameplay/entities/taxi.c index e053badb98..68372d313d 100644 --- a/src/overlays/l03/gameplay/entities/taxi.c +++ b/src/overlays/l03/gameplay/entities/taxi.c @@ -93,7 +93,7 @@ typedef struct { u8 pad2A[0xE]; s32 alerted; /* 0x38: set when it is hit */ u8 pad3C[4]; - u8 effect[0x18]; /* 0x40: debris record (FUN_L00_0025e450, FUN_L00_00259028) */ + u8 effect[0x18]; /* 0x40: debris record (spawn_explosion, FUN_L00_00259028) */ u8 unk58; u8 pad59; u8 unk5A; @@ -162,9 +162,9 @@ extern f32 trooper_rand(f32, f32) __asm__("FUN_002132a8"); extern void trooper_scale(void *, void *, f32) __asm__("FUN_001f9c48"); extern void trooper_scale4(void *, void *, f32) __asm__("FUN_001f9a68"); extern void trooper_add(void *, void *, void *) __asm__("FUN_001f9a10"); -extern int FUN_L00_0025c698(struct Moby *, void *); -extern void FUN_L00_0025e450(struct Moby *, void *, void *, f32, f32, s32, s32, s32, f32, f32, f32, f32, s32, - f32, s32, s32, s32, s32); +extern int mine_fall(struct Moby *, void *) __asm__("FUN_L00_0025c698"); +extern void spawn_explosion(struct Moby *, void *, void *, f32, f32, s32, s32, s32, f32, f32, f32, f32, s32, + f32, s32, s32, s32, s32) __asm__("FUN_L00_0025e450"); extern void FUN_L00_00257470(struct Moby *, int, int); extern void trooper_kill(struct Moby *) __asm__("FUN_0020c828"); extern f32 probe_ground_height(void *, int, f32) __asm__("FUN_00213508"); @@ -173,7 +173,8 @@ extern void FUN_L00_0025a120(struct Moby *); /* l03 trooper update: patrols its rail path, turns to face the hero once in sight, fires three-shot bursts, falls under gravity and blows up when shot down or when it drops into a pit. */ -void FUN_L03_002c9eb8(struct Moby *m) { +void mine_layer_update(struct Moby *m) __asm__("FUN_L03_002c9eb8"); +void mine_layer_update(struct Moby *m) { TrooperVars *v = (TrooperVars *)m->pvars; TrooperPatrol *pt; struct RailPath *path; @@ -288,7 +289,7 @@ void FUN_L03_002c9eb8(struct Moby *m) { } break; case 4: - if (FUN_L00_0025c698(m, v->knockback) & 0x60) { + if (mine_fall(m, v->knockback) & 0x60) { if (m->prev_seq != 0) { trooper_blend_anim(m, 0, 0, trooper_frames(10)); } @@ -296,17 +297,17 @@ void FUN_L03_002c9eb8(struct Moby *m) { } else if (m->pos.z < 5.0f) { qcopy(muzzle, &m->pos); muzzle[2] += 0.5f; - FUN_L00_0025e450(m, v->effect, muzzle, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, -1, 0); + spawn_explosion(m, v->effect, muzzle, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, -1, 0); FUN_L00_00257470(m, 0, -1); trooper_kill(m); return; } break; case 5: - if ((FUN_L00_0025c698(m, v->knockback) & 0x60) || m->pos.z < 5.0f) { + if ((mine_fall(m, v->knockback) & 0x60) || m->pos.z < 5.0f) { qcopy(muzzle, &m->pos); muzzle[2] += 0.5f; - FUN_L00_0025e450(m, v->effect, muzzle, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, -1, 0); + spawn_explosion(m, v->effect, muzzle, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, -1, 0); FUN_L00_00257470(m, 0, -1); trooper_kill(m); return; @@ -324,7 +325,7 @@ void FUN_L03_002c9eb8(struct Moby *m) { } else if (m->pos.z < 5.0f) { qcopy(muzzle, &m->pos); muzzle[2] += 0.5f; - FUN_L00_0025e450(m, v->effect, muzzle, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, -1, 0); + spawn_explosion(m, v->effect, muzzle, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, -1, 0); FUN_L00_00257470(m, 0, -1); trooper_kill(m); return; @@ -435,14 +436,14 @@ void FUN_L03_002ca808(struct Moby *m) { typedef float MineVec[4] __attribute__((aligned(16))); -/* Explosion description handed to FUN_L00_002d3838 (0x50 bytes, copied from a level constant). */ +/* Explosion description handed to mine_camera_blast (0x50 bytes, copied from a level constant). */ typedef struct { OvlQuad q[5]; } MineBlast; /* Pvars of the l03 mine. */ typedef struct { - u8 pad0[0x60]; /* 0x00: fall record (FUN_L00_0025c698) */ + u8 pad0[0x60]; /* 0x00: fall record (mine_fall) */ s32 unk60; s32 timer; /* 0x64: arming delay */ struct Moby *target; /* 0x68: moby it is stuck to or homing on */ @@ -715,12 +716,12 @@ extern f32 D_L03_00161B18 __attribute__((sda)); extern L03LevelState D_L03_001BB330; extern s32 D_L03_0015F594 __attribute__((sda)); extern void FUN_L00_00266858(void *, int); -extern void FUN_L01_00285768(void *, struct Moby *, s32, u32, s32, s32, s32, f32); +extern void draw_number(void *, struct Moby *, s32, u32, s32, s32, s32, f32) __asm__("FUN_L01_00285768"); extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); extern int FUN_L01_00277fb8(void *); extern void FUN_L00_00233ee8(void *, float, int); extern s32 FUN_L00_00233f38(void); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void taxi_kill(struct Moby *) __asm__("FUN_0020c828"); extern f32 taxi_atan2(f32, f32) __asm__("FUN_001f9e90"); extern void taxi_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); @@ -743,13 +744,13 @@ void FUN_L03_002d3198(struct Moby *m) { FUN_L00_00266858(m, FUN_L03_002d30d8((u8 *)m)); if (D_L03_00161B04 != 0) { for (i = 0; i < D_L03_001B05B0[v->out[0]]->count; i++) { - FUN_L01_00285768(&D_L03_001B05B0[v->out[0]]->pts[i], m, 4, 0x800000FF, 0x7F, 2, 0xFF, 0.333f); + draw_number(&D_L03_001B05B0[v->out[0]]->pts[i], m, 4, 0x800000FF, 0x7F, 2, 0xFF, 0.333f); } for (i = 0; i < D_L03_001B05B0[v->back[0]]->count; i++) { - FUN_L01_00285768(&D_L03_001B05B0[v->back[0]]->pts[i], m, 4, 0x8000FF00, 0x7F, 2, 0xFF, 0.333f); + draw_number(&D_L03_001B05B0[v->back[0]]->pts[i], m, 4, 0x8000FF00, 0x7F, 2, 0xFF, 0.333f); } for (i = 0; i < D_L03_001B05B0[v->onward[0]]->count; i++) { - FUN_L01_00285768(&D_L03_001B05B0[v->onward[0]]->pts[i], m, 4, 0x80FF0000, 0x7F, 2, 0xFF, 0.333f); + draw_number(&D_L03_001B05B0[v->onward[0]]->pts[i], m, 4, 0x80FF0000, 0x7F, 2, 0xFF, 0.333f); } } qcopy(&oldPos, &m->pos); @@ -857,7 +858,7 @@ void FUN_L03_002d3198(struct Moby *m) { } FUN_L03_002d3c40(m); taxi_vec_sub(&move, &m->pos, &oldPos); - FUN_L00_00260738(v->coll, &move, &oldRot, &m->rot); + update_entity_matrix(v->coll, &move, &oldRot, &m->rot); } /* Pvars of a moby flying along a rail path. */ @@ -954,9 +955,10 @@ struct SpinnerVars { u8 pad0[0x20]; u8 coll[0x10]; /* 0x20: collision record moved with the rotation */ }; -extern float FUN_001fa580(float, float); -extern void FUN_L00_00260738(void *, void *, void *, void *); -void FUN_L03_002d3e58(struct Moby *m) { +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); +void robo_shack_sign_update(struct Moby *m) __asm__("FUN_L03_002d3e58"); +void robo_shack_sign_update(struct Moby *m) { Vec4 move; Vec4 oldRot; struct SpinnerVars *v; @@ -965,8 +967,8 @@ void FUN_L03_002d3e58(struct Moby *m) { v = (struct SpinnerVars *)m->pvars; m->draw_dist = 0xFF; m->update_dist = 0xFF; - m->rot.z = FUN_001fa580(m->rot.z, frame_time * 0.47996554f); - FUN_L00_00260738(v->coll, &move, &oldRot, &m->rot); + m->rot.z = fast_add_rotations(m->rot.z, frame_time * 0.47996554f); + update_entity_matrix(v->coll, &move, &oldRot, &m->rot); } #define NOT_SDA @@ -981,11 +983,12 @@ void FUN_L03_002d3e58(struct Moby *m) { extern CollisionHit coll_hit __asm__("D_L03_00173F60"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern int FUN_001efa68(void *, void *, int, void *, void *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void FUN_L00_00250df8(void *); extern struct Moby *func_0020D348_m(int) __asm__("FUN_0020c4f8"); +char *FUN_L03_002d4288(char *a, char *pos, struct Moby *parent, int n, float f0, float f1, float f2); char *FUN_L03_002d4288(char *a, char *pos, struct Moby *parent, int n, float f0, float f1, float f2) { char *m = (char *)func_0020D348_m(0x341); char *d; @@ -1007,7 +1010,7 @@ char *FUN_L03_002d4288(char *a, char *pos, struct Moby *parent, int n, float f0, *(int *)(d + 0x28) = 0; *(OvlQuad *)v = *(OvlQuad *)&parent->pos; v[2] = *(float *)(pos + 8); - if (FUN_001efa68(v, pos, 2, parent, 0) != 0) { + if (collision_line(v, pos, 2, parent, 0) != 0) { *(int *)(d + 0x14) = 0; *(OvlQuad *)(m + 0x10) = *(OvlQuad *)&coll_hit; *(int *)(d + 0x24) = 0; @@ -1056,7 +1059,7 @@ extern float spring_turn(float *vel, float cur, float target, float k, float d, extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern void make_hit_descriptor(void *, void *, int, float, void *) __asm__("FUN_L00_00259888"); extern void FUN_L00_00259a88(void *, void *); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern float D_L03_00161B28 __attribute__((sda)); extern CollisionHit D_L03_00173F40; @@ -1109,7 +1112,7 @@ void FUN_L03_002d43c8(struct Moby *m) { frame_time_sq_macro * 3.1415927f, frame_time * 0.5235988f); m->pos.z += fast_sin(-m->rot.y) * v->speed; } - if (FUN_001efa68(pos, &old, 0, v->ignore, 0) != 0 || + if (collision_line(pos, &old, 0, v->ignore, 0) != 0 || coll_sphere(0.2f, pos, 0, v->ignore) != 0) { level = (void **)&D_L03_00173F40; if (level[6] != NULL) { @@ -1125,12 +1128,12 @@ void FUN_L03_002d43c8(struct Moby *m) { } m->state = 2; } - if (FUN_001f9740(&v->timer) != 0) { + if (fast_dec_timer(&v->timer) != 0) { m->state = 2; } break; case 2: - FUN_L00_0025f090(m, &m->pos, 0, 0.25f, 13.0f); + cart_burst(m, &m->pos, 0, 0.25f, 13.0f); mark_moby_for_removal(m); break; } @@ -1183,7 +1186,7 @@ void FUN_L03_002da710(struct Moby *m) { #include "rnc/globals.h" -/* Pvars of the l03 dialogue mobys (the record FUN_L00_002668a0 / FUN_L00_00266448 run). */ +/* Pvars of the l03 dialogue mobys (the record initialize_npc_dialogue / update_npc_dialogue run). */ struct TalkState { u8 pad0[4]; s16 mode; /* 0x04: 1 talked, 2 talked and accepted */ @@ -1196,7 +1199,7 @@ struct TalkState { s32 warp; /* 0x4C: index into D_L03_001600EC, -1 for none */ }; -/* Pvars of the Kerwan quest giver FUN_L03_002da870 drives. */ +/* Pvars of the Kerwan quest giver helga_update drives. */ struct QuestGiverVars { u8 pad0[0x80]; struct TalkState talk; /* 0x80 */ @@ -1204,7 +1207,7 @@ struct QuestGiverVars { s32 link; /* 0xD4: moby index of the class 0x3F4 helper it drives, -1 for none */ s32 link_arg; /* 0xD8: stored into the helper when it is released */ u8 padDC[4]; - u8 body[0x64]; /* 0xE0: body look-at driver (FUN_L00_002628d8) */ + u8 body[0x64]; /* 0xE0: body look-at driver (update_joint_animation) */ f32 pitch; /* 0x144 */ f32 yaw; /* 0x148 */ u8 pad14C[4]; @@ -1228,28 +1231,29 @@ extern L03LevelState D_L03_001BA6D0; extern char *D_L03_001600EC; extern float frame_scale_sq __asm__("D_0015ED64"); extern void FUN_L01_0029b0a0(void *, int, struct Moby *, int, void *); -extern void FUN_L00_002668a0(struct Moby *, struct TalkState *); -extern int FUN_L00_00266448(struct Moby *, struct TalkState *); -extern void FUN_L02_0025c758(struct Moby *); -extern void FUN_L01_002783a8(struct Moby *, f32); -extern void FUN_L00_002502a0(int); -extern void FUN_L00_00284e50(void *, void *); +extern void initialize_npc_dialogue(struct Moby *, struct TalkState *) __asm__("FUN_L00_002668a0"); +extern int update_npc_dialogue(struct Moby *, struct TalkState *) __asm__("FUN_L00_00266448"); +extern void initialize_moby_grounding(struct Moby *) __asm__("FUN_L02_0025c758"); +extern void begin_dialogue_camera_transition(struct Moby *, f32) __asm__("FUN_L01_002783a8"); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern void FUN_L00_00260860(int, int); extern void queue_dialogue_message(int, int) __asm__("FUN_L00_00263d40"); extern void memcard_save_data(int, int) __asm__("FUN_0020b178"); -extern float FUN_001fa688(float, float); +extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); -extern s32 FUN_001f9740(s32 *); +extern s32 fast_dec_timer(s32 *) __asm__("FUN_001f9740"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); extern void build_spherical_offset(void *, float, float, float) __asm__("FUN_00214db0"); -extern void FUN_L00_002628d8(float, float, void *, void *, int); +extern void update_joint_animation(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); /* Quest giver: talks when approached (driving its class 0x3F4 helper), warps the hero or, once the deal is accepted, removes the reward moby, records it and saves. While idle it turns its head toward the hero or toward random points. */ -void FUN_L03_002da870(struct Moby *m) { +void helga_update(struct Moby *m) __asm__("FUN_L03_002da870"); +void helga_update(struct Moby *m) { struct QuestGiverVars *v = (struct QuestGiverVars *)m->pvars; struct TalkState *talk = &v->talk; struct Moby *t; @@ -1294,12 +1298,12 @@ void FUN_L03_002da870(struct Moby *m) { m->state = 1; talk->script = D_L03_00161BB8; v->talk.unk48 = 5; - FUN_L00_002668a0(m, talk); - FUN_L02_0025c758(m); + initialize_npc_dialogue(m, talk); + initialize_moby_grounding(m); break; case 1: - if (FUN_L00_00266448(m, talk)) { - FUN_L01_002783a8(m, 2.3f); + if (update_npc_dialogue(m, talk)) { + begin_dialogue_camera_transition(m, 2.3f); m->state = 2; if (v->link != -1) { t = (struct Moby *)((v->link << 8) + D_L03_0015FFD8_i); @@ -1314,7 +1318,7 @@ void FUN_L03_002da870(struct Moby *m) { case 2: if (D_L03_0015F5C4 != 2) { if (v->talk.mode != 2) { - FUN_L00_002502a0(m->mission); + jet_clear_persistent(m->mission); if (v->link != -1) { t = (struct Moby *)((v->link << 8) + D_L03_0015FFD8_i); if (t->oclass == 0x3F4) { @@ -1324,7 +1328,7 @@ void FUN_L03_002da870(struct Moby *m) { } } if (v->talk.warp != -1) { - FUN_L00_00284e50(D_L03_001600EC + v->talk.warp * 128 + 0x30, + jet_reset_camera(D_L03_001600EC + v->talk.warp * 128 + 0x30, D_L03_001600EC + v->talk.warp * 128 + 0x70); } } @@ -1386,18 +1390,18 @@ void FUN_L03_002da870(struct Moby *m) { tracking = 1; if (taxi_dist2(&m->pos, g) < 8.0f && (h = (struct Hero *)((u8 *)g - 0x80), - FUN_001fa688(m->rot.z, taxi_atan2(h->motion.unkD0.f[0] - m->pos.x, h->motion.unkD0.f[1] - m->pos.y))) < + fast_difference_between_rotations(m->rot.z, taxi_atan2(h->motion.unkD0.f[0] - m->pos.x, h->motion.unkD0.f[1] - m->pos.y))) < 1.5707964f) { if (vec_len((u8 *)g + 0x80) > 0.01f) { v->watch_timer = scale_game_frames(120); } else { - FUN_001f9740(&v->watch_timer); + fast_dec_timer(&v->watch_timer); } } else if (v->watch_timer) { v->watch_timer = 0; qcopy(&v->target, &hero.motion.unkD0); } - if (FUN_001f9740(&v->target_timer)) { + if (fast_dec_timer(&v->target_timer)) { float heading; v->target_timer = truncate_float_to_s32(multiply_global_factor_ed64(random_float_between(180.0f, 300.0f))); heading = fast_add_rotations(m->rot.z, random_float_between(-90.0f, 90.0f) * DEG_TO_RAD); @@ -1431,8 +1435,8 @@ void FUN_L03_002da870(struct Moby *m) { } if (big_head_cheat_enabled) v->height = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, v->body, 0); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, v->head, 1); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, v->body, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, v->head, 1); } extern float cos_2db020(float) __asm__("FUN_001f9dc8"); @@ -1443,7 +1447,7 @@ extern void vscale_2db020(void *, void *, float) __asm__("FUN_001f9a68"); extern int ftoi_2db020(float) __asm__("FUN_001fa6d0"); extern float itof_2db020(int) __asm__("FUN_001fa6c0"); extern void kill_2db020(char *) __asm__("FUN_0020c828"); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern float D_L03_00161BC0; /* Moves the moby along its path: advances the distance, places it on the @@ -1476,7 +1480,7 @@ void FUN_L03_002db020(struct Moby *m) { vscale_2db020(b, b, t); vadd_2db020(&m->pos, b, (*(float (**)[4])(v + 0x60))[i + 1]); vsub_2db020(a, &m->pos, old); - FUN_L00_00260738(v + 0x20, a, &m->rot, &m->rot); + update_entity_matrix(v + 0x20, a, &m->rot, &m->rot); } extern void FUN_L00_0025d1b8(struct Moby *); @@ -1531,8 +1535,8 @@ extern char D_L03_001E35F0[]; extern void debug_print(char *, int) __asm__("FUN_001e93b0"); extern float FUN_001f9b48(void *, void *); extern struct Moby *FUN_L03_002db198(struct RailPath *, float); -extern int FUN_001f9740(s32 *); -extern int FUN_L00_0028d8c0(struct RailSpawnerMoby *, int); +extern int fast_dec_timer(s32 *) __asm__("FUN_001f9740"); +extern int voice_is_playing(struct RailSpawnerMoby *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L00_0028dc90(int, int, struct RailSpawnerMoby *, int); void FUN_L03_002db280(struct RailSpawnerMoby *moby) { @@ -1558,15 +1562,15 @@ void FUN_L03_002db280(struct RailSpawnerMoby *moby) { FUN_L03_002db198(path, d); moby->unk30 = 0x60; } - if (FUN_001f9740(&vars->timer)) { + if (fast_dec_timer(&vars->timer)) { vars->timer = ftoi_2db020(2.9f / D_L03_00161BC0); FUN_L03_002db198(D_L03_001B05B0[vars->path], 0.0f); } - if (!FUN_L00_0028d8c0(moby, vars->voice)) + if (!voice_is_playing(moby, vars->voice)) vars->voice = FUN_L00_0028dc90(0, 4, moby, 0x382); } -/* Dialogue record run by FUN_L00_002668a0 / FUN_L00_00266448 (only the fields read here). */ +/* Dialogue record run by initialize_npc_dialogue / update_npc_dialogue (only the fields read here). */ struct TalkRecord { u8 pad0[4]; s16 mode; /* 0x04: 2 when the talk was accepted */ @@ -1575,7 +1579,7 @@ struct TalkRecord { u8 pad38[8]; }; -/* Look-at driver run by FUN_L00_002628d8. */ +/* Look-at driver run by update_joint_animation. */ struct LookAt { u8 pad0[0x64]; f32 pitch; /* 0x64 */ @@ -1585,7 +1589,7 @@ struct LookAt { u8 pad74[0xC]; }; -/* Pvars of the Kerwan guide FUN_L03_002db558 drives. */ +/* Pvars of the Kerwan guide big_al_update drives. */ struct GuideVars { struct TalkRecord talk; struct LookAt head; /* 0x40 */ @@ -1614,28 +1618,29 @@ extern s32 D_L03_0015FFD8_i __asm__("D_L03_0015FFD8"); extern char *D_L03_001600EC; extern float frame_scale_sq __asm__("D_0015ED64"); extern void FUN_L03_002db480(struct Moby *); -extern void FUN_L02_0025c758(struct Moby *); -extern void FUN_L01_002783a8(struct Moby *, f32); -extern void FUN_L00_002502a0(int); -extern void FUN_L00_00284e50(void *, void *); +extern void initialize_moby_grounding(struct Moby *) __asm__("FUN_L02_0025c758"); +extern void begin_dialogue_camera_transition(struct Moby *, f32) __asm__("FUN_L01_002783a8"); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern void FUN_L00_00260860(int, int); extern void queue_dialogue_message(int, int) __asm__("FUN_L00_00263d40"); extern void FUN_L00_00216f90(void *, void *, int, int); extern int guide_save(int, int) __asm__("FUN_0020b178"); -extern float FUN_001fa688(float, float); +extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); -extern s32 FUN_001f9740(s32 *); +extern s32 fast_dec_timer(s32 *) __asm__("FUN_001f9740"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); extern void build_spherical_offset(void *, float, float, float) __asm__("FUN_00214db0"); -extern void FUN_L00_002628d8(float, float, void *, void *, int); +extern void update_joint_animation(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); extern GameFlags_db558 race_gates __asm__("D_0013D5B0"); /* Kerwan guide: talks when approached (turning round to face the hero first), releases its reward moby once the item is owned, can warp the hero, and turns its head toward the hero or random points while idle. */ -void FUN_L03_002db558(struct Moby *m) { +void big_al_update(struct Moby *m) __asm__("FUN_L03_002db558"); +void big_al_update(struct Moby *m) { struct GuideVars *v = (struct GuideVars *)m->pvars; struct Moby *t; struct Moby *o; @@ -1668,8 +1673,8 @@ void FUN_L03_002db558(struct Moby *m) { } m->spawn_frame = *(u64 *)(D_001413D0_db558[0] + 0x38); m->state = 1; - FUN_L00_002668a0(m, (struct TalkState *)&v->talk); - FUN_L02_0025c758(m); + initialize_npc_dialogue(m, (struct TalkState *)&v->talk); + initialize_moby_grounding(m); if (D_0013D4C2[0] != 0) { v->talk.unk36 = -1; } @@ -1694,12 +1699,12 @@ void FUN_L03_002db558(struct Moby *m) { if (item_available[2] != 0 && visited52[m->mission + current_level_index * 16] == 0xFF) { break; } - if (FUN_L00_00266448(m, (struct TalkState *)&v->talk)) { + if (update_npc_dialogue(m, (struct TalkState *)&v->talk)) { if (v->turned == 0) { m->rot.z = fast_add_rotations(m->rot.z, 3.1415927f); v->turned = 1; } - FUN_L01_002783a8(m, 2.7f); + begin_dialogue_camera_transition(m, 2.7f); m->anim_speed = 0.0f; m->state = 2; } @@ -1710,7 +1715,7 @@ void FUN_L03_002db558(struct Moby *m) { } m->anim_speed = 1.0f; if (v->talk.mode != 2) { - FUN_L00_002502a0(m->mission); + jet_clear_persistent(m->mission); if (v->link != -1) { t = (struct Moby *)((v->link << 8) + D_L03_0015FFD8_i); if (t->oclass == 0x3F4) { @@ -1718,7 +1723,7 @@ void FUN_L03_002db558(struct Moby *m) { } } if (v->warp != -1) { - FUN_L00_00284e50(D_L03_001600EC + v->warp * 128 + 0x30, D_L03_001600EC + v->warp * 128 + 0x70); + jet_reset_camera(D_L03_001600EC + v->warp * 128 + 0x30, D_L03_001600EC + v->warp * 128 + 0x70); } } m->state = 1; @@ -1748,7 +1753,7 @@ void FUN_L03_002db558(struct Moby *m) { } } if (v->warp != -1) { - FUN_L00_00284e50(D_L03_001600EC + v->warp * 128 + 0x30, D_L03_001600EC + v->warp * 128 + 0x70); + jet_reset_camera(D_L03_001600EC + v->warp * 128 + 0x30, D_L03_001600EC + v->warp * 128 + 0x70); } guide_save(0, -1); FUN_L00_00216f90(D_L03_001600EC + v->warp * 128 + 0x30, D_L03_001600EC + v->warp * 128 + 0x70, 0, 1); @@ -1762,18 +1767,18 @@ void FUN_L03_002db558(struct Moby *m) { tracking = 1; if (taxi_dist2(&m->pos, g) < 8.0f && (h = (struct Hero *)((u8 *)g - 0x80), - FUN_001fa688(m->rot.z, taxi_atan2(h->motion.unkD0.f[0] - m->pos.x, h->motion.unkD0.f[1] - m->pos.y))) < + fast_difference_between_rotations(m->rot.z, taxi_atan2(h->motion.unkD0.f[0] - m->pos.x, h->motion.unkD0.f[1] - m->pos.y))) < 1.5707964f) { if (vec_len((u8 *)g + 0x80) > 0.01f) { v->watch_timer = scale_game_frames(120); } else { - FUN_001f9740(&v->watch_timer); + fast_dec_timer(&v->watch_timer); } } else if (v->watch_timer) { v->watch_timer = 0; qcopy(&v->target, &hero.motion.unkD0); } - if (FUN_001f9740(&v->target_timer)) { + if (fast_dec_timer(&v->target_timer)) { float heading; v->target_timer = truncate_float_to_s32(multiply_global_factor_ed64(random_float_between(180.0f, 300.0f))); heading = fast_add_rotations(m->rot.z, random_float_between(-90.0f, 90.0f) * DEG_TO_RAD); @@ -1807,11 +1812,11 @@ void FUN_L03_002db558(struct Moby *m) { } if (big_head_cheat_enabled) v->head.height = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, &v->head, 1); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, &v->body, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, &v->head, 1); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, &v->body, 0); } -/* Pvars of the dialogue moby FUN_L03_002dbd90 drives (FUN_L00_002668a0 / FUN_L00_00266448 state). */ +/* Pvars of the dialogue moby robot_qwark_update drives (initialize_npc_dialogue / update_npc_dialogue state). */ struct TalkerVars { u8 pad0[4]; s16 mode; /* 0x04: 2 when the talk ends in a warp */ @@ -1843,8 +1848,8 @@ extern void talker_spawn_debris(struct Moby *, void *, void *, f32, f32, s32, s3 f32, s32, s32, s32, s32) __asm__("FUN_L00_0025e450"); extern int talker_init(struct Moby *, struct TalkerVars *) __asm__("FUN_L00_002668a0"); extern int talker_update(struct Moby *, struct TalkerVars *) __asm__("FUN_L00_00266448"); -extern void FUN_L01_002783a8(struct Moby *, f32); -extern void FUN_L00_00284e50(void *, void *); +extern void begin_dialogue_camera_transition(struct Moby *, f32) __asm__("FUN_L01_002783a8"); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern f32 talker_rand_angle(void) __asm__("FUN_00213308"); extern f32 talker_rand_range(f32, f32) __asm__("FUN_002132a8"); extern f32 talker_cos(f32) __asm__("FUN_001f9dc8"); @@ -1855,7 +1860,8 @@ extern void FUN_L00_0026ced0(void *, void *, u32, u32, s32, f32); /* A talking moby that can be shot down: talks (and may warp the hero) when * approached, and once hit by a type 3 hit or already recorded as collected * it breaks, records its save bit, and keeps sparking. */ -void FUN_L03_002dbd90(struct Moby *m) { +void robot_qwark_update(struct Moby *m) __asm__("FUN_L03_002dbd90"); +void robot_qwark_update(struct Moby *m) { struct TalkerVars *d = (struct TalkerVars *)m->pvars; TalkerHit *hit; u8 type; @@ -1910,7 +1916,7 @@ void FUN_L03_002dbd90(struct Moby *m) { case 1: if (talker_update(m, d)) { D_0013D388[0x19] = 1; - FUN_L01_002783a8(m, 2.7f); + begin_dialogue_camera_transition(m, 2.7f); m->state = 2; } break; @@ -1921,7 +1927,7 @@ void FUN_L03_002dbd90(struct Moby *m) { m->state = 1; if (d->mode == 2 && d->warp != -1) { w = D_L03_001600EC + d->warp * 128; - FUN_L00_00284e50(w + 0x30, w + 0x70); + jet_reset_camera(w + 0x30, w + 0x70); } break; case 3: @@ -2026,7 +2032,7 @@ void FUN_L03_002dccc0(struct Moby *m) { FUN_L00_00266858(m, FUN_L03_002dcb30((unsigned char *)m)); qcopy(&oldPos, &m->pos); oldRot.q = *(u128 *)&m->rot; - FUN_001f9740(&d->timer); + fast_dec_timer(&d->timer); switch (m->state) { case 0: m->command = d->start_end; @@ -2091,7 +2097,7 @@ void FUN_L03_002dccc0(struct Moby *m) { } FUN_L03_002dd0f0(m); vec_sub(&move, &m->pos, &oldPos); - FUN_L00_00260738(d->coll, &move, &oldRot, &m->rot); + update_entity_matrix(d->coll, &move, &oldRot, &m->rot); if (!FUN_L01_00277fb8(m) && vector_distance(&m->pos, &hero.motion.pos) > 2.0f && d->timer == 0) d->ready = 1; } diff --git a/src/overlays/l03/gameplay/hero/00205830.c b/src/overlays/l03/gameplay/hero/00205830.c index d9b05eb915..6f7fd49b7d 100644 --- a/src/overlays/l03/gameplay/hero/00205830.c +++ b/src/overlays/l03/gameplay/hero/00205830.c @@ -21,7 +21,7 @@ extern struct LedgeSpot *D_L03_0015F70C; extern s32 D_L03_0015F710; extern f32 FUN_001f99c0(f32); extern f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); s32 FUN_L03_00205830(Vec4 *from, s32 **outOwner, Vec4 *to, s32 *outI, f32 *outF, s32 *outKind, @@ -45,7 +45,7 @@ s32 FUN_L03_00205830(Vec4 *from, s32 **outOwner, Vec4 *to, s32 *outI, f32 *outF, if (!FUN_L00_0025df68(D_L03_0015F70C[i].owner, p, to, &gotI, &gotF, D_L03_0015F70C[i].kind, 12.0f, 10.0f, 0.0f)) continue; - if (!(FUN_001f9b80(p, to) < 1.7f)) + if (!(vector_distance(p, to) < 1.7f)) continue; if (!(FUN_001f99c0(p->f[2] - to->f[2]) < 1.5f)) continue; @@ -189,7 +189,7 @@ extern void FUN_L00_00217118(f32, f32); extern void stick_target(f32, s32) __asm__("FUN_L00_002118c8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void turn_to(s32, f32, f32, f32) __asm__("FUN_L00_00211e30"); -extern s32 FUN_001f9740(void *); +extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 FUN_L00_00229a98(void); extern void FUN_L00_00211e98(void); @@ -226,10 +226,10 @@ extern u8 D_L03_0017C0C0[]; extern void FUN_L00_00216e48(s32, struct MobyView *, s32); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); -extern s32 FUN_001f9770(s16 *); +extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); extern void FUN_L00_00209a40(s32, s32); extern void FUN_L00_00209ca8(s32, s32, s32); -extern void FUN_L00_002a3ec8(s32, s32, s32, f32, f32, f32, f32); +extern void pool_splash(s32, s32, s32, f32, f32, f32, f32) __asm__("FUN_L00_002a3ec8"); extern f32 FUN_L00_0025bc98(f32 *, f32, f32 *, s32, f32, f32, f32); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); @@ -243,7 +243,7 @@ extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 FUN_L00_00209018(void *, s32); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern void FUN_L00_0020a1e0(f32, f32); @@ -267,21 +267,21 @@ extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern s32 FUN_L00_002595a0(f32 *, f32 *, f32, f32, f32); extern void FUN_L00_0025bc00(f32 *, s32, f32, f32); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern f32 square_root(f32) __asm__("FUN_001f9988"); -extern f32 FUN_L00_00233a78(void *); -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); -extern f32 FUN_L00_00213350(void *); +extern f32 gravity_z(void *) __asm__("FUN_L00_00233a78"); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); +extern f32 forward_component(void *) __asm__("FUN_L00_00213350"); extern struct HeroTableRow2C D_L03_0017BD28[]; extern struct LevelTable_QS D_L03_00166D80; #define Q D_L03_00166D80 extern void FUN_L00_00233ba0(void *, void *, f32); -extern void FUN_L00_00233b20(void *, void *, f32); +extern void gravity_set_z(void *, void *, f32) __asm__("FUN_L00_00233b20"); extern void FUN_L00_002336e8(void *, void *, f32); extern void make_hit_descriptor(void *, struct MobyView *, s32, f32, void *) __asm__("FUN_L00_00259888"); extern s32 collect_mobies_in_sphere(f32, void *, s32, struct MobyView *, void *) __asm__("FUN_L00_001f2868"); @@ -292,8 +292,8 @@ extern void FUN_L00_001ff290(void *, void *, void *); extern void FUN_L00_002a9b80(struct MobyView *, void *); extern s32 FUN_L00_002a96f8(struct MobyView *, void *, f32, f32, s32, f32, f32, f32); extern void FUN_L00_002335c8(void *, f32, f32, f32); -extern s32 FUN_L00_002598b0(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32); -extern f32 FUN_001f9ab0(void *, void *); +extern s32 play_entity_sound(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32) __asm__("FUN_L00_002598b0"); +extern f32 fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); struct PlayerSpeedTuning { u8 pad0[8]; f32 x08; @@ -305,13 +305,13 @@ extern struct PlayerSpeedTuning D_L03_0017BEB8; extern s32 FUN_L00_00216de8(s32, s32); extern void FUN_L00_00233708(void *, void *, f32); extern void FUN_L00_00233810(void *, void *, f32); -extern s32 FUN_001efa68(void *, void *, s32, struct MobyView *, s32); +extern s32 collision_line(void *, void *, s32, struct MobyView *, s32) __asm__("FUN_001efa68"); extern void FUN_L00_00215340(void); extern void FUN_L00_00233660(void *, f32, f32, f32); extern s32 FUN_L00_0025e3b8(s32); -extern void FUN_L00_00259bc8(s32, struct MobyView *, s32, void *, void *, f32); +extern void spawn_nearby_effect(s32, struct MobyView *, s32, void *, void *, f32) __asm__("FUN_L00_00259bc8"); extern void FUN_L00_00209ec8(void); -extern void FUN_L00_002338d0(void *, void *); +extern void gravity_flatten(void *, void *) __asm__("FUN_L00_002338d0"); extern s32 hero_slot_item_id(s32) __asm__("FUN_L00_0020d498"); extern void FUN_L00_0020b5b8(void); extern void FUN_L01_0022d090(void); @@ -324,7 +324,7 @@ extern void FUN_L00_0020d2f8(void *); extern f32 randf_sym(f32, f32) __asm__("FUN_L00_00257c48"); extern void FUN_L00_0026d598(void *, void *, s32); extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); -extern s32 FUN_L00_0025d808(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); +extern s32 sample_path(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); extern s32 FUN_L00_0025d7a0(void *, s32, s32, s32); extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); extern void hero_integrate_velocity(void) __asm__("FUN_L00_00214108"); @@ -385,7 +385,7 @@ void FUN_L03_0020ef60(void) { transform_vector_by_basis(&hero.motion.unk170, &v0, &D_L03_00166ED8[0x1F8]); hero.motion.move_yaw = *(f32 *)D_L03_00166ED8; turn_to(0, frame_scale_sq, frame_scale_sq * 0.0f, frame_time * 174.53293f); - if (D_L03_0015F688_gp > 0 && FUN_001f9740(&D_L03_0015F688_gp) != 0) { + if (D_L03_0015F688_gp > 0 && fast_dec_timer(&D_L03_0015F688_gp) != 0) { s32 t; if (usage_stats.stat[18].count < 0xFFFF) { usage_stats.stat[18].count++; @@ -541,7 +541,7 @@ void FUN_L03_0020ef60(void) { } if (hero.unk90A != 0) { s32 n; - FUN_001f9770(&hero.unk90A); + fast_dec_timer_s16(&hero.unk90A); n = (s16)hero.unk90A >> 2; FUN_L00_00209a40(n > 8 ? 8 : n, 0); } @@ -555,7 +555,7 @@ void FUN_L03_0020ef60(void) { if (hero.state_timer == 1) { FUN_L00_00209ca8(3, 0x10, 0); if (D_L03_001612D0 != 0) { - FUN_L00_002a3ec8(D_L03_001612D0, D_L03_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L03_001612D0, D_L03_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, -0.3f); } hero.unk90A = scale_game_frames(70); @@ -666,7 +666,7 @@ void FUN_L03_0020ef60(void) { stick_target(1.0f, 0); turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); hero.unk8EC = hero.motion.unk184; - FUN_001f9740(&hero.unk8F4); + fast_dec_timer(&hero.unk8F4); if (hero.state.step == 1) { hero.target_speed = frame_time * 6.0f; } else if (hero.state.current == 0x35) { @@ -696,7 +696,7 @@ void FUN_L03_0020ef60(void) { if (hero.state.current != 0x35 || !(PD.u1A0.i1A0 & 0xA)) { hero.target_speed *= k; }; - if (FUN_001f9740(&hero.unk8F0) != 0) { + if (fast_dec_timer(&hero.unk8F0) != 0) { s32 lo2; s32 hi2; pl = &hero; @@ -719,7 +719,7 @@ void FUN_L03_0020ef60(void) { } pl->unk8F0 = random_int_between(lo2, scale_game_frames(hi2)); } - if (hero.state.current == 0x35 && FUN_001f9770(&hero.unk8F8) != 0) { + if (hero.state.current == 0x35 && fast_dec_timer_s16(&hero.unk8F8) != 0) { struct MobyView *gm = MV(hero.items[3].moby); if (gm != NULL && gm->hA6 == 0x261) { s32 i; @@ -757,7 +757,7 @@ void FUN_L03_0020ef60(void) { } build_spherical_offset(&hero.motion.velocity, sp, hero.motion.rot.f[2], yaw); } else if (hero.state.current == 0x34) { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); if (hero.state.prev == 0x35) { approach_value(&len, 0.0f, frame_time_sq * 8.0f); } else { @@ -805,11 +805,11 @@ void FUN_L03_0020ef60(void) { break; case 0x6A: case 0x82: { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); approach_value(&len, 0.0f, frame_time_sq * 4.0f); fast_vec_normalize(&hero.motion.unk150, &hero.motion.unk150, len); qcopy(&hero.motion.velocity, &hero.motion.unk150); - if (FUN_001f9740(&hero.unk8F0) == 2) { + if (fast_dec_timer(&hero.unk8F0) == 2) { moby_point_position(MV(hero.moby), 4, &v0); v20.q = 0; v20.f[0] = 0.4f; @@ -856,7 +856,7 @@ void FUN_L03_0020ef60(void) { } } turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); - FUN_001f9740(&hero.unk698); + fast_dec_timer(&hero.unk698); if (hero.state.current == 0x36) { if (PD.i1D4 != 0 && hero.unk698 != 0) { hero.target_speed = frame_time * 3.0f; @@ -960,7 +960,7 @@ void FUN_L03_0020ef60(void) { FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, 0.0f, frame_time * 3.8397243f); } else { f32 an = fast_add_rotations( - -fast_arc_tan(FUN_001f9b80(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); + -fast_arc_tan(vector_distance(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, an, frame_time * 6.4577184f); } v20.f[0] = fast_cos(fast_add_rotations(hero.motion.rot.f[2], -1.5707964f)) * -0.57f; @@ -1044,14 +1044,14 @@ void FUN_L03_0020ef60(void) { } if (hero.unk99C != 0) { f32 s; - if (FUN_001f9b80(&hero.motion.pos, &MV(hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { + if (vector_distance(&hero.motion.pos, &MV(hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.displacement, frame_time_sq * 40.0f); - if (hero.unk9BE != 0 && FUN_L00_00233a78(&hero.motion.velocity) > 0.0f) { + if (hero.unk9BE != 0 && gravity_z(&hero.motion.velocity) > 0.0f) { subtract_vector_xyz(&v30, &hero.motion.pos, &MV(hero.unk994)->u10.v10); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 57.0f); } } - s = FUN_001f9af0(&hero.motion.velocity) * (frame_time * 0.015f); + s = fast_vec_length(&hero.motion.velocity) * (frame_time * 0.015f); fast_vec_scale(&v30, &hero.motion.velocity, -1.0f); fast_vec_normalize(&v30, &v30, s); add_vector_xyz(&hero.motion.velocity, &hero.motion.velocity, &v30); @@ -1059,7 +1059,7 @@ void FUN_L03_0020ef60(void) { { struct MobyView *r; if (MV(hero.unk994) != NULL && (r = MV(hero.unk994)->pm78) != NULL) { - f32 len = FUN_001f9af0(&hero.motion.velocity); + f32 len = fast_vec_length(&hero.motion.velocity); if (r->fC < len) { approach_value(&len, r->fC, frame_time_sq * 15.0f); fast_vec_normalize(&hero.motion.velocity, &hero.motion.velocity, len); @@ -1080,9 +1080,9 @@ void FUN_L03_0020ef60(void) { add_vector_xyz(&v30, &MV(hero.unk994)->u10.v10, &vC0); subtract_vector_xyz(&hero.motion.velocity, &v30, &vD0); old = hero.unk9A4; - FUN_L00_0025b8c0(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); + vendor_spring(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); d = hero.unk9A4 - old; - if (FUN_001f9af0(&vC0) > hero.unk9A4) { + if (fast_vec_length(&vC0) > hero.unk9A4) { fast_vec_normalize(&vC0, &vC0, d); add_vector_xyz(&hero.motion.pos, &hero.motion.pos, &vC0); } @@ -1091,7 +1091,7 @@ void FUN_L03_0020ef60(void) { f32 mx = frame_time * 14.0f; f32 sp = vector_length_xy(&hero.motion.velocity); if (sp < mx) { - FUN_L00_0025b8c0(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); + vendor_spring(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); v30.f[0] = fast_cos(hero.unk9AC) * hero.unk9B4; v30.f[1] = fast_sin(hero.unk9AC) * hero.unk9B4; v30.f[2] = 0.0f; @@ -1108,7 +1108,7 @@ void FUN_L03_0020ef60(void) { up = hero.unk9BC == 1; } else { v30.q = hero.motion.displacement.q; - up = FUN_L00_00213350(&v30) > 0.0f; + up = forward_component(&v30) > 0.0f; } if (up) { if (moby->b53 != 0x35) { @@ -1144,12 +1144,12 @@ void FUN_L03_0020ef60(void) { mx = frame_time_sq * 70.0f; t2 = scale_game_frames(33); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk4B0); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unk4B8 = 1.0f; } } @@ -1181,7 +1181,7 @@ void FUN_L03_0020ef60(void) { } hero.target_speed = 0.0f; if (MV(hero.unkA54) != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &MV(hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &MV(hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = frame_time * 4.5f; } @@ -1222,16 +1222,16 @@ void FUN_L03_0020ef60(void) { } FUN_L00_00211870(27.0f); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 130.0f); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unkA70 = 1.0f; } - if (FUN_L00_00233a78(&hero.motion.velocity) < frame_time * -37.0f) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); + if (gravity_z(&hero.motion.velocity) < frame_time * -37.0f) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); } } break; @@ -1301,7 +1301,7 @@ void FUN_L03_0020ef60(void) { tb = &D_L03_0017BD28[hero.attack_record]; hero.target_speed = 0.0f; if (MV(hero.unkA54) != NULL && scale_game_frames(4) > hero.state_timer) { - f32 d = FUN_001f9b80(&MV(hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; + f32 d = vector_distance(&MV(hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; f32 off; f32 tol; f32 mx; @@ -1520,7 +1520,7 @@ void FUN_L03_0020ef60(void) { Vec4 *p = &hero.move_impulse; FUN_L00_002132b8(0.7f, 0.0f); v0.q = hero.move_impulse.q; - hero.target_speed += FUN_L00_00213350(&v0); + hero.target_speed += forward_component(&v0); if (hero.target_speed < frame_time * 0.7f) { hero.target_speed = frame_time * 0.7f; } @@ -1603,7 +1603,7 @@ void FUN_L03_0020ef60(void) { v10.f[2] += random_float_between(frame_time, frame_time * 2.0f); FUN_L00_00271b18(&v0, &v10, random_float_between(37800.0f, 75600.0f)); } - f = FUN_001f9af0(&hero.motion.platform_delta); + f = fast_vec_length(&hero.motion.platform_delta); if (f > frame_time * 0.5f) { hero.motion.move_yaw = fast_arc_tan(hero.motion.platform_delta.f[0], hero.motion.platform_delta.f[1]); } else { @@ -1664,10 +1664,10 @@ void FUN_L03_0020ef60(void) { hero.motion.velocity.f[2] = hero.motion.velocity.f[2] - frame_time_sq * 24.0f; break; } - FUN_L00_0025d808(hero.unk5F0, &v10, &hero.unk5F4, &hero.unk5F8, hero.unk604, hero.unk60C); + sample_path(hero.unk5F0, &v10, &hero.unk5F4, &hero.unk5F8, hero.unk604, hero.unk60C); idx = FUN_L00_0025d7a0(hero.unk5F0, hero.unk5F4, 1, hero.unk60C); subtract_vector_xyz(&v20, (Vec4 *)hero.unk5F0 + (idx + 1), &v10); - if (FUN_001f9af0(&v20) < 0.001f) { + if (fast_vec_length(&v20) < 0.001f) { if (hero.unk5F4 == idx) { hero.unk600 = scale_game_frames(1); break; @@ -1684,10 +1684,10 @@ void FUN_L03_0020ef60(void) { { f32 fl; f32 len; - fl = -FUN_001f9af0(&v20); - FUN_L00_0025b8c0(&fl, &hero.unk618.f, 0.0f, frame_scale_sq * 0.05f, frame_scale_sq * 0.3f, + fl = -fast_vec_length(&v20); + vendor_spring(&fl, &hero.unk618.f, 0.0f, frame_scale_sq * 0.05f, frame_scale_sq * 0.3f, frame_time * 10.0f); - len = FUN_001f9af0(&v20); + len = fast_vec_length(&v20); if (len < hero.unk618.f) { hero.unk618.f = len; } @@ -1785,8 +1785,8 @@ void FUN_L03_0020ef60(void) { FUN_L00_00215340(); FUN_L00_002132b8(0.7f, frame_time * 0.0f); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; case 0x77: { @@ -1798,8 +1798,8 @@ void FUN_L03_0020ef60(void) { len = vector_length_xy(&hero.motion.velocity); FUN_L00_001ff600(frame_scale * -0.100000024f * len + len, &hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; } @@ -1838,11 +1838,11 @@ void FUN_L03_0020ef60(void) { FUN_L00_00215340(); FUN_L01_00232978(1); if (big) { - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); hero.unk304 = hero.motion.velocity.f[2]; } else { - FUN_L00_0025b8c0(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, + vendor_spring(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, frame_scale_sq * 0.35f, frame_time * 2.5f); } break; @@ -1877,7 +1877,7 @@ void FUN_L03_0020ef60(void) { speed_step(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); FUN_L00_00215340(); - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); if (hero.motion.pos.f[2] < hero.unk410) { approach_value(&hero.unk410, hero.motion.pos.f[2], frame_time * 4.0f); @@ -1921,7 +1921,7 @@ void FUN_L03_0020ef60(void) { if (hero.state_timer == scale_game_frames(20)) { FUN_L00_00209ca8(3, 0x10, 1); if (D_L03_001612D0 != 0) { - FUN_L00_002a3ec8(D_L03_001612D0, D_L03_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L03_001612D0, D_L03_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, 0.35f); } } @@ -1971,7 +1971,7 @@ void FUN_L03_0020ef60(void) { qcopy(&v10, &v0); v10.f[0] += fast_cos(hero.motion.rot.f[2]) * 0.85f; v10.f[1] += fast_sin(hero.motion.rot.f[2]) * 0.85f; - if (FUN_001efa68(&v0, &v10, 4, MV(hero.moby), 0) != 0) { + if (collision_line(&v0, &v10, 4, MV(hero.moby), 0) != 0) { hero.unk4A4 = 1; } } @@ -1994,7 +1994,7 @@ void FUN_L03_0020ef60(void) { if (hero.motion.pos.f[2] < hero.unk410) { hero.unk410 = hero.motion.pos.f[2]; } - if (hero.state_timer > hero.unk420 && FUN_L00_00233a78(&hero.motion.velocity) < 0.001f && + if (hero.state_timer > hero.unk420 && gravity_z(&hero.motion.velocity) < 0.001f && (hero.unk41C == 0 || hero.state_timer > hero.unk3D4)) { hero.unk41E = 1; if (hero.unk3F8 != 0.0f) { @@ -2017,7 +2017,7 @@ void FUN_L03_0020ef60(void) { fast_vec_scale(&v10, &hero.motion.displacement, 7.0f); for (i = 0; i < n; i++) { if (FUN_L00_0025e3b8(D_L03_00178000[i]) != 0) { - FUN_L00_00259bc8(D_L03_00178000[i], MV(hero.moby), 0x10000, &hero.motion.pos, &v10, + spawn_nearby_effect(D_L03_00178000[i], MV(hero.moby), 0x10000, &hero.motion.pos, &v10, 1.0f); } } @@ -2100,7 +2100,7 @@ void FUN_L03_0020ef60(void) { } case 0x66: subtract_vector_xyz(&v0, &hero.unk1640, &hero.motion.pos); - if (FUN_001f9ab0(&v0, &hero.motion.unk150) < 0.0f) { + if (fast_vec_dot(&v0, &hero.motion.unk150) < 0.0f) { clear_u64_value(&hero.motion.unk150); } clear_u64_value(&hero.motion.velocity); diff --git a/src/overlays/l03/gameplay/hero/0021c668.c b/src/overlays/l03/gameplay/hero/0021c668.c index 6a9bf9f3ee..dda1462b87 100644 --- a/src/overlays/l03/gameplay/hero/0021c668.c +++ b/src/overlays/l03/gameplay/hero/0021c668.c @@ -48,11 +48,11 @@ extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L03_0015F638; extern float D_L03_00166ED8 __attribute__((section(".data"))); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_00208f20(float a, float b, float c, float d); extern float FUN_L00_00232b90(float a, float b, float c); -extern float FUN_L00_00233a78(float *v); +extern float gravity_z(float *v) __asm__("FUN_L00_00233a78"); extern float FUN_L00_00233c30(float *pos, float *vel, int *steps, float step); extern float FUN_L00_00266e80(int); extern float approach_value(float *p, float target, float maxstep) __asm__("FUN_00213ed8"); @@ -108,7 +108,7 @@ extern void FUN_L00_00232628(void); extern void FUN_L00_00232640(int id); extern void FUN_L00_00233288(float a, float b, short c, unsigned char d, unsigned char e, unsigned char f); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void hud_keep_visible(int, int) __asm__("FUN_L00_00235e18"); extern void FUN_L00_00237ae8(void); extern void FUN_L00_00237ba0(void); @@ -865,7 +865,7 @@ void FUN_L03_0021c668(void) { } break; case 101: - if (FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { + if (vector_distance(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { if (frame_time * 2.7f > hero.motion.speed_xy) { if (fast_difference_between_rotations( hero.motion.rot.f[2], hero.unk1640.f[3]) < 0.034906585f) { @@ -889,7 +889,7 @@ void FUN_L03_0021c668(void) { if ((hero.unkA98 & 2) || hero.unk1650 != 0) { hero_set_state(HERO_STATE_IDLE, 1); } - if (0.2f < FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f)) { + if (0.2f < vector_distance(hero.motion.pos.f, hero.unk1640.f)) { hero_set_state(0x65, 1); } break; @@ -1258,7 +1258,7 @@ void FUN_L03_0021c668(void) { if (hero_set_state(HERO_STATE_IDLE, 0)) { set_hero_animation(0xC, 9, -1.0f); } - FUN_L00_00233b20(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); + gravity_set_z(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); FUN_L00_0025f730(hero.motion.unk150.f, frame_time * 7.0f); hero.unk1C4 = scale_game_frames(7); if (hero.state.prev == 0x2D) { @@ -1767,7 +1767,7 @@ void FUN_L03_0021c668(void) { scale_game_frames(0xE) < hero.state_timer && (hero.unk41E == 0 || (hero.ground_distance > 0.7f && - absolute_float(FUN_L00_00233a78(hero.motion.velocity.f)) < + absolute_float(gravity_z(hero.motion.velocity.f)) < frame_time * 5.8f))) { hero_set_state(0xE, 1); } else if (D_0013D4C0[2] != 0 && hero_slot_item_id(3) != 4 && diff --git a/src/overlays/l03/gameplay/hero/hero_set_state.c b/src/overlays/l03/gameplay/hero/hero_set_state.c index 684e1ebe10..d7f52fabcb 100644 --- a/src/overlays/l03/gameplay/hero/hero_set_state.c +++ b/src/overlays/l03/gameplay/hero/hero_set_state.c @@ -31,7 +31,7 @@ extern float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_0020d658(int back); -extern float FUN_L00_002339d0(float *v); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float dot_vectors_xyz(void *a, void *b); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); @@ -46,7 +46,7 @@ extern int FUN_L00_00216de8(int, int); extern int stick_direction_vs_facing(void) __asm__("FUN_L00_00221df8"); extern int FUN_L00_00229a98(void); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int FUN_L00_0025d808(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); +extern int sample_path(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); extern int FUN_L01_00226f10(int a); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); @@ -69,12 +69,12 @@ extern void FUN_L00_00214ed8(float a, float b, float c); extern void FUN_L00_00216ec0(int, int, int); extern void set_hero_animation(int, int, float) __asm__("FUN_L00_002323b8"); extern void FUN_L00_002325e0(int bank, int seq); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L00_00262500(int a, char *b); extern void FUN_L00_00262528(char *o, int a, int b); extern void FUN_L00_00262840(char *o); -extern void FUN_L00_002a3ec8(void *, int, int, float, float, float, float); +extern void pool_splash(void *, int, int, float, float, float, float) __asm__("FUN_L00_002a3ec8"); extern void FUN_L01_002405a0(void); extern void fill_transfer_words(void *, int, int) __asm__("func_001F97E8"); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); @@ -299,7 +299,7 @@ int hero_set_state(int a, int b) { if (p->state.prev_control_mode == 0x11) { FUN_L00_00209ca8(3, 0xA, 0); if (D_L03_001612D0 != 0) { - FUN_L00_002a3ec8(D_L03_001612D0, D_L03_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L03_001612D0, D_L03_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.4f, 0.3f); } } else if (p->motion.displacement.f[2] < frame_time * -0.5f) { @@ -309,7 +309,7 @@ int hero_set_state(int a, int b) { v = 0x28; FUN_L00_00209ca8(3, v, 1); if (D_L03_001612D0 != 0) { - FUN_L00_002a3ec8(D_L03_001612D0, D_L03_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L03_001612D0, D_L03_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.5f, -0.4f); } p->unk90A = scale_game_frames(0x4B); @@ -623,7 +623,7 @@ int hero_set_state(int a, int b) { char *v = (char *)&p->motion.unk110; p->state.control_mode = 1; p->unk2284 = 0; - p->ground_speed = FUN_L00_002339d0((float *)v); + p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.unk150, v); if (b) { int id = 6; @@ -810,7 +810,7 @@ int hero_set_state(int a, int b) { p->unk618.i = 0; seg = p->unk5F4; t = p->unk5F8; - FUN_L00_0025d808(((int *)p->unk5F0), pos, &seg, &t, p->unk60C, 1.0f); + sample_path(((int *)p->unk5F0), pos, &seg, &t, p->unk60C, 1.0f); subtract_vector_xyz(vec, pos, &p->motion.pos); if (0.001f < vector_length_xyz(vec)) { normalize_vector_xyz(vec, vec, 1.0f); @@ -1046,7 +1046,7 @@ int hero_set_state(int a, int b) { u->unk48C = 1.98f; u->unk430 = 1.95f; } else { - FUN_L00_00233b20((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); + gravity_set_z((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); u->unk41C = 1; u->unk3D0 = scale_game_frames(2); u->unk3D4 = scale_game_frames(0x23) + u->unk3D0; diff --git a/src/overlays/l03/gameplay/vendor/002df520.c b/src/overlays/l03/gameplay/vendor/002df520.c index 285b1a83b9..f2ebad7497 100644 --- a/src/overlays/l03/gameplay/vendor/002df520.c +++ b/src/overlays/l03/gameplay/vendor/002df520.c @@ -42,7 +42,7 @@ extern u8 D_0013D4C0[]; extern s32 is_point_inside_clip_volume(void *point, s32 volume) __asm__("FUN_00214720"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 tick_countdown(s32 *) __asm__("FUN_001f9740"); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern s32 help_request(s32, s32) __asm__("FUN_L00_00203908"); extern s32 get_ammo(s32) __asm__("FUN_L00_00233e98"); extern s32 allocate_voice_for_bank_entry(s32, s32, s32) __asm__("FUN_0022db10"); @@ -118,7 +118,7 @@ void FUN_L03_002df520(u8 *moby) { count = 0; for (m = D_L03_0015FFE4; m != 0; m = m->next) { if (m->pclass != 0 && *(s16 *)((u8 *)m->pclass + 0x46) == 5 && - FUN_001f9b80(&m->pos, &hero.motion.pos) < 8.0f) { + vector_distance(&m->pos, &hero.motion.pos) < 8.0f) { count++; } } @@ -228,7 +228,7 @@ struct L03Cutscene { }; extern struct L03Cutscene D_L03_0016C960; -extern void FUN_L00_002637f8(void *); +extern void cutscene_set_camera_target(void *) __asm__("FUN_L00_002637f8"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); @@ -258,7 +258,7 @@ void FUN_L03_002e01d0(char *m) { i = 2; else if (v == 10) i = 0; - FUN_L00_002637f8(D_L03_0016C960.mobys[i]); + cutscene_set_camera_target(D_L03_0016C960.mobys[i]); } if (D_L03_0015F5C4 != 2 || D_L03_0016C960.mode != 3) break; diff --git a/src/overlays/l03/gameplay/vendor/002e2948.c b/src/overlays/l03/gameplay/vendor/002e2948.c index 5c6aa3414d..19d88894bb 100644 --- a/src/overlays/l03/gameplay/vendor/002e2948.c +++ b/src/overlays/l03/gameplay/vendor/002e2948.c @@ -13,7 +13,8 @@ extern void FUN_L01_002787a0(void *); extern void FUN_L01_00278e20(void *, int); void mark_moby_for_removal(struct Obj *obj) __asm__("FUN_0020c828"); -void FUN_L03_002e2948(struct Moby *m) { +void lightpost_update(struct Moby *m) __asm__("FUN_L03_002e2948"); +void lightpost_update(struct Moby *m) { int hit = 0; char *r = find_moby_hit(m, 0x10000, 0); switch (m->state) { diff --git a/src/overlays/l03/math/rotations/rotate_point_about_axis.c b/src/overlays/l03/math/rotations/rotate_point_about_axis.c index 147f9bcf76..14a3c2fd0f 100644 --- a/src/overlays/l03/math/rotations/rotate_point_about_axis.c +++ b/src/overlays/l03/math/rotations/rotate_point_about_axis.c @@ -14,6 +14,7 @@ extern void matrix_to_euler(void *, void *) __asm__("FUN_00214598"); /* Rotates a point (in place) about a unit axis by angle using a Rodrigues-style * matrix: skew = cross-product matrix of axis, sin_part = sin*skew, * cos_part = (1-cos)*skew^2; cos_part is then reused as the identity matrix. */ +void FUN_L03_0024fba8(Q *axis, Q *point, float angle); void FUN_L03_0024fba8(Q *axis, Q *point, float angle) { float axis_v[4] __attribute__((aligned(16))); float point_v[4] __attribute__((aligned(16))); diff --git a/src/overlays/l03/rendering/view/0024e830.c b/src/overlays/l03/rendering/view/0024e830.c index 1f3fac4e86..ab1899149a 100644 --- a/src/overlays/l03/rendering/view/0024e830.c +++ b/src/overlays/l03/rendering/view/0024e830.c @@ -12,6 +12,7 @@ extern float FUN_001f9b80_25fcb8(void *, void *) __asm__("FUN_001f9b80"); extern short D_L03_001B0930[] __attribute__((section(".data"))); extern char *D_L03_001D1680[] __attribute__((section(".data"))); extern struct Hero hero_lui __asm__("D_0013F350") __attribute__((section(".data"))); +int FUN_L03_0024e830(char *a, char *o, float best); int FUN_L03_0024e830(char *a, char *o, float best) { struct Hero *g = &hero_lui; char *m; diff --git a/src/overlays/l03/runtime/startup/0022c728.c b/src/overlays/l03/runtime/startup/0022c728.c index 9b35748f23..b4b5a6d0a3 100644 --- a/src/overlays/l03/runtime/startup/0022c728.c +++ b/src/overlays/l03/runtime/startup/0022c728.c @@ -49,3 +49,5 @@ void FUN_L03_0022c728(void) { random_int_between(scale_game_frames(12), scale_game_frames(35))); } } + +s32 D_L03_0016CAE4[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/l04/gameplay/entities/001f3038.c b/src/overlays/l04/gameplay/entities/001f3038.c index f7a938d899..3f4bea0007 100644 --- a/src/overlays/l04/gameplay/entities/001f3038.c +++ b/src/overlays/l04/gameplay/entities/001f3038.c @@ -77,7 +77,7 @@ extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern int coll_line_fix() __asm__("FUN_001efa68"); extern int fast_dec_timer_s16() __asm__("FUN_001f9770"); extern int set_vector_length_xy() __asm__("FUN_001f9c48"); -extern int FUN_L00_001f0d60(float, void *, int, void *); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); extern void add_vector_xyz_c(void *, void *, void *) __asm__("FUN_001f9a10"); extern void clear_u64_value(void *) __asm__("func_001F99F8"); @@ -333,10 +333,11 @@ void FUN_L04_001f30e0(Moby **others, int other_count, Moby *moby, Steer_1F3010 * extern s32 D_L04_00173FF0[]; extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); -extern int FUN_L00_001f0d60(float, void *, int, void *); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern void add_vector_xyz(void *, void *, void *); extern void normalize_vector_xyz(void *, void *, float); +void FUN_L04_001f3a80(char *a, char *b, char *c, float f); void FUN_L04_001f3a80(char *a, char *b, char *c, float f) { int i; float v[4]; @@ -348,7 +349,7 @@ void FUN_L04_001f3a80(char *a, char *b, char *c, float f) { for (i = 0; i < 6; i++) { qcopy(v, a + 0x10); v[2] = v[2] + f; - if (FUN_L00_001f0d60(*(float *)(c + 0x10) * 0.25f, v, 4, a)) { + if (coll_sphere(*(float *)(c + 0x10) * 0.25f, v, 4, a)) { qcopy(a + 0x10, D_L04_00173FF0); *(float *)(a + 0x18) = *(float *)(a + 0x18) - f; } else { diff --git a/src/overlays/l04/gameplay/entities/0024c4f0.c b/src/overlays/l04/gameplay/entities/0024c4f0.c index 1bf298d437..60f6062654 100644 --- a/src/overlays/l04/gameplay/entities/0024c4f0.c +++ b/src/overlays/l04/gameplay/entities/0024c4f0.c @@ -75,7 +75,7 @@ float FUN_L04_0024c660(float *dst, float *a, float *b, float *c) { extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern int FUN_L04_0024c4f0(float *, float *, int); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void FUN_L04_0024c660_u(float *, float *, float *, float *) __asm__("FUN_L04_0024c660"); int FUN_L04_0024c7d8(float *out, float *p, float *poly, int n) { @@ -88,7 +88,7 @@ int FUN_L04_0024c7d8(float *out, float *p, float *poly, int n) { for (i = 0; i < n; i++) { float d; FUN_L04_0024c660_u(tmp, poly + i * 4, poly + ((i + 1) % n) * 4, p); - FUN_001f9a28(diff, p, tmp); + fast_vec_sub(diff, p, tmp); d = fast_vec_length(diff); if (i == 0 || d < best) { best = d; diff --git a/src/overlays/l04/gameplay/entities/big_axebot.c b/src/overlays/l04/gameplay/entities/big_axebot.c index 1cc8a44f25..9309915683 100644 --- a/src/overlays/l04/gameplay/entities/big_axebot.c +++ b/src/overlays/l04/gameplay/entities/big_axebot.c @@ -16,7 +16,7 @@ extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern s32 rand(); -extern void FUN_0020e098(void *); +extern void refresh_moby_spatial_bounds_from_basis(void *) __asm__("FUN_0020e098"); void blend_moby_animation_u(MobyAnim *moby, int new_seq, int frame_index, int blend_frames) __asm__("FUN_00212f90"); void FUN_L04_002a5a08(struct Moby *m) { @@ -34,7 +34,7 @@ void FUN_L04_002a5a08(struct Moby *m) { blend_moby_animation_u(m, 0, 0, (void *)scale_game_frames(3)); } *d = *d - 1; - FUN_0020e098(m); + refresh_moby_spatial_bounds_from_basis(m); } } #define NOT_SDA @@ -59,22 +59,22 @@ void FUN_L04_002ba3e0(char *arg, void *a, void *b, void *c) { extern void clear_u64_value(float *) __asm__("FUN_001f99f8"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, int, float, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); void FUN_L04_002ba470(char *moby) { float w[4]; float v[4]; clear_u64_value(v); moby_point_position(moby, 6, w); - FUN_L00_0025e450(moby, v, w, 0.0f, 0.0f, 10, 3, 4, 2.0f, 1.0f, 100000.0f, -1, 1.5f, 15.0f, 1, 1, + spawn_explosion(moby, v, w, 0.0f, 0.0f, 10, 3, 4, 2.0f, 1.0f, 100000.0f, -1, 1.5f, 15.0f, 1, 1, -1, 0); } /* Check that a moby's spot is clear of the other mobys of class 0x154. */ /* Ported from rac1-decomp (src/overlays/l04_eudora/vendor_0029FCF0.c: func_L04_002C3218), where it is exact; names translated to the US level program. */ extern char *D_L04_0015FFE4; -extern float FUN_001f9b80(float *, float *); +extern float vector_distance(float *, float *) __asm__("FUN_001f9b80"); extern void FUN_L00_0025fcb8(char *, float *, float); int FUN_L04_002c1e98(struct Moby *moby) { @@ -94,11 +94,11 @@ int FUN_L04_002c1e98(struct Moby *moby) { s = *(float *)(data + 0x140); } FUN_L00_0025fcb8(moby, vec, s); - d0 = FUN_001f9b80((float *)&moby->pos, vec); + d0 = vector_distance((float *)&moby->pos, vec); for (o = D_L04_0015FFE4; o != 0; o = *(char **)(o + 0x28)) { if (o != moby && *(short *)(o + 0xA6) == 0x154) { float *q = (float *)(o + 0x10); - if (FUN_001f9b80((float *)&moby->pos, q) < 3.0f || FUN_001f9b80(q, vec) < d0) { + if (vector_distance((float *)&moby->pos, q) < 3.0f || vector_distance(q, vec) < d0) { return 0; } } @@ -130,11 +130,11 @@ typedef struct { Vec4 point[1]; } PathPoints_eb20; -extern void FUN_001f9a28(Vec4 *out, void *a, void *b); +extern void fast_vec_sub(Vec4 *out, void *a, void *b) __asm__("FUN_001f9a28"); extern f32 fast_vec_length(Vec4 *v) __asm__("FUN_001f9af0"); extern void fast_vec_normalize(Vec4 *out, Vec4 *v, f32 len) __asm__("FUN_001f9bf8"); extern f32 fast_vec_dot(Vec4 *a, Vec4 *b) __asm__("FUN_001f9ab0"); -extern void FUN_001f9a10(Vec4 *out, Vec4 *a, Vec4 *b); +extern void fast_vec_add(Vec4 *out, Vec4 *a, Vec4 *b) __asm__("FUN_001f9a10"); static inline s32 path_next_eb20(PathPoints_eb20 *path, s32 i, s32 dir) { if (i == path->count - 1) { @@ -154,20 +154,20 @@ s32 FUN_L04_0029eb20(struct Moby *m, PathPoints_eb20 *path, s32 i, s32 dir, f32 f32 along; next = path_next_eb20(path, i, dir); - FUN_001f9a28(&seg, &path->point[next], &path->point[i]); + fast_vec_sub(&seg, &path->point[next], &path->point[i]); len = fast_vec_length(&seg); fast_vec_normalize(&seg, &seg, 1.0f); - FUN_001f9a28(&rel, &m->pos, &path->point[i]); + fast_vec_sub(&rel, &m->pos, &path->point[i]); along = fast_vec_dot(&rel, &seg) + dist; if (len < along) { i = next; next = path_next_eb20(path, i, dir); - FUN_001f9a28(&seg, &path->point[next], &path->point[i]); + fast_vec_sub(&seg, &path->point[next], &path->point[i]); along = along - len; fast_vec_normalize(&seg, &seg, 1.0f); } fast_vec_normalize(&seg, &seg, along); - FUN_001f9a10(&m->pos, &seg, &path->point[i]); + fast_vec_add(&m->pos, &seg, &path->point[i]); return i; } extern void *memset(void *, int, int) __asm__("FUN_001153fc"); @@ -182,7 +182,7 @@ extern f32 random_float_between_29ecf8(f32, f32) __asm__("FUN_002132a8"); extern f32 random_angle_29ecf8(void) __asm__("FUN_00213308"); extern void update_spawned_moby_29ecf8(struct Moby *) __asm__("FUN_L00_00250df8"); extern void FUN_L04_001f30e0(void *, s32, struct Moby *, void *, void *); -extern void apply_child_motion_29ecf8(f32, struct Moby *, void *, void *) __asm__("FUN_L04_001f3a80"); +extern void FUN_L04_001f3a80(f32, struct Moby *, void *, void *); extern PathPoints_eb20 *D_L04_001b0630[]; f32 D_L04_00166130[8] __attribute__((section(".bss"))); extern s32 D_L04_001513C0 __attribute__((sda)); @@ -325,7 +325,7 @@ void FUN_L04_0029ecf8(struct Moby *moby) { D_L04_00166130[6] = ((data->radius * 7.753f) / 1800.0f) * frame_scale * ((child->anim_speed + 1.0f) * 0.5f) * 0.05f * frame_scale_sq * ((child->anim_speed + 1.0f) * 0.5f); D_L04_00166130[7] = (((data->radius * 7.753f) / 1800.0f) * frame_scale) * ((child->anim_speed + 1.0f) * 0.5f); FUN_L04_001f30e0(children, data->count, child, part, D_L04_00166130); - apply_child_motion_29ecf8(0.0f, child, part, D_L04_00166130); + FUN_L04_001f3a80(0.0f, child, part, D_L04_00166130); } } } @@ -489,8 +489,8 @@ extern float D_L04_0015F580[] __attribute__((section(".sdata"))); extern float D_L04_00166F40[4]; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(float *, float *); -extern float FUN_001f9e90(float, float); +extern float vector_distance(float *, float *) __asm__("FUN_001f9b80"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float FUN_L00_00259bc8_cf(float) __asm__("FUN_001f99c0"); extern float add_vector_xyz_cf(float) __asm__("FUN_001f9de0"); extern float compute_interpolated_record_value(void *) __asm__("FUN_0020c9e0"); @@ -502,7 +502,7 @@ extern float fast_subtract_rotations_cf(float, float) __asm__("FUN_001fa580"); extern float probe_ground_height(void *, int, float) __asm__("FUN_00213508"); extern int absolute_float_cf(void *, void *, int) __asm__("FUN_L00_00259740"); extern int D_L04_0015F5C4; -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_001fefc8(void *); extern int FUN_L00_00258110_cf(void *arg0, int arg1) __asm__("FUN_00214720"); extern int hit_reaction(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_L00_0025a478"); @@ -528,14 +528,14 @@ extern void FUN_L00_00257470(void *, int, int); extern void FUN_L00_00258490_cf(void *, void *, void *) __asm__("FUN_001f9a10"); extern void FUN_L00_00259740_cf(void *, void *, float, float, float) __asm__("FUN_L04_00295778"); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025ab48(void *, float *, void *, void *); -extern void FUN_L00_0025c558(float, void *, void *, int, int, int); +extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(float, void *, void *, int, int, int) __asm__("FUN_L00_0025c558"); extern void FUN_L00_0025c698_cf(void *, float, float, float) __asm__("FUN_00214db0"); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern void FUN_L00_0025fcb8(char *, float *, float); extern void FUN_L00_00263ac8(float, int, int, unsigned char *); -extern void FUN_L03_00250a78(float *p, float a, float b); +extern void trooper_set_knockback(float *p, float a, float b) __asm__("FUN_L03_00250a78"); extern void FUN_L04_00295778_cf(void *, void *) __asm__("FUN_L04_00295de8"); extern void FUN_L04_002ba448_c(void *, float) __asm__("FUN_L04_002ba448"); extern void advance_moby_animation(void *); @@ -551,7 +551,8 @@ extern void tick_countdown_32(int *counter); void FUN_L04_002ba3e0(char *arg, void *a, void *b, void *c); extern P_B7B0 *D_L04_001B0930_B7B0[] __asm__("D_L04_001B0630"); -void FUN_L04_002ba520(M_B7B0 *moby) { +void big_axebot_update(M_B7B0 *moby) __asm__("FUN_L04_002ba520"); +void big_axebot_update(M_B7B0 *moby) { D_B7B0 *data = moby->data; T_B7B0 tg; V4_B7B0 prev; @@ -578,8 +579,8 @@ void FUN_L04_002ba520(M_B7B0 *moby) { FUN_L00_0025fcb8((char *)moby, (float *)&tg, flag ? data->f43C * 2.0f : data->f43C); tgt = tg.f40; rot = moby->rot[2]; - dist = FUN_001f9b80(moby->pos, (float *)&tg); - ang = FUN_001f9e90(tg.pos[0] - moby->pos[0], tg.pos[1] - moby->pos[1]); + dist = vector_distance(moby->pos, (float *)&tg); + ang = fast_arc_tan(tg.pos[0] - moby->pos[0], tg.pos[1] - moby->pos[1]); hd = compute_interpolated_record_value(moby); if (D_L04_0015F5C4 == 2) { moby->f34 |= 0x41; @@ -601,7 +602,7 @@ void FUN_L04_002ba520(M_B7B0 *moby) { moby->f7F = 0x1A; } } - FUN_001f9770(&data->f404); + fast_dec_timer_s16(&data->f404); if (moby->state != 10 && moby->state != 0) { int tmp; float dmg; @@ -616,14 +617,14 @@ void FUN_L04_002ba520(M_B7B0 *moby) { if (hit->att != 0) { struct Hero *h = &hero; if (hit->att != h->items[0].moby) { - ang2 = FUN_001f9e90(moby->pos[0] - hit->att->pos[0], + ang2 = fast_arc_tan(moby->pos[0] - hit->att->pos[0], moby->pos[1] - hit->att->pos[1]); } else { - ang2 = FUN_001f9e90(moby->pos[0] - h->motion.pos.f[0], moby->pos[1] - h->motion.pos.f[1]); + ang2 = fast_arc_tan(moby->pos[0] - h->motion.pos.f[0], moby->pos[1] - h->motion.pos.f[1]); } } else { struct Hero *h = &hero; - ang2 = FUN_001f9e90(moby->pos[0] - h->motion.pos.f[0], moby->pos[1] - h->motion.pos.f[1]); + ang2 = fast_arc_tan(moby->pos[0] - h->motion.pos.f[0], moby->pos[1] - h->motion.pos.f[1]); } data->fD4 = frame_time_sq * 12.0f; data->fD0 = frame_time_sq * 35.0f; @@ -640,7 +641,7 @@ void FUN_L04_002ba520(M_B7B0 *moby) { } data->f448 = scale_game_frames(0x1E); data->fB7 = 0x78; - FUN_L00_0025d458(moby, (short *)data->fB0); + trooper_anim_update(moby, (short *)data->fB0); } else { switch (r) { case 0: @@ -662,7 +663,7 @@ void FUN_L04_002ba520(M_B7B0 *moby) { } data->f42C = 3.4f / multiply_global_factor_ed64(7.0f) * 0.5f; data->fB7 = 0x78; - FUN_L00_0025d458(moby, (short *)data->fB0); + trooper_anim_update(moby, (short *)data->fB0); data->f404 = scale_game_frames(0x46); data->f406 = scale_game_frames(0xF0); break; @@ -676,12 +677,12 @@ void FUN_L04_002ba520(M_B7B0 *moby) { FUN_L04_002ba3e0((char *)moby, (void *)5, 0, (void *)scale_game_frames(6)); FUN_L04_002ba448_c(moby, 2.0f); moby->state = 8; - FUN_L00_0025c558(ang2, moby, data->fC0, 5, 1, 0); + trooper_start_knockback(ang2, moby, data->fC0, 5, 1, 0); data->f110 = 5.0f; data->f114 = 10.0f; data->f42C = 3.4f / multiply_global_factor_ed64(7.0f); data->fB7 = 0x78; - FUN_L00_0025d458(moby, (short *)data->fB0); + trooper_anim_update(moby, (short *)data->fB0); data->f404 = scale_game_frames(0x46); data->f406 = scale_game_frames(0xF0); break; @@ -694,22 +695,22 @@ void FUN_L04_002ba520(M_B7B0 *moby) { moby->state = 1; data->f42C = 3.4f / multiply_global_factor_ed64(7.0f); data->fB7 = 0x78; - FUN_L00_0025d458(moby, (short *)data->fB0); + trooper_anim_update(moby, (short *)data->fB0); data->f404 = scale_game_frames(0x46); data->f406 = scale_game_frames(0xF0); break; case 1: data->fE8 = 1.0f; data->fE0 = 0x400; - FUN_L03_00250a78(data->fC0, 5.7f, 4.0f); + trooper_set_knockback(data->fC0, 5.7f, 4.0f); *(OvlQuad *)v = *(OvlQuad *)hit->pos; - FUN_L00_0025ab48(v, &ang2, &data->fD8, &data->fDC); - FUN_L00_0025c558(ang2, moby, data->fC0, 7, 1, 0); + trooper_knockback_arc(v, &ang2, &data->fD8, &data->fDC); + trooper_start_knockback(ang2, moby, data->fC0, 7, 1, 0); data->f110 = 12.0f; data->f114 = 25.0f; moby->state = 10; data->fB7 = 0x78; - FUN_L00_0025d458(moby, (short *)data->fB0); + trooper_anim_update(moby, (short *)data->fB0); FUN_L00_00257470(moby, 0, -1); break; case 2: @@ -734,7 +735,7 @@ void FUN_L04_002ba520(M_B7B0 *moby) { attach_manipulator_cf(moby); return; } - FUN_001f9770(&data->f402); + fast_dec_timer_s16(&data->f402); switch (moby->state) { case 0: data->hp = 3.0f; @@ -845,7 +846,7 @@ void FUN_L04_002ba520(M_B7B0 *moby) { FUN_L04_002ba3e0((char *)moby, (void *)4, (void *)4, (void *)scale_game_frames(0xC)); moby->state = 7; } - if (FUN_001f9b80(path->pts[data->f438], moby->pos) < 1.0f) { + if (vector_distance(path->pts[data->f438], moby->pos) < 1.0f) { data->f438++; if (data->f438 == path->count) { if (flag ? data->f43C * 2.0f < dist : data->f43C < dist) { @@ -857,7 +858,7 @@ void FUN_L04_002ba520(M_B7B0 *moby) { break; } } - a = FUN_001f9e90(path->pts[data->f438][0] - moby->pos[0], + a = fast_arc_tan(path->pts[data->f438][0] - moby->pos[0], path->pts[data->f438][1] - moby->pos[1]); moby->rot[2] = fast_cos_cf(moby->rot[2], a, &data->f410, frame_time_sq * 12.566371f, frame_time_sq * 6.2831855f, frame_time * 3.1415927f); @@ -907,12 +908,12 @@ void FUN_L04_002ba520(M_B7B0 *moby) { moby->fBC &= ~8; FUN_L04_00295778_cf(moby, data->f1A0); } - a = FUN_001f9e90(data->home[0] - moby->pos[0], data->home[1] - moby->pos[1]); + a = fast_arc_tan(data->home[0] - moby->pos[0], data->home[1] - moby->pos[1]); data->f414 = fast_cos_cf(moby->rot[2], a, &data->f410, frame_time_sq * 6.2831855f, frame_time_sq * 125.663704f, frame_time * 12.566371f); FUN_L00_00259740_cf(moby, data->f1A0, frame_time * 4.0f, data->f414, frame_time_sq * 20.0f); - if (FUN_001f9b80(moby->pos, data->home) < 2.0f) { + if (vector_distance(moby->pos, data->home) < 2.0f) { moby->state = 1; } if (data->f41C != -1) { @@ -938,7 +939,7 @@ void FUN_L04_002ba520(M_B7B0 *moby) { if (moby->f52 == moby->f53 && compute_interpolated_record_value(moby) >= 17.0f && compute_interpolated_record_value(moby) < 20.0f && FUN_L00_00259bc8_cf(moby->pos[2] - tg.pos[2]) < 2.0f && - FUN_001f9b80(moby->pos, (float *)&tg) < 4.5f) { + vector_distance(moby->pos, (float *)&tg) < 4.5f) { float p[4]; v[0] = fast_sin_cf(ang) * 0.2f; @@ -1006,7 +1007,7 @@ void FUN_L04_002ba520(M_B7B0 *moby) { moby->fBC = (moby->fBC | 8) & ~0x10; FUN_L04_002ba3e0((char *)moby, (void *)9, 0, (void *)scale_game_frames(0xC)); } else if (moby->fBC & 0x10) { - float a = FUN_001f9e90(data->home[0] - moby->pos[0], data->home[1] - moby->pos[1]); + float a = fast_arc_tan(data->home[0] - moby->pos[0], data->home[1] - moby->pos[1]); moby->rot[2] = fast_cos_cf(moby->rot[2], a, &data->f410, frame_time_sq * 3.1415927f, frame_time_sq * 6.2831855f, frame_time * 4.1887903f); @@ -1033,13 +1034,13 @@ void FUN_L04_002ba520(M_B7B0 *moby) { } break; } - FUN_L00_0025d538(moby, data->fB0); + trooper_anim_finish(moby, data->fB0); if (data->f42C > 0.0f) { struct Hero *h = &hero; - v[0] = fast_sin_cf(FUN_001f9e90(moby->pos[0] - h->motion.pos.f[0], moby->pos[1] - h->motion.pos.f[1])) * + v[0] = fast_sin_cf(fast_arc_tan(moby->pos[0] - h->motion.pos.f[0], moby->pos[1] - h->motion.pos.f[1])) * data->f42C; - v[1] = add_vector_xyz_cf(FUN_001f9e90(moby->pos[0] - h->motion.pos.f[0], moby->pos[1] - h->motion.pos.f[1])) * + v[1] = add_vector_xyz_cf(fast_arc_tan(moby->pos[0] - h->motion.pos.f[0], moby->pos[1] - h->motion.pos.f[1])) * data->f42C; v[2] = 0.0f; FUN_L00_00258490_cf(v, v, moby->pos); @@ -1249,20 +1250,20 @@ float FUN_L04_002c1fb8(struct Moby *moby, void *out, float speed) { speed = *(float *)(data + 0x140); } func_L00_00260D30_k(moby, target, speed); - target_dist = FUN_001f9b80((float *)&moby->pos, target); + target_dist = vector_distance((float *)&moby->pos, target); clear_u64_value_c(out); is_closest = 1; other = D_L04_0015FFE4; weight = 0.0f; for (; other != 0; other = *(char **)(other + 0x28)) { if (other == moby || *(short *)(other + 0xA6) != moby->oclass) continue; - if (FUN_001f9b80((float *)(other + 0x10), (float *)&moby->pos) < 3.0f) { + if (vector_distance((float *)(other + 0x10), (float *)&moby->pos) < 3.0f) { subtract_vector_xyz_c(away, &moby->pos, other + 0x10); scale_vector_xyz(away, away, D_L04_00161884); add_vector_xyz_c(out, out, away); weight += D_L04_00161884; } - if (FUN_001f9b80((float *)(other + 0x10), target) < target_dist) is_closest = 0; + if (vector_distance((float *)(other + 0x10), target) < target_dist) is_closest = 0; } if (!is_closest) { float offset_dir; @@ -1282,11 +1283,11 @@ float FUN_L04_002c1fb8(struct Moby *moby, void *out, float speed) { } else { qcopy(out, target); } - if (FUN_001f9b80((float *)&moby->pos, (float *)out) < 1.0f) { + if (vector_distance((float *)&moby->pos, (float *)out) < 1.0f) { qcopy(out, &moby->pos); - return FUN_001f9e90(target[0] - moby->pos.x, target[1] - moby->pos.y); + return fast_arc_tan(target[0] - moby->pos.x, target[1] - moby->pos.y); } - return FUN_001f9e90(((float *)out)[0] - moby->pos.x, ((float *)out)[1] - moby->pos.y); + return fast_arc_tan(((float *)out)[0] - moby->pos.x, ((float *)out)[1] - moby->pos.y); } #define NOT_SDA @@ -1471,8 +1472,8 @@ extern float convert_integer_to_float(int) __asm__("func_001FA6C0"); extern float D_L04_00166F40[4]; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(float *, float *); -extern float FUN_001f9e90(float, float); +extern float vector_distance(float *, float *) __asm__("FUN_001f9b80"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L04_002c1fb8_u(void *, void *, float) __asm__("FUN_L04_002c1fb8"); extern float compute_interpolated_record_value(void *) __asm__("FUN_0020c9e0"); @@ -1483,7 +1484,7 @@ extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float probe_ground_height(void *, int, float) __asm__("FUN_00213508"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); extern float wrap_angle(float); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int collect_mobies_in_sphere(void *, int, void *, void *, float) __asm__("FUN_L00_001f2868"); extern int FUN_L00_001fefc8(void *); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); @@ -1500,8 +1501,8 @@ extern struct Path5BD0 *D_L04_001B0630[]; extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); extern void FUN_L00_00258278(char *moby, float *vel, float target, float k, float d, float max); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern void FUN_L00_0025fcb8(char *, float *, float); extern void FUN_L00_00261630(char *moby, char *d, float a, float b); extern void FUN_L00_00263ac8(float, int, int, unsigned char *); @@ -1523,7 +1524,8 @@ extern void func_L00_002592B0_b(char *moby, float target, float *vel, float k, f float max) __asm__("FUN_L00_00258278"); extern P_35F0 *D_L04_001B0930_2C35F0[] __asm__("D_L04_001B0630"); -void FUN_L04_002c2270(M_35F0 *moby) { +void circular_saw_enemy_update(M_35F0 *moby) __asm__("FUN_L04_002c2270"); +void circular_saw_enemy_update(M_35F0 *moby) { D_35F0 *data = moby->data; T_35F0 tg; V4_35F0 prev; @@ -1548,7 +1550,7 @@ void FUN_L04_002c2270(M_35F0 *moby) { FUN_L00_0025fcb8((char *)moby, (float *)&tg, flag ? data->f140 * 2.0f : data->f140); tgt = tg.f40; hd = compute_interpolated_record_value(moby); - dist = FUN_001f9b80(moby->pos, (float *)&tg); + dist = vector_distance(moby->pos, (float *)&tg); qcopy(prev, moby->pos); qcopy(dest, moby->pos); moby->f30 = 0x20; @@ -1576,14 +1578,14 @@ void FUN_L04_002c2270(M_35F0 *moby) { if (hit->att != 0) { struct Hero *h = &hero; if (hit->att != h->items[0].moby) { - ang = FUN_001f9e90(moby->pos[0] - hit->att->pos[0], + ang = fast_arc_tan(moby->pos[0] - hit->att->pos[0], moby->pos[1] - hit->att->pos[1]); } else { - ang = FUN_001f9e90(moby->pos[0] - h->motion.pos.f[0], moby->pos[1] - h->motion.pos.f[1]); + ang = fast_arc_tan(moby->pos[0] - h->motion.pos.f[0], moby->pos[1] - h->motion.pos.f[1]); } } else { struct Hero *h = &hero; - ang = FUN_001f9e90(moby->pos[0] - h->motion.pos.f[0], moby->pos[1] - h->motion.pos.f[1]); + ang = fast_arc_tan(moby->pos[0] - h->motion.pos.f[0], moby->pos[1] - h->motion.pos.f[1]); } data->fD0 = 0.008f; data->fD4 = 0.0005f; @@ -1620,10 +1622,10 @@ void FUN_L04_002c2270(M_35F0 *moby) { moby->state = 6; moby->rot = fast_add_rotations(3.1415927f, ang); data->fB7 = 0x78; - FUN_L00_0025d458(moby, (short *)data->fB0); + trooper_anim_update(moby, (short *)data->fB0); data->f14D = scale_game_frames(0x14); data->fB7 = 0x78; - FUN_L00_0025d458(moby, (short *)data->fB0); + trooper_anim_update(moby, (short *)data->fB0); data->f14D = scale_game_frames(0x14); break; case 7: @@ -1640,7 +1642,7 @@ void FUN_L04_002c2270(M_35F0 *moby) { data->f136 = scale_game_frames(0xF0); } data->f38 = 0; - FUN_001f9770(&data->f136); + fast_dec_timer_s16(&data->f136); if (moby->state == 7 && moby->f52 == 7 && hd > 15.0f && hd < 44.0f) { int i; for (i = 0; i < 4; i++) { @@ -1677,7 +1679,7 @@ void FUN_L04_002c2270(M_35F0 *moby) { mark_moby_for_removal(moby); return; } - FUN_001f9770(&data->f146); + fast_dec_timer_s16(&data->f146); switch (moby->state) { case 0: { float k; @@ -1737,7 +1739,7 @@ void FUN_L04_002c2270(M_35F0 *moby) { blend_moby_animation(moby, (void *)6, 0, (void *)scale_game_frames(10)); data->f146 = scale_game_frames(0x3C); } - ta = FUN_001f9e90(tg.pos[0] - moby->pos[0], tg.pos[1] - moby->pos[1]); + ta = fast_arc_tan(tg.pos[0] - moby->pos[0], tg.pos[1] - moby->pos[1]); if (dist < 2.0f && data->f146 == 0 && FUN_L04_002c1e98((char *)moby) != 0) { blend_moby_animation(moby, (void *)7, 0, (void *)scale_game_frames(10)); data->f146 = scale_game_frames(0x3C); @@ -1776,7 +1778,7 @@ void FUN_L04_002c2270(M_35F0 *moby) { } } else if (flag == 0) { qcopy(dest, data->f120); - if (FUN_001f9b80(moby->pos, data->f120) < 1.0f) { + if (vector_distance(moby->pos, data->f120) < 1.0f) { blend_moby_animation(moby, 0, 0, (void *)scale_game_frames(10)); moby->state = 1; } @@ -1799,7 +1801,7 @@ void FUN_L04_002c2270(M_35F0 *moby) { blend_moby_animation(moby, (void *)6, 0, (void *)scale_game_frames(10)); data->f146 = scale_game_frames(0x3C); } - ta = FUN_001f9e90(tg.pos[0] - moby->pos[0], tg.pos[1] - moby->pos[1]); + ta = fast_arc_tan(tg.pos[0] - moby->pos[0], tg.pos[1] - moby->pos[1]); if (dist < 2.0f && data->f146 == 0 && FUN_L04_002c1e98((char *)moby) != 0) { blend_moby_animation(moby, (void *)7, 0, (void *)scale_game_frames(10)); data->f146 = scale_game_frames(0x3C); @@ -1813,9 +1815,9 @@ void FUN_L04_002c2270(M_35F0 *moby) { } } } - if (FUN_001f9b80(path->pts[data->f154], moby->pos) < 1.0f || + if (vector_distance(path->pts[data->f154], moby->pos) < 1.0f || fast_difference_between_rotations( - moby->rot, FUN_001f9e90(path->pts[data->f154][0] - moby->pos[0], + moby->rot, fast_arc_tan(path->pts[data->f154][0] - moby->pos[0], path->pts[data->f154][1] - moby->pos[1])) > 2.3561945f) { data->f154++; if (data->f154 == path->count) { @@ -1836,7 +1838,7 @@ void FUN_L04_002c2270(M_35F0 *moby) { { int n = data->f154; qcopy(dest, path->pts[n]); - ta = FUN_001f9e90(path->pts[n][0] - moby->pos[0], path->pts[n][1] - moby->pos[1]); + ta = fast_arc_tan(path->pts[n][0] - moby->pos[0], path->pts[n][1] - moby->pos[1]); func_L00_002592B0_b((char *)moby, ta, vel, frame_time_sq * 1.0471976f, frame_time_sq * 3.1415927f, frame_time * 3.1415927f); } @@ -1855,7 +1857,7 @@ void FUN_L04_002c2270(M_35F0 *moby) { blend_moby_animation(moby, (void *)6, 0, (void *)scale_game_frames(10)); data->f146 = scale_game_frames(0x3C); } - ta = FUN_001f9e90(tg.pos[0] - moby->pos[0], tg.pos[1] - moby->pos[1]); + ta = fast_arc_tan(tg.pos[0] - moby->pos[0], tg.pos[1] - moby->pos[1]); if (dist < 2.0f && data->f146 == 0 && FUN_L04_002c1e98((char *)moby) != 0) { blend_moby_animation(moby, (void *)7, 0, (void *)scale_game_frames(10)); data->f146 = scale_game_frames(0x3C); @@ -1880,7 +1882,7 @@ void FUN_L04_002c2270(M_35F0 *moby) { if (moby->f53 != 1) { blend_moby_animation(moby, (void *)1, 0, (void *)scale_game_frames(10)); } - if (FUN_001f9b80(moby->pos, dest) < 1.0f) { + if (vector_distance(moby->pos, dest) < 1.0f) { if (fast_difference_between_rotations(moby->rot, D_L04_001600EC[data->f158].f78) < 0.17453292f) { data->f15A = 1; @@ -1900,12 +1902,12 @@ void FUN_L04_002c2270(M_35F0 *moby) { break; case 2: { qcopy(dest, D_L04_001600EC[data->f158].f30); - ta = FUN_001f9e90(path->pts[data->f154][0] - moby->pos[0], + ta = fast_arc_tan(path->pts[data->f154][0] - moby->pos[0], path->pts[data->f154][1] - moby->pos[1]); func_L00_002592B0_b((char *)moby, ta, &data->f130, frame_time_sq * 1.0471976f, frame_time_sq * 3.1415927f, frame_time * 3.1415927f); if (fast_difference_between_rotations( - moby->rot, FUN_001f9e90(path->pts[data->f154][0] - moby->pos[0], + moby->rot, fast_arc_tan(path->pts[data->f154][0] - moby->pos[0], path->pts[data->f154][1] - moby->pos[1])) < 0.17453292f) { moby->state = 4; @@ -1985,12 +1987,12 @@ void FUN_L04_002c2270(M_35F0 *moby) { } else if (moby->state == 3) { V4_35F0 v; V4_35F0 np; - float ang = FUN_001f9e90(dest[0] - moby->pos[0], dest[1] - moby->pos[1]); + float ang = fast_arc_tan(dest[0] - moby->pos[0], dest[1] - moby->pos[1]); int anim = moby->f53; I4_35F0 tbl = D_L04_001618A0; int moved; { - if (FUN_001f9b80(moby->pos, dest) >= frame_time * 3.0f * 2.0f) { + if (vector_distance(moby->pos, dest) >= frame_time * 3.0f * 2.0f) { float rel = fast_subtract_rotations(ang, moby->rot); float q = fast_add_rotations(rel, 0.3926991f); float dir; @@ -2024,19 +2026,19 @@ void FUN_L04_002c2270(M_35F0 *moby) { } else { anim = 0; } - if (FUN_001f9770(&data->f144) != 0 && anim != moby->f53) { + if (fast_dec_timer_s16(&data->f144) != 0 && anim != moby->f53) { blend_moby_animation(moby, (void *)anim, 0, (void *)scale_game_frames(10)); data->f144 = scale_game_frames(0xF); } } } else if (moby->state == 5 || (moby->state == 7 && moby->f52 == 7 && hd > 15.0f)) { - if (FUN_001f9b80(moby->pos, dest) > frame_time * 2.0f) { + if (vector_distance(moby->pos, dest) > frame_time * 2.0f) { V4_35F0 v; V4_35F0 np; { - v[0] = fast_cos(FUN_001f9e90(dest[0] - moby->pos[0], dest[1] - moby->pos[1])) * + v[0] = fast_cos(fast_arc_tan(dest[0] - moby->pos[0], dest[1] - moby->pos[1])) * (frame_time * 2.0f); - v[1] = fast_sin(FUN_001f9e90(dest[0] - moby->pos[0], dest[1] - moby->pos[1])) * + v[1] = fast_sin(fast_arc_tan(dest[0] - moby->pos[0], dest[1] - moby->pos[1])) * (frame_time * 2.0f); v[2] = 0.0f; add_vector_xyz(v, v, moby->pos); @@ -2071,7 +2073,7 @@ void FUN_L04_002c2270(M_35F0 *moby) { mark_moby_for_removal(moby); return; } - if (FUN_001f9b80(moby->pos, D_L04_00166F40) < 20.0f) { + if (vector_distance(moby->pos, D_L04_00166F40) < 20.0f) { V4_35F0 b; V4_35F0 a; int alt; @@ -2090,7 +2092,7 @@ void FUN_L04_002c2270(M_35F0 *moby) { scale_game_frames(alt ? random_int_between(10, 15) : random_int_between(20, 30))); } } - FUN_L00_0025d538(moby, data->fB0); + trooper_anim_finish(moby, data->fB0); } typedef struct { u8 pad0[4]; @@ -2220,7 +2222,7 @@ extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L04_00166F40[4]; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float compute_interpolated_record_value(void *) __asm__("FUN_0020c9e0"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); @@ -2230,13 +2232,13 @@ extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float probe_ground_height(void *, int, float) __asm__("FUN_00213508"); extern float vector_length_xy(void *); extern int DebugPrint(); -extern int FUN_001efa68(void *, void *, int, void *, void *); -extern int FUN_001f9770(void *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_001fefc8(void *); extern int FUN_L00_00258490(void *, void *, void *, int, float, float, float, float); extern int point_in_path_xy(void *, void *, int) __asm__("FUN_L00_00259740"); extern int hit_reaction(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_L00_0025a478"); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int allocate_voice_for_target_entry(int, int, char *); extern int rand(void); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); @@ -2248,11 +2250,11 @@ extern void FUN_L00_00250df8(void *); extern void FUN_L00_00258278(char *moby, float *vel, float target, float k, float d, float max); extern void FUN_L00_00259a88(void *, void *); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025ab48(void *, float *, void *, void *); -extern void FUN_L00_0025c558(float, void *, void *, int, int, int); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); -extern void FUN_L00_002628d8(char *, char *, int, float, float); +extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(float, void *, void *, int, int, int) __asm__("FUN_L00_0025c558"); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); +extern void update_joint_animation(char *, char *, int, float, float) __asm__("FUN_L00_002628d8"); extern void FUN_L00_00263b38(void *, float); extern void FUN_L04_002aee30(void *, void *, void *, int); extern void add_vector_xyz(void *, void *, void *); @@ -2270,7 +2272,8 @@ void FUN_L04_002c4808_c(char *arg) __asm__("FUN_L04_002c4808"); extern int func_L00_002594C8_o(void *, void *, void *, float, float, float, float, int) __asm__("FUN_L00_00258490"); -void FUN_L04_002c4850(struct Moby *moby) { +void blarg_trooper_update(struct Moby *moby) __asm__("FUN_L04_002c4850"); +void blarg_trooper_update(struct Moby *moby) { struct { float tgt[20]; float v50[4]; @@ -2327,7 +2330,7 @@ void FUN_L04_002c4850(struct Moby *moby) { } FUN_L00_0025fcb8(moby, st.tgt, s); target = *(char **)&st.tgt[16]; - dist = FUN_001f9b80(pos, st.tgt); + dist = vector_distance(pos, st.tgt); dmg = 0.0f; alive = compute_interpolated_record_value(moby); if (moby->state != 0 && *(unsigned char *)(data + 0x2E) != 1) { @@ -2349,7 +2352,7 @@ void FUN_L04_002c4850(struct Moby *moby) { qcopy(st.v50, &st.tgt[8]); path = D_L04_001B0630[*(short *)(data + 0xE8) != 0 ? e0 : e4]; for (i = 0; i < path->count; i++) { - float d = FUN_001f9b80(st.v50, path->pts[i]); + float d = vector_distance(st.v50, path->pts[i]); if (d > best) { best = d; bi = i; @@ -2357,15 +2360,15 @@ void FUN_L04_002c4850(struct Moby *moby) { } if (bi != -1) { qcopy(st.v60, path->pts[bi]); - best = FUN_001f9b80(st.v60, pos); + best = vector_distance(st.v60, pos); } else { qcopy(st.v60, pos); best = 0.0f; } hit = find_moby_hit(moby, 0x210000, 0); r = hit_reaction(moby, hit, data + 0x20, 0, &n, &dmg, 0, 4); - FUN_001f9770(data + 0xF0); - FUN_001f9770(data + 0xF2); + fast_dec_timer_s16(data + 0xF0); + fast_dec_timer_s16(data + 0xF2); if (hit != 0 && moby->state < 0xB && *(short *)(data + 0xF0) == 0) { char *o; float t; @@ -2374,15 +2377,15 @@ void FUN_L04_002c4850(struct Moby *moby) { if (o != 0) { struct Hero *g = &hero; if (o != ((char *)g->items[0].moby)) { - ang2 = FUN_001f9e90(moby->pos.x - *(float *)(o + 0x10), + ang2 = fast_arc_tan(moby->pos.x - *(float *)(o + 0x10), moby->pos.y - *(float *)(o + 0x14)); } else { - ang2 = FUN_001f9e90(moby->pos.x - g->motion.pos.f[0], + ang2 = fast_arc_tan(moby->pos.x - g->motion.pos.f[0], moby->pos.y - g->motion.pos.f[1]); } } else { struct Hero *g = &hero; - ang2 = FUN_001f9e90(moby->pos.x - g->motion.pos.f[0], + ang2 = fast_arc_tan(moby->pos.x - g->motion.pos.f[0], moby->pos.y - g->motion.pos.f[1]); } t = *(float *)(data + 0x20) - dmg; @@ -2409,8 +2412,8 @@ void FUN_L04_002c4850(struct Moby *moby) { *(float *)(data + 0x8C) = d; } *(OvlQuad *)st.w.p.v70 = *(OvlQuad *)(hit + 0x10); - FUN_L00_0025ab48(st.w.p.v70, &ang, data + 0x88, data + 0x8C); - FUN_L00_0025c558(ang, moby, data + 0x70, 0xD, 1, 0); + trooper_knockback_arc(st.w.p.v70, &ang, data + 0x88, data + 0x8C); + trooper_start_knockback(ang, moby, data + 0x70, 0xD, 1, 0); *(float *)(data + 0xC0) = 12.0f; *(float *)(data + 0xC4) = 25.0f; moby->state = 0xB; @@ -2429,7 +2432,7 @@ void FUN_L04_002c4850(struct Moby *moby) { *(float *)(data + 0xF4) = 2.0f / multiply_global_factor_ed64(15.0f); } *(OvlQuad *)st.w.p.v70 = *(OvlQuad *)(hit + 0x10); - FUN_L00_0025ab48(st.w.p.v70, &ang2, data + 0xF4, &one); + trooper_knockback_arc(st.w.p.v70, &ang2, data + 0xF4, &one); moby->rot.z = fast_add_rotations(3.1415927f, ang2); break; } @@ -2440,7 +2443,7 @@ void FUN_L04_002c4850(struct Moby *moby) { moby->state = 0xA; *(float *)(data + 0xF4) = 2.0f / multiply_global_factor_ed64(15.0f); *(OvlQuad *)st.w.p.v70 = *(OvlQuad *)(hit + 0x10); - FUN_L00_0025ab48(st.w.p.v70, &ang2, data + 0xF4, &one); + trooper_knockback_arc(st.w.p.v70, &ang2, data + 0xF4, &one); moby->rot.z = fast_add_rotations(3.1415927f, ang2); break; case 7: @@ -2450,7 +2453,7 @@ void FUN_L04_002c4850(struct Moby *moby) { case 11: break; } - FUN_L00_0025d458(moby, (short *)(data + 0x60)); + trooper_anim_update(moby, (short *)(data + 0x60)); } moby->hit_slot = 0xFF; if (*(int *)(data + 0x38) != 0) { @@ -2495,7 +2498,7 @@ void FUN_L04_002c4850(struct Moby *moby) { (void *)scale_game_frames(0xA)); } { - float a = FUN_001f9e90(st.v50[0] - moby->pos.x, + float a = fast_arc_tan(st.v50[0] - moby->pos.x, st.v50[1] - moby->pos.y); FUN_L00_00258278(moby, (float *)(data + 0xEC), a, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f, frame_time * 7.330382823944092f); @@ -2524,7 +2527,7 @@ void FUN_L04_002c4850(struct Moby *moby) { st.w.p.v90[2] = 0.5f; add_vector_xyz(st.w.p.v70, pos, st.w.p.v90); add_vector_xyz(st.w.p.v80, st.v50, st.w.p.v90); - if (FUN_001efa68(st.w.p.v70, st.w.p.v80, 0, moby, 0) != 0 && + if (collision_line(st.w.p.v70, st.w.p.v80, 0, moby, 0) != 0 && D_L04_00173FD8 == target) { moby->state = 5; blend_moby_animation_p(moby, (void *)3, 0, (void *)scale_game_frames(7)); @@ -2547,7 +2550,7 @@ void FUN_L04_002c4850(struct Moby *moby) { } else { float f; { - float a = FUN_001f9e90(st.v60[0] - moby->pos.x, + float a = fast_arc_tan(st.v60[0] - moby->pos.x, st.v60[1] - moby->pos.y); FUN_L00_00258278(moby, (float *)(data + 0xEC), a, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, frame_time * 4.712389f); @@ -2572,7 +2575,7 @@ void FUN_L04_002c4850(struct Moby *moby) { if (flag) { int k; { - float a = FUN_001f9e90(st.v50[0] - moby->pos.x, + float a = fast_arc_tan(st.v50[0] - moby->pos.x, st.v50[1] - moby->pos.y); FUN_L00_00258278(moby, (float *)(data + 0xEC), a, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f, frame_time * 4.886922f); @@ -2599,7 +2602,7 @@ void FUN_L04_002c4850(struct Moby *moby) { } if (*(short *)(data + 0xF2) == 0) { if (dist < 1.0f && fast_difference_between_rotations( - FUN_001f9e90(st.v50[0] - moby->pos.x, + fast_arc_tan(st.v50[0] - moby->pos.x, st.v50[1] - moby->pos.y), moby->rot.z) < 0.2617994f) { moby->state = 7; @@ -2613,7 +2616,7 @@ void FUN_L04_002c4850(struct Moby *moby) { } } else { if (dist < 1.0f && - fast_difference_between_rotations(FUN_001f9e90(st.v50[0] - moby->pos.x, + fast_difference_between_rotations(fast_arc_tan(st.v50[0] - moby->pos.x, st.v50[1] - moby->pos.y), moby->rot.z) < 0.2617994f) { moby->state = 7; @@ -2626,7 +2629,7 @@ void FUN_L04_002c4850(struct Moby *moby) { moby->state = 1; } else { { - float a = FUN_001f9e90(st.v60[0] - moby->pos.x, + float a = fast_arc_tan(st.v60[0] - moby->pos.x, st.v60[1] - moby->pos.y); FUN_L00_00258278(moby, (float *)(data + 0xEC), a, frame_scale_sq * 0.035f, frame_scale_sq * 0.3f, frame_time * 4.712389f); @@ -2650,7 +2653,7 @@ void FUN_L04_002c4850(struct Moby *moby) { break; case 5: { float a = - FUN_001f9e90(st.v50[0] - moby->pos.x, st.v50[1] - moby->pos.y); + fast_arc_tan(st.v50[0] - moby->pos.x, st.v50[1] - moby->pos.y); FUN_L00_00258278(moby, (float *)(data + 0xEC), a, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, frame_time * 5.585053443908691f); } @@ -2679,10 +2682,10 @@ void FUN_L04_002c4850(struct Moby *moby) { char *g = D_L04_00166E00; if (fast_difference_between_rotations( *(float *)(g + 0x158), - FUN_001f9e90(moby->pos.x - *(float *)(g + 0x140), + fast_arc_tan(moby->pos.x - *(float *)(g + 0x140), moby->pos.y - *(float *)(g + 0x144))) < 0.61086524f && fast_difference_between_rotations( - moby->rot.z, FUN_001f9e90(st.v50[0] - moby->pos.x, + moby->rot.z, fast_arc_tan(st.v50[0] - moby->pos.x, st.v50[1] - moby->pos.y)) < 0.7853982f) { moby->state = 6; @@ -2701,7 +2704,7 @@ void FUN_L04_002c4850(struct Moby *moby) { case 6: { char *o; { - float a = FUN_001f9e90(st.tgt[8] - moby->pos.x, + float a = fast_arc_tan(st.tgt[8] - moby->pos.x, st.tgt[9] - moby->pos.y); FUN_L00_00258278(moby, (float *)(data + 0xEC), a, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f, frame_time * 4.712389f); @@ -2715,12 +2718,12 @@ void FUN_L04_002c4850(struct Moby *moby) { float a; moby_point_position(o, 0, st.w.p.v70); subtract_vector_xyz(st.w.p.v80, st.v50, st.w.p.v70); - a = FUN_001f9e90(st.w.p.v80[0], st.w.p.v80[1]); + a = fast_arc_tan(st.w.p.v80[0], st.w.p.v80[1]); a = (fast_difference_between_rotations(a, moby->rot.z) > 0.2617994f) ? moby->rot.z : a; { - float p = FUN_001f9e90(vector_length_xy(st.w.p.v80), st.w.p.v80[2]); + float p = fast_arc_tan(vector_length_xy(st.w.p.v80), st.w.p.v80[2]); build_spherical_offset(st.w.p.v80, frame_time * 10.0f, a, p); } allocate_voice_for_target_entry(7, 0, moby); @@ -2737,14 +2740,14 @@ void FUN_L04_002c4850(struct Moby *moby) { } case 7: { float a = - FUN_001f9e90(st.v50[0] - moby->pos.x, st.v50[1] - moby->pos.y); + fast_arc_tan(st.v50[0] - moby->pos.x, st.v50[1] - moby->pos.y); FUN_L00_00258278(moby, (float *)(data + 0xEC), a, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f, frame_time * 5.585053443908691f); } if (moby->seq == moby->prev_seq && alive >= 12.0f && alive < 13.0f && absolute_float(moby->pos.z - st.tgt[2]) < 2.0f && - FUN_001f9b80(pos, st.v50) < 1.0f && - fast_difference_between_rotations(FUN_001f9e90(st.v50[0] - moby->pos.x, + vector_distance(pos, st.v50) < 1.0f && + fast_difference_between_rotations(fast_arc_tan(st.v50[0] - moby->pos.x, st.v50[1] - moby->pos.y), moby->rot.z) < 0.2617994f) { st.w.p.blk.f0 = fast_cos(moby->rot.z) * 0.2f; @@ -2794,13 +2797,13 @@ void FUN_L04_002c4850(struct Moby *moby) { } break; case 11: - if (FUN_L00_0025c698(moby, data + 0x70) & 0x60) { + if (mine_fall(moby, data + 0x70) & 0x60) { FUN_L04_002c4808_c(moby); return; } break; } - FUN_L00_0025d538(moby, data + 0x60); + trooper_anim_finish(moby, data + 0x60); { int st = moby->state; if (st == 1 || st == 3 || st == 4 || st == 5 || st == 6) { @@ -2808,9 +2811,9 @@ void FUN_L04_002c4850(struct Moby *moby) { if (t == 0) { t = *(char **)((char *)(&hero.moby)); } - if (FUN_001f9b80(pos, (float *)(t + 0x10)) < 24.0f) { + if (vector_distance(pos, (float *)(t + 0x10)) < 24.0f) { float f = fast_subtract_rotations( - FUN_001f9e90(*(float *)(t + 0x10) - moby->pos.x, + fast_arc_tan(*(float *)(t + 0x10) - moby->pos.x, *(float *)(t + 0x14) - moby->pos.y), moby->rot.z); if (f > 0.9599311f) { @@ -2827,8 +2830,8 @@ void FUN_L04_002c4850(struct Moby *moby) { *(float *)(data + 0x178) = -*(float *)(data + 0x178); *(float *)(data + 0x1F8) = -*(float *)(data + 0x1F8); } - FUN_L00_002628d8(moby, data + 0x110, 5, frame_scale_sq * 0.018f, frame_scale_sq * 0.3f); - FUN_L00_002628d8(moby, data + 0x190, 6, frame_scale_sq * 0.024f, frame_scale_sq * 0.3f); + update_joint_animation(moby, data + 0x110, 5, frame_scale_sq * 0.018f, frame_scale_sq * 0.3f); + update_joint_animation(moby, data + 0x190, 6, frame_scale_sq * 0.024f, frame_scale_sq * 0.3f); if (*(char **)(data + 0xF8) != 0) { char *o; build_moby_bone_transform(moby, 1, (char *)st.w.m); @@ -2897,7 +2900,8 @@ extern s32 voice_is_playing(struct Moby *, s32) __asm__("FUN_L00_0028d8c0"); extern s32 play_moby_voice(s32, s32, struct Moby *) __asm__("FUN_0022da68"); /* Follows a linked switch moby (class 0x118): mirrors its position value, loops a sound while it moves, plays a click at either end and swaps class 0x41C back to 0x1B0 when it reaches 1.0. */ -void FUN_L04_002c6858(struct Moby *m) { +void eudora_bridge_update(struct Moby *m) __asm__("FUN_L04_002c6858"); +void eudora_bridge_update(struct Moby *m) { SwitchFollowerVars *v = (SwitchFollowerVars *)m->pvars; f32 last = m->anim_time; struct Moby *other; @@ -2923,7 +2927,7 @@ void FUN_L04_002c6858(struct Moby *m) { reset_moby_anim(m); m->unk72 = ((MobyClassHeader *)m->pclass)->unkE; m->collision = ((MobyClassHeader *)m->pclass)->unk10; - FUN_0020e098(m); + refresh_moby_spatial_bounds_from_basis(m); } break; case 1: @@ -2956,7 +2960,7 @@ void FUN_L04_002c6858(struct Moby *m) { reset_moby_anim(m); m->unk72 = ((MobyClassHeader *)m->pclass)->unkE; m->collision = ((MobyClassHeader *)m->pclass)->unk10; - FUN_0020e098(m); + refresh_moby_spatial_bounds_from_basis(m); m->state = 2; } } else if (!voice_is_playing(m, v->voice)) { @@ -2989,7 +2993,7 @@ void FUN_L04_002c6858(struct Moby *m) { } #include "rnc/gameplay/entities/moby.h" -/* Pvars of a door driven by a lever (FUN_L04_002c6bb8 update): follows the lever's travel and plays its sounds. */ +/* Pvars of a door driven by a lever (platform_booster_update update): follows the lever's travel and plays its sounds. */ typedef struct { s32 lever; /* 0x00: moby index of the lever, -1 for none */ s32 target; /* 0x04: moby index it carries along, -1 for none */ @@ -3019,7 +3023,8 @@ extern u8 voice_slots[] __asm__("D_0013E550"); /* Door update: follows its lever's travel, pushes the lever back while opening, and runs the motor sounds. */ -void FUN_L04_002c6bb8(struct Moby *m) { +void platform_booster_update(struct Moby *m) __asm__("FUN_L04_002c6bb8"); +void platform_booster_update(struct Moby *m) { DoorVars *v = (DoorVars *)m->pvars; f32 prev; struct Moby *lever; diff --git a/src/overlays/l04/gameplay/entities/lieutenant.c b/src/overlays/l04/gameplay/entities/lieutenant.c index 7c589bb4d7..d39f755557 100644 --- a/src/overlays/l04/gameplay/entities/lieutenant.c +++ b/src/overlays/l04/gameplay/entities/lieutenant.c @@ -45,17 +45,18 @@ extern s32 D_L04_0015F5C4; extern float FUN_001f9b48(void *, void *); extern void FUN_L00_0025a120(struct Moby *); extern void FUN_L02_002e0cd8(struct Moby *); -extern void FUN_L00_002668a0(struct Moby *, struct VendorVars *); +extern void initialize_npc_dialogue(struct Moby *, struct VendorVars *) __asm__("FUN_L00_002668a0"); extern int FUN_00214720(char *, s32); -extern int FUN_L00_00266448(struct Moby *, struct VendorVars *); +extern int update_npc_dialogue(struct Moby *, struct VendorVars *) __asm__("FUN_L00_00266448"); extern void unlock_planet(int) __asm__("FUN_L00_002607d0"); -extern void FUN_L00_002502a0(int); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); extern void fast_vec_normalize(Vec4 *, Vec4 *, float) __asm__("FUN_001f9bf8"); extern void add_vector_xyz(Vec4 *, Vec4 *, void *) __asm__("FUN_001f9a10"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern void memcard_save_data(int, int) __asm__("FUN_0020b178"); -void FUN_L04_002e3078(struct Moby *moby) { +void lieutenant_update(struct Moby *moby) __asm__("FUN_L04_002e3078"); +void lieutenant_update(struct Moby *moby) { Vec4 pos; Vec4 rot; Vec4 *r; @@ -75,20 +76,20 @@ void FUN_L04_002e3078(struct Moby *moby) { break; } moby->state = 1; - FUN_L00_002668a0(moby, vars); + initialize_npc_dialogue(moby, vars); break; case 1: if (FUN_00214720(&hero.motion.pos, vars->item)) vars->alpha = 255.0f; else vars->alpha = 1.0f; - if (FUN_L00_00266448(moby, vars)) + if (update_npc_dialogue(moby, vars)) moby->state = 2; break; case 2: if (vars->phase == 2) { unlock_planet(6); - FUN_L00_002502a0(((struct VendorMobyView *)moby)->slot); + jet_clear_persistent(((struct VendorMobyView *)moby)->slot); fast_vec_normalize(&pos, &((struct VendorMobyView *)moby)->facing, 2.0f); add_vector_xyz(&pos, &pos, &moby->pos); r = &rot; @@ -104,7 +105,7 @@ void FUN_L04_002e3078(struct Moby *moby) { break; } if (D_L04_0015F5C4 != 2) - FUN_L00_00266448(moby, vars); + update_npc_dialogue(moby, vars); break; case 3: moby->flags |= 0x41; @@ -476,7 +477,7 @@ void FUN_L04_002e5178(M2e5178 *m) { break; } } -/* Waits for state 1, then passes the slot for the level's current mode to FUN_L00_002637f8. */ +/* Waits for state 1, then passes the slot for the level's current mode to cutscene_set_camera_target. */ struct L04MissionState { char pad0[0x30]; int mode; @@ -486,7 +487,7 @@ struct L04MissionState { extern int D_L04_0015F5C4; extern struct L04MissionState D_L04_0016C9E0; -extern void FUN_L00_002637f8(int); +extern void cutscene_set_camera_target(int) __asm__("FUN_L00_002637f8"); void FUN_L04_002e53a0(struct Moby *m) { switch (m->state) { @@ -504,7 +505,7 @@ void FUN_L04_002e53a0(struct Moby *m) { i = 3; else if (v == 1) i = 2; - FUN_L00_002637f8(D_L04_0016C9E0.slot[i]); + cutscene_set_camera_target(D_L04_0016C9E0.slot[i]); } } break; diff --git a/src/overlays/l04/gameplay/entities/snow_plow.c b/src/overlays/l04/gameplay/entities/snow_plow.c index 49a73c2f45..147e690b64 100644 --- a/src/overlays/l04/gameplay/entities/snow_plow.c +++ b/src/overlays/l04/gameplay/entities/snow_plow.c @@ -16,15 +16,15 @@ /* UpdateMoby_584 */ /* Ported from rac1-decomp (src/overlays/l04_eudora/vendor_002CB800.c: func_L04_002D4960), where it is exact; names translated to the US level program. */ -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void FUN_L00_0025d1b8(void *); -extern void FUN_L00_00260738(char *, void *, void *, void *); +extern void update_entity_matrix(char *, void *, void *, void *) __asm__("FUN_L00_00260738"); void FUN_L04_002d3580(char *m) { char *d = *(char **)(m + 0x78); float v[4]; - FUN_001f9a28(v, m + 0x10, d + 0xA0); - FUN_L00_00260738(d + 0x60, v, m + 0x40, m + 0x40); + fast_vec_sub(v, m + 0x10, d + 0xA0); + update_entity_matrix(d + 0x60, v, m + 0x40, m + 0x40); qcopy(d + 0xA0, m + 0x10); if (*(unsigned char *)(m + 0x20) == 0) { *(int *)(d + 0x20) = 0; @@ -45,11 +45,11 @@ extern int D_L04_0015EDF8 __attribute__((sda)); extern unsigned char D_0013D408[]; extern void debug_print() __asm__("FUN_001e93b0"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); -extern int FUN_001f96f8(int); -extern int FUN_001f9740(int *); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); +extern int fast_dec_timer(int *) __asm__("FUN_001f9740"); extern void fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); @@ -60,7 +60,7 @@ extern void scale_vector_xyz(void *, void *, float) __asm__("FUN_001f9a68"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void clear_vector(void *) __asm__("FUN_001f99f8"); extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); -extern void FUN_L01_002f5168(void *); +extern void gunship_follow_path(void *) __asm__("FUN_L01_002f5168"); extern void FUN_L00_00258278(void *, float, void *, float, float, float); extern void attach_manipulator(char *, int, void *) __asm__("FUN_0020cb10"); extern void FUN_L00_001fff28(void *, int, float); @@ -75,11 +75,12 @@ extern void func_L00_0025F4A8_alt(void *, void *, void *, float, float, int, int float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern int allocate_voice_for_target_entry(int, int, struct Moby *) __asm__("FUN_0022da68"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L00_00263fd8(void *, int, void *, void *, int, int, float, void *, void *, void *); /* Class-dependent movement, manipulator rotation, hit effects and visibility. */ -void FUN_L04_002ca420(struct Moby *moby) { +void snow_plow_update(struct Moby *moby) __asm__("FUN_L04_002ca420"); +void snow_plow_update(struct Moby *moby) { Vec4 old; Vec4 delta, *d; /* The sphere query is its position followed by the record; the hit cases pass one or the other. */ @@ -124,7 +125,7 @@ void FUN_L04_002ca420(struct Moby *moby) { *(int *)(data + 0x178) = moby->draw_dist; } amount = 0.0f; - FUN_L01_002f5168(moby); + gunship_follow_path(moby); if (moby->oclass != 0x1e4) { fast_dec_timer_s16(data + 0x14a); switch (*(unsigned char *)(data + 0x149)) { @@ -146,7 +147,7 @@ void FUN_L04_002ca420(struct Moby *moby) { *(float *)(data + 0x14c) = moby->rot.z; *(int *)(data + 0x7c) = 0; moby->state = 3; - *(int *)(data + 0x11c) = FUN_001f96f8(36000); + *(int *)(data + 0x11c) = scale_game_frames(36000); break; } ++i; @@ -156,12 +157,12 @@ void FUN_L04_002ca420(struct Moby *moby) { case 1: FUN_L00_00258278(moby, *(float *)(D_L04_001600EC + *(unsigned char *)(data + 0x148) * 0x80 + 0x78), data + 0x7c, frame_time_sq * 1.0471976f, frame_time_sq * 3.1415927f, frame_time * 3.1415927f); - if (FUN_001f9b80(&moby->pos, D_L04_001600EC + *(unsigned char *)(data + 0x148) * 0x80 + 0x30) < 1.0f && + if (vector_distance(&moby->pos, D_L04_001600EC + *(unsigned char *)(data + 0x148) * 0x80 + 0x30) < 1.0f && fast_difference_between_rotations(moby->rot.z, *(float *)(D_L04_001600EC + *(unsigned char *)(data + 0x148) * 0x80 + 0x78)) < 0.17453292f) { *(unsigned char *)(data + 0x149) = 2; - *(short *)(data + 0x14a) = FUN_001f96f8(300); + *(short *)(data + 0x14a) = scale_game_frames(300); } - FUN_001f9a28(&delta, D_L04_001600EC + *(unsigned char *)(data + 0x148) * 0x80 + 0x30, &moby->pos); + fast_vec_sub(&delta, D_L04_001600EC + *(unsigned char *)(data + 0x148) * 0x80 + 0x30, &moby->pos); normalize_vector_xyz(&delta, &delta, frame_time * 3.0f); add_vector_xyz(&moby->pos, &moby->pos, &delta); break; @@ -174,15 +175,15 @@ void FUN_L04_002ca420(struct Moby *moby) { case 3: FUN_L00_00258278(moby, *(float *)(data + 0x14c), data + 0x7c, frame_time_sq * 1.0471976f, frame_time_sq * 3.1415927f, frame_time * 3.1415927f); - if (FUN_001f9b80(&moby->pos, data + 0x160) < 1.0f && + if (vector_distance(&moby->pos, data + 0x160) < 1.0f && fast_difference_between_rotations(moby->rot.z, *(float *)(data + 0x14c)) < 0.034906585f) { *(unsigned char *)(data + 0x149) = 0; - *(short *)(data + 0x14a) = FUN_001f96f8(600); + *(short *)(data + 0x14a) = scale_game_frames(600); *(float *)(data + 0xfc) = amount; *(float *)(data + 0x7c) = amount; *(int *)(data + 0x11c) = 0; } - FUN_001f9a28(&delta, data + 0x160, &moby->pos); + fast_vec_sub(&delta, data + 0x160, &moby->pos); length = fast_vec_length(&delta); step = frame_time * 3.0f; d = δ @@ -283,7 +284,7 @@ void FUN_L04_002ca420(struct Moby *moby) { 100000.0f, 3.0f, -1, 15.0f, 1, 1, -1, 0); if (moby->oclass == 0x1f2 || moby->oclass == 0x22b) allocate_voice_for_target_entry(0, 0, moby); else if (moby->oclass != 0x1e6) allocate_voice_for_target_entry(1, 0, moby); - *(int *)(data + 0x170) = FUN_001f96f8(600); + *(int *)(data + 0x170) = scale_game_frames(600); *(int *)(data + 0x174) = 1; break; case 0x1b: @@ -292,10 +293,10 @@ void FUN_L04_002ca420(struct Moby *moby) { clear_vector(&sphere); moby_point_position(moby, 0, &delta); add_vector_xyz(&delta, &delta, &sphere_pos); - FUN_L00_0025f090(moby, &delta, -1, 1.0f, 13.0f); + cart_burst(moby, &delta, -1, 1.0f, 13.0f); moby_point_position(moby, 1, &delta); add_vector_xyz(&delta, &delta, &sphere_pos); - FUN_L00_0025f090(moby, &delta, -1, 1.0f, 13.0f); + cart_burst(moby, &delta, -1, 1.0f, 13.0f); add_vector_xyz(&delta, &sphere_pos, &moby->pos); func_L00_0025F4A8_alt(moby, &sphere, &delta, 0.0f, 0.0f, 20, 5, 4, 2.0f, 1.0f, 100000.0f, 3.0f, -1, 15.0f, 1, 1, -1, 0); @@ -306,103 +307,103 @@ void FUN_L04_002ca420(struct Moby *moby) { clear_vector(&sphere2.vector); sphere2.zero = 0; collect_mobies_in_sphere(&moby->pos, 6.0f, 0x10, moby, &sphere2); - *(int *)(data + 0x170) = FUN_001f96f8(600); + *(int *)(data + 0x170) = scale_game_frames(600); *(int *)(data + 0x174) = 1; break; } scale_vector_xyz(&delta, &moby->rot_row0, frame_scale * 0.075f); delta.f[2] += frame_scale * 0.08f; if (moby->oclass == 0x1d2) { - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x63f, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x641, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x642, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); } else if (moby->oclass == 0x1e0) { - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x642, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x643, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x644, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); } else if (moby->oclass == 0x1e6) { int i; - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x645, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); i = 5; do { --i; - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x646, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); } while (i >= 0); } else if (moby->oclass == 0x1ea) { - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x647, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x648, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x649, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); } else if (moby->oclass == 0x1ee) { - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x64d, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x64e, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); } else if (moby->oclass == 0x1ef) { - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x64f, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x650, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x651, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x658, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); } else if (moby->oclass == 0x1f2) { - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x652, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x653, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x654, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); } else if (moby->oclass == 0x1ed) { - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x793, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x794, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); { int i = 2; do { --i; - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x795, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); } while (i >= 0); @@ -411,7 +412,7 @@ void FUN_L04_002ca420(struct Moby *moby) { int i = 2; do { --i; - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); FUN_L00_00263fd8(moby, 0x796, &moby->pos, &moby->rot, timer, 0, frame_time_sq * 12.0f, &delta, D_L04_0015F580, D_L04_0015F580); } while (i >= 0); @@ -420,7 +421,7 @@ void FUN_L04_002ca420(struct Moby *moby) { } moby->hit_slot = 0xff; if (*(int *)(data + 0x174) == 0) return; - if (FUN_001f9740((int *)(data + 0x170))) { + if (fast_dec_timer((int *)(data + 0x170))) { char *camera = D_L04_00166E00; amount = fast_arc_tan(moby->pos.x - *(float *)(camera + 0x140), moby->pos.y - *(float *)(camera + 0x144)); if (1.5707964f < fast_difference_between_rotations(*(float *)(camera + 0x158), amount)) { @@ -457,13 +458,14 @@ extern f32 random_float_between(f32, f32) __asm__("func_002132A8"); extern float fast_add_rotations(float, float) __asm__("func_001FA580"); extern int D_L04_0015FFD8; /* no foreign declaration */ extern short D_L04_0016195C __attribute__((sda)); -extern void FUN_L00_00260738(char *, void *, void *, void *); -extern void FUN_L00_002628d8(char *, char *, int, float, float); +extern void update_entity_matrix(char *, void *, void *, void *) __asm__("FUN_L00_00260738"); +extern void update_joint_animation(char *, char *, int, float, float) __asm__("FUN_L00_002628d8"); extern void mark_moby_for_removal(void *) __asm__("func_0020C828"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); f32 compute_interpolated_record_value(void *anim) __asm__("FUN_0020c9e0"); -void FUN_L04_002cdda0(char *moby) { +void floating_platform_update(char *moby) __asm__("FUN_L04_002cdda0"); +void floating_platform_update(char *moby) { float old[4]; float delta[4]; char *data = *(char **)(moby + 0x78); @@ -495,7 +497,7 @@ void FUN_L04_002cdda0(char *moby) { float g = frame_scale_sq; *p = a; *(float *)(data + 0x108 + i * 0x80) = a; - FUN_L00_002628d8(moby, data + 0xA0 + i * 0x80, i, g * 0.03f, g * 0.3f); + update_joint_animation(moby, data + 0xA0 + i * 0x80, i, g * 0.03f, g * 0.3f); } if (*(int *)(data + 0x230) != -1) { char *o = D_L04_0015FFD8 + (*(int *)(data + 0x230) << 8); @@ -510,13 +512,14 @@ void FUN_L04_002cdda0(char *moby) { } } subtract_vector_xyz(delta, moby + 0x10, old); - FUN_L00_00260738(data + 0x60, delta, moby + 0x40, moby + 0x40); + update_entity_matrix(data + 0x60, delta, moby + 0x40, moby + 0x40); } extern void remove_moby_2ce060(void *) __asm__("FUN_0020c828"); /* Marks the moby for removal; the unused buffer is kept for its frame. */ -void FUN_L04_002ce060(void *moby) { +void transport_ship_update(void *moby) __asm__("FUN_L04_002ce060"); +void transport_ship_update(void *moby) { char buf[0x50]; remove_moby_2ce060(moby); @@ -712,7 +715,7 @@ extern f32 fast_sin(f32) __asm__("func_001F9DE0"); extern float D_L04_0015F580[] __attribute__((section(".sdata"))); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float spring_turn(float, float, void *, float, float, float) __asm__("FUN_L00_00258110"); @@ -724,7 +727,7 @@ extern float random_float_between(float a, float b) __asm__("FUN_002132a8"); extern int *D_L04_001B0630[]; extern int point_in_path_xy(void *, void *, int) __asm__("FUN_L00_00259740"); extern int hit_reaction(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_L00_0025a478"); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int FUN_L04_00295778(void *, void *, float, float, float); extern int is_value_within_interpolated_window(char *, float) __asm__("FUN_00214cc8"); extern s32 random_integer_below(s32) __asm__("func_00213260"); @@ -740,10 +743,10 @@ extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8") extern void FUN_L00_00257470(void *, int, int); extern void FUN_L00_00258490(void *, void *, void *, int, float, float, float, float); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025ab48(void *, float *, void *, void *); -extern void FUN_L00_0025c558(float, void *, void *, int, int, int); -extern void FUN_L00_0025d458(void *, void *); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(float, void *, void *, int, int, int) __asm__("FUN_L00_0025c558"); +extern void trooper_anim_update(void *, void *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern void FUN_L00_0025fcb8(void *, void *, float); extern void FUN_L00_00263ac8(float, void *, int, void *); extern void FUN_L00_00263fd8(void *, int, void *, void *, int, int, float, void *, void *, void *); @@ -763,7 +766,8 @@ void FUN_L04_002d1608(void *m); void build_spherical_offset(f32 *out, f32 scale, f32 a, f32 b) __asm__("FUN_00214db0"); void mark_moby_for_removal(void *obj) __asm__("FUN_0020c828"); -void FUN_L04_002d16b8(WBMoby *m) { +void woodcut_bot_update(WBMoby *m) __asm__("FUN_L04_002d16b8"); +void woodcut_bot_update(WBMoby *m) { int excited = 0; WBData *d = m->d; unsigned char *p120; @@ -791,7 +795,7 @@ void FUN_L04_002d16b8(WBMoby *m) { } adiff = fast_difference_between_rotations(m->rot[2], fast_arc_tan(tgt[0] - m->pos[0], tgt[1] - m->pos[1])); - dist = FUN_001f9b80(pos, tgt); + dist = vector_distance(pos, tgt); hd = compute_interpolated_record_value(m); qcopy(v60, pos); qcopy(v70, pos); @@ -852,14 +856,14 @@ void FUN_L04_002d16b8(WBMoby *m) { d->fD8 = frame_time * 7.0f; d->fDC = frame_time * 13.0f; *(OvlQuad *)v = *(OvlQuad *)(p + 0x10); - FUN_L00_0025ab48(v, &angle, &d->fD8, &d->fDC); - FUN_L00_0025c558(angle, m, d->fC0, 8, 1, 0); + trooper_knockback_arc(v, &angle, &d->fD8, &d->fDC); + trooper_start_knockback(angle, m, d->fC0, 8, 1, 0); d->f110 = 14.0f; d->f114 = 24.0f; m->state = 0xB; FUN_L00_00257470(m, 0, -1); d->fB7 = 0x78; - FUN_L00_0025d458(m, d->fB0); + trooper_anim_update(m, d->fB0); d->f3E4 = (2.0f / multiply_global_factor_ed64(15.0f)) * 2.0f; break; case 3: @@ -879,9 +883,9 @@ void FUN_L04_002d16b8(WBMoby *m) { d->f3E4 = 2.0f / multiply_global_factor_ed64(15.0f); } *(OvlQuad *)v = *(OvlQuad *)(p + 0x10); - FUN_L00_0025ab48(v, &angle, &d->f3E4, &one); + trooper_knockback_arc(v, &angle, &d->f3E4, &one); d->fB7 = 0x78; - FUN_L00_0025d458(m, d->fB0); + trooper_anim_update(m, d->fB0); d->t3C4 = scale_game_frames(0xF); d->t3C6 = scale_game_frames(0xF0); } @@ -893,10 +897,10 @@ void FUN_L04_002d16b8(WBMoby *m) { m->state = 1; d->f3E4 = 2.0f / multiply_global_factor_ed64(15.0f); *(OvlQuad *)v = *(OvlQuad *)(p + 0x10); - FUN_L00_0025ab48(v, &angle, &d->f3E4, &one); + trooper_knockback_arc(v, &angle, &d->f3E4, &one); m->rot[2] = fast_add_rotations(3.1415927f, angle); d->fB7 = 0x78; - FUN_L00_0025d458(m, d->fB0); + trooper_anim_update(m, d->fB0); d->t3C4 = scale_game_frames(0x1E); d->t3C2 = scale_game_frames(0xB4); d->t3C6 = scale_game_frames(0xF0); @@ -999,7 +1003,7 @@ void FUN_L04_002d16b8(WBMoby *m) { } } if (!excited) { - if (FUN_001f9b80(pos, d->f3B0) > 2.0f) { + if (vector_distance(pos, d->f3B0) > 2.0f) { if (d->f3E8 < dist || (d->f3DC != -1 && point_in_path_xy(tgt, D_L04_001B0630[d->f3DC] + 4, *D_L04_001B0630[d->f3DC]) == 0)) { @@ -1152,7 +1156,7 @@ void FUN_L04_002d16b8(WBMoby *m) { m->fBC &= ~8; FUN_L04_00295de8(m, d->f160); } - if (FUN_001f9b80(pos, d->f3B0) < 2.0f) { + if (vector_distance(pos, d->f3B0) < 2.0f) { m->state = 7; } else { FUN_L04_00295778(m, d->f160, frame_time * 4.0f, @@ -1311,7 +1315,7 @@ void FUN_L04_002d16b8(WBMoby *m) { } break; case 11: - if ((FUN_L00_0025c698(m, d->fC0) & 0x40) || m->pos[2] < 1.0f) { + if ((mine_fall(m, d->fC0) & 0x40) || m->pos[2] < 1.0f) { FUN_L04_002d1608(m); FUN_L00_00263fd8(m, 0x6CB, pos, m->rot, 0, 0, 0.0f, D_L04_0015F580, D_L04_0015F580, D_L04_0015F580); @@ -1328,7 +1332,7 @@ void FUN_L04_002d16b8(WBMoby *m) { { float w[16]; - FUN_L00_0025d538(m, d->fB0); + trooper_anim_finish(m, d->fB0); if (d->f3E4 > 0.0f) { struct Hero *h = &hero; @@ -1406,8 +1410,8 @@ void FUN_L04_002d6f68(char *moby) { qcopy(dst + 0x10, moby + 0x10); } extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); -extern int FUN_001f9740(s32 *); -extern int FUN_001f96f8(int); +extern int fast_dec_timer(s32 *) __asm__("FUN_001f9740"); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); extern void FUN_L00_001ff660(void *, void *, void *); @@ -1415,7 +1419,8 @@ extern float D_L04_001CB940[6]; extern char D_L04_00173FE0[]; /* Three-state motion update. The saved position is restored when the timer expires. */ -void FUN_L04_002d7e90(struct Moby *moby) { +void leaf_update(struct Moby *moby) __asm__("FUN_L04_002d7e90"); +void leaf_update(struct Moby *moby) { Vec4 random; Vec4 old; Vec4 work; @@ -1442,9 +1447,9 @@ void FUN_L04_002d7e90(struct Moby *moby) { moby->state = 1; break; case 1: - if (!(FUN_001f9b80(&moby->pos, D_L04_00166F40) < 32.0f)) + if (!(vector_distance(&moby->pos, D_L04_00166F40) < 32.0f)) return; - if (!FUN_001f9740((int *)(data + 0x44))) + if (!fast_dec_timer((int *)(data + 0x44))) return; direction.q = 0; direction.f[0] = random_float_between(-1.0f, 1.0f); @@ -1466,7 +1471,7 @@ void FUN_L04_002d7e90(struct Moby *moby) { moby->state = 2; return; case 2: - FUN_001f9740((int *)(data + 0x44)); + fast_dec_timer((int *)(data + 0x44)); normalize_vector_xyz(&random, &random, D_L04_001CB940[5] / 10.0f); add_vector_xyz(data + 0x10, data + 0x10, &random); normalize_vector_xyz(&work, data + 0x10, 5.0f); @@ -1503,11 +1508,11 @@ void FUN_L04_002d7e90(struct Moby *moby) { moby->rot.x = fast_add_rotations(moby->rot.x, *(float *)(data + 0x20)); moby->rot.y = fast_add_rotations(moby->rot.y, *(float *)(data + 0x24)); moby->rot.z = fast_add_rotations(moby->rot.z, *(float *)(data + 0x28)); - if (*(int *)(data + 0x40) - FUN_001f96f8(10) < *(int *)(data + 0x44)) { + if (*(int *)(data + 0x40) - scale_game_frames(10) < *(int *)(data + 0x44)) { amount = convert_integer_to_float(*(int *)(data + 0x44) - *(int *)(data + 0x40)); moby->scale = (*(float *)(data + 0x4c) * amount) / multiply_global_factor_ed64(10.0f); } else { - if (*(int *)(data + 0x44) < FUN_001f96f8(100)) + if (*(int *)(data + 0x44) < scale_game_frames(100)) moby->scale *= 0.99f; else moby->scale = *(float *)(data + 0x4c); @@ -1554,13 +1559,14 @@ struct RiserVars { extern s32 D_L04_001BA650[]; extern LevelCollected D_L04_001BB3B0; -extern int FUN_L00_0028dc90(int, int, struct Moby *, int); -extern int FUN_001f96f8(int); -extern int FUN_001f9740(s32 *); +extern int trooper_play_sound(int, int, struct Moby *, int) __asm__("FUN_L00_0028dc90"); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); +extern int fast_dec_timer(s32 *) __asm__("FUN_001f9740"); extern int allocate_voice_for_target_entry(int, int, struct Moby *) __asm__("FUN_0022da68"); extern s32 D_0014C190_257218[][64] __asm__("D_0014C190"); -void FUN_L04_002e17d8(struct Moby *m) { +void upper_door_update(struct Moby *m) __asm__("FUN_L04_002e17d8"); +void upper_door_update(struct Moby *m) { struct RiserVars *d = (struct RiserVars *)m->pvars; struct Moby *t; s16 idx; @@ -1582,13 +1588,13 @@ void FUN_L04_002e17d8(struct Moby *m) { return; } if (m->oclass == 0x44D || m->oclass == 0x5FC) - FUN_L00_0028dc90(0, 0, m, 0x44D); + trooper_play_sound(0, 0, m, 0x44D); m->state = 2; - d->timer = FUN_001f96f8(60); + d->timer = scale_game_frames(60); break; case 2: m->pos.z += riser_rise_speed(m) * frame_time; - if (FUN_001f9740(&d->timer)) { + if (fast_dec_timer(&d->timer)) { D_0014C190_257218[current_level_index][(s16)m->save_id >> 5] |= 1 << (m->save_id & 0x1F); D_L04_001BA650[(s16)m->save_id >> 5] |= 1 << (m->save_id & 0x1F); if (m->oclass == 0x44D) @@ -1618,14 +1624,15 @@ extern struct Moby *portal_mobys_2e1a10 __asm__("D_L04_0015FFD8"); extern void FUN_L00_002d6bf0(struct Moby *); extern void remove_moby_2e1a10(struct Moby *) __asm__("FUN_0020c828"); extern void FUN_L04_002e1d00_m(struct Moby *) __asm__("FUN_L04_002e1d00"); -extern void FUN_L00_00298840(int); +extern void start_scene(int) __asm__("FUN_L00_00298840"); extern void queue_dialogue_message(int, int) __asm__("FUN_L00_00263d40"); extern void FUN_L00_00260860(int, int); -extern void FUN_L00_00284e50(void *, void *); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern void debug_print(char *, int) __asm__("FUN_001e93b0"); extern void memcard_save_data(int, int) __asm__("FUN_0020b178"); -void FUN_L04_002e1a10(struct Moby *moby) { +void suck_cannon_update(struct Moby *moby) __asm__("FUN_L04_002e1a10"); +void suck_cannon_update(struct Moby *moby) { struct PortalVars *vars = (struct PortalVars *)moby->pvars; struct Moby *exit; @@ -1646,9 +1653,9 @@ void FUN_L04_002e1a10(struct Moby *moby) { break; case 1: FUN_L04_002e1d00_m(moby); - if (FUN_001f9b80(&moby->pos, &hero.motion.pos) < 3.0f) { + if (vector_distance(&moby->pos, &hero.motion.pos) < 3.0f) { moby->flags |= 0x41; - FUN_L00_00298840(2); + start_scene(2); moby->state = 2; } break; @@ -1663,7 +1670,7 @@ void FUN_L04_002e1a10(struct Moby *moby) { FUN_L00_00260860(9, 1); if (vars->exitMoby != -1) { exit = &portal_mobys_2e1a10[vars->exitMoby]; - FUN_L00_00284e50(&exit->pos, &exit->rot); + jet_reset_camera(&exit->pos, &exit->rot); } else { debug_print(D_L04_001DC760, ((struct PortalMobyView *)moby)->uid); } diff --git a/src/overlays/l04/gameplay/vendor/002e79a8.c b/src/overlays/l04/gameplay/vendor/002e79a8.c index a330a039d8..95c26a3890 100644 --- a/src/overlays/l04/gameplay/vendor/002e79a8.c +++ b/src/overlays/l04/gameplay/vendor/002e79a8.c @@ -12,7 +12,8 @@ extern void FUN_L01_002787a0(void *); extern void FUN_L01_00278e20(void *, int); void mark_moby_for_removal(struct Obj *obj) __asm__("FUN_0020c828"); -void FUN_L04_002e79a8(char *m) { +void pipe_update(char *m) __asm__("FUN_L04_002e79a8"); +void pipe_update(char *m) { int hit = 0; char *r = find_moby_hit(m, 0x10000, 0); switch (*(unsigned char *)(m + 0x20)) { diff --git a/src/overlays/l04/runtime/dma/002922d0.c b/src/overlays/l04/runtime/dma/002922d0.c index 0faef2c680..13ff82bfb5 100644 --- a/src/overlays/l04/runtime/dma/002922d0.c +++ b/src/overlays/l04/runtime/dma/002922d0.c @@ -47,7 +47,7 @@ extern void stub_printf() __asm__("FUN_001e93b0"); extern void raise_kernel_trap(void) __asm__("FUN_001f97b0"); extern float animation_start(int, int) __asm__("FUN_L04_002418b0"); extern float animation_end(int, int) __asm__("FUN_L04_00241910"); -extern float FUN_001f96b0(float) __asm__("FUN_L04_001f1978"); +extern float FUN_L04_001f1978(float); extern void transform_scaled_vertex_batch(struct Moby *m, int count, int *joints, void *out) __asm__("FUN_0020cd48"); extern void get_joint_matrix(struct Moby *m, int joint, float *mtx) __asm__("FUN_0020cca8"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); @@ -76,7 +76,7 @@ void FUN_L04_002923b8(struct Moby *moby, LegRig *rig) { ? rig->anims[i]->phase[0].to[j] - rig->anims[i]->phase[0].from[j] : rig->anims[i]->phase[0].to[j] + rig->anims[i]->len - rig->anims[i]->phase[0].from[j]; } - rig->anims[i]->rate = rig->anims[i]->unk4 / FUN_001f96b0(rig->anims[i]->len + rig->anims[i]->len); + rig->anims[i]->rate = rig->anims[i]->unk4 / FUN_L04_001f1978(rig->anims[i]->len + rig->anims[i]->len); } } joints[0] = rig->legs[0].joint; diff --git a/src/overlays/l05/gameplay/entities/electric_gate.c b/src/overlays/l05/gameplay/entities/electric_gate.c index dee2057fb2..b524ead12f 100644 --- a/src/overlays/l05/gameplay/entities/electric_gate.c +++ b/src/overlays/l05/gameplay/entities/electric_gate.c @@ -76,7 +76,8 @@ void enqueue_callback_list_1(int arg0, int arg1) __asm__("FUN_001f4600"); extern int func_0022ED80_i(int, int, void *) __asm__("FUN_0022da68"); extern short D_L05_00161D38 __attribute__((sda)); -void FUN_L05_0030dc68(char *m) { +void electric_gate_update(char *m) __asm__("FUN_L05_0030dc68"); +void electric_gate_update(char *m) { char *data = *(char **)(m + 0x78); int state = *(unsigned char *)(m + 0x20); char *base; @@ -369,7 +370,7 @@ void FUN_L05_0030e1f8(char *moby) { } } extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); -extern void FUN_001f9a68(void *, void *, float); +extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern float vector_length_xyz(void *); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); @@ -397,7 +398,7 @@ void FUN_L05_0030e508(char *moby) { *(float *)(moby + 0x48) = *(float *)(e0 + 0x78); fast_vec_normalize(v, e0 + 0x10, *(float *)(data + 0x18)); if (*(int *)(data + 0x1C) != 0) { - FUN_001f9a68(v, v, -1.0f); + fast_vec_scale(v, v, -1.0f); *(u16 *)(moby + 0x34) |= 0x8000; } add_vector_xyz(moby + 0x10, moby + 0x10, v); @@ -417,7 +418,7 @@ void FUN_L05_0030e508(char *moby) { pos = 0.0f; fast_vec_normalize(v, e + 0x10, reach); if (*(int *)(data + 0x1C) != 0) { - FUN_001f9a68(v, v, -1.0f); + fast_vec_scale(v, v, -1.0f); } add_vector_xyz(v, e + 0x30, v); subtract_vector_xyz(v, v, moby + 0x10); @@ -528,7 +529,8 @@ typedef struct { char pad90[0x1FF0]; int f2080; } DrainCoverHero; -void FUN_L05_0030e7f8(DrainCoverMoby *moby) { +void drain_cover_update(DrainCoverMoby *moby) __asm__("FUN_L05_0030e7f8"); +void drain_cover_update(DrainCoverMoby *moby) { DrainCoverData *data = moby->d; float old_position[4]; float old_rotation[4]; @@ -810,7 +812,8 @@ extern u8 *FUN_L00_00272060(void *pos, s32 life, f32 size0, f32 size1, s32 color void *vel, f32 f2); extern char D_L05_001BAAA0[]; -void FUN_L05_0030f5c8(struct Moby *moby) { +void pipe_mounted_grating_update(struct Moby *moby) __asm__("FUN_L05_0030f5c8"); +void pipe_mounted_grating_update(struct Moby *moby) { float vel[4]; float spin_vel[4]; float dir[4]; @@ -988,13 +991,13 @@ struct FloorRow { }; extern float square_root(float) __asm__("FUN_001f9988"); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); extern s32 random_integer_below(s32) __asm__("FUN_00213260"); extern void FUN_L01_0026e0e0(int, int); extern void FUN_L05_0029be70(float, float, float, void *, void *, int, int); -extern void FUN_L00_002718d0(float, float, void *, void *, void *); +extern void spawn_splash(float, float, void *, void *, void *) __asm__("FUN_L00_002718d0"); extern unsigned char D_0014C050[][16]; extern struct Moby *D_L05_0015FFD8; extern struct FloorRow *D_L05_001612D0; @@ -1104,12 +1107,12 @@ void FUN_L05_003150f0(struct Moby *m) { float s = t * (frame_time * 4.0f); float ang = random_angle_radians(); float r = random_float_between(0.0f, 1.25f); - FUN_001f9a68(v, &m->rot_row0, s); + fast_vec_scale(v, &m->rot_row0, s); add_vector_xyz(v, v, &m->pos); - v[0] += FUN_001f9dc8(ang) * r; - v[1] += FUN_001f9de0(ang) * r; + v[0] += fast_cos(ang) * r; + v[1] += fast_sin(ang) * r; v[2] = floor + 0.05f; - FUN_L00_002718d0(random_float_between(1.0f, 1.5f), random_integer_below(2) ? 2.0f : -2.0f, v, + spawn_splash(random_float_between(1.0f, 1.5f), random_integer_below(2) ? 2.0f : -2.0f, v, D_L05_0015F580_macro, &D_L05_001612D0[d->floor].z); } } @@ -1168,25 +1171,26 @@ extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern f32 random_angle_radians(void) __asm__("FUN_00213308"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern f32 approach_with_speed(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_00213f38"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern s32 allocate_voice_for_target_entry(s32, s32, struct Moby *) __asm__("FUN_0022da68"); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern f32 FUN_001f99c0(f32); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 tick_countdown_32_alt(s32 *) __asm__("FUN_001f9740"); extern void FUN_L00_00260738(char *a, void *b, void *c, void *d); extern void FUN_L00_002ea9d8(void *); extern void FUN_L00_002eaa30(void *); -extern void FUN_L00_002eaaa0(void *, void *, s32, s32, s32); +extern void jet_mount(void *, void *, s32, s32, s32) __asm__("FUN_L00_002eaaa0"); extern void FUN_L00_002eac18(s32); extern void lift_camera_view(void *, void *, void *) __asm__("FUN_L05_00315ee0"); extern void place_marker_ring(void *) __asm__("FUN_L05_00315f70"); -void FUN_L05_003156d0(struct Moby *moby) { +void elevator_with_button_update(struct Moby *moby) __asm__("FUN_L05_003156d0"); +void elevator_with_button_update(struct Moby *moby) { LiftVars *vars = (LiftVars *)moby->pvars; Vec4 delta; Vec4 rot; @@ -1213,14 +1217,14 @@ void FUN_L05_003156d0(struct Moby *moby) { D_L05_0015F3FC = vars->fade; if (vars->fade == 1.0f) { lift_camera_view(moby, &eye, &look); - FUN_L00_002eaaa0(&eye, &look, 1, 0, 0); + jet_mount(&eye, &look, 1, 0, 0); moby->state = moby->command; moby->command = 1; } break; case 2: case 3: - if (!FUN_L00_0028d8c0(moby, vars->sound)) { + if (!voice_is_playing(moby, vars->sound)) { vars->sound = allocate_voice_for_target_entry(0, 4, moby); } if (moby->command) { @@ -1273,11 +1277,11 @@ void FUN_L05_003156d0(struct Moby *moby) { break; case 6: case 7: - if (FUN_L00_0028d8c0(moby, vars->sound)) { + if (voice_is_playing(moby, vars->sound)) { release_voice_slot(vars->sound); vars->sound = -1; } - if (vars->timer > scale_game_frames(30) || FUN_001f9b80(&hero.motion.pos, &moby->pos) > 0.5f) { + if (vars->timer > scale_game_frames(30) || vector_distance(&hero.motion.pos, &moby->pos) > 0.5f) { tick_countdown_32_alt(&vars->timer); } if (hero.ground_moby != moby) { @@ -1293,14 +1297,14 @@ void FUN_L05_003156d0(struct Moby *moby) { break; } vars->phase = fast_add_rotations(vars->phase, frame_time * 6.2831855f); - level = truncate_float_to_s32((FUN_001f9de0(vars->phase) * 4.0f - 3.0f) * 128.0f); + level = truncate_float_to_s32((fast_sin(vars->phase) * 4.0f - 3.0f) * 128.0f); if (level > 0x80) { level = 0x80; } else if (level < 0x20) { level = 0x20; } moby->glow_color = 0x80000000 | (level << 16) | (level << 8) | level; - if (hero.ground_moby == moby && hero.air_frames.s == 0 && FUN_001f9b80(&hero.motion.pos, &moby->pos) < 0.5f) { + if (hero.ground_moby == moby && hero.air_frames.s == 0 && vector_distance(&hero.motion.pos, &moby->pos) < 0.5f) { allocate_voice_for_target_entry(1, 0, moby); moby->glow_color = 0x80208020; if (moby->state == 7) { @@ -1313,14 +1317,14 @@ void FUN_L05_003156d0(struct Moby *moby) { case 4: case 5: vars->phase = fast_add_rotations(vars->phase, frame_time * 6.2831855f); - level = truncate_float_to_s32((FUN_001f9de0(vars->phase) * 4.0f - 3.0f) * 128.0f); + level = truncate_float_to_s32((fast_sin(vars->phase) * 4.0f - 3.0f) * 128.0f); if (level > 0x80) { level = 0x80; } else if (level < 0x20) { level = 0x20; } moby->glow_color = 0x80000000 | (level << 16) | (level << 8) | level; - if (hero.ground_moby == moby && hero.air_frames.s == 0 && FUN_001f9b80(&hero.motion.pos, &moby->pos) < 0.5f) { + if (hero.ground_moby == moby && hero.air_frames.s == 0 && vector_distance(&hero.motion.pos, &moby->pos) < 0.5f) { allocate_voice_for_target_entry(1, 0, moby); if (vars->marker != -1) { place_marker_ring(moby); @@ -1334,13 +1338,13 @@ void FUN_L05_003156d0(struct Moby *moby) { moby->state = 1; vars->fade = 0.0f; } else if (moby->state == 4) { - f32 dist = FUN_001f9b80(&moby->pos, &hero.motion.pos); + f32 dist = vector_distance(&moby->pos, &hero.motion.pos); if (FUN_001f99c0(hero.ground_z.f - vars->bottom) < 2.0f && dist < 32.0f && dist > 5.0f) { moby->command = 0; moby->state = 3; } } else if (moby->state == 5) { - f32 dist = FUN_001f9b80(&moby->pos, &hero.motion.pos); + f32 dist = vector_distance(&moby->pos, &hero.motion.pos); if (FUN_001f99c0(hero.ground_z.f - vars->top) < 2.0f && dist < 32.0f && dist > 5.0f) { moby->command = 0; moby->state = 2; @@ -1358,7 +1362,7 @@ void FUN_L05_003156d0(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/l05_rilgar/vendor_0030EB68.c: func_L05_003173A8), where it is exact; names translated to the US level program. */ extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern short D_L05_00161EC0 __attribute__((sda)); @@ -1367,7 +1371,7 @@ extern short D_L05_00161EC8 __attribute__((sda)); void FUN_L05_00315ee0(char *a, char *b, char *c) { float t; fast_vec_normalize(b, a + 0xC0, *(float *)&D_L05_00161EC8); - FUN_001f9a10(b, b, a + 0x10); + fast_vec_add(b, b, a + 0x10); *(float *)(b + 8) = *(float *)(b + 8) + *(float *)&D_L05_00161EC0; clear_u64_value(c); t = *(float *)&D_L05_00161EC4; @@ -1377,7 +1381,7 @@ void FUN_L05_00315ee0(char *a, char *b, char *c) { /* Ported from rac1-decomp (src/overlays/l05_rilgar/vendor_0030EB68.c: func_L05_00317438), where it is exact; names translated to the US level program. */ extern char *D_L05_001B0930[]; -extern float FUN_001fa580(float, float); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); void FUN_L05_00315f70(char *moby) { int i = 0; @@ -1387,11 +1391,11 @@ void FUN_L05_00315f70(char *moby) { float step = 6.28318f / (float)(*(int *)tab - 1); for (; i < *(int *)tab; i++) { char *v = tab + 0x10 + i * 16; - *(float *)v = FUN_001f9dc8(ang) * 3.5f; - *(float *)(v + 4) = FUN_001f9de0(ang) * 3.5f; + *(float *)v = fast_cos(ang) * 3.5f; + *(float *)(v + 4) = fast_sin(ang) * 3.5f; *(int *)(v + 8) = 0; - FUN_001f9a10(v, v, moby + 0x10); - ang = FUN_001fa580(ang, step); + fast_vec_add(v, v, moby + 0x10); + ang = fast_add_rotations(ang, step); } } /* Ported from rac1-decomp (src/overlays/l05_rilgar/vendor_0030EB68.c: func_L05_00317538), where it is exact; names translated to the US level program. */ @@ -1426,7 +1430,8 @@ void enqueue_callback_list_1(int arg0, int arg1) __asm__("FUN_001f4600"); extern void func_L05_00317538_3175D8(void) __asm__("FUN_L05_00316070"); extern float D_L05_00211B20[]; -void FUN_L05_00316110(char *moby) { +void ocean_rilgar_update(char *moby) __asm__("FUN_L05_00316110"); +void ocean_rilgar_update(char *moby) { switch ((unsigned char)moby[0x20]) { case 0: FUN_L02_002a40d0(D_L05_00211B20, 1.0f); @@ -1469,9 +1474,9 @@ void FUN_L05_00316258(char *moby) { *(float *)(data + 0x60) = 0.0f; *(u8 *)(moby + 0x20) = 2; if (*(int *)(data + 0x50) != 0) - FUN_001f9a68(target, moby + 0xD0, 2.0f); + fast_vec_scale(target, moby + 0xD0, 2.0f); else - FUN_001f9a68(target, moby + 0xD0, -2.0f); + fast_vec_scale(target, moby + 0xD0, -2.0f); add_vector_xyz(moby + 0x10, moby + 0x10, target); } else { *(u8 *)(moby + 0x20) = 1; @@ -1532,7 +1537,7 @@ void FUN_L05_00316258(char *moby) { case 3: case 4: if (*(u8 *)(moby + 0x20) == 3) { - FUN_001f9a68(target, moby + 0xD0, -1.9f); + fast_vec_scale(target, moby + 0xD0, -1.9f); add_vector_xyz(target, data, target); } else { qcopy(target, data); @@ -1607,10 +1612,11 @@ extern int D_L05_0015F5C4; extern s32 breast_growth_count_gp __asm__("D_L05_00161ED0") __attribute__((sda)); extern unsigned char D_0015EDB0[] MACRO_ADDR; extern unsigned char D_L05_0017C8A0[]; -extern void FUN_L05_00316810(char *, int); +extern void update_hoverboard_girl_boobs_animation(char *, int) __asm__("FUN_L05_00316810"); extern void attach_manipulator(void *arg0, s32 arg1, void *arg2) __asm__("FUN_0020cb10"); -void FUN_L05_00316990(char *arg) { +void update_hoverboard_girl_cutscene_instances(char *arg) __asm__("FUN_L05_00316990"); +void update_hoverboard_girl_cutscene_instances(char *arg) { if (D_L05_0015F5C4 == 2 && (D_0015EDB0[0] != 0 || *(int *)&breast_growth_count_gp != 0)) { int i; for (i = 0; i < D_L05_0016CC60.n; i++) { @@ -1626,7 +1632,7 @@ void FUN_L05_00316990(char *arg) { } } if (*(int *)&breast_growth_count_gp != 0) { - FUN_L05_00316810(moby, *(int *)(arg + 0x78)); + update_hoverboard_girl_boobs_animation(moby, *(int *)(arg + 0x78)); } } } @@ -1734,13 +1740,14 @@ typedef struct { } WD2; extern char D_L05_00161EF0[]; extern void FUN_L05_00317398(void *); -extern void FUN_L02_0025c758(void *); +extern void initialize_moby_grounding(void *) __asm__("FUN_L02_0025c758"); extern void unlock_planet(int) __asm__("FUN_L00_002607d0"); extern void build_spherical_offset(void *, float, float, float) __asm__("FUN_00214db0"); extern unsigned char D_0013DD47 __attribute__((section(".data"))); -/* Watcher moby update (variant of FUN_L05_003180a0): turns its head toward the hero or a random target. */ -void FUN_L05_00317470(WM_c *m) { +/* Watcher moby update (variant of shady_salesman_update): turns its head toward the hero or a random target. */ +void qwarks_bouncer_update(WM_c *m) __asm__("FUN_L05_00317470"); +void qwarks_bouncer_update(WM_c *m) { L16WatchScratch_c scratch; WD2 *d = (WD2 *)m->data; float rate; @@ -1759,7 +1766,7 @@ void FUN_L05_00317470(WM_c *m) { m->state = 1; FUN_L00_002668a0_c(m, d); d->fC = 3.7f; - FUN_L02_0025c758(m); + initialize_moby_grounding(m); break; case 1: if (FUN_L00_00266448_c(m, d)) @@ -1904,17 +1911,17 @@ extern char D_L05_001671C0[]; extern unsigned char D_0013D4FF __attribute__((section(".data"))); extern f32 FUN_001f9b48(void *, void *); extern void FUN_L00_0025a120(void *); -extern void FUN_L01_002783a8(void *, float); +extern void begin_dialogue_camera_transition(void *, float) __asm__("FUN_L01_002783a8"); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern int memcard_save_data(int, int) __asm__("FUN_0020b178"); extern f32 probe_ground_height(void *, int, float) __asm__("FUN_00213508"); extern int FUN_001f9740(void *); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern char D_0013E633[], D_0014171B[], D_0013D24D[], D_L16_00167240[]; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float FUN_001f9e90_cf(float, float) __asm__("FUN_001fa688"); extern float FUN_001fa688_cf(float, float) __asm__("FUN_001f9e90"); extern float fast_add_rotations(float, float); @@ -1923,8 +1930,8 @@ extern float truncate_float_to_s32_cf(float, float) __asm__("FUN_002132a8"); extern float vector_length_xy(void *); extern float vector_length_xyz(void *); extern int help_request(int, int) __asm__("FUN_L00_00203908"); -extern int FUN_L00_00266448(void *, void *); -extern int FUN_L00_002668a0(void *, void *); +extern int update_npc_dialogue(void *, void *) __asm__("FUN_L00_00266448"); +extern int initialize_npc_dialogue(void *, void *) __asm__("FUN_L00_002668a0"); extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); extern int memcard_save_data(int, int) __asm__("FUN_0020b178"); extern int random_float_between_cf(float) __asm__("FUN_001fa6d0"); @@ -1933,9 +1940,9 @@ extern int tick_countdown_32(int *); extern char D_L05_00161EF8[]; extern unsigned char D_0015EDB0_b __asm__("D_0015EDB0"); extern void FUN_L00_00216f90(void *, void *, int, int); -extern void FUN_L00_002502a0(int); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); extern void FUN_L00_00260860(int, int); -extern void FUN_L00_002628d8(float, float, void *, void *, int); +extern void update_joint_animation(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); extern void queue_dialogue_message(int, int) __asm__("FUN_L00_00263d40"); extern void FUN_L02_002e0cd8(char *); extern void add_vector_xyz(void *, void *, void *); @@ -1943,7 +1950,8 @@ extern void build_spherical_offset(void *, float, float, float) __asm__("FUN_002 extern void subtract_vector_xyz(void *, void *, void *); extern L16WatchPlayer D_0013E633_watch __asm__("D_0013E533"); -void FUN_L05_003180a0(WM *m) { +void shady_salesman_update(WM *m) __asm__("FUN_L05_003180a0"); +void shady_salesman_update(WM *m) { L16WatchScratch scratch; WD *d = m->data; float rate; @@ -1966,11 +1974,11 @@ void FUN_L05_003180a0(WM *m) { m->position[2] = probe_ground_height(m->position, 0, 0.5f); d->ptr20 = (void *)D_L05_00161EF8; m->state = 1; - FUN_L00_002668a0(m, d); + initialize_npc_dialogue(m, d); break; case 1: - if (FUN_L00_00266448(m, d)) - FUN_L01_002783a8(m, 2.0f); + if (update_npc_dialogue(m, d)) + begin_dialogue_camera_transition(m, 2.0f); if ((unsigned)(d->sub - 3) < 2) { FUN_L00_00260860(0x17, 1); queue_dialogue_message(0x1396, -1); @@ -1982,9 +1990,9 @@ void FUN_L05_003180a0(WM *m) { d->idle_timer = random_float_between_cf(multiply_global_factor_ed64(truncate_float_to_s32_cf(1200.0f, 2400.0f))); if (m->animation != 1) - blend_moby_animation(m, 1, 0, FUN_001f96f8(10)); + blend_moby_animation(m, 1, 0, scale_game_frames(10)); } else if (m->animation == 1 && (m->flags70 & 2)) { - blend_moby_animation(m, 0, 0, FUN_001f96f8(10)); + blend_moby_animation(m, 0, 0, scale_game_frames(10)); } break; } @@ -1994,7 +2002,7 @@ void FUN_L05_003180a0(WM *m) { if (m->animation == 0) { char *player = (char *)&D_0013E633_watch + 0xE9D; tracking = 1; - if (FUN_001f9b80(m->position, player) < 8.0f && + if (vector_distance(m->position, player) < 8.0f && FUN_001f9e90_cf( m->yaw, FUN_001fa688_cf(((L16WatchPlayer *)((char *)&D_0013E633_watch + 0xE1D))->aim[0] - @@ -2049,8 +2057,8 @@ void FUN_L05_003180a0(WM *m) { } if (D_0015EDB0_b) d->height = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); } extern int D_L05_001612D8_318a68[] __asm__("D_L05_001612D8") MACRO_ADDR; @@ -2097,7 +2105,8 @@ extern float random_angle_radians_alt(void) __asm__("FUN_00213308"); extern int D_L05_0015F5C4; extern short D_L05_00161F08 __attribute__((sda)); -void FUN_L05_00318b98(struct Moby *moby) { +void television_update(struct Moby *moby) __asm__("FUN_L05_00318b98"); +void television_update(struct Moby *moby) { float v; char *data = (char *)moby->pvars; int g; @@ -2118,13 +2127,13 @@ void FUN_L05_00318b98(struct Moby *moby) { moby->visible = 1; moby->flags &= 0xFFFE; } - v = FUN_001fa580(*(float *)data, frame_time * 0.87266463f); + v = fast_add_rotations(*(float *)data, frame_time * 0.87266463f); *(float *)data = v; - moby->pos.z = *(float *)(data + 4) + FUN_001f9de0(v); + moby->pos.z = *(float *)(data + 4) + fast_sin(v); break; } } -/* Same source as the exact FUN_L16_002e43e0, with its moby data 8 bytes further on, an x range on the pickup test and a table test for state 6. */ +/* Same source as the exact taxi_update, with its moby data 8 bytes further on, an x range on the pickup test and a table test for state 6. */ typedef struct { char pad00[0x30]; float position[4]; @@ -2139,7 +2148,7 @@ extern float advance_accelerated_scalar_c(float, float, float, float, float *, float *) __asm__("FUN_00213f38"); extern f32 fast_add_rotations(f32 a, f32 b) __asm__("FUN_001fa580"); extern f32 fast_subtract_rotations(f32, f32) __asm__("func_001FA5C8"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L05_003195f8(char *); extern void lerp_vector(void *, void *, void *, float) __asm__("FUN_001f9a40"); extern void FUN_001f9d20(void *, void *, void *); @@ -2159,7 +2168,8 @@ extern void subtract_vector_xyz(void *out, void *a, void *b) __asm__("FUN_001f9a float absolute_float(float input) __asm__("func_001F99C0"); extern void func_00215CA8_f5848(float, int *, int, void *, float *, int) __asm__("FUN_00214e58"); -void FUN_L05_00318c78(struct Moby *moby) { +void taxi_update(struct Moby *moby) __asm__("FUN_L05_00318c78"); +void taxi_update(struct Moby *moby) { char *d = (char *)moby->pvars; float v00[4], v10[4], v20[4], v30[4], v40[4], v50[4], v60[4], v70[4]; struct Hero *g; @@ -2270,10 +2280,10 @@ void FUN_L05_00318c78(struct Moby *moby) { g2->unk1F2 = 2; g2->unk1F4 = 2; FUN_L05_003198e8(moby); - if (FUN_L00_0028d8c0(moby, *(short *)(d + 0xB2)) == 0) { + if (voice_is_playing(moby, *(short *)(d + 0xB2)) == 0) { *(short *)(d + 0xB2) = func_0022ED80_i(0, 4, moby); } - } else if (FUN_L00_0028d8c0(moby, *(short *)(d + 0xB2)) != 0) { + } else if (voice_is_playing(moby, *(short *)(d + 0xB2)) != 0) { h = *(short *)(d + 0xB2); if (h != -1) { e = D_0013E550 + h * 0x70; @@ -2391,7 +2401,8 @@ void FUN_L05_003193a8(char *moby) { extern int D_L05_0015F5C4_c __asm__("D_L05_0015F5C4"); -void FUN_L05_00319c28(char *moby) { +void qwarks_trailer_update(char *moby) __asm__("FUN_L05_00319c28"); +void qwarks_trailer_update(char *moby) { if (D_L05_0015F5C4_c == 2) { moby[0x31] = 0; *(unsigned short *)(moby + 0x34) |= 1; @@ -2400,3 +2411,10 @@ void FUN_L05_00319c28(char *moby) { *(unsigned short *)(moby + 0x34) &= 0xFFFE; } } + +float D_L05_0020B740[4][2] = { + {0.5f, 0.0f}, + {0.5f, 1.0f}, + {0.5f, 0.0f}, + {0.5f, 1.0f}, +}; diff --git a/src/overlays/l05/gameplay/entities/sharkigator.c b/src/overlays/l05/gameplay/entities/sharkigator.c index 0153bcece2..0984da629e 100644 --- a/src/overlays/l05/gameplay/entities/sharkigator.c +++ b/src/overlays/l05/gameplay/entities/sharkigator.c @@ -55,7 +55,7 @@ void FUN_L05_002d7890(char *moby, int *path) { extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern char D_0013E533[]; -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); extern void FUN_L05_002db238_u(void *, void *) __asm__("FUN_L05_002db238"); @@ -72,7 +72,7 @@ void FUN_L05_002daf58(unsigned char *m) { allocate_voice_for_target_entry(0, 0, (int)m); o = *(char **)(r + 0x20); if (o != 0 && *(short *)(o + 0xA6) == 0) { - int v = FUN_001f96f8(0x3C); + int v = scale_game_frames(0x3C); char *y = b - 0x100; *(int *)(y + 0x8C4) += v; } @@ -107,10 +107,10 @@ char *FUN_L05_002f8718(char *owner) { /* Moves a point along a looped path of 16-byte nodes stored in the moby's data. */ /* Ported from rac1-decomp (src/overlays/l05_rilgar/vendor_002D28D0.c: func_L05_00308188), where it is exact; names translated to the US level program. */ -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); -extern float FUN_001fa580(float, float); -extern float FUN_001f9e90(float, float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); void FUN_L05_00306d30(char *moby, int idx, float *out) { char *p = *(char **)(*(char **)(moby + 0x78) + 0x244); @@ -118,9 +118,9 @@ void FUN_L05_00306d30(char *moby, int idx, float *out) { float a; qcopy(out, p + 0x10 + idx * 16); qcopy(v, p + 0x10 + ((idx + 1) % *(int *)p) * 16); - a = FUN_001fa580(FUN_001f9e90(v[0] - out[0], v[1] - out[1]), 1.5707964f); - out[0] = out[0] + FUN_001f9dc8(a) * 0.0f; - out[1] = out[1] + FUN_001f9de0(a) * 0.0f; + a = fast_add_rotations(fast_arc_tan(v[0] - out[0], v[1] - out[1]), 1.5707964f); + out[0] = out[0] + fast_cos(a) * 0.0f; + out[1] = out[1] + fast_sin(a) * 0.0f; } /* advances a moby's path waypoint until it reaches one flagged 2.0 */ /* Ported from rac1-decomp (src/overlays/l05_rilgar/vendor_002D28D0.c: func_L05_003087B0), where it is exact; names translated to the US level program. */ @@ -230,7 +230,8 @@ extern void reset_2d1688(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa extern void FUN_L05_002d1e30(char *); extern void FUN_L05_002d1fd8(int, char *); -void FUN_L05_002d1688(char *moby) { +void sharkigator_update(char *moby) __asm__("FUN_L05_002d1688"); +void sharkigator_update(char *moby) { char *data = *(char **)(moby + 0x78); int state = *(unsigned char *)(moby + 0x20); int one = 1; @@ -465,7 +466,7 @@ extern float D_L05_001612E8; extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int random_integer_below(int) __asm__("FUN_00213260"); extern int truncate_float_to_s32() __asm__("FUN_001fa6d0"); -extern unsigned char *FUN_L00_002718d0(void *, void *, void *, float, float); +extern unsigned char *spawn_splash(void *, void *, void *, float, float) __asm__("FUN_L00_002718d0"); extern void random_vector(float *, float, float) __asm__("FUN_L00_00257d78"); extern void FUN_L00_0026f548(void *, void *, int, int); extern void add_vector_xyz(void *, void *, void *); @@ -494,7 +495,7 @@ void FUN_L05_002d1fd8(int unused, char *p) { random_vector(v, 1.0f, 1.0f); add_vector_xyz(v, v, p); v[2] = D_L05_001612E8 + 0.05f; - q = FUN_L00_002718d0(v, D_L05_0015F580_macro, base, random_float_between(0.7f, 1.0f), + q = spawn_splash(v, D_L05_0015F580_macro, base, random_float_between(0.7f, 1.0f), i == 0 ? 2.0f : -2.0f); if (q) { *(short *)(q + 0xA) = func_001FA898_r(multiply_global_factor_ed64(random_float_between(30.0f, 60.0f))); @@ -586,7 +587,7 @@ float D_L05_001613E0 = 5.0f; int D_L05_001613E4 = 1; extern float D_L05_001613E8 __attribute__((sda)); extern float D_L05_001613EC __attribute__((sda)); -extern int FUN_001fa6e0(int, int, float); +extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void allocate_voice_for_target_entry_alt(int, int, int) __asm__("FUN_0022da68"); @@ -595,7 +596,7 @@ extern void mark_moby_for_removal_c(void *) __asm__("func_0020C828"); extern void scale_vector_xyz(void *, void *, float) __asm__("FUN_001f9a68"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("func_001F9CF8"); float absolute_float(float input) __asm__("func_001F99C0"); -int FUN_L00_0028d8c0(int a, int i); +int voice_is_playing(int a, int i) __asm__("FUN_L00_0028d8c0"); void *FUN_L00_00263fd8(char *src, int cls, float *pos, void *mat, int a8, int a9, float *v10, float *v11, float scale, float *v12); void FUN_L05_002d7020_c(char *m) __asm__("FUN_L05_002d7020"); void FUN_L05_002d7890_c(char *moby, int *path) __asm__("FUN_L05_002d7890"); @@ -624,7 +625,8 @@ extern void func_L05_002D8B68_2D8388(void) __asm__("FUN_L05_002d7920"); extern float D_L05_001672C8_2D8388[] __asm__("D_L05_001671C8"); extern char *D_L05_001B0CB0_2D8388[] __asm__("D_L05_001B0930"); -void FUN_L05_002d7140(char *moby) { +void scenery_ship_update(char *moby) __asm__("FUN_L05_002d7140"); +void scenery_ship_update(char *moby) { Data_2D8388 *data = *(Data_2D8388 **)(moby + 0x78); char *hit; char *path; @@ -881,7 +883,7 @@ void FUN_L05_002d7920(char *moby) { extern f32 fast_cos_c(f32) __asm__("func_001F9DC8"); extern f32 fast_sin_c(f32) __asm__("func_001F9DE0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float FUN_L00_0025be00(float *, float *, float, float, float, float); extern int FUN_L00_00258b50(void *, void *, void *, void *, float); extern int fast_dec_timer(int *arg0) __asm__("FUN_001f9740"); @@ -896,7 +898,8 @@ void mark_moby_for_removal(void *obj) __asm__("FUN_0020c828"); extern char *D_L05_001B0CB0_x[] __asm__("D_L05_001B0930"); extern int func_001F9908_v(void *) __asm__("FUN_001f9740"); -void FUN_L05_002dac80(struct Moby *m) { +void amoeboid_update(struct Moby *m) __asm__("FUN_L05_002dac80"); +void amoeboid_update(struct Moby *m) { char *d = (char *)m->pvars; float dir[4]; FUN_L05_002daf58_c(m); @@ -922,7 +925,7 @@ void FUN_L05_002dac80(struct Moby *m) { break; case 1: { char *p = D_L05_001B0CB0_x[*(int *)(d + 0xB0)] + *(int *)(d + 0xB4) * 16; - float yaw = FUN_001f9e90(*(float *)(p + 0x10) - m->pos.x, + float yaw = fast_arc_tan(*(float *)(p + 0x10) - m->pos.x, *(float *)(p + 0x14) - m->pos.y); FUN_L00_0025be00(&m->rot.z, (float *)(d + 0xBC), yaw, frame_time_sq * 1.0471976f, frame_time_sq * 1.0471976f, frame_time * 3.1415927f); @@ -931,7 +934,7 @@ void FUN_L05_002dac80(struct Moby *m) { dir[2] = 0.0f; FUN_L00_00258b50(m, d + 0x60, dir, d + 0x40, 1.0f); if (func_001F9908_v(d + 0xB8) != 0 || - FUN_001f9b80(&m->pos, D_L05_001B0CB0_x[*(int *)(d + 0xB0)] + + vector_distance(&m->pos, D_L05_001B0CB0_x[*(int *)(d + 0xB0)] + (*(int *)(d + 0xB4) * 16 + 0x10)) < 1.0f) { int r = random_integer_below_c(*(int *)D_L05_001B0CB0_x[*(int *)(d + 0xB0)]); *(int *)(d + 0xB4) = @@ -942,7 +945,7 @@ void FUN_L05_002dac80(struct Moby *m) { break; } case 2: - if (48.0f < FUN_001f9b80(&m->pos, &hero.motion.pos)) { + if (48.0f < vector_distance(&m->pos, &hero.motion.pos)) { m->state = 1; m->visible = 1; m->flags &= 0xFFFE; @@ -1004,7 +1007,7 @@ extern f32 fast_cos_c2(f32) __asm__("func_001F9DC8"); extern f32 fast_sin_c2(f32) __asm__("func_001F9DE0"); extern f32 random_angle_radians_c(void) __asm__("func_00213308"); extern f32 random_float_between_c(f32, f32) __asm__("func_002132A8"); -extern int FUN_001fa6e0(int, int, float); +extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern s32 truncate_float_to_s32_c2(f32) __asm__("func_001FA6D0"); extern void FUN_L00_0025f8e0(float *v, float s); extern void scale_vector_xyz(void *, void *, float) __asm__("FUN_001f9a68"); @@ -1036,8 +1039,8 @@ void FUN_L05_002db238(void *moby, void *dir) { a[3] = r * 0.065f; FUN_L00_0025f8e0(p, 0.2f); FUN_L00_0025f8e0(a, frame_time * 0.5f); - c1 = FUN_001fa6e0(0x8000EEEE, 0x8000FF90, random_float_between_c(0.0f, 1.0f)); - c2 = FUN_001fa6e0(0xFFEE, 0xFFEE, random_float_between_c(0.0f, 1.0f)); + c1 = fast_tween_color(0x8000EEEE, 0x8000FF90, random_float_between_c(0.0f, 1.0f)); + c2 = fast_tween_color(0xFFEE, 0xFFEE, random_float_between_c(0.0f, 1.0f)); n1 = scale_game_frames(10); n2 = scale_game_frames(0x1E); spawn_spark(p, v, a, c1, c2, n1, n2, func_001FA898_r(multiply_global_factor_ed64(random_float_between_c(5.0f, 25.0f))), -1); @@ -1057,18 +1060,18 @@ extern f32 fast_cos_c4(f32) __asm__("func_001F9DC8"); extern f32 fast_sin_c6(f32) __asm__("func_001F9DE0"); extern f32 random_angle_radians_c4(void) __asm__("func_00213308"); extern f32 random_float_between_c3(f32, f32) __asm__("func_002132A8"); -extern float FUN_001f96b0(float); +extern float FUN_L04_001f1978(float); extern float fast_add_rotations_c4(float, float) __asm__("func_001FA580"); extern float fast_difference_between_rotations(float, float) __asm__("func_001FA688"); extern float fast_vec_dist(void *, void *); extern float vector_distance_xy_alt(void *, void *) __asm__("FUN_001f9b80"); extern int D_L05_0015FFD8; extern int D_L05_0015F5C4; -extern int FUN_001f9770(void *); -extern int FUN_L00_0025c698(void *, void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int FUN_L00_00261b48(int, void *, void *, void *); extern int is_point_inside_clip_volume(void *arg0, int arg1) __asm__("func_00214720"); -extern s32 FUN_L01_00276fe8(void *, s32, s32, void *, s32, void *, f32); +extern s32 follow_path(void *, s32, s32, void *, s32, void *, f32) __asm__("FUN_L01_00276fe8"); extern s32 random_integer_below_c2(s32) __asm__("func_00213260"); extern s32 spawn_spark_c(void *, void *, void *, s32, s32, s32, s32, s32, s32) __asm__("func_00218888"); extern s32 truncate_float_to_s32_c4(f32) __asm__("func_001FA6D0"); @@ -1088,9 +1091,9 @@ extern float D_L05_00161AC4 __attribute__((sda)); extern int D_L05_00161AC8 __attribute__((sda)); extern void FUN_L00_0024f7c8(void *, int, void *); extern void FUN_L00_00257d78(float *, float, float); -extern void FUN_L00_00259bc8(void *, int, int, void *, void *, float); +extern void spawn_nearby_effect(void *, int, int, void *, void *, float) __asm__("FUN_L00_00259bc8"); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L00_00261d78(int, void *, void *, float); extern void FUN_L00_00263b38(void *, float); extern void FUN_L00_00263fd8_c(void *, int, void *, void *, int, int, float, void *, void *, void *) __asm__("FUN_L00_00263fd8"); @@ -1104,7 +1107,8 @@ void FUN_L05_00303b08_c(struct Moby *m, s32 node, f32 side) __asm__("FUN_L05_003 extern float D_0013F3D0[]; extern char D_001404A8[]; -void FUN_L05_00301f48(unsigned char *m) { +void extermibot_update(unsigned char *m) __asm__("FUN_L05_00301f48"); +void extermibot_update(unsigned char *m) { char *d = *(char **)(m + 0x78); char *t; float dir[4]; @@ -1182,7 +1186,7 @@ void FUN_L05_00301f48(unsigned char *m) { break; case 1: if (*(int *)(d + 0x164) != 2 && random_integer_below_c2(9) == 0) { - if (FUN_L01_00276fe8(d + 0x2C0, 1, *(int *)(d + 0x2C4), m + 0x10, (s32)(t + 0x10), dir, + if (follow_path(d + 0x2C0, 1, *(int *)(d + 0x2C4), m + 0x10, (s32)(t + 0x10), dir, (D_L05_00161A98) * 0.4f) != 0) { if (random_integer_below_c2(0x100) & 1) { *(float *)(d + 0x298) = -*(float *)(d + 0x298); @@ -1328,7 +1332,7 @@ void FUN_L05_00301f48(unsigned char *m) { if ((m[0x70] & 2) && m[0x53] == 2) { blend_moby_animation(m, 7, 0, scale_game_frames(5)); } - if (FUN_001f9770(d + 0x2D0) != 0) { + if (fast_dec_timer_s16(d + 0x2D0) != 0) { float a; m[0x20] = 8; *(short *)(d + 0x2D0) = 0; @@ -1350,10 +1354,10 @@ void FUN_L05_00301f48(unsigned char *m) { out[0] = random_float_between_c3(-D_0015ED6C, D_0015ED6C); out[1] = random_float_between_c3(-D_0015ED6C, D_0015ED6C); out[2] = random_float_between_c3(-(D_L05_00161ABC * D_0015ED6C), D_L05_00161ABC * D_0015ED6C); - c1 = truncate_float_to_s32_c4(FUN_001f96b0(random_float_between_c3(D_L05_00161AAC, D_L05_00161AAC * 2.0f))); - c2 = truncate_float_to_s32_c4(FUN_001f96b0(random_float_between_c3(D_L05_00161AB0, D_L05_00161AB0 * 1.2f))); + c1 = truncate_float_to_s32_c4(FUN_L04_001f1978(random_float_between_c3(D_L05_00161AAC, D_L05_00161AAC * 2.0f))); + c2 = truncate_float_to_s32_c4(FUN_L04_001f1978(random_float_between_c3(D_L05_00161AB0, D_L05_00161AB0 * 1.2f))); spawn_spark_c(pos, dir, out, D_L05_00161A9C, D_L05_00161AA0, c1, c2, - truncate_float_to_s32_c4(FUN_001f96b0(random_float_between_c3(D_L05_00161AB4, D_L05_00161AB4 * 1.2f))), -1); + truncate_float_to_s32_c4(FUN_L04_001f1978(random_float_between_c3(D_L05_00161AB4, D_L05_00161AB4 * 1.2f))), -1); } dir[3] = D_L05_00161AC0 * 0.1f; out[3] = D_L05_00161AC4 * 0.1f; @@ -1366,10 +1370,10 @@ void FUN_L05_00301f48(unsigned char *m) { out[0] = random_float_between_c3(-D_0015ED6C, D_0015ED6C); out[1] = random_float_between_c3(-D_0015ED6C, D_0015ED6C); out[2] = random_float_between_c3(-(D_L05_00161ABC * D_0015ED6C), D_L05_00161ABC * D_0015ED6C); - c1 = truncate_float_to_s32_c4(FUN_001f96b0(random_float_between_c3(D_L05_00161AAC, D_L05_00161AAC * 2.0f))); - c2 = truncate_float_to_s32_c4(FUN_001f96b0(random_float_between_c3(D_L05_00161AB0, D_L05_00161AB0 * 1.2f))); + c1 = truncate_float_to_s32_c4(FUN_L04_001f1978(random_float_between_c3(D_L05_00161AAC, D_L05_00161AAC * 2.0f))); + c2 = truncate_float_to_s32_c4(FUN_L04_001f1978(random_float_between_c3(D_L05_00161AB0, D_L05_00161AB0 * 1.2f))); spawn_spark_c(pos, dir, out, D_L05_00161AA4, D_L05_00161AA8, c1, c2, - truncate_float_to_s32_c4(FUN_001f96b0(random_float_between_c3(D_L05_00161AB4, D_L05_00161AB4 * 1.2f))), -1); + truncate_float_to_s32_c4(FUN_L04_001f1978(random_float_between_c3(D_L05_00161AB4, D_L05_00161AB4 * 1.2f))), -1); } } break; @@ -1387,7 +1391,7 @@ void FUN_L05_00301f48(unsigned char *m) { dir[3] = 5627.9248f; qcopy(out, t + 0x10); out[2] += 0.75f; - FUN_L00_00259bc8(t, (int)m, *(int *)(((char *)&D_001404A8)) != 6 ? 0x10001 : 0x10000, out, dir, 1.0f); + spawn_nearby_effect(t, (int)m, *(int *)(((char *)&D_001404A8)) != 6 ? 0x10001 : 0x10000, out, dir, 1.0f); } if (m[0x70] & 2) { m[0x20] = 9; @@ -1424,14 +1428,14 @@ void FUN_L05_00301f48(unsigned char *m) { } break; case 11: - if (FUN_L00_0025c698(m, d + 0x70) & 0x60) { - if (FUN_L01_00276fe8(d + 0x2C0, 1, *(int *)(d + 0x2C4), m + 0x10, (s32)(d + 0x270), dir, + if (mine_fall(m, d + 0x70) & 0x60) { + if (follow_path(d + 0x2C0, 1, *(int *)(d + 0x2C4), m + 0x10, (s32)(d + 0x270), dir, (D_L05_00161A98) * 0.4f) != 0) { m[0x20] = 4; if (m[0x53] != 1) blend_moby_animation(m, 1, 0, scale_game_frames(10)); break; } - FUN_L00_0025f090(m, m + 0x10, -1, 0.5f, 13.0f); + cart_burst(m, m + 0x10, -1, 0.5f, 13.0f); mark_moby_for_removal_c2(m); return; } @@ -1447,8 +1451,8 @@ void FUN_L05_00301f48(unsigned char *m) { } break; case 14: - if (FUN_L00_0025c698(m, d + 0x70) & 0x60) { - FUN_L00_0025f090(m, m + 0x10, -1, 0.5f, 13.0f); + if (mine_fall(m, d + 0x70) & 0x60) { + cart_burst(m, m + 0x10, -1, 0.5f, 13.0f); FUN_L00_00263fd8_c(m, 0x6DA, m + 0x10, m + 0x40, 0, 0, 0.0f, D_L05_0015F580, D_L05_0015F580, D_L05_0015F580); FUN_L00_00263fd8_c(m, 0x6DB, m + 0x10, m + 0x40, 0, 0, 0.0f, D_L05_0015F580, D_L05_0015F580, D_L05_0015F580); FUN_L00_00263fd8_c(m, 0x6DC, m + 0x10, m + 0x40, 0, 0, 0.0f, D_L05_0015F580, D_L05_0015F580, D_L05_0015F580); @@ -1567,7 +1571,7 @@ extern void subtract_vector_xyz_c(void *, void *, void *) __asm__("FUN_001f9a28" float absolute_float(float input) __asm__("func_001F99C0"); int FUN_L00_0025ff38(float best, char *a, char *o, int *excluded, int excluded_count, void *region, int region_count); void FUN_L00_00257470(unsigned char *m, int flags, int arg); -void FUN_L00_0025ab48(void *v, float *ang, float *s1, float *s2); +void trooper_knockback_arc(void *v, float *ang, float *s1, float *s2) __asm__("FUN_L00_0025ab48"); void FUN_L00_0025c558(u8 *a, void *b, int c, int d, int e, float f); void FUN_L00_0025d458(void *a, void *s); void FUN_L00_0025d538(s32 id, void *s); @@ -1794,26 +1798,26 @@ void FUN_L05_00303b08(struct Moby *m, s32 node, f32 side) { v->mode = 2; } qcopy(&goal, &v->goal); - dist = FUN_001f9b80(&m->pos, &goal); + dist = vector_distance(&m->pos, &goal); if (dist > 5.0f && side != 0.0f && FUN_L05_00303e50((char *)m, (float *)&goal, D_L05_00161A98_gp * 0.4f)) { - a = FUN_001fa580(FUN_001f9e90(goal.x - m->pos.x, goal.y - m->pos.y), side); + a = fast_add_rotations(fast_arc_tan(goal.x - m->pos.x, goal.y - m->pos.y), side); approach_angle(&m->rot.z, a, &v->yaw_vel, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, frame_time * 25.132742f); } else { - approach_angle(&m->rot.z, FUN_001f9e90(goal.x - m->pos.x, goal.y - m->pos.y), &v->yaw_vel, + approach_angle(&m->rot.z, fast_arc_tan(goal.x - m->pos.x, goal.y - m->pos.y), &v->yaw_vel, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, frame_time * 25.132742f); } - if (angle_diff(m->rot.z, FUN_001f9e90(goal.x - m->pos.x, goal.y - m->pos.y)) < 1.5707964f && dist > 3.0f) + if (angle_diff(m->rot.z, fast_arc_tan(goal.x - m->pos.x, goal.y - m->pos.y)) < 1.5707964f && dist > 3.0f) approach_value(&v->speed, frame_time * 6.0f, frame_time_sq * 6.0f); else approach_value(&v->speed, frame_time, frame_time_sq * 6.0f); - dir.x = FUN_001f9dc8(m->rot.z) * 2.0f; - dir.y = FUN_001f9de0(m->rot.z) * 2.0f; + dir.x = fast_cos(m->rot.z) * 2.0f; + dir.y = fast_sin(m->rot.z) * 2.0f; dir.z = 0.0f; FUN_L00_00258b50(m, v->move, &dir, &out, 1.0f); if (v->stuck_timer == 0) { if (FUN_L05_00304058_u(v->path, &m->pos, &m->pos, D_L05_00161A98_gp * 0.4f) > 2.0f) - v->stuck_timer = FUN_001f96f8(5); + v->stuck_timer = scale_game_frames(5); } } extern float FUN_001f9e90_c(float, float) __asm__("FUN_001f9e90"); @@ -1985,7 +1989,7 @@ extern float D_0015ED6C_gp __asm__("D_0015ED6C") __attribute__((section(".sdata" extern float FUN_L00_0025bc00(float *, int, float, float); extern float fast_add_rotations_c5(float, float) __asm__("func_001FA580"); extern int frame_number_gp __asm__("D_L05_0015F5CC") __attribute__((section(".sdata"))); -extern int FUN_001efa68(void *, void *, int, void *, void *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); extern int FUN_L00_00259028(char *m, char *p, float *pos, char *v); extern int FUN_L00_00259740(void *, void *, int); extern s32 spawn_spark_c2(void *, void *, void *, s32, s32, s32, s32, s32, s32) __asm__("func_00218888"); @@ -2032,7 +2036,8 @@ extern char D_0013E533[]; typedef char *(*Spawn_305778)(void *, void *, void *, int, int, long, long, long, int); -void FUN_L05_00304320(unsigned char *m) { +void extermitank_update(unsigned char *m) __asm__("FUN_L05_00304320"); +void extermitank_update(unsigned char *m) { char *d = *(char **)(m + 0x78); float v10[4]; float v20[4]; @@ -2151,7 +2156,7 @@ void FUN_L05_00304320(unsigned char *m) { *(int *)D_L05_001B0930[*(int *)(d + 0x190)]) != 0) { qcopy(v10, m + 0x10); v10[2] = v10[2] + 3.0f; - if (FUN_001efa68(v10, h + 0x50, 2, m, 0) == 0) { + if (collision_line(v10, h + 0x50, 2, m, 0) == 0) { if (m[0x53] != 0) blend_moby_animation(m, 0, 0, 3); m[0x20] = 2; } @@ -2214,9 +2219,9 @@ void FUN_L05_00304320(unsigned char *m) { v30[1] = fast_sin_c7(fast_add_rotations_c5(*(float *)(d + 0x194), ang)) * (D_L05_00161B28 * D_0015ED6C_gp); v30[2] = 0.0f; v30[2] = random_float_between_c4(D_L05_00161B2C * D_0015ED6C_gp * 0.9f, D_L05_00161B2C * D_0015ED6C_gp * 1.1f); - a = truncate_float_to_s32_c5(FUN_001f96b0(random_float_between_c4(D_L05_00161B14, D_L05_00161B14 + D_L05_00161B14))); - b = truncate_float_to_s32_c5(FUN_001f96b0(random_float_between_c4(D_L05_00161B18, D_L05_00161B18 * 1.2f))); - e = truncate_float_to_s32_c5(FUN_001f96b0(random_float_between_c4(D_L05_00161B1C, D_L05_00161B1C * 1.2f))); + a = truncate_float_to_s32_c5(scale_time(random_float_between_c4(D_L05_00161B14, D_L05_00161B14 + D_L05_00161B14))); + b = truncate_float_to_s32_c5(scale_time(random_float_between_c4(D_L05_00161B18, D_L05_00161B18 * 1.2f))); + e = truncate_float_to_s32_c5(scale_time(random_float_between_c4(D_L05_00161B1C, D_L05_00161B1C * 1.2f))); r = ((Spawn_305778)spawn_spark_c2)(v40, v20, v30, D_L05_00161B0C, D_L05_00161B10, a, b, e, -1); if ((frame_number_gp & 7) == 0 && r != 0 && i == 0) { int j; @@ -2249,9 +2254,9 @@ void FUN_L05_00304320(unsigned char *m) { v30[1] = fast_sin_c7(fast_add_rotations_c5(*(float *)(d + 0x194), ang)) * (D_L05_00161B58 * D_0015ED6C_gp); v30[2] = 0.0f; v30[2] = random_float_between_c4(D_L05_00161B5C * D_0015ED6C_gp * 0.7f, D_L05_00161B5C * D_0015ED6C_gp * 1.5f); - a = truncate_float_to_s32_c5(FUN_001f96b0(random_float_between_c4(D_L05_00161B44, D_L05_00161B44 + D_L05_00161B44))); - b = truncate_float_to_s32_c5(FUN_001f96b0(random_float_between_c4(D_L05_00161B48, D_L05_00161B48 * 1.2f))); - e = truncate_float_to_s32_c5(FUN_001f96b0(random_float_between_c4(D_L05_00161B4C, D_L05_00161B4C * 1.2f))); + a = truncate_float_to_s32_c5(scale_time(random_float_between_c4(D_L05_00161B44, D_L05_00161B44 + D_L05_00161B44))); + b = truncate_float_to_s32_c5(scale_time(random_float_between_c4(D_L05_00161B48, D_L05_00161B48 * 1.2f))); + e = truncate_float_to_s32_c5(scale_time(random_float_between_c4(D_L05_00161B4C, D_L05_00161B4C * 1.2f))); ((Spawn_305778)spawn_spark_c2)(v40, v20, v30, D_L05_00161B3C, D_L05_00161B40, a, b, e, -1); } qcopy(v40, m + 0x10); @@ -2262,7 +2267,7 @@ void FUN_L05_00304320(unsigned char *m) { || (*(int *)(d + 0x190) != -1 && FUN_L00_00259740(h, D_L05_001B0930[*(int *)(d + 0x190)] + 0x10, *(int *)D_L05_001B0930[*(int *)(d + 0x190)]) == 0) - || FUN_001efa68(v40, D_0013E533 + 0xEED, 2, m, 0) != 0) { + || collision_line(v40, D_0013E533 + 0xEED, 2, m, 0) != 0) { if (m[0x53] != 0) blend_moby_animation(m, 0, 0, 3); m[0x20] = 1; } @@ -2290,15 +2295,15 @@ extern int allocate_voice_305178(int, int, void *) __asm__("FUN_0022da68"); extern void stop_animation_305178(void *, int, int) __asm__("FUN_L00_00257470"); extern void spawn_effects_305178(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); -extern float FUN_001fa580(float, float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern int scale_frames_305178(int) __asm__("FUN_001f96f8"); extern void clear_vector_305178(void *) __asm__("FUN_001f99f8"); extern void spawn_particle_305178(void *, int, void *, void *, int, int, float, void *, void *, void *) __asm__("FUN_L00_00263fd8"); extern void update_motion_305178(void *, void *) __asm__("FUN_L00_0025d458"); -extern float FUN_001f9e90(float, float); -extern float FUN_001fa688(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); +extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern int tick_305178(void *) __asm__("FUN_001f9740"); extern float vector_length_305178(void *) __asm__("FUN_001f9af0"); extern void finish_motion_305178(void *, void *) __asm__("FUN_L00_0025d538"); @@ -2356,15 +2361,15 @@ void FUN_L05_00305178(char *moby) { spawn_effects_305178(moby, data + 0x40, position, 0.0f, 0.0f, 0x14, 8, 0x14, 4.0f, 2.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, -1, 0); qcopy(position, moby + 0x10); - position[0] += 2.0f * FUN_001f9dc8(*(float *)(moby + 0x48)); - position[1] += 2.0f * FUN_001f9de0(*(float *)(moby + 0x48)); + position[0] += 2.0f * fast_cos(*(float *)(moby + 0x48)); + position[1] += 2.0f * fast_sin(*(float *)(moby + 0x48)); spawn_effects_305178(moby, data + 0x40, position, 0.0f, 0.0f, 0x14, 8, 0x14, 4.0f, 2.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, -1, 0); qcopy(position, moby + 0x10); - angle = FUN_001fa580(*(float *)(moby + 0x48), 3.14159274f); - position[0] += 2.0f * FUN_001f9dc8(angle); - angle = FUN_001fa580(*(float *)(moby + 0x48), 3.14159274f); - position[1] += 2.0f * FUN_001f9de0(angle); + angle = fast_add_rotations(*(float *)(moby + 0x48), 3.14159274f); + position[0] += 2.0f * fast_cos(angle); + angle = fast_add_rotations(*(float *)(moby + 0x48), 3.14159274f); + position[1] += 2.0f * fast_sin(angle); spawn_effects_305178(moby, data + 0x40, position, 0.0f, 0.0f, 0x14, 8, 0x14, 4.0f, 2.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, -1, 0); *(short *)(data + 0x19e) = scale_frames_305178(D_L05_00161B74); @@ -2402,9 +2407,9 @@ void FUN_L05_00305178(char *moby) { *(int *)(data + 0x178) = scale_frames_305178(0xf0); *(int *)(data + 0x38) = 0; base = &hero; - angle = FUN_001f9e90(base->motion.pos.f[0] - *(float *)(moby + 0x10), + angle = fast_arc_tan(base->motion.pos.f[0] - *(float *)(moby + 0x10), base->motion.pos.f[1] - *(float *)(moby + 0x14)); - if (FUN_001fa688(*(float *)(moby + 0x48), angle) > 1.5707964f) + if (fast_difference_between_rotations(*(float *)(moby + 0x48), angle) > 1.5707964f) ((signed char *)data)[0xc4] *= -1; } if (tick_305178(data + 0x178) != 0) @@ -2493,8 +2498,8 @@ void FUN_L05_00305898(char *m) { } } -extern float FUN_001f9e90(float, float); -extern float FUN_001f9b80(void *, void *); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_difference_between_rotations(float, float) __asm__("func_001FA688"); extern int FUN_L01_0028b510(void *, void *, float); extern int FUN_L00_0025d7a0(char *, int, int, int); @@ -2539,13 +2544,13 @@ void FUN_L05_00306e10(char *obj) { float heading, distance; FUN_L05_00306d30((char *)moby, d->node, target); - heading = FUN_001f9e90(target[0] - moby->position[0], target[1] - moby->position[1]); + heading = fast_arc_tan(target[0] - moby->position[0], target[1] - moby->position[1]); for (;;) { L16PatrolPath *path; L16PatrolPath *base; FUN_L05_00306d30((char *)moby, d->node, target); - distance = FUN_001f9b80(target, d->position); + distance = vector_distance(target, d->position); if ((fast_difference_between_rotations(heading, moby->yaw) < 1.5707964f || distance > 4.0f) && distance > 2.0f) { break; } @@ -2568,7 +2573,7 @@ void FUN_L05_00306e10(char *obj) { } /* The same two statements as before the loop, written out again: the compiler merges the copies. */ FUN_L05_00306d30((char *)moby, d->node, target); - heading = FUN_001f9e90(target[0] - moby->position[0], target[1] - moby->position[1]); + heading = fast_arc_tan(target[0] - moby->position[0], target[1] - moby->position[1]); } } @@ -2588,12 +2593,11 @@ struct LeapVars { s16 sequence; /* 0x272 */ }; -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int FUN_001fa6d0(float); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int FUN_L00_002595a0(float *, float *, float, float, float); extern float FUN_0020c9e0(struct Moby *); -extern void leap_anim_307570(struct Moby *, int, int, int) __asm__("FUN_L05_00307480"); void FUN_L05_00307570(struct Moby *m) { float root0, root1; @@ -2602,8 +2606,8 @@ void FUN_L05_00307570(struct Moby *m) { if (d->timer != 0) { float duration; float acceleration; - if (m->prev_seq != 5 && FUN_001f96f8(3) >= d->timer) { - leap_anim_307570(m, 5, 1, FUN_001f96f8(5)); + if (m->prev_seq != 5 && scale_game_frames(3) >= d->timer) { + FUN_L05_00307480(m, 5, 1, scale_game_frames(5)); d->sequence = -1; } acceleration = frame_time_sq * 21.0f * -0.5f; @@ -2613,14 +2617,14 @@ void FUN_L05_00307570(struct Moby *m) { root0 > 0.0f) { duration = FUN_001fa6d0(root0); } - if (FUN_001f96f8(7) < d->timer && FUN_001f96f8(11) > d->timer && m->prev_seq == 5 && - (float)FUN_001f96f8(27) < duration) { + if (scale_game_frames(7) < d->timer && scale_game_frames(11) > d->timer && m->prev_seq == 5 && + (float)scale_game_frames(27) < duration) { short sequence; int chosen; chosen = random_int_between(0, 3) + 1; d->sequence = chosen; sequence = chosen; - leap_anim_307570(m, sequence, 1, FUN_001f96f8(7)); + FUN_L05_00307480(m, sequence, 1, scale_game_frames(7)); } if (d->sequence != -1) { if (m->seq == m->prev_seq) { @@ -2635,11 +2639,11 @@ void FUN_L05_00307570(struct Moby *m) { } } if (d->sequence != -1) { - if (duration < (float)FUN_001f96f8(9)) { - leap_anim_307570(m, 5, 3, FUN_001f96f8(7)); + if (duration < (float)scale_game_frames(9)) { + FUN_L05_00307480(m, 5, 3, scale_game_frames(7)); d->sequence = -1; } else if (m->anim_flags & 2) { - leap_anim_307570(m, 5, 2, FUN_001f96f8(7)); + FUN_L05_00307480(m, 5, 2, scale_game_frames(7)); d->sequence = -1; } } @@ -2654,7 +2658,7 @@ void FUN_L05_00307570(struct Moby *m) { } else { m->anim_speed = 1.0f; if ((m->anim_flags & 2) && m->prev_seq != 0) { - leap_anim_307570(m, 0, 0, FUN_001f96f8(8)); + FUN_L05_00307480(m, 0, 0, scale_game_frames(8)); } } if (d->rider != 0) @@ -2734,11 +2738,11 @@ extern float FUN_L00_0025bc98(void *, float, void *, int, float, float, float); extern float probe_ground_height(void *, int, float) __asm__("func_00213508"); extern int D_0015EE38_macro __asm__("D_0015EE38") __attribute__((section(".sdata"))); extern int D_L05_00178300[]; -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_0025e3b8(int); extern unsigned char D_0013D388[]; -extern void FUN_L00_001f2868(void *, int, void *, void *, float); -extern void FUN_L00_00259bc8(void *, int, int, void *, void *, float); +extern void collect_mobies_in_sphere(void *, int, void *, void *, float) __asm__("FUN_L00_001f2868"); +extern void spawn_nearby_effect(void *, int, int, void *, void *, float) __asm__("FUN_L00_00259bc8"); extern void FUN_L00_0025a120(void *); extern void FUN_L00_00263b38(void *, float); extern void FUN_L05_00306d30_c(char *moby, int idx, float *out) __asm__("FUN_L05_00306d30"); @@ -2751,7 +2755,8 @@ extern char D_001413DC[]; extern char D_0013F350[]; extern int func_L00_001F2BE8_308D68(void *, int, void *, void *, float) __asm__("FUN_L00_001f2868"); -void FUN_L05_00307910(Moby *moby) { +void skid_mcmarx_update(Moby *moby) __asm__("FUN_L05_00307910"); +void skid_mcmarx_update(Moby *moby) { float path_point[4]; float step[4]; float probe[4]; @@ -2775,7 +2780,7 @@ void FUN_L05_00307910(Moby *moby) { qcopy(data->pos, ((float *)&moby->pos)); moby->rot.x = 0.0f; moby->rot.y = 0.0f; - moby->rot.z = FUN_001f9e90(path->points[1].x - path->points[0].x, path->points[1].y - path->points[0].y); + moby->rot.z = fast_arc_tan(path->points[1].x - path->points[0].x, path->points[1].y - path->points[0].y); data->cruise_speed = D_0015ED6C_gp * 17.0f + (float)data->racer_index * (D_0015ED6C_gp * 1.55f); data->launch_speed = D_0015ED6C_gp * 24.0f + (float)data->racer_index * (D_0015ED6C_gp * 1.55f); if (D_0013D388[0] == 0) { @@ -2850,7 +2855,7 @@ void FUN_L05_00307910(Moby *moby) { for (i = data->point_index; i < data->jump_point; i = next) { next = FUN_L00_0025d7a0((char *)data->path, i, 1, 1); - path_length += FUN_001f9b80((float (*)[4])data->path + (i + 1), (float (*)[4])data->path + (next + 1)); + path_length += vector_distance((float (*)[4])data->path + (i + 1), (float (*)[4])data->path + (next + 1)); } air_time = path_length / data->speed; jump_speed = (data->path->points[data->jump_point].z - data->path->points[data->point_index].z) / air_time + frame_time_sq_macro * 21.0f * air_time * 0.5f; @@ -2862,7 +2867,7 @@ void FUN_L05_00307910(Moby *moby) { } FUN_L05_00307570_c((unsigned char *)moby); FUN_L05_00306d30_c((char *)moby, data->point_index, path_point); - FUN_L00_0025bc98(&moby->rot.z, FUN_001f9e90(path_point[0] - moby->pos.x, path_point[1] - moby->pos.y), &data->yaw_speed, 0, + FUN_L00_0025bc98(&moby->rot.z, fast_arc_tan(path_point[0] - moby->pos.x, path_point[1] - moby->pos.y), &data->yaw_speed, 0, frame_scale_sq_macro * 0.035f, frame_scale_sq_macro * 0.3f, D_0015ED6C_gp * 6.981317f); if (data->pos[2] < path_point[2] - 5.0f) { data->pos[2] = path_point[2]; @@ -2878,7 +2883,7 @@ void FUN_L05_00307910(Moby *moby) { scale_vector_xyz(push, step, 7.0f); for (j = 0; j < hit_count; j++) { if (FUN_L00_0025e3b8(D_L05_00178300[j]) != 0) { - FUN_L00_00259bc8((void *)D_L05_00178300[j], (int)moby, 0x30000, data->pos, push, 1.0f); + spawn_nearby_effect((void *)D_L05_00178300[j], (int)moby, 0x30000, data->pos, push, 1.0f); } } } @@ -2892,7 +2897,7 @@ void FUN_L05_00307910(Moby *moby) { data->jump_frames = 0; } data->pos[2] += data->vertical_speed; - if (FUN_001f9770(&data->launch_timer) != 0) { + if (fast_dec_timer_s16(&data->launch_timer) != 0) { float target = data->cruise_speed; Hero *hero; @@ -2967,7 +2972,7 @@ void FUN_L05_00307910(Moby *moby) { extern f32 fast_add_rotations(f32 a, f32 b) __asm__("FUN_001fa580"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern int fast_dec_timer(int *arg0) __asm__("FUN_001f9740"); -extern void FUN_L00_00260738(char *, void *, void *, void *); +extern void update_entity_matrix(char *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void allocate_voice_for_target_entry_alt(int, int, int) __asm__("FUN_0022da68"); extern void subtract_vector_xyz(void *out, void *a, void *b) __asm__("FUN_001f9a28"); @@ -2977,7 +2982,8 @@ extern float D_L05_00161CDC __attribute__((sda)); extern float D_L05_00161CE0 __attribute__((sda)); extern int D_L05_00161CE4 __attribute__((sda)); extern int D_L05_00161CE8 __attribute__((sda)); -void FUN_L05_0030bdd8(unsigned char *moby) { +void floating_platform_update(unsigned char *moby) __asm__("FUN_L05_0030bdd8"); +void floating_platform_update(unsigned char *moby) { char *data = *(char **)(moby + 0x78); float v[4]; float w[4]; @@ -3016,17 +3022,17 @@ void FUN_L05_0030bdd8(unsigned char *moby) { *(float *)(moby + 0x40) = D_L05_00161CE0 * DEG_TO_RAD * fast_sin(*(float *)(data + 0x6C)); subtract_vector_xyz(d, p, v); - FUN_L00_00260738(data + 0x20, d, r, q); + update_entity_matrix(data + 0x20, d, r, q); break; } } extern char *D_L05_0015FFD8_c __asm__("D_L05_0015FFD8"); extern void FUN_L00_00260668(char *, char *, char *, char *, char *, char *); extern void FUN_L00_002604f0(char *, char *, char *, char *, char *, char *); -extern void FUN_001f9a28(float *, char *, float *); extern void FUN_L00_00260738_c(char *, float *, float *, char *) __asm__("FUN_L00_00260738"); -void FUN_L05_0030bf98(char *moby) +void box_update(char *moby) __asm__("FUN_L05_0030bf98"); +void box_update(char *moby) { char *d = *(char **)(moby + 0x78); float p[4]; @@ -3044,7 +3050,7 @@ void FUN_L05_0030bf98(char *moby) qcopy(p, moby + 0x10); qcopy(q, moby + 0x40); FUN_L00_002604f0(moby, D_L05_0015FFD8_c + (*(int *)(d + 0x80) << 8), d + 0x60, d + 0x70, moby + 0x10, moby + 0x40); - FUN_001f9a28(r, moby + 0x10, p); + fast_vec_sub(r, moby + 0x10, p); FUN_L00_00260738_c(d + 0x20, r, q, moby + 0x40); break; } @@ -3114,9 +3120,9 @@ extern void initialize_slots_30ca80(void *, int) __asm__("FUN_L01_002b7a48"); extern void initialize_slot_data_30ca80(float) __asm__("FUN_L01_002b7ef0"); extern void copy_slot_30ca80(float *, int *) __asm__("FUN_L01_002b7c68"); extern void FUN_L05_0030d6a0_30ca80(int) __asm__("FUN_L05_0030d6a0"); -extern void set_group_state_30ca80(int, int) __asm__("FUN_L01_0026e0e0"); +extern void FUN_L01_0026e0e0(int, int); extern float advance_accelerated_scalar_30ca80(float *, float *, float, float, float, float) __asm__("FUN_00213f38"); -extern void update_group_30ca80(char *) __asm__("FUN_L05_0030d5c0"); +extern void FUN_L05_0030d5c0(char *); extern void pool_splash_30ca80(void *, int, int, float, float, float, float) __asm__("FUN_L00_002a3ec8"); extern int FUN_L01_00275690_30ca80(char *, float) __asm__("FUN_L01_00275690"); extern void finish_slots_30ca80(char *, int) __asm__("FUN_L01_002b7fe0"); @@ -3149,7 +3155,8 @@ extern float move_speed __asm__("D_L05_00161D30") __attribute__((sda)); extern float move_accel __asm__("D_L05_00161D34") __attribute__((sda)); extern s32 D_L05_001612D8 __attribute__((section(".sdata"))); /* Update of the level 05 water mobys: sets up the 48-record water chain, moves the surface by state and keeps its record in step. */ -void FUN_L05_0030ca80(struct Moby *moby) { +void water_update(struct Moby *moby) __asm__("FUN_L05_0030ca80"); +void water_update(struct Moby *moby) { WaterVars_30ca80 *d = *(WaterVars_30ca80 **)&moby->pvars; switch (moby->state) { @@ -3249,7 +3256,7 @@ void FUN_L05_0030ca80(struct Moby *moby) { case 2: if (moby->command & 4) { d->moving = 1; - set_group_state_30ca80(moby->group, 1); + FUN_L01_0026e0e0(moby->group, 1); } else if (d->f10 >= 0) { if (mission_states_30ca80[moby->mission + (current_level_index << 4)] == 0xFF) { moby->state = 1; @@ -3258,7 +3265,7 @@ void FUN_L05_0030ca80(struct Moby *moby) { } if (d->moving != 0) { advance_accelerated_scalar_30ca80(&moby->pos.z, &d->speed, d->lowered_z, move_speed * D_0015ED70, move_speed * D_0015ED70, move_accel * D_0015ED6C_gp); - update_group_30ca80((char *)moby); + FUN_L05_0030d5c0((char *)moby); } moby->command = 1; if (random_integer_below_30ca80(0xC8) == 0) { @@ -3271,13 +3278,13 @@ void FUN_L05_0030ca80(struct Moby *moby) { case 1: if (moby->command & 8) { d->moving = 1; - set_group_state_30ca80(moby->group, 2); + FUN_L01_0026e0e0(moby->group, 2); } else { moby->command = 2; } if (d->moving != 0) { advance_accelerated_scalar_30ca80(&moby->pos.z, &d->speed, d->raised_z, move_speed * D_0015ED70, move_speed * D_0015ED70, move_accel * D_0015ED6C_gp); - update_group_30ca80((char *)moby); + FUN_L05_0030d5c0((char *)moby); } if (random_integer_below_30ca80(0xC8) == 0) { float x = water_records_30ca80[d->record_index].x + random_float_between_30ca80(-4.0f, 4.0f); @@ -3335,7 +3342,7 @@ void FUN_L05_0030ca80(struct Moby *moby) { } } moby->pos.z += rise_speeds[rise_step] * D_0015ED6C_gp; - update_group_30ca80((char *)moby); + FUN_L05_0030d5c0((char *)moby); water = moby->pos.z; { Vec4 v; @@ -3360,7 +3367,7 @@ void FUN_L05_0030ca80(struct Moby *moby) { } } if (moby->pos.z >= 44.0f) { - set_group_state_30ca80(moby->group, 7); + FUN_L01_0026e0e0(moby->group, 7); } break; } @@ -3395,6 +3402,7 @@ extern char D_L05_001D6880[]; extern int D_L05_0015FFD8; extern short *D_L05_001ABCC0[]; +void FUN_L05_0030d5c0(char *moby); void FUN_L05_0030d5c0(char *moby) { char *data = *(char **)(moby + 0x78); short *p = D_L05_001ABCC0[*(unsigned char *)(moby + 0x21)]; @@ -3417,3 +3425,9 @@ void FUN_L05_0030d5c0(char *moby) { } } while (*p++ >= 0); } + +s32 D_L05_001CAD28[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001CAD2C[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_001CAD30[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_001CAD34[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_001CAD38[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/l05/gameplay/hero/00239fc0.c b/src/overlays/l05/gameplay/hero/00239fc0.c index ab3079dc37..357b35b0d2 100644 --- a/src/overlays/l05/gameplay/hero/00239fc0.c +++ b/src/overlays/l05/gameplay/hero/00239fc0.c @@ -120,17 +120,17 @@ extern f32 D_L05_00174268 __attribute__((section(".data"))); void FUN_001f99f8_c(void *) __asm__("FUN_001f99f8"); void hero_get_collision_ray_endpoints(void *, void *, s32, f32, f32) __asm__("FUN_L00_002126b8"); -s32 FUN_001efa68(void *, void *, s32, s32, s32); +s32 collision_line(void *, void *, s32, s32, s32) __asm__("FUN_001efa68"); s32 coll_sound_class(void) __asm__("FUN_L00_001f3608"); s32 collision_hit_material(void) __asm__("FUN_001f0b58"); f32 resolve_camera_surface_height(void *, void *) __asm__("FUN_002135f0"); s32 FUN_L00_0025e3b8(s32); -u8 *FUN_002141f8(s32); +u8 *suck_get_aim_height(s32) __asm__("FUN_002141f8"); f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); void sceVu0Normalize(void *, void *) __asm__("FUN_00125180"); f32 FUN_L00_00233d30(void *); f32 FUN_001f9e90_c(f32, f32) __asm__("FUN_001f9e90"); -void FUN_001f9a28(void *, void *, void *); +void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); f32 FUN_001f9ab0_c(void *, void *) __asm__("FUN_001f9ab0"); void FUN_001f9a68_c(void *, void *, f32) __asm__("FUN_001f9a68"); void FUN_001f9bf8_c(void *, void *, f32) __asm__("FUN_001f9bf8"); @@ -176,7 +176,7 @@ void FUN_L05_002402a8(void) { g = hero.unk234 * 2.9f; } hero_get_collision_ray_endpoints(&v10, &v0, k, g, -48.0f); - if (FUN_001efa68(&v10, &v0, 2, (s32)hero.moby, 0) == 0) { + if (collision_line(&v10, &v0, 2, (s32)hero.moby, 0) == 0) { goto tail; } r = coll_sound_class(); @@ -190,7 +190,7 @@ void FUN_L05_002402a8(void) { if (hero.motion.pos.f[2] < hero.water_surface_z && hero.unk2F8 <= 0) { hero.unk2F8 = 1; } - if (FUN_001efa68(&v10, &v0, 0x24, (s32)hero.moby, 0) == 0) { + if (collision_line(&v10, &v0, 0x24, (s32)hero.moby, 0) == 0) { goto d1; } r = coll_sound_class(); @@ -202,14 +202,14 @@ void FUN_L05_002402a8(void) { if (hero.ground_type == 0xD) { hero.water_surface_z = D_L05_00174268; v10.f[2] = D_L05_00174268 - 0.01f; - if (FUN_001efa68(&v10, &v0, 4, (s32)hero.moby, 0) == 0) { + if (collision_line(&v10, &v0, 4, (s32)hero.moby, 0) == 0) { goto d1; } } if (hero.ground_type == 3) { hero.unk2F4 = D_L05_00174268; v10.f[2] = D_L05_00174268 - 0.01f; - if (FUN_001efa68(&v10, &v0, 4, (s32)hero.moby, 0) == 0) { + if (collision_line(&v10, &v0, 4, (s32)hero.moby, 0) == 0) { goto d1; } } @@ -227,7 +227,7 @@ void FUN_L05_002402a8(void) { FUN_L00_002334d0((u8 *)&HH.point, (u8 *)&HH.point, 1.0f); } } - p = FUN_002141f8(HH.moby); + p = suck_get_aim_height(HH.moby); if (p != 0 && (*(u16 *)(p + 0x1E) & 8)) { hero.unk30A = 1; } @@ -240,7 +240,7 @@ void FUN_L05_002402a8(void) { sceVu0Normalize((u8 *)&hero.unk270, (u8 *)&HH.normal_x); hero.ground_slope.f = FUN_L00_00233d30((u8 *)&HH.normal_x); hero.downhill_yaw = FUN_001f9e90_c(HH.normal_x, HH.normal_y); - FUN_001f9a28(&v20, (u8 *)&hero.ground_point, (u8 *)&hero.motion.pos); + fast_vec_sub(&v20, (u8 *)&hero.ground_point, (u8 *)&hero.motion.pos); if (0.0f < FUN_001f9ab0_c(&v20, (u8 *)&hero.unk270)) { hero.ground_distance = -hero.ground_distance; } @@ -273,7 +273,7 @@ void FUN_L05_002402a8(void) { FUN_001f9a68_c((u8 *)&hero.gravity_dir, (u8 *)&hero.gravity_dir, -1.0f); break; case 2: - FUN_001f9a28((u8 *)&hero.gravity_dir, (u8 *)&hero.motion.unkB0, (u8 *)&hero.motion.pos); + fast_vec_sub((u8 *)&hero.gravity_dir, (u8 *)&hero.motion.unkB0, (u8 *)&hero.motion.pos); FUN_001f9bf8_c((u8 *)&hero.gravity_dir, (u8 *)&hero.gravity_dir, 1.0f); break; } @@ -306,7 +306,7 @@ void FUN_L05_002402a8(void) { } FUN_L00_002335c8(&v30, 0.2f, a, 0.45f); FUN_L00_002335c8(&v40, 0.2f, a, -0.45f); - if (FUN_001efa68(&v30, &v0, 0x22, (s32)hero.moby, 0)) { + if (collision_line(&v30, &v0, 0x22, (s32)hero.moby, 0)) { f = HH.point.f[2] - hero.ground_z.f; hero.unk2C0.f[i] = f; if (0.4f < FUN_001f99c0(f)) { @@ -340,16 +340,16 @@ typedef union { f32 f[4]; } V_2133a8; extern void vzero_2133a8(void *) __asm__("FUN_001f99f8"); -extern void f2347c0_2133a8(void) __asm__("FUN_L00_002347c0"); -extern void f233660_2133a8(void *, f32, f32, f32) __asm__("FUN_L00_00233660"); -extern void f233810_2133a8(void *, void *, f32) __asm__("FUN_L00_00233810"); -extern void f2334d0_2133a8(void *, void *, f32) __asm__("FUN_L00_002334d0"); +extern void FUN_L00_002347c0(void); +extern void FUN_L00_00233660(void *, f32, f32, f32); +extern void FUN_L00_00233810(void *, void *, f32); +extern void FUN_L00_002334d0(void *, void *, f32); extern void vadd_2133a8(void *, void *, void *) __asm__("FUN_001f9a10"); extern void vsub_2133a8(void *, void *, void *) __asm__("FUN_001f9a28"); extern f32 vlen_2133a8(void *) __asm__("FUN_001f9af0"); extern s32 coll1_2133a8(void *, s32, s32, f32) __asm__("FUN_L00_001f0d60"); extern s32 coll2_2133a8(void *, s32, f32, s32, f32) __asm__("FUN_L00_001f19a0"); -extern s32 coll3_2133a8(void *, f32) __asm__("FUN_L00_001f3170"); +extern s32 FUN_L00_001f3170(void *, f32); extern void vscl_2133a8(void *, void *, f32) __asm__("FUN_001f9bf8"); extern u128_2133a8 D_L05_00174270[] __attribute__((section(".data"))); s32 FUN_L05_00240ed0(s32 mode) { @@ -366,19 +366,19 @@ s32 FUN_L05_00240ed0(s32 mode) { qcopy(&old, &hero.motion.pos.q); vzero_2133a8(&v); if (hero.unk22DA != 0) { - f2347c0_2133a8(); + FUN_L00_002347c0(); hero.unk22DA = 0; } if (hero.state.control_mode != 0x11) { if (hero.state.control_mode == 0x16) { - f233660_2133a8(&v, 0.0f, 0.0f, 0.7f); + FUN_L00_00233660(&v, 0.0f, 0.0f, 0.7f); vsub_2133a8(&v, &v, &hero.motion.pos.q); } else if (hero.unk20B3 != 0 || hero.unk1F8 != 0) { if (hero.unk20B3 == 1 || hero.unk1F8 != 0 || (unsigned)(hero.state.control_mode - 0x15) < 2) { - f233810_2133a8(&v, &v, 0.6f); + FUN_L00_00233810(&v, &v, 0.6f); } else { - f2334d0_2133a8(&v, &v, -hero.unk224); + FUN_L00_002334d0(&v, &v, -hero.unk224); } } else { v.f[2] = hero.unk224; @@ -406,7 +406,7 @@ s32 FUN_L05_00240ed0(s32 mode) { h = 0.05f; } a = coll2_2133a8(&hero.motion.pos.q, mask, hero.unk234, ((s32)hero.moby), h); - if (!(a | coll3_2133a8(&hero.motion.pos.q, hero.unk234))) + if (!(a | FUN_L00_001f3170(&hero.motion.pos.q, hero.unk234))) break; } c = D_L05_00174270; @@ -442,7 +442,7 @@ s32 FUN_L05_00240ed0(s32 mode) { } -s32 FUN_001efa68(void *, void *, s32, s32, s32); +s32 collision_line(void *, void *, s32, s32, s32) __asm__("FUN_001efa68"); typedef union { OvlQuad q; f32 f[4]; } V_c413e0; @@ -488,14 +488,14 @@ extern char *D_L05_00174258[]; extern f32 dot_vectors_xyz(void *, void *) __asm__("func_001F9AB0"); extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); -extern float FUN_L00_00213350(void *); -extern float FUN_L00_002339d0(float *v); -extern float FUN_L00_00233a78(float *); +extern float forward_component(void *) __asm__("FUN_L00_00213350"); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); +extern float gravity_z(float *) __asm__("FUN_L00_00233a78"); extern void set_vector_length_xy(void *, void *, float) __asm__("FUN_001f9c48"); extern void FUN_L00_00212ff0(void); extern void FUN_L00_002137a8(void); -extern void FUN_L00_002338d0(float *, float *); -extern void FUN_L00_00233b20(float *, float *, float); +extern void gravity_flatten(float *, float *) __asm__("FUN_L00_002338d0"); +extern void gravity_set_z(float *, float *, float) __asm__("FUN_L00_00233b20"); extern void FUN_L00_00233ba0(float *, float *, float); extern void FUN_L00_00233f80(int, void *, void *); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); @@ -537,22 +537,22 @@ void FUN_L05_002413e0(void) { float length; position = (float *)((char *)position + 0x60); - length = FUN_L00_002339d0(position); + length = gravity_length_xy(position); limit = player->speed_limit - 0.02f; if (limit < length) normalize_vector_xyz(position, position, limit); } limited_velocity = (float *)(&hero.motion.velocity); - magnitude = FUN_L00_00233a78(limited_velocity); + magnitude = gravity_z(limited_velocity); limit = -*(float *)((char *)limited_velocity + 0x1FC); /* the player's gravity_limit */ if (magnitude < limit) { if (limit > 0.0f) limit = 0.0f; - FUN_L00_00233b20(limited_velocity, limited_velocity, limit); + gravity_set_z(limited_velocity, limited_velocity, limit); } } else if (player->mode == 22) { qcopy(work.f, position); work.f[2] += 0.5f; add_vector_xyz(plane.f, work.f, (char *)position + 0x60); - if (FUN_001efa68(position, plane.f, 2, 0, 0)) { + if (collision_line(position, plane.f, 2, 0, 0)) { char *hit = D_L05_00174258[0]; if (!hit || *(short *)(hit + 0xA6) == 0x1F6 || *(short *)(hit + 0xA6) == 0x59F) { @@ -610,8 +610,8 @@ void FUN_L05_002413e0(void) { if (magnitude < 0.0f) magnitude = 0.0f; normalize_vector_xyz(delta, velocity, magnitude); qcopy(work.f, velocity); - FUN_L00_002338d0(work.f, work.f); - FUN_L00_002338d0(horizontal, horizontal); + gravity_flatten(work.f, work.f); + gravity_flatten(horizontal, horizontal); normalize_vector_xyz(horizontal, horizontal, 1.0f); magnitude = dot_vectors_xyz(horizontal, work.f); if (magnitude < 0.0f) magnitude = 0.0f; @@ -627,7 +627,7 @@ void FUN_L05_002413e0(void) { motion_player->speed = vector_length_xyz(delta); motion_player->horizontal_speed = vector_length_xy(delta); work.q = *(OvlQuad *)delta; - motion_player->vertical_speed = FUN_L00_00213350(work.f); + motion_player->vertical_speed = forward_component(work.f); if (motion_player->vertical_speed < 0.0f) motion_player->vertical_speed = 0.0f; qcopy(work.f, new_position); contact = (float *)((char *)delta - 0x20); diff --git a/src/overlays/l05/gameplay/hero/00244a70.c b/src/overlays/l05/gameplay/hero/00244a70.c index 8c1a0280a9..43ec9363fc 100644 --- a/src/overlays/l05/gameplay/hero/00244a70.c +++ b/src/overlays/l05/gameplay/hero/00244a70.c @@ -139,9 +139,9 @@ extern void FUN_L00_002132b8(f32, f32); extern void FUN_L00_00217118(f32, f32); extern void stick_target(f32, s32) __asm__("FUN_L00_002118c8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); -extern void FUN_L00_00211e30(s32, f32, f32, f32); +extern void turn_to(s32, f32, f32, f32) __asm__("FUN_L00_00211e30"); extern void FUN_L00_00211e30_b(f32, f32, f32, s32) __asm__("FUN_L00_00211e30"); -extern s32 FUN_001f9740(void *); +extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 FUN_L00_00229a98(void); extern void FUN_L00_00211e98(void); @@ -192,10 +192,10 @@ extern u8 D_L05_0017C420[]; extern void FUN_L00_00216e48(s32, struct MobyView *, s32); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); -extern s32 FUN_001f9770(s16 *); +extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); extern void FUN_L00_00209a40(s32, s32); extern void FUN_L00_00209ca8(s32, s32, s32); -extern void FUN_L00_002a3ec8(s32, s32, s32, f32, f32, f32, f32); +extern void pool_splash(s32, s32, s32, f32, f32, f32, f32) __asm__("FUN_L00_002a3ec8"); extern f32 FUN_L00_0025bc98(f32 *, f32, f32 *, s32, f32, f32, f32); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); @@ -209,7 +209,7 @@ extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 FUN_L00_00209018(void *, s32); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern void FUN_L00_0020a1e0(f32, f32); @@ -233,21 +233,21 @@ extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern s32 FUN_L00_002595a0(f32 *, f32 *, f32, f32, f32); extern f32 FUN_L00_0025bc00(f32 *, f32, s32, f32); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern f32 square_root(f32) __asm__("FUN_001f9988"); -extern f32 FUN_L00_00233a78(void *); -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); -extern f32 FUN_L00_00213350(void *); +extern f32 gravity_z(void *) __asm__("FUN_L00_00233a78"); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); +extern f32 forward_component(void *) __asm__("FUN_L00_00213350"); extern struct HeroTableRow2C D_L05_0017C088[]; extern struct LevelTable_QS D_L05_00167080; #define Q D_L05_00167080 extern void FUN_L00_00233ba0(void *, void *, f32); -extern void FUN_L00_00233b20(void *, void *, f32); +extern void gravity_set_z(void *, void *, f32) __asm__("FUN_L00_00233b20"); extern void FUN_L00_002336e8(void *, void *, f32); extern void make_hit_descriptor(void *, struct MobyView *, s32, f32, void *) __asm__("FUN_L00_00259888"); extern s32 collect_mobies_in_sphere(f32, void *, s32, struct MobyView *, void *) __asm__("FUN_L00_001f2868"); @@ -258,8 +258,8 @@ extern void FUN_L00_001ff290(void *, void *, void *); extern void FUN_L00_002a9b80(struct MobyView *, void *); extern s32 FUN_L00_002a96f8(struct MobyView *, void *, f32, f32, s32, f32, f32, f32); extern void FUN_L00_002335c8(void *, f32, f32, f32); -extern s32 FUN_L00_002598b0(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32); -extern f32 FUN_001f9ab0(void *, void *); +extern s32 play_entity_sound(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32) __asm__("FUN_L00_002598b0"); +extern f32 fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); struct PlayerSpeedTuning { u8 pad0[8]; f32 x08; @@ -271,14 +271,14 @@ extern struct PlayerSpeedTuning D_L05_0017C218; extern s32 FUN_L00_00216de8(s32, s32); extern void FUN_L00_00233708(void *, void *, f32); extern void FUN_L00_00233810(void *, void *, f32); -extern s32 FUN_001efa68(void *, void *, s32, struct MobyView *, s32); +extern s32 collision_line(void *, void *, s32, struct MobyView *, s32) __asm__("FUN_001efa68"); extern void FUN_L00_00215340(void); extern void FUN_L00_00233660(void *, f32, f32, f32); extern s32 FUN_L00_0025e3b8(s32); -extern void FUN_L00_00259bc8(s32, struct MobyView *, s32, void *, void *, f32); +extern void spawn_nearby_effect(s32, struct MobyView *, s32, void *, void *, f32) __asm__("FUN_L00_00259bc8"); extern s32 D_L05_00178300[]; extern void FUN_L00_00209ec8(void); -extern void FUN_L00_002338d0(void *, void *); +extern void gravity_flatten(void *, void *) __asm__("FUN_L00_002338d0"); extern s32 hero_slot_item_id(s32) __asm__("FUN_L00_0020d498"); extern void FUN_L00_0020b5b8(void); extern void FUN_L01_0022d090(void); @@ -291,7 +291,7 @@ extern void FUN_L00_0020d2f8(void *); extern f32 randf_sym(f32, f32) __asm__("FUN_L00_00257c48"); extern void FUN_L00_0026d598(void *, void *, s32); extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); -extern s32 FUN_L00_0025d808(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); +extern s32 sample_path(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); extern s32 FUN_L00_0025d7a0(void *, s32, s32, s32); extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); extern void hero_integrate_velocity(void) __asm__("FUN_L00_00214108"); @@ -350,8 +350,8 @@ void FUN_L05_00244a70(void) { v0.f[0] = 1.0f; transform_vector_by_basis(&hero.motion.unk170, &v0, &D_L05_001671D8[0x1F8]); hero.motion.move_yaw = *(f32 *)D_L05_001671D8; - FUN_L00_00211e30(0, frame_scale_sq, frame_scale_sq * 0.0f, frame_time * 174.53293f); - if (D_L05_0015F688 > 0 && FUN_001f9740(&D_L05_0015F688) != 0) { + turn_to(0, frame_scale_sq, frame_scale_sq * 0.0f, frame_time * 174.53293f); + if (D_L05_0015F688 > 0 && fast_dec_timer(&D_L05_0015F688) != 0) { s32 t; if (usage_stats.stat[18].count < 0xFFFF) { usage_stats.stat[18].count++; @@ -374,7 +374,7 @@ void FUN_L05_00244a70(void) { if (hero.state.current == HERO_STATE_CROUCH || hero.state.current == 0x17) { if (hero.unk229C > 0.2f || ((struct MobyView *)hero.moby)->b53 == 0xE || ((struct MobyView *)hero.moby)->b53 == 0xF) { if (hero.state.current == HERO_STATE_CROUCH) { - FUN_L00_00211e30(0, frame_scale_sq * 0.002f, frame_scale_sq * 0.07f, + turn_to(0, frame_scale_sq * 0.002f, frame_scale_sq * 0.07f, frame_time * 6.981317f); } else if (hero.state.current == 0x17) { FUN_L00_00211e98(); @@ -510,7 +510,7 @@ void FUN_L05_00244a70(void) { } if (hero.unk90A != 0) { s32 n; - FUN_001f9770(&hero.unk90A); + fast_dec_timer_s16(&hero.unk90A); n = (s16)hero.unk90A >> 2; FUN_L00_00209a40(n > 8 ? 8 : n, 0); } @@ -524,7 +524,7 @@ void FUN_L05_00244a70(void) { if (hero.state_timer == 1) { FUN_L00_00209ca8(3, 0x10, 0); if (D_L05_001612D0 != 0) { - FUN_L00_002a3ec8(D_L05_001612D0, D_L05_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L05_001612D0, D_L05_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, -0.3f); } hero.unk90A = scale_game_frames(70); @@ -633,9 +633,9 @@ void FUN_L05_00244a70(void) { FUN_L00_0025bc98(&hero.motion.rot.f[1], steer, &hero.unk8E8, 0, accel, rate, lo); diff = fast_subtract_rotations(hero.motion.rot.f[1], old); stick_target(1.0f, 0); - FUN_L00_00211e30(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); + turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); hero.unk8EC = hero.motion.unk184; - FUN_001f9740(&hero.unk8F4); + fast_dec_timer(&hero.unk8F4); if (hero.state.step == 1) { hero.target_speed = frame_time * 6.0f; } else if (hero.state.current == 0x35) { @@ -665,7 +665,7 @@ void FUN_L05_00244a70(void) { if (hero.state.current != 0x35 || !(PD.u1A0.i1A0 & 0xA)) { hero.target_speed *= k; }; - if (FUN_001f9740(&hero.unk8F0) != 0) { + if (fast_dec_timer(&hero.unk8F0) != 0) { s32 lo2; s32 hi2; pl = &hero; @@ -688,7 +688,7 @@ void FUN_L05_00244a70(void) { } pl->unk8F0 = random_int_between(lo2, scale_game_frames(hi2)); } - if (hero.state.current == 0x35 && FUN_001f9770(&hero.unk8F8) != 0) { + if (hero.state.current == 0x35 && fast_dec_timer_s16(&hero.unk8F8) != 0) { struct MobyView *gm = (struct MobyView *)hero.items[3].moby; if (gm != NULL && gm->hA6 == 0x261) { s32 i; @@ -726,7 +726,7 @@ void FUN_L05_00244a70(void) { } build_spherical_offset(&hero.motion.velocity, sp, hero.motion.rot.f[2], yaw); } else if (hero.state.current == 0x34) { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); if (hero.state.prev == 0x35) { approach_value(&len, 0.0f, frame_time_sq * 8.0f); } else { @@ -774,11 +774,11 @@ void FUN_L05_00244a70(void) { break; case 0x6A: case 0x82: { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); approach_value(&len, 0.0f, frame_time_sq * 4.0f); fast_vec_normalize(&hero.motion.unk150, &hero.motion.unk150, len); qcopy(&hero.motion.velocity, &hero.motion.unk150); - if (FUN_001f9740(&hero.unk8F0) == 2) { + if (fast_dec_timer(&hero.unk8F0) == 2) { moby_point_position((struct MobyView *)hero.moby, 4, &v0); v20.q = 0; v20.f[0] = 0.4f; @@ -824,8 +824,8 @@ void FUN_L05_00244a70(void) { hero.target_speed = frame_time * 3.0f * 0.5f; } } - FUN_L00_00211e30(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); - FUN_001f9740(&hero.unk698); + turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); + fast_dec_timer(&hero.unk698); if (hero.state.current == 0x36) { if (PD.i1D4 != 0 && hero.unk698 != 0) { hero.target_speed = frame_time * 3.0f; @@ -911,25 +911,25 @@ void FUN_L05_00244a70(void) { } hero.unk88D = hero.unk89C && (PD.u1A0.i1A0 & 0xF); if ((((PD.u1A0.i1A0 & 0x80) || hero.unk8CC != 0) && hero.unk864 != 0) || hero.unk8C4 != 0) { - FUN_001f9770(&hero.unk8CC); + fast_dec_timer_s16(&hero.unk8CC); if (hero.unk884 == 0) { hero.unk8CC = scale_game_frames(20); } hero.unk884 = 1; - FUN_L00_0025b8c0(&hero.unk87C, &hero.unk858, 1.2217305f, frame_scale_sq * 0.01f, frame_scale_sq * 0.3f, + vendor_spring(&hero.unk87C, &hero.unk858, 1.2217305f, frame_scale_sq * 0.01f, frame_scale_sq * 0.3f, frame_time * 0.6981317f); approach_value(&hero.unk868, frame_time * 11.0f, frame_time_sq * 20.0f); if (hero.unk8C4 != 0) { - FUN_001f9740(&hero.unk8C4); + fast_dec_timer(&hero.unk8C4); } else { - FUN_001f9740(&hero.unk864); + fast_dec_timer(&hero.unk864); } if ((struct MobyView *)hero.unk86C != NULL) { ((struct MobyView *)hero.unk86C)->bBC = 1; } } else { hero.unk884 = 0; - FUN_L00_0025b8c0(&hero.unk87C, &hero.unk858, 1.2217305f, frame_scale_sq * 0.007f, frame_scale_sq * 0.3f, + vendor_spring(&hero.unk87C, &hero.unk858, 1.2217305f, frame_scale_sq * 0.007f, frame_scale_sq * 0.3f, frame_time * 0.5235988f); approach_value(&hero.unk868, 0.0f, frame_time_sq * 10.0f); } @@ -1050,7 +1050,7 @@ void FUN_L05_00244a70(void) { for (i = 0; i < n; i++) { if (FUN_L00_0025e3b8(D_L05_00178300[i]) != 0 || ((struct MobyView *)D_L05_00178300[i])->hA6 == 0x85) { - FUN_L00_00259bc8(D_L05_00178300[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, 1.0f); + spawn_nearby_effect(D_L05_00178300[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, 1.0f); } } } @@ -1171,7 +1171,7 @@ void FUN_L05_00244a70(void) { if ((struct MobyView *)hero.unk964 != NULL) { hero.motion.move_yaw = fast_arc_tan(((struct MobyView *)hero.unk964)->u10.f10 - moby->u10.f10, ((struct MobyView *)hero.unk964)->u10.f14.v - moby->u10.f14.v); - FUN_L00_00211e30(0, frame_scale_sq * 0.02f, frame_scale_sq * 0.15f, frame_time * 6.2831855f); + turn_to(0, frame_scale_sq * 0.02f, frame_scale_sq * 0.15f, frame_time * 6.2831855f); } break; case 0x25: { @@ -1187,7 +1187,7 @@ void FUN_L05_00244a70(void) { approach_value(&hero.unk960, frame_time * 27.0f, frame_time_sq * 80.0f); hero.motion.move_yaw = fast_arc_tan(((struct MobyView *)hero.unk964)->u10.f10 - moby->u10.f10, ((struct MobyView *)hero.unk964)->u10.f14.v - moby->u10.f14.v); - FUN_L00_00211e30(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.15f, frame_time * 7.330383f); + turn_to(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.15f, frame_time * 7.330383f); } else if (hero.state.step == 1) { approach_value(&hero.unk960, 0.0f, frame_time_sq * 42.0f); } @@ -1204,7 +1204,7 @@ void FUN_L05_00244a70(void) { FUN_L00_0025bc00(&hero.motion.rot.f[1], 0.0f, 0, frame_time * 3.8397243f); } else { f32 an = fast_add_rotations( - -fast_arc_tan(FUN_001f9b80(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); + -fast_arc_tan(vector_distance(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); FUN_L00_0025bc00(&hero.motion.rot.f[1], an, 0, frame_time * 6.4577184f); } v20.f[0] = fast_cos(fast_add_rotations(hero.motion.rot.f[2], -1.5707964f)) * -0.57f; @@ -1249,7 +1249,7 @@ void FUN_L05_00244a70(void) { FUN_L00_0025bc98(&hero.unk9AC, a, &hero.unk9B8, 0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f, 0.0f); } hero.motion.move_yaw = hero.unk9AC; - FUN_L00_00211e30(0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f, frame_time * 4.712389f); + turn_to(0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f, frame_time * 4.712389f); subtract_vector_xyz(&v0, &((struct MobyView *)hero.unk994)->u10.v10, &hero.motion.pos); fast_vec_normalize(&v0, &v0, 1.0f); if (v0.f[2] < 0.23f) { @@ -1288,14 +1288,14 @@ void FUN_L05_00244a70(void) { } if (hero.unk99C != 0) { f32 s; - if (FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { + if (vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.displacement, frame_time_sq * 40.0f); - if (hero.unk9BE != 0 && FUN_L00_00233a78(&hero.motion.velocity) > 0.0f) { + if (hero.unk9BE != 0 && gravity_z(&hero.motion.velocity) > 0.0f) { subtract_vector_xyz(&m80[3], &hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 57.0f); } } - s = FUN_001f9af0(&hero.motion.velocity) * (frame_time * 0.015f); + s = fast_vec_length(&hero.motion.velocity) * (frame_time * 0.015f); fast_vec_scale(&m80[3], &hero.motion.velocity, -1.0f); fast_vec_normalize(&m80[3], &m80[3], s); add_vector_xyz(&hero.motion.velocity, &hero.motion.velocity, &m80[3]); @@ -1303,7 +1303,7 @@ void FUN_L05_00244a70(void) { { struct MobyView *r; if ((struct MobyView *)hero.unk994 != NULL && (r = ((struct MobyView *)hero.unk994)->pm78) != NULL) { - f32 len = FUN_001f9af0(&hero.motion.velocity); + f32 len = fast_vec_length(&hero.motion.velocity); if (r->fC < len) { approach_value(&len, r->fC, frame_time_sq * 15.0f); fast_vec_normalize(&hero.motion.velocity, &hero.motion.velocity, len); @@ -1324,9 +1324,9 @@ void FUN_L05_00244a70(void) { add_vector_xyz(&m80[3], &((struct MobyView *)hero.unk994)->u10.v10, &vC0); subtract_vector_xyz(&hero.motion.velocity, &m80[3], &vD0); old = hero.unk9A4; - FUN_L00_0025b8c0(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); + vendor_spring(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); d = hero.unk9A4 - old; - if (FUN_001f9af0(&vC0) > hero.unk9A4) { + if (fast_vec_length(&vC0) > hero.unk9A4) { fast_vec_normalize(&vC0, &vC0, d); add_vector_xyz(&hero.motion.pos, &hero.motion.pos, &vC0); } @@ -1335,7 +1335,7 @@ void FUN_L05_00244a70(void) { f32 mx = frame_time * 14.0f; f32 sp = vector_length_xy(&hero.motion.velocity); if (sp < mx) { - FUN_L00_0025b8c0(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); + vendor_spring(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); m80[3].f[0] = fast_cos(hero.unk9AC) * hero.unk9B4; m80[3].f[1] = fast_sin(hero.unk9AC) * hero.unk9B4; m80[3].f[2] = 0.0f; @@ -1352,7 +1352,7 @@ void FUN_L05_00244a70(void) { up = hero.unk9BC == 1; } else { m80[3].q = hero.motion.displacement.q; - up = FUN_L00_00213350(&m80[3]) > 0.0f; + up = forward_component(&m80[3]) > 0.0f; } if (up) { if (moby->b53 != 0x35) { @@ -1388,12 +1388,12 @@ void FUN_L05_00244a70(void) { mx = frame_time_sq * 70.0f; t2 = scale_game_frames(33); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk4B0); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unk4B8 = 1.0f; } } @@ -1425,7 +1425,7 @@ void FUN_L05_00244a70(void) { } hero.target_speed = 0.0f; if ((struct MobyView *)hero.unkA54 != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = frame_time * 4.5f; } @@ -1438,7 +1438,7 @@ void FUN_L05_00244a70(void) { } if (hero.unkA58 != 0 || (struct MobyView *)hero.unkA54 != NULL) { hero.motion.move_yaw = hero.unkA5C; - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); } else if (hero.anim_frame < 25.0f) { FUN_L00_00214ed8(8.0f, 1.0471976f, 1.0471976f); } @@ -1466,16 +1466,16 @@ void FUN_L05_00244a70(void) { } FUN_L00_00211870(27.0f); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 130.0f); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unkA70 = 1.0f; } - if (FUN_L00_00233a78(&hero.motion.velocity) < frame_time * -37.0f) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); + if (gravity_z(&hero.motion.velocity) < frame_time * -37.0f) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); } } break; @@ -1504,10 +1504,10 @@ void FUN_L05_00244a70(void) { } hero.motion.move_yaw = hero.unkA5C; if (ok) { - FUN_L00_00211e30(1, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, + turn_to(1, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); } else { - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); } } else { @@ -1545,7 +1545,7 @@ void FUN_L05_00244a70(void) { tb = &D_L05_0017C088[hero.attack_record]; hero.target_speed = 0.0f; if ((struct MobyView *)hero.unkA54 != NULL && scale_game_frames(4) > hero.state_timer) { - f32 d = FUN_001f9b80(&((struct MobyView *)hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; + f32 d = vector_distance(&((struct MobyView *)hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; f32 off; f32 tol; f32 mx; @@ -1606,7 +1606,7 @@ void FUN_L05_00244a70(void) { hero.anim_speed = 1.0f / (fast_difference_between_rotations(hero.unkA5C, hero.motion.rot.f[2]) + 1.0f); } hero.motion.move_yaw = hero.unkA5C; - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); } else { s32 ok = 1; if (tb->kind == 1 && hero.unkA9C == 0 && hero.anim_frame > 7.0f) { @@ -1641,14 +1641,14 @@ void FUN_L05_00244a70(void) { hero.motion.velocity.f[2] = 0.0f; } hero.motion.move_yaw = fast_add_rotations(hero.unkA68, 3.1415927f); - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); break; case 0x20: { s32 t1; s32 t2; if (hero.unkA58 != 0 || (struct MobyView *)hero.unkA54 != NULL) { hero.motion.move_yaw = hero.unkA5C; - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); } else if (hero.state_timer < scale_game_frames(4)) { FUN_L00_00214ed8(11.0f, 0.87266463f, -1.0f); } @@ -1721,7 +1721,7 @@ void FUN_L05_00244a70(void) { hero.target_speed = 0.0f; if (hero.unkA58 != 0) { hero.motion.move_yaw = hero.unkA5C; - FUN_L00_00211e30(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 15.009831f); + turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 15.009831f); } else { FUN_L00_00214ed8(11.0f, 0.87266463f, -1.0f); } @@ -1764,7 +1764,7 @@ void FUN_L05_00244a70(void) { Vec4 *p = &hero.move_impulse; FUN_L00_002132b8(0.7f, 0.0f); v0.q = hero.move_impulse.q; - hero.target_speed += FUN_L00_00213350(&v0); + hero.target_speed += forward_component(&v0); if (hero.target_speed < frame_time * 0.7f) { hero.target_speed = frame_time * 0.7f; } @@ -1772,7 +1772,7 @@ void FUN_L05_00244a70(void) { } k = 1.0f; if (hero.state.step == 1 && hero.unk3BE == 0) { - FUN_L00_00211e30(0, frame_scale_sq * 0.008f, frame_scale_sq * 0.15f, frame_time * 9.948377f); + turn_to(0, frame_scale_sq * 0.008f, frame_scale_sq * 0.15f, frame_time * 9.948377f); } else { f32 c = hero.unk229C; f32 r = hero.motion.unk188; @@ -1788,7 +1788,7 @@ void FUN_L05_00244a70(void) { FUN_L00_00211f38(); } else { f32 f = hero.unk229C + 0.35f; - FUN_L00_00211e30(0, frame_scale_sq * 0.005f * f, frame_scale_sq * 0.1f, + turn_to(0, frame_scale_sq * 0.005f * f, frame_scale_sq * 0.1f, frame_time * 4.712389f * f); } } @@ -1847,14 +1847,14 @@ void FUN_L05_00244a70(void) { v10.f[2] += random_float_between(frame_time, frame_time * 2.0f); FUN_L00_00271b18(&v0, &v10, random_float_between(37800.0f, 75600.0f)); } - f = FUN_001f9af0(&hero.motion.platform_delta); + f = fast_vec_length(&hero.motion.platform_delta); if (f > frame_time * 0.5f) { hero.motion.move_yaw = fast_arc_tan(hero.motion.platform_delta.f[0], hero.motion.platform_delta.f[1]); } else { hero.motion.move_yaw = hero.motion.rot.f[2]; } old = hero.motion.rot.f[2]; - FUN_L00_00211e30(0, f * 0.125f * frame_scale_sq, frame_scale_sq * 0.2f, frame_time * 4.1887903f); + turn_to(0, f * 0.125f * frame_scale_sq, frame_scale_sq * 0.2f, frame_time * 4.1887903f); d = fast_difference_between_rotations(hero.motion.rot.f[2], old); clear_u64_value(&hero.motion.velocity); FUN_L00_00216710(frame_time_sq * 5.0f); @@ -1883,7 +1883,7 @@ void FUN_L05_00244a70(void) { case 0x18: case 0x19: hero.motion.move_yaw = fast_add_rotations(hero.unk4E4, 3.1415927f); - FUN_L00_00211e30(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 6.2831855f); + turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 6.2831855f); FUN_L00_0025bc00(&hero.motion.rot.f[1], 0.0f, 0, frame_time * 4.712389f); subtract_vector_xyz(&hero.motion.velocity, &hero.unk4D0, &hero.motion.pos); FUN_L00_0025f730(&hero.motion.velocity, frame_time * 4.0f); @@ -1930,7 +1930,7 @@ void FUN_L05_00244a70(void) { add_vector_xyz(&m40[1], &v0, &v10); fast_vec_scale(&m40[1], &m40[1], 0.5f); hero.motion.move_yaw = a; - FUN_L00_00211e30(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 6.2831855f); + turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 6.2831855f); fl = hero.motion.unk164; approach_value(&fl, hero.target_speed * frame_time, frame_time_sq * 5.0f); subtract_vector_xyz(&hero.motion.velocity, &m40[1], &hero.motion.pos); @@ -2007,9 +2007,9 @@ void FUN_L05_00244a70(void) { if (hero.state.current == 0x42) { r = hero.unk5CC * (f32)hero.unk578; } - FUN_L00_0025d808((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); + sample_path((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); if (hero.unk590 != 0) { - FUN_L00_0025d808((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); + sample_path((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); } if (scale_game_frames(90) < hero.unk19C) { s32 h; @@ -2019,11 +2019,11 @@ void FUN_L05_00244a70(void) { qcopy(&v20, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - h = FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); + h = sample_path((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); qcopy(&v30, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - if ((h | FUN_L00_0025d808((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || + if ((h | sample_path((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || hero.unk584 != 0) { f32 a = fast_subtract_rotations( hero.unk57C, fast_arc_tan(v30.f[0] - v20.f[0], v30.f[1] - v20.f[1])) * @@ -2080,7 +2080,7 @@ void FUN_L05_00244a70(void) { } idx = FUN_L00_0025d7a0((void *)hero.unk560, hero.unk564, hero.unk578, hero.unk584); subtract_vector_xyz(&v20, (Vec4 *)hero.unk560 + (idx + 1), &v0); - if (FUN_001f9af0(&v20) < 0.001f) { + if (fast_vec_length(&v20) < 0.001f) { if (hero.unk564 == idx) { hero.unk570 = scale_game_frames(1); break; @@ -2090,13 +2090,13 @@ void FUN_L05_00244a70(void) { hero.unk580 = fast_arc_tan(vector_length_xy(&v20), v20.f[2]); } hero.motion.move_yaw = fast_add_rotations(hero.unk57C, hero.unk588); - FUN_L00_00211e30(0, frame_scale_sq * 0.015f, frame_scale_sq * 0.15f, frame_time * 6.2831855f); + turn_to(0, frame_scale_sq * 0.015f, frame_scale_sq * 0.15f, frame_time * 6.2831855f); if (((hero.state.current == 0x29 || hero.state.current == 0x2A) && hero.unk418 == 0) || hero.state.current == 0x42) { if (hero.unk5C4 != 0) { f32 a = fast_arc_tan(hero.unk550.f[0] - hero.motion.pos.f[0], hero.unk550.f[1] - hero.motion.pos.f[1]); if (fast_difference_between_rotations(hero.motion.rot.f[2], a) < 1.5707964f) { hero.motion.move_yaw = a; - FUN_L00_00211e30(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, + turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 6.2831855f); } } @@ -2127,7 +2127,7 @@ void FUN_L05_00244a70(void) { hero.motion.pos.f[2] += v20.f[2]; subtract_vector_xyz(&v30, &hero.unk500, &hero.motion.pos); v30.f[2] = 0.0f; - if (FUN_001f9af0(&v30) > frame_time) { + if (fast_vec_length(&v30) > frame_time) { fast_vec_normalize(&v30, &v30, frame_time); } hero.motion.pos.f[0] += v30.f[0]; @@ -2175,8 +2175,8 @@ void FUN_L05_00244a70(void) { si = hero.unk564; sf = hero.unk568; qcopy(&v20, &hero.motion.pos); - FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); - e = fast_arc_tan(FUN_001f9b80(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); + sample_path((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); + e = fast_arc_tan(vector_distance(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); if (e > 0.0f) { sp = e * 1.9098593f * (frame_time * -2.5f); if (e > 0.2617994f && hero.unk5A8 != 2 && hero.unk5A8 != 3) { @@ -2213,9 +2213,9 @@ void FUN_L05_00244a70(void) { f32 mx = frame_time * 7.0f; f32 fl; f32 len; - fl = -FUN_001f9af0(&v20); - FUN_L00_0025b8c0(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); - len = FUN_001f9af0(&v20); + fl = -fast_vec_length(&v20); + vendor_spring(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); + len = fast_vec_length(&v20); if (len < hero.unk5DC) { hero.unk5DC = len; } @@ -2270,8 +2270,8 @@ void FUN_L05_00244a70(void) { FUN_L00_00215340(); FUN_L00_002132b8(0.7f, frame_time * 0.0f); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; case 0x77: { @@ -2283,8 +2283,8 @@ void FUN_L05_00244a70(void) { len = vector_length_xy(&hero.motion.velocity); FUN_L00_001ff600(frame_scale * -0.100000024f * len + len, &hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; } @@ -2304,13 +2304,13 @@ void FUN_L05_00244a70(void) { } stick_target(hero.unk229C * m, 0); if (hero.unk229C > 0.2f && !(PD.u1A0.i1A0 & 3)) { - FUN_L00_00211e30(0, frame_scale_sq * 0.027f, frame_scale_sq * 0.3f, + turn_to(0, frame_scale_sq * 0.027f, frame_scale_sq * 0.3f, frame_time * 5.934119f * hero.unk229C); } if (PD.u1A0.i1A0 & 3) { f32 o = hero.motion.move_yaw; hero.motion.move_yaw = *(f32 *)D_L05_001671D8; - FUN_L00_00211e30(0, frame_scale_sq * 0.017f, frame_scale_sq * 0.3f, frame_time * 4.712389f); + turn_to(0, frame_scale_sq * 0.017f, frame_scale_sq * 0.3f, frame_time * 4.712389f); hero.motion.move_yaw = o; } { @@ -2323,11 +2323,11 @@ void FUN_L05_00244a70(void) { FUN_L00_00215340(); FUN_L01_00232978(1); if (big) { - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); hero.unk304 = hero.motion.velocity.f[2]; } else { - FUN_L00_0025b8c0(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, + vendor_spring(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, frame_scale_sq * 0.35f, frame_time * 2.5f); } break; @@ -2358,11 +2358,11 @@ void FUN_L05_00244a70(void) { sp = frame_time * 5.0f; } stick_target(sp, 0); - FUN_L00_00211e30(0, frame_scale_sq * 0.025f, frame_scale_sq * 0.3f, frame_time * 12.566371f); + turn_to(0, frame_scale_sq * 0.025f, frame_scale_sq * 0.3f, frame_time * 12.566371f); speed_step(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); FUN_L00_00215340(); - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); if (hero.motion.pos.f[2] < hero.unk410) { approach_value(&hero.unk410, hero.motion.pos.f[2], frame_time * 4.0f); @@ -2406,7 +2406,7 @@ void FUN_L05_00244a70(void) { if (hero.state_timer == scale_game_frames(20)) { FUN_L00_00209ca8(3, 0x10, 1); if (D_L05_001612D0 != 0) { - FUN_L00_002a3ec8(D_L05_001612D0, D_L05_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L05_001612D0, D_L05_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, 0.35f); } } @@ -2422,7 +2422,7 @@ void FUN_L05_00244a70(void) { if (hero.unk418 != 0 || (t198 < t420 && hero.state.current != HERO_STATE_HIGH_JUMP && hero.state.current != HERO_STATE_PACK_LONG_JUMP && hero.state.current != 0xC && hero.state.current != 0x11 && hero.state.current != 0x1C && hero.state.current != 0x4C)) { f32 sv; - FUN_L00_00211e30(0, frame_scale_sq * 0.015f, frame_scale_sq * 0.2f, frame_time * 15.009831f); + turn_to(0, frame_scale_sq * 0.015f, frame_scale_sq * 0.2f, frame_time * 15.009831f); sv = hero.ground_speed; if (hero.unk418 >= 2) { hero.ground_speed = sv * 0.4f; @@ -2456,7 +2456,7 @@ void FUN_L05_00244a70(void) { qcopy(&v10, &v0); v10.f[0] += fast_cos(hero.motion.rot.f[2]) * 0.85f; v10.f[1] += fast_sin(hero.motion.rot.f[2]) * 0.85f; - if (FUN_001efa68(&v0, &v10, 4, (struct MobyView *)hero.moby, 0) != 0) { + if (collision_line(&v0, &v10, 4, (struct MobyView *)hero.moby, 0) != 0) { hero.unk4A4 = 1; } } @@ -2479,7 +2479,7 @@ void FUN_L05_00244a70(void) { if (hero.motion.pos.f[2] < hero.unk410) { hero.unk410 = hero.motion.pos.f[2]; } - if (hero.state_timer > hero.unk420 && FUN_L00_00233a78(&hero.motion.velocity) < 0.001f && + if (hero.state_timer > hero.unk420 && gravity_z(&hero.motion.velocity) < 0.001f && (hero.unk41C == 0 || hero.state_timer > hero.unk3D4)) { hero.unk41E = 1; if (hero.unk3F8 != 0.0f) { @@ -2502,7 +2502,7 @@ void FUN_L05_00244a70(void) { fast_vec_scale(&v10, &hero.motion.displacement, 7.0f); for (i = 0; i < n; i++) { if (FUN_L00_0025e3b8(D_L05_00178300[i]) != 0) { - FUN_L00_00259bc8(D_L05_00178300[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, + spawn_nearby_effect(D_L05_00178300[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, 1.0f); } } @@ -2559,12 +2559,12 @@ void FUN_L05_00244a70(void) { } k = 1.0f; if (hero.vehicle_mode == 3) { - FUN_L00_00211e30(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, frame_time * 5.5850534f); + turn_to(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, frame_time * 5.5850534f); } else if (hero.vehicle_mode == 1) { - FUN_L00_00211e30(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, frame_time * 7.8539815f); + turn_to(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, frame_time * 7.8539815f); } else if (hero.vehicle_mode == 0) { if (hero.state.step == 1) { - FUN_L00_00211e30(0, frame_scale_sq * 0.016f, frame_scale_sq * 0.15f, + turn_to(0, frame_scale_sq * 0.016f, frame_scale_sq * 0.15f, frame_time * 9.948377f); } else { FUN_L00_00211f38(); @@ -2588,7 +2588,7 @@ void FUN_L05_00244a70(void) { } case 0x66: subtract_vector_xyz(&v0, &hero.unk1640, &hero.motion.pos); - if (FUN_001f9ab0(&v0, &hero.motion.unk150) < 0.0f) { + if (fast_vec_dot(&v0, &hero.motion.unk150) < 0.0f) { clear_u64_value(&hero.motion.unk150); } clear_u64_value(&hero.motion.velocity); @@ -2671,7 +2671,7 @@ void FUN_L05_00244a70(void) { if (k < 0.0f) { k = 0.0f; } - FUN_L00_00211e30(0, frame_scale_sq * 0.035f * g, frame_scale_sq * 0.1f, frame_time * 2.268928f * g); + turn_to(0, frame_scale_sq * 0.035f * g, frame_scale_sq * 0.1f, frame_time * 2.268928f * g); speed_step(frame_time_sq * 7.5f * k, frame_time_sq * 8.5f); if (hero.unk3B8 != 0 && hero.unk308 == 0) { set_planar_vel(hero.motion.move_yaw); @@ -2716,3 +2716,5 @@ void FUN_L05_00244a70(void) { hero.unk1A4 = 0; } } + +f32 D_L05_0017AD50[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/l05/gameplay/hero/00255960.c b/src/overlays/l05/gameplay/hero/00255960.c index 9f7f04dbd5..4e971099a0 100644 --- a/src/overlays/l05/gameplay/hero/00255960.c +++ b/src/overlays/l05/gameplay/hero/00255960.c @@ -48,11 +48,11 @@ extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L05_0015F638; extern float D_L05_001671D8 __attribute__((section(".data"))); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_00208f20(float a, float b, float c, float d); extern float FUN_L00_00232b90(float a, float b, float c); -extern float FUN_L00_00233a78(float *v); +extern float gravity_z(float *v) __asm__("FUN_L00_00233a78"); extern float FUN_L00_00233c30(float *pos, float *vel, int *steps, float step); extern float FUN_L00_00266e80(int); extern float approach_value(float *p, float target, float maxstep) __asm__("FUN_00213ed8"); @@ -110,7 +110,7 @@ extern void FUN_L00_00232628(void); extern void FUN_L00_00232640(int id); extern void FUN_L00_00233288(float a, float b, short c, unsigned char d, unsigned char e, unsigned char f); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void hud_keep_visible(int, int) __asm__("FUN_L00_00235e18"); extern void FUN_L00_00237ae8(void); extern void FUN_L00_00237ba0(void); @@ -883,7 +883,7 @@ void FUN_L05_00255960(void) { } break; case 101: - if (FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { + if (vector_distance(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { if (frame_time * 2.7f > hero.motion.speed_xy) { if (fast_difference_between_rotations( hero.motion.rot.f[2], hero.unk1640.f[3]) < 0.034906585f) { @@ -907,7 +907,7 @@ void FUN_L05_00255960(void) { if ((hero.unkA98 & 2) || hero.unk1650 != 0) { hero_set_state(HERO_STATE_IDLE, 1); } - if (0.2f < FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f)) { + if (0.2f < vector_distance(hero.motion.pos.f, hero.unk1640.f)) { hero_set_state(0x65, 1); } break; @@ -1290,7 +1290,7 @@ void FUN_L05_00255960(void) { if (hero_set_state(HERO_STATE_IDLE, 0)) { set_hero_animation(0xC, 9, -1.0f); } - FUN_L00_00233b20(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); + gravity_set_z(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); FUN_L00_0025f730(hero.motion.unk150.f, frame_time * 7.0f); hero.unk1C4 = scale_game_frames(7); if (hero.state.prev == 0x2D) { @@ -1791,7 +1791,7 @@ void FUN_L05_00255960(void) { scale_game_frames(0xE) < hero.state_timer && (hero.unk41E == 0 || (hero.ground_distance > 0.7f && - absolute_float(FUN_L00_00233a78(hero.motion.velocity.f)) < + absolute_float(gravity_z(hero.motion.velocity.f)) < frame_time * 5.8f))) { hero_set_state(0xE, 1); } else if (D_0013D4C0[2] != 0 && hero_slot_item_id(3) != 4 && diff --git a/src/overlays/l05/gameplay/hero/hero_set_state.c b/src/overlays/l05/gameplay/hero/hero_set_state.c index c653304b48..3c0d7fd517 100644 --- a/src/overlays/l05/gameplay/hero/hero_set_state.c +++ b/src/overlays/l05/gameplay/hero/hero_set_state.c @@ -34,7 +34,7 @@ extern float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_0020d658(int back); -extern float FUN_L00_002339d0(float *v); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float dot_vectors_xyz(void *a, void *b); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); @@ -75,14 +75,14 @@ extern void FUN_L00_00216ec0(int, int, int); extern void FUN_L00_00217450(void); extern void set_hero_animation(int, int, float) __asm__("FUN_L00_002323b8"); extern void FUN_L00_002325e0(int bank, int seq); -extern void FUN_L00_002338d0(float *dst, float *src); -extern void FUN_L00_00233b20(float *dst, float *src, float z); -extern void FUN_L00_00250320(void *, void *, void *, void *); +extern void gravity_flatten(float *dst, float *src) __asm__("FUN_L00_002338d0"); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); +extern void get_moby_color(void *, void *, void *, void *) __asm__("FUN_L00_00250320"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L00_00262500(int a, char *b); extern void FUN_L00_00262528(char *o, int a, int b); extern void FUN_L00_00262840(char *o); -extern void FUN_L00_002a3ec8(void *, int, int, float, float, float, float); +extern void pool_splash(void *, int, int, float, float, float, float) __asm__("FUN_L00_002a3ec8"); extern void FUN_L01_002405a0(void); extern void FUN_L05_00262ae8(void); extern void FUN_L05_00262b58(void); @@ -313,7 +313,7 @@ int hero_set_state(int a, int b) { if (p->state.prev_control_mode == 0x11) { FUN_L00_00209ca8(3, 0xA, 0); if (D_L05_001612D0 != 0) { - FUN_L00_002a3ec8(D_L05_001612D0, D_L05_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L05_001612D0, D_L05_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.4f, 0.3f); } } else if (p->motion.displacement.f[2] < frame_time * -0.5f) { @@ -323,7 +323,7 @@ int hero_set_state(int a, int b) { v = 0x28; FUN_L00_00209ca8(3, v, 1); if (D_L05_001612D0 != 0) { - FUN_L00_002a3ec8(D_L05_001612D0, D_L05_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L05_001612D0, D_L05_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.5f, -0.4f); } p->unk90A = scale_game_frames(0x4B); @@ -592,7 +592,7 @@ int hero_set_state(int a, int b) { clear_vector(v2); w = v2 + 0x70; qcopy(w, v2 + 0x30); - FUN_L00_002338d0((float *)w, (float *)w); + gravity_flatten((float *)w, (float *)w); FUN_L00_0025f730(w, frame_time * 9.5f); *(int *)(v2 + 0xF18) = 0x68; if (b) @@ -805,7 +805,7 @@ int hero_set_state(int a, int b) { char *v = (char *)&p->motion.unk110; p->state.control_mode = 1; p->unk2284 = 0; - p->ground_speed = FUN_L00_002339d0((float *)v); + p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.unk150, v); if (b) { int id = 6; @@ -1204,7 +1204,7 @@ int hero_set_state(int a, int b) { u->unk48C = 1.98f; u->unk430 = 1.95f; } else { - FUN_L00_00233b20((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); + gravity_set_z((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); u->unk41C = 1; u->unk3D0 = scale_game_frames(2); u->unk3D4 = scale_game_frames(0x23) + u->unk3D0; @@ -1788,7 +1788,7 @@ int hero_set_state(int a, int b) { { struct Hero *q = &hero; q->unk22F4 = 1; - FUN_L00_00250320(((void *)q->moby), &c0, &c1, &c2); + get_moby_color(((void *)q->moby), &c0, &c1, &c2); q->unk22F8 = (c2 << 16) | ((c1 << 8) | 0x80000000) | c0; } return 0; diff --git a/src/overlays/l05/gameplay/vendor/0031bf40.c b/src/overlays/l05/gameplay/vendor/0031bf40.c index f72714573d..3eca59e0e8 100644 --- a/src/overlays/l05/gameplay/vendor/0031bf40.c +++ b/src/overlays/l05/gameplay/vendor/0031bf40.c @@ -19,7 +19,7 @@ extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); extern void FUN_L00_00203908(int, int) __asm__("FUN_L00_00203908"); extern void FUN_L00_002d5830(void *) __asm__("FUN_L00_002d5830"); -extern void FUN_001f99f8(void *) __asm__("FUN_001f99f8"); +extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); typedef unsigned int L05Vector __attribute__((mode(TI), aligned(16))); typedef struct { unsigned short count, best; int flags; } VendorEventRecord; @@ -183,7 +183,7 @@ void FUN_L05_0031bf40(unsigned char *moby) { } if (hero.state.control_mode == 0x12) { if (is_point_inside_clip_volume(data + 4, data[13]) || is_point_inside_clip_volume(data + 4, data[14])) { - FUN_001f99f8(data + 4); + clear_u64_value(data + 4); data[24]++; } } else if (data[24] > 1 && @@ -219,7 +219,7 @@ typedef struct { } G; extern G D_L05_0016CC60; -extern void FUN_L00_002637f8(int); +extern void cutscene_set_camera_target(int) __asm__("FUN_L00_002637f8"); void FUN_L05_0031d5c8(unsigned char *m) { unsigned int s = m[0x20]; @@ -238,7 +238,7 @@ void FUN_L05_0031d5c8(unsigned char *m) { int k = 3; if (s < t) k = 0; - FUN_L00_002637f8((int)g->m[k]); + cutscene_set_camera_target((int)g->m[k]); } } break; diff --git a/src/overlays/l05/hoverboard_girl.c b/src/overlays/l05/hoverboard_girl.c index a8c1f17bd3..49a26a4143 100644 --- a/src/overlays/l05/hoverboard_girl.c +++ b/src/overlays/l05/hoverboard_girl.c @@ -138,7 +138,8 @@ void update_hoverboard_girl(HoverboardGirlMoby *) __asm__("FUN_L05_00316ab8"); extern f32 frame_scale_sq __asm__("D_0015ED64"); -void FUN_L05_00316810(HoverboardGirlMoby *moby, HoverboardGirlState *state) { +void update_hoverboard_girl_boobs_animation(HoverboardGirlMoby *moby, HoverboardGirlState *state) __asm__("FUN_L05_00316810"); +void update_hoverboard_girl_boobs_animation(HoverboardGirlMoby *moby, HoverboardGirlState *state) { s32 joint_index = 0; HoverboardGirlJoint *joint = &state->joints[2]; HoverboardGirlState *state_window = state; @@ -163,7 +164,8 @@ void FUN_L05_00316810(HoverboardGirlMoby *moby, HoverboardGirlState *state) { } while (joint_index < 2); } -void FUN_L05_00316ab8(HoverboardGirlMoby *moby) { +void update_hoverboard_girl(HoverboardGirlMoby *moby) __asm__("FUN_L05_00316ab8"); +void update_hoverboard_girl(HoverboardGirlMoby *moby) { HoverboardGirlState *state = moby->data; HoverboardGirlVector target_position; HoverboardGirlVector head_position; diff --git a/src/overlays/l05/rendering/0029bbe0.c b/src/overlays/l05/rendering/0029bbe0.c index f00fda50cf..d5b8c6edc3 100644 --- a/src/overlays/l05/rendering/0029bbe0.c +++ b/src/overlays/l05/rendering/0029bbe0.c @@ -7,7 +7,7 @@ extern unsigned char *FUN_L00_002678b8(int); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); extern int random_integer_below(int) __asm__("FUN_00213260"); -extern unsigned char *D_L05_001B25C0 __asm__("D_L05_001B25C0") __attribute__((section(".data"))); +unsigned char *D_L05_001B25C0 __attribute__((section(".data"))) = 0; unsigned char *FUN_L05_0029bbe0(float a, void *pos, void *vel, int life, int size, int color) { unsigned char *p = FUN_L00_002678b8(0x30); diff --git a/src/overlays/l06/gameplay/entities/fred.c b/src/overlays/l06/gameplay/entities/fred.c index 3561e72c2f..4a2db5d8e4 100644 --- a/src/overlays/l06/gameplay/entities/fred.c +++ b/src/overlays/l06/gameplay/entities/fred.c @@ -27,11 +27,458 @@ extern float D_L06_00161FA0 __attribute__((sda)); extern float D_L06_00161FA4 __attribute__((sda)); extern float D_L06_00167554; extern float D_L06_00167540[]; -extern float D_L06_001F1540[][2]; -extern short D_L06_001F1220[][4][2]; -extern float D_L06_001F0900[][4] __attribute__((aligned(16))); -extern char D_L06_001F2610[][16]; -extern char D_L06_001F19D0[][16]; +float D_L06_001F1540[146][2] = { + {1.0f, -0.5f}, + {1.0f, -0.25f}, + {0.0f, -0.25f}, + {0.0f, -0.5f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -0.75f}, + {1.0f, -0.75f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {1.0f, -0.25f}, + {0.0f, -0.25f}, + {0.0f, -0.5f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -0.75f}, + {1.0f, -0.75f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.0f, -0.5f}, + {0.0f, -0.75f}, + {1.0f, -0.75f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, -0.25f}, + {0.0f, -0.25f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {1.0f, -0.5f}, + {1.0f, -0.25f}, + {0.0f, -0.25f}, + {0.0f, -0.5f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -0.75f}, + {1.0f, -0.75f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.0f, -0.5f}, + {0.0f, -0.75f}, + {1.0f, -0.75f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, -0.25f}, + {0.0f, -0.25f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {1.0f, -0.5f}, + {1.0f, -0.25f}, + {0.0f, -0.25f}, + {0.0f, -0.5f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -0.75f}, + {1.0f, -0.75f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.0f, -0.5f}, + {0.0f, -0.75f}, + {1.0f, -0.75f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, -0.25f}, + {0.0f, -0.25f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {1.0f, -0.5f}, + {1.0f, -0.25f}, + {0.0f, -0.25f}, + {0.0f, -0.5f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -0.75f}, + {1.0f, -0.75f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {0.0f, -0.5f}, + {1.0f, -0.5f}, + {1.0f, -0.25f}, + {0.0f, -0.25f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -0.75f}, + {1.0f, -0.75f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -1.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, +}; +short D_L06_001F1220[50][4][2] = { + {{0, 0}, {1, 1}, {3, 3}, {2, 2}}, + {{1, 1}, {4, 4}, {2, 2}, {5, 5}}, + {{0, 0}, {3, 3}, {7, 7}, {6, 6}}, + {{7, 7}, {6, 6}, {9, 9}, {8, 8}}, + {{0xa, 0xa}, {0xb, 0xb}, {0xd, 0xd}, {0xc, 0xc}}, + {{0xb, 0xb}, {0xe, 0xe}, {0xc, 0xc}, {0xf, 0xf}}, + {{0xa, 0xa}, {0xd, 0xd}, {0x11, 0x11}, {0x10, 0x10}}, + {{0x11, 0x11}, {0x10, 0x10}, {0x13, 0x13}, {0x12, 0x12}}, + {{0x14, 0x14}, {0x15, 0x15}, {0x17, 0x17}, {0x16, 0x16}}, + {{0x17, 0x17}, {0x16, 0x16}, {0x19, 0x19}, {0x18, 0x18}}, + {{0x14, 0x14}, {0x1a, 0x1a}, {0x15, 0x15}, {0x1b, 0x1b}}, + {{0x1a, 0x1a}, {0x1c, 0x1c}, {0x1b, 0x1b}, {0x1d, 0x1d}}, + {{0x1e, 0x1e}, {0x1f, 0x1f}, {0x21, 0x21}, {0x20, 0x20}}, + {{0x1f, 0x1f}, {0x22, 0x22}, {0x20, 0x20}, {0x23, 0x23}}, + {{0x1e, 0x1e}, {0x21, 0x21}, {0x25, 0x25}, {0x24, 0x24}}, + {{0x25, 0x25}, {0x24, 0x24}, {0x27, 0x27}, {0x26, 0x26}}, + {{0x28, 0x28}, {0x29, 0x29}, {0x2b, 0x2b}, {0x2a, 0x2a}}, + {{0x2b, 0x2b}, {0x2a, 0x2a}, {0x2d, 0x2d}, {0x2c, 0x2c}}, + {{0x28, 0x28}, {0x2e, 0x2e}, {0x29, 0x29}, {0x2f, 0x2f}}, + {{0x2e, 0x2e}, {0x30, 0x30}, {0x2f, 0x2f}, {0x31, 0x31}}, + {{0x32, 0x32}, {0x33, 0x33}, {0x35, 0x35}, {0x34, 0x34}}, + {{0x33, 0x33}, {0x36, 0x36}, {0x34, 0x34}, {0x37, 0x37}}, + {{0x32, 0x32}, {0x35, 0x35}, {0x39, 0x39}, {0x38, 0x38}}, + {{0x39, 0x39}, {0x38, 0x38}, {0x3b, 0x3b}, {0x3a, 0x3a}}, + {{0x3c, 0x3c}, {0x3d, 0x3d}, {0x3f, 0x3f}, {0x3e, 0x3e}}, + {{0x3f, 0x3f}, {0x3e, 0x3e}, {0x41, 0x41}, {0x40, 0x40}}, + {{0x3c, 0x3c}, {0x42, 0x42}, {0x3d, 0x3d}, {0x43, 0x43}}, + {{0x42, 0x42}, {0x44, 0x44}, {0x43, 0x43}, {0x45, 0x45}}, + {{0x46, 0x46}, {0x47, 0x47}, {0x49, 0x49}, {0x48, 0x48}}, + {{0x47, 0x47}, {0x4a, 0x4a}, {0x48, 0x48}, {0x4b, 0x4b}}, + {{0x46, 0x46}, {0x49, 0x49}, {0x4d, 0x4d}, {0x4c, 0x4c}}, + {{0x4d, 0x4d}, {0x4c, 0x4c}, {0x4f, 0x4f}, {0x4e, 0x4e}}, + {{0x50, 0x50}, {0x51, 0x51}, {0x53, 0x53}, {0x52, 0x52}}, + {{0x53, 0x53}, {0x52, 0x52}, {0x55, 0x55}, {0x54, 0x54}}, + {{0x50, 0x50}, {0x56, 0x56}, {0x51, 0x51}, {0x57, 0x57}}, + {{0x56, 0x56}, {0x58, 0x58}, {0x57, 0x57}, {0x59, 0x59}}, + {{0x5a, 0x5a}, {0x5b, 0x5b}, {0x5d, 0x5d}, {0x5c, 0x5c}}, + {{0x5e, 0x5e}, {0x5f, 0x5f}, {0x61, 0x61}, {0x60, 0x60}}, + {{0x62, 0x62}, {0x63, 0x63}, {0x65, 0x65}, {0x64, 0x64}}, + {{0x66, 0x66}, {0x67, 0x67}, {0x69, 0x69}, {0x68, 0x68}}, + {{0x6a, 0x6a}, {0x6b, 0x6b}, {0x6d, 0x6d}, {0x6c, 0x6c}}, + {{0x6e, 0x6e}, {0x6f, 0x6f}, {0x71, 0x71}, {0x70, 0x70}}, + {{0x72, 0x72}, {0x73, 0x73}, {0x75, 0x75}, {0x74, 0x74}}, + {{0x76, 0x76}, {0x77, 0x77}, {0x79, 0x79}, {0x78, 0x78}}, + {{0x7a, 0x7a}, {0x7b, 0x7b}, {0x7d, 0x7d}, {0x7c, 0x7c}}, + {{0x7e, 0x7e}, {0x7f, 0x7f}, {0x81, 0x81}, {0x80, 0x80}}, + {{0x82, 0x82}, {0x83, 0x83}, {0x85, 0x85}, {0x84, 0x84}}, + {{0x86, 0x86}, {0x87, 0x87}, {0x89, 0x89}, {0x88, 0x88}}, + {{0x8a, 0x8a}, {0x8b, 0x8b}, {0x8d, 0x8d}, {0x8c, 0x8c}}, + {{0x8e, 0x8e}, {0x8f, 0x8f}, {0x91, 0x91}, {0x90, 0x90}}, +}; +float D_L06_001F0900[146][4] = { + {271.15707f, 148.8695f, 142.0f, 1.0f}, + {270.73264f, 148.86949f, 143.71515f, 1.0f}, + {267.5755f, 154.79811f, 143.92354f, 1.0f}, + {267.9356f, 155.07442f, 142.0f, 1.0f}, + {269.48035f, 148.8976f, 145.70465f, 1.0f}, + {266.49127f, 153.92964f, 145.82965f, 1.0f}, + {267.5755f, 154.79811f, 140.07646f, 1.0f}, + {270.73264f, 148.86949f, 140.28484f, 1.0f}, + {266.496f, 153.97223f, 138.17519f, 1.0f}, + {269.40753f, 148.86809f, 138.4721f, 1.0f}, + {263.07443f, 159.93561f, 142.0f, 1.0f}, + {262.79807f, 159.57552f, 143.92352f, 1.0f}, + {257.55383f, 162.6033f, 143.92354f, 1.0f}, + {257.72754f, 163.02264f, 142.0f, 1.0f}, + {261.8809f, 158.5194f, 145.82965f, 1.0f}, + {257.04907f, 161.30905f, 145.82965f, 1.0f}, + {257.55383f, 162.6033f, 140.07646f, 1.0f}, + {262.79807f, 159.57552f, 140.07648f, 1.0f}, + {257.03055f, 161.35065f, 138.17519f, 1.0f}, + {261.96844f, 158.49974f, 138.17519f, 1.0f}, + {267.7205f, 155.35477f, 142.0f, 1.0f}, + {263.35477f, 159.72049f, 142.0f, 1.0f}, + {263.07846f, 159.3604f, 140.07646f, 1.0f}, + {267.36035f, 155.07846f, 140.07648f, 1.0f}, + {262.249f, 158.28452f, 138.17519f, 1.0f}, + {266.28073f, 154.25272f, 138.1752f, 1.0f}, + {267.36035f, 155.07846f, 143.92352f, 1.0f}, + {263.07846f, 159.36038f, 143.92354f, 1.0f}, + {266.20108f, 154.29572f, 145.82965f, 1.0f}, + {262.25592f, 158.24089f, 145.82965f, 1.0f}, + {257.40106f, 163.15787f, 142.0f, 1.0f}, + {257.22733f, 162.73851f, 143.92352f, 1.0f}, + {251.37811f, 164.30582f, 143.92354f, 1.0f}, + {251.43738f, 164.75583f, 142.0f, 1.0f}, + {256.61475f, 161.481f, 145.82965f, 1.0f}, + {251.22554f, 162.92503f, 145.82965f, 1.0f}, + {251.37811f, 164.30582f, 140.07646f, 1.0f}, + {257.22733f, 162.73853f, 140.07648f, 1.0f}, + {251.1964f, 162.96169f, 138.17519f, 1.0f}, + {256.70392f, 161.48595f, 138.17519f, 1.0f}, + {251.08702f, 164.80197f, 142.0f, 1.0f}, + {244.91296f, 164.80197f, 142.0f, 1.0f}, + {244.9722f, 164.35194f, 140.07646f, 1.0f}, + {251.02777f, 164.35193f, 140.07648f, 1.0f}, + {245.14406f, 163.00783f, 138.17519f, 1.0f}, + {250.84586f, 163.00784f, 138.17519f, 1.0f}, + {251.02777f, 164.35193f, 143.92352f, 1.0f}, + {244.9722f, 164.35194f, 143.92354f, 1.0f}, + {250.76152f, 162.97873f, 145.82965f, 1.0f}, + {245.1822f, 162.97873f, 145.82965f, 1.0f}, + {244.56264f, 164.75583f, 142.0f, 1.0f}, + {244.62186f, 164.30582f, 143.92352f, 1.0f}, + {238.77263f, 162.73853f, 143.92354f, 1.0f}, + {238.59894f, 163.15788f, 142.0f, 1.0f}, + {244.7201f, 162.91048f, 145.82965f, 1.0f}, + {239.33089f, 161.46645f, 145.82965f, 1.0f}, + {238.77263f, 162.73853f, 140.07646f, 1.0f}, + {244.62186f, 164.30582f, 140.07648f, 1.0f}, + {239.28596f, 161.48595f, 138.17519f, 1.0f}, + {244.79349f, 162.9617f, 138.17519f, 1.0f}, + {238.27246f, 163.02266f, 142.0f, 1.0f}, + {232.92558f, 159.93562f, 142.0f, 1.0f}, + {233.20187f, 159.5755f, 140.07646f, 1.0f}, + {238.44615f, 162.60327f, 140.07648f, 1.0f}, + {234.02142f, 158.49974f, 138.1752f, 1.0f}, + {238.95934f, 161.35065f, 138.17519f, 1.0f}, + {238.44615f, 162.60327f, 143.92352f, 1.0f}, + {233.20187f, 159.5755f, 143.92354f, 1.0f}, + {238.90216f, 161.28091f, 145.82965f, 1.0f}, + {234.07034f, 158.49127f, 145.82965f, 1.0f}, + {232.64523f, 159.7205f, 142.0f, 1.0f}, + {232.92155f, 159.36037f, 143.92352f, 1.0f}, + {228.63962f, 155.07846f, 143.92354f, 1.0f}, + {228.27953f, 155.35478f, 142.0f, 1.0f}, + {233.70428f, 158.2011f, 145.82965f, 1.0f}, + {229.75914f, 154.25594f, 145.82965f, 1.0f}, + {228.6396f, 155.07846f, 140.07646f, 1.0f}, + {232.92152f, 159.36037f, 140.07648f, 1.0f}, + {229.70914f, 154.25272f, 138.17519f, 1.0f}, + {233.7409f, 158.28452f, 138.17519f, 1.0f}, + {224.84293f, 148.8695f, 142.00294f, 1.0f}, + {228.06438f, 155.07442f, 142.00294f, 1.0f}, + {228.42448f, 154.79811f, 143.92354f, 1.0f}, + {225.26733f, 148.86949f, 143.71515f, 1.0f}, + {229.50873f, 153.92964f, 145.82965f, 1.0f}, + {226.51964f, 148.8976f, 145.70465f, 1.0f}, + {225.26733f, 148.86949f, 140.29074f, 1.0f}, + {228.42448f, 154.79811f, 140.08237f, 1.0f}, + {226.58235f, 148.86809f, 138.47212f, 1.0f}, + {229.4939f, 153.97223f, 138.1752f, 1.0f}, + {266.20108f, 154.29572f, 145.82965f, 1.0f}, + {262.32663f, 151.30846f, 148.0f, 1.0f}, + {259.30835f, 154.32674f, 148.0f, 1.0f}, + {262.25592f, 158.24089f, 145.82965f, 1.0f}, + {261.8809f, 158.5194f, 145.82965f, 1.0f}, + {258.91162f, 154.63113f, 148.0f, 1.0f}, + {255.215f, 156.76538f, 148.0f, 1.0f}, + {257.04907f, 161.30905f, 145.82965f, 1.0f}, + {256.61475f, 161.481f, 145.82965f, 1.0f}, + {254.753f, 156.95673f, 148.0f, 1.0f}, + {250.62996f, 158.0615f, 148.0f, 1.0f}, + {251.22554f, 162.92503f, 145.82965f, 1.0f}, + {250.76152f, 162.97873f, 145.82965f, 1.0f}, + {250.13417f, 158.12674f, 148.0f, 1.0f}, + {245.86568f, 158.12674f, 148.0f, 1.0f}, + {245.1822f, 162.97873f, 145.82965f, 1.0f}, + {244.7201f, 162.91048f, 145.82965f, 1.0f}, + {245.3699f, 158.06146f, 148.0f, 1.0f}, + {241.24686f, 156.9567f, 148.0f, 1.0f}, + {239.33089f, 161.46645f, 145.82965f, 1.0f}, + {238.90216f, 161.28091f, 145.82965f, 1.0f}, + {240.78488f, 156.7653f, 148.0f, 1.0f}, + {237.08826f, 154.63106f, 148.0f, 1.0f}, + {234.07034f, 158.49127f, 145.82965f, 1.0f}, + {233.70428f, 158.2011f, 145.82965f, 1.0f}, + {236.69154f, 154.32663f, 148.0f, 1.0f}, + {233.67326f, 151.30835f, 148.0f, 1.0f}, + {229.75914f, 154.25594f, 145.82965f, 1.0f}, + {266.28073f, 154.25272f, 138.1752f, 1.0f}, + {262.249f, 158.28452f, 138.17519f, 1.0f}, + {259.2451f, 154.3698f, 135.82323f, 1.0f}, + {262.36606f, 151.24887f, 135.82323f, 1.0f}, + {261.96844f, 158.49974f, 138.17519f, 1.0f}, + {257.03055f, 161.35065f, 138.17519f, 1.0f}, + {255.14226f, 156.79187f, 135.82323f, 1.0f}, + {258.96463f, 154.58504f, 135.82323f, 1.0f}, + {256.70392f, 161.48595f, 138.17519f, 1.0f}, + {251.1964f, 162.96169f, 138.17519f, 1.0f}, + {250.55232f, 158.0695f, 135.82323f, 1.0f}, + {254.81561f, 156.92717f, 135.82323f, 1.0f}, + {250.84586f, 163.00784f, 138.17519f, 1.0f}, + {245.14406f, 163.00783f, 138.17519f, 1.0f}, + {245.7881f, 158.11568f, 135.82323f, 1.0f}, + {250.2018f, 158.11566f, 135.82323f, 1.0f}, + {244.79349f, 162.9617f, 138.17519f, 1.0f}, + {239.28596f, 161.48595f, 138.17519f, 1.0f}, + {241.17429f, 156.92717f, 135.82323f, 1.0f}, + {245.43759f, 158.06952f, 135.82323f, 1.0f}, + {238.95934f, 161.35065f, 138.17519f, 1.0f}, + {234.02142f, 158.49974f, 138.1752f, 1.0f}, + {237.02527f, 154.58504f, 135.82323f, 1.0f}, + {240.84766f, 156.79187f, 135.82323f, 1.0f}, + {233.7409f, 158.28452f, 138.17519f, 1.0f}, + {229.70914f, 154.25272f, 138.17519f, 1.0f}, + {233.62384f, 151.24887f, 135.82323f, 1.0f}, + {236.7448f, 154.3698f, 135.82323f, 1.0f}, +}; +float D_L06_001F2610[50][4] = { + {269.35022f, 151.90288f, 142.90967f, 1.0f}, + {268.56995f, 151.6237f, 144.79324f, 1.0f}, + {269.3502f, 151.90288f, 141.09033f, 1.0f}, + {268.55292f, 151.62698f, 139.25215f, 1.0f}, + {260.28845f, 161.28427f, 142.96176f, 1.0f}, + {259.82047f, 160.50182f, 144.87659f, 1.0f}, + {260.28848f, 161.28427f, 141.03824f, 1.0f}, + {259.8377f, 160.50731f, 139.12582f, 1.0f}, + {265.3785f, 157.37854f, 141.03824f, 1.0f}, + {264.74216f, 156.74402f, 139.12582f, 1.0f}, + {265.3785f, 157.37852f, 142.96176f, 1.0f}, + {264.72394f, 156.74387f, 144.87659f, 1.0f}, + {254.36098f, 163.7395f, 142.96176f, 1.0f}, + {254.11142f, 162.86258f, 144.87659f, 1.0f}, + {254.36096f, 163.7395f, 141.03824f, 1.0f}, + {254.12643f, 162.873f, 139.12582f, 1.0f}, + {247.99998f, 164.57695f, 141.03824f, 1.0f}, + {247.99747f, 163.67987f, 139.12582f, 1.0f}, + {248.0f, 164.57697f, 142.96176f, 1.0f}, + {247.98593f, 163.66533f, 144.87659f, 1.0f}, + {241.63902f, 163.73952f, 142.96176f, 1.0f}, + {241.86137f, 162.85532f, 144.87659f, 1.0f}, + {241.639f, 163.7395f, 141.03824f, 1.0f}, + {241.86847f, 162.87299f, 139.12582f, 1.0f}, + {235.71152f, 161.28427f, 141.03824f, 1.0f}, + {236.1572f, 160.5073f, 139.12584f, 1.0f}, + {235.71153f, 161.28426f, 142.96176f, 1.0f}, + {236.15515f, 160.48773f, 144.87659f, 1.0f}, + {230.62149f, 157.37852f, 142.96176f, 1.0f}, + {231.25616f, 156.72397f, 144.87659f, 1.0f}, + {230.62146f, 157.37852f, 141.03824f, 1.0f}, + {231.25279f, 156.74402f, 139.12582f, 1.0f}, + {226.64978f, 151.90288f, 142.91115f, 1.0f}, + {227.43005f, 151.6237f, 144.79324f, 1.0f}, + {226.64978f, 151.90288f, 141.09476f, 1.0f}, + {227.44202f, 151.62698f, 139.25511f, 1.0f}, + {262.523f, 154.54295f, 146.91483f, 1.0f}, + {258.26413f, 157.80624f, 146.91483f, 1.0f}, + {253.3058f, 159.85606f, 146.91483f, 1.0f}, + {247.98589f, 160.55273f, 146.91483f, 1.0f}, + {242.66693f, 159.84877f, 146.91483f, 1.0f}, + {237.7114f, 157.79213f, 146.91483f, 1.0f}, + {233.45706f, 154.523f, 146.91483f, 1.0f}, + {262.53522f, 154.53897f, 136.99922f, 1.0f}, + {258.2765f, 157.80682f, 136.9992f, 1.0f}, + {253.31706f, 159.86108f, 136.9992f, 1.0f}, + {247.99495f, 160.56175f, 136.9992f, 1.0f}, + {242.67285f, 159.86108f, 136.9992f, 1.0f}, + {237.71342f, 157.80682f, 136.99922f, 1.0f}, + {233.45467f, 154.53897f, 136.9992f, 1.0f}, +}; +float D_L06_001F19D0[50][4] = { + {-0.865279f, -0.453256f, -0.21413f, 1.0f}, + {-0.762331f, -0.441066f, -0.473617f, 1.0f}, + {-0.864488f, -0.448825f, 0.226313f, 1.0f}, + {-0.730418f, -0.368759f, 0.574897f, 1.0f}, + {-0.486856f, -0.843251f, -0.227811f, 1.0f}, + {-0.405687f, -0.702668f, -0.58453f, 1.0f}, + {-0.486855f, -0.843255f, 0.2278f, 1.0f}, + {-0.408043f, -0.706742f, 0.577942f, 1.0f}, + {-0.688516f, -0.688516f, 0.227794f, 1.0f}, + {-0.576942f, -0.576934f, 0.578174f, 1.0f}, + {-0.688516f, -0.688511f, -0.227811f, 1.0f}, + {-0.573728f, -0.573726f, -0.584529f, 1.0f}, + {-0.252016f, -0.940526f, -0.227812f, 1.0f}, + {-0.209999f, -0.783727f, -0.584527f, 1.0f}, + {-0.252014f, -0.940529f, 0.227802f, 1.0f}, + {-0.211276f, -0.788487f, 0.577624f, 1.0f}, + {0.0f, -0.973706f, 0.227807f, 1.0f}, + {-4e-06f, -0.816555f, 0.577267f, 1.0f}, + {-3e-06f, -0.973704f, -0.227816f, 1.0f}, + {0.0f, -0.811375f, -0.584525f, 1.0f}, + {0.252013f, -0.940531f, -0.227798f, 1.0f}, + {0.209998f, -0.783725f, -0.584531f, 1.0f}, + {0.252011f, -0.94053f, 0.227804f, 1.0f}, + {0.211409f, -0.788998f, 0.576879f, 1.0f}, + {0.486855f, -0.843254f, 0.227803f, 1.0f}, + {0.408548f, -0.707632f, 0.576495f, 1.0f}, + {0.48685f, -0.843254f, -0.227817f, 1.0f}, + {0.405687f, -0.702672f, -0.584525f, 1.0f}, + {0.68851f, -0.688516f, -0.227817f, 1.0f}, + {0.57373f, -0.573728f, -0.584526f, 1.0f}, + {0.688518f, -0.688515f, 0.227794f, 1.0f}, + {0.577955f, -0.577959f, 0.576134f, 1.0f}, + {0.864421f, -0.448788f, -0.226642f, 1.0f}, + {0.726943f, -0.366709f, -0.580584f, 1.0f}, + {0.865217f, -0.453214f, 0.214467f, 1.0f}, + {0.744821f, -0.393519f, 0.538873f, 1.0f}, + {-0.288729f, -0.288729f, -0.912837f, 1.0f}, + {-0.204162f, -0.353619f, -0.912837f, 1.0f}, + {-0.105682f, -0.394411f, -0.912837f, 1.0f}, + {0.0f, -0.408322f, -0.912838f, 1.0f}, + {0.105682f, -0.39441f, -0.912837f, 1.0f}, + {0.204161f, -0.353617f, -0.912838f, 1.0f}, + {0.288728f, -0.288728f, -0.912837f, 1.0f}, + {-0.306383f, -0.306375f, 0.901257f, 1.0f}, + {-0.216645f, -0.375238f, 0.901255f, 1.0f}, + {-0.112143f, -0.418523f, 0.901256f, 1.0f}, + {1e-06f, -0.433289f, 0.901255f, 1.0f}, + {0.112144f, -0.418523f, 0.901256f, 1.0f}, + {0.216648f, -0.37524f, 0.901254f, 1.0f}, + {0.306383f, -0.30638f, 0.901255f, 1.0f}, +}; extern long texture_2fd1a0(int) __asm__("FUN_001f44b8"); extern void initialize_matrix_2fd1a0(void *) __asm__("FUN_001f9fc8"); extern void transform_2fd1a0(void *, void *, float) __asm__("FUN_001f9a68"); @@ -110,11 +557,449 @@ typedef struct { } Packet_2fd460; extern float D_L06_00167540[]; -extern short D_L06_001EF310[][4][2]; -extern float D_L06_001EF6B0[][2]; -extern float D_L06_001EED30[][4] __attribute__((aligned(16))); -extern char D_L06_001F0560[][16]; -extern char D_L06_001EFBE0[][16]; +short D_L06_001EF310[58][4][2] = { + {{0, 0}, {1, 1}, {3, 3}, {2, 2}}, + {{1, 4}, {4, 5}, {2, 7}, {5, 6}}, + {{6, 8}, {7, 9}, {9, 0xb}, {8, 0xa}}, + {{7, 9}, {0xa, 0xc}, {8, 0xa}, {0xb, 0xd}}, + {{0xa, 0xe}, {0xc, 0xf}, {0xb, 0x11}, {0xd, 0x10}}, + {{0xc, 0xf}, {0xe, 0x12}, {0xd, 0x10}, {0xf, 0x13}}, + {{0xe, 0x14}, {0x10, 0x15}, {0xf, 0x17}, {0x11, 0x16}}, + {{0x10, 0x15}, {0x12, 0x18}, {0x11, 0x16}, {0x13, 0x19}}, + {{0x12, 0x1a}, {0x14, 0x1b}, {0x13, 0x1d}, {0x15, 0x1c}}, + {{0x14, 0x1b}, {0x16, 0x1e}, {0x15, 0x1c}, {0x17, 0x1f}}, + {{0x16, 0x20}, {0x18, 0x21}, {0x17, 0x23}, {0x19, 0x22}}, + {{0x18, 0x21}, {0x1a, 0x24}, {0x19, 0x22}, {0x1b, 0x25}}, + {{0x1a, 0x26}, {0x1c, 0x27}, {0x1b, 0x29}, {0x1d, 0x28}}, + {{0x1c, 0x27}, {0x1e, 0x2a}, {0x1d, 0x28}, {0x1f, 0x2b}}, + {{0x1e, 0x2c}, {0x20, 0x2d}, {0x1f, 0x2f}, {0x21, 0x2e}}, + {{0x20, 0x2d}, {0x22, 0x30}, {0x21, 0x2e}, {0x23, 0x31}}, + {{0x22, 0x32}, {0x24, 0x33}, {0x23, 0x35}, {0x25, 0x34}}, + {{0x24, 0x33}, {0x26, 0x36}, {0x25, 0x34}, {0x27, 0x37}}, + {{0x26, 0x38}, {0x28, 0x39}, {0x27, 0x3b}, {0x29, 0x3a}}, + {{0x28, 0x39}, {0x2a, 0x3c}, {0x29, 0x3a}, {0x2b, 0x3d}}, + {{0x2a, 0x3e}, {0x2c, 0x3f}, {0x2b, 0x41}, {0x2d, 0x40}}, + {{0x2c, 0x3f}, {0x2e, 0x42}, {0x2d, 0x40}, {0x2f, 0x43}}, + {{0x2e, 0x44}, {0x30, 0x45}, {0x2f, 0x47}, {0x31, 0x46}}, + {{0x30, 0x45}, {0x32, 0x48}, {0x31, 0x46}, {0x33, 0x49}}, + {{0x32, 0x4a}, {0x34, 0x4b}, {0x33, 0x4d}, {0x35, 0x4c}}, + {{0x34, 0x4b}, {0x36, 0x4e}, {0x35, 0x4c}, {0x37, 0x4f}}, + {{0x36, 0x50}, {0, 0}, {0x37, 0x51}, {3, 3}}, + {{3, 3}, {2, 2}, {0x39, 0x53}, {0x38, 0x52}}, + {{2, 7}, {5, 6}, {0x38, 0x55}, {0x3a, 0x54}}, + {{9, 0xb}, {8, 0xa}, {0x3c, 0x57}, {0x3b, 0x56}}, + {{8, 0xa}, {0xb, 0xd}, {0x3b, 0x56}, {0x3d, 0x58}}, + {{0xb, 0x11}, {0xd, 0x10}, {0x3d, 0x5a}, {0x3e, 0x59}}, + {{0xd, 0x10}, {0xf, 0x13}, {0x3e, 0x59}, {0x3f, 0x5b}}, + {{0xf, 0x17}, {0x11, 0x16}, {0x3f, 0x5d}, {0x40, 0x5c}}, + {{0x11, 0x16}, {0x13, 0x19}, {0x40, 0x5c}, {0x41, 0x5e}}, + {{0x13, 0x1d}, {0x15, 0x1c}, {0x41, 0x60}, {0x42, 0x5f}}, + {{0x15, 0x1c}, {0x17, 0x1f}, {0x42, 0x5f}, {0x43, 0x61}}, + {{0x17, 0x23}, {0x19, 0x22}, {0x43, 0x63}, {0x44, 0x62}}, + {{0x19, 0x22}, {0x1b, 0x25}, {0x44, 0x62}, {0x45, 0x64}}, + {{0x1b, 0x29}, {0x1d, 0x28}, {0x45, 0x66}, {0x46, 0x65}}, + {{0x1d, 0x28}, {0x1f, 0x2b}, {0x46, 0x65}, {0x47, 0x67}}, + {{0x1f, 0x2f}, {0x21, 0x2e}, {0x47, 0x69}, {0x48, 0x68}}, + {{0x21, 0x2e}, {0x23, 0x31}, {0x48, 0x68}, {0x49, 0x6a}}, + {{0x23, 0x35}, {0x25, 0x34}, {0x49, 0x6c}, {0x4a, 0x6b}}, + {{0x25, 0x34}, {0x27, 0x37}, {0x4a, 0x6b}, {0x4b, 0x6d}}, + {{0x27, 0x3b}, {0x29, 0x3a}, {0x4b, 0x6f}, {0x4c, 0x6e}}, + {{0x29, 0x3a}, {0x2b, 0x3d}, {0x4c, 0x6e}, {0x4d, 0x70}}, + {{0x2b, 0x41}, {0x2d, 0x40}, {0x4d, 0x72}, {0x4e, 0x71}}, + {{0x2d, 0x40}, {0x2f, 0x43}, {0x4e, 0x71}, {0x4f, 0x73}}, + {{0x2f, 0x47}, {0x31, 0x46}, {0x4f, 0x75}, {0x50, 0x74}}, + {{0x31, 0x46}, {0x33, 0x49}, {0x50, 0x74}, {0x51, 0x76}}, + {{0x33, 0x4d}, {0x35, 0x4c}, {0x51, 0x78}, {0x52, 0x77}}, + {{0x35, 0x4c}, {0x37, 0x4f}, {0x52, 0x77}, {0x53, 0x79}}, + {{0x37, 0x51}, {3, 3}, {0x53, 0x7a}, {0x39, 0x53}}, + {{0x54, 0x9b}, {0x55, 0x97}, {0x57, 0x99}, {0x56, 0x95}}, + {{0x54, 0x9b}, {0x57, 0x99}, {0x59, 0x9f}, {0x58, 0x9d}}, + {{0x59, 0x9f}, {0x58, 0x9d}, {0x5b, 0xa3}, {0x5a, 0xa1}}, + {{0x5b, 0xa3}, {0x5a, 0xa1}, {0x5d, 0xa4}, {0x5c, 0xa2}}, +}; +float D_L06_001EF6B0[165][2] = { + {0.5f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.5f, -0.5f}, + {0.0f, -1.0f}, + {0.5f, -1.0f}, + {0.5f, -0.5f}, + {0.0f, -0.5f}, + {0.0f, -1.0f}, + {0.5f, -1.0f}, + {0.5f, -0.5f}, + {0.0f, -0.5f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.0f, -1.0f}, + {0.5f, -1.0f}, + {0.5f, -0.5f}, + {0.0f, -0.5f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.0f, -1.0f}, + {0.5f, -1.0f}, + {0.5f, -0.5f}, + {0.0f, -0.5f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.0f, -1.0f}, + {0.5f, -1.0f}, + {0.5f, -0.5f}, + {0.0f, -0.5f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.0f, -1.0f}, + {0.5f, -1.0f}, + {0.5f, -0.5f}, + {0.0f, -0.5f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.0f, -1.0f}, + {0.5f, -1.0f}, + {0.5f, -0.5f}, + {0.0f, -0.5f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.0f, -1.0f}, + {0.5f, -1.0f}, + {0.5f, -0.5f}, + {0.0f, -0.5f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.0f, -1.0f}, + {0.5f, -1.0f}, + {0.5f, -0.5f}, + {0.0f, -0.5f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.0f, -1.0f}, + {0.5f, -1.0f}, + {0.5f, -0.5f}, + {0.0f, -0.5f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.0f, -1.0f}, + {0.5f, -1.0f}, + {0.5f, -0.5f}, + {0.0f, -0.5f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.0f, -1.0f}, + {0.5f, -1.0f}, + {0.5f, -0.5f}, + {0.0f, -0.5f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.0f, -1.0f}, + {0.5f, -1.0f}, + {0.5f, -0.5f}, + {0.0f, -0.5f}, + {1.0f, -1.0f}, + {1.0f, -0.5f}, + {0.0f, -1.0f}, + {0.0f, -0.5f}, + {1.0f, 0.0f}, + {0.5f, 0.0f}, + {0.5f, 0.0f}, + {0.0f, 0.0f}, + {0.5f, 0.0f}, + {0.0f, 0.0f}, + {1.0f, 0.0f}, + {0.5f, 0.0f}, + {0.0f, 0.0f}, + {1.0f, 0.0f}, + {0.5f, 0.0f}, + {0.0f, 0.0f}, + {1.0f, 0.0f}, + {0.5f, 0.0f}, + {0.0f, 0.0f}, + {1.0f, 0.0f}, + {0.5f, 0.0f}, + {0.0f, 0.0f}, + {1.0f, 0.0f}, + {0.5f, 0.0f}, + {0.0f, 0.0f}, + {1.0f, 0.0f}, + {0.5f, 0.0f}, + {0.0f, 0.0f}, + {1.0f, 0.0f}, + {0.5f, 0.0f}, + {0.0f, 0.0f}, + {1.0f, 0.0f}, + {0.5f, 0.0f}, + {0.0f, 0.0f}, + {1.0f, 0.0f}, + {0.5f, 0.0f}, + {0.0f, 0.0f}, + {1.0f, 0.0f}, + {0.5f, 0.0f}, + {0.0f, 0.0f}, + {1.0f, 0.0f}, + {0.5f, 0.0f}, + {0.0f, 0.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, 0.0f}, + {0.0f, -1.0f}, + {1.0f, -1.0f}, + {2.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, 0.0f}, + {2.0f, -1.0f}, + {0.0f, 0.0f}, + {1.0f, 0.0f}, + {1.0f, 0.0f}, + {0.0f, 0.0f}, + {0.25f, 0.0f}, + {0.0f, -1.0f}, + {0.25f, -1.0f}, + {0.25f, 0.0f}, + {0.5f, 0.0f}, + {0.25f, -1.0f}, + {0.5f, -1.0f}, + {0.5f, 0.0f}, + {0.75f, 0.0f}, + {0.5f, -1.0f}, + {0.75f, -1.0f}, + {0.75f, 0.0f}, + {1.0f, 0.0f}, + {0.75f, -1.0f}, + {1.0f, -1.0f}, + {0.0f, 0.0f}, + {0.25f, 0.0f}, + {0.0f, -1.0f}, + {0.25f, -1.0f}, + {0.25f, 0.0f}, + {0.5f, 0.0f}, + {0.25f, -1.0f}, + {0.5f, -1.0f}, + {0.5f, 0.0f}, + {0.75f, 0.0f}, + {0.5f, -1.0f}, + {0.75f, -1.0f}, + {0.75f, 0.0f}, + {1.0f, 0.0f}, + {0.75f, -1.0f}, + {1.0f, -1.0f}, +}; +float D_L06_001EED30[94][4] = { + {21522.467f, 15327.876f, 13686.439f, 1.0f}, + {21632.7f, 15283.502f, 13686.439f, 1.0f}, + {21632.756f, 15283.663f, 13900.302f, 1.0f}, + {21522.555f, 15328.026f, 13900.303f, 1.0f}, + {21694.0f, 15270.8545f, 13686.439f, 1.0f}, + {21694.025f, 15271.026f, 13900.302f, 1.0f}, + {22280.4f, 15453.078f, 13686.438f, 1.0f}, + {22352.57f, 15540.274f, 13686.438f, 1.0f}, + {22352.422f, 15540.363f, 13900.302f, 1.0f}, + {22280.27f, 15453.195f, 13900.302f, 1.0f}, + {22402.812f, 15647.898f, 13686.438f, 1.0f}, + {22402.648f, 15647.956f, 13900.302f, 1.0f}, + {22431.088f, 15763.258f, 13686.4375f, 1.0f}, + {22430.916f, 15763.281f, 13900.301f, 1.0f}, + {22436.318f, 15881.918f, 13686.4375f, 1.0f}, + {22436.143f, 15881.907f, 13900.301f, 1.0f}, + {22418.295f, 15999.314f, 13686.438f, 1.0f}, + {22418.127f, 15999.273f, 13900.302f, 1.0f}, + {22377.715f, 16110.94f, 13686.44f, 1.0f}, + {22377.56f, 16110.868f, 13900.304f, 1.0f}, + {22316.137f, 16212.502f, 13686.438f, 1.0f}, + {22316.0f, 16212.403f, 13900.303f, 1.0f}, + {22235.93f, 16300.106f, 13686.4375f, 1.0f}, + {22235.812f, 16299.977f, 13900.301f, 1.0f}, + {22140.18f, 16370.38f, 13686.4375f, 1.0f}, + {22140.088f, 16370.23f, 13900.302f, 1.0f}, + {22032.55f, 16420.62f, 13686.438f, 1.0f}, + {22032.492f, 16420.455f, 13900.302f, 1.0f}, + {21917.193f, 16448.895f, 13686.438f, 1.0f}, + {21917.168f, 16448.725f, 13900.302f, 1.0f}, + {21798.533f, 16454.123f, 13686.438f, 1.0f}, + {21798.543f, 16453.947f, 13900.302f, 1.0f}, + {21681.133f, 16436.1f, 13686.438f, 1.0f}, + {21681.178f, 16435.934f, 13900.302f, 1.0f}, + {21569.504f, 16395.523f, 13686.4375f, 1.0f}, + {21569.584f, 16395.365f, 13900.301f, 1.0f}, + {21467.941f, 16333.947f, 13686.4375f, 1.0f}, + {21468.047f, 16333.806f, 13900.302f, 1.0f}, + {21380.34f, 16253.739f, 13686.438f, 1.0f}, + {21380.473f, 16253.622f, 13900.302f, 1.0f}, + {21310.07f, 16157.982f, 13686.439f, 1.0f}, + {21310.225f, 16157.894f, 13900.303f, 1.0f}, + {21259.834f, 16050.356f, 13686.438f, 1.0f}, + {21259.998f, 16050.301f, 13900.302f, 1.0f}, + {21231.555f, 15935.0f, 13686.438f, 1.0f}, + {21231.727f, 15934.973f, 13900.301f, 1.0f}, + {21226.326f, 15816.34f, 13686.438f, 1.0f}, + {21226.502f, 15816.351f, 13900.302f, 1.0f}, + {21244.348f, 15698.941f, 13686.439f, 1.0f}, + {21244.518f, 15698.984f, 13900.302f, 1.0f}, + {21284.926f, 15587.314f, 13686.437f, 1.0f}, + {21285.086f, 15587.39f, 13900.3f, 1.0f}, + {21346.51f, 15485.753f, 13686.438f, 1.0f}, + {21346.65f, 15485.858f, 13900.302f, 1.0f}, + {21426.71f, 15398.15f, 13686.44f, 1.0f}, + {21426.832f, 15398.277f, 13900.304f, 1.0f}, + {21632.695f, 15283.5f, 14114.167f, 1.0f}, + {21522.467f, 15327.876f, 14114.167f, 1.0f}, + {21694.0f, 15270.853f, 14114.166f, 1.0f}, + {22352.57f, 15540.276f, 14114.167f, 1.0f}, + {22280.4f, 15453.079f, 14114.167f, 1.0f}, + {22402.812f, 15647.898f, 14114.167f, 1.0f}, + {22431.086f, 15763.256f, 14114.166f, 1.0f}, + {22436.318f, 15881.916f, 14114.167f, 1.0f}, + {22418.297f, 15999.315f, 14114.167f, 1.0f}, + {22377.723f, 16110.947f, 14114.168f, 1.0f}, + {22316.145f, 16212.509f, 14114.168f, 1.0f}, + {22235.93f, 16300.108f, 14114.165f, 1.0f}, + {22140.176f, 16370.378f, 14114.166f, 1.0f}, + {22032.549f, 16420.615f, 14114.167f, 1.0f}, + {21917.193f, 16448.895f, 14114.166f, 1.0f}, + {21798.533f, 16454.123f, 14114.166f, 1.0f}, + {21681.133f, 16436.1f, 14114.167f, 1.0f}, + {21569.504f, 16395.523f, 14114.167f, 1.0f}, + {21467.941f, 16333.947f, 14114.166f, 1.0f}, + {21380.342f, 16253.74f, 14114.168f, 1.0f}, + {21310.07f, 16157.983f, 14114.168f, 1.0f}, + {21259.828f, 16050.355f, 14114.167f, 1.0f}, + {21231.555f, 15935.0f, 14114.166f, 1.0f}, + {21226.328f, 15816.34f, 14114.167f, 1.0f}, + {21244.348f, 15698.941f, 14114.166f, 1.0f}, + {21284.928f, 15587.316f, 14114.165f, 1.0f}, + {21346.51f, 15485.751f, 14114.167f, 1.0f}, + {21426.71f, 15398.148f, 14114.169f, 1.0f}, + {26811.404f, 50609.258f, 11998.273f, 1.0f}, + {27141.416f, 50512.32f, 12051.608f, 1.0f}, + {27061.666f, 50551.227f, 12615.783f, 1.0f}, + {26731.654f, 50648.168f, 12562.448f, 1.0f}, + {26388.588f, 50678.19f, 12511.883f, 1.0f}, + {26468.34f, 50639.28f, 11947.708f, 1.0f}, + {26045.66f, 50640.15f, 12466.031f, 1.0f}, + {26125.41f, 50601.234f, 11901.856f, 1.0f}, + {25716.037f, 50535.49f, 12426.654f, 1.0f}, + {25795.787f, 50496.58f, 11862.4795f, 1.0f}, +}; +float D_L06_001F0560[58][4] = { + {21577.62f, 15305.768f, 13793.371f, 1.0f}, + {21663.371f, 15277.262f, 13793.37f, 1.0f}, + {22316.414f, 15496.728f, 13793.37f, 1.0f}, + {22377.613f, 15594.123f, 13793.37f, 1.0f}, + {22416.865f, 15705.599f, 13793.369f, 1.0f}, + {22433.615f, 15822.591f, 13793.369f, 1.0f}, + {22427.22f, 15940.604f, 13793.369f, 1.0f}, + {22397.924f, 16055.099f, 13793.371f, 1.0f}, + {22346.854f, 16161.678f, 13793.371f, 1.0f}, + {22275.969f, 16256.247f, 13793.369f, 1.0f}, + {22188.002f, 16335.174f, 13793.369f, 1.0f}, + {22086.326f, 16395.422f, 13793.369f, 1.0f}, + {21974.85f, 16434.674f, 13793.37f, 1.0f}, + {21857.86f, 16451.422f, 13793.37f, 1.0f}, + {21739.848f, 16445.025f, 13793.37f, 1.0f}, + {21625.35f, 16415.73f, 13793.369f, 1.0f}, + {21518.77f, 16364.66f, 13793.369f, 1.0f}, + {21424.2f, 16293.778f, 13793.369f, 1.0f}, + {21345.277f, 16205.81f, 13793.37f, 1.0f}, + {21285.033f, 16104.134f, 13793.371f, 1.0f}, + {21245.78f, 15992.657f, 13793.37f, 1.0f}, + {21229.027f, 15875.666f, 13793.37f, 1.0f}, + {21235.422f, 15757.654f, 13793.37f, 1.0f}, + {21264.719f, 15643.157f, 13793.369f, 1.0f}, + {21315.793f, 15536.579f, 13793.369f, 1.0f}, + {21386.676f, 15442.01f, 13793.371f, 1.0f}, + {21474.64f, 15363.083f, 13793.371f, 1.0f}, + {21577.62f, 15305.766f, 14007.235f, 1.0f}, + {21663.37f, 15277.261f, 14007.234f, 1.0f}, + {22316.416f, 15496.729f, 14007.234f, 1.0f}, + {22377.613f, 15594.124f, 14007.234f, 1.0f}, + {22416.865f, 15705.598f, 14007.233f, 1.0f}, + {22433.615f, 15822.59f, 14007.234f, 1.0f}, + {22427.22f, 15940.604f, 14007.234f, 1.0f}, + {22397.926f, 16055.101f, 14007.235f, 1.0f}, + {22346.855f, 16161.682f, 14007.235f, 1.0f}, + {22275.973f, 16256.249f, 14007.234f, 1.0f}, + {22188.002f, 16335.174f, 14007.232f, 1.0f}, + {22086.324f, 16395.42f, 14007.234f, 1.0f}, + {21974.85f, 16434.672f, 14007.234f, 1.0f}, + {21857.86f, 16451.422f, 14007.234f, 1.0f}, + {21739.846f, 16445.027f, 14007.234f, 1.0f}, + {21625.35f, 16415.73f, 14007.234f, 1.0f}, + {21518.77f, 16364.66f, 14007.233f, 1.0f}, + {21424.2f, 16293.779f, 14007.234f, 1.0f}, + {21345.277f, 16205.811f, 14007.235f, 1.0f}, + {21285.031f, 16104.134f, 14007.235f, 1.0f}, + {21245.777f, 15992.657f, 14007.233f, 1.0f}, + {21229.027f, 15875.666f, 14007.234f, 1.0f}, + {21235.424f, 15757.654f, 14007.234f, 1.0f}, + {21264.719f, 15643.158f, 14007.232f, 1.0f}, + {21315.793f, 15536.579f, 14007.233f, 1.0f}, + {21386.676f, 15442.009f, 14007.235f, 1.0f}, + {21474.64f, 15363.082f, 14007.235f, 1.0f}, + {26936.535f, 50580.246f, 12307.028f, 1.0f}, + {26599.996f, 50643.723f, 12255.078f, 1.0f}, + {26257.0f, 50639.715f, 12206.869f, 1.0f}, + {25920.725f, 50568.363f, 12164.255f, 1.0f}, +}; +float D_L06_001EFBE0[58][4] = { + {-0.373429f, -0.927659f, 0.000798f, 1.0f}, + {-0.202062f, -0.979372f, 0.000811f, 1.0f}, + {0.770362f, -0.637607f, 0.0008f, 1.0f}, + {0.906126f, -0.423007f, 0.000809f, 1.0f}, + {0.97125f, -0.23806f, 0.000807f, 1.0f}, + {0.99903f, -0.044037f, 0.000819f, 1.0f}, + {0.988419f, 0.151748f, 0.000805f, 1.0f}, + {0.939823f, 0.34166f, 0.000794f, 1.0f}, + {0.855102f, 0.51846f, 0.000786f, 1.0f}, + {0.737561f, 0.67528f, 0.000814f, 1.0f}, + {0.591674f, 0.806177f, 0.000817f, 1.0f}, + {0.422971f, 0.906143f, 0.000811f, 1.0f}, + {0.238064f, 0.971249f, 0.0008f, 1.0f}, + {0.04402f, 0.99903f, 0.000819f, 1.0f}, + {-0.151743f, 0.98842f, 0.000799f, 1.0f}, + {-0.341623f, 0.939837f, 0.000823f, 1.0f}, + {-0.518444f, 0.855111f, 0.000822f, 1.0f}, + {-0.675297f, 0.737546f, 0.000824f, 1.0f}, + {-0.806213f, 0.591625f, 0.000828f, 1.0f}, + {-0.906148f, 0.422961f, 0.000805f, 1.0f}, + {-0.971241f, 0.238097f, 0.000811f, 1.0f}, + {-0.99903f, 0.04402f, 0.000819f, 1.0f}, + {-0.988422f, -0.15173f, 0.000816f, 1.0f}, + {-0.93983f, -0.341643f, 0.000824f, 1.0f}, + {-0.85508f, -0.518496f, 0.000818f, 1.0f}, + {-0.737578f, -0.675261f, 0.000818f, 1.0f}, + {-0.591656f, -0.80619f, 0.00081f, 1.0f}, + {-0.373442f, -0.927653f, -0.000813f, 1.0f}, + {-0.201996f, -0.979386f, -0.00082f, 1.0f}, + {0.770336f, -0.637637f, -0.000794f, 1.0f}, + {0.906129f, -0.423f, -0.000809f, 1.0f}, + {0.971249f, -0.238065f, -0.0008f, 1.0f}, + {0.99903f, -0.044016f, -0.000819f, 1.0f}, + {0.988423f, 0.151722f, -0.000815f, 1.0f}, + {0.93983f, 0.341643f, -0.000839f, 1.0f}, + {0.855108f, 0.51845f, -0.000834f, 1.0f}, + {0.737523f, 0.675322f, -0.00082f, 1.0f}, + {0.591669f, 0.80618f, -0.000799f, 1.0f}, + {0.422977f, 0.90614f, -0.000791f, 1.0f}, + {0.238082f, 0.971245f, -0.0008f, 1.0f}, + {0.043984f, 0.999032f, -0.000819f, 1.0f}, + {-0.151707f, 0.988425f, -0.000799f, 1.0f}, + {-0.34166f, 0.939823f, -0.000823f, 1.0f}, + {-0.518437f, 0.855116f, -0.000822f, 1.0f}, + {-0.6753f, 0.737543f, -0.000821f, 1.0f}, + {-0.806215f, 0.591622f, -0.00083f, 1.0f}, + {-0.906129f, 0.423f, -0.000828f, 1.0f}, + {-0.971243f, 0.23809f, -0.000811f, 1.0f}, + {-0.999031f, 0.044001f, -0.00081f, 1.0f}, + {-0.988423f, -0.151722f, -0.000816f, 1.0f}, + {-0.939824f, -0.341657f, -0.000812f, 1.0f}, + {-0.855084f, -0.518489f, -0.000823f, 1.0f}, + {-0.737577f, -0.675262f, -0.000825f, 1.0f}, + {-0.591661f, -0.806186f, -0.00081f, 1.0f}, + {-0.285561f, -0.958016f, 0.0257f, 1.0f}, + {-0.095107f, -0.993941f, 0.055106f, 1.0f}, + {0.098996f, -0.991671f, 0.082388f, 1.0f}, + {0.289323f, -0.951287f, 0.106513f, 1.0f}, +}; extern long texture_2fd1a0(int) __asm__("FUN_001f44b8"); extern void initialize_matrix_2fd1a0(void *) __asm__("FUN_001f9fc8"); extern void transform_2fd1a0(void *, void *, float) __asm__("FUN_001f9a68"); @@ -201,11 +1086,4423 @@ typedef struct { } Packet_2fd748; extern float D_L06_00167540[]; -extern short D_L06_001DF6F0[][4][2]; -extern float D_L06_001E2CF0[][2]; -extern float D_L06_001DBFF0[][4] __attribute__((aligned(16))); -extern char D_L06_001EB730[][16]; -extern char D_L06_001E4A30[][16]; +short D_L06_001DF6F0[864][4][2] = { + {{0x2ec, 0x2ec}, {1, 1}, {0x36e, 0x36e}, {0x36f, 0x36f}}, + {{0x13d, 0x13d}, {2, 2}, {0x1bf, 0x1bf}, {0x1c0, 0x1c0}}, + {{0x5e, 0x5e}, {3, 3}, {0xe0, 0xe0}, {0xe1, 0xe1}}, + {{0x7d, 0x7d}, {5, 5}, {0x7e, 0x7e}, {0x7f, 0x7f}}, + {{0x40, 0x40}, {6, 6}, {0x41, 0x41}, {0x42, 0x42}}, + {{0x26, 0x26}, {9, 9}, {0x27, 0x27}, {0x28, 0x28}}, + {{0x19, 0x19}, {0xa, 0xa}, {0x1a, 0x1a}, {0x1b, 0x1b}}, + {{0x12, 0x12}, {0xd, 0xd}, {0x14, 0x14}, {0x15, 0x15}}, + {{0x10, 0x10}, {0xc, 0xc}, {0x11, 0x11}, {0xe, 0xe}}, + {{0, 0}, {0x10, 0x10}, {0xf, 0xf}, {0x11, 0x11}}, + {{0xe, 0xe}, {0x12, 0x12}, {0x11, 0x11}, {0x14, 0x14}}, + {{0x14, 0x14}, {0x13, 0x13}, {0x11, 0x11}, {0xf, 0xf}}, + {{0x15, 0x15}, {0xb, 0xb}, {0x14, 0x14}, {0x13, 0x13}}, + {{0x17, 0x17}, {8, 8}, {0x18, 0x18}, {0x16, 0x16}}, + {{0xc, 0xc}, {0x17, 0x17}, {0xe, 0xe}, {0x18, 0x18}}, + {{0x16, 0x16}, {0x19, 0x19}, {0x18, 0x18}, {0x1a, 0x1a}}, + {{0x1a, 0x1a}, {0x12, 0x12}, {0x18, 0x18}, {0xe, 0xe}}, + {{0x1b, 0x1b}, {0xd, 0xd}, {0x1a, 0x1a}, {0x12, 0x12}}, + {{0x1c, 0x1c}, {0x23, 0x23}, {0x21, 0x21}, {0x22, 0x22}}, + {{0x15, 0x15}, {0xd, 0xd}, {0x1f, 0x1f}, {0x1e, 0x1e}}, + {{0x1d, 0x1d}, {0xb, 0xb}, {0x1f, 0x1f}, {0x15, 0x15}}, + {{0x1f, 0x1f}, {0x1e, 0x1e}, {0x22, 0x22}, {0x21, 0x21}}, + {{0x20, 0x20}, {0x1d, 0x1d}, {0x22, 0x22}, {0x1f, 0x1f}}, + {{0x23, 0x23}, {7, 7}, {0x22, 0x22}, {0x20, 0x20}}, + {{0xa, 0xa}, {0x24, 0x24}, {0x1b, 0x1b}, {0x25, 0x25}}, + {{0x25, 0x25}, {0x1e, 0x1e}, {0x1b, 0x1b}, {0xd, 0xd}}, + {{0x24, 0x24}, {0x26, 0x26}, {0x25, 0x25}, {0x27, 0x27}}, + {{0x27, 0x27}, {0x21, 0x21}, {0x25, 0x25}, {0x1e, 0x1e}}, + {{0x28, 0x28}, {0x1c, 0x1c}, {0x27, 0x27}, {0x21, 0x21}}, + {{0x35, 0x35}, {0x29, 0x29}, {0x36, 0x36}, {0x37, 0x37}}, + {{0x2f, 0x2f}, {0x2b, 0x2b}, {0x30, 0x30}, {0x31, 0x31}}, + {{0x2d, 0x2d}, {0x2a, 0x2a}, {0x2e, 0x2e}, {0x2c, 0x2c}}, + {{8, 8}, {0x2d, 0x2d}, {0x16, 0x16}, {0x2e, 0x2e}}, + {{0x2c, 0x2c}, {0x2f, 0x2f}, {0x2e, 0x2e}, {0x30, 0x30}}, + {{0x30, 0x30}, {0x19, 0x19}, {0x2e, 0x2e}, {0x16, 0x16}}, + {{0x31, 0x31}, {0xa, 0xa}, {0x30, 0x30}, {0x19, 0x19}}, + {{0x33, 0x33}, {4, 4}, {0x34, 0x34}, {0x32, 0x32}}, + {{0x2a, 0x2a}, {0x33, 0x33}, {0x2c, 0x2c}, {0x34, 0x34}}, + {{0x32, 0x32}, {0x35, 0x35}, {0x34, 0x34}, {0x36, 0x36}}, + {{0x36, 0x36}, {0x2f, 0x2f}, {0x34, 0x34}, {0x2c, 0x2c}}, + {{0x37, 0x37}, {0x2b, 0x2b}, {0x36, 0x36}, {0x2f, 0x2f}}, + {{0x38, 0x38}, {0x3d, 0x3d}, {0x3b, 0x3b}, {0x3c, 0x3c}}, + {{0x31, 0x31}, {0x2b, 0x2b}, {0x3a, 0x3a}, {0x39, 0x39}}, + {{0x24, 0x24}, {0xa, 0xa}, {0x3a, 0x3a}, {0x31, 0x31}}, + {{0x3a, 0x3a}, {0x39, 0x39}, {0x3c, 0x3c}, {0x3b, 0x3b}}, + {{0x26, 0x26}, {0x24, 0x24}, {0x3c, 0x3c}, {0x3a, 0x3a}}, + {{0x3d, 0x3d}, {9, 9}, {0x3c, 0x3c}, {0x26, 0x26}}, + {{0x29, 0x29}, {0x3e, 0x3e}, {0x37, 0x37}, {0x3f, 0x3f}}, + {{0x3f, 0x3f}, {0x39, 0x39}, {0x37, 0x37}, {0x2b, 0x2b}}, + {{0x3e, 0x3e}, {0x40, 0x40}, {0x3f, 0x3f}, {0x41, 0x41}}, + {{0x41, 0x41}, {0x3b, 0x3b}, {0x3f, 0x3f}, {0x39, 0x39}}, + {{0x42, 0x42}, {0x38, 0x38}, {0x41, 0x41}, {0x3b, 0x3b}}, + {{0x43, 0x43}, {0x64, 0x64}, {0x62, 0x62}, {0x63, 0x63}}, + {{0x50, 0x50}, {0x45, 0x45}, {0x51, 0x51}, {0x52, 0x52}}, + {{0x4c, 0x4c}, {0x4b, 0x4b}, {0x4d, 0x4d}, {0x46, 0x46}}, + {{0x23, 0x23}, {0x1c, 0x1c}, {0x49, 0x49}, {0x48, 0x48}}, + {{0x47, 0x47}, {7, 7}, {0x49, 0x49}, {0x23, 0x23}}, + {{0x49, 0x49}, {0x48, 0x48}, {0x4c, 0x4c}, {0x4b, 0x4b}}, + {{0x4a, 0x4a}, {0x47, 0x47}, {0x4c, 0x4c}, {0x49, 0x49}}, + {{0x44, 0x44}, {0x4a, 0x4a}, {0x4d, 0x4d}, {0x4c, 0x4c}}, + {{0x28, 0x28}, {9, 9}, {0x4f, 0x4f}, {0x4e, 0x4e}}, + {{0x1c, 0x1c}, {0x28, 0x28}, {0x48, 0x48}, {0x4f, 0x4f}}, + {{0x4e, 0x4e}, {0x50, 0x50}, {0x4f, 0x4f}, {0x51, 0x51}}, + {{0x51, 0x51}, {0x4b, 0x4b}, {0x4f, 0x4f}, {0x48, 0x48}}, + {{0x52, 0x52}, {0x46, 0x46}, {0x51, 0x51}, {0x4b, 0x4b}}, + {{0x5a, 0x5a}, {0x54, 0x54}, {0x5b, 0x5b}, {0x5c, 0x5c}}, + {{0x58, 0x58}, {0x57, 0x57}, {0x59, 0x59}, {0x55, 0x55}}, + {{0x4d, 0x4d}, {0x46, 0x46}, {0x58, 0x58}, {0x57, 0x57}}, + {{0x56, 0x56}, {0x44, 0x44}, {0x58, 0x58}, {0x4d, 0x4d}}, + {{0x53, 0x53}, {0x56, 0x56}, {0x59, 0x59}, {0x58, 0x58}}, + {{0x52, 0x52}, {0x45, 0x45}, {0x5b, 0x5b}, {0x5a, 0x5a}}, + {{0x46, 0x46}, {0x52, 0x52}, {0x57, 0x57}, {0x5b, 0x5b}}, + {{0x5c, 0x5c}, {0x55, 0x55}, {0x5b, 0x5b}, {0x57, 0x57}}, + {{0x5d, 0x5d}, {0x61, 0x61}, {0x5f, 0x5f}, {0x60, 0x60}}, + {{0x59, 0x59}, {0x55, 0x55}, {0x60, 0x60}, {0x5f, 0x5f}}, + {{0x5e, 0x370}, {0x53, 0x53}, {0x60, 0x60}, {0x59, 0x59}}, + {{0x61, 0x61}, {3, 0x371}, {0x60, 0x60}, {0x5e, 0x370}}, + {{0x5c, 0x5c}, {0x54, 0x54}, {0x63, 0x63}, {0x62, 0x62}}, + {{0x5f, 0x5f}, {0x55, 0x55}, {0x63, 0x63}, {0x5c, 0x5c}}, + {{0x64, 0x64}, {0x5d, 0x5d}, {0x63, 0x63}, {0x5f, 0x5f}}, + {{0x6e, 0x6e}, {0x65, 0x65}, {0x6f, 0x6f}, {0x70, 0x70}}, + {{0x66, 0x66}, {0x6b, 0x6b}, {0x69, 0x69}, {0x6a, 0x6a}}, + {{0x3d, 0x3d}, {0x38, 0x38}, {0x68, 0x68}, {0x67, 0x67}}, + {{0x4e, 0x4e}, {9, 9}, {0x68, 0x68}, {0x3d, 0x3d}}, + {{0x68, 0x68}, {0x67, 0x67}, {0x6a, 0x6a}, {0x69, 0x69}}, + {{0x50, 0x50}, {0x4e, 0x4e}, {0x6a, 0x6a}, {0x68, 0x68}}, + {{0x6b, 0x6b}, {0x45, 0x45}, {0x6a, 0x6a}, {0x50, 0x50}}, + {{6, 6}, {0x6c, 0x6c}, {0x42, 0x42}, {0x6d, 0x6d}}, + {{0x6d, 0x6d}, {0x67, 0x67}, {0x42, 0x42}, {0x38, 0x38}}, + {{0x6c, 0x6c}, {0x6e, 0x6e}, {0x6d, 0x6d}, {0x6f, 0x6f}}, + {{0x6f, 0x6f}, {0x69, 0x69}, {0x6d, 0x6d}, {0x67, 0x67}}, + {{0x70, 0x70}, {0x66, 0x66}, {0x6f, 0x6f}, {0x69, 0x69}}, + {{0x76, 0x76}, {0x71, 0x71}, {0x77, 0x77}, {0x78, 0x78}}, + {{0x72, 0x72}, {0x75, 0x75}, {0x73, 0x73}, {0x74, 0x74}}, + {{0x6b, 0x6b}, {0x66, 0x66}, {0x74, 0x74}, {0x73, 0x73}}, + {{0x5a, 0x5a}, {0x45, 0x45}, {0x74, 0x74}, {0x6b, 0x6b}}, + {{0x75, 0x75}, {0x54, 0x54}, {0x74, 0x74}, {0x5a, 0x5a}}, + {{0x65, 0x65}, {0x76, 0x76}, {0x70, 0x70}, {0x77, 0x77}}, + {{0x77, 0x77}, {0x73, 0x73}, {0x70, 0x70}, {0x66, 0x66}}, + {{0x78, 0x78}, {0x72, 0x72}, {0x77, 0x77}, {0x73, 0x73}}, + {{0x79, 0x79}, {0x7c, 0x7c}, {0x7a, 0x7a}, {0x7b, 0x7b}}, + {{0x75, 0x75}, {0x72, 0x72}, {0x7b, 0x7b}, {0x7a, 0x7a}}, + {{0x62, 0x62}, {0x54, 0x54}, {0x7b, 0x7b}, {0x75, 0x75}}, + {{0x7c, 0x7c}, {0x43, 0x43}, {0x7b, 0x7b}, {0x62, 0x62}}, + {{0x71, 0x71}, {0x7d, 0x7d}, {0x78, 0x78}, {0x7e, 0x7e}}, + {{0x7e, 0x7e}, {0x7a, 0x7a}, {0x78, 0x78}, {0x72, 0x72}}, + {{0x7f, 0x7f}, {0x79, 0x79}, {0x7e, 0x7e}, {0x7a, 0x7a}}, + {{0x20, 0x372}, {7, 0x373}, {0xaf, 0xaf}, {0xb0, 0xb0}}, + {{0x99, 0x99}, {0x81, 0x81}, {0x9a, 0x9a}, {0x9b, 0x9b}}, + {{0x8e, 0x8e}, {0x82, 0x82}, {0x8f, 0x8f}, {0x90, 0x90}}, + {{0x88, 0x88}, {0x84, 0x84}, {0x89, 0x89}, {0x8a, 0x8a}}, + {{0x86, 0x86}, {0x83, 0x83}, {0x87, 0x87}, {0x85, 0x85}}, + {{4, 4}, {0x86, 0x86}, {0x32, 0x32}, {0x87, 0x87}}, + {{0x85, 0x85}, {0x88, 0x88}, {0x87, 0x87}, {0x89, 0x89}}, + {{0x89, 0x89}, {0x35, 0x35}, {0x87, 0x87}, {0x32, 0x32}}, + {{0x8a, 0x8a}, {0x29, 0x29}, {0x89, 0x89}, {0x35, 0x35}}, + {{0x8c, 0x8c}, {0x80, 0x80}, {0x8d, 0x8d}, {0x8b, 0x8b}}, + {{0x83, 0x83}, {0x8c, 0x8c}, {0x85, 0x85}, {0x8d, 0x8d}}, + {{0x8b, 0x8b}, {0x8e, 0x8e}, {0x8d, 0x8d}, {0x8f, 0x8f}}, + {{0x8f, 0x8f}, {0x88, 0x88}, {0x8d, 0x8d}, {0x85, 0x85}}, + {{0x90, 0x90}, {0x84, 0x84}, {0x8f, 0x8f}, {0x88, 0x88}}, + {{0x91, 0x91}, {0x96, 0x96}, {0x94, 0x94}, {0x95, 0x95}}, + {{0x8a, 0x8a}, {0x84, 0x84}, {0x93, 0x93}, {0x92, 0x92}}, + {{0x3e, 0x3e}, {0x29, 0x29}, {0x93, 0x93}, {0x8a, 0x8a}}, + {{0x93, 0x93}, {0x92, 0x92}, {0x95, 0x95}, {0x94, 0x94}}, + {{0x40, 0x40}, {0x3e, 0x3e}, {0x95, 0x95}, {0x93, 0x93}}, + {{0x96, 0x96}, {6, 6}, {0x95, 0x95}, {0x40, 0x40}}, + {{0x82, 0x82}, {0x97, 0x97}, {0x90, 0x90}, {0x98, 0x98}}, + {{0x98, 0x98}, {0x92, 0x92}, {0x90, 0x90}, {0x84, 0x84}}, + {{0x97, 0x97}, {0x99, 0x99}, {0x98, 0x98}, {0x9a, 0x9a}}, + {{0x9a, 0x9a}, {0x94, 0x94}, {0x98, 0x98}, {0x92, 0x92}}, + {{0x9b, 0x9b}, {0x91, 0x91}, {0x9a, 0x9a}, {0x94, 0x94}}, + {{0x13, 0x374}, {0xb, 0x375}, {0xa6, 0xa6}, {0xa7, 0xa7}}, + {{0xa1, 0xa1}, {0x9d, 0x9d}, {0xa2, 0xa2}, {0xa3, 0xa3}}, + {{0x9f, 0x9f}, {0x9c, 0x9c}, {0xa0, 0xa0}, {0x9e, 0x9e}}, + {{0x80, 0x80}, {0x9f, 0x9f}, {0x8b, 0x8b}, {0xa0, 0xa0}}, + {{0x9e, 0x9e}, {0xa1, 0xa1}, {0xa0, 0xa0}, {0xa2, 0xa2}}, + {{0xa2, 0xa2}, {0x8e, 0x8e}, {0xa0, 0xa0}, {0x8b, 0x8b}}, + {{0xa3, 0xa3}, {0x82, 0x82}, {0xa2, 0xa2}, {0x8e, 0x8e}}, + {{0xa4, 0xa4}, {0, 0x376}, {0xa5, 0xa5}, {0xf, 0x377}}, + {{0x9c, 0x9c}, {0xa4, 0xa4}, {0x9e, 0x9e}, {0xa5, 0xa5}}, + {{0xf, 0x377}, {0x13, 0x374}, {0xa5, 0xa5}, {0xa6, 0xa6}}, + {{0xa6, 0xa6}, {0xa1, 0xa1}, {0xa5, 0xa5}, {0x9e, 0x9e}}, + {{0xa7, 0xa7}, {0x9d, 0x9d}, {0xa6, 0xa6}, {0xa1, 0xa1}}, + {{0xa8, 0xa8}, {0xad, 0xad}, {0xab, 0xab}, {0xac, 0xac}}, + {{0xa3, 0xa3}, {0x9d, 0x9d}, {0xaa, 0xaa}, {0xa9, 0xa9}}, + {{0x97, 0x97}, {0x82, 0x82}, {0xaa, 0xaa}, {0xa3, 0xa3}}, + {{0xaa, 0xaa}, {0xa9, 0xa9}, {0xac, 0xac}, {0xab, 0xab}}, + {{0x99, 0x99}, {0x97, 0x97}, {0xac, 0xac}, {0xaa, 0xaa}}, + {{0xad, 0xad}, {0x81, 0x81}, {0xac, 0xac}, {0x99, 0x99}}, + {{0xb, 0x375}, {0x1d, 0x378}, {0xa7, 0xa7}, {0xae, 0xae}}, + {{0xae, 0xae}, {0xa9, 0xa9}, {0xa7, 0xa7}, {0x9d, 0x9d}}, + {{0x1d, 0x378}, {0x20, 0x372}, {0xae, 0xae}, {0xaf, 0xaf}}, + {{0xaf, 0xaf}, {0xab, 0xab}, {0xae, 0xae}, {0xa9, 0xa9}}, + {{0xb0, 0xb0}, {0xa8, 0xa8}, {0xaf, 0xaf}, {0xab, 0xab}}, + {{0xb1, 0xb1}, {0xcc, 0xcc}, {0xca, 0xca}, {0xcb, 0xcb}}, + {{0xbb, 0xbb}, {0xb2, 0xb2}, {0xbc, 0xbc}, {0xbd, 0xbd}}, + {{0xb7, 0xb7}, {0xb6, 0xb6}, {0xb8, 0xb8}, {0xb3, 0xb3}}, + {{0x96, 0x96}, {0x91, 0x91}, {0xb5, 0xb5}, {0xb4, 0xb4}}, + {{0x6c, 0x6c}, {6, 6}, {0xb5, 0xb5}, {0x96, 0x96}}, + {{0xb5, 0xb5}, {0xb4, 0xb4}, {0xb7, 0xb7}, {0xb6, 0xb6}}, + {{0x6e, 0x6e}, {0x6c, 0x6c}, {0xb7, 0xb7}, {0xb5, 0xb5}}, + {{0x65, 0x65}, {0x6e, 0x6e}, {0xb8, 0xb8}, {0xb7, 0xb7}}, + {{0x9b, 0x9b}, {0x81, 0x81}, {0xba, 0xba}, {0xb9, 0xb9}}, + {{0x91, 0x91}, {0x9b, 0x9b}, {0xb4, 0xb4}, {0xba, 0xba}}, + {{0xb9, 0xb9}, {0xbb, 0xbb}, {0xba, 0xba}, {0xbc, 0xbc}}, + {{0xbc, 0xbc}, {0xb6, 0xb6}, {0xba, 0xba}, {0xb4, 0xb4}}, + {{0xbd, 0xbd}, {0xb3, 0xb3}, {0xbc, 0xbc}, {0xb6, 0xb6}}, + {{0xc3, 0xc3}, {0xbe, 0xbe}, {0xc4, 0xc4}, {0xc5, 0xc5}}, + {{0xc1, 0xc1}, {0xc0, 0xc0}, {0xc2, 0xc2}, {0xbf, 0xbf}}, + {{0xb8, 0xb8}, {0xb3, 0xb3}, {0xc1, 0xc1}, {0xc0, 0xc0}}, + {{0x76, 0x76}, {0x65, 0x65}, {0xc1, 0xc1}, {0xb8, 0xb8}}, + {{0x71, 0x71}, {0x76, 0x76}, {0xc2, 0xc2}, {0xc1, 0xc1}}, + {{0xbd, 0xbd}, {0xb2, 0xb2}, {0xc4, 0xc4}, {0xc3, 0xc3}}, + {{0xb3, 0xb3}, {0xbd, 0xbd}, {0xc0, 0xc0}, {0xc4, 0xc4}}, + {{0xc5, 0xc5}, {0xbf, 0xbf}, {0xc4, 0xc4}, {0xc0, 0xc0}}, + {{0xc6, 0xc6}, {0xc9, 0xc9}, {0xc7, 0xc7}, {0xc8, 0xc8}}, + {{0xc2, 0xc2}, {0xbf, 0xbf}, {0xc8, 0xc8}, {0xc7, 0xc7}}, + {{0x7d, 0x7d}, {0x71, 0x71}, {0xc8, 0xc8}, {0xc2, 0xc2}}, + {{0xc9, 0xc9}, {5, 5}, {0xc8, 0xc8}, {0x7d, 0x7d}}, + {{0xc5, 0xc5}, {0xbe, 0xbe}, {0xcb, 0xcb}, {0xca, 0xca}}, + {{0xc7, 0xc7}, {0xbf, 0xbf}, {0xcb, 0xcb}, {0xc5, 0xc5}}, + {{0xcc, 0xcc}, {0xc6, 0xc6}, {0xcb, 0xcb}, {0xc7, 0xc7}}, + {{0x4a, 0x379}, {0x44, 0x37a}, {0xd4, 0xd4}, {0xd5, 0xd5}}, + {{0xcd, 0xcd}, {0xd2, 0xd2}, {0xd0, 0xd0}, {0xd1, 0xd1}}, + {{0xad, 0xad}, {0xa8, 0xa8}, {0xcf, 0xcf}, {0xce, 0xce}}, + {{0xb9, 0xb9}, {0x81, 0x81}, {0xcf, 0xcf}, {0xad, 0xad}}, + {{0xcf, 0xcf}, {0xce, 0xce}, {0xd1, 0xd1}, {0xd0, 0xd0}}, + {{0xbb, 0xbb}, {0xb9, 0xb9}, {0xd1, 0xd1}, {0xcf, 0xcf}}, + {{0xd2, 0xd2}, {0xb2, 0xb2}, {0xd1, 0xd1}, {0xbb, 0xbb}}, + {{7, 0x373}, {0x47, 0x37b}, {0xb0, 0xb0}, {0xd3, 0xd3}}, + {{0xd3, 0xd3}, {0xce, 0xce}, {0xb0, 0xb0}, {0xa8, 0xa8}}, + {{0x47, 0x37b}, {0x4a, 0x379}, {0xd3, 0xd3}, {0xd4, 0xd4}}, + {{0xd4, 0xd4}, {0xd0, 0xd0}, {0xd3, 0xd3}, {0xce, 0xce}}, + {{0xd5, 0xd5}, {0xcd, 0xcd}, {0xd4, 0xd4}, {0xd0, 0xd0}}, + {{0x56, 0x37c}, {0x53, 0x37d}, {0xda, 0xda}, {0xdb, 0xdb}}, + {{0xd6, 0xd6}, {0xd9, 0xd9}, {0xd7, 0xd7}, {0xd8, 0xd8}}, + {{0xd2, 0xd2}, {0xcd, 0xcd}, {0xd8, 0xd8}, {0xd7, 0xd7}}, + {{0xc3, 0xc3}, {0xb2, 0xb2}, {0xd8, 0xd8}, {0xd2, 0xd2}}, + {{0xd9, 0xd9}, {0xbe, 0xbe}, {0xd8, 0xd8}, {0xc3, 0xc3}}, + {{0x44, 0x37a}, {0x56, 0x37c}, {0xd5, 0xd5}, {0xda, 0xda}}, + {{0xda, 0xda}, {0xd7, 0xd7}, {0xd5, 0xd5}, {0xcd, 0xcd}}, + {{0xdb, 0xdb}, {0xd6, 0xd6}, {0xda, 0xda}, {0xd7, 0xd7}}, + {{0xdc, 0xdc}, {0xdf, 0xdf}, {0xdd, 0xdd}, {0xde, 0xde}}, + {{0xd9, 0xd9}, {0xd6, 0xd6}, {0xde, 0xde}, {0xdd, 0xdd}}, + {{0xca, 0xca}, {0xbe, 0xbe}, {0xde, 0xde}, {0xd9, 0xd9}}, + {{0xdf, 0xdf}, {0xb1, 0xb1}, {0xde, 0xde}, {0xca, 0xca}}, + {{0x53, 0x37d}, {0x5e, 0x5e}, {0xdb, 0xdb}, {0xe0, 0xe0}}, + {{0xe0, 0xe0}, {0xdd, 0xdd}, {0xdb, 0xdb}, {0xd6, 0xd6}}, + {{0xe1, 0xe1}, {0xdc, 0xdc}, {0xe0, 0xe0}, {0xdd, 0xdd}}, + {{0xe2, 0xe2}, {0x15e, 0x15e}, {0x15c, 0x15c}, {0x15d, 0x15d}}, + {{0x11f, 0x11f}, {0xe4, 0xe4}, {0x120, 0x120}, {0x121, 0x121}}, + {{0x104, 0x104}, {0xe5, 0xe5}, {0x105, 0x105}, {0x106, 0x106}}, + {{0xf2, 0xf2}, {0xe7, 0xe7}, {0xf3, 0xf3}, {0xf4, 0xf4}}, + {{0xee, 0xee}, {0xed, 0xed}, {0xef, 0xef}, {0xe8, 0xe8}}, + {{0x61, 0x61}, {0x5d, 0x5d}, {0xeb, 0xeb}, {0xea, 0xea}}, + {{0xe9, 0xe9}, {3, 0x371}, {0xeb, 0xeb}, {0x61, 0x61}}, + {{0xeb, 0xeb}, {0xea, 0xea}, {0xee, 0xee}, {0xed, 0xed}}, + {{0xec, 0xec}, {0xe9, 0xe9}, {0xee, 0xee}, {0xeb, 0xeb}}, + {{0xe6, 0xe6}, {0xec, 0xec}, {0xef, 0xef}, {0xee, 0xee}}, + {{0x64, 0x64}, {0x43, 0x43}, {0xf1, 0xf1}, {0xf0, 0xf0}}, + {{0x5d, 0x5d}, {0x64, 0x64}, {0xea, 0xea}, {0xf1, 0xf1}}, + {{0xf0, 0xf0}, {0xf2, 0xf2}, {0xf1, 0xf1}, {0xf3, 0xf3}}, + {{0xf3, 0xf3}, {0xed, 0xed}, {0xf1, 0xf1}, {0xea, 0xea}}, + {{0xf4, 0xf4}, {0xe8, 0xe8}, {0xf3, 0xf3}, {0xed, 0xed}}, + {{0xfc, 0xfc}, {0xf6, 0xf6}, {0xfd, 0xfd}, {0xfe, 0xfe}}, + {{0xfa, 0xfa}, {0xf9, 0xf9}, {0xfb, 0xfb}, {0xf7, 0xf7}}, + {{0xef, 0xef}, {0xe8, 0xe8}, {0xfa, 0xfa}, {0xf9, 0xf9}}, + {{0xf8, 0xf8}, {0xe6, 0xe6}, {0xfa, 0xfa}, {0xef, 0xef}}, + {{0xf5, 0xf5}, {0xf8, 0xf8}, {0xfb, 0xfb}, {0xfa, 0xfa}}, + {{0xf4, 0xf4}, {0xe7, 0xe7}, {0xfd, 0xfd}, {0xfc, 0xfc}}, + {{0xe8, 0xe8}, {0xf4, 0xf4}, {0xf9, 0xf9}, {0xfd, 0xfd}}, + {{0xfe, 0xfe}, {0xf7, 0xf7}, {0xfd, 0xfd}, {0xf9, 0xf9}}, + {{0x102, 0x102}, {0x101, 0x101}, {0x103, 0x103}, {0xff, 0xff}}, + {{0xfb, 0xfb}, {0xf7, 0xf7}, {0x102, 0x102}, {0x101, 0x101}}, + {{0x100, 0x100}, {0xf5, 0xf5}, {0x102, 0x102}, {0xfb, 0xfb}}, + {{0xe3, 0xe3}, {0x100, 0x100}, {0x103, 0x103}, {0x102, 0x102}}, + {{0xfe, 0xfe}, {0xf6, 0xf6}, {0x105, 0x105}, {0x104, 0x104}}, + {{0xf7, 0xf7}, {0xfe, 0xfe}, {0x101, 0x101}, {0x105, 0x105}}, + {{0x106, 0x106}, {0xff, 0xff}, {0x105, 0x105}, {0x101, 0x101}}, + {{0x110, 0x110}, {0x107, 0x107}, {0x111, 0x111}, {0x112, 0x112}}, + {{0x10b, 0x10b}, {0x108, 0x108}, {0x10c, 0x10c}, {0x10d, 0x10d}}, + {{0x7c, 0x7c}, {0x79, 0x79}, {0x10a, 0x10a}, {0x109, 0x109}}, + {{0x43, 0x43}, {0x7c, 0x7c}, {0xf0, 0xf0}, {0x10a, 0x10a}}, + {{0x109, 0x109}, {0x10b, 0x10b}, {0x10a, 0x10a}, {0x10c, 0x10c}}, + {{0x10c, 0x10c}, {0xf2, 0xf2}, {0x10a, 0x10a}, {0xf0, 0xf0}}, + {{0x10d, 0x10d}, {0xe7, 0xe7}, {0x10c, 0x10c}, {0xf2, 0xf2}}, + {{0x7f, 0x7f}, {5, 5}, {0x10f, 0x10f}, {0x10e, 0x10e}}, + {{0x79, 0x79}, {0x7f, 0x7f}, {0x109, 0x109}, {0x10f, 0x10f}}, + {{0x10e, 0x10e}, {0x110, 0x110}, {0x10f, 0x10f}, {0x111, 0x111}}, + {{0x111, 0x111}, {0x10b, 0x10b}, {0x10f, 0x10f}, {0x109, 0x109}}, + {{0x112, 0x112}, {0x108, 0x108}, {0x111, 0x111}, {0x10b, 0x10b}}, + {{0x118, 0x118}, {0x113, 0x113}, {0x119, 0x119}, {0x11a, 0x11a}}, + {{0x114, 0x114}, {0x117, 0x117}, {0x115, 0x115}, {0x116, 0x116}}, + {{0x10d, 0x10d}, {0x108, 0x108}, {0x116, 0x116}, {0x115, 0x115}}, + {{0xfc, 0xfc}, {0xe7, 0xe7}, {0x116, 0x116}, {0x10d, 0x10d}}, + {{0x117, 0x117}, {0xf6, 0xf6}, {0x116, 0x116}, {0xfc, 0xfc}}, + {{0x107, 0x107}, {0x118, 0x118}, {0x112, 0x112}, {0x119, 0x119}}, + {{0x119, 0x119}, {0x115, 0x115}, {0x112, 0x112}, {0x108, 0x108}}, + {{0x11a, 0x11a}, {0x114, 0x114}, {0x119, 0x119}, {0x115, 0x115}}, + {{0x11b, 0x11b}, {0x11e, 0x11e}, {0x11c, 0x11c}, {0x11d, 0x11d}}, + {{0x117, 0x117}, {0x114, 0x114}, {0x11d, 0x11d}, {0x11c, 0x11c}}, + {{0x104, 0x104}, {0xf6, 0xf6}, {0x11d, 0x11d}, {0x117, 0x117}}, + {{0x11e, 0x11e}, {0xe5, 0xe5}, {0x11d, 0x11d}, {0x104, 0x104}}, + {{0x113, 0x113}, {0x11f, 0x11f}, {0x11a, 0x11a}, {0x120, 0x120}}, + {{0x120, 0x120}, {0x11c, 0x11c}, {0x11a, 0x11a}, {0x114, 0x114}}, + {{0x121, 0x121}, {0x11b, 0x11b}, {0x120, 0x120}, {0x11c, 0x11c}}, + {{0x122, 0x122}, {0x143, 0x143}, {0x141, 0x141}, {0x142, 0x142}}, + {{0x12f, 0x12f}, {0x124, 0x124}, {0x130, 0x130}, {0x131, 0x131}}, + {{0x12b, 0x12b}, {0x12a, 0x12a}, {0x12c, 0x12c}, {0x125, 0x125}}, + {{0x103, 0x103}, {0xff, 0xff}, {0x128, 0x128}, {0x127, 0x127}}, + {{0x126, 0x126}, {0xe3, 0xe3}, {0x128, 0x128}, {0x103, 0x103}}, + {{0x128, 0x128}, {0x127, 0x127}, {0x12b, 0x12b}, {0x12a, 0x12a}}, + {{0x129, 0x129}, {0x126, 0x126}, {0x12b, 0x12b}, {0x128, 0x128}}, + {{0x123, 0x123}, {0x129, 0x129}, {0x12c, 0x12c}, {0x12b, 0x12b}}, + {{0x106, 0x106}, {0xe5, 0xe5}, {0x12e, 0x12e}, {0x12d, 0x12d}}, + {{0xff, 0xff}, {0x106, 0x106}, {0x127, 0x127}, {0x12e, 0x12e}}, + {{0x12d, 0x12d}, {0x12f, 0x12f}, {0x12e, 0x12e}, {0x130, 0x130}}, + {{0x130, 0x130}, {0x12a, 0x12a}, {0x12e, 0x12e}, {0x127, 0x127}}, + {{0x131, 0x131}, {0x125, 0x125}, {0x130, 0x130}, {0x12a, 0x12a}}, + {{0x139, 0x139}, {0x133, 0x133}, {0x13a, 0x13a}, {0x13b, 0x13b}}, + {{0x137, 0x137}, {0x136, 0x136}, {0x138, 0x138}, {0x134, 0x134}}, + {{0x12c, 0x12c}, {0x125, 0x125}, {0x137, 0x137}, {0x136, 0x136}}, + {{0x135, 0x135}, {0x123, 0x123}, {0x137, 0x137}, {0x12c, 0x12c}}, + {{0x132, 0x132}, {0x135, 0x135}, {0x138, 0x138}, {0x137, 0x137}}, + {{0x131, 0x131}, {0x124, 0x124}, {0x13a, 0x13a}, {0x139, 0x139}}, + {{0x125, 0x125}, {0x131, 0x131}, {0x136, 0x136}, {0x13a, 0x13a}}, + {{0x13b, 0x13b}, {0x134, 0x134}, {0x13a, 0x13a}, {0x136, 0x136}}, + {{0x13c, 0x13c}, {0x140, 0x140}, {0x13e, 0x13e}, {0x13f, 0x13f}}, + {{0x138, 0x138}, {0x134, 0x134}, {0x13f, 0x13f}, {0x13e, 0x13e}}, + {{0x13d, 0x37e}, {0x132, 0x132}, {0x13f, 0x13f}, {0x138, 0x138}}, + {{0x140, 0x140}, {2, 0x37f}, {0x13f, 0x13f}, {0x13d, 0x37e}}, + {{0x13b, 0x13b}, {0x133, 0x133}, {0x142, 0x142}, {0x141, 0x141}}, + {{0x13e, 0x13e}, {0x134, 0x134}, {0x142, 0x142}, {0x13b, 0x13b}}, + {{0x143, 0x143}, {0x13c, 0x13c}, {0x142, 0x142}, {0x13e, 0x13e}}, + {{0x14d, 0x14d}, {0x144, 0x144}, {0x14e, 0x14e}, {0x14f, 0x14f}}, + {{0x149, 0x149}, {0x148, 0x148}, {0x14a, 0x14a}, {0x145, 0x145}}, + {{0x11e, 0x11e}, {0x11b, 0x11b}, {0x147, 0x147}, {0x146, 0x146}}, + {{0x12d, 0x12d}, {0xe5, 0xe5}, {0x147, 0x147}, {0x11e, 0x11e}}, + {{0x147, 0x147}, {0x146, 0x146}, {0x149, 0x149}, {0x148, 0x148}}, + {{0x12f, 0x12f}, {0x12d, 0x12d}, {0x149, 0x149}, {0x147, 0x147}}, + {{0x124, 0x124}, {0x12f, 0x12f}, {0x14a, 0x14a}, {0x149, 0x149}}, + {{0x121, 0x121}, {0xe4, 0xe4}, {0x14c, 0x14c}, {0x14b, 0x14b}}, + {{0x11b, 0x11b}, {0x121, 0x121}, {0x146, 0x146}, {0x14c, 0x14c}}, + {{0x14b, 0x14b}, {0x14d, 0x14d}, {0x14c, 0x14c}, {0x14e, 0x14e}}, + {{0x14e, 0x14e}, {0x148, 0x148}, {0x14c, 0x14c}, {0x146, 0x146}}, + {{0x14f, 0x14f}, {0x145, 0x145}, {0x14e, 0x14e}, {0x148, 0x148}}, + {{0x155, 0x155}, {0x150, 0x150}, {0x156, 0x156}, {0x157, 0x157}}, + {{0x153, 0x153}, {0x152, 0x152}, {0x154, 0x154}, {0x151, 0x151}}, + {{0x14a, 0x14a}, {0x145, 0x145}, {0x153, 0x153}, {0x152, 0x152}}, + {{0x139, 0x139}, {0x124, 0x124}, {0x153, 0x153}, {0x14a, 0x14a}}, + {{0x133, 0x133}, {0x139, 0x139}, {0x154, 0x154}, {0x153, 0x153}}, + {{0x14f, 0x14f}, {0x144, 0x144}, {0x156, 0x156}, {0x155, 0x155}}, + {{0x145, 0x145}, {0x14f, 0x14f}, {0x152, 0x152}, {0x156, 0x156}}, + {{0x157, 0x157}, {0x151, 0x151}, {0x156, 0x156}, {0x152, 0x152}}, + {{0x158, 0x158}, {0x15b, 0x15b}, {0x159, 0x159}, {0x15a, 0x15a}}, + {{0x154, 0x154}, {0x151, 0x151}, {0x15a, 0x15a}, {0x159, 0x159}}, + {{0x141, 0x141}, {0x133, 0x133}, {0x15a, 0x15a}, {0x154, 0x154}}, + {{0x15b, 0x15b}, {0x122, 0x122}, {0x15a, 0x15a}, {0x141, 0x141}}, + {{0x157, 0x157}, {0x150, 0x150}, {0x15d, 0x15d}, {0x15c, 0x15c}}, + {{0x159, 0x159}, {0x151, 0x151}, {0x15d, 0x15d}, {0x157, 0x157}}, + {{0x15e, 0x15e}, {0x158, 0x158}, {0x15d, 0x15d}, {0x159, 0x159}}, + {{0x100, 0x380}, {0xe3, 0x381}, {0x18e, 0x18e}, {0x18f, 0x18f}}, + {{0x15f, 0x15f}, {0x17a, 0x17a}, {0x178, 0x178}, {0x179, 0x179}}, + {{0x169, 0x169}, {0x160, 0x160}, {0x16a, 0x16a}, {0x16b, 0x16b}}, + {{0x165, 0x165}, {0x164, 0x164}, {0x166, 0x166}, {0x161, 0x161}}, + {{0xc9, 0xc9}, {0xc6, 0xc6}, {0x163, 0x163}, {0x162, 0x162}}, + {{0x10e, 0x10e}, {5, 5}, {0x163, 0x163}, {0xc9, 0xc9}}, + {{0x163, 0x163}, {0x162, 0x162}, {0x165, 0x165}, {0x164, 0x164}}, + {{0x110, 0x110}, {0x10e, 0x10e}, {0x165, 0x165}, {0x163, 0x163}}, + {{0x107, 0x107}, {0x110, 0x110}, {0x166, 0x166}, {0x165, 0x165}}, + {{0xcc, 0xcc}, {0xb1, 0xb1}, {0x168, 0x168}, {0x167, 0x167}}, + {{0xc6, 0xc6}, {0xcc, 0xcc}, {0x162, 0x162}, {0x168, 0x168}}, + {{0x167, 0x167}, {0x169, 0x169}, {0x168, 0x168}, {0x16a, 0x16a}}, + {{0x16a, 0x16a}, {0x164, 0x164}, {0x168, 0x168}, {0x162, 0x162}}, + {{0x16b, 0x16b}, {0x161, 0x161}, {0x16a, 0x16a}, {0x164, 0x164}}, + {{0x171, 0x171}, {0x16c, 0x16c}, {0x172, 0x172}, {0x173, 0x173}}, + {{0x16f, 0x16f}, {0x16e, 0x16e}, {0x170, 0x170}, {0x16d, 0x16d}}, + {{0x166, 0x166}, {0x161, 0x161}, {0x16f, 0x16f}, {0x16e, 0x16e}}, + {{0x118, 0x118}, {0x107, 0x107}, {0x16f, 0x16f}, {0x166, 0x166}}, + {{0x113, 0x113}, {0x118, 0x118}, {0x170, 0x170}, {0x16f, 0x16f}}, + {{0x16b, 0x16b}, {0x160, 0x160}, {0x172, 0x172}, {0x171, 0x171}}, + {{0x161, 0x161}, {0x16b, 0x16b}, {0x16e, 0x16e}, {0x172, 0x172}}, + {{0x173, 0x173}, {0x16d, 0x16d}, {0x172, 0x172}, {0x16e, 0x16e}}, + {{0x174, 0x174}, {0x177, 0x177}, {0x175, 0x175}, {0x176, 0x176}}, + {{0x170, 0x170}, {0x16d, 0x16d}, {0x176, 0x176}, {0x175, 0x175}}, + {{0x11f, 0x11f}, {0x113, 0x113}, {0x176, 0x176}, {0x170, 0x170}}, + {{0x177, 0x177}, {0xe4, 0xe4}, {0x176, 0x176}, {0x11f, 0x11f}}, + {{0x173, 0x173}, {0x16c, 0x16c}, {0x179, 0x179}, {0x178, 0x178}}, + {{0x175, 0x175}, {0x16d, 0x16d}, {0x179, 0x179}, {0x173, 0x173}}, + {{0x17a, 0x17a}, {0x174, 0x174}, {0x179, 0x179}, {0x175, 0x175}}, + {{0xec, 0x382}, {0xe6, 0x383}, {0x182, 0x182}, {0x183, 0x183}}, + {{0x17b, 0x17b}, {0x180, 0x180}, {0x17e, 0x17e}, {0x17f, 0x17f}}, + {{0xdf, 0xdf}, {0xdc, 0xdc}, {0x17d, 0x17d}, {0x17c, 0x17c}}, + {{0x167, 0x167}, {0xb1, 0xb1}, {0x17d, 0x17d}, {0xdf, 0xdf}}, + {{0x17d, 0x17d}, {0x17c, 0x17c}, {0x17f, 0x17f}, {0x17e, 0x17e}}, + {{0x169, 0x169}, {0x167, 0x167}, {0x17f, 0x17f}, {0x17d, 0x17d}}, + {{0x180, 0x180}, {0x160, 0x160}, {0x17f, 0x17f}, {0x169, 0x169}}, + {{3, 3}, {0xe9, 0x384}, {0xe1, 0xe1}, {0x181, 0x181}}, + {{0x181, 0x181}, {0x17c, 0x17c}, {0xe1, 0xe1}, {0xdc, 0xdc}}, + {{0xe9, 0x384}, {0xec, 0x382}, {0x181, 0x181}, {0x182, 0x182}}, + {{0x182, 0x182}, {0x17e, 0x17e}, {0x181, 0x181}, {0x17c, 0x17c}}, + {{0x183, 0x183}, {0x17b, 0x17b}, {0x182, 0x182}, {0x17e, 0x17e}}, + {{0xf8, 0x385}, {0xf5, 0x386}, {0x188, 0x188}, {0x189, 0x189}}, + {{0x184, 0x184}, {0x187, 0x187}, {0x185, 0x185}, {0x186, 0x186}}, + {{0x180, 0x180}, {0x17b, 0x17b}, {0x186, 0x186}, {0x185, 0x185}}, + {{0x171, 0x171}, {0x160, 0x160}, {0x186, 0x186}, {0x180, 0x180}}, + {{0x187, 0x187}, {0x16c, 0x16c}, {0x186, 0x186}, {0x171, 0x171}}, + {{0xe6, 0x383}, {0xf8, 0x385}, {0x183, 0x183}, {0x188, 0x188}}, + {{0x188, 0x188}, {0x185, 0x185}, {0x183, 0x183}, {0x17b, 0x17b}}, + {{0x189, 0x189}, {0x184, 0x184}, {0x188, 0x188}, {0x185, 0x185}}, + {{0x18a, 0x18a}, {0x18d, 0x18d}, {0x18b, 0x18b}, {0x18c, 0x18c}}, + {{0x187, 0x187}, {0x184, 0x184}, {0x18c, 0x18c}, {0x18b, 0x18b}}, + {{0x178, 0x178}, {0x16c, 0x16c}, {0x18c, 0x18c}, {0x187, 0x187}}, + {{0x18d, 0x18d}, {0x15f, 0x15f}, {0x18c, 0x18c}, {0x178, 0x178}}, + {{0xf5, 0x386}, {0x100, 0x380}, {0x189, 0x189}, {0x18e, 0x18e}}, + {{0x18e, 0x18e}, {0x18b, 0x18b}, {0x189, 0x189}, {0x184, 0x184}}, + {{0x18f, 0x18f}, {0x18a, 0x18a}, {0x18e, 0x18e}, {0x18b, 0x18b}}, + {{0x190, 0x190}, {0x1ab, 0x1ab}, {0x1a9, 0x1a9}, {0x1aa, 0x1aa}}, + {{0x19a, 0x19a}, {0x191, 0x191}, {0x19b, 0x19b}, {0x19c, 0x19c}}, + {{0x196, 0x196}, {0x195, 0x195}, {0x197, 0x197}, {0x192, 0x192}}, + {{0x177, 0x177}, {0x174, 0x174}, {0x194, 0x194}, {0x193, 0x193}}, + {{0x14b, 0x14b}, {0xe4, 0xe4}, {0x194, 0x194}, {0x177, 0x177}}, + {{0x194, 0x194}, {0x193, 0x193}, {0x196, 0x196}, {0x195, 0x195}}, + {{0x14d, 0x14d}, {0x14b, 0x14b}, {0x196, 0x196}, {0x194, 0x194}}, + {{0x144, 0x144}, {0x14d, 0x14d}, {0x197, 0x197}, {0x196, 0x196}}, + {{0x17a, 0x17a}, {0x15f, 0x15f}, {0x199, 0x199}, {0x198, 0x198}}, + {{0x174, 0x174}, {0x17a, 0x17a}, {0x193, 0x193}, {0x199, 0x199}}, + {{0x198, 0x198}, {0x19a, 0x19a}, {0x199, 0x199}, {0x19b, 0x19b}}, + {{0x19b, 0x19b}, {0x195, 0x195}, {0x199, 0x199}, {0x193, 0x193}}, + {{0x19c, 0x19c}, {0x192, 0x192}, {0x19b, 0x19b}, {0x195, 0x195}}, + {{0x1a2, 0x1a2}, {0x19d, 0x19d}, {0x1a3, 0x1a3}, {0x1a4, 0x1a4}}, + {{0x1a0, 0x1a0}, {0x19f, 0x19f}, {0x1a1, 0x1a1}, {0x19e, 0x19e}}, + {{0x197, 0x197}, {0x192, 0x192}, {0x1a0, 0x1a0}, {0x19f, 0x19f}}, + {{0x155, 0x155}, {0x144, 0x144}, {0x1a0, 0x1a0}, {0x197, 0x197}}, + {{0x150, 0x150}, {0x155, 0x155}, {0x1a1, 0x1a1}, {0x1a0, 0x1a0}}, + {{0x19c, 0x19c}, {0x191, 0x191}, {0x1a3, 0x1a3}, {0x1a2, 0x1a2}}, + {{0x192, 0x192}, {0x19c, 0x19c}, {0x19f, 0x19f}, {0x1a3, 0x1a3}}, + {{0x1a4, 0x1a4}, {0x19e, 0x19e}, {0x1a3, 0x1a3}, {0x19f, 0x19f}}, + {{0x1a5, 0x1a5}, {0x1a8, 0x1a8}, {0x1a6, 0x1a6}, {0x1a7, 0x1a7}}, + {{0x1a1, 0x1a1}, {0x19e, 0x19e}, {0x1a7, 0x1a7}, {0x1a6, 0x1a6}}, + {{0x15c, 0x15c}, {0x150, 0x150}, {0x1a7, 0x1a7}, {0x1a1, 0x1a1}}, + {{0x1a8, 0x1a8}, {0xe2, 0xe2}, {0x1a7, 0x1a7}, {0x15c, 0x15c}}, + {{0x1a4, 0x1a4}, {0x19d, 0x19d}, {0x1aa, 0x1aa}, {0x1a9, 0x1a9}}, + {{0x1a6, 0x1a6}, {0x19e, 0x19e}, {0x1aa, 0x1aa}, {0x1a4, 0x1a4}}, + {{0x1ab, 0x1ab}, {0x1a5, 0x1a5}, {0x1aa, 0x1aa}, {0x1a6, 0x1a6}}, + {{0x129, 0x387}, {0x123, 0x388}, {0x1b3, 0x1b3}, {0x1b4, 0x1b4}}, + {{0x1ac, 0x1ac}, {0x1b1, 0x1b1}, {0x1af, 0x1af}, {0x1b0, 0x1b0}}, + {{0x18d, 0x18d}, {0x18a, 0x18a}, {0x1ae, 0x1ae}, {0x1ad, 0x1ad}}, + {{0x198, 0x198}, {0x15f, 0x15f}, {0x1ae, 0x1ae}, {0x18d, 0x18d}}, + {{0x1ae, 0x1ae}, {0x1ad, 0x1ad}, {0x1b0, 0x1b0}, {0x1af, 0x1af}}, + {{0x19a, 0x19a}, {0x198, 0x198}, {0x1b0, 0x1b0}, {0x1ae, 0x1ae}}, + {{0x1b1, 0x1b1}, {0x191, 0x191}, {0x1b0, 0x1b0}, {0x19a, 0x19a}}, + {{0xe3, 0x381}, {0x126, 0x389}, {0x18f, 0x18f}, {0x1b2, 0x1b2}}, + {{0x1b2, 0x1b2}, {0x1ad, 0x1ad}, {0x18f, 0x18f}, {0x18a, 0x18a}}, + {{0x126, 0x389}, {0x129, 0x387}, {0x1b2, 0x1b2}, {0x1b3, 0x1b3}}, + {{0x1b3, 0x1b3}, {0x1af, 0x1af}, {0x1b2, 0x1b2}, {0x1ad, 0x1ad}}, + {{0x1b4, 0x1b4}, {0x1ac, 0x1ac}, {0x1b3, 0x1b3}, {0x1af, 0x1af}}, + {{0x135, 0x38a}, {0x132, 0x38b}, {0x1b9, 0x1b9}, {0x1ba, 0x1ba}}, + {{0x1b5, 0x1b5}, {0x1b8, 0x1b8}, {0x1b6, 0x1b6}, {0x1b7, 0x1b7}}, + {{0x1b1, 0x1b1}, {0x1ac, 0x1ac}, {0x1b7, 0x1b7}, {0x1b6, 0x1b6}}, + {{0x1a2, 0x1a2}, {0x191, 0x191}, {0x1b7, 0x1b7}, {0x1b1, 0x1b1}}, + {{0x1b8, 0x1b8}, {0x19d, 0x19d}, {0x1b7, 0x1b7}, {0x1a2, 0x1a2}}, + {{0x123, 0x388}, {0x135, 0x38a}, {0x1b4, 0x1b4}, {0x1b9, 0x1b9}}, + {{0x1b9, 0x1b9}, {0x1b6, 0x1b6}, {0x1b4, 0x1b4}, {0x1ac, 0x1ac}}, + {{0x1ba, 0x1ba}, {0x1b5, 0x1b5}, {0x1b9, 0x1b9}, {0x1b6, 0x1b6}}, + {{0x1bb, 0x1bb}, {0x1be, 0x1be}, {0x1bc, 0x1bc}, {0x1bd, 0x1bd}}, + {{0x1b8, 0x1b8}, {0x1b5, 0x1b5}, {0x1bd, 0x1bd}, {0x1bc, 0x1bc}}, + {{0x1a9, 0x1a9}, {0x19d, 0x19d}, {0x1bd, 0x1bd}, {0x1b8, 0x1b8}}, + {{0x1be, 0x1be}, {0x190, 0x190}, {0x1bd, 0x1bd}, {0x1a9, 0x1a9}}, + {{0x132, 0x38b}, {0x13d, 0x13d}, {0x1ba, 0x1ba}, {0x1bf, 0x1bf}}, + {{0x1bf, 0x1bf}, {0x1bc, 0x1bc}, {0x1ba, 0x1ba}, {0x1b5, 0x1b5}}, + {{0x1c0, 0x1c0}, {0x1bb, 0x1bb}, {0x1bf, 0x1bf}, {0x1bc, 0x1bc}}, + {{0x214, 0x214}, {0x1c1, 0x1c1}, {0x28f, 0x28f}, {0x290, 0x290}}, + {{0x1c2, 0x1c2}, {0x235, 0x235}, {0x233, 0x233}, {0x234, 0x234}}, + {{0x1f6, 0x1f6}, {0x1c4, 0x1c4}, {0x1f7, 0x1f7}, {0x1f8, 0x1f8}}, + {{0x1df, 0x1df}, {0x1c5, 0x1c5}, {0x1e0, 0x1e0}, {0x1e1, 0x1e1}}, + {{0x1d2, 0x1d2}, {0x1c7, 0x1c7}, {0x1d3, 0x1d3}, {0x1d4, 0x1d4}}, + {{0x1ce, 0x1ce}, {0x1cd, 0x1cd}, {0x1cf, 0x1cf}, {0x1c8, 0x1c8}}, + {{0x140, 0x140}, {0x13c, 0x13c}, {0x1cb, 0x1cb}, {0x1ca, 0x1ca}}, + {{0x1c9, 0x1c9}, {2, 0x37f}, {0x1cb, 0x1cb}, {0x140, 0x140}}, + {{0x1cb, 0x1cb}, {0x1ca, 0x1ca}, {0x1ce, 0x1ce}, {0x1cd, 0x1cd}}, + {{0x1cc, 0x1cc}, {0x1c9, 0x1c9}, {0x1ce, 0x1ce}, {0x1cb, 0x1cb}}, + {{0x1c6, 0x1c6}, {0x1cc, 0x1cc}, {0x1cf, 0x1cf}, {0x1ce, 0x1ce}}, + {{0x143, 0x143}, {0x122, 0x122}, {0x1d1, 0x1d1}, {0x1d0, 0x1d0}}, + {{0x13c, 0x13c}, {0x143, 0x143}, {0x1ca, 0x1ca}, {0x1d1, 0x1d1}}, + {{0x1d0, 0x1d0}, {0x1d2, 0x1d2}, {0x1d1, 0x1d1}, {0x1d3, 0x1d3}}, + {{0x1d3, 0x1d3}, {0x1cd, 0x1cd}, {0x1d1, 0x1d1}, {0x1ca, 0x1ca}}, + {{0x1d4, 0x1d4}, {0x1c8, 0x1c8}, {0x1d3, 0x1d3}, {0x1cd, 0x1cd}}, + {{0x1db, 0x1db}, {0x1da, 0x1da}, {0x1dc, 0x1dc}, {0x1d5, 0x1d5}}, + {{0x1cf, 0x1cf}, {0x1c8, 0x1c8}, {0x1d8, 0x1d8}, {0x1d7, 0x1d7}}, + {{0x1d6, 0x1d6}, {0x1c6, 0x1c6}, {0x1d8, 0x1d8}, {0x1cf, 0x1cf}}, + {{0x1d8, 0x1d8}, {0x1d7, 0x1d7}, {0x1db, 0x1db}, {0x1da, 0x1da}}, + {{0x1d9, 0x1d9}, {0x1d6, 0x1d6}, {0x1db, 0x1db}, {0x1d8, 0x1d8}}, + {{0x1c3, 0x1c3}, {0x1d9, 0x1d9}, {0x1dc, 0x1dc}, {0x1db, 0x1db}}, + {{0x1d4, 0x1d4}, {0x1c7, 0x1c7}, {0x1de, 0x1de}, {0x1dd, 0x1dd}}, + {{0x1c8, 0x1c8}, {0x1d4, 0x1d4}, {0x1d7, 0x1d7}, {0x1de, 0x1de}}, + {{0x1dd, 0x1dd}, {0x1df, 0x1df}, {0x1de, 0x1de}, {0x1e0, 0x1e0}}, + {{0x1e0, 0x1e0}, {0x1da, 0x1da}, {0x1de, 0x1de}, {0x1d7, 0x1d7}}, + {{0x1e1, 0x1e1}, {0x1d5, 0x1d5}, {0x1e0, 0x1e0}, {0x1da, 0x1da}}, + {{0x1eb, 0x1eb}, {0x1e2, 0x1e2}, {0x1ec, 0x1ec}, {0x1ed, 0x1ed}}, + {{0x1e6, 0x1e6}, {0x1e3, 0x1e3}, {0x1e7, 0x1e7}, {0x1e8, 0x1e8}}, + {{0x15b, 0x15b}, {0x158, 0x158}, {0x1e5, 0x1e5}, {0x1e4, 0x1e4}}, + {{0x122, 0x122}, {0x15b, 0x15b}, {0x1d0, 0x1d0}, {0x1e5, 0x1e5}}, + {{0x1e4, 0x1e4}, {0x1e6, 0x1e6}, {0x1e5, 0x1e5}, {0x1e7, 0x1e7}}, + {{0x1e7, 0x1e7}, {0x1d2, 0x1d2}, {0x1e5, 0x1e5}, {0x1d0, 0x1d0}}, + {{0x1e8, 0x1e8}, {0x1c7, 0x1c7}, {0x1e7, 0x1e7}, {0x1d2, 0x1d2}}, + {{0x15e, 0x15e}, {0xe2, 0xe2}, {0x1ea, 0x1ea}, {0x1e9, 0x1e9}}, + {{0x158, 0x158}, {0x15e, 0x15e}, {0x1e4, 0x1e4}, {0x1ea, 0x1ea}}, + {{0x1e9, 0x1e9}, {0x1eb, 0x1eb}, {0x1ea, 0x1ea}, {0x1ec, 0x1ec}}, + {{0x1ec, 0x1ec}, {0x1e6, 0x1e6}, {0x1ea, 0x1ea}, {0x1e4, 0x1e4}}, + {{0x1ed, 0x1ed}, {0x1e3, 0x1e3}, {0x1ec, 0x1ec}, {0x1e6, 0x1e6}}, + {{0x1ee, 0x1ee}, {0x1f3, 0x1f3}, {0x1f1, 0x1f1}, {0x1f2, 0x1f2}}, + {{0x1e8, 0x1e8}, {0x1e3, 0x1e3}, {0x1f0, 0x1f0}, {0x1ef, 0x1ef}}, + {{0x1dd, 0x1dd}, {0x1c7, 0x1c7}, {0x1f0, 0x1f0}, {0x1e8, 0x1e8}}, + {{0x1f0, 0x1f0}, {0x1ef, 0x1ef}, {0x1f2, 0x1f2}, {0x1f1, 0x1f1}}, + {{0x1df, 0x1df}, {0x1dd, 0x1dd}, {0x1f2, 0x1f2}, {0x1f0, 0x1f0}}, + {{0x1f3, 0x1f3}, {0x1c5, 0x1c5}, {0x1f2, 0x1f2}, {0x1df, 0x1df}}, + {{0x1e2, 0x1e2}, {0x1f4, 0x1f4}, {0x1ed, 0x1ed}, {0x1f5, 0x1f5}}, + {{0x1f5, 0x1f5}, {0x1ef, 0x1ef}, {0x1ed, 0x1ed}, {0x1e3, 0x1e3}}, + {{0x1f4, 0x1f4}, {0x1f6, 0x1f6}, {0x1f5, 0x1f5}, {0x1f7, 0x1f7}}, + {{0x1f7, 0x1f7}, {0x1f1, 0x1f1}, {0x1f5, 0x1f5}, {0x1ef, 0x1ef}}, + {{0x1f8, 0x1f8}, {0x1ee, 0x1ee}, {0x1f7, 0x1f7}, {0x1f1, 0x1f1}}, + {{0x1f9, 0x1f9}, {0x21a, 0x21a}, {0x218, 0x218}, {0x219, 0x219}}, + {{0x206, 0x206}, {0x1fb, 0x1fb}, {0x207, 0x207}, {0x208, 0x208}}, + {{0x202, 0x202}, {0x201, 0x201}, {0x203, 0x203}, {0x1fc, 0x1fc}}, + {{0x1dc, 0x1dc}, {0x1d5, 0x1d5}, {0x1ff, 0x1ff}, {0x1fe, 0x1fe}}, + {{0x1fd, 0x1fd}, {0x1c3, 0x1c3}, {0x1ff, 0x1ff}, {0x1dc, 0x1dc}}, + {{0x1ff, 0x1ff}, {0x1fe, 0x1fe}, {0x202, 0x202}, {0x201, 0x201}}, + {{0x200, 0x200}, {0x1fd, 0x1fd}, {0x202, 0x202}, {0x1ff, 0x1ff}}, + {{0x1fa, 0x1fa}, {0x200, 0x200}, {0x203, 0x203}, {0x202, 0x202}}, + {{0x1e1, 0x1e1}, {0x1c5, 0x1c5}, {0x205, 0x205}, {0x204, 0x204}}, + {{0x1d5, 0x1d5}, {0x1e1, 0x1e1}, {0x1fe, 0x1fe}, {0x205, 0x205}}, + {{0x204, 0x204}, {0x206, 0x206}, {0x205, 0x205}, {0x207, 0x207}}, + {{0x207, 0x207}, {0x201, 0x201}, {0x205, 0x205}, {0x1fe, 0x1fe}}, + {{0x208, 0x208}, {0x1fc, 0x1fc}, {0x207, 0x207}, {0x201, 0x201}}, + {{0x210, 0x210}, {0x20a, 0x20a}, {0x211, 0x211}, {0x212, 0x212}}, + {{0x20e, 0x20e}, {0x20d, 0x20d}, {0x20f, 0x20f}, {0x20b, 0x20b}}, + {{0x203, 0x203}, {0x1fc, 0x1fc}, {0x20e, 0x20e}, {0x20d, 0x20d}}, + {{0x20c, 0x20c}, {0x1fa, 0x1fa}, {0x20e, 0x20e}, {0x203, 0x203}}, + {{0x209, 0x209}, {0x20c, 0x20c}, {0x20f, 0x20f}, {0x20e, 0x20e}}, + {{0x208, 0x208}, {0x1fb, 0x1fb}, {0x211, 0x211}, {0x210, 0x210}}, + {{0x1fc, 0x1fc}, {0x208, 0x208}, {0x20d, 0x20d}, {0x211, 0x211}}, + {{0x212, 0x212}, {0x20b, 0x20b}, {0x211, 0x211}, {0x20d, 0x20d}}, + {{0x213, 0x213}, {0x217, 0x217}, {0x215, 0x215}, {0x216, 0x216}}, + {{0x20f, 0x20f}, {0x20b, 0x20b}, {0x216, 0x216}, {0x215, 0x215}}, + {{0x214, 0x38c}, {0x209, 0x209}, {0x216, 0x216}, {0x20f, 0x20f}}, + {{0x217, 0x217}, {0x1c1, 0x38d}, {0x216, 0x216}, {0x214, 0x38c}}, + {{0x212, 0x212}, {0x20a, 0x20a}, {0x219, 0x219}, {0x218, 0x218}}, + {{0x215, 0x215}, {0x20b, 0x20b}, {0x219, 0x219}, {0x212, 0x212}}, + {{0x21a, 0x21a}, {0x213, 0x213}, {0x219, 0x219}, {0x215, 0x215}}, + {{0x224, 0x224}, {0x21b, 0x21b}, {0x225, 0x225}, {0x226, 0x226}}, + {{0x220, 0x220}, {0x21f, 0x21f}, {0x221, 0x221}, {0x21c, 0x21c}}, + {{0x1f3, 0x1f3}, {0x1ee, 0x1ee}, {0x21e, 0x21e}, {0x21d, 0x21d}}, + {{0x204, 0x204}, {0x1c5, 0x1c5}, {0x21e, 0x21e}, {0x1f3, 0x1f3}}, + {{0x21e, 0x21e}, {0x21d, 0x21d}, {0x220, 0x220}, {0x21f, 0x21f}}, + {{0x206, 0x206}, {0x204, 0x204}, {0x220, 0x220}, {0x21e, 0x21e}}, + {{0x1fb, 0x1fb}, {0x206, 0x206}, {0x221, 0x221}, {0x220, 0x220}}, + {{0x1f8, 0x1f8}, {0x1c4, 0x1c4}, {0x223, 0x223}, {0x222, 0x222}}, + {{0x1ee, 0x1ee}, {0x1f8, 0x1f8}, {0x21d, 0x21d}, {0x223, 0x223}}, + {{0x222, 0x222}, {0x224, 0x224}, {0x223, 0x223}, {0x225, 0x225}}, + {{0x225, 0x225}, {0x21f, 0x21f}, {0x223, 0x223}, {0x21d, 0x21d}}, + {{0x226, 0x226}, {0x21c, 0x21c}, {0x225, 0x225}, {0x21f, 0x21f}}, + {{0x22c, 0x22c}, {0x227, 0x227}, {0x22d, 0x22d}, {0x22e, 0x22e}}, + {{0x22a, 0x22a}, {0x229, 0x229}, {0x22b, 0x22b}, {0x228, 0x228}}, + {{0x221, 0x221}, {0x21c, 0x21c}, {0x22a, 0x22a}, {0x229, 0x229}}, + {{0x210, 0x210}, {0x1fb, 0x1fb}, {0x22a, 0x22a}, {0x221, 0x221}}, + {{0x20a, 0x20a}, {0x210, 0x210}, {0x22b, 0x22b}, {0x22a, 0x22a}}, + {{0x226, 0x226}, {0x21b, 0x21b}, {0x22d, 0x22d}, {0x22c, 0x22c}}, + {{0x21c, 0x21c}, {0x226, 0x226}, {0x229, 0x229}, {0x22d, 0x22d}}, + {{0x22e, 0x22e}, {0x228, 0x228}, {0x22d, 0x22d}, {0x229, 0x229}}, + {{0x22f, 0x22f}, {0x232, 0x232}, {0x230, 0x230}, {0x231, 0x231}}, + {{0x22b, 0x22b}, {0x228, 0x228}, {0x231, 0x231}, {0x230, 0x230}}, + {{0x218, 0x218}, {0x20a, 0x20a}, {0x231, 0x231}, {0x22b, 0x22b}}, + {{0x232, 0x232}, {0x1f9, 0x1f9}, {0x231, 0x231}, {0x218, 0x218}}, + {{0x22e, 0x22e}, {0x227, 0x227}, {0x234, 0x234}, {0x233, 0x233}}, + {{0x230, 0x230}, {0x228, 0x228}, {0x234, 0x234}, {0x22e, 0x22e}}, + {{0x235, 0x235}, {0x22f, 0x22f}, {0x234, 0x234}, {0x230, 0x230}}, + {{0x1d9, 0x38e}, {0x1c3, 0x38f}, {0x25e, 0x25e}, {0x25f, 0x25f}}, + {{0x236, 0x236}, {0x24d, 0x24d}, {0x24b, 0x24b}, {0x24c, 0x24c}}, + {{0x240, 0x240}, {0x237, 0x237}, {0x241, 0x241}, {0x242, 0x242}}, + {{0x23c, 0x23c}, {0x23b, 0x23b}, {0x23d, 0x23d}, {0x238, 0x238}}, + {{0x1a8, 0x1a8}, {0x1a5, 0x1a5}, {0x23a, 0x23a}, {0x239, 0x239}}, + {{0x1e9, 0x1e9}, {0xe2, 0xe2}, {0x23a, 0x23a}, {0x1a8, 0x1a8}}, + {{0x23a, 0x23a}, {0x239, 0x239}, {0x23c, 0x23c}, {0x23b, 0x23b}}, + {{0x1eb, 0x1eb}, {0x1e9, 0x1e9}, {0x23c, 0x23c}, {0x23a, 0x23a}}, + {{0x1e2, 0x1e2}, {0x1eb, 0x1eb}, {0x23d, 0x23d}, {0x23c, 0x23c}}, + {{0x1ab, 0x1ab}, {0x190, 0x190}, {0x23f, 0x23f}, {0x23e, 0x23e}}, + {{0x1a5, 0x1a5}, {0x1ab, 0x1ab}, {0x239, 0x239}, {0x23f, 0x23f}}, + {{0x23e, 0x23e}, {0x240, 0x240}, {0x23f, 0x23f}, {0x241, 0x241}}, + {{0x241, 0x241}, {0x23b, 0x23b}, {0x23f, 0x23f}, {0x239, 0x239}}, + {{0x242, 0x242}, {0x238, 0x238}, {0x241, 0x241}, {0x23b, 0x23b}}, + {{0x243, 0x243}, {0x248, 0x248}, {0x246, 0x246}, {0x247, 0x247}}, + {{0x23d, 0x23d}, {0x238, 0x238}, {0x245, 0x245}, {0x244, 0x244}}, + {{0x1f4, 0x1f4}, {0x1e2, 0x1e2}, {0x245, 0x245}, {0x23d, 0x23d}}, + {{0x245, 0x245}, {0x244, 0x244}, {0x247, 0x247}, {0x246, 0x246}}, + {{0x1f6, 0x1f6}, {0x1f4, 0x1f4}, {0x247, 0x247}, {0x245, 0x245}}, + {{0x248, 0x248}, {0x1c4, 0x1c4}, {0x247, 0x247}, {0x1f6, 0x1f6}}, + {{0x242, 0x242}, {0x237, 0x237}, {0x24a, 0x24a}, {0x249, 0x249}}, + {{0x244, 0x244}, {0x238, 0x238}, {0x24a, 0x24a}, {0x242, 0x242}}, + {{0x24a, 0x24a}, {0x249, 0x249}, {0x24c, 0x24c}, {0x24b, 0x24b}}, + {{0x246, 0x246}, {0x244, 0x244}, {0x24c, 0x24c}, {0x24a, 0x24a}}, + {{0x24d, 0x24d}, {0x243, 0x243}, {0x24c, 0x24c}, {0x246, 0x246}}, + {{0x1cc, 0x390}, {0x1c6, 0x391}, {0x255, 0x255}, {0x256, 0x256}}, + {{0x24e, 0x24e}, {0x253, 0x253}, {0x251, 0x251}, {0x252, 0x252}}, + {{0x1be, 0x1be}, {0x1bb, 0x1bb}, {0x250, 0x250}, {0x24f, 0x24f}}, + {{0x23e, 0x23e}, {0x190, 0x190}, {0x250, 0x250}, {0x1be, 0x1be}}, + {{0x250, 0x250}, {0x24f, 0x24f}, {0x252, 0x252}, {0x251, 0x251}}, + {{0x240, 0x240}, {0x23e, 0x23e}, {0x252, 0x252}, {0x250, 0x250}}, + {{0x253, 0x253}, {0x237, 0x237}, {0x252, 0x252}, {0x240, 0x240}}, + {{2, 2}, {0x1c9, 0x392}, {0x1c0, 0x1c0}, {0x254, 0x254}}, + {{0x254, 0x254}, {0x24f, 0x24f}, {0x1c0, 0x1c0}, {0x1bb, 0x1bb}}, + {{0x1c9, 0x392}, {0x1cc, 0x390}, {0x254, 0x254}, {0x255, 0x255}}, + {{0x255, 0x255}, {0x251, 0x251}, {0x254, 0x254}, {0x24f, 0x24f}}, + {{0x256, 0x256}, {0x24e, 0x24e}, {0x255, 0x255}, {0x251, 0x251}}, + {{0x257, 0x257}, {0x25c, 0x25c}, {0x25a, 0x25a}, {0x25b, 0x25b}}, + {{0x253, 0x253}, {0x24e, 0x24e}, {0x259, 0x259}, {0x258, 0x258}}, + {{0x249, 0x249}, {0x237, 0x237}, {0x259, 0x259}, {0x253, 0x253}}, + {{0x259, 0x259}, {0x258, 0x258}, {0x25b, 0x25b}, {0x25a, 0x25a}}, + {{0x24b, 0x24b}, {0x249, 0x249}, {0x25b, 0x25b}, {0x259, 0x259}}, + {{0x25c, 0x25c}, {0x236, 0x236}, {0x25b, 0x25b}, {0x24b, 0x24b}}, + {{0x1c6, 0x391}, {0x1d6, 0x393}, {0x256, 0x256}, {0x25d, 0x25d}}, + {{0x25d, 0x25d}, {0x258, 0x258}, {0x256, 0x256}, {0x24e, 0x24e}}, + {{0x1d6, 0x393}, {0x1d9, 0x38e}, {0x25d, 0x25d}, {0x25e, 0x25e}}, + {{0x25e, 0x25e}, {0x25a, 0x25a}, {0x25d, 0x25d}, {0x258, 0x258}}, + {{0x25f, 0x25f}, {0x257, 0x257}, {0x25e, 0x25e}, {0x25a, 0x25a}}, + {{0x260, 0x260}, {0x27b, 0x27b}, {0x279, 0x279}, {0x27a, 0x27a}}, + {{0x26a, 0x26a}, {0x261, 0x261}, {0x26b, 0x26b}, {0x26c, 0x26c}}, + {{0x266, 0x266}, {0x265, 0x265}, {0x267, 0x267}, {0x262, 0x262}}, + {{0x248, 0x248}, {0x243, 0x243}, {0x264, 0x264}, {0x263, 0x263}}, + {{0x222, 0x222}, {0x1c4, 0x1c4}, {0x264, 0x264}, {0x248, 0x248}}, + {{0x264, 0x264}, {0x263, 0x263}, {0x266, 0x266}, {0x265, 0x265}}, + {{0x224, 0x224}, {0x222, 0x222}, {0x266, 0x266}, {0x264, 0x264}}, + {{0x21b, 0x21b}, {0x224, 0x224}, {0x267, 0x267}, {0x266, 0x266}}, + {{0x24d, 0x24d}, {0x236, 0x236}, {0x269, 0x269}, {0x268, 0x268}}, + {{0x243, 0x243}, {0x24d, 0x24d}, {0x263, 0x263}, {0x269, 0x269}}, + {{0x268, 0x268}, {0x26a, 0x26a}, {0x269, 0x269}, {0x26b, 0x26b}}, + {{0x26b, 0x26b}, {0x265, 0x265}, {0x269, 0x269}, {0x263, 0x263}}, + {{0x26c, 0x26c}, {0x262, 0x262}, {0x26b, 0x26b}, {0x265, 0x265}}, + {{0x272, 0x272}, {0x26d, 0x26d}, {0x273, 0x273}, {0x274, 0x274}}, + {{0x270, 0x270}, {0x26f, 0x26f}, {0x271, 0x271}, {0x26e, 0x26e}}, + {{0x267, 0x267}, {0x262, 0x262}, {0x270, 0x270}, {0x26f, 0x26f}}, + {{0x22c, 0x22c}, {0x21b, 0x21b}, {0x270, 0x270}, {0x267, 0x267}}, + {{0x227, 0x227}, {0x22c, 0x22c}, {0x271, 0x271}, {0x270, 0x270}}, + {{0x26c, 0x26c}, {0x261, 0x261}, {0x273, 0x273}, {0x272, 0x272}}, + {{0x262, 0x262}, {0x26c, 0x26c}, {0x26f, 0x26f}, {0x273, 0x273}}, + {{0x274, 0x274}, {0x26e, 0x26e}, {0x273, 0x273}, {0x26f, 0x26f}}, + {{0x275, 0x275}, {0x278, 0x278}, {0x276, 0x276}, {0x277, 0x277}}, + {{0x271, 0x271}, {0x26e, 0x26e}, {0x277, 0x277}, {0x276, 0x276}}, + {{0x233, 0x233}, {0x227, 0x227}, {0x277, 0x277}, {0x271, 0x271}}, + {{0x278, 0x278}, {0x1c2, 0x1c2}, {0x277, 0x277}, {0x233, 0x233}}, + {{0x274, 0x274}, {0x26d, 0x26d}, {0x27a, 0x27a}, {0x279, 0x279}}, + {{0x276, 0x276}, {0x26e, 0x26e}, {0x27a, 0x27a}, {0x274, 0x274}}, + {{0x27b, 0x27b}, {0x275, 0x275}, {0x27a, 0x27a}, {0x276, 0x276}}, + {{0x200, 0x394}, {0x1fa, 0x395}, {0x283, 0x283}, {0x284, 0x284}}, + {{0x27c, 0x27c}, {0x281, 0x281}, {0x27f, 0x27f}, {0x280, 0x280}}, + {{0x25c, 0x25c}, {0x257, 0x257}, {0x27e, 0x27e}, {0x27d, 0x27d}}, + {{0x268, 0x268}, {0x236, 0x236}, {0x27e, 0x27e}, {0x25c, 0x25c}}, + {{0x27e, 0x27e}, {0x27d, 0x27d}, {0x280, 0x280}, {0x27f, 0x27f}}, + {{0x26a, 0x26a}, {0x268, 0x268}, {0x280, 0x280}, {0x27e, 0x27e}}, + {{0x281, 0x281}, {0x261, 0x261}, {0x280, 0x280}, {0x26a, 0x26a}}, + {{0x1c3, 0x38f}, {0x1fd, 0x396}, {0x25f, 0x25f}, {0x282, 0x282}}, + {{0x282, 0x282}, {0x27d, 0x27d}, {0x25f, 0x25f}, {0x257, 0x257}}, + {{0x1fd, 0x396}, {0x200, 0x394}, {0x282, 0x282}, {0x283, 0x283}}, + {{0x283, 0x283}, {0x27f, 0x27f}, {0x282, 0x282}, {0x27d, 0x27d}}, + {{0x284, 0x284}, {0x27c, 0x27c}, {0x283, 0x283}, {0x27f, 0x27f}}, + {{0x20c, 0x397}, {0x209, 0x398}, {0x289, 0x289}, {0x28a, 0x28a}}, + {{0x285, 0x285}, {0x288, 0x288}, {0x286, 0x286}, {0x287, 0x287}}, + {{0x281, 0x281}, {0x27c, 0x27c}, {0x287, 0x287}, {0x286, 0x286}}, + {{0x272, 0x272}, {0x261, 0x261}, {0x287, 0x287}, {0x281, 0x281}}, + {{0x288, 0x288}, {0x26d, 0x26d}, {0x287, 0x287}, {0x272, 0x272}}, + {{0x1fa, 0x395}, {0x20c, 0x397}, {0x284, 0x284}, {0x289, 0x289}}, + {{0x289, 0x289}, {0x286, 0x286}, {0x284, 0x284}, {0x27c, 0x27c}}, + {{0x28a, 0x28a}, {0x285, 0x285}, {0x289, 0x289}, {0x286, 0x286}}, + {{0x28b, 0x28b}, {0x28e, 0x28e}, {0x28c, 0x28c}, {0x28d, 0x28d}}, + {{0x288, 0x288}, {0x285, 0x285}, {0x28d, 0x28d}, {0x28c, 0x28c}}, + {{0x279, 0x279}, {0x26d, 0x26d}, {0x28d, 0x28d}, {0x288, 0x288}}, + {{0x28e, 0x28e}, {0x260, 0x260}, {0x28d, 0x28d}, {0x279, 0x279}}, + {{0x209, 0x398}, {0x214, 0x214}, {0x28a, 0x28a}, {0x28f, 0x28f}}, + {{0x28f, 0x28f}, {0x28c, 0x28c}, {0x28a, 0x28a}, {0x285, 0x285}}, + {{0x290, 0x290}, {0x28b, 0x28b}, {0x28f, 0x28f}, {0x28c, 0x28c}}, + {{0x291, 0x291}, {0x30d, 0x30d}, {0x30b, 0x30b}, {0x30c, 0x30c}}, + {{0x2ce, 0x2ce}, {0x293, 0x293}, {0x2cf, 0x2cf}, {0x2d0, 0x2d0}}, + {{0x2b3, 0x2b3}, {0x294, 0x294}, {0x2b4, 0x2b4}, {0x2b5, 0x2b5}}, + {{0x2a1, 0x2a1}, {0x296, 0x296}, {0x2a2, 0x2a2}, {0x2a3, 0x2a3}}, + {{0x29d, 0x29d}, {0x29c, 0x29c}, {0x29e, 0x29e}, {0x297, 0x297}}, + {{0x217, 0x217}, {0x213, 0x213}, {0x29a, 0x29a}, {0x299, 0x299}}, + {{0x298, 0x298}, {0x1c1, 0x38d}, {0x29a, 0x29a}, {0x217, 0x217}}, + {{0x29a, 0x29a}, {0x299, 0x299}, {0x29d, 0x29d}, {0x29c, 0x29c}}, + {{0x29b, 0x29b}, {0x298, 0x298}, {0x29d, 0x29d}, {0x29a, 0x29a}}, + {{0x295, 0x295}, {0x29b, 0x29b}, {0x29e, 0x29e}, {0x29d, 0x29d}}, + {{0x21a, 0x21a}, {0x1f9, 0x1f9}, {0x2a0, 0x2a0}, {0x29f, 0x29f}}, + {{0x213, 0x213}, {0x21a, 0x21a}, {0x299, 0x299}, {0x2a0, 0x2a0}}, + {{0x29f, 0x29f}, {0x2a1, 0x2a1}, {0x2a0, 0x2a0}, {0x2a2, 0x2a2}}, + {{0x2a2, 0x2a2}, {0x29c, 0x29c}, {0x2a0, 0x2a0}, {0x299, 0x299}}, + {{0x2a3, 0x2a3}, {0x297, 0x297}, {0x2a2, 0x2a2}, {0x29c, 0x29c}}, + {{0x2ab, 0x2ab}, {0x2a5, 0x2a5}, {0x2ac, 0x2ac}, {0x2ad, 0x2ad}}, + {{0x2a9, 0x2a9}, {0x2a8, 0x2a8}, {0x2aa, 0x2aa}, {0x2a6, 0x2a6}}, + {{0x29e, 0x29e}, {0x297, 0x297}, {0x2a9, 0x2a9}, {0x2a8, 0x2a8}}, + {{0x2a7, 0x2a7}, {0x295, 0x295}, {0x2a9, 0x2a9}, {0x29e, 0x29e}}, + {{0x2a4, 0x2a4}, {0x2a7, 0x2a7}, {0x2aa, 0x2aa}, {0x2a9, 0x2a9}}, + {{0x2a3, 0x2a3}, {0x296, 0x296}, {0x2ac, 0x2ac}, {0x2ab, 0x2ab}}, + {{0x297, 0x297}, {0x2a3, 0x2a3}, {0x2a8, 0x2a8}, {0x2ac, 0x2ac}}, + {{0x2ad, 0x2ad}, {0x2a6, 0x2a6}, {0x2ac, 0x2ac}, {0x2a8, 0x2a8}}, + {{0x2b1, 0x2b1}, {0x2b0, 0x2b0}, {0x2b2, 0x2b2}, {0x2ae, 0x2ae}}, + {{0x2aa, 0x2aa}, {0x2a6, 0x2a6}, {0x2b1, 0x2b1}, {0x2b0, 0x2b0}}, + {{0x2af, 0x2af}, {0x2a4, 0x2a4}, {0x2b1, 0x2b1}, {0x2aa, 0x2aa}}, + {{0x292, 0x292}, {0x2af, 0x2af}, {0x2b2, 0x2b2}, {0x2b1, 0x2b1}}, + {{0x2ad, 0x2ad}, {0x2a5, 0x2a5}, {0x2b4, 0x2b4}, {0x2b3, 0x2b3}}, + {{0x2a6, 0x2a6}, {0x2ad, 0x2ad}, {0x2b0, 0x2b0}, {0x2b4, 0x2b4}}, + {{0x2b5, 0x2b5}, {0x2ae, 0x2ae}, {0x2b4, 0x2b4}, {0x2b0, 0x2b0}}, + {{0x2bf, 0x2bf}, {0x2b6, 0x2b6}, {0x2c0, 0x2c0}, {0x2c1, 0x2c1}}, + {{0x2ba, 0x2ba}, {0x2b7, 0x2b7}, {0x2bb, 0x2bb}, {0x2bc, 0x2bc}}, + {{0x232, 0x232}, {0x22f, 0x22f}, {0x2b9, 0x2b9}, {0x2b8, 0x2b8}}, + {{0x1f9, 0x1f9}, {0x232, 0x232}, {0x29f, 0x29f}, {0x2b9, 0x2b9}}, + {{0x2b8, 0x2b8}, {0x2ba, 0x2ba}, {0x2b9, 0x2b9}, {0x2bb, 0x2bb}}, + {{0x2bb, 0x2bb}, {0x2a1, 0x2a1}, {0x2b9, 0x2b9}, {0x29f, 0x29f}}, + {{0x2bc, 0x2bc}, {0x296, 0x296}, {0x2bb, 0x2bb}, {0x2a1, 0x2a1}}, + {{0x235, 0x235}, {0x1c2, 0x1c2}, {0x2be, 0x2be}, {0x2bd, 0x2bd}}, + {{0x22f, 0x22f}, {0x235, 0x235}, {0x2b8, 0x2b8}, {0x2be, 0x2be}}, + {{0x2bd, 0x2bd}, {0x2bf, 0x2bf}, {0x2be, 0x2be}, {0x2c0, 0x2c0}}, + {{0x2c0, 0x2c0}, {0x2ba, 0x2ba}, {0x2be, 0x2be}, {0x2b8, 0x2b8}}, + {{0x2c1, 0x2c1}, {0x2b7, 0x2b7}, {0x2c0, 0x2c0}, {0x2ba, 0x2ba}}, + {{0x2c7, 0x2c7}, {0x2c2, 0x2c2}, {0x2c8, 0x2c8}, {0x2c9, 0x2c9}}, + {{0x2c3, 0x2c3}, {0x2c6, 0x2c6}, {0x2c4, 0x2c4}, {0x2c5, 0x2c5}}, + {{0x2bc, 0x2bc}, {0x2b7, 0x2b7}, {0x2c5, 0x2c5}, {0x2c4, 0x2c4}}, + {{0x2ab, 0x2ab}, {0x296, 0x296}, {0x2c5, 0x2c5}, {0x2bc, 0x2bc}}, + {{0x2c6, 0x2c6}, {0x2a5, 0x2a5}, {0x2c5, 0x2c5}, {0x2ab, 0x2ab}}, + {{0x2b6, 0x2b6}, {0x2c7, 0x2c7}, {0x2c1, 0x2c1}, {0x2c8, 0x2c8}}, + {{0x2c8, 0x2c8}, {0x2c4, 0x2c4}, {0x2c1, 0x2c1}, {0x2b7, 0x2b7}}, + {{0x2c9, 0x2c9}, {0x2c3, 0x2c3}, {0x2c8, 0x2c8}, {0x2c4, 0x2c4}}, + {{0x2ca, 0x2ca}, {0x2cd, 0x2cd}, {0x2cb, 0x2cb}, {0x2cc, 0x2cc}}, + {{0x2c6, 0x2c6}, {0x2c3, 0x2c3}, {0x2cc, 0x2cc}, {0x2cb, 0x2cb}}, + {{0x2b3, 0x2b3}, {0x2a5, 0x2a5}, {0x2cc, 0x2cc}, {0x2c6, 0x2c6}}, + {{0x2cd, 0x2cd}, {0x294, 0x294}, {0x2cc, 0x2cc}, {0x2b3, 0x2b3}}, + {{0x2c2, 0x2c2}, {0x2ce, 0x2ce}, {0x2c9, 0x2c9}, {0x2cf, 0x2cf}}, + {{0x2cf, 0x2cf}, {0x2cb, 0x2cb}, {0x2c9, 0x2c9}, {0x2c3, 0x2c3}}, + {{0x2d0, 0x2d0}, {0x2ca, 0x2ca}, {0x2cf, 0x2cf}, {0x2cb, 0x2cb}}, + {{0x2d1, 0x2d1}, {0x2f2, 0x2f2}, {0x2f0, 0x2f0}, {0x2f1, 0x2f1}}, + {{0x2de, 0x2de}, {0x2d3, 0x2d3}, {0x2df, 0x2df}, {0x2e0, 0x2e0}}, + {{0x2da, 0x2da}, {0x2d9, 0x2d9}, {0x2db, 0x2db}, {0x2d4, 0x2d4}}, + {{0x2b2, 0x2b2}, {0x2ae, 0x2ae}, {0x2d7, 0x2d7}, {0x2d6, 0x2d6}}, + {{0x2d5, 0x2d5}, {0x292, 0x292}, {0x2d7, 0x2d7}, {0x2b2, 0x2b2}}, + {{0x2d7, 0x2d7}, {0x2d6, 0x2d6}, {0x2da, 0x2da}, {0x2d9, 0x2d9}}, + {{0x2d8, 0x2d8}, {0x2d5, 0x2d5}, {0x2da, 0x2da}, {0x2d7, 0x2d7}}, + {{0x2d2, 0x2d2}, {0x2d8, 0x2d8}, {0x2db, 0x2db}, {0x2da, 0x2da}}, + {{0x2b5, 0x2b5}, {0x294, 0x294}, {0x2dd, 0x2dd}, {0x2dc, 0x2dc}}, + {{0x2ae, 0x2ae}, {0x2b5, 0x2b5}, {0x2d6, 0x2d6}, {0x2dd, 0x2dd}}, + {{0x2dc, 0x2dc}, {0x2de, 0x2de}, {0x2dd, 0x2dd}, {0x2df, 0x2df}}, + {{0x2df, 0x2df}, {0x2d9, 0x2d9}, {0x2dd, 0x2dd}, {0x2d6, 0x2d6}}, + {{0x2e0, 0x2e0}, {0x2d4, 0x2d4}, {0x2df, 0x2df}, {0x2d9, 0x2d9}}, + {{0x2e8, 0x2e8}, {0x2e2, 0x2e2}, {0x2e9, 0x2e9}, {0x2ea, 0x2ea}}, + {{0x2e6, 0x2e6}, {0x2e5, 0x2e5}, {0x2e7, 0x2e7}, {0x2e3, 0x2e3}}, + {{0x2db, 0x2db}, {0x2d4, 0x2d4}, {0x2e6, 0x2e6}, {0x2e5, 0x2e5}}, + {{0x2e4, 0x2e4}, {0x2d2, 0x2d2}, {0x2e6, 0x2e6}, {0x2db, 0x2db}}, + {{0x2e1, 0x2e1}, {0x2e4, 0x2e4}, {0x2e7, 0x2e7}, {0x2e6, 0x2e6}}, + {{0x2e0, 0x2e0}, {0x2d3, 0x2d3}, {0x2e9, 0x2e9}, {0x2e8, 0x2e8}}, + {{0x2d4, 0x2d4}, {0x2e0, 0x2e0}, {0x2e5, 0x2e5}, {0x2e9, 0x2e9}}, + {{0x2ea, 0x2ea}, {0x2e3, 0x2e3}, {0x2e9, 0x2e9}, {0x2e5, 0x2e5}}, + {{0x2eb, 0x2eb}, {0x2ef, 0x2ef}, {0x2ed, 0x2ed}, {0x2ee, 0x2ee}}, + {{0x2e7, 0x2e7}, {0x2e3, 0x2e3}, {0x2ee, 0x2ee}, {0x2ed, 0x2ed}}, + {{0x2ec, 0x399}, {0x2e1, 0x2e1}, {0x2ee, 0x2ee}, {0x2e7, 0x2e7}}, + {{0x2ef, 0x2ef}, {1, 0x39a}, {0x2ee, 0x2ee}, {0x2ec, 0x399}}, + {{0x2ea, 0x2ea}, {0x2e2, 0x2e2}, {0x2f1, 0x2f1}, {0x2f0, 0x2f0}}, + {{0x2ed, 0x2ed}, {0x2e3, 0x2e3}, {0x2f1, 0x2f1}, {0x2ea, 0x2ea}}, + {{0x2f2, 0x2f2}, {0x2eb, 0x2eb}, {0x2f1, 0x2f1}, {0x2ed, 0x2ed}}, + {{0x2fc, 0x2fc}, {0x2f3, 0x2f3}, {0x2fd, 0x2fd}, {0x2fe, 0x2fe}}, + {{0x2f8, 0x2f8}, {0x2f7, 0x2f7}, {0x2f9, 0x2f9}, {0x2f4, 0x2f4}}, + {{0x2cd, 0x2cd}, {0x2ca, 0x2ca}, {0x2f6, 0x2f6}, {0x2f5, 0x2f5}}, + {{0x2dc, 0x2dc}, {0x294, 0x294}, {0x2f6, 0x2f6}, {0x2cd, 0x2cd}}, + {{0x2f6, 0x2f6}, {0x2f5, 0x2f5}, {0x2f8, 0x2f8}, {0x2f7, 0x2f7}}, + {{0x2de, 0x2de}, {0x2dc, 0x2dc}, {0x2f8, 0x2f8}, {0x2f6, 0x2f6}}, + {{0x2d3, 0x2d3}, {0x2de, 0x2de}, {0x2f9, 0x2f9}, {0x2f8, 0x2f8}}, + {{0x2d0, 0x2d0}, {0x293, 0x293}, {0x2fb, 0x2fb}, {0x2fa, 0x2fa}}, + {{0x2ca, 0x2ca}, {0x2d0, 0x2d0}, {0x2f5, 0x2f5}, {0x2fb, 0x2fb}}, + {{0x2fa, 0x2fa}, {0x2fc, 0x2fc}, {0x2fb, 0x2fb}, {0x2fd, 0x2fd}}, + {{0x2fd, 0x2fd}, {0x2f7, 0x2f7}, {0x2fb, 0x2fb}, {0x2f5, 0x2f5}}, + {{0x2fe, 0x2fe}, {0x2f4, 0x2f4}, {0x2fd, 0x2fd}, {0x2f7, 0x2f7}}, + {{0x304, 0x304}, {0x2ff, 0x2ff}, {0x305, 0x305}, {0x306, 0x306}}, + {{0x302, 0x302}, {0x301, 0x301}, {0x303, 0x303}, {0x300, 0x300}}, + {{0x2f9, 0x2f9}, {0x2f4, 0x2f4}, {0x302, 0x302}, {0x301, 0x301}}, + {{0x2e8, 0x2e8}, {0x2d3, 0x2d3}, {0x302, 0x302}, {0x2f9, 0x2f9}}, + {{0x2e2, 0x2e2}, {0x2e8, 0x2e8}, {0x303, 0x303}, {0x302, 0x302}}, + {{0x2fe, 0x2fe}, {0x2f3, 0x2f3}, {0x305, 0x305}, {0x304, 0x304}}, + {{0x2f4, 0x2f4}, {0x2fe, 0x2fe}, {0x301, 0x301}, {0x305, 0x305}}, + {{0x306, 0x306}, {0x300, 0x300}, {0x305, 0x305}, {0x301, 0x301}}, + {{0x307, 0x307}, {0x30a, 0x30a}, {0x308, 0x308}, {0x309, 0x309}}, + {{0x303, 0x303}, {0x300, 0x300}, {0x309, 0x309}, {0x308, 0x308}}, + {{0x2f0, 0x2f0}, {0x2e2, 0x2e2}, {0x309, 0x309}, {0x303, 0x303}}, + {{0x30a, 0x30a}, {0x2d1, 0x2d1}, {0x309, 0x309}, {0x2f0, 0x2f0}}, + {{0x306, 0x306}, {0x2ff, 0x2ff}, {0x30c, 0x30c}, {0x30b, 0x30b}}, + {{0x308, 0x308}, {0x300, 0x300}, {0x30c, 0x30c}, {0x306, 0x306}}, + {{0x30d, 0x30d}, {0x307, 0x307}, {0x30c, 0x30c}, {0x308, 0x308}}, + {{0x2af, 0x39b}, {0x292, 0x39c}, {0x33d, 0x33d}, {0x33e, 0x33e}}, + {{0x30e, 0x30e}, {0x329, 0x329}, {0x327, 0x327}, {0x328, 0x328}}, + {{0x318, 0x318}, {0x30f, 0x30f}, {0x319, 0x319}, {0x31a, 0x31a}}, + {{0x314, 0x314}, {0x313, 0x313}, {0x315, 0x315}, {0x310, 0x310}}, + {{0x278, 0x278}, {0x275, 0x275}, {0x312, 0x312}, {0x311, 0x311}}, + {{0x2bd, 0x2bd}, {0x1c2, 0x1c2}, {0x312, 0x312}, {0x278, 0x278}}, + {{0x312, 0x312}, {0x311, 0x311}, {0x314, 0x314}, {0x313, 0x313}}, + {{0x2bf, 0x2bf}, {0x2bd, 0x2bd}, {0x314, 0x314}, {0x312, 0x312}}, + {{0x2b6, 0x2b6}, {0x2bf, 0x2bf}, {0x315, 0x315}, {0x314, 0x314}}, + {{0x27b, 0x27b}, {0x260, 0x260}, {0x317, 0x317}, {0x316, 0x316}}, + {{0x275, 0x275}, {0x27b, 0x27b}, {0x311, 0x311}, {0x317, 0x317}}, + {{0x316, 0x316}, {0x318, 0x318}, {0x317, 0x317}, {0x319, 0x319}}, + {{0x319, 0x319}, {0x313, 0x313}, {0x317, 0x317}, {0x311, 0x311}}, + {{0x31a, 0x31a}, {0x310, 0x310}, {0x319, 0x319}, {0x313, 0x313}}, + {{0x320, 0x320}, {0x31b, 0x31b}, {0x321, 0x321}, {0x322, 0x322}}, + {{0x31e, 0x31e}, {0x31d, 0x31d}, {0x31f, 0x31f}, {0x31c, 0x31c}}, + {{0x315, 0x315}, {0x310, 0x310}, {0x31e, 0x31e}, {0x31d, 0x31d}}, + {{0x2c7, 0x2c7}, {0x2b6, 0x2b6}, {0x31e, 0x31e}, {0x315, 0x315}}, + {{0x2c2, 0x2c2}, {0x2c7, 0x2c7}, {0x31f, 0x31f}, {0x31e, 0x31e}}, + {{0x31a, 0x31a}, {0x30f, 0x30f}, {0x321, 0x321}, {0x320, 0x320}}, + {{0x310, 0x310}, {0x31a, 0x31a}, {0x31d, 0x31d}, {0x321, 0x321}}, + {{0x322, 0x322}, {0x31c, 0x31c}, {0x321, 0x321}, {0x31d, 0x31d}}, + {{0x323, 0x323}, {0x326, 0x326}, {0x324, 0x324}, {0x325, 0x325}}, + {{0x31f, 0x31f}, {0x31c, 0x31c}, {0x325, 0x325}, {0x324, 0x324}}, + {{0x2ce, 0x2ce}, {0x2c2, 0x2c2}, {0x325, 0x325}, {0x31f, 0x31f}}, + {{0x326, 0x326}, {0x293, 0x293}, {0x325, 0x325}, {0x2ce, 0x2ce}}, + {{0x322, 0x322}, {0x31b, 0x31b}, {0x328, 0x328}, {0x327, 0x327}}, + {{0x324, 0x324}, {0x31c, 0x31c}, {0x328, 0x328}, {0x322, 0x322}}, + {{0x329, 0x329}, {0x323, 0x323}, {0x328, 0x328}, {0x324, 0x324}}, + {{0x29b, 0x39d}, {0x295, 0x39e}, {0x331, 0x331}, {0x332, 0x332}}, + {{0x32a, 0x32a}, {0x32f, 0x32f}, {0x32d, 0x32d}, {0x32e, 0x32e}}, + {{0x28e, 0x28e}, {0x28b, 0x28b}, {0x32c, 0x32c}, {0x32b, 0x32b}}, + {{0x316, 0x316}, {0x260, 0x260}, {0x32c, 0x32c}, {0x28e, 0x28e}}, + {{0x32c, 0x32c}, {0x32b, 0x32b}, {0x32e, 0x32e}, {0x32d, 0x32d}}, + {{0x318, 0x318}, {0x316, 0x316}, {0x32e, 0x32e}, {0x32c, 0x32c}}, + {{0x32f, 0x32f}, {0x30f, 0x30f}, {0x32e, 0x32e}, {0x318, 0x318}}, + {{0x1c1, 0x1c1}, {0x298, 0x39f}, {0x290, 0x290}, {0x330, 0x330}}, + {{0x330, 0x330}, {0x32b, 0x32b}, {0x290, 0x290}, {0x28b, 0x28b}}, + {{0x298, 0x39f}, {0x29b, 0x39d}, {0x330, 0x330}, {0x331, 0x331}}, + {{0x331, 0x331}, {0x32d, 0x32d}, {0x330, 0x330}, {0x32b, 0x32b}}, + {{0x332, 0x332}, {0x32a, 0x32a}, {0x331, 0x331}, {0x32d, 0x32d}}, + {{0x2a7, 0x3a0}, {0x2a4, 0x3a1}, {0x337, 0x337}, {0x338, 0x338}}, + {{0x333, 0x333}, {0x336, 0x336}, {0x334, 0x334}, {0x335, 0x335}}, + {{0x32f, 0x32f}, {0x32a, 0x32a}, {0x335, 0x335}, {0x334, 0x334}}, + {{0x320, 0x320}, {0x30f, 0x30f}, {0x335, 0x335}, {0x32f, 0x32f}}, + {{0x336, 0x336}, {0x31b, 0x31b}, {0x335, 0x335}, {0x320, 0x320}}, + {{0x295, 0x39e}, {0x2a7, 0x3a0}, {0x332, 0x332}, {0x337, 0x337}}, + {{0x337, 0x337}, {0x334, 0x334}, {0x332, 0x332}, {0x32a, 0x32a}}, + {{0x338, 0x338}, {0x333, 0x333}, {0x337, 0x337}, {0x334, 0x334}}, + {{0x339, 0x339}, {0x33c, 0x33c}, {0x33a, 0x33a}, {0x33b, 0x33b}}, + {{0x336, 0x336}, {0x333, 0x333}, {0x33b, 0x33b}, {0x33a, 0x33a}}, + {{0x327, 0x327}, {0x31b, 0x31b}, {0x33b, 0x33b}, {0x336, 0x336}}, + {{0x33c, 0x33c}, {0x30e, 0x30e}, {0x33b, 0x33b}, {0x327, 0x327}}, + {{0x2a4, 0x3a1}, {0x2af, 0x39b}, {0x338, 0x338}, {0x33d, 0x33d}}, + {{0x33d, 0x33d}, {0x33a, 0x33a}, {0x338, 0x338}, {0x333, 0x333}}, + {{0x33e, 0x33e}, {0x339, 0x339}, {0x33d, 0x33d}, {0x33a, 0x33a}}, + {{0x33f, 0x33f}, {0x35a, 0x35a}, {0x358, 0x358}, {0x359, 0x359}}, + {{0x349, 0x349}, {0x340, 0x340}, {0x34a, 0x34a}, {0x34b, 0x34b}}, + {{0x345, 0x345}, {0x344, 0x344}, {0x346, 0x346}, {0x341, 0x341}}, + {{0x326, 0x326}, {0x323, 0x323}, {0x343, 0x343}, {0x342, 0x342}}, + {{0x2fa, 0x2fa}, {0x293, 0x293}, {0x343, 0x343}, {0x326, 0x326}}, + {{0x343, 0x343}, {0x342, 0x342}, {0x345, 0x345}, {0x344, 0x344}}, + {{0x2fc, 0x2fc}, {0x2fa, 0x2fa}, {0x345, 0x345}, {0x343, 0x343}}, + {{0x2f3, 0x2f3}, {0x2fc, 0x2fc}, {0x346, 0x346}, {0x345, 0x345}}, + {{0x329, 0x329}, {0x30e, 0x30e}, {0x348, 0x348}, {0x347, 0x347}}, + {{0x323, 0x323}, {0x329, 0x329}, {0x342, 0x342}, {0x348, 0x348}}, + {{0x347, 0x347}, {0x349, 0x349}, {0x348, 0x348}, {0x34a, 0x34a}}, + {{0x34a, 0x34a}, {0x344, 0x344}, {0x348, 0x348}, {0x342, 0x342}}, + {{0x34b, 0x34b}, {0x341, 0x341}, {0x34a, 0x34a}, {0x344, 0x344}}, + {{0x351, 0x351}, {0x34c, 0x34c}, {0x352, 0x352}, {0x353, 0x353}}, + {{0x34f, 0x34f}, {0x34e, 0x34e}, {0x350, 0x350}, {0x34d, 0x34d}}, + {{0x346, 0x346}, {0x341, 0x341}, {0x34f, 0x34f}, {0x34e, 0x34e}}, + {{0x304, 0x304}, {0x2f3, 0x2f3}, {0x34f, 0x34f}, {0x346, 0x346}}, + {{0x2ff, 0x2ff}, {0x304, 0x304}, {0x350, 0x350}, {0x34f, 0x34f}}, + {{0x34b, 0x34b}, {0x340, 0x340}, {0x352, 0x352}, {0x351, 0x351}}, + {{0x341, 0x341}, {0x34b, 0x34b}, {0x34e, 0x34e}, {0x352, 0x352}}, + {{0x353, 0x353}, {0x34d, 0x34d}, {0x352, 0x352}, {0x34e, 0x34e}}, + {{0x354, 0x354}, {0x357, 0x357}, {0x355, 0x355}, {0x356, 0x356}}, + {{0x350, 0x350}, {0x34d, 0x34d}, {0x356, 0x356}, {0x355, 0x355}}, + {{0x30b, 0x30b}, {0x2ff, 0x2ff}, {0x356, 0x356}, {0x350, 0x350}}, + {{0x357, 0x357}, {0x291, 0x291}, {0x356, 0x356}, {0x30b, 0x30b}}, + {{0x353, 0x353}, {0x34c, 0x34c}, {0x359, 0x359}, {0x358, 0x358}}, + {{0x355, 0x355}, {0x34d, 0x34d}, {0x359, 0x359}, {0x353, 0x353}}, + {{0x35a, 0x35a}, {0x354, 0x354}, {0x359, 0x359}, {0x355, 0x355}}, + {{0x2d8, 0x3a2}, {0x2d2, 0x3a3}, {0x362, 0x362}, {0x363, 0x363}}, + {{0x35b, 0x35b}, {0x360, 0x360}, {0x35e, 0x35e}, {0x35f, 0x35f}}, + {{0x33c, 0x33c}, {0x339, 0x339}, {0x35d, 0x35d}, {0x35c, 0x35c}}, + {{0x347, 0x347}, {0x30e, 0x30e}, {0x35d, 0x35d}, {0x33c, 0x33c}}, + {{0x35d, 0x35d}, {0x35c, 0x35c}, {0x35f, 0x35f}, {0x35e, 0x35e}}, + {{0x349, 0x349}, {0x347, 0x347}, {0x35f, 0x35f}, {0x35d, 0x35d}}, + {{0x360, 0x360}, {0x340, 0x340}, {0x35f, 0x35f}, {0x349, 0x349}}, + {{0x292, 0x39c}, {0x2d5, 0x3a4}, {0x33e, 0x33e}, {0x361, 0x361}}, + {{0x361, 0x361}, {0x35c, 0x35c}, {0x33e, 0x33e}, {0x339, 0x339}}, + {{0x2d5, 0x3a4}, {0x2d8, 0x3a2}, {0x361, 0x361}, {0x362, 0x362}}, + {{0x362, 0x362}, {0x35e, 0x35e}, {0x361, 0x361}, {0x35c, 0x35c}}, + {{0x363, 0x363}, {0x35b, 0x35b}, {0x362, 0x362}, {0x35e, 0x35e}}, + {{0x2e4, 0x3a5}, {0x2e1, 0x3a6}, {0x368, 0x368}, {0x369, 0x369}}, + {{0x364, 0x364}, {0x367, 0x367}, {0x365, 0x365}, {0x366, 0x366}}, + {{0x360, 0x360}, {0x35b, 0x35b}, {0x366, 0x366}, {0x365, 0x365}}, + {{0x351, 0x351}, {0x340, 0x340}, {0x366, 0x366}, {0x360, 0x360}}, + {{0x367, 0x367}, {0x34c, 0x34c}, {0x366, 0x366}, {0x351, 0x351}}, + {{0x2d2, 0x3a3}, {0x2e4, 0x3a5}, {0x363, 0x363}, {0x368, 0x368}}, + {{0x368, 0x368}, {0x365, 0x365}, {0x363, 0x363}, {0x35b, 0x35b}}, + {{0x369, 0x369}, {0x364, 0x364}, {0x368, 0x368}, {0x365, 0x365}}, + {{0x36a, 0x36a}, {0x36d, 0x36d}, {0x36b, 0x36b}, {0x36c, 0x36c}}, + {{0x367, 0x367}, {0x364, 0x364}, {0x36c, 0x36c}, {0x36b, 0x36b}}, + {{0x358, 0x358}, {0x34c, 0x34c}, {0x36c, 0x36c}, {0x367, 0x367}}, + {{0x36d, 0x36d}, {0x33f, 0x33f}, {0x36c, 0x36c}, {0x358, 0x358}}, + {{0x2e1, 0x3a6}, {0x2ec, 0x2ec}, {0x369, 0x369}, {0x36e, 0x36e}}, + {{0x36e, 0x36e}, {0x36b, 0x36b}, {0x369, 0x369}, {0x364, 0x364}}, + {{0x36f, 0x36f}, {0x36a, 0x36a}, {0x36e, 0x36e}, {0x36b, 0x36b}}, +}; +float D_L06_001E2CF0[935][2] = { + {0.0f, 0.0f}, + {1.0f, 1.0f}, + {1.0f, 0.5f}, + {1.0f, 0.240741f}, + {0.5f, 0.0f}, + {0.5f, 0.240741f}, + {0.5f, 0.111111f}, + {0.0f, 0.111111f}, + {0.25f, 0.0f}, + {0.25f, 0.111111f}, + {0.25f, 0.055556f}, + {0.0f, 0.055556f}, + {0.125f, 0.0f}, + {0.125f, 0.055556f}, + {0.125f, 0.018519f}, + {0.0f, 0.018519f}, + {0.0625f, 0.0f}, + {0.0625f, 0.018519f}, + {0.125f, 0.037037f}, + {0.0f, 0.037037f}, + {0.0625f, 0.037037f}, + {0.0625f, 0.055556f}, + {0.25f, 0.018519f}, + {0.1875f, 0.0f}, + {0.1875f, 0.018519f}, + {0.25f, 0.037037f}, + {0.1875f, 0.037037f}, + {0.1875f, 0.055556f}, + {0.125f, 0.111111f}, + {0.0f, 0.074074f}, + {0.125f, 0.074074f}, + {0.0625f, 0.074074f}, + {0.0f, 0.092593f}, + {0.125f, 0.092593f}, + {0.0625f, 0.092593f}, + {0.0625f, 0.111111f}, + {0.25f, 0.074074f}, + {0.1875f, 0.074074f}, + {0.25f, 0.092593f}, + {0.1875f, 0.092593f}, + {0.1875f, 0.111111f}, + {0.5f, 0.055556f}, + {0.375f, 0.0f}, + {0.375f, 0.055556f}, + {0.375f, 0.018519f}, + {0.3125f, 0.0f}, + {0.3125f, 0.018519f}, + {0.375f, 0.037037f}, + {0.3125f, 0.037037f}, + {0.3125f, 0.055556f}, + {0.5f, 0.018519f}, + {0.4375f, 0.0f}, + {0.4375f, 0.018519f}, + {0.5f, 0.037037f}, + {0.4375f, 0.037037f}, + {0.4375f, 0.055556f}, + {0.375f, 0.111111f}, + {0.375f, 0.074074f}, + {0.3125f, 0.074074f}, + {0.375f, 0.092593f}, + {0.3125f, 0.092593f}, + {0.3125f, 0.111111f}, + {0.5f, 0.074074f}, + {0.4375f, 0.074074f}, + {0.5f, 0.092593f}, + {0.4375f, 0.092593f}, + {0.4375f, 0.111111f}, + {0.25f, 0.240741f}, + {0.0f, 0.166667f}, + {0.25f, 0.166667f}, + {0.125f, 0.166667f}, + {0.0f, 0.12963f}, + {0.125f, 0.12963f}, + {0.0625f, 0.12963f}, + {0.0f, 0.148148f}, + {0.125f, 0.148148f}, + {0.0625f, 0.148148f}, + {0.0625f, 0.166667f}, + {0.25f, 0.12963f}, + {0.1875f, 0.12963f}, + {0.25f, 0.148148f}, + {0.1875f, 0.148148f}, + {0.1875f, 0.166667f}, + {0.0f, 0.203704f}, + {0.25f, 0.203704f}, + {0.125f, 0.203704f}, + {0.0f, 0.185185f}, + {0.125f, 0.185185f}, + {0.0625f, 0.185185f}, + {0.0625f, 0.203704f}, + {0.25f, 0.185185f}, + {0.1875f, 0.185185f}, + {0.1875f, 0.203704f}, + {0.125f, 0.240741f}, + {1.0f, 0.222222f}, + {0.125f, 0.222222f}, + {0.0625f, 0.222222f}, + {0.0625f, 0.240741f}, + {0.25f, 0.222222f}, + {0.1875f, 0.222222f}, + {0.1875f, 0.240741f}, + {0.5f, 0.166667f}, + {0.375f, 0.166667f}, + {0.375f, 0.12963f}, + {0.3125f, 0.12963f}, + {0.375f, 0.148148f}, + {0.3125f, 0.148148f}, + {0.3125f, 0.166667f}, + {0.5f, 0.12963f}, + {0.4375f, 0.12963f}, + {0.5f, 0.148148f}, + {0.4375f, 0.148148f}, + {0.4375f, 0.166667f}, + {0.5f, 0.203704f}, + {0.375f, 0.203704f}, + {0.375f, 0.185185f}, + {0.3125f, 0.185185f}, + {0.3125f, 0.203704f}, + {0.5f, 0.185185f}, + {0.4375f, 0.185185f}, + {0.4375f, 0.203704f}, + {0.375f, 0.240741f}, + {0.375f, 0.222222f}, + {0.3125f, 0.222222f}, + {0.3125f, 0.240741f}, + {0.5f, 0.222222f}, + {0.4375f, 0.222222f}, + {0.4375f, 0.240741f}, + {0.75f, 0.0f}, + {0.75f, 0.111111f}, + {0.75f, 0.055556f}, + {0.625f, 0.0f}, + {0.625f, 0.055556f}, + {0.625f, 0.018519f}, + {0.5625f, 0.0f}, + {0.5625f, 0.018519f}, + {0.625f, 0.037037f}, + {0.5625f, 0.037037f}, + {0.5625f, 0.055556f}, + {0.75f, 0.018519f}, + {0.6875f, 0.0f}, + {0.6875f, 0.018519f}, + {0.75f, 0.037037f}, + {0.6875f, 0.037037f}, + {0.6875f, 0.055556f}, + {0.625f, 0.111111f}, + {0.625f, 0.074074f}, + {0.5625f, 0.074074f}, + {0.625f, 0.092593f}, + {0.5625f, 0.092593f}, + {0.5625f, 0.111111f}, + {0.75f, 0.074074f}, + {0.6875f, 0.074074f}, + {0.75f, 0.092593f}, + {0.6875f, 0.092593f}, + {0.6875f, 0.111111f}, + {0.875f, 0.0f}, + {0.875f, 0.055556f}, + {0.875f, 0.018519f}, + {0.8125f, 0.0f}, + {0.8125f, 0.018519f}, + {0.875f, 0.037037f}, + {0.8125f, 0.037037f}, + {0.8125f, 0.055556f}, + {0.9375f, 0.0f}, + {0.9375f, 0.018519f}, + {0.9375f, 0.037037f}, + {0.9375f, 0.055556f}, + {0.875f, 0.111111f}, + {0.875f, 0.074074f}, + {0.8125f, 0.074074f}, + {0.875f, 0.092593f}, + {0.8125f, 0.092593f}, + {0.8125f, 0.111111f}, + {0.9375f, 0.074074f}, + {0.9375f, 0.092593f}, + {0.9375f, 0.111111f}, + {0.75f, 0.240741f}, + {0.75f, 0.166667f}, + {0.625f, 0.166667f}, + {0.625f, 0.12963f}, + {0.5625f, 0.12963f}, + {0.625f, 0.148148f}, + {0.5625f, 0.148148f}, + {0.5625f, 0.166667f}, + {0.75f, 0.12963f}, + {0.6875f, 0.12963f}, + {0.75f, 0.148148f}, + {0.6875f, 0.148148f}, + {0.6875f, 0.166667f}, + {0.75f, 0.203704f}, + {0.625f, 0.203704f}, + {0.625f, 0.185185f}, + {0.5625f, 0.185185f}, + {0.5625f, 0.203704f}, + {0.75f, 0.185185f}, + {0.6875f, 0.185185f}, + {0.6875f, 0.203704f}, + {0.625f, 0.240741f}, + {0.625f, 0.222222f}, + {0.5625f, 0.222222f}, + {0.5625f, 0.240741f}, + {0.75f, 0.222222f}, + {0.6875f, 0.222222f}, + {0.6875f, 0.240741f}, + {0.875f, 0.166667f}, + {0.875f, 0.12963f}, + {0.8125f, 0.12963f}, + {0.875f, 0.148148f}, + {0.8125f, 0.148148f}, + {0.8125f, 0.166667f}, + {0.9375f, 0.12963f}, + {0.9375f, 0.148148f}, + {0.9375f, 0.166667f}, + {0.875f, 0.203704f}, + {0.875f, 0.185185f}, + {0.8125f, 0.185185f}, + {0.8125f, 0.203704f}, + {0.9375f, 0.185185f}, + {0.9375f, 0.203704f}, + {0.875f, 0.240741f}, + {0.875f, 0.222222f}, + {0.8125f, 0.222222f}, + {0.8125f, 0.240741f}, + {0.9375f, 0.222222f}, + {0.9375f, 0.240741f}, + {0.5f, 0.5f}, + {0.0f, 0.37037f}, + {0.5f, 0.37037f}, + {0.25f, 0.37037f}, + {0.0f, 0.296296f}, + {0.25f, 0.296296f}, + {0.125f, 0.296296f}, + {0.0f, 0.259259f}, + {0.125f, 0.259259f}, + {0.0625f, 0.259259f}, + {0.0f, 0.277778f}, + {0.125f, 0.277778f}, + {0.0625f, 0.277778f}, + {0.0625f, 0.296296f}, + {0.25f, 0.259259f}, + {0.1875f, 0.259259f}, + {0.25f, 0.277778f}, + {0.1875f, 0.277778f}, + {0.1875f, 0.296296f}, + {0.0f, 0.333333f}, + {0.25f, 0.333333f}, + {0.125f, 0.333333f}, + {0.0f, 0.314815f}, + {0.125f, 0.314815f}, + {0.0625f, 0.314815f}, + {0.0625f, 0.333333f}, + {0.25f, 0.314815f}, + {0.1875f, 0.314815f}, + {0.1875f, 0.333333f}, + {0.125f, 0.37037f}, + {0.0f, 0.351852f}, + {0.125f, 0.351852f}, + {0.0625f, 0.351852f}, + {0.0625f, 0.37037f}, + {0.25f, 0.351852f}, + {0.1875f, 0.351852f}, + {0.1875f, 0.37037f}, + {0.5f, 0.296296f}, + {0.375f, 0.296296f}, + {0.375f, 0.259259f}, + {0.3125f, 0.259259f}, + {0.375f, 0.277778f}, + {0.3125f, 0.277778f}, + {0.3125f, 0.296296f}, + {0.5f, 0.259259f}, + {0.4375f, 0.259259f}, + {0.5f, 0.277778f}, + {0.4375f, 0.277778f}, + {0.4375f, 0.296296f}, + {0.5f, 0.333333f}, + {0.375f, 0.333333f}, + {0.375f, 0.314815f}, + {0.3125f, 0.314815f}, + {0.3125f, 0.333333f}, + {0.5f, 0.314815f}, + {0.4375f, 0.314815f}, + {0.4375f, 0.333333f}, + {0.375f, 0.37037f}, + {0.375f, 0.351852f}, + {0.3125f, 0.351852f}, + {0.3125f, 0.37037f}, + {0.5f, 0.351852f}, + {0.4375f, 0.351852f}, + {0.4375f, 0.37037f}, + {0.25f, 0.5f}, + {0.0f, 0.425926f}, + {0.25f, 0.425926f}, + {0.125f, 0.425926f}, + {0.0f, 0.388889f}, + {0.125f, 0.388889f}, + {0.0625f, 0.388889f}, + {0.0f, 0.407407f}, + {0.125f, 0.407407f}, + {0.0625f, 0.407407f}, + {0.0625f, 0.425926f}, + {0.25f, 0.388889f}, + {0.1875f, 0.388889f}, + {0.25f, 0.407407f}, + {0.1875f, 0.407407f}, + {0.1875f, 0.425926f}, + {0.0f, 0.462963f}, + {0.25f, 0.462963f}, + {0.125f, 0.462963f}, + {0.0f, 0.444444f}, + {0.125f, 0.444444f}, + {0.0625f, 0.444444f}, + {0.0625f, 0.462963f}, + {0.25f, 0.444444f}, + {0.1875f, 0.444444f}, + {0.1875f, 0.462963f}, + {0.125f, 0.5f}, + {1.0f, 0.481481f}, + {0.125f, 0.481481f}, + {0.0625f, 0.481481f}, + {0.0625f, 0.5f}, + {0.25f, 0.481481f}, + {0.1875f, 0.481481f}, + {0.1875f, 0.5f}, + {0.5f, 0.425926f}, + {0.375f, 0.425926f}, + {0.375f, 0.388889f}, + {0.3125f, 0.388889f}, + {0.375f, 0.407407f}, + {0.3125f, 0.407407f}, + {0.3125f, 0.425926f}, + {0.5f, 0.388889f}, + {0.4375f, 0.388889f}, + {0.5f, 0.407407f}, + {0.4375f, 0.407407f}, + {0.4375f, 0.425926f}, + {0.5f, 0.462963f}, + {0.375f, 0.462963f}, + {0.375f, 0.444444f}, + {0.3125f, 0.444444f}, + {0.3125f, 0.462963f}, + {0.5f, 0.444444f}, + {0.4375f, 0.444444f}, + {0.4375f, 0.462963f}, + {0.375f, 0.5f}, + {0.375f, 0.481481f}, + {0.3125f, 0.481481f}, + {0.3125f, 0.5f}, + {0.5f, 0.481481f}, + {0.4375f, 0.481481f}, + {0.4375f, 0.5f}, + {0.75f, 0.37037f}, + {0.75f, 0.296296f}, + {0.625f, 0.296296f}, + {0.625f, 0.259259f}, + {0.5625f, 0.259259f}, + {0.625f, 0.277778f}, + {0.5625f, 0.277778f}, + {0.5625f, 0.296296f}, + {0.75f, 0.259259f}, + {0.6875f, 0.259259f}, + {0.75f, 0.277778f}, + {0.6875f, 0.277778f}, + {0.6875f, 0.296296f}, + {0.75f, 0.333333f}, + {0.625f, 0.333333f}, + {0.625f, 0.314815f}, + {0.5625f, 0.314815f}, + {0.5625f, 0.333333f}, + {0.75f, 0.314815f}, + {0.6875f, 0.314815f}, + {0.6875f, 0.333333f}, + {0.625f, 0.37037f}, + {0.625f, 0.351852f}, + {0.5625f, 0.351852f}, + {0.5625f, 0.37037f}, + {0.75f, 0.351852f}, + {0.6875f, 0.351852f}, + {0.6875f, 0.37037f}, + {0.875f, 0.296296f}, + {0.875f, 0.259259f}, + {0.8125f, 0.259259f}, + {0.875f, 0.277778f}, + {0.8125f, 0.277778f}, + {0.8125f, 0.296296f}, + {0.9375f, 0.259259f}, + {0.9375f, 0.277778f}, + {0.9375f, 0.296296f}, + {0.875f, 0.333333f}, + {0.875f, 0.314815f}, + {0.8125f, 0.314815f}, + {0.8125f, 0.333333f}, + {0.9375f, 0.314815f}, + {0.9375f, 0.333333f}, + {0.875f, 0.37037f}, + {0.875f, 0.351852f}, + {0.8125f, 0.351852f}, + {0.8125f, 0.37037f}, + {0.9375f, 0.351852f}, + {0.9375f, 0.37037f}, + {0.75f, 0.5f}, + {0.75f, 0.425926f}, + {0.625f, 0.425926f}, + {0.625f, 0.388889f}, + {0.5625f, 0.388889f}, + {0.625f, 0.407407f}, + {0.5625f, 0.407407f}, + {0.5625f, 0.425926f}, + {0.75f, 0.388889f}, + {0.6875f, 0.388889f}, + {0.75f, 0.407407f}, + {0.6875f, 0.407407f}, + {0.6875f, 0.425926f}, + {0.75f, 0.462963f}, + {0.625f, 0.462963f}, + {0.625f, 0.444444f}, + {0.5625f, 0.444444f}, + {0.5625f, 0.462963f}, + {0.75f, 0.444444f}, + {0.6875f, 0.444444f}, + {0.6875f, 0.462963f}, + {0.625f, 0.5f}, + {0.625f, 0.481481f}, + {0.5625f, 0.481481f}, + {0.5625f, 0.5f}, + {0.75f, 0.481481f}, + {0.6875f, 0.481481f}, + {0.6875f, 0.5f}, + {0.875f, 0.425926f}, + {0.875f, 0.388889f}, + {0.8125f, 0.388889f}, + {0.875f, 0.407407f}, + {0.8125f, 0.407407f}, + {0.8125f, 0.425926f}, + {0.9375f, 0.388889f}, + {0.9375f, 0.407407f}, + {0.9375f, 0.425926f}, + {0.875f, 0.462963f}, + {0.875f, 0.444444f}, + {0.8125f, 0.444444f}, + {0.8125f, 0.462963f}, + {0.9375f, 0.444444f}, + {0.9375f, 0.462963f}, + {0.875f, 0.5f}, + {0.875f, 0.481481f}, + {0.8125f, 0.481481f}, + {0.8125f, 0.5f}, + {0.9375f, 0.481481f}, + {0.9375f, 0.5f}, + {1.0f, 0.740741f}, + {0.5f, 0.740741f}, + {0.0f, 0.611111f}, + {0.5f, 0.611111f}, + {0.25f, 0.611111f}, + {0.0f, 0.555556f}, + {0.25f, 0.555556f}, + {0.125f, 0.555556f}, + {0.0f, 0.518519f}, + {0.125f, 0.518519f}, + {0.0625f, 0.518519f}, + {0.0f, 0.537037f}, + {0.125f, 0.537037f}, + {0.0625f, 0.537037f}, + {0.0625f, 0.555556f}, + {0.25f, 0.518519f}, + {0.1875f, 0.518519f}, + {0.25f, 0.537037f}, + {0.1875f, 0.537037f}, + {0.1875f, 0.555556f}, + {0.125f, 0.611111f}, + {0.0f, 0.574074f}, + {0.125f, 0.574074f}, + {0.0625f, 0.574074f}, + {0.0f, 0.592593f}, + {0.125f, 0.592593f}, + {0.0625f, 0.592593f}, + {0.0625f, 0.611111f}, + {0.25f, 0.574074f}, + {0.1875f, 0.574074f}, + {0.25f, 0.592593f}, + {0.1875f, 0.592593f}, + {0.1875f, 0.611111f}, + {0.5f, 0.555556f}, + {0.375f, 0.555556f}, + {0.375f, 0.518519f}, + {0.3125f, 0.518519f}, + {0.375f, 0.537037f}, + {0.3125f, 0.537037f}, + {0.3125f, 0.555556f}, + {0.5f, 0.518519f}, + {0.4375f, 0.518519f}, + {0.5f, 0.537037f}, + {0.4375f, 0.537037f}, + {0.4375f, 0.555556f}, + {0.375f, 0.611111f}, + {0.375f, 0.574074f}, + {0.3125f, 0.574074f}, + {0.375f, 0.592593f}, + {0.3125f, 0.592593f}, + {0.3125f, 0.611111f}, + {0.5f, 0.574074f}, + {0.4375f, 0.574074f}, + {0.5f, 0.592593f}, + {0.4375f, 0.592593f}, + {0.4375f, 0.611111f}, + {0.25f, 0.740741f}, + {0.0f, 0.666667f}, + {0.25f, 0.666667f}, + {0.125f, 0.666667f}, + {0.0f, 0.62963f}, + {0.125f, 0.62963f}, + {0.0625f, 0.62963f}, + {0.0f, 0.648148f}, + {0.125f, 0.648148f}, + {0.0625f, 0.648148f}, + {0.0625f, 0.666667f}, + {0.25f, 0.62963f}, + {0.1875f, 0.62963f}, + {0.25f, 0.648148f}, + {0.1875f, 0.648148f}, + {0.1875f, 0.666667f}, + {0.0f, 0.703704f}, + {0.25f, 0.703704f}, + {0.125f, 0.703704f}, + {0.0f, 0.685185f}, + {0.125f, 0.685185f}, + {0.0625f, 0.685185f}, + {0.0625f, 0.703704f}, + {0.25f, 0.685185f}, + {0.1875f, 0.685185f}, + {0.1875f, 0.703704f}, + {0.125f, 0.740741f}, + {1.0f, 0.722222f}, + {0.125f, 0.722222f}, + {0.0625f, 0.722222f}, + {0.0625f, 0.740741f}, + {0.25f, 0.722222f}, + {0.1875f, 0.722222f}, + {0.1875f, 0.740741f}, + {0.5f, 0.666667f}, + {0.375f, 0.666667f}, + {0.375f, 0.62963f}, + {0.3125f, 0.62963f}, + {0.375f, 0.648148f}, + {0.3125f, 0.648148f}, + {0.3125f, 0.666667f}, + {0.5f, 0.62963f}, + {0.4375f, 0.62963f}, + {0.5f, 0.648148f}, + {0.4375f, 0.648148f}, + {0.4375f, 0.666667f}, + {0.5f, 0.703704f}, + {0.375f, 0.703704f}, + {0.375f, 0.685185f}, + {0.3125f, 0.685185f}, + {0.3125f, 0.703704f}, + {0.5f, 0.685185f}, + {0.4375f, 0.685185f}, + {0.4375f, 0.703704f}, + {0.375f, 0.740741f}, + {0.375f, 0.722222f}, + {0.3125f, 0.722222f}, + {0.3125f, 0.740741f}, + {0.5f, 0.722222f}, + {0.4375f, 0.722222f}, + {0.4375f, 0.740741f}, + {0.75f, 0.611111f}, + {0.75f, 0.555556f}, + {0.625f, 0.555556f}, + {0.625f, 0.518519f}, + {0.5625f, 0.518519f}, + {0.625f, 0.537037f}, + {0.5625f, 0.537037f}, + {0.5625f, 0.555556f}, + {0.75f, 0.518519f}, + {0.6875f, 0.518519f}, + {0.75f, 0.537037f}, + {0.6875f, 0.537037f}, + {0.6875f, 0.555556f}, + {0.625f, 0.611111f}, + {0.625f, 0.574074f}, + {0.5625f, 0.574074f}, + {0.625f, 0.592593f}, + {0.5625f, 0.592593f}, + {0.5625f, 0.611111f}, + {0.75f, 0.574074f}, + {0.6875f, 0.574074f}, + {0.75f, 0.592593f}, + {0.6875f, 0.592593f}, + {0.6875f, 0.611111f}, + {0.875f, 0.555556f}, + {0.875f, 0.518519f}, + {0.8125f, 0.518519f}, + {0.875f, 0.537037f}, + {0.8125f, 0.537037f}, + {0.8125f, 0.555556f}, + {0.9375f, 0.518519f}, + {0.9375f, 0.537037f}, + {0.9375f, 0.555556f}, + {0.875f, 0.611111f}, + {0.875f, 0.574074f}, + {0.8125f, 0.574074f}, + {0.875f, 0.592593f}, + {0.8125f, 0.592593f}, + {0.8125f, 0.611111f}, + {0.9375f, 0.574074f}, + {0.9375f, 0.592593f}, + {0.9375f, 0.611111f}, + {0.75f, 0.740741f}, + {0.75f, 0.666667f}, + {0.625f, 0.666667f}, + {0.625f, 0.62963f}, + {0.5625f, 0.62963f}, + {0.625f, 0.648148f}, + {0.5625f, 0.648148f}, + {0.5625f, 0.666667f}, + {0.75f, 0.62963f}, + {0.6875f, 0.62963f}, + {0.75f, 0.648148f}, + {0.6875f, 0.648148f}, + {0.6875f, 0.666667f}, + {0.75f, 0.703704f}, + {0.625f, 0.703704f}, + {0.625f, 0.685185f}, + {0.5625f, 0.685185f}, + {0.5625f, 0.703704f}, + {0.75f, 0.685185f}, + {0.6875f, 0.685185f}, + {0.6875f, 0.703704f}, + {0.625f, 0.740741f}, + {0.625f, 0.722222f}, + {0.5625f, 0.722222f}, + {0.5625f, 0.740741f}, + {0.75f, 0.722222f}, + {0.6875f, 0.722222f}, + {0.6875f, 0.740741f}, + {0.875f, 0.666667f}, + {0.875f, 0.62963f}, + {0.8125f, 0.62963f}, + {0.875f, 0.648148f}, + {0.8125f, 0.648148f}, + {0.8125f, 0.666667f}, + {0.9375f, 0.62963f}, + {0.9375f, 0.648148f}, + {0.9375f, 0.666667f}, + {0.875f, 0.703704f}, + {0.875f, 0.685185f}, + {0.8125f, 0.685185f}, + {0.8125f, 0.703704f}, + {0.9375f, 0.685185f}, + {0.9375f, 0.703704f}, + {0.875f, 0.740741f}, + {0.875f, 0.722222f}, + {0.8125f, 0.722222f}, + {0.8125f, 0.740741f}, + {0.9375f, 0.722222f}, + {0.9375f, 0.740741f}, + {0.5f, 1.0f}, + {0.0f, 0.87037f}, + {0.5f, 0.87037f}, + {0.25f, 0.87037f}, + {0.0f, 0.796296f}, + {0.25f, 0.796296f}, + {0.125f, 0.796296f}, + {0.0f, 0.759259f}, + {0.125f, 0.759259f}, + {0.0625f, 0.759259f}, + {0.0f, 0.777778f}, + {0.125f, 0.777778f}, + {0.0625f, 0.777778f}, + {0.0625f, 0.796296f}, + {0.25f, 0.759259f}, + {0.1875f, 0.759259f}, + {0.25f, 0.777778f}, + {0.1875f, 0.777778f}, + {0.1875f, 0.796296f}, + {0.0f, 0.833333f}, + {0.25f, 0.833333f}, + {0.125f, 0.833333f}, + {0.0f, 0.814815f}, + {0.125f, 0.814815f}, + {0.0625f, 0.814815f}, + {0.0625f, 0.833333f}, + {0.25f, 0.814815f}, + {0.1875f, 0.814815f}, + {0.1875f, 0.833333f}, + {0.125f, 0.87037f}, + {0.0f, 0.851852f}, + {0.125f, 0.851852f}, + {0.0625f, 0.851852f}, + {0.0625f, 0.87037f}, + {0.25f, 0.851852f}, + {0.1875f, 0.851852f}, + {0.1875f, 0.87037f}, + {0.5f, 0.796296f}, + {0.375f, 0.796296f}, + {0.375f, 0.759259f}, + {0.3125f, 0.759259f}, + {0.375f, 0.777778f}, + {0.3125f, 0.777778f}, + {0.3125f, 0.796296f}, + {0.5f, 0.759259f}, + {0.4375f, 0.759259f}, + {0.5f, 0.777778f}, + {0.4375f, 0.777778f}, + {0.4375f, 0.796296f}, + {0.5f, 0.833333f}, + {0.375f, 0.833333f}, + {0.375f, 0.814815f}, + {0.3125f, 0.814815f}, + {0.3125f, 0.833333f}, + {0.5f, 0.814815f}, + {0.4375f, 0.814815f}, + {0.4375f, 0.833333f}, + {0.375f, 0.87037f}, + {0.375f, 0.851852f}, + {0.3125f, 0.851852f}, + {0.3125f, 0.87037f}, + {0.5f, 0.851852f}, + {0.4375f, 0.851852f}, + {0.4375f, 0.87037f}, + {0.25f, 1.0f}, + {0.0f, 0.925926f}, + {0.25f, 0.925926f}, + {0.125f, 0.925926f}, + {0.0f, 0.888889f}, + {0.125f, 0.888889f}, + {0.0625f, 0.888889f}, + {0.0f, 0.907407f}, + {0.125f, 0.907407f}, + {0.0625f, 0.907407f}, + {0.0625f, 0.925926f}, + {0.25f, 0.888889f}, + {0.1875f, 0.888889f}, + {0.25f, 0.907407f}, + {0.1875f, 0.907407f}, + {0.1875f, 0.925926f}, + {0.0f, 0.962963f}, + {0.25f, 0.962963f}, + {0.125f, 0.962963f}, + {0.0f, 0.944444f}, + {0.125f, 0.944444f}, + {0.0625f, 0.944444f}, + {0.0625f, 0.962963f}, + {0.25f, 0.944444f}, + {0.1875f, 0.944444f}, + {0.1875f, 0.962963f}, + {0.125f, 1.0f}, + {1.0f, 0.981481f}, + {0.125f, 0.981481f}, + {0.0625f, 0.981481f}, + {0.0625f, 1.0f}, + {0.25f, 0.981481f}, + {0.1875f, 0.981481f}, + {0.1875f, 1.0f}, + {0.5f, 0.925926f}, + {0.375f, 0.925926f}, + {0.375f, 0.888889f}, + {0.3125f, 0.888889f}, + {0.375f, 0.907407f}, + {0.3125f, 0.907407f}, + {0.3125f, 0.925926f}, + {0.5f, 0.888889f}, + {0.4375f, 0.888889f}, + {0.5f, 0.907407f}, + {0.4375f, 0.907407f}, + {0.4375f, 0.925926f}, + {0.5f, 0.962963f}, + {0.375f, 0.962963f}, + {0.375f, 0.944444f}, + {0.3125f, 0.944444f}, + {0.3125f, 0.962963f}, + {0.5f, 0.944444f}, + {0.4375f, 0.944444f}, + {0.4375f, 0.962963f}, + {0.375f, 1.0f}, + {0.375f, 0.981481f}, + {0.3125f, 0.981481f}, + {0.3125f, 1.0f}, + {0.5f, 0.981481f}, + {0.4375f, 0.981481f}, + {0.4375f, 1.0f}, + {0.75f, 0.87037f}, + {0.75f, 0.796296f}, + {0.625f, 0.796296f}, + {0.625f, 0.759259f}, + {0.5625f, 0.759259f}, + {0.625f, 0.777778f}, + {0.5625f, 0.777778f}, + {0.5625f, 0.796296f}, + {0.75f, 0.759259f}, + {0.6875f, 0.759259f}, + {0.75f, 0.777778f}, + {0.6875f, 0.777778f}, + {0.6875f, 0.796296f}, + {0.75f, 0.833333f}, + {0.625f, 0.833333f}, + {0.625f, 0.814815f}, + {0.5625f, 0.814815f}, + {0.5625f, 0.833333f}, + {0.75f, 0.814815f}, + {0.6875f, 0.814815f}, + {0.6875f, 0.833333f}, + {0.625f, 0.87037f}, + {0.625f, 0.851852f}, + {0.5625f, 0.851852f}, + {0.5625f, 0.87037f}, + {0.75f, 0.851852f}, + {0.6875f, 0.851852f}, + {0.6875f, 0.87037f}, + {0.875f, 0.796296f}, + {0.875f, 0.759259f}, + {0.8125f, 0.759259f}, + {0.875f, 0.777778f}, + {0.8125f, 0.777778f}, + {0.8125f, 0.796296f}, + {0.9375f, 0.759259f}, + {0.9375f, 0.777778f}, + {0.9375f, 0.796296f}, + {0.875f, 0.833333f}, + {0.875f, 0.814815f}, + {0.8125f, 0.814815f}, + {0.8125f, 0.833333f}, + {0.9375f, 0.814815f}, + {0.9375f, 0.833333f}, + {0.875f, 0.87037f}, + {0.875f, 0.851852f}, + {0.8125f, 0.851852f}, + {0.8125f, 0.87037f}, + {0.9375f, 0.851852f}, + {0.9375f, 0.87037f}, + {0.75f, 1.0f}, + {0.75f, 0.925926f}, + {0.625f, 0.925926f}, + {0.625f, 0.888889f}, + {0.5625f, 0.888889f}, + {0.625f, 0.907407f}, + {0.5625f, 0.907407f}, + {0.5625f, 0.925926f}, + {0.75f, 0.888889f}, + {0.6875f, 0.888889f}, + {0.75f, 0.907407f}, + {0.6875f, 0.907407f}, + {0.6875f, 0.925926f}, + {0.75f, 0.962963f}, + {0.625f, 0.962963f}, + {0.625f, 0.944444f}, + {0.5625f, 0.944444f}, + {0.5625f, 0.962963f}, + {0.75f, 0.944444f}, + {0.6875f, 0.944444f}, + {0.6875f, 0.962963f}, + {0.625f, 1.0f}, + {0.625f, 0.981481f}, + {0.5625f, 0.981481f}, + {0.5625f, 1.0f}, + {0.75f, 0.981481f}, + {0.6875f, 0.981481f}, + {0.6875f, 1.0f}, + {0.875f, 0.925926f}, + {0.875f, 0.888889f}, + {0.8125f, 0.888889f}, + {0.875f, 0.907407f}, + {0.8125f, 0.907407f}, + {0.8125f, 0.925926f}, + {0.9375f, 0.888889f}, + {0.9375f, 0.907407f}, + {0.9375f, 0.925926f}, + {0.875f, 0.962963f}, + {0.875f, 0.944444f}, + {0.8125f, 0.944444f}, + {0.8125f, 0.962963f}, + {0.9375f, 0.944444f}, + {0.9375f, 0.962963f}, + {0.875f, 1.0f}, + {0.875f, 0.981481f}, + {0.8125f, 0.981481f}, + {0.8125f, 1.0f}, + {0.9375f, 0.981481f}, + {0.9375f, 1.0f}, + {0.0f, 0.222222f}, + {0.0f, 0.240741f}, + {1.0f, 0.092593f}, + {1.0f, 0.111111f}, + {1.0f, 0.037037f}, + {1.0f, 0.055556f}, + {1.0f, 0.0f}, + {1.0f, 0.018519f}, + {1.0f, 0.074074f}, + {1.0f, 0.148148f}, + {1.0f, 0.166667f}, + {1.0f, 0.12963f}, + {1.0f, 0.185185f}, + {1.0f, 0.203704f}, + {0.0f, 0.481481f}, + {0.0f, 0.5f}, + {1.0f, 0.351852f}, + {1.0f, 0.37037f}, + {1.0f, 0.277778f}, + {1.0f, 0.296296f}, + {1.0f, 0.259259f}, + {1.0f, 0.314815f}, + {1.0f, 0.333333f}, + {1.0f, 0.407407f}, + {1.0f, 0.425926f}, + {1.0f, 0.388889f}, + {1.0f, 0.444444f}, + {1.0f, 0.462963f}, + {0.0f, 0.722222f}, + {0.0f, 0.740741f}, + {1.0f, 0.592593f}, + {1.0f, 0.611111f}, + {1.0f, 0.537037f}, + {1.0f, 0.555556f}, + {1.0f, 0.518519f}, + {1.0f, 0.574074f}, + {1.0f, 0.648148f}, + {1.0f, 0.666667f}, + {1.0f, 0.62963f}, + {1.0f, 0.685185f}, + {1.0f, 0.703704f}, + {0.0f, 0.981481f}, + {0.0f, 1.0f}, + {1.0f, 0.851852f}, + {1.0f, 0.87037f}, + {1.0f, 0.777778f}, + {1.0f, 0.796296f}, + {1.0f, 0.759259f}, + {1.0f, 0.814815f}, + {1.0f, 0.833333f}, + {1.0f, 0.907407f}, + {1.0f, 0.925926f}, + {1.0f, 0.888889f}, + {1.0f, 0.944444f}, + {1.0f, 0.962963f}, +}; +float D_L06_001DBFF0[880][4] = { + {17586.89f, 30949.385f, 14786.696f, 1.0f}, + {22258.645f, 13440.912f, 14847.657f, 1.0f}, + {13976.784f, 20565.451f, 15725.608f, 1.0f}, + {14075.065f, 25285.793f, 14773.048f, 1.0f}, + {17586.89f, 30949.385f, 14007.857f, 1.0f}, + {14036.107f, 25291.36f, 13995.763f, 1.0f}, + {17638.299f, 27294.326f, 13643.778f, 1.0f}, + {17671.21f, 27243.873f, 14419.334f, 1.0f}, + {17976.31f, 30949.385f, 14397.276f, 1.0f}, + {17985.23f, 27091.105f, 14010.987f, 1.0f}, + {18228.082f, 28616.244f, 14190.317f, 1.0f}, + {17848.084f, 28535.076f, 14576.998f, 1.0f}, + {17862.254f, 30949.385f, 14672.638f, 1.0f}, + {18119.021f, 28569.703f, 14463.209f, 1.0f}, + {17909.87f, 29953.822f, 14637.75f, 1.0f}, + {17636.56f, 29922.516f, 14750.335f, 1.0f}, + {17735.914f, 30949.385f, 14757.054f, 1.0f}, + {17784.625f, 29937.25f, 14721.372f, 1.0f}, + {18014.775f, 29176.41f, 14556.84f, 1.0f}, + {17743.371f, 29130.271f, 14668.593f, 1.0f}, + {17890.594f, 29151.363f, 14639.931f, 1.0f}, + {17995.156f, 28549.287f, 14547.169f, 1.0f}, + {18021.986f, 29982.494f, 14363.836f, 1.0f}, + {17946.67f, 30949.385f, 14546.301f, 1.0f}, + {17993.219f, 29969.71f, 14512.201f, 1.0f}, + {18124.758f, 29223.094f, 14284.332f, 1.0f}, + {18097.002f, 29201.598f, 14431.97f, 1.0f}, + {18200.812f, 28593.217f, 14337.899f, 1.0f}, + {17900.074f, 27125.4f, 14291.212f, 1.0f}, + {17896.035f, 28062.805f, 14497.462f, 1.0f}, + {18162.852f, 28060.871f, 14379.19f, 1.0f}, + {18041.0f, 28057.514f, 14465.233f, 1.0f}, + {17841.66f, 27641.432f, 14444.833f, 1.0f}, + {18095.016f, 27583.893f, 14320.98f, 1.0f}, + {17979.625f, 27607.002f, 14409.672f, 1.0f}, + {17796.424f, 27177.68f, 14381.944f, 1.0f}, + {18269.334f, 28090.252f, 14104.253f, 1.0f}, + {18243.031f, 28072.367f, 14252.431f, 1.0f}, + {18193.893f, 27583.455f, 14043.108f, 1.0f}, + {18170.256f, 27575.625f, 14192.26f, 1.0f}, + {17966.373f, 27095.0f, 14160.949f, 1.0f}, + {17837.293f, 28645.006f, 13806.21f, 1.0f}, + {17862.254f, 30949.385f, 14121.915f, 1.0f}, + {18111.389f, 28647.436f, 13918.18f, 1.0f}, + {17907.242f, 29991.732f, 14089.047f, 1.0f}, + {17946.668f, 30949.385f, 14248.252f, 1.0f}, + {17991.795f, 29990.227f, 14215.244f, 1.0f}, + {18008.9f, 29242.977f, 14010.701f, 1.0f}, + {18093.82f, 29237.623f, 14136.402f, 1.0f}, + {18196.682f, 28635.285f, 14042.932f, 1.0f}, + {17632.844f, 29976.127f, 13974.351f, 1.0f}, + {17735.914f, 30949.385f, 14037.5f, 1.0f}, + {17781.19f, 29986.781f, 14004.456f, 1.0f}, + {17735.062f, 29224.408f, 13896.236f, 1.0f}, + {17882.916f, 29238.336f, 13926.366f, 1.0f}, + {17985.186f, 28650.85f, 13835.054f, 1.0f}, + {17876.803f, 27161.076f, 13742.812f, 1.0f}, + {18153.115f, 28133.736f, 13833.704f, 1.0f}, + {18237.76f, 28111.8f, 13957.216f, 1.0f}, + {18080.377f, 27640.375f, 13773.99f, 1.0f}, + {18162.332f, 27606.193f, 13896.231f, 1.0f}, + {17953.777f, 27114.309f, 13864.157f, 1.0f}, + {17882.268f, 28165.852f, 13726.027f, 1.0f}, + {18028.28f, 28152.715f, 13752.521f, 1.0f}, + {17820.957f, 27721.31f, 13671.273f, 1.0f}, + {17960.498f, 27680.8f, 13694.996f, 1.0f}, + {17766.018f, 27224.293f, 13665.426f, 1.0f}, + {14202.429f, 24928.678f, 14374.96f, 1.0f}, + {16598.023f, 26269.424f, 14490.198f, 1.0f}, + {16746.535f, 25930.793f, 14087.657f, 1.0f}, + {16721.01f, 26031.977f, 14365.772f, 1.0f}, + {17386.57f, 26863.53f, 14418.235f, 1.0f}, + {17580.748f, 26692.227f, 14289.166f, 1.0f}, + {17493.732f, 26769.83f, 14380.352f, 1.0f}, + {17020.316f, 26530.773f, 14441.649f, 1.0f}, + {17176.584f, 26319.334f, 14314.272f, 1.0f}, + {17107.766f, 26416.195f, 14404.644f, 1.0f}, + {16668.156f, 26141.32f, 14454.729f, 1.0f}, + {17646.42f, 26628.326f, 14008.421f, 1.0f}, + {17634.363f, 26642.537f, 14158.562f, 1.0f}, + {17220.832f, 26232.822f, 14034.495f, 1.0f}, + {17216.287f, 26254.943f, 14184.294f, 1.0f}, + {16748.531f, 25958.05f, 14236.875f, 1.0f}, + {15458.066f, 25798.47f, 14655.671f, 1.0f}, + {15559.955f, 25431.047f, 14258.687f, 1.0f}, + {15547.321f, 25541.113f, 14535.241f, 1.0f}, + {16086.541f, 26040.086f, 14563.727f, 1.0f}, + {16186.12f, 25788.406f, 14442.005f, 1.0f}, + {16144.267f, 25904.494f, 14529.689f, 1.0f}, + {15509.792f, 25659.68f, 14622.377f, 1.0f}, + {16200.101f, 25679.805f, 14165.224f, 1.0f}, + {16205.727f, 25709.508f, 14314.021f, 1.0f}, + {15564.936f, 25460.828f, 14407.53f, 1.0f}, + {14173.194f, 25032.121f, 14652.538f, 1.0f}, + {14764.882f, 25543.916f, 14734.618f, 1.0f}, + {14854.561f, 25286.521f, 14614.385f, 1.0f}, + {14815.98f, 25404.771f, 14701.508f, 1.0f}, + {14129.775f, 25148.28f, 14739.85f, 1.0f}, + {14873.464f, 25178.814f, 14337.361f, 1.0f}, + {14874.746f, 25207.176f, 14486.514f, 1.0f}, + {14198.706f, 24955.008f, 14524.406f, 1.0f}, + {16511.25f, 26259.75f, 13716.617f, 1.0f}, + {16659.652f, 26025.137f, 13818.768f, 1.0f}, + {17545.123f, 26709.258f, 13740.455f, 1.0f}, + {17615.082f, 26651.756f, 13861.602f, 1.0f}, + {17127.143f, 26321.912f, 13766.206f, 1.0f}, + {17189.53f, 26256.34f, 13887.683f, 1.0f}, + {16715.324f, 25954.35f, 13940.838f, 1.0f}, + {17336.19f, 26887.617f, 13642.24f, 1.0f}, + {17447.186f, 26792.084f, 13663.426f, 1.0f}, + {16950.396f, 26534.42f, 13666.565f, 1.0f}, + {17043.17f, 26419.562f, 13688.561f, 1.0f}, + {16587.988f, 26132.383f, 13740.032f, 1.0f}, + {15374.98f, 25786.635f, 13881.769f, 1.0f}, + {15488.57f, 25532.744f, 13988.01f, 1.0f}, + {16120.295f, 25777.89f, 13895.519f, 1.0f}, + {16170.102f, 25703.816f, 14018.266f, 1.0f}, + {15533.14f, 25456.3f, 14111.371f, 1.0f}, + {15993.45f, 26025.213f, 13790.879f, 1.0f}, + {16058.263f, 25890.752f, 13815.671f, 1.0f}, + {15433.031f, 25648.746f, 13907.385f, 1.0f}, + {14145.647f, 25036.057f, 14102.914f, 1.0f}, + {14810.519f, 25283.883f, 14065.823f, 1.0f}, + {14850.91f, 25205.75f, 14189.635f, 1.0f}, + {14183.797f, 24957.139f, 14226.952f, 1.0f}, + {14702.597f, 25540.184f, 13958.835f, 1.0f}, + {14758.437f, 25401.324f, 13984.777f, 1.0f}, + {14093.784f, 25153.422f, 14021.731f, 1.0f}, + {17197.47f, 30949.385f, 14397.276f, 1.0f}, + {17324.281f, 27447.094f, 14052.125f, 1.0f}, + {17457.293f, 28563.836f, 14192.89f, 1.0f}, + {17311.53f, 30949.385f, 14121.916f, 1.0f}, + {17566.357f, 28610.377f, 13919.999f, 1.0f}, + {17359.535f, 29944.82f, 14086.935f, 1.0f}, + {17437.87f, 30949.385f, 14037.5f, 1.0f}, + {17484.78f, 29961.393f, 14003.313f, 1.0f}, + {17463.66f, 29178.27f, 14007.989f, 1.0f}, + {17587.84f, 29203.316f, 13924.898f, 1.0f}, + {17690.22f, 28630.795f, 13836.039f, 1.0f}, + {17247.416f, 29916.15f, 14360.849f, 1.0f}, + {17227.115f, 30949.385f, 14248.253f, 1.0f}, + {17276.188f, 29928.934f, 14212.485f, 1.0f}, + {17353.674f, 29131.586f, 14280.497f, 1.0f}, + {17381.434f, 29153.082f, 14132.859f, 1.0f}, + {17484.566f, 28586.865f, 14045.309f, 1.0f}, + {17409.438f, 27412.799f, 13771.9f, 1.0f}, + {17615.453f, 28167.785f, 13844.299f, 1.0f}, + {17737.303f, 28171.143f, 13758.256f, 1.0f}, + {17567.604f, 27778.85f, 13795.127f, 1.0f}, + {17682.992f, 27755.74f, 13706.435f, 1.0f}, + {17513.086f, 27360.521f, 13681.168f, 1.0f}, + {17508.969f, 28138.404f, 14119.236f, 1.0f}, + {17535.275f, 28156.29f, 13971.059f, 1.0f}, + {17468.725f, 27779.287f, 14072.998f, 1.0f}, + {17492.365f, 27787.117f, 13923.847f, 1.0f}, + {17343.14f, 27443.2f, 13902.163f, 1.0f}, + {17311.531f, 30949.385f, 14672.638f, 1.0f}, + {17573.99f, 28532.645f, 14465.028f, 1.0f}, + {17362.166f, 29906.91f, 14635.638f, 1.0f}, + {17227.115f, 30949.385f, 14546.301f, 1.0f}, + {17277.607f, 29908.416f, 14509.44f, 1.0f}, + {17469.537f, 29111.705f, 14554.128f, 1.0f}, + {17384.611f, 29117.057f, 14428.427f, 1.0f}, + {17488.695f, 28544.797f, 14340.276f, 1.0f}, + {17437.87f, 30949.385f, 14757.054f, 1.0f}, + {17488.213f, 29911.861f, 14720.229f, 1.0f}, + {17595.516f, 29116.346f, 14638.463f, 1.0f}, + {17700.191f, 28529.232f, 14548.153f, 1.0f}, + {17432.71f, 27377.123f, 14320.301f, 1.0f}, + {17625.191f, 28094.92f, 14389.785f, 1.0f}, + {17540.543f, 28116.854f, 14266.273f, 1.0f}, + {17582.244f, 27722.365f, 14342.116f, 1.0f}, + {17500.287f, 27756.549f, 14219.875f, 1.0f}, + {17355.734f, 27423.89f, 14198.955f, 1.0f}, + {17750.023f, 28075.94f, 14470.968f, 1.0f}, + {17702.12f, 27681.941f, 14421.11f, 1.0f}, + {17543.492f, 27313.908f, 14397.6875f, 1.0f}, + {13908.744f, 25648.475f, 14393.85f, 1.0f}, + {16362.738f, 26598.383f, 14119.158f, 1.0f}, + {16388.266f, 26497.195f, 13841.043f, 1.0f}, + {17142.014f, 27058.92f, 13771.31f, 1.0f}, + {17229.027f, 26981.316f, 13680.124f, 1.0f}, + {16794.129f, 26745.857f, 13793.941f, 1.0f}, + {16862.947f, 26648.998f, 13703.57f, 1.0f}, + {16441.117f, 26387.855f, 13752.087f, 1.0f}, + {17076.34f, 27122.82f, 14052.056f, 1.0f}, + {17088.398f, 27108.607f, 13901.915f, 1.0f}, + {16749.88f, 26832.371f, 14073.719f, 1.0f}, + {16754.428f, 26810.248f, 13923.921f, 1.0f}, + {16360.743f, 26571.121f, 13969.94f, 1.0f}, + {15273.091f, 26154.059f, 14278.753f, 1.0f}, + {15285.726f, 26043.992f, 14002.199f, 1.0f}, + {15893.872f, 26276.889f, 13912.601f, 1.0f}, + {15935.725f, 26160.805f, 13824.916f, 1.0f}, + {15323.254f, 25925.426f, 13915.063f, 1.0f}, + {15879.892f, 26385.494f, 14189.381f, 1.0f}, + {15874.268f, 26355.787f, 14040.584f, 1.0f}, + {15268.112f, 26124.273f, 14129.91f, 1.0f}, + {13937.9795f, 25545.031f, 14116.271f, 1.0f}, + {14612.918f, 25797.578f, 14079.068f, 1.0f}, + {14651.497f, 25679.33f, 13991.945f, 1.0f}, + {13981.396f, 25428.873f, 14028.961f, 1.0f}, + {14594.015f, 25905.287f, 14356.092f, 1.0f}, + {14592.733f, 25876.922f, 14206.939f, 1.0f}, + {13912.468f, 25622.143f, 14244.404f, 1.0f}, + {16449.623f, 26504.035f, 14388.047f, 1.0f}, + {17177.639f, 27041.887f, 14320.0205f, 1.0f}, + {17107.678f, 27099.39f, 14198.875f, 1.0f}, + {16843.572f, 26743.28f, 14342.008f, 1.0f}, + {16781.184f, 26808.854f, 14220.532f, 1.0f}, + {16393.95f, 26574.824f, 14265.978f, 1.0f}, + {17275.574f, 26959.062f, 14397.05f, 1.0f}, + {16927.543f, 26645.63f, 14419.654f, 1.0f}, + {16521.285f, 26396.793f, 14466.783f, 1.0f}, + {15344.478f, 26052.36f, 14549.43f, 1.0f}, + {15959.698f, 26287.404f, 14459.087f, 1.0f}, + {15909.891f, 26361.48f, 14336.34f, 1.0f}, + {15299.907f, 26128.805f, 14426.069f, 1.0f}, + {16021.7295f, 26174.545f, 14538.935f, 1.0f}, + {15400.016f, 25936.36f, 14630.056f, 1.0f}, + {13965.527f, 25541.094f, 14665.8955f, 1.0f}, + {14656.96f, 25800.217f, 14627.63f, 1.0f}, + {14616.568f, 25878.352f, 14503.819f, 1.0f}, + {13927.376f, 25620.014f, 14541.858f, 1.0f}, + {14709.041f, 25682.777f, 14708.676f, 1.0f}, + {14017.389f, 25423.73f, 14747.078f, 1.0f}, + {13986.322f, 20242.752f, 15017.357f, 1.0f}, + {11761.203f, 22915.473f, 14972.887f, 1.0f}, + {11677.811f, 22763.389f, 14215.066f, 1.0f}, + {12096.586f, 22832.68f, 14548.674f, 1.0f}, + {12468.874f, 24494.402f, 14786.642f, 1.0f}, + {12712.147f, 24213.537f, 14386.068f, 1.0f}, + {12645.48f, 24295.05f, 14664.479f, 1.0f}, + {13439.778f, 25029.957f, 14783.845f, 1.0f}, + {13555.646f, 24785.695f, 14662.957f, 1.0f}, + {13503.351f, 24897.242f, 14750.479f, 1.0f}, + {12899.497f, 24775.055f, 14786.519f, 1.0f}, + {13043.198f, 24548.459f, 14665.275f, 1.0f}, + {12977.884f, 24651.848f, 14752.97f, 1.0f}, + {12565.363f, 24386.367f, 14752.569f, 1.0f}, + {13597.482f, 24688.244f, 14384.96f, 1.0f}, + {13588.701f, 24712.305f, 14534.604f, 1.0f}, + {13098.33f, 24458.697f, 14387.06f, 1.0f}, + {13085.493f, 24480.633f, 14536.784f, 1.0f}, + {12697.023f, 24234.361f, 14535.78f, 1.0f}, + {11933.249f, 23781.139f, 14816.165f, 1.0f}, + {12245.931f, 23594.596f, 14408.362f, 1.0f}, + {12167.131f, 23662.139f, 14687.645f, 1.0f}, + {12151.588f, 24162.152f, 14789.878f, 1.0f}, + {12359.963f, 23999.771f, 14665.49f, 1.0f}, + {12266.032f, 24075.215f, 14754.522f, 1.0f}, + {12062.365f, 23719.305f, 14778.404f, 1.0f}, + {12434.362f, 23925.826f, 14386.726f, 1.0f}, + {12419.071f, 23947.314f, 14536.338f, 1.0f}, + {12231.59f, 23618.348f, 14557.703f, 1.0f}, + {12015.628f, 22888.426f, 14829.872f, 1.0f}, + {11800.378f, 23361.693f, 14881.632f, 1.0f}, + {12049.618f, 23288.645f, 14746.718f, 1.0f}, + {11938.414f, 23326.646f, 14840.138f, 1.0f}, + {11902.329f, 22907.1f, 14926.708f, 1.0f}, + {12130.452f, 23226.49f, 14466.733f, 1.0f}, + {12117.053f, 23253.475f, 14615.596f, 1.0f}, + {12083.841f, 22862.293f, 14697.125f, 1.0f}, + {12446.735f, 24498.012f, 14008.857f, 1.0f}, + {12629.826f, 24297.604f, 14114.501f, 1.0f}, + {13540.783f, 24794.684f, 14112.702f, 1.0f}, + {13580.656f, 24717.172f, 14236.809f, 1.0f}, + {13032.599f, 24558.346f, 14114.847f, 1.0f}, + {13079.756f, 24485.986f, 14238.895f, 1.0f}, + {12688.551f, 24235.744f, 14238.135f, 1.0f}, + {13418.759f, 25042.67f, 14005.668f, 1.0f}, + {13483.931f, 24908.988f, 14031.537f, 1.0f}, + {12884.508f, 24789.037f, 14008.095f, 1.0f}, + {12964.035f, 24664.768f, 14033.801f, 1.0f}, + {12544.91f, 24389.703f, 14033.99f, 1.0f}, + {11871.534f, 23718.814f, 14044.394f, 1.0f}, + {12123.492f, 23618.07f, 14141.919f, 1.0f}, + {12331.21f, 23983.63f, 14116.879f, 1.0f}, + {12403.51f, 23938.58f, 14239.431f, 1.0f}, + {12207.972f, 23594.498f, 14262.359f, 1.0f}, + {12110.925f, 24139.326f, 14014.022f, 1.0f}, + {12228.465f, 24054.127f, 14037.726f, 1.0f}, + {12005.349f, 23661.727f, 14065.38f, 1.0f}, + {11956.66f, 22780.887f, 14294.013f, 1.0f}, + {11995.533f, 23211.639f, 14205.688f, 1.0f}, + {12087.78f, 23211.799f, 14322.793f, 1.0f}, + {12051.927f, 22804.094f, 14407.12f, 1.0f}, + {11723.891f, 23252.79f, 14116.5f, 1.0f}, + {11867.749f, 23226.033f, 14133.248f, 1.0f}, + {11825.285f, 22766.594f, 14226.573f, 1.0f}, + {14111.784f, 20737.596f, 15221.131f, 1.0f}, + {12200.83f, 21542.135f, 15289.713f, 1.0f}, + {12493.261f, 21603.994f, 14830.786f, 1.0f}, + {12416.938f, 21638.77f, 15116.731f, 1.0f}, + {11824.008f, 22454.375f, 15072.701f, 1.0f}, + {12074.313f, 22471.467f, 14920.538f, 1.0f}, + {11962.849f, 22471.227f, 15021.304f, 1.0f}, + {11975.614f, 21989.95f, 15178.014f, 1.0f}, + {12213.068f, 22048.475f, 15015.841f, 1.0f}, + {12106.99f, 22030.518f, 15120.867f, 1.0f}, + {12319.64f, 21604.953f, 15226.238f, 1.0f}, + {12153.962f, 22424.502f, 14637.452f, 1.0f}, + {12141.422f, 22455.06f, 14785.748f, 1.0f}, + {12291.026f, 22009.475f, 14730.966f, 1.0f}, + {12277.692f, 22041.084f, 14878.926f, 1.0f}, + {12477.905f, 21638.432f, 14977.868f, 1.0f}, + {12874.611f, 20901.129f, 15537.555f, 1.0f}, + {13084.713f, 21033.973f, 15051.671f, 1.0f}, + {13021.54f, 21060.297f, 15341.335f, 1.0f}, + {12497.886f, 21164.799f, 15410.303f, 1.0f}, + {12683.326f, 21295.408f, 15225.782f, 1.0f}, + {12598.901f, 21247.53f, 15340.093f, 1.0f}, + {12953.802f, 21000.244f, 15460.672f, 1.0f}, + {12755.457f, 21263.854f, 14938.542f, 1.0f}, + {12738.301f, 21301.14f, 15084.776f, 1.0f}, + {13067.51f, 21072.14f, 15197.713f, 1.0f}, + {14070.269f, 20754.01f, 15515.571f, 1.0f}, + {13363.81f, 20717.684f, 15648.698f, 1.0f}, + {13476.14f, 20896.986f, 15443.207f, 1.0f}, + {13423.845f, 20828.059f, 15566.644f, 1.0f}, + {14026.983f, 20680.791f, 15641.116f, 1.0f}, + {13528.039f, 20876.402f, 15150.807f, 1.0f}, + {13512.728f, 20913.96f, 15297.185f, 1.0f}, + {14100.047f, 20773.957f, 15368.093f, 1.0f}, + {12155.795f, 21286.75f, 14558.065f, 1.0f}, + {12385.094f, 21458.184f, 14599.379f, 1.0f}, + {12016.303f, 22340.994f, 14389.268f, 1.0f}, + {12110.025f, 22384.447f, 14498.227f, 1.0f}, + {12163.825f, 21895.795f, 14490.264f, 1.0f}, + {12251.041f, 21958.455f, 14594.486f, 1.0f}, + {12460.67f, 21540.7f, 14697.879f, 1.0f}, + {11741.969f, 22269.857f, 14321.371f, 1.0f}, + {11887.055f, 22300.754f, 14327.165f, 1.0f}, + {11905.974f, 21774.027f, 14434.735f, 1.0f}, + {12042.65f, 21831.031f, 14434.168f, 1.0f}, + {12278.033f, 21369.008f, 14550.283f, 1.0f}, + {12882.513f, 20586.16f, 14826.075f, 1.0f}, + {13027.127f, 20837.58f, 14838.243f, 1.0f}, + {12672.029f, 21088.623f, 14716.841f, 1.0f}, + {12732.186f, 21189.229f, 14809.34f, 1.0f}, + {13070.532f, 20951.605f, 14925.442f, 1.0f}, + {12481.909f, 20872.36f, 14690.551f, 1.0f}, + {12584.142f, 20977.352f, 14675.129f, 1.0f}, + {12961.102f, 20709.25f, 14803.352f, 1.0f}, + {14077.014f, 20525.828f, 15014.762f, 1.0f}, + {13489.109f, 20667.998f, 14942.778f, 1.0f}, + {13519.746f, 20790.031f, 15026.355f, 1.0f}, + {14103.696f, 20650.465f, 15097.058f, 1.0f}, + {13382.151f, 20393.844f, 14940.984f, 1.0f}, + {13440.791f, 20528.871f, 14912.802f, 1.0f}, + {14035.796f, 20382.656f, 14986.776f, 1.0f}, + {11342.427f, 22846.182f, 14639.279f, 1.0f}, + {12203.463f, 24778.877f, 14409.43f, 1.0f}, + {12270.131f, 24697.361f, 14131.0205f, 1.0f}, + {13302.892f, 25286.932f, 14126.557f, 1.0f}, + {13355.187f, 25175.385f, 14039.034f, 1.0f}, + {12740.808f, 25015.633f, 14129.338f, 1.0f}, + {12806.121f, 24912.244f, 14041.643f, 1.0f}, + {12350.247f, 24606.047f, 14042.93f, 1.0f}, + {13261.054f, 25384.385f, 14404.553f, 1.0f}, + {13269.837f, 25360.32f, 14254.909f, 1.0f}, + {12685.675f, 25105.395f, 14407.553f, 1.0f}, + {12698.514f, 25083.455f, 14257.828f, 1.0f}, + {12218.589f, 24758.049f, 14259.719f, 1.0f}, + {11558.853f, 23905.357f, 14452.195f, 1.0f}, + {11637.653f, 23837.812f, 14172.914f, 1.0f}, + {11902.552f, 24301.707f, 14138.41f, 1.0f}, + {11996.48f, 24226.264f, 14049.378f, 1.0f}, + {11742.418f, 23780.646f, 14082.154f, 1.0f}, + {11828.15f, 24375.652f, 14417.175f, 1.0f}, + {11843.443f, 24354.162f, 14267.5625f, 1.0f}, + {11573.196f, 23881.604f, 14302.8545f, 1.0f}, + {11423.388f, 22790.436f, 14358.08f, 1.0f}, + {11474.651f, 23325.836f, 14251.414f, 1.0f}, + {11585.8545f, 23287.836f, 14157.995f, 1.0f}, + {11536.685f, 22771.762f, 14261.246f, 1.0f}, + {11393.816f, 23387.992f, 14531.398f, 1.0f}, + {11407.22f, 23361.006f, 14382.536f, 1.0f}, + {11355.176f, 22816.568f, 14490.828f, 1.0f}, + {12285.786f, 24694.807f, 14680.997f, 1.0f}, + {13317.755f, 25277.94f, 14676.811f, 1.0f}, + {13277.881f, 25355.455f, 14552.705f, 1.0f}, + {12751.407f, 25005.742f, 14679.766f, 1.0f}, + {12704.249f, 25078.105f, 14555.718f, 1.0f}, + {12227.06f, 24756.668f, 14557.363f, 1.0f}, + {13374.606f, 25163.64f, 14757.977f, 1.0f}, + {12819.97f, 24899.324f, 14760.8125f, 1.0f}, + {12370.7f, 24602.71f, 14761.509f, 1.0f}, + {11681.294f, 23881.88f, 14718.639f, 1.0f}, + {11931.306f, 24317.846f, 14687.021f, 1.0f}, + {11859.003f, 24362.898f, 14564.47f, 1.0f}, + {11596.812f, 23905.455f, 14598.199f, 1.0f}, + {12034.048f, 24247.352f, 14766.175f, 1.0f}, + {11799.435f, 23838.227f, 14795.178f, 1.0f}, + {11482.356f, 22897.975f, 14893.94f, 1.0f}, + {11528.738f, 23402.844f, 14792.443f, 1.0f}, + {11436.488f, 23402.682f, 14675.339f, 1.0f}, + {11387.087f, 22874.768f, 14780.833f, 1.0f}, + {11656.52f, 23388.45f, 14864.884f, 1.0f}, + {11613.729f, 22912.268f, 14961.38f, 1.0f}, + {13851.322f, 20070.605f, 15521.835f, 1.0f}, + {11863.364f, 21224.89f, 15016.991f, 1.0f}, + {11939.6875f, 21190.117f, 14731.046f, 1.0f}, + {11491.666f, 22252.766f, 14473.533f, 1.0f}, + {11603.128f, 22253.008f, 14372.769f, 1.0f}, + {11668.521f, 21715.504f, 14596.909f, 1.0f}, + {11774.599f, 21733.46f, 14491.883f, 1.0f}, + {12036.984f, 21223.932f, 14621.54f, 1.0f}, + {11412.016f, 22299.73f, 14756.62f, 1.0f}, + {11424.559f, 22269.174f, 14608.323f, 1.0f}, + {11590.5625f, 21754.504f, 14881.784f, 1.0f}, + {11603.898f, 21722.895f, 14733.823f, 1.0f}, + {11878.723f, 21190.455f, 14869.909f, 1.0f}, + {12672.411f, 20453.316f, 15311.959f, 1.0f}, + {12735.585f, 20426.992f, 15022.295f, 1.0f}, + {12296.47f, 20741.75f, 14875.071f, 1.0f}, + {12380.894f, 20789.629f, 14760.761f, 1.0f}, + {12803.322f, 20487.045f, 14902.958f, 1.0f}, + {12224.338f, 20773.305f, 15162.312f, 1.0f}, + {12241.497f, 20736.02f, 15016.076f, 1.0f}, + {12689.616f, 20415.15f, 15165.916f, 1.0f}, + {13892.839f, 20054.193f, 15227.394f, 1.0f}, + {13269.822f, 20214.543f, 15146.475f, 1.0f}, + {13322.116f, 20283.469f, 15023.039f, 1.0f}, + {13936.123f, 20127.412f, 15101.851f, 1.0f}, + {13217.922f, 20235.125f, 15438.876f, 1.0f}, + {13233.235f, 20197.568f, 15292.496f, 1.0f}, + {13863.062f, 20034.248f, 15374.872f, 1.0f}, + {11971.533f, 21370.703f, 15248.398f, 1.0f}, + {11549.678f, 22383.24f, 15004.803f, 1.0f}, + {11455.952f, 22339.785f, 14895.845f, 1.0f}, + {11717.766f, 21868.184f, 15122.485f, 1.0f}, + {11630.547f, 21805.523f, 15018.264f, 1.0f}, + {11895.955f, 21288.186f, 15149.899f, 1.0f}, + {11678.922f, 22423.479f, 15066.906f, 1.0f}, + {11838.9375f, 21932.945f, 15178.582f, 1.0f}, + {12078.592f, 21459.879f, 15297.495f, 1.0f}, + {12729.999f, 20649.71f, 15525.386f, 1.0f}, + {12307.769f, 20948.537f, 15384.012f, 1.0f}, + {12247.609f, 20847.93f, 15291.514f, 1.0f}, + {12686.592f, 20535.684f, 15438.1875f, 1.0f}, + {12395.653f, 21059.807f, 15425.725f, 1.0f}, + {12796.022f, 20778.04f, 15560.278f, 1.0f}, + {13886.095f, 20282.377f, 15728.202f, 1.0f}, + {13256.853f, 20443.533f, 15646.903f, 1.0f}, + {13226.215f, 20321.496f, 15563.327f, 1.0f}, + {13859.411f, 20157.738f, 15645.908f, 1.0f}, + {13305.17f, 20582.656f, 15676.881f, 1.0f}, + {13927.311f, 20425.547f, 15756.189f, 1.0f}, + {16670.783f, 14599.395f, 15997.24f, 1.0f}, + {16413.633f, 14520.952f, 15267.713f, 1.0f}, + {16674.514f, 18649.477f, 15983.245f, 1.0f}, + {16431.875f, 18577.03f, 15252.036f, 1.0f}, + {16891.793f, 18712.014f, 15483.844f, 1.0f}, + {15666.4375f, 19962.748f, 15924.151f, 1.0f}, + {15822.917f, 20117.967f, 15420.638f, 1.0f}, + {15798.371f, 20126.998f, 15717.45f, 1.0f}, + {14613.883f, 20409.787f, 15789.299f, 1.0f}, + {14706.171f, 20598.201f, 15578.549f, 1.0f}, + {14664.483f, 20524.664f, 15704.557f, 1.0f}, + {15174.655f, 20219.488f, 15861.057f, 1.0f}, + {15281.739f, 20400.125f, 15651.83f, 1.0f}, + {15234.83f, 20329.426f, 15777.324f, 1.0f}, + {15742.072f, 20062.477f, 15841.991f, 1.0f}, + {14739.733f, 20584.46f, 15282.839f, 1.0f}, + {14732.595f, 20619.2f, 15430.462f, 1.0f}, + {15310.294f, 20388.352f, 15355.436f, 1.0f}, + {15308.238f, 20420.816f, 15503.683f, 1.0f}, + {15826.76f, 20146.484f, 15569.491f, 1.0f}, + {16878.408f, 18708.703f, 15781.553f, 1.0f}, + {16108.373f, 19613.662f, 15959.294f, 1.0f}, + {16268.433f, 19751.652f, 15755.077f, 1.0f}, + {16201.541f, 19697.014f, 15878.683f, 1.0f}, + {16459.062f, 19170.537f, 15974.994f, 1.0f}, + {16644.662f, 19272.68f, 15772.57f, 1.0f}, + {16568.137f, 19231.736f, 15895.505f, 1.0f}, + {16794.854f, 18684.514f, 15904.215f, 1.0f}, + {16288.188f, 19747.14f, 15457.849f, 1.0f}, + {16298.858f, 19769.254f, 15607.301f, 1.0f}, + {16660.178f, 19272.895f, 15475.005f, 1.0f}, + {16676.98f, 19287.133f, 15624.911f, 1.0f}, + {16912.447f, 18718.36f, 15633.939f, 1.0f}, + {15563.664f, 19699.633f, 15203.086f, 1.0f}, + {15725.699f, 19940.95f, 15207.58f, 1.0f}, + {14694.911f, 20376.617f, 15075.391f, 1.0f}, + {14726.501f, 20499.277f, 15158.155f, 1.0f}, + {15243.594f, 20191.07f, 15145.495f, 1.0f}, + {15287.594f, 20307.676f, 15229.657f, 1.0f}, + {15787.43f, 20045.793f, 15293.552f, 1.0f}, + {14597.958f, 20096.42f, 15077.726f, 1.0f}, + {14649.771f, 20235.15f, 15047.148f, 1.0f}, + {15120.709f, 19923.842f, 15144.991f, 1.0f}, + {15184.99f, 20056.283f, 15115.767f, 1.0f}, + {15647.121f, 19819.39f, 15175.813f, 1.0f}, + {16706.836f, 18657.475f, 15264.51f, 1.0f}, + {16156.07f, 19602.773f, 15241.718f, 1.0f}, + {16238.048f, 19688.68f, 15329.473f, 1.0f}, + {16496.525f, 19171.057f, 15256.6045f, 1.0f}, + {16596.81f, 19232.133f, 15345.673f, 1.0f}, + {16819.592f, 18690.635f, 15354.118f, 1.0f}, + {15949.468f, 19403.117f, 15233.295f, 1.0f}, + {16054.732f, 19502.496f, 15207.946f, 1.0f}, + {16249.567f, 19026.818f, 15245.309f, 1.0f}, + {16374.588f, 19098.959f, 15221.363f, 1.0f}, + {16570.686f, 18617.58f, 15228.665f, 1.0f}, + {16888.22f, 14653.558f, 15496.195f, 1.0f}, + {16670.586f, 17113.436f, 15958.872f, 1.0f}, + {16900.27f, 17093.713f, 15458.98f, 1.0f}, + {16888.043f, 17092.197f, 15756.75f, 1.0f}, + {16760.896f, 18113.572f, 15982.188f, 1.0f}, + {16975.104f, 18132.656f, 15780.518f, 1.0f}, + {16887.512f, 18124.383f, 15903.174f, 1.0f}, + {16743.08f, 17614.771f, 15970.002f, 1.0f}, + {16960.562f, 17606.281f, 15768.112f, 1.0f}, + {16871.697f, 17609.145f, 15890.859f, 1.0f}, + {16799.219f, 17100.492f, 15879.592f, 1.0f}, + {16987.814f, 18137.137f, 15482.779f, 1.0f}, + {17010.324f, 18137.135f, 15632.895f, 1.0f}, + {16973.01f, 17610.1f, 15470.357f, 1.0f}, + {16996.137f, 17606.617f, 15620.452f, 1.0f}, + {16923.525f, 17089.816f, 15609.052f, 1.0f}, + {16552.594f, 15932.773f, 15972.076f, 1.0f}, + {16781.16f, 15924.868f, 15471.855f, 1.0f}, + {16769.654f, 15928.856f, 15769.633f, 1.0f}, + {16595.129f, 16557.006f, 15960.678f, 1.0f}, + {16812.678f, 16537.818f, 15758.417f, 1.0f}, + {16723.863f, 16545.76f, 15881.314f, 1.0f}, + {16681.092f, 15930.986f, 15892.6045f, 1.0f}, + {16824.574f, 16535.996f, 15460.646f, 1.0f}, + {16848.043f, 16534.39f, 15610.698f, 1.0f}, + {16804.793f, 15926.708f, 15621.886f, 1.0f}, + {16877.795f, 14653.94f, 15794.037f, 1.0f}, + {16572.006f, 15254.179f, 15986.192f, 1.0f}, + {16786.215f, 15276.3f, 15783.39f, 1.0f}, + {16698.852f, 15267.88f, 15906.509f, 1.0f}, + {16793.408f, 14632.1455f, 15917.322f, 1.0f}, + {16797.307f, 15273.167f, 15485.584f, 1.0f}, + {16820.787f, 15278.157f, 15635.58f, 1.0f}, + {16911.088f, 14661.459f, 15646.157f, 1.0f}, + {16404.812f, 17148.643f, 15228.063f, 1.0f}, + {16700.111f, 17117.092f, 15239.991f, 1.0f}, + {16791.588f, 18124.389f, 15263.384f, 1.0f}, + {16911.004f, 18132.66f, 15353.024f, 1.0f}, + {16773.14f, 17623.986f, 15251.155f, 1.0f}, + {16894.703f, 17616.2f, 15340.677f, 1.0f}, + {16821.816f, 17103.29f, 15329.384f, 1.0f}, + {16501.367f, 18101.879f, 15250.851f, 1.0f}, + {16647.74f, 18113.578f, 15227.506f, 1.0f}, + {16478.027f, 17639.809f, 15238.914f, 1.0f}, + {16626.818f, 17632.277f, 15215.422f, 1.0f}, + {16553.676f, 17133.018f, 15204.413f, 1.0f}, + {16284.918f, 15924.694f, 15241.699f, 1.0f}, + {16580.379f, 15923.144f, 15253.178f, 1.0f}, + {16623.855f, 16552.607f, 15241.794f, 1.0f}, + {16745.852f, 16542.395f, 15331.1045f, 1.0f}, + {16702.355f, 15923.616f, 15342.383f, 1.0f}, + {16328.094f, 16577.922f, 15230.0625f, 1.0f}, + {16477.156f, 16565.084f, 15206.314f, 1.0f}, + {16433.791f, 15923.522f, 15217.823f, 1.0f}, + {16695.96f, 14598.473f, 15278.184f, 1.0f}, + {16598.791f, 15246.616f, 15267.224f, 1.0f}, + {16719.352f, 15262.092f, 15356.234f, 1.0f}, + {16812.68f, 14631.439f, 15366.98f, 1.0f}, + {16306.947f, 15212.199f, 15256.224f, 1.0f}, + {16453.969f, 15229.096f, 15232.105f, 1.0f}, + {16555.832f, 14559.674f, 15243.326f, 1.0f}, + {16214.596f, 18514.49f, 15751.4375f, 1.0f}, + {15407.184f, 19544.416f, 15706.599f, 1.0f}, + {15431.73f, 19535.385f, 15409.786f, 1.0f}, + {14505.67f, 19908.008f, 15288.475f, 1.0f}, + {14547.356f, 19981.543f, 15162.467f, 1.0f}, + {15013.626f, 19743.209f, 15354.218f, 1.0f}, + {15060.534f, 19813.906f, 15228.724f, 1.0f}, + {15488.029f, 19599.904f, 15285.245f, 1.0f}, + {14472.107f, 19921.748f, 15584.185f, 1.0f}, + {14479.246f, 19887.012f, 15436.561f, 1.0f}, + {14985.07f, 19754.98f, 15650.612f, 1.0f}, + {14987.127f, 19722.518f, 15502.364f, 1.0f}, + {15403.343f, 19515.902f, 15557.745f, 1.0f}, + {16227.983f, 18517.803f, 15453.728f, 1.0f}, + {15789.408f, 19265.129f, 15437.511f, 1.0f}, + {15856.3f, 19319.766f, 15313.906f, 1.0f}, + {16063.971f, 18924.678f, 15447.732f, 1.0f}, + {16140.494f, 18965.621f, 15324.799f, 1.0f}, + {16311.536f, 18541.992f, 15331.067f, 1.0f}, + {15769.652f, 19269.64f, 15734.74f, 1.0f}, + {15758.984f, 19247.53f, 15585.287f, 1.0f}, + {16048.453f, 18924.46f, 15745.299f, 1.0f}, + {16031.651f, 18910.225f, 15595.392f, 1.0f}, + {16193.944f, 18508.146f, 15601.341f, 1.0f}, + {15504.403f, 19721.436f, 15919.655f, 1.0f}, + {14516.931f, 20129.594f, 15791.632f, 1.0f}, + {14485.34f, 20006.93f, 15708.869f, 1.0f}, + {15051.771f, 19952.264f, 15860.551f, 1.0f}, + {15007.7705f, 19835.656f, 15776.391f, 1.0f}, + {15442.672f, 19616.59f, 15833.686f, 1.0f}, + {14562.068f, 20271.059f, 15819.875f, 1.0f}, + {15110.374f, 20087.047f, 15890.281f, 1.0f}, + {15582.9795f, 19842.992f, 15951.423f, 1.0f}, + {16399.555f, 18569.031f, 15970.7705f, 1.0f}, + {15901.772f, 19414.008f, 15950.869f, 1.0f}, + {15819.793f, 19328.1f, 15863.116f, 1.0f}, + {16212.106f, 19026.3f, 15963.697f, 1.0f}, + {16111.82f, 18965.223f, 15874.631f, 1.0f}, + {16286.797f, 18535.871f, 15881.163f, 1.0f}, + {16003.108f, 19514.285f, 15984.643f, 1.0f}, + {16334.042f, 19098.398f, 15998.94f, 1.0f}, + {16535.703f, 18608.926f, 16006.616f, 1.0f}, + {16196.195f, 14466.789f, 15768.758f, 1.0f}, + {16175.128f, 17168.365f, 15727.954f, 1.0f}, + {16187.356f, 17169.879f, 15430.185f, 1.0f}, + {16287.161f, 18082.795f, 15452.521f, 1.0f}, + {16374.75f, 18091.07f, 15329.865f, 1.0f}, + {16260.547f, 17648.297f, 15440.804f, 1.0f}, + {16349.41f, 17645.434f, 15318.058f, 1.0f}, + {16276.179f, 17161.586f, 15307.344f, 1.0f}, + {16274.449f, 18078.316f, 15750.26f, 1.0f}, + {16251.942f, 18078.316f, 15600.144f, 1.0f}, + {16248.098f, 17644.48f, 15738.559f, 1.0f}, + {16224.974f, 17647.963f, 15588.463f, 1.0f}, + {16151.875f, 17172.26f, 15577.883f, 1.0f}, + {16056.353f, 15932.601f, 15741.92f, 1.0f}, + {16067.86f, 15928.611f, 15444.143f, 1.0f}, + {16110.547f, 16597.11f, 15432.323f, 1.0f}, + {16199.359f, 16589.168f, 15309.426f, 1.0f}, + {16156.422f, 15926.481f, 15321.172f, 1.0f}, + {16098.648f, 16598.932f, 15730.094f, 1.0f}, + {16075.184f, 16600.537f, 15580.041f, 1.0f}, + {16032.723f, 15930.76f, 15591.889f, 1.0f}, + {16206.624f, 14466.407f, 15470.915f, 1.0f}, + {16092.739f, 15190.078f, 15459.025f, 1.0f}, + {16180.102f, 15198.498f, 15335.906f, 1.0f}, + {16291.009f, 14488.201f, 15347.631f, 1.0f}, + {16081.646f, 15193.211f, 15756.831f, 1.0f}, + {16058.169f, 15188.222f, 15606.834f, 1.0f}, + {16173.332f, 14458.889f, 15618.794f, 1.0f}, + {16375.289f, 17144.986f, 15946.943f, 1.0f}, + {16470.678f, 18091.064f, 15969.654f, 1.0f}, + {16351.258f, 18082.793f, 15880.015f, 1.0f}, + {16447.97f, 17630.592f, 15957.76f, 1.0f}, + {16326.403f, 17638.38f, 15868.239f, 1.0f}, + {16253.58f, 17158.787f, 15857.552f, 1.0f}, + {16614.523f, 18101.873f, 16005.533f, 1.0f}, + {16594.29f, 17622.303f, 15993.494f, 1.0f}, + {16521.723f, 17129.06f, 15982.522f, 1.0f}, + {16257.138f, 15934.324f, 15960.597f, 1.0f}, + {16299.37f, 16582.32f, 15948.945f, 1.0f}, + {16177.372f, 16592.533f, 15859.636f, 1.0f}, + {16135.156f, 15933.852f, 15871.393f, 1.0f}, + {16446.066f, 16569.844f, 15984.426f, 1.0f}, + {16403.723f, 15933.945f, 15995.952f, 1.0f}, + {16388.459f, 14521.875f, 15986.769f, 1.0f}, + {16280.167f, 15219.763f, 15975.19f, 1.0f}, + {16159.602f, 15204.286f, 15886.182f, 1.0f}, + {16271.737f, 14488.907f, 15897.973f, 1.0f}, + {16424.984f, 15237.282f, 16010.31f, 1.0f}, + {16528.584f, 14560.673f, 16021.626f, 1.0f}, + {22209.033f, 13431.873f, 14070.452f, 1.0f}, + {19640.875f, 12092.971f, 15728.672f, 1.0f}, + {19411.44f, 11897.761f, 15010.993f, 1.0f}, + {19552.646f, 12361.938f, 15264.109f, 1.0f}, + {17513.338f, 13113.478f, 16000.91f, 1.0f}, + {17667.852f, 13273.141f, 15499.808f, 1.0f}, + {17662.762f, 13265.143f, 15797.565f, 1.0f}, + {16860.744f, 14039.781f, 16001.384f, 1.0f}, + {17054.57f, 14128.628f, 15797.906f, 1.0f}, + {16975.625f, 14092.668f, 15921.305f, 1.0f}, + {17142.902f, 13554.717f, 16001.479f, 1.0f}, + {17317.525f, 13676.659f, 15797.891f, 1.0f}, + {17246.48f, 13627.06f, 15921.335f, 1.0f}, + {17602.193f, 13203.267f, 15920.8955f, 1.0f}, + {17063.867f, 14131.273f, 15500.039f, 1.0f}, + {17085.557f, 14142.185f, 15649.979f, 1.0f}, + {17325.324f, 13682.02f, 15500.013f, 1.0f}, + {17345.21f, 13695.958f, 15649.942f, 1.0f}, + {17685.818f, 13289.678f, 15649.699f, 1.0f}, + {18467.262f, 12449.571f, 15982.509f, 1.0f}, + {18520.951f, 12673.185f, 15489.973f, 1.0f}, + {18543.668f, 12650.958f, 15784.665f, 1.0f}, + {17959.174f, 12736.911f, 15998.469f, 1.0f}, + {18076.088f, 12915.015f, 15796.675f, 1.0f}, + {18029.785f, 12841.839f, 15919.266f, 1.0f}, + {18516.258f, 12567.164f, 15905.36f, 1.0f}, + {18072.33f, 12928.059f, 15499.758f, 1.0f}, + {18091.027f, 12945.29f, 15649.364f, 1.0f}, + {18545.316f, 12688.187f, 15638.8f, 1.0f}, + {19626.006f, 12323.591f, 15548.8125f, 1.0f}, + {19032.303f, 12239.2705f, 15904.237f, 1.0f}, + {19063.398f, 12458.816f, 15713.614f, 1.0f}, + {19057.674f, 12366.379f, 15830.841f, 1.0f}, + {19642.28f, 12225.82f, 15660.898f, 1.0f}, + {19015.531f, 12490.785f, 15423.016f, 1.0f}, + {19048.598f, 12502.501f, 15570.405f, 1.0f}, + {19594.531f, 12371.388f, 15409.479f, 1.0f}, + {17319.402f, 12926.304f, 15271.872f, 1.0f}, + {17525.629f, 13132.79f, 15282.058f, 1.0f}, + {16883.191f, 14046.169f, 15282.266f, 1.0f}, + {16992.807f, 14097.557f, 15370.916f, 1.0f}, + {17161.734f, 13567.662f, 15282.336f, 1.0f}, + {17260.896f, 13636.969f, 15370.927f, 1.0f}, + {17611.6f, 13218.049f, 15370.709f, 1.0f}, + {16618.377f, 13923.166f, 15272.157f, 1.0f}, + {16751.707f, 13984.93f, 15247.588f, 1.0f}, + {16922.582f, 13400.573f, 15272.374f, 1.0f}, + {17042.932f, 13484.649f, 15247.73f, 1.0f}, + {17423.02f, 13030.341f, 15247.352f, 1.0f}, + {18281.65f, 12240.661f, 15256.158f, 1.0f}, + {18412.422f, 12503.236f, 15271.058f, 1.0f}, + {17950.105f, 12768.407f, 15281.6455f, 1.0f}, + {18022.846f, 12865.946f, 15370.633f, 1.0f}, + {18474.285f, 12608.238f, 15360.839f, 1.0f}, + {17781.008f, 12529.577f, 15270.107f, 1.0f}, + {17865.182f, 12650.288f, 15246.347f, 1.0f}, + {18344.775f, 12374.157f, 15234.3f, 1.0f}, + {19463.77f, 12185.557f, 15041.337f, 1.0f}, + {18916.742f, 12316.457f, 15202.668f, 1.0f}, + {18969.229f, 12425.455f, 15293.884f, 1.0f}, + {19506.729f, 12296.683f, 15134.835f, 1.0f}, + {18824.898f, 12037.943f, 15181.65f, 1.0f}, + {18866.059f, 12180.377f, 15163.259f, 1.0f}, + {19430.309f, 12045.471f, 14997.85f, 1.0f}, + {21855.96f, 13527.633f, 14482.113f, 1.0f}, + {21236.873f, 12180.848f, 15162.681f, 1.0f}, + {20993.916f, 12439.895f, 14746.767f, 1.0f}, + {21104.785f, 12399.777f, 15020.386f, 1.0f}, + {20239.227f, 12030.968f, 15513.25f, 1.0f}, + {20181.824f, 12265.739f, 15345.751f, 1.0f}, + {20217.97f, 12165.884f, 15452.1f, 1.0f}, + {20774.393f, 12070.203f, 15323.224f, 1.0f}, + {20679.93f, 12302.128f, 15167.895f, 1.0f}, + {20732.488f, 12203.347f, 15268.892f, 1.0f}, + {21173.287f, 12306.441f, 15115.866f, 1.0f}, + {20088.305f, 12307.091f, 15066.644f, 1.0f}, + {20136.291f, 12315.324f, 15210.397f, 1.0f}, + {20575.27f, 12343.95f, 14892.177f, 1.0f}, + {20624.723f, 12351.501f, 15035.609f, 1.0f}, + {21041.799f, 12446.64f, 14890.775f, 1.0f}, + {21922.465f, 12586.896f, 14923.896f, 1.0f}, + {21579.541f, 12768.464f, 14541.2f, 1.0f}, + {21702.16f, 12736.821f, 14810.881f, 1.0f}, + {21624.688f, 12338.459f, 15025.252f, 1.0f}, + {21448.97f, 12530.713f, 14897.815f, 1.0f}, + {21535.8f, 12448.565f, 14987.054f, 1.0f}, + {21807.65f, 12672.317f, 14894.079f, 1.0f}, + {21332.04f, 12567.249f, 14626.267f, 1.0f}, + {21377.418f, 12572.389f, 14771.124f, 1.0f}, + {21622.06f, 12770.583f, 14686.966f, 1.0f}, + {21984.178f, 13504.105f, 14750.144f, 1.0f}, + {22122.184f, 12967.212f, 14869.788f, 1.0f}, + {21864.912f, 13063.972f, 14767.721f, 1.0f}, + {21985.773f, 13021.493f, 14846.363f, 1.0f}, + {22112.15f, 13475.483f, 14826.9f, 1.0f}, + {21738.293f, 13090.424f, 14499.256f, 1.0f}, + {21778.01f, 13088.177f, 14645.833f, 1.0f}, + {21894.217f, 13522.418f, 14629.07f, 1.0f}, + {21045.13f, 12008.211f, 14429.722f, 1.0f}, + {20969.203f, 12277.704f, 14502.105f, 1.0f}, + {20013.451f, 12130.804f, 14839.424f, 1.0f}, + {20045.17f, 12242.296f, 14936.375f, 1.0f}, + {20521.719f, 12171.176f, 14657.581f, 1.0f}, + {20539.1f, 12280.629f, 14759.431f, 1.0f}, + {20968.424f, 12380.572f, 14610.284f, 1.0f}, + {20001.113f, 11840.141f, 14797.195f, 1.0f}, + {19997.982f, 11989.582f, 14790.552f, 1.0f}, + {20550.646f, 11885.009f, 14601.531f, 1.0f}, + {20525.773f, 12032.249f, 14602.135f, 1.0f}, + {20996.14f, 12146.945f, 14438.7f, 1.0f}, + {21815.367f, 12482.911f, 14162.977f, 1.0f}, + {21626.432f, 12663.292f, 14272.829f, 1.0f}, + {21342.389f, 12426.669f, 14369.674f, 1.0f}, + {21319.738f, 12516.079f, 14485.296f, 1.0f}, + {21581.076f, 12730.788f, 14395.774f, 1.0f}, + {21473.959f, 12191.318f, 14278.348f, 1.0f}, + {21396.547f, 12312.626f, 14297.004f, 1.0f}, + {21708.705f, 12576.247f, 14191.081f, 1.0f}, + {21949.098f, 13497.714f, 14200.576f, 1.0f}, + {21816.494f, 13031.077f, 14221.658f, 1.0f}, + {21751.807f, 13070.373f, 14350.306f, 1.0f}, + {21875.234f, 13518.958f, 14331.646f, 1.0f}, + {22053.71f, 12920.692f, 14097.539f, 1.0f}, + {21922.512f, 12978.515f, 14132.897f, 1.0f}, + {22066.316f, 13467.133f, 14108.856f, 1.0f}, + {19499.668f, 11628.793f, 15475.555f, 1.0f}, + {17164.887f, 12766.642f, 15772.975f, 1.0f}, + {17169.979f, 12774.641f, 15475.217f, 1.0f}, + {16424.55f, 13834.32f, 15475.634f, 1.0f}, + {16503.496f, 13870.279f, 15352.236f, 1.0f}, + {16747.959f, 13278.632f, 15475.962f, 1.0f}, + {16819.002f, 13328.23f, 15352.519f, 1.0f}, + {17230.547f, 12836.515f, 15351.887f, 1.0f}, + {16415.252f, 13831.675f, 15773.501f, 1.0f}, + {16393.566f, 13820.765f, 15623.562f, 1.0f}, + {16740.16f, 13273.2705f, 15773.841f, 1.0f}, + {16720.275f, 13259.334f, 15623.91f, 1.0f}, + {17146.924f, 12750.106f, 15623.082f, 1.0f}, + {18227.96f, 12017.048f, 15748.695f, 1.0f}, + {18205.244f, 12039.276f, 15454.003f, 1.0f}, + {17664.094f, 12351.475f, 15471.9f, 1.0f}, + {17710.396f, 12424.649f, 15349.311f, 1.0f}, + {18232.654f, 12123.068f, 15333.308f, 1.0f}, + {17667.852f, 12338.429f, 15768.817f, 1.0f}, + {17649.156f, 12321.2f, 15619.211f, 1.0f}, + {18203.598f, 12002.049f, 15599.866f, 1.0f}, + {19426.309f, 11667.143f, 15190.852f, 1.0f}, + {18793.805f, 11818.399f, 15372.272f, 1.0f}, + {18799.527f, 11910.835f, 15255.046f, 1.0f}, + {19410.035f, 11764.911f, 15078.766f, 1.0f}, + {18841.67f, 11786.429f, 15662.871f, 1.0f}, + {18808.604f, 11774.716f, 15515.481f, 1.0f}, + {19457.783f, 11619.347f, 15330.186f, 1.0f}, + {17307.111f, 12906.993f, 15990.724f, 1.0f}, + {16595.932f, 13916.78f, 15991.273f, 1.0f}, + {16486.314f, 13865.391f, 15902.625f, 1.0f}, + {16903.75f, 13387.63f, 15991.517f, 1.0f}, + {16804.588f, 13318.322f, 15902.927f, 1.0f}, + {17221.139f, 12821.733f, 15902.073f, 1.0f}, + {16727.414f, 13978.018f, 16025.953f, 1.0f}, + {17022.55f, 13470.641f, 16026.123f, 1.0f}, + {17409.719f, 13009.44f, 16025.431f, 1.0f}, + {18336.492f, 12186.999f, 15967.609f, 1.0f}, + {17790.078f, 12498.083f, 15986.929f, 1.0f}, + {17717.336f, 12400.542f, 15897.942f, 1.0f}, + {18274.627f, 12081.994f, 15877.829f, 1.0f}, + {17875.0f, 12616.2f, 16022.229f, 1.0f}, + {18404.137f, 12316.075f, 16004.368f, 1.0f}, + {19588.543f, 11805.178f, 15698.327f, 1.0f}, + {18940.46f, 11960.761f, 15883.218f, 1.0f}, + {18887.973f, 11851.759f, 15792.003f, 1.0f}, + {19545.584f, 11694.048f, 15604.829f, 1.0f}, + {18991.143f, 12096.837f, 15922.629f, 1.0f}, + {19622.006f, 11945.261f, 15741.814f, 1.0f}, + {22611.717f, 13345.151f, 14435.995f, 1.0f}, + {21288.086f, 11749.164f, 14845.635f, 1.0f}, + {21177.215f, 11789.282f, 14572.016f, 1.0f}, + {20058.518f, 11605.37f, 14964.694f, 1.0f}, + {20022.371f, 11705.225f, 14858.347f, 1.0f}, + {20645.107f, 11653.086f, 14756.859f, 1.0f}, + {20592.55f, 11751.865f, 14655.863f, 1.0f}, + {21108.715f, 11882.617f, 14476.535f, 1.0f}, + {20152.035f, 11564.018f, 15243.802f, 1.0f}, + {20104.049f, 11555.787f, 15100.048f, 1.0f}, + {20749.768f, 11611.262f, 15032.577f, 1.0f}, + {20700.314f, 11603.715f, 14889.144f, 1.0f}, + {21240.201f, 11742.422f, 14701.626f, 1.0f}, + {22158.291f, 12301.344f, 14545.672f, 1.0f}, + {22035.67f, 12332.987f, 14275.991f, 1.0f}, + {21649.676f, 11999.065f, 14405.784f, 1.0f}, + {21562.846f, 12081.212f, 14316.547f, 1.0f}, + {21930.18f, 12397.49f, 14192.793f, 1.0f}, + {21766.607f, 11962.528f, 14677.333f, 1.0f}, + {21721.227f, 11957.392f, 14532.476f, 1.0f}, + {22115.77f, 12299.227f, 14399.906f, 1.0f}, + {22483.498f, 13368.68f, 14167.966f, 1.0f}, + {22310.982f, 12823.934f, 14199.606f, 1.0f}, + {22190.123f, 12866.411f, 14120.964f, 1.0f}, + {22355.527f, 13397.301f, 14091.208f, 1.0f}, + {22437.604f, 12797.48f, 14468.07f, 1.0f}, + {22397.885f, 12799.7295f, 14321.494f, 1.0f}, + {22573.457f, 13350.368f, 14289.039f, 1.0f}, + {21312.797f, 11911.357f, 15090.296f, 1.0f}, + {20226.889f, 11740.308f, 15471.0205f, 1.0f}, + {20195.172f, 11628.8125f, 15374.07f, 1.0f}, + {20803.32f, 11784.039f, 15267.173f, 1.0f}, + {20785.94f, 11674.584f, 15165.324f, 1.0f}, + {21313.578f, 11808.486f, 14982.117f, 1.0f}, + {20242.36f, 11881.526f, 15519.895f, 1.0f}, + {20799.266f, 11922.963f, 15322.62f, 1.0f}, + {21285.861f, 12042.113f, 15153.701f, 1.0f}, + {22111.398f, 12406.518f, 14814.043f, 1.0f}, + {21756.256f, 12103.111f, 14933.925f, 1.0f}, + {21778.908f, 12013.698f, 14818.304f, 1.0f}, + {22156.756f, 12339.02f, 14691.098f, 1.0f}, + {21702.102f, 12217.152f, 15006.596f, 1.0f}, + {22029.125f, 12493.561f, 14895.791f, 1.0f}, + {22518.576f, 13375.071f, 14717.532f, 1.0f}, + {22359.398f, 12856.829f, 14745.669f, 1.0f}, + {22424.09f, 12817.531f, 14617.021f, 1.0f}, + {22592.443f, 13353.826f, 14586.462f, 1.0f}, + {22253.383f, 12909.391f, 14834.43f, 1.0f}, + {22401.361f, 13405.652f, 14809.252f, 1.0f}, +}; +float D_L06_001EB730[864][4] = { + {22258.893f, 13180.792f, 14840.281f, 1.0f}, + {13643.27f, 20572.834f, 15701.844f, 1.0f}, + {14391.594f, 25484.055f, 14740.8545f, 1.0f}, + {14397.731f, 25346.574f, 13990.276f, 1.0f}, + {17796.443f, 27480.184f, 13668.868f, 1.0f}, + {18078.94f, 27336.297f, 14101.826f, 1.0f}, + {18162.664f, 28908.54f, 14311.129f, 1.0f}, + {18004.887f, 28861.691f, 14551.787f, 1.0f}, + {17823.166f, 30447.46f, 14697.203f, 1.0f}, + {17685.998f, 30439.633f, 14753.864f, 1.0f}, + {17899.965f, 29554.71f, 14638.973f, 1.0f}, + {17763.787f, 29535.35f, 14695.058f, 1.0f}, + {17869.3f, 28841.5f, 14608.173f, 1.0f}, + {17984.547f, 30462.744f, 14454.904f, 1.0f}, + {17928.002f, 30455.576f, 14592.223f, 1.0f}, + {18059.24f, 29594.225f, 14398.084f, 1.0f}, + {18003.717f, 29575.385f, 14534.689f, 1.0f}, + {18107.902f, 28885.23f, 14447.4795f, 1.0f}, + {17942.785f, 27373.492f, 14350.952f, 1.0f}, + {18079.508f, 28309.344f, 14463.701f, 1.0f}, + {17945.068f, 28301.172f, 14521.716f, 1.0f}, + {18069.623f, 27827.318f, 14393.77f, 1.0f}, + {17939.58f, 27842.188f, 14454.3f, 1.0f}, + {17822.23f, 27417.496f, 14413.945f, 1.0f}, + {18235.314f, 28343.02f, 14221.225f, 1.0f}, + {18181.43f, 28324.04f, 14358.182f, 1.0f}, + {18219.129f, 27830.424f, 14148.013f, 1.0f}, + {18167.79f, 27823.19f, 14286.215f, 1.0f}, + {18032.93f, 27344.979f, 14241.35f, 1.0f}, + {17860.113f, 28939.65f, 13865.967f, 1.0f}, + {18102.697f, 28940.832f, 14027.054f, 1.0f}, + {17926.99f, 30470.182f, 14168.615f, 1.0f}, + {17984.19f, 30467.873f, 14306.152f, 1.0f}, + {18000.44f, 29615.64f, 14112.848f, 1.0f}, + {18058.09f, 29608.36f, 14249.953f, 1.0f}, + {18160.836f, 28928.062f, 14163.496f, 1.0f}, + {17684.209f, 30465.42f, 14006.041f, 1.0f}, + {17821.65f, 30469.32f, 14063.2295f, 1.0f}, + {17758.002f, 29606.414f, 13950.353f, 1.0f}, + {17895.062f, 29614.957f, 14007.643f, 1.0f}, + {17997.098f, 28944.9f, 13922.576f, 1.0f}, + {18018.322f, 27380.488f, 13819.297f, 1.0f}, + {18174.736f, 28382.062f, 13938.008f, 1.0f}, + {18232.963f, 28363.395f, 14073.679f, 1.0f}, + {18158.395f, 27873.027f, 13865.285f, 1.0f}, + {18215.828f, 27847.926f, 14000.202f, 1.0f}, + {18073.809f, 27348.766f, 13953.621f, 1.0f}, + {17933.258f, 28403.607f, 13779.953f, 1.0f}, + {18069.492f, 28396.186f, 13834.865f, 1.0f}, + {17923.002f, 27930.172f, 13711.205f, 1.0f}, + {18055.568f, 27901.906f, 13763.803f, 1.0f}, + {17920.924f, 27426.637f, 13719.306f, 1.0f}, + {14537.337f, 25067.418f, 14430.811f, 1.0f}, + {16983.047f, 26094.154f, 14135.83f, 1.0f}, + {16918.379f, 26227.207f, 14384.854f, 1.0f}, + {17692.746f, 26941.283f, 14335.668f, 1.0f}, + {17586.984f, 27013.727f, 14399.967f, 1.0f}, + {17339.707f, 26549.396f, 14347.108f, 1.0f}, + {17252.096f, 26645.082f, 14411.22f, 1.0f}, + {16848.566f, 26339.428f, 14447.805f, 1.0f}, + {17808.098f, 26864.242f, 14084.73f, 1.0f}, + {17770.389f, 26888.791f, 14224.973f, 1.0f}, + {17429.477f, 26439.658f, 14096.443f, 1.0f}, + {17401.996f, 26477.26f, 14236.574f, 1.0f}, + {16965.604f, 26141.076f, 14275.304f, 1.0f}, + {15882.68f, 25570.297f, 14286.365f, 1.0f}, + {15846.875f, 25723.424f, 14532.328f, 1.0f}, + {16429.889f, 25966.549f, 14448.049f, 1.0f}, + {16374.246f, 26088.83f, 14509.586f, 1.0f}, + {15799.667f, 25850.682f, 14592.865f, 1.0f}, + {16475.223f, 25819.54f, 14200.943f, 1.0f}, + {16465.346f, 25871.984f, 14339.669f, 1.0f}, + {15876.026f, 25624.963f, 14424.699f, 1.0f}, + {14493.377f, 25217.924f, 14677.07f, 1.0f}, + {15181.913f, 25473.021f, 14618.377f, 1.0f}, + {15137.181f, 25601.709f, 14678.543f, 1.0f}, + {14446.426f, 25345.69f, 14737.256f, 1.0f}, + {15218.275f, 25319.465f, 14372.523f, 1.0f}, + {15210.392f, 25373.91f, 14510.918f, 1.0f}, + {14525.302f, 25120.207f, 14569.461f, 1.0f}, + {16773.201f, 26336.53f, 13702.943f, 1.0f}, + {16922.912f, 26139.436f, 13853.374f, 1.0f}, + {17747.695f, 26909.1f, 13802.256f, 1.0f}, + {17800.127f, 26871.373f, 13936.292f, 1.0f}, + {17369.219f, 26484.816f, 13813.986f, 1.0f}, + {17417.965f, 26442.312f, 13948.05f, 1.0f}, + {16968.055f, 26093.574f, 13987.669f, 1.0f}, + {17546.922f, 27049.582f, 13653.718f, 1.0f}, + {17658.781f, 26971.68f, 13703.029f, 1.0f}, + {17194.236f, 26658.422f, 13665.198f, 1.0f}, + {17290.656f, 26560.705f, 13714.661f, 1.0f}, + {16854.488f, 26224.748f, 13753.393f, 1.0f}, + {15714.931f, 25837.836f, 13848.926f, 1.0f}, + {15828.027f, 25617.688f, 14003.292f, 1.0f}, + {16416.344f, 25865.297f, 13918.348f, 1.0f}, + {16458.016f, 25817.191f, 14052.996f, 1.0f}, + {15865.824f, 25567.742f, 14138.387f, 1.0f}, + {16287.737f, 26077.023f, 13765.8f, 1.0f}, + {16356.55f, 25956.541f, 13817.497f, 1.0f}, + {15775.04f, 25712.533f, 13901.646f, 1.0f}, + {14497.719f, 25120.707f, 14146.331f, 1.0f}, + {15170.785f, 25369.67f, 14088.709f, 1.0f}, + {15204.367f, 25317.977f, 14224.264f, 1.0f}, + {14527.65f, 25067.596f, 14282.227f, 1.0f}, + {15067.262f, 25594.223f, 13933.191f, 1.0f}, + {15122.639f, 25466.676f, 13986.498f, 1.0f}, + {14452.097f, 25218.672f, 14043.812f, 1.0f}, + {17689.621f, 27470.29f, 14420.741f, 1.0f}, + {17407.129f, 27614.174f, 13987.783f, 1.0f}, + {17419.242f, 28858.844f, 14162.889f, 1.0f}, + {17577.02f, 28905.691f, 13922.231f, 1.0f}, + {17398.428f, 30451.246f, 14062.416f, 1.0f}, + {17535.596f, 30459.072f, 14005.756f, 1.0f}, + {17473.953f, 29571.95f, 14005.783f, 1.0f}, + {17610.13f, 29591.31f, 13949.699f, 1.0f}, + {17712.605f, 28925.883f, 13865.846f, 1.0f}, + {17237.047f, 30435.965f, 14304.716f, 1.0f}, + {17293.592f, 30443.13f, 14167.396f, 1.0f}, + {17314.678f, 29532.438f, 14246.672f, 1.0f}, + {17370.203f, 29551.277f, 14110.066f, 1.0f}, + {17474.004f, 28882.148f, 14026.539f, 1.0f}, + {17543.28f, 27576.979f, 13738.658f, 1.0f}, + {17652.334f, 28395.023f, 13839.648f, 1.0f}, + {17786.771f, 28403.2f, 13781.633f, 1.0f}, + {17650.838f, 27968.38f, 13776.028f, 1.0f}, + {17780.88f, 27953.512f, 13715.497f, 1.0f}, + {17663.832f, 27532.975f, 13675.663f, 1.0f}, + {17496.527f, 28361.35f, 14082.123f, 1.0f}, + {17550.414f, 28380.33f, 13945.166f, 1.0f}, + {17501.334f, 27965.275f, 14021.785f, 1.0f}, + {17552.674f, 27972.51f, 13883.583f, 1.0f}, + {17453.137f, 27605.492f, 13848.259f, 1.0f}, + {17721.79f, 28827.73f, 14608.051f, 1.0f}, + {17479.209f, 28826.55f, 14446.965f, 1.0f}, + {17294.605f, 30428.523f, 14591.004f, 1.0f}, + {17237.402f, 30430.834f, 14453.467f, 1.0f}, + {17373.48f, 29511.021f, 14531.908f, 1.0f}, + {17315.828f, 29518.3f, 14394.804f, 1.0f}, + {17421.068f, 28839.318f, 14310.522f, 1.0f}, + {17537.383f, 30433.285f, 14753.578f, 1.0f}, + {17399.943f, 30429.387f, 14696.39f, 1.0f}, + {17615.914f, 29520.248f, 14694.404f, 1.0f}, + {17478.857f, 29511.705f, 14637.113f, 1.0f}, + {17584.809f, 28822.48f, 14551.443f, 1.0f}, + {17467.744f, 27569.982f, 14270.3125f, 1.0f}, + {17557.105f, 28322.303f, 14365.341f, 1.0f}, + {17498.875f, 28340.973f, 14229.669f, 1.0f}, + {17562.066f, 27922.672f, 14304.513f, 1.0f}, + {17504.63f, 27947.773f, 14169.596f, 1.0f}, + {17412.258f, 27601.705f, 14135.988f, 1.0f}, + {17798.582f, 28300.764f, 14523.3955f, 1.0f}, + {17662.348f, 28308.184f, 14468.483f, 1.0f}, + {17797.459f, 27865.527f, 14458.594f, 1.0f}, + {17664.895f, 27893.791f, 14405.995f, 1.0f}, + {17565.14f, 27523.836f, 14370.304f, 1.0f}, + {14251.99f, 25763.207f, 14300.322f, 1.0f}, + {16556.947f, 26703.031f, 14021.685f, 1.0f}, + {16621.615f, 26569.977f, 13772.66f, 1.0f}, + {17323.39f, 27203.39f, 13726.126f, 1.0f}, + {17429.15f, 27130.945f, 13661.828f, 1.0f}, + {17007.03f, 26858.773f, 13737.236f, 1.0f}, + {17094.64f, 26763.09f, 13673.125f, 1.0f}, + {16691.428f, 26457.758f, 13709.71f, 1.0f}, + {17208.04f, 27280.43f, 13977.064f, 1.0f}, + {17245.748f, 27255.883f, 13836.821f, 1.0f}, + {16917.262f, 26968.512f, 13987.902f, 1.0f}, + {16944.742f, 26930.908f, 13847.771f, 1.0f}, + {16574.39f, 26656.105f, 13882.212f, 1.0f}, + {15573.84f, 26254.904f, 14159.656f, 1.0f}, + {15609.645f, 26101.777f, 13913.694f, 1.0f}, + {16164.744f, 26330.686f, 13832.662f, 1.0f}, + {16220.385f, 26208.404f, 13771.125f, 1.0f}, + {15656.853f, 25974.52f, 13853.156f, 1.0f}, + {16119.41f, 26477.697f, 14079.766f, 1.0f}, + {16129.286f, 26425.248f, 13941.043f, 1.0f}, + {15580.494f, 26200.236f, 14021.324f, 1.0f}, + {14295.947f, 25612.703f, 14054.0625f, 1.0f}, + {14968.349f, 25861.582f, 13997.068f, 1.0f}, + {15013.082f, 25732.895f, 13936.903f, 1.0f}, + {14342.899f, 25484.938f, 13993.876f, 1.0f}, + {14931.988f, 26015.135f, 14242.924f, 1.0f}, + {14939.873f, 25960.691f, 14104.529f, 1.0f}, + {14264.025f, 25710.418f, 14161.67f, 1.0f}, + {16766.793f, 26460.654f, 14454.572f, 1.0f}, + {16617.082f, 26657.748f, 14304.141f, 1.0f}, + {17268.441f, 27235.574f, 14259.538f, 1.0f}, + {17216.008f, 27273.299f, 14125.502f, 1.0f}, + {16977.52f, 26923.352f, 14270.358f, 1.0f}, + {16928.77f, 26965.857f, 14136.295f, 1.0f}, + {16571.938f, 26703.607f, 14169.847f, 1.0f}, + {17469.21f, 27095.094f, 14408.077f, 1.0f}, + {17357.354f, 27172.994f, 14358.765f, 1.0f}, + {17152.5f, 26749.75f, 14419.147f, 1.0f}, + {17056.082f, 26847.465f, 14369.684f, 1.0f}, + {16685.504f, 26572.436f, 14404.123f, 1.0f}, + {15741.589f, 25987.365f, 14597.097f, 1.0f}, + {15628.493f, 26207.512f, 14442.731f, 1.0f}, + {16178.29f, 26431.938f, 14362.362f, 1.0f}, + {16136.617f, 26480.047f, 14227.714f, 1.0f}, + {15590.695f, 26257.46f, 14307.636f, 1.0f}, + {16306.895f, 26220.21f, 14514.91f, 1.0f}, + {16238.084f, 26340.695f, 14463.213f, 1.0f}, + {15681.48f, 26112.668f, 14544.376f, 1.0f}, + {14291.607f, 25709.92f, 14584.801f, 1.0f}, + {14979.479f, 25964.934f, 14526.737f, 1.0f}, + {14945.895f, 26016.625f, 14391.184f, 1.0f}, + {14261.676f, 25763.031f, 14448.904f, 1.0f}, + {15083.002f, 25740.38f, 14682.255f, 1.0f}, + {15027.623f, 25867.928f, 14628.947f, 1.0f}, + {14337.229f, 25611.953f, 14687.319f, 1.0f}, + {13711.265f, 20387.031f, 14964.4795f, 1.0f}, + {11773.684f, 23002.201f, 14172.848f, 1.0f}, + {12106.982f, 23043.736f, 14582.031f, 1.0f}, + {12898.248f, 24346.807f, 14461.424f, 1.0f}, + {12807.981f, 24470.432f, 14708.824f, 1.0f}, + {13840.492f, 24965.834f, 14701.455f, 1.0f}, + {13786.992f, 25090.318f, 14761.805f, 1.0f}, + {13270.02f, 24720.812f, 14707.92f, 1.0f}, + {13205.127f, 24838.523f, 14768.453f, 1.0f}, + {12727.904f, 24576.918f, 14769.675f, 1.0f}, + {13896.83f, 24821.059f, 14454.732f, 1.0f}, + {13879.0625f, 24871.283f, 14593.626f, 1.0f}, + {13342.502f, 24584.97f, 14460.852f, 1.0f}, + {13318.26f, 24631.773f, 14599.904f, 1.0f}, + {12867.799f, 24389.627f, 14600.579f, 1.0f}, + {12332.738f, 23771.52f, 14472.281f, 1.0f}, + {12213.873f, 23864.107f, 14721.516f, 1.0f}, + {12459.209f, 24189.102f, 14709.266f, 1.0f}, + {12362.964f, 24279.535f, 14770.903f, 1.0f}, + {12103.309f, 23934.451f, 14784.742f, 1.0f}, + {12565.651f, 24080.26f, 14461.229f, 1.0f}, + {12530.385f, 24119.125f, 14600.521f, 1.0f}, + {12294.438f, 23806.893f, 14611.793f, 1.0f}, + {11976.497f, 23102.705f, 14835.858f, 1.0f}, + {12054.382f, 23499.186f, 14763.226f, 1.0f}, + {11933.602f, 23547.197f, 14829.085f, 1.0f}, + {11850.581f, 23127.729f, 14905.341f, 1.0f}, + {12181.256f, 23423.229f, 14512.1f, 1.0f}, + {12141.348f, 23455.652f, 14651.916f, 1.0f}, + {12066.535f, 23073.209f, 14722.328f, 1.0f}, + {12710.047f, 24585.379f, 14021.187f, 1.0f}, + {12857.684f, 24394.42f, 14176.595f, 1.0f}, + {13862.721f, 24876.262f, 14169.845f, 1.0f}, + {13891.092f, 24822.807f, 14305.92f, 1.0f}, + {13308.449f, 24639.047f, 14175.813f, 1.0f}, + {13339.057f, 24587.525f, 14311.931f, 1.0f}, + {12894.697f, 24348.49f, 14312.539f, 1.0f}, + {13758.145f, 25099.11f, 14013.676f, 1.0f}, + {13816.037f, 24973.29f, 14067.221f, 1.0f}, + {13187.808f, 24851.367f, 14019.775f, 1.0f}, + {13255.336f, 24731.695f, 14073.223f, 1.0f}, + {12792.843f, 24477.604f, 14074.285f, 1.0f}, + {12054.068f, 23893.498f, 14040.381f, 1.0f}, + {12266.547f, 23783.695f, 14190.146f, 1.0f}, + {12513.273f, 24113.889f, 14177.236f, 1.0f}, + {12559.643f, 24078.422f, 14312.59f, 1.0f}, + {12322.943f, 23763.375f, 14324.22f, 1.0f}, + {12332.759f, 24270.291f, 14023.648f, 1.0f}, + {12433.603f, 24181.266f, 14075.773f, 1.0f}, + {12172.129f, 23829.389f, 14090.477f, 1.0f}, + {12022.975f, 23002.105f, 14307.403f, 1.0f}, + {12103.695f, 23409.002f, 14233.189f, 1.0f}, + {12168.034f, 23406.846f, 14365.062f, 1.0f}, + {12091.687f, 23018.766f, 14436.33f, 1.0f}, + {11867.131f, 23464.84f, 14089.88f, 1.0f}, + {11998.03f, 23429.367f, 14136.559f, 1.0f}, + {11911.307f, 22996.287f, 14214.881f, 1.0f}, + {13813.149f, 20825.48f, 15259.303f, 1.0f}, + {12384.971f, 21823.246f, 14854.637f, 1.0f}, + {12264.159f, 21830.68f, 15119.919f, 1.0f}, + {11988.779f, 22684.555f, 14924.605f, 1.0f}, + {11862.597f, 22687.043f, 14998.4f, 1.0f}, + {12089.305f, 22255.422f, 15019.638f, 1.0f}, + {11967.365f, 22236.516f, 15098.222f, 1.0f}, + {12150.77f, 21791.889f, 15203.708f, 1.0f}, + {12118.952f, 22643.635f, 14667.25f, 1.0f}, + {12078.801f, 22669.312f, 14808.32f, 1.0f}, + {12216.025f, 22232.531f, 14758.273f, 1.0f}, + {12176.624f, 22254.021f, 14900.264f, 1.0f}, + {12346.401f, 21841.691f, 14997.342f, 1.0f}, + {12911.495f, 21167.777f, 15068.176f, 1.0f}, + {12814.392f, 21150.87f, 15341.971f, 1.0f}, + {12504.702f, 21446.666f, 15227.211f, 1.0f}, + {12404.314f, 21389.854f, 15316.587f, 1.0f}, + {12731.3f, 21078.426f, 15437.155f, 1.0f}, + {12616.231f, 21451.855f, 14957.993f, 1.0f}, + {12579.117f, 21468.438f, 15101.289f, 1.0f}, + {12877.669f, 21182.246f, 15212.401f, 1.0f}, + {13749.31f, 20789.96f, 15541.635f, 1.0f}, + {13218.831f, 20946.395f, 15452.965f, 1.0f}, + {13154.017f, 20861.777f, 15553.393f, 1.0f}, + {13697.855f, 20697.996f, 15645.517f, 1.0f}, + {13298.247f, 20974.12f, 15174.343f, 1.0f}, + {13269.479f, 20985.846f, 15319.86f, 1.0f}, + {13789.796f, 20834.729f, 15406.014f, 1.0f}, + {12095.613f, 21565.203f, 14494.313f, 1.0f}, + {12315.158f, 21713.283f, 14595.502f, 1.0f}, + {12033.729f, 22577.605f, 14397.156f, 1.0f}, + {12103.125f, 22611.43f, 14522.868f, 1.0f}, + {12135.299f, 22144.922f, 14493.061f, 1.0f}, + {12201.514f, 22194.219f, 14615.283f, 1.0f}, + {12374.0f, 21778.156f, 14713.529f, 1.0f}, + {11783.029f, 22525.148f, 14272.544f, 1.0f}, + {11921.326f, 22547.307f, 14309.254f, 1.0f}, + {11894.412f, 22043.918f, 14379.359f, 1.0f}, + {12027.459f, 22092.145f, 14410.216f, 1.0f}, + {12217.4f, 21638.504f, 14518.523f, 1.0f}, + {12727.416f, 20786.281f, 14748.776f, 1.0f}, + {12875.469f, 21016.758f, 14822.466f, 1.0f}, + {12562.494f, 21319.184f, 14705.859f, 1.0f}, + {12610.395f, 21399.443f, 14819.137f, 1.0f}, + {12910.722f, 21109.664f, 14931.249f, 1.0f}, + {12374.97f, 21126.367f, 14618.507f, 1.0f}, + {12479.824f, 21223.291f, 14635.407f, 1.0f}, + {12811.1f, 20903.201f, 14758.391f, 1.0f}, + {13797.392f, 20658.58f, 15020.238f, 1.0f}, + {13276.629f, 20811.805f, 14933.205f, 1.0f}, + {13300.758f, 20913.004f, 15038.568f, 1.0f}, + {13815.816f, 20763.625f, 15123.837f, 1.0f}, + {13166.639f, 20554.531f, 14870.803f, 1.0f}, + {13229.531f, 20685.926f, 14874.294f, 1.0f}, + {13760.678f, 20526.34f, 14964.279f, 1.0f}, + {11707.958f, 23144.469f, 14920.195f, 1.0f}, + {11374.659f, 23102.938f, 14511.011f, 1.0f}, + {12451.561f, 24931.443f, 14333.633f, 1.0f}, + {12541.827f, 24807.82f, 14086.232f, 1.0f}, + {13644.363f, 25359.055f, 14077.706f, 1.0f}, + {13697.863f, 25234.572f, 14017.356f, 1.0f}, + {13051.252f, 25097.549f, 14084.143f, 1.0f}, + {13116.144f, 24979.834f, 14023.609f, 1.0f}, + {12621.902f, 24701.334f, 14025.381f, 1.0f}, + {13588.025f, 25503.83f, 14324.429f, 1.0f}, + {13605.794f, 25453.605f, 14185.535f, 1.0f}, + {12978.77f, 25233.389f, 14331.211f, 1.0f}, + {13003.012f, 25186.584f, 14192.158f, 1.0f}, + {12482.01f, 24888.625f, 14194.477f, 1.0f}, + {11700.91f, 24129.193f, 14359.947f, 1.0f}, + {11819.775f, 24036.607f, 14110.715f, 1.0f}, + {12129.853f, 24457.844f, 14090.435f, 1.0f}, + {12226.097f, 24367.412f, 14028.797f, 1.0f}, + {11930.339f, 23966.264f, 14047.486f, 1.0f}, + {12023.412f, 24566.686f, 14338.472f, 1.0f}, + {12058.679f, 24527.82f, 14199.178f, 1.0f}, + {11739.211f, 24093.822f, 14220.436f, 1.0f}, + {11505.145f, 23043.967f, 14257.184f, 1.0f}, + {11610.145f, 23558.033f, 14166.12f, 1.0f}, + {11730.925f, 23510.021f, 14100.261f, 1.0f}, + {11631.061f, 23018.943f, 14187.702f, 1.0f}, + {11483.271f, 23633.99f, 14417.246f, 1.0f}, + {11523.18f, 23601.564f, 14277.43f, 1.0f}, + {11415.108f, 23073.463f, 14370.714f, 1.0f}, + {12639.76f, 24692.875f, 14773.87f, 1.0f}, + {12492.125f, 24883.83f, 14618.461f, 1.0f}, + {13622.135f, 25448.625f, 14609.316f, 1.0f}, + {13593.764f, 25502.082f, 14473.242f, 1.0f}, + {13012.823f, 25179.312f, 14616.25f, 1.0f}, + {12982.215f, 25230.836f, 14480.133f, 1.0f}, + {12455.112f, 24929.762f, 14482.516f, 1.0f}, + {13726.709f, 25225.781f, 14765.486f, 1.0f}, + {13668.82f, 25351.602f, 14711.94f, 1.0f}, + {13133.463f, 24966.994f, 14772.288f, 1.0f}, + {13065.935f, 25086.662f, 14718.842f, 1.0f}, + {12556.966f, 24800.645f, 14720.771f, 1.0f}, + {11979.579f, 24007.217f, 14791.849f, 1.0f}, + {11767.104f, 24117.02f, 14642.082f, 1.0f}, + {12075.789f, 24533.055f, 14622.463f, 1.0f}, + {12029.419f, 24568.525f, 14487.109f, 1.0f}, + {11710.704f, 24137.342f, 14508.01f, 1.0f}, + {12256.302f, 24376.654f, 14776.051f, 1.0f}, + {12155.46f, 24465.678f, 14723.925f, 1.0f}, + {11861.5205f, 24071.326f, 14741.753f, 1.0f}, + {11458.667f, 23144.566f, 14785.639f, 1.0f}, + {11560.833f, 23648.215f, 14696.155f, 1.0f}, + {11496.492f, 23650.371f, 14564.283f, 1.0f}, + {11389.954f, 23127.904f, 14656.713f, 1.0f}, + {11797.3955f, 23592.377f, 14839.465f, 1.0f}, + {11666.496f, 23627.85f, 14792.787f, 1.0f}, + {11570.336f, 23150.383f, 14878.162f, 1.0f}, + {13541.385f, 20134.387f, 15407.02f, 1.0f}, + {11734.137f, 21473.188f, 14875.627f, 1.0f}, + {11854.948f, 21465.754f, 14610.345f, 1.0f}, + {11513.717f, 22516.992f, 14366.407f, 1.0f}, + {11639.898f, 22514.504f, 14292.613f, 1.0f}, + {11634.478f, 21988.686f, 14483.773f, 1.0f}, + {11756.417f, 22007.588f, 14405.189f, 1.0f}, + {11968.338f, 21504.543f, 14526.556f, 1.0f}, + {11383.544f, 22557.914f, 14623.763f, 1.0f}, + {11423.697f, 22532.236f, 14482.691f, 1.0f}, + {11507.759f, 22011.574f, 14745.138f, 1.0f}, + {11547.161f, 21990.084f, 14603.147f, 1.0f}, + {11772.707f, 21454.742f, 14732.922f, 1.0f}, + {12456.966f, 20594.45f, 15164.066f, 1.0f}, + {12554.068f, 20611.354f, 14890.2705f, 1.0f}, + {12163.509f, 20986.355f, 14747.1045f, 1.0f}, + {12263.8955f, 21043.168f, 14657.7295f, 1.0f}, + {12637.16f, 20683.799f, 14795.086f, 1.0f}, + {12051.9795f, 20981.168f, 15016.322f, 1.0f}, + {12089.094f, 20964.586f, 14873.025f, 1.0f}, + {12490.792f, 20579.977f, 15019.84f, 1.0f}, + {13605.225f, 20169.904f, 15124.689f, 1.0f}, + {13032.711f, 20353.012f, 15023.691f, 1.0f}, + {13097.525f, 20437.629f, 14923.264f, 1.0f}, + {13656.679f, 20261.87f, 15020.808f, 1.0f}, + {12953.296f, 20325.291f, 15302.312f, 1.0f}, + {12982.064f, 20313.564f, 15156.796f, 1.0f}, + {13564.739f, 20125.139f, 15260.31f, 1.0f}, + {12023.494f, 21731.227f, 15235.951f, 1.0f}, + {11803.95f, 21583.148f, 15134.762f, 1.0f}, + {11468.769f, 22623.941f, 14893.855f, 1.0f}, + {11399.37f, 22590.117f, 14768.144f, 1.0f}, + {11588.485f, 22099.182f, 15010.35f, 1.0f}, + {11522.27f, 22049.885f, 14888.129f, 1.0f}, + {11745.107f, 21518.277f, 15016.734f, 1.0f}, + {11719.465f, 22676.398f, 15018.468f, 1.0f}, + {11581.172f, 22654.24f, 14981.757f, 1.0f}, + {11829.37f, 22200.186f, 15124.051f, 1.0f}, + {11696.326f, 22151.96f, 15093.193f, 1.0f}, + {11901.707f, 21657.928f, 15211.74f, 1.0f}, + {12641.043f, 20975.943f, 15483.465f, 1.0f}, + {12492.992f, 20745.465f, 15409.774f, 1.0f}, + {12105.717f, 21113.84f, 15268.455f, 1.0f}, + {12057.816f, 21033.578f, 15155.18f, 1.0f}, + {12457.738f, 20652.559f, 15300.992f, 1.0f}, + {12293.24f, 21306.656f, 15355.81f, 1.0f}, + {12188.387f, 21209.73f, 15338.907f, 1.0f}, + {12557.36f, 20859.023f, 15473.85f, 1.0f}, + {13557.143f, 20301.287f, 15646.085f, 1.0f}, + {12974.914f, 20487.605f, 15543.451f, 1.0f}, + {12950.784f, 20386.406f, 15438.088f, 1.0f}, + {13538.718f, 20196.242f, 15542.486f, 1.0f}, + {13084.904f, 20744.877f, 15605.853f, 1.0f}, + {13022.012f, 20613.484f, 15602.362f, 1.0f}, + {13593.857f, 20433.527f, 15702.043f, 1.0f}, + {16549.09f, 14912.882f, 16003.842f, 1.0f}, + {16432.596f, 14880.4795f, 15249.842f, 1.0f}, + {16406.678f, 18830.098f, 15236.843f, 1.0f}, + {16785.348f, 18997.6f, 15554.425f, 1.0f}, + {15567.052f, 20268.406f, 15462.3125f, 1.0f}, + {15514.254f, 20229.756f, 15747.149f, 1.0f}, + {14366.977f, 20639.416f, 15609.947f, 1.0f}, + {14320.534f, 20545.174f, 15715.145f, 1.0f}, + {14971.807f, 20463.105f, 15678.065f, 1.0f}, + {14921.963f, 20370.84f, 15783.06f, 1.0f}, + {15454.498f, 20143.535f, 15851.131f, 1.0f}, + {14421.04f, 20678.805f, 15325.631f, 1.0f}, + {14402.2705f, 20686.342f, 15473.168f, 1.0f}, + {15022.715f, 20503.207f, 15393.1045f, 1.0f}, + {15007.186f, 20509.586f, 15541.131f, 1.0f}, + {15553.777f, 20273.605f, 15610.614f, 1.0f}, + {16721.514f, 18974.408f, 15838.46f, 1.0f}, + {16002.604f, 19909.535f, 15798.301f, 1.0f}, + {15929.605f, 19833.975f, 15901.03f, 1.0f}, + {16420.691f, 19488.27f, 15825.458f, 1.0f}, + {16334.278f, 19428.236f, 15927.119f, 1.0f}, + {16624.143f, 18934.066f, 15939.489f, 1.0f}, + {16059.181f, 19945.21f, 15513.819f, 1.0f}, + {16048.105f, 19948.598f, 15662.33f, 1.0f}, + {16481.05f, 19519.105f, 15541.267f, 1.0f}, + {16472.232f, 19520.18f, 15689.965f, 1.0f}, + {16778.125f, 18996.719f, 15703.243f, 1.0f}, + {15379.121f, 19874.787f, 15159.914f, 1.0f}, + {15511.079f, 20121.371f, 15219.07f, 1.0f}, + {14400.53f, 20513.047f, 15086.342f, 1.0f}, + {14420.429f, 20617.95f, 15189.796f, 1.0f}, + {14988.149f, 20343.66f, 15152.175f, 1.0f}, + {15016.03f, 20444.941f, 15256.522f, 1.0f}, + {15552.059f, 20214.945f, 15324.82f, 1.0f}, + {14317.461f, 20239.244f, 15032.252f, 1.0f}, + {14364.372f, 20380.062f, 15031.02f, 1.0f}, + {14888.357f, 20077.924f, 15096.408f, 1.0f}, + {14943.316f, 20214.78f, 15095.95f, 1.0f}, + {15450.352f, 20001.924f, 15161.164f, 1.0f}, + {16654.941f, 18937.824f, 15305.227f, 1.0f}, + {15976.812f, 19819.549f, 15268.081f, 1.0f}, + {16034.1455f, 19899.895f, 15375.378f, 1.0f}, + {16371.863f, 19423.66f, 15293.367f, 1.0f}, + {16445.807f, 19485.21f, 15402.0f, 1.0f}, + {16742.094f, 18976.918f, 15414.659f, 1.0f}, + {15803.747f, 19606.16f, 15205.035f, 1.0f}, + {15895.905f, 19716.402f, 15208.264f, 1.0f}, + {16157.09f, 19257.848f, 15226.979f, 1.0f}, + {16270.479f, 19343.82f, 15231.908f, 1.0f}, + {16537.158f, 18886.268f, 15242.786f, 1.0f}, + {16854.35f, 14966.585f, 15565.879f, 1.0f}, + {16948.234f, 17350.062f, 15539.711f, 1.0f}, + {16879.879f, 17352.03f, 15823.828f, 1.0f}, + {16883.969f, 18412.564f, 15842.365f, 1.0f}, + {16779.445f, 18392.986f, 15943.205f, 1.0f}, + {16923.719f, 17868.117f, 15835.666f, 1.0f}, + {16815.797f, 17865.469f, 15936.557f, 1.0f}, + {16771.145f, 17359.46f, 15924.832f, 1.0f}, + {16950.594f, 18426.162f, 15558.364f, 1.0f}, + {16944.07f, 18424.213f, 15707.227f, 1.0f}, + {16991.82f, 17872.746f, 15551.621f, 1.0f}, + {16985.531f, 17870.672f, 15700.494f, 1.0f}, + {16942.066f, 17348.729f, 15688.592f, 1.0f}, + {16814.643f, 16230.49f, 15541.271f, 1.0f}, + {16746.822f, 16235.855f, 15825.492f, 1.0f}, + {16805.95f, 16819.066f, 15819.018f, 1.0f}, + {16697.2f, 16829.174f, 15920.113f, 1.0f}, + {16638.17f, 16241.631f, 15926.669f, 1.0f}, + {16874.104f, 16813.48f, 15534.845f, 1.0f}, + {16868.072f, 16813.557f, 15683.7295f, 1.0f}, + {16808.793f, 16231.943f, 15690.159f, 1.0f}, + {16789.066f, 14957.566f, 15850.314f, 1.0f}, + {16733.953f, 15601.006f, 15838.034f, 1.0f}, + {16626.137f, 15596.454f, 15939.346f, 1.0f}, + {16683.762f, 14938.399f, 15951.815f, 1.0f}, + {16801.012f, 15600.725f, 15553.727f, 1.0f}, + {16795.361f, 15602.505f, 15702.623f, 1.0f}, + {16848.97f, 14967.464f, 15714.791f, 1.0f}, + {16515.834f, 17388.438f, 15221.703f, 1.0f}, + {16797.441f, 17365.143f, 15290.302f, 1.0f}, + {16807.254f, 18401.29f, 15308.759f, 1.0f}, + {16902.55f, 18418.11f, 15418.441f, 1.0f}, + {16842.61f, 17874.309f, 15302.06f, 1.0f}, + {16941.633f, 17874.023f, 15411.709f, 1.0f}, + {16897.45f, 17355.824f, 15399.85f, 1.0f}, + {16537.918f, 18352.516f, 15239.764f, 1.0f}, + {16679.213f, 18378.256f, 15246.016f, 1.0f}, + {16563.488f, 17871.887f, 15233.174f, 1.0f}, + {16709.822f, 17873.559f, 15239.367f, 1.0f}, + {16663.438f, 17376.594f, 15227.745f, 1.0f}, + {16380.99f, 16247.807f, 15223.975f, 1.0f}, + {16663.11f, 16235.44f, 15292.115f, 1.0f}, + {16722.91f, 16828.848f, 15285.568f, 1.0f}, + {16823.129f, 16818.848f, 15395.029f, 1.0f}, + {16763.484f, 16231.719f, 15401.497f, 1.0f}, + {16440.934f, 16856.166f, 15217.213f, 1.0f}, + {16588.7f, 16841.951f, 15223.128f, 1.0f}, + {16528.797f, 16241.09f, 15229.777f, 1.0f}, + {16706.695f, 14934.655f, 15317.155f, 1.0f}, + {16650.219f, 15588.867f, 15304.755f, 1.0f}, + {16750.043f, 15595.936f, 15414.014f, 1.0f}, + {16804.389f, 14955.064f, 15426.248f, 1.0f}, + {16369.906f, 15572.377f, 15236.963f, 1.0f}, + {16516.732f, 15580.594f, 15242.583f, 1.0f}, + {16576.139f, 14908.465f, 15255.21f, 1.0f}, + {16500.83f, 18881.836f, 15990.949f, 1.0f}, + {16122.161f, 18714.33f, 15673.367f, 1.0f}, + {15195.682f, 19634.455f, 15604.33f, 1.0f}, + {15248.48f, 19673.102f, 15319.493f, 1.0f}, + {14220.497f, 20017.79f, 15195.047f, 1.0f}, + {14266.94f, 20112.031f, 15089.85f, 1.0f}, + {14781.797f, 19861.666f, 15258.471f, 1.0f}, + {14831.64f, 19953.928f, 15153.477f, 1.0f}, + {15308.234f, 19759.322f, 15215.512f, 1.0f}, + {14166.435f, 19978.402f, 15479.363f, 1.0f}, + {14185.205f, 19970.865f, 15331.826f, 1.0f}, + {14730.888f, 19821.562f, 15543.43f, 1.0f}, + {14746.417f, 19815.188f, 15395.404f, 1.0f}, + {15208.957f, 19629.254f, 15456.028f, 1.0f}, + {16185.996f, 18737.523f, 15389.332f, 1.0f}, + {15641.367f, 19430.047f, 15361.612f, 1.0f}, + {15714.366f, 19505.605f, 15258.883f, 1.0f}, + {15962.543f, 19118.797f, 15380.986f, 1.0f}, + {16048.957f, 19178.832f, 15279.326f, 1.0f}, + {16283.367f, 18777.867f, 15288.303f, 1.0f}, + {15584.791f, 19394.373f, 15646.094f, 1.0f}, + {15595.866f, 19390.986f, 15497.582f, 1.0f}, + {15902.186f, 19087.965f, 15665.18f, 1.0f}, + {15911.004f, 19086.89f, 15516.48f, 1.0f}, + {16129.388f, 18715.213f, 15524.548f, 1.0f}, + {15383.612f, 20028.068f, 15906.728f, 1.0f}, + {15251.654f, 19781.486f, 15847.57f, 1.0f}, + {14186.944f, 20144.16f, 15718.652f, 1.0f}, + {14167.045f, 20039.254f, 15615.199f, 1.0f}, + {14765.452f, 19981.111f, 15784.36f, 1.0f}, + {14737.571f, 19879.828f, 15680.014f, 1.0f}, + {15210.674f, 19687.91f, 15741.822f, 1.0f}, + {14270.012f, 20417.96f, 15772.742f, 1.0f}, + {14223.102f, 20277.145f, 15773.975f, 1.0f}, + {14865.246f, 20246.844f, 15840.128f, 1.0f}, + {14810.285f, 20109.992f, 15840.585f, 1.0f}, + {15312.383f, 19900.936f, 15905.478f, 1.0f}, + {16252.569f, 18774.105f, 15922.564f, 1.0f}, + {15667.16f, 19520.033f, 15891.832f, 1.0f}, + {15609.825f, 19439.686f, 15784.535f, 1.0f}, + {16011.373f, 19183.408f, 15913.078f, 1.0f}, + {15937.43f, 19121.855f, 15804.447f, 1.0f}, + {16165.416f, 18735.012f, 15813.133f, 1.0f}, + {15840.225f, 19733.422f, 15954.877f, 1.0f}, + {15748.066f, 19623.18f, 15951.647f, 1.0f}, + {16226.146f, 19349.22f, 15979.469f, 1.0f}, + {16112.758f, 19263.248f, 15974.537f, 1.0f}, + {16370.352f, 18825.664f, 15985.007f, 1.0f}, + {16127.336f, 14826.777f, 15687.804f, 1.0f}, + {16200.019f, 17408.266f, 15658.215f, 1.0f}, + {16268.373f, 17406.299f, 15374.098f, 1.0f}, + {16300.357f, 18308.416f, 15391.795f, 1.0f}, + {16404.883f, 18327.992f, 15290.955f, 1.0f}, + {16317.967f, 17866.898f, 15385.3125f, 1.0f}, + {16425.889f, 17869.547f, 15284.423f, 1.0f}, + {16377.107f, 17398.867f, 15273.095f, 1.0f}, + {16233.732f, 18294.816f, 15675.796f, 1.0f}, + {16240.258f, 18296.766f, 15526.934f, 1.0f}, + {16249.865f, 17862.27f, 15669.356f, 1.0f}, + {16256.155f, 17864.344f, 15520.483f, 1.0f}, + {16206.1875f, 17409.6f, 15509.334f, 1.0f}, + {16065.727f, 16265.707f, 15660.986f, 1.0f}, + {16133.547f, 16260.343f, 15376.766f, 1.0f}, + {16193.36f, 16879.436f, 15369.819f, 1.0f}, + {16302.111f, 16869.328f, 15268.724f, 1.0f}, + {16242.198f, 16254.566f, 15275.59f, 1.0f}, + {16125.209f, 16885.023f, 15653.992f, 1.0f}, + {16131.24f, 16884.947f, 15505.108f, 1.0f}, + {16071.578f, 16264.254f, 15512.1f, 1.0f}, + {16192.618f, 14835.797f, 15403.369f, 1.0f}, + {16124.28f, 15560.918f, 15390.062f, 1.0f}, + {16232.098f, 15565.469f, 15288.75f, 1.0f}, + {16297.922f, 14854.963f, 15301.868f, 1.0f}, + {16057.222f, 15561.198f, 15674.369f, 1.0f}, + {16062.872f, 15559.418f, 15525.473f, 1.0f}, + {16132.716f, 14825.899f, 15538.893f, 1.0f}, + {16632.418f, 17369.893f, 15976.223f, 1.0f}, + {16350.811f, 17393.188f, 15907.623f, 1.0f}, + {16377.072f, 18319.691f, 15925.4f, 1.0f}, + {16281.775f, 18302.867f, 15815.719f, 1.0f}, + {16399.078f, 17860.709f, 15918.917f, 1.0f}, + {16300.052f, 17860.992f, 15809.268f, 1.0f}, + {16250.802f, 17402.504f, 15798.075f, 1.0f}, + {16646.41f, 18368.46f, 15994.396f, 1.0f}, + {16505.115f, 18342.723f, 15988.144f, 1.0f}, + {16678.197f, 17863.13f, 15987.805f, 1.0f}, + {16531.865f, 17861.459f, 15981.609f, 1.0f}, + {16484.818f, 17381.736f, 15970.18f, 1.0f}, + {16499.379f, 16248.393f, 15978.283f, 1.0f}, + {16217.259f, 16260.758f, 15910.143f, 1.0f}, + {16276.402f, 16869.656f, 15903.27f, 1.0f}, + {16176.183f, 16879.654f, 15793.809f, 1.0f}, + {16116.882f, 16264.479f, 15800.761f, 1.0f}, + {16558.375f, 16842.336f, 15971.625f, 1.0f}, + {16410.613f, 16856.553f, 15965.709f, 1.0f}, + {16351.574f, 16255.108f, 15972.4795f, 1.0f}, + {16274.991f, 14858.707f, 15936.528f, 1.0f}, + {16208.016f, 15573.056f, 15923.34f, 1.0f}, + {16108.189f, 15565.987f, 15814.08f, 1.0f}, + {16177.295f, 14838.298f, 15827.436f, 1.0f}, + {16488.328f, 15589.545f, 15991.133f, 1.0f}, + {16341.503f, 15581.328f, 15985.513f, 1.0f}, + {16405.549f, 14884.897f, 15998.474f, 1.0f}, + {22062.893f, 13199.553f, 14102.437f, 1.0f}, + {19133.176f, 12040.387f, 15088.4375f, 1.0f}, + {19302.828f, 12431.652f, 15416.752f, 1.0f}, + {17506.05f, 13485.198f, 15574.865f, 1.0f}, + {17457.24f, 13443.031f, 15859.422f, 1.0f}, + {16925.35f, 14376.846f, 15857.643f, 1.0f}, + {16825.14f, 14340.997f, 15959.3125f, 1.0f}, + {17148.55f, 13881.254f, 15859.609f, 1.0f}, + {17056.438f, 13828.556f, 15961.376f, 1.0f}, + {17376.229f, 13374.63f, 15961.154f, 1.0f}, + {16987.184f, 14397.118f, 15573.092f, 1.0f}, + {16982.252f, 14396.553f, 15722.02f, 1.0f}, + {17204.99f, 13912.858f, 15574.992f, 1.0f}, + {17200.715f, 13910.857f, 15723.93f, 1.0f}, + {17502.828f, 13481.859f, 15723.774f, 1.0f}, + {18307.406f, 12808.68f, 15569.474f, 1.0f}, + {18291.45f, 12743.744f, 15851.491f, 1.0f}, + {17842.707f, 13056.316f, 15858.601f, 1.0f}, + {17776.121f, 12973.874f, 15959.885f, 1.0f}, + {18243.121f, 12648.871f, 15951.4f, 1.0f}, + {17879.258f, 13109.041f, 15574.657f, 1.0f}, + {17878.924f, 13103.781f, 15723.326f, 1.0f}, + {18314.023f, 12799.862f, 15717.376f, 1.0f}, + {19347.34f, 12343.651f, 15688.541f, 1.0f}, + {18795.25f, 12510.829f, 15808.62f, 1.0f}, + {18768.373f, 12405.597f, 15905.736f, 1.0f}, + {19343.283f, 12231.11f, 15781.162f, 1.0f}, + {18782.598f, 12588.664f, 15530.549f, 1.0f}, + {18800.246f, 12575.115f, 15676.871f, 1.0f}, + {19333.133f, 12414.074f, 15560.578f, 1.0f}, + {17176.984f, 13210.467f, 15259.832f, 1.0f}, + {17389.965f, 13388.867f, 15326.507f, 1.0f}, + {16846.16f, 14343.41f, 15324.586f, 1.0f}, + {16939.393f, 14378.457f, 15433.533f, 1.0f}, + {17074.656f, 13837.09f, 15326.611f, 1.0f}, + {17160.723f, 13886.955f, 15435.473f, 1.0f}, + {17466.418f, 13452.545f, 15435.363f, 1.0f}, + {16584.887f, 14247.18f, 15257.695f, 1.0f}, + {16721.672f, 14297.312f, 15262.841f, 1.0f}, + {16833.898f, 13698.329f, 15259.963f, 1.0f}, + {16959.89f, 13770.853f, 15264.98f, 1.0f}, + {17288.328f, 13303.86f, 15264.869f, 1.0f}, + {18068.152f, 12448.671f, 15251.729f, 1.0f}, + {18214.914f, 12686.457f, 15321.044f, 1.0f}, + {17777.545f, 12996.298f, 15326.261f, 1.0f}, + {17843.656f, 13071.299f, 15435.227f, 1.0f}, + {18272.602f, 12768.856f, 15430.301f, 1.0f}, + {17597.152f, 12784.127f, 15258.92f, 1.0f}, + {17690.984f, 12895.456f, 15264.351f, 1.0f}, + {18143.121f, 12574.022f, 15258.338f, 1.0f}, + {19214.117f, 12306.038f, 15168.181f, 1.0f}, + {18693.17f, 12463.346f, 15282.111f, 1.0f}, + {18745.0f, 12549.416f, 15391.928f, 1.0f}, + {19261.033f, 12393.715f, 15278.961f, 1.0f}, + {18579.346f, 12208.285f, 15208.842f, 1.0f}, + {18635.0f, 12343.557f, 15217.821f, 1.0f}, + {19169.219f, 12181.965f, 15101.278f, 1.0f}, + {21816.621f, 13307.162f, 14564.068f, 1.0f}, + {20808.926f, 12395.496f, 14891.332f, 1.0f}, + {20922.623f, 12302.923f, 15143.26f, 1.0f}, + {19917.02f, 12245.258f, 15501.891f, 1.0f}, + {19935.088f, 12128.91f, 15588.73f, 1.0f}, + {20453.055f, 12234.274f, 15308.659f, 1.0f}, + {20491.02f, 12117.601f, 15389.365f, 1.0f}, + {20979.26f, 12190.21f, 15217.666f, 1.0f}, + {19842.943f, 12338.936f, 15237.657f, 1.0f}, + {19884.664f, 12319.011f, 15378.609f, 1.0f}, + {20356.146f, 12329.467f, 15051.207f, 1.0f}, + {20405.691f, 12308.673f, 15189.913f, 1.0f}, + {20862.809f, 12375.012f, 15028.666f, 1.0f}, + {21477.766f, 12669.672f, 14656.39f, 1.0f}, + {21623.646f, 12597.104f, 14897.457f, 1.0f}, + {21315.71f, 12421.374f, 15005.28f, 1.0f}, + {21392.664f, 12318.579f, 15072.714f, 1.0f}, + {21722.65f, 12511.56f, 14957.57f, 1.0f}, + {21186.293f, 12506.543f, 14758.733f, 1.0f}, + {21243.244f, 12487.379f, 14895.025f, 1.0f}, + {21537.652f, 12652.627f, 14791.697f, 1.0f}, + {21986.754f, 13266.264f, 14797.781f, 1.0f}, + {21840.125f, 12873.65f, 14829.761f, 1.0f}, + {21959.518f, 12811.9795f, 14883.531f, 1.0f}, + {22119.69f, 13226.274f, 14847.678f, 1.0f}, + {21679.477f, 12929.411f, 14593.313f, 1.0f}, + {21741.785f, 12914.888f, 14727.85f, 1.0f}, + {21880.328f, 13294.668f, 14698.192f, 1.0f}, + {20779.422f, 12018.104f, 14518.021f, 1.0f}, + {20749.611f, 12277.52f, 14632.351f, 1.0f}, + {19757.281f, 12213.835f, 14987.992f, 1.0f}, + {19798.213f, 12302.002f, 15100.491f, 1.0f}, + {20279.86f, 12206.226f, 14798.202f, 1.0f}, + {20311.96f, 12293.491f, 14913.656f, 1.0f}, + {20769.178f, 12361.262f, 14752.165f, 1.0f}, + {19710.21f, 11943.238f, 14899.147f, 1.0f}, + {19726.379f, 12087.854f, 14917.291f, 1.0f}, + {20268.879f, 11936.745f, 14697.853f, 1.0f}, + {20264.732f, 12080.953f, 14722.423f, 1.0f}, + {20753.209f, 12157.019f, 14550.131f, 1.0f}, + {21598.645f, 12390.775f, 14232.353f, 1.0f}, + {21467.408f, 12584.207f, 14380.893f, 1.0f}, + {21149.938f, 12400.256f, 14491.84f, 1.0f}, + {21153.527f, 12475.949f, 14617.153f, 1.0f}, + {21453.098f, 12645.6455f, 14512.134f, 1.0f}, + {21227.945f, 12164.775f, 14360.943f, 1.0f}, + {21176.07f, 12290.985f, 14401.871f, 1.0f}, + {21518.518f, 12494.708f, 14282.647f, 1.0f}, + {21848.158f, 13279.531f, 14276.047f, 1.0f}, + {21693.951f, 12873.883f, 14310.142f, 1.0f}, + {21662.68f, 12915.012f, 14446.634f, 1.0f}, + {21805.324f, 13301.848f, 14415.83f, 1.0f}, + {21875.074f, 12739.592f, 14146.124f, 1.0f}, + {21768.535f, 12812.283f, 14204.617f, 1.0f}, + {21938.605f, 13243.61f, 14165.998f, 1.0f}, + {19321.582f, 12093.585f, 15824.339f, 1.0f}, + {19151.932f, 11702.321f, 15496.023f, 1.0f}, + {16943.06f, 13012.338f, 15698.452f, 1.0f}, + {16991.871f, 13054.505f, 15413.8955f, 1.0f}, + {16356.42f, 14164.803f, 15411.604f, 1.0f}, + {16456.629f, 14200.65f, 15309.934f, 1.0f}, + {16623.752f, 13577.865f, 15414.088f, 1.0f}, + {16715.865f, 13630.562f, 15312.321f, 1.0f}, + {17072.883f, 13122.906f, 15312.163f, 1.0f}, + {16294.587f, 14144.529f, 15696.153f, 1.0f}, + {16299.519f, 14145.096f, 15547.226f, 1.0f}, + {16567.312f, 13546.262f, 15698.703f, 1.0f}, + {16571.588f, 13548.263f, 15549.767f, 1.0f}, + {16946.283f, 13015.678f, 15549.543f, 1.0f}, + {17937.14f, 12169.681f, 15684.147f, 1.0f}, + {17953.098f, 12234.617f, 15402.131f, 1.0f}, + {17443.754f, 12596.82f, 15412.078f, 1.0f}, + {17510.338f, 12679.261f, 15310.795f, 1.0f}, + {18001.428f, 12329.488f, 15302.222f, 1.0f}, + {17407.205f, 12544.094f, 15696.021f, 1.0f}, + {17407.54f, 12549.355f, 15547.352f, 1.0f}, + {17930.523f, 12178.499f, 15536.245f, 1.0f}, + {19107.418f, 11790.322f, 15224.234f, 1.0f}, + {18507.809f, 11972.895f, 15353.657f, 1.0f}, + {18534.684f, 12078.127f, 15256.541f, 1.0f}, + {19111.477f, 11902.863f, 15131.613f, 1.0f}, + {18520.457f, 11895.061f, 15631.729f, 1.0f}, + {18502.812f, 11908.61f, 15485.405f, 1.0f}, + {19121.625f, 11719.9f, 15352.197f, 1.0f}, + {17272.129f, 13287.069f, 16013.486f, 1.0f}, + {17059.146f, 13108.669f, 15946.81f, 1.0f}, + {16435.61f, 14198.238f, 15944.66f, 1.0f}, + {16342.375f, 14163.19f, 15835.714f, 1.0f}, + {16697.646f, 13622.031f, 15947.085f, 1.0f}, + {16611.578f, 13572.164f, 15838.224f, 1.0f}, + {16982.693f, 13044.992f, 15837.953f, 1.0f}, + {16696.88f, 14294.467f, 16011.551f, 1.0f}, + {16560.098f, 14244.336f, 16006.405f, 1.0f}, + {16938.402f, 13760.789f, 16013.734f, 1.0f}, + {16812.412f, 13688.268f, 16008.717f, 1.0f}, + {17160.781f, 13193.676f, 16008.449f, 1.0f}, + {18176.395f, 12529.689f, 16001.893f, 1.0f}, + {18029.633f, 12291.904f, 15932.577f, 1.0f}, + {17508.916f, 12656.838f, 15944.417f, 1.0f}, + {17442.803f, 12581.837f, 15835.452f, 1.0f}, + {17971.943f, 12209.504f, 15823.32f, 1.0f}, + {17689.309f, 12869.008f, 16011.76f, 1.0f}, + {17595.477f, 12757.68f, 16006.327f, 1.0f}, + {18101.426f, 12404.339f, 15995.283f, 1.0f}, + {19240.64f, 11827.937f, 15744.595f, 1.0f}, + {18609.887f, 12020.378f, 15880.165f, 1.0f}, + {18558.059f, 11934.307f, 15770.35f, 1.0f}, + {19193.723f, 11740.257f, 15633.814f, 1.0f}, + {18723.71f, 12275.438f, 15953.436f, 1.0f}, + {18668.059f, 12140.168f, 15944.456f, 1.0f}, + {19285.537f, 11952.009f, 15811.497f, 1.0f}, + {22505.164f, 13073.183f, 14378.65f, 1.0f}, + {20994.592f, 11676.641f, 14867.245f, 1.0f}, + {20880.896f, 11769.213f, 14615.318f, 1.0f}, + {19729.309f, 11685.662f, 15023.165f, 1.0f}, + {19711.24f, 11802.01f, 14936.325f, 1.0f}, + {20329.637f, 11678.887f, 14808.94f, 1.0f}, + {20291.67f, 11795.561f, 14728.234f, 1.0f}, + {20824.262f, 11881.926f, 14540.913f, 1.0f}, + {19803.385f, 11591.986f, 15287.397f, 1.0f}, + {19761.664f, 11611.911f, 15146.445f, 1.0f}, + {20426.541f, 11583.695f, 15066.393f, 1.0f}, + {20376.996f, 11604.49f, 14927.687f, 1.0f}, + {20940.709f, 11697.126f, 14729.911f, 1.0f}, + {21940.475f, 12130.122f, 14538.847f, 1.0f}, + {21794.594f, 12202.689f, 14297.779f, 1.0f}, + {21374.613f, 11938.044f, 14442.721f, 1.0f}, + {21297.662f, 12040.84f, 14375.288f, 1.0f}, + {21695.588f, 12288.232f, 14237.666f, 1.0f}, + {21504.031f, 11852.876f, 14689.268f, 1.0f}, + {21447.078f, 11872.04f, 14552.976f, 1.0f}, + {21880.584f, 12147.168f, 14403.54f, 1.0f}, + {22335.033f, 13114.081f, 14144.936f, 1.0f}, + {22116.74f, 12605.205f, 14197.339f, 1.0f}, + {21997.346f, 12666.876f, 14143.568f, 1.0f}, + {22202.1f, 13154.069f, 14095.041f, 1.0f}, + {22277.387f, 12549.445f, 14433.785f, 1.0f}, + {22215.076f, 12563.97f, 14299.25f, 1.0f}, + {22441.455f, 13085.678f, 14244.525f, 1.0f}, + {21024.098f, 12054.031f, 15240.557f, 1.0f}, + {21053.908f, 11794.617f, 15126.228f, 1.0f}, + {19889.047f, 11717.087f, 15537.062f, 1.0f}, + {19848.115f, 11628.918f, 15424.563f, 1.0f}, + {20502.83f, 11706.936f, 15319.396f, 1.0f}, + {20470.729f, 11619.67f, 15203.943f, 1.0f}, + {21034.342f, 11710.875f, 15006.413f, 1.0f}, + {19936.117f, 11987.682f, 15625.908f, 1.0f}, + {19919.95f, 11843.068f, 15607.764f, 1.0f}, + {20513.81f, 11976.415f, 15419.747f, 1.0f}, + {20517.959f, 11832.209f, 15395.177f, 1.0f}, + {21050.31f, 11915.117f, 15208.447f, 1.0f}, + {21819.596f, 12409.017f, 14962.883f, 1.0f}, + {21950.83f, 12215.586f, 14814.343f, 1.0f}, + {21540.385f, 11959.163f, 14956.161f, 1.0f}, + {21536.795f, 11883.47f, 14830.848f, 1.0f}, + {21965.14f, 12154.147f, 14683.102f, 1.0f}, + {21462.38f, 12194.644f, 15087.059f, 1.0f}, + {21514.254f, 12068.434f, 15046.129f, 1.0f}, + {21899.72f, 12305.085f, 14912.588f, 1.0f}, + {22473.627f, 13100.814f, 14666.671f, 1.0f}, + {22262.91f, 12604.975f, 14716.957f, 1.0f}, + {22294.184f, 12563.844f, 14580.465f, 1.0f}, + {22516.465f, 13078.497f, 14526.887f, 1.0f}, + {22081.79f, 12739.266f, 14880.977f, 1.0f}, + {22188.326f, 12666.574f, 14822.482f, 1.0f}, + {22383.18f, 13136.735f, 14776.721f, 1.0f}, +}; +float D_L06_001E4A30[864][4] = { + {-0.253345f, 0.027806f, -0.966976f, 1.0f}, + {0.063477f, -0.234485f, -0.970045f, 1.0f}, + {0.012536f, -0.179942f, -0.983597f, 1.0f}, + {-0.012659f, 0.179885f, 0.983606f, 1.0f}, + {-0.16365f, 0.006483f, 0.986497f, 1.0f}, + {-0.910584f, 0.394052f, -0.124738f, 1.0f}, + {-0.970505f, -0.134215f, -0.200267f, 1.0f}, + {-0.56425f, 0.030375f, -0.825045f, 1.0f}, + {-0.555561f, 0.002566f, -0.831472f, 1.0f}, + {-0.195028f, 0.025179f, -0.980474f, 1.0f}, + {-0.55762f, 0.011139f, -0.830022f, 1.0f}, + {-0.200744f, 0.073727f, -0.976866f, 1.0f}, + {-0.20797f, 0.112931f, -0.971594f, 1.0f}, + {-0.98002f, -0.039554f, -0.194924f, 1.0f}, + {-0.831299f, -0.020165f, -0.555459f, 1.0f}, + {-0.973662f, -0.110914f, -0.199197f, 1.0f}, + {-0.828941f, -0.053917f, -0.556731f, 1.0f}, + {-0.831057f, -0.057419f, -0.553215f, 1.0f}, + {-0.546413f, 0.284051f, -0.787876f, 1.0f}, + {-0.568684f, 0.086089f, -0.818039f, 1.0f}, + {-0.209894f, 0.141613f, -0.967414f, 1.0f}, + {-0.57079f, 0.178974f, -0.801353f, 1.0f}, + {-0.209497f, 0.147759f, -0.966581f, 1.0f}, + {-0.208506f, 0.151368f, -0.966236f, 1.0f}, + {-0.982489f, -0.047578f, -0.180142f, 1.0f}, + {-0.845651f, 0.015252f, -0.533519f, 1.0f}, + {-0.975772f, 0.162878f, -0.146084f, 1.0f}, + {-0.843845f, 0.181631f, -0.504913f, 1.0f}, + {-0.791102f, 0.36808f, -0.488543f, 1.0f}, + {-0.181284f, -0.182146f, 0.966415f, 1.0f}, + {-0.814649f, -0.223346f, 0.535223f, 1.0f}, + {-0.830073f, -0.058031f, 0.554627f, 1.0f}, + {-0.979418f, -0.052784f, 0.194817f, 1.0f}, + {-0.820088f, -0.168562f, 0.546848f, 1.0f}, + {-0.970463f, -0.151031f, 0.188125f, 1.0f}, + {-0.964577f, -0.192222f, 0.180669f, 1.0f}, + {-0.19491f, -0.042938f, 0.979881f, 1.0f}, + {-0.55473f, -0.054591f, 0.830238f, 1.0f}, + {-0.186606f, -0.126612f, 0.974242f, 1.0f}, + {-0.54502f, -0.160111f, 0.822993f, 1.0f}, + {-0.540815f, -0.219231f, 0.812069f, 1.0f}, + {-0.757033f, 0.282561f, 0.589118f, 1.0f}, + {-0.822346f, -0.156744f, 0.546972f, 1.0f}, + {-0.975066f, -0.108175f, 0.193762f, 1.0f}, + {-0.81947f, 0.051733f, 0.570783f, 1.0f}, + {-0.967358f, 0.116872f, 0.224855f, 1.0f}, + {-0.897298f, 0.36399f, 0.249735f, 1.0f}, + {-0.191246f, -0.179436f, 0.965002f, 1.0f}, + {-0.555347f, -0.178672f, 0.812198f, 1.0f}, + {-0.193226f, -0.093647f, 0.976675f, 1.0f}, + {-0.554575f, -0.018928f, 0.831918f, 1.0f}, + {-0.503075f, 0.158405f, 0.849602f, 1.0f}, + {-0.35274f, 0.919987f, -0.170874f, 1.0f}, + {-0.542969f, 0.827337f, -0.143867f, 1.0f}, + {-0.385232f, 0.468227f, -0.795211f, 1.0f}, + {-0.498522f, 0.3712f, -0.783381f, 1.0f}, + {-0.20563f, 0.156679f, -0.966006f, 1.0f}, + {-0.443654f, 0.42784f, -0.787479f, 1.0f}, + {-0.204357f, 0.156941f, -0.966234f, 1.0f}, + {-0.206607f, 0.154361f, -0.966171f, 1.0f}, + {-0.801119f, 0.587159f, -0.115988f, 1.0f}, + {-0.705775f, 0.520423f, -0.480668f, 1.0f}, + {-0.679376f, 0.722659f, -0.127329f, 1.0f}, + {-0.605966f, 0.623523f, -0.493988f, 1.0f}, + {-0.499702f, 0.701044f, -0.508759f, 1.0f}, + {-0.378366f, 0.91002f, -0.16942f, 1.0f}, + {-0.311169f, 0.498816f, -0.808923f, 1.0f}, + {-0.337785f, 0.490337f, -0.803412f, 1.0f}, + {-0.207793f, 0.153714f, -0.96602f, 1.0f}, + {-0.201728f, 0.156812f, -0.966807f, 1.0f}, + {-0.430517f, 0.888891f, -0.156616f, 1.0f}, + {-0.415931f, 0.747702f, -0.517632f, 1.0f}, + {-0.372281f, 0.761756f, -0.530222f, 1.0f}, + {-0.241432f, 0.523797f, -0.816914f, 1.0f}, + {-0.280139f, 0.509326f, -0.813701f, 1.0f}, + {-0.172425f, 0.168547f, -0.970495f, 1.0f}, + {-0.123906f, 0.186015f, -0.974703f, 1.0f}, + {-0.357038f, 0.918162f, -0.171763f, 1.0f}, + {-0.34482f, 0.772524f, -0.533204f, 1.0f}, + {-0.321742f, 0.781576f, -0.534435f, 1.0f}, + {-0.000721f, 0.180389f, 0.983595f, 1.0f}, + {-0.386469f, 0.710393f, 0.588203f, 1.0f}, + {-0.64958f, 0.473755f, 0.594644f, 1.0f}, + {-0.780398f, 0.56992f, 0.257235f, 1.0f}, + {-0.527232f, 0.608368f, 0.593224f, 1.0f}, + {-0.650211f, 0.716355f, 0.253102f, 1.0f}, + {-0.502143f, 0.830801f, 0.240045f, 1.0f}, + {-0.117185f, 0.083304f, 0.98961f, 1.0f}, + {-0.418015f, 0.302397f, 0.856632f, 1.0f}, + {-0.063792f, 0.137753f, 0.98841f, 1.0f}, + {-0.321763f, 0.404134f, 0.856239f, 1.0f}, + {-0.211019f, 0.482921f, 0.849858f, 1.0f}, + {0.063227f, 0.207952f, 0.976093f, 1.0f}, + {-0.223687f, 0.790244f, 0.570507f, 1.0f}, + {-0.272861f, 0.773017f, 0.572705f, 1.0f}, + {-0.380188f, 0.897182f, 0.22477f, 1.0f}, + {-0.325878f, 0.920157f, 0.217059f, 1.0f}, + {0.048081f, 0.203481f, 0.977898f, 1.0f}, + {-0.122221f, 0.527582f, 0.840666f, 1.0f}, + {-0.087042f, 0.54012f, 0.837075f, 1.0f}, + {-0.25761f, 0.777395f, 0.573841f, 1.0f}, + {-0.22445f, 0.789957f, 0.570605f, 1.0f}, + {-0.314875f, 0.924283f, 0.215763f, 1.0f}, + {-0.330116f, 0.918385f, 0.218156f, 1.0f}, + {0.039378f, 0.198784f, 0.979252f, 1.0f}, + {-0.099962f, 0.534725f, 0.839093f, 1.0f}, + {-0.146172f, 0.518266f, 0.842635f, 1.0f}, + {0.163467f, -0.00681f, -0.986525f, 1.0f}, + {0.907037f, -0.402219f, 0.124516f, 1.0f}, + {0.968554f, 0.145643f, 0.201719f, 1.0f}, + {0.563827f, -0.02594f, 0.825486f, 1.0f}, + {0.555561f, -0.002405f, 0.831472f, 1.0f}, + {0.195033f, -0.024667f, 0.980486f, 1.0f}, + {0.557444f, -0.009775f, 0.830157f, 1.0f}, + {0.200802f, -0.0742f, 0.976818f, 1.0f}, + {0.208061f, -0.114227f, 0.971423f, 1.0f}, + {0.979978f, 0.040498f, 0.194942f, 1.0f}, + {0.831299f, 0.020507f, 0.555446f, 1.0f}, + {0.973583f, 0.111448f, 0.199286f, 1.0f}, + {0.828759f, 0.055224f, 0.556874f, 1.0f}, + {0.830107f, 0.064296f, 0.553885f, 1.0f}, + {0.545909f, -0.285057f, 0.787862f, 1.0f}, + {0.568097f, -0.077121f, 0.81934f, 1.0f}, + {0.209929f, -0.14217f, 0.967325f, 1.0f}, + {0.571406f, -0.171755f, 0.802493f, 1.0f}, + {0.209484f, -0.147942f, 0.966555f, 1.0f}, + {0.208484f, -0.151406f, 0.966235f, 1.0f}, + {0.979009f, 0.087008f, 0.18431f, 1.0f}, + {0.845035f, 0.002283f, 0.534706f, 1.0f}, + {0.980442f, -0.129009f, 0.148628f, 1.0f}, + {0.846321f, -0.168026f, 0.505477f, 1.0f}, + {0.789267f, -0.37203f, 0.488519f, 1.0f}, + {0.181399f, 0.180675f, -0.96667f, 1.0f}, + {0.813813f, 0.228982f, -0.534112f, 1.0f}, + {0.829971f, 0.059996f, -0.554571f, 1.0f}, + {0.979331f, 0.054401f, -0.194812f, 1.0f}, + {0.820279f, 0.166834f, -0.547091f, 1.0f}, + {0.970505f, 0.150712f, -0.188165f, 1.0f}, + {0.962647f, 0.203288f, -0.178842f, 1.0f}, + {0.194903f, 0.044123f, -0.97983f, 1.0f}, + {0.554685f, 0.05638f, -0.830148f, 1.0f}, + {0.186711f, 0.125703f, -0.97434f, 1.0f}, + {0.54528f, 0.158008f, -0.823227f, 1.0f}, + {0.540484f, 0.22235f, -0.811441f, 1.0f}, + {0.753494f, -0.290326f, -0.589879f, 1.0f}, + {0.81911f, 0.188917f, -0.541636f, 1.0f}, + {0.970709f, 0.150352f, -0.187398f, 1.0f}, + {0.822824f, -0.022195f, -0.567862f, 1.0f}, + {0.972048f, -0.080536f, -0.220538f, 1.0f}, + {0.893517f, -0.372788f, -0.250315f, 1.0f}, + {0.191375f, 0.181868f, -0.964521f, 1.0f}, + {0.555335f, 0.203563f, -0.806328f, 1.0f}, + {0.194082f, 0.09688f, -0.97619f, 1.0f}, + {0.559474f, 0.041425f, -0.827812f, 1.0f}, + {0.500728f, -0.163162f, -0.850088f, 1.0f}, + {0.353818f, -0.919579f, 0.170844f, 1.0f}, + {0.524216f, -0.838931f, 0.146262f, 1.0f}, + {0.381081f, -0.471337f, 0.795373f, 1.0f}, + {0.495731f, -0.375928f, 0.782898f, 1.0f}, + {0.205737f, -0.156478f, 0.966016f, 1.0f}, + {0.439904f, -0.431915f, 0.787359f, 1.0f}, + {0.204477f, -0.156802f, 0.966231f, 1.0f}, + {0.206643f, -0.154324f, 0.966169f, 1.0f}, + {0.789122f, -0.603392f, 0.114911f, 1.0f}, + {0.69808f, -0.53184f, 0.479406f, 1.0f}, + {0.663914f, -0.736609f, 0.128939f, 1.0f}, + {0.598848f, -0.629684f, 0.494853f, 1.0f}, + {0.491668f, -0.705919f, 0.509844f, 1.0f}, + {0.372939f, -0.912139f, 0.170055f, 1.0f}, + {0.310361f, -0.499188f, 0.809004f, 1.0f}, + {0.335402f, -0.491664f, 0.803599f, 1.0f}, + {0.208086f, -0.153542f, 0.965984f, 1.0f}, + {0.202433f, -0.156488f, 0.966712f, 1.0f}, + {0.417507f, -0.894849f, 0.157904f, 1.0f}, + {0.407974f, -0.751673f, 0.518214f, 1.0f}, + {0.370202f, -0.762612f, 0.530447f, 1.0f}, + {0.24097f, -0.52398f, 0.816932f, 1.0f}, + {0.279591f, -0.509542f, 0.813754f, 1.0f}, + {0.172934f, -0.16835f, 0.970439f, 1.0f}, + {0.123512f, -0.186175f, 0.974722f, 1.0f}, + {0.356064f, -0.918515f, 0.171896f, 1.0f}, + {0.343982f, -0.772853f, 0.533268f, 1.0f}, + {0.321888f, -0.781528f, 0.534418f, 1.0f}, + {-0.000854f, -0.181304f, -0.983427f, 1.0f}, + {0.367512f, -0.721949f, -0.586281f, 1.0f}, + {0.640494f, -0.486838f, -0.593933f, 1.0f}, + {0.767697f, -0.586931f, -0.257203f, 1.0f}, + {0.5152f, -0.619955f, -0.591798f, 1.0f}, + {0.633864f, -0.731245f, -0.251989f, 1.0f}, + {0.481836f, -0.843388f, -0.237759f, 1.0f}, + {0.116383f, -0.08424f, -0.989626f, 1.0f}, + {0.410494f, -0.311617f, -0.856965f, 1.0f}, + {0.062736f, -0.138597f, -0.98836f, 1.0f}, + {0.312126f, -0.412216f, -0.855953f, 1.0f}, + {0.198602f, -0.490329f, -0.848607f, 1.0f}, + {-0.062911f, -0.207821f, -0.976142f, 1.0f}, + {0.218367f, -0.79222f, -0.569828f, 1.0f}, + {0.261457f, -0.778443f, -0.570672f, 1.0f}, + {0.365982f, -0.903561f, -0.222786f, 1.0f}, + {0.31994f, -0.922402f, -0.216363f, 1.0f}, + {-0.049109f, -0.203952f, -0.977748f, 1.0f}, + {0.113334f, -0.531576f, -0.839394f, 1.0f}, + {0.08395f, -0.541304f, -0.836625f, 1.0f}, + {0.259453f, -0.776683f, -0.573975f, 1.0f}, + {0.224758f, -0.789832f, -0.570657f, 1.0f}, + {0.314137f, -0.924555f, -0.215676f, 1.0f}, + {0.3319f, -0.917719f, -0.218251f, 1.0f}, + {-0.038643f, -0.198502f, -0.979338f, 1.0f}, + {0.100578f, -0.534506f, -0.839159f, 1.0f}, + {0.147409f, -0.517786f, -0.842715f, 1.0f}, + {-0.063024f, 0.234339f, 0.97011f, 1.0f}, + {-0.08056f, 0.20408f, 0.975634f, 1.0f}, + {-0.993043f, 0.064962f, -0.098215f, 1.0f}, + {-0.527926f, 0.832286f, -0.169099f, 1.0f}, + {-0.311981f, 0.492202f, -0.812653f, 1.0f}, + {-0.22535f, 0.530171f, -0.817396f, 1.0f}, + {-0.096044f, 0.197321f, -0.975623f, 1.0f}, + {-0.24634f, 0.524146f, -0.815222f, 1.0f}, + {-0.098291f, 0.198105f, -0.97524f, 1.0f}, + {-0.12246f, 0.187471f, -0.974607f, 1.0f}, + {-0.366379f, 0.91475f, -0.170291f, 1.0f}, + {-0.320147f, 0.782194f, -0.534489f, 1.0f}, + {-0.412551f, 0.895574f, -0.166578f, 1.0f}, + {-0.359409f, 0.771217f, -0.525404f, 1.0f}, + {-0.457419f, 0.719551f, -0.522508f, 1.0f}, + {-0.862541f, 0.480285f, -0.159215f, 1.0f}, + {-0.546229f, 0.259713f, -0.796356f, 1.0f}, + {-0.424413f, 0.407612f, -0.808534f, 1.0f}, + {-0.171195f, 0.154006f, -0.973126f, 1.0f}, + {-0.243485f, 0.072801f, -0.967168f, 1.0f}, + {-0.709507f, 0.684648f, -0.166906f, 1.0f}, + {-0.612251f, 0.591834f, -0.524291f, 1.0f}, + {-0.759969f, 0.400449f, -0.511945f, 1.0f}, + {-0.659654f, -0.098777f, -0.74505f, 1.0f}, + {-0.629039f, 0.075545f, -0.773694f, 1.0f}, + {-0.30335f, -0.052405f, -0.951437f, 1.0f}, + {-0.321667f, -0.162523f, -0.9328f, 1.0f}, + {-0.951294f, 0.27696f, -0.1354f, 1.0f}, + {-0.852421f, 0.190315f, -0.48699f, 1.0f}, + {-0.890779f, -0.018687f, -0.454053f, 1.0f}, + {-0.093761f, 0.143621f, 0.985181f, 1.0f}, + {-0.450096f, 0.694525f, 0.561292f, 1.0f}, + {-0.294958f, 0.762495f, 0.575848f, 1.0f}, + {-0.357557f, 0.907715f, 0.219558f, 1.0f}, + {-0.345284f, 0.747594f, 0.567346f, 1.0f}, + {-0.407335f, 0.887717f, 0.214564f, 1.0f}, + {-0.524654f, 0.825609f, 0.207623f, 1.0f}, + {-0.050413f, 0.164382f, 0.985108f, 1.0f}, + {-0.187401f, 0.501442f, 0.844652f, 1.0f}, + {-0.070747f, 0.158444f, 0.98483f, 1.0f}, + {-0.2261f, 0.493789f, 0.839674f, 1.0f}, + {-0.297311f, 0.458151f, 0.837677f, 1.0f}, + {-0.100044f, 0.128216f, 0.986687f, 1.0f}, + {-0.695672f, 0.433513f, 0.572806f, 1.0f}, + {-0.594501f, 0.569722f, 0.567438f, 1.0f}, + {-0.702505f, 0.678758f, 0.213947f, 1.0f}, + {-0.841973f, 0.493262f, 0.218573f, 1.0f}, + {-0.112374f, 0.119412f, 0.986465f, 1.0f}, + {-0.389244f, 0.376572f, 0.840644f, 1.0f}, + {-0.435628f, 0.305527f, 0.846689f, 1.0f}, + {-0.769596f, 0.193535f, 0.608496f, 1.0f}, + {-0.742913f, 0.325656f, 0.584832f, 1.0f}, + {-0.915383f, 0.324869f, 0.237771f, 1.0f}, + {-0.952151f, 0.138563f, 0.272415f, 1.0f}, + {-0.081175f, 0.177469f, 0.980773f, 1.0f}, + {-0.450498f, 0.275095f, 0.849338f, 1.0f}, + {-0.464364f, 0.217921f, 0.858415f, 1.0f}, + {-0.250854f, -0.944171f, 0.213572f, 1.0f}, + {-0.895852f, -0.444228f, 0.010483f, 1.0f}, + {-0.585808f, -0.456417f, -0.669711f, 1.0f}, + {-0.65275f, -0.24756f, -0.715983f, 1.0f}, + {-0.314697f, -0.241571f, -0.917938f, 1.0f}, + {-0.624967f, -0.360963f, -0.692186f, 1.0f}, + {-0.29836f, -0.302657f, -0.905196f, 1.0f}, + {-0.276003f, -0.360999f, -0.890787f, 1.0f}, + {-0.987074f, -0.150645f, -0.054693f, 1.0f}, + {-0.88521f, -0.214947f, -0.412556f, 1.0f}, + {-0.948214f, -0.31714f, -0.0177f, 1.0f}, + {-0.849526f, -0.36458f, -0.381297f, 1.0f}, + {-0.801175f, -0.484995f, -0.350569f, 1.0f}, + {-0.598127f, -0.789785f, 0.135953f, 1.0f}, + {-0.333373f, -0.756257f, -0.562973f, 1.0f}, + {-0.503761f, -0.590944f, -0.630088f, 1.0f}, + {-0.22284f, -0.45154f, -0.863976f, 1.0f}, + {-0.113493f, -0.55867f, -0.821588f, 1.0f}, + {-0.799327f, -0.598223f, 0.056616f, 1.0f}, + {-0.703635f, -0.640644f, -0.307366f, 1.0f}, + {-0.501541f, -0.834187f, -0.229321f, 1.0f}, + {-0.137747f, -0.834189f, -0.533998f, 1.0f}, + {-0.18213f, -0.832939f, -0.522533f, 1.0f}, + {-0.039424f, -0.592581f, -0.804546f, 1.0f}, + {-0.041502f, -0.578626f, -0.814537f, 1.0f}, + {-0.366841f, -0.909715f, 0.194541f, 1.0f}, + {-0.298442f, -0.938631f, -0.172928f, 1.0f}, + {-0.210528f, -0.96222f, -0.172655f, 1.0f}, + {-0.077333f, 0.207186f, 0.97524f, 1.0f}, + {-0.69827f, -0.180334f, 0.692747f, 1.0f}, + {-0.767865f, 0.034408f, 0.639687f, 1.0f}, + {-0.947767f, -0.06532f, 0.312205f, 1.0f}, + {-0.736473f, -0.092005f, 0.67018f, 1.0f}, + {-0.909876f, -0.221438f, 0.350844f, 1.0f}, + {-0.862144f, -0.336818f, 0.378499f, 1.0f}, + {-0.080537f, 0.199866f, 0.976508f, 1.0f}, + {-0.463903f, 0.127782f, 0.876622f, 1.0f}, + {-0.078319f, 0.19751f, 0.977167f, 1.0f}, + {-0.443857f, 0.055813f, 0.894358f, 1.0f}, + {-0.424459f, 0.011131f, 0.905379f, 1.0f}, + {-0.135416f, 0.262816f, 0.955296f, 1.0f}, + {-0.528737f, -0.381137f, 0.758401f, 1.0f}, + {-0.641452f, -0.269776f, 0.718165f, 1.0f}, + {-0.779483f, -0.469479f, 0.414723f, 1.0f}, + {-0.607459f, -0.635561f, 0.476503f, 1.0f}, + {-0.095817f, 0.233923f, 0.967522f, 1.0f}, + {-0.401548f, -0.021988f, 0.915574f, 1.0f}, + {-0.363895f, -0.065401f, 0.929141f, 1.0f}, + {-0.22151f, -0.503854f, 0.834904f, 1.0f}, + {-0.357024f, -0.477873f, 0.802603f, 1.0f}, + {-0.386654f, -0.751861f, 0.534045f, 1.0f}, + {-0.254595f, -0.783514f, 0.566822f, 1.0f}, + {-0.122359f, 0.255185f, 0.959119f, 1.0f}, + {-0.262431f, -0.125125f, 0.956804f, 1.0f}, + {-0.155016f, -0.146346f, 0.977012f, 1.0f}, + {0.080573f, -0.206493f, -0.975125f, 1.0f}, + {0.992147f, -0.074921f, 0.100151f, 1.0f}, + {0.553033f, -0.815763f, 0.169366f, 1.0f}, + {0.328557f, -0.481592f, 0.812477f, 1.0f}, + {0.228237f, -0.529038f, 0.817329f, 1.0f}, + {0.095267f, -0.197633f, 0.975636f, 1.0f}, + {0.25504f, -0.520041f, 0.815176f, 1.0f}, + {0.098444f, -0.198032f, 0.97524f, 1.0f}, + {0.125172f, -0.185734f, 0.974595f, 1.0f}, + {0.374476f, -0.91153f, 0.169941f, 1.0f}, + {0.326423f, -0.779756f, 0.534255f, 1.0f}, + {0.430882f, -0.88684f, 0.166899f, 1.0f}, + {0.371774f, -0.764858f, 0.526096f, 1.0f}, + {0.47841f, -0.704728f, 0.523911f, 1.0f}, + {0.861778f, -0.481599f, 0.159374f, 1.0f}, + {0.549621f, -0.254672f, 0.79565f, 1.0f}, + {0.43959f, -0.393316f, 0.807504f, 1.0f}, + {0.1754f, -0.150204f, 0.972971f, 1.0f}, + {0.24555f, -0.069957f, 0.966856f, 1.0f}, + {0.723384f, -0.670115f, 0.166315f, 1.0f}, + {0.62952f, -0.574564f, 0.52305f, 1.0f}, + {0.761908f, -0.397011f, 0.511741f, 1.0f}, + {0.655524f, 0.087611f, 0.750075f, 1.0f}, + {0.627069f, -0.080853f, 0.774756f, 1.0f}, + {0.302877f, 0.051289f, 0.951649f, 1.0f}, + {0.315548f, 0.15871f, 0.935543f, 1.0f}, + {0.949682f, -0.282109f, 0.136086f, 1.0f}, + {0.850571f, -0.195983f, 0.487974f, 1.0f}, + {0.889886f, 0.005672f, 0.456147f, 1.0f}, + {0.093484f, -0.143871f, -0.985171f, 1.0f}, + {0.460621f, -0.686692f, -0.56239f, 1.0f}, + {0.299306f, -0.760656f, -0.576036f, 1.0f}, + {0.3652f, -0.90458f, -0.219916f, 1.0f}, + {0.352097f, -0.738829f, -0.574595f, 1.0f}, + {0.424706f, -0.87826f, -0.219736f, 1.0f}, + {0.547742f, -0.810124f, -0.208992f, 1.0f}, + {0.050158f, -0.166115f, -0.98483f, 1.0f}, + {0.190415f, -0.503671f, -0.842649f, 1.0f}, + {0.070079f, -0.158867f, -0.98481f, 1.0f}, + {0.231439f, -0.490664f, -0.840051f, 1.0f}, + {0.301441f, -0.454722f, -0.83807f, 1.0f}, + {0.101033f, -0.125984f, -0.986874f, 1.0f}, + {0.692785f, -0.439253f, -0.571932f, 1.0f}, + {0.595317f, -0.568883f, -0.567424f, 1.0f}, + {0.712981f, -0.667737f, -0.213973f, 1.0f}, + {0.839836f, -0.497137f, -0.218013f, 1.0f}, + {0.113447f, -0.117947f, -0.986518f, 1.0f}, + {0.387969f, -0.378265f, -0.840473f, 1.0f}, + {0.433601f, -0.310017f, -0.846097f, 1.0f}, + {0.769582f, -0.193612f, -0.608488f, 1.0f}, + {0.742549f, -0.326571f, -0.584784f, 1.0f}, + {0.914329f, -0.328023f, -0.237493f, 1.0f}, + {0.951675f, -0.144248f, -0.271123f, 1.0f}, + {0.080926f, -0.178683f, -0.980573f, 1.0f}, + {0.450665f, -0.274398f, -0.849475f, 1.0f}, + {0.464413f, -0.215362f, -0.859034f, 1.0f}, + {0.271103f, 0.939207f, -0.210697f, 1.0f}, + {0.890321f, 0.455131f, -0.01359f, 1.0f}, + {0.57989f, 0.469317f, 0.665934f, 1.0f}, + {0.653463f, 0.237328f, 0.718792f, 1.0f}, + {0.314768f, 0.238791f, 0.91864f, 1.0f}, + {0.624124f, 0.364188f, 0.691257f, 1.0f}, + {0.297785f, 0.305298f, 0.904498f, 1.0f}, + {0.274032f, 0.365627f, 0.889507f, 1.0f}, + {0.988739f, 0.138226f, 0.05734f, 1.0f}, + {0.886744f, 0.201676f, 0.415947f, 1.0f}, + {0.948936f, 0.31494f, 0.018247f, 1.0f}, + {0.848767f, 0.366846f, 0.380813f, 1.0f}, + {0.794159f, 0.498592f, 0.347444f, 1.0f}, + {0.605142f, 0.784793f, -0.133803f, 1.0f}, + {0.345194f, 0.747208f, 0.56791f, 1.0f}, + {0.498393f, 0.598168f, 0.627535f, 1.0f}, + {0.222817f, 0.45157f, 0.863966f, 1.0f}, + {0.117873f, 0.554942f, 0.823496f, 1.0f}, + {0.789114f, 0.61124f, -0.060707f, 1.0f}, + {0.694706f, 0.652171f, 0.303408f, 1.0f}, + {0.513904f, 0.825721f, 0.232567f, 1.0f}, + {0.142978f, 0.832703f, 0.534942f, 1.0f}, + {0.204101f, 0.823052f, 0.530027f, 1.0f}, + {0.042254f, 0.59107f, 0.805513f, 1.0f}, + {0.041718f, 0.578563f, 0.81457f, 1.0f}, + {0.402005f, 0.896362f, -0.18689f, 1.0f}, + {0.326784f, 0.927591f, 0.181075f, 1.0f}, + {0.224044f, 0.958756f, 0.174901f, 1.0f}, + {0.075953f, -0.20519f, -0.975771f, 1.0f}, + {0.699748f, 0.183299f, -0.690474f, 1.0f}, + {0.768062f, -0.037236f, -0.639293f, 1.0f}, + {0.949066f, 0.054212f, -0.310378f, 1.0f}, + {0.737616f, 0.087751f, -0.669494f, 1.0f}, + {0.910976f, 0.21793f, -0.350184f, 1.0f}, + {0.859378f, 0.346712f, -0.375845f, 1.0f}, + {0.081636f, -0.200231f, -0.976342f, 1.0f}, + {0.461759f, -0.128629f, -0.877629f, 1.0f}, + {0.077788f, -0.196255f, -0.977463f, 1.0f}, + {0.445133f, -0.058889f, -0.893526f, 1.0f}, + {0.425183f, -0.012175f, -0.905026f, 1.0f}, + {0.137616f, -0.264098f, -0.954628f, 1.0f}, + {0.525465f, 0.381518f, -0.76048f, 1.0f}, + {0.63687f, 0.275989f, -0.719879f, 1.0f}, + {0.770419f, 0.481282f, -0.418118f, 1.0f}, + {0.610352f, 0.630264f, -0.47983f, 1.0f}, + {0.09488f, -0.234495f, -0.967476f, 1.0f}, + {0.401707f, 0.025884f, -0.915402f, 1.0f}, + {0.359692f, 0.067971f, -0.930592f, 1.0f}, + {0.237777f, 0.499228f, -0.833207f, 1.0f}, + {0.369281f, 0.471724f, -0.800692f, 1.0f}, + {0.418392f, 0.738426f, -0.528844f, 1.0f}, + {0.276f, 0.778017f, -0.564371f, 1.0f}, + {0.12288f, -0.253622f, -0.959467f, 1.0f}, + {0.265458f, 0.114091f, -0.957348f, 1.0f}, + {0.162964f, 0.143894f, -0.976083f, 1.0f}, + {-0.158159f, -0.040505f, -0.986582f, 1.0f}, + {0.15814f, 0.0406f, 0.986582f, 1.0f}, + {0.144692f, 0.073405f, 0.98675f, 1.0f}, + {-0.915726f, -0.375912f, 0.141903f, 1.0f}, + {-0.476691f, -0.861014f, 0.17726f, 1.0f}, + {-0.332919f, -0.762887f, -0.554229f, 1.0f}, + {-0.150396f, -0.830558f, -0.536241f, 1.0f}, + {-0.058371f, -0.573288f, -0.817272f, 1.0f}, + {-0.210371f, -0.812459f, -0.543742f, 1.0f}, + {-0.087256f, -0.566196f, -0.819639f, 1.0f}, + {-0.17321f, -0.534996f, -0.826908f, 1.0f}, + {-0.251212f, -0.944087f, 0.213523f, 1.0f}, + {-0.217819f, -0.960376f, -0.173877f, 1.0f}, + {-0.340984f, -0.919284f, 0.196587f, 1.0f}, + {-0.298787f, -0.936369f, -0.184224f, 1.0f}, + {-0.438057f, -0.876533f, -0.19949f, 1.0f}, + {-0.752368f, -0.320989f, -0.575246f, 1.0f}, + {-0.486691f, -0.666156f, -0.565127f, 1.0f}, + {-0.298383f, -0.461833f, -0.835271f, 1.0f}, + {-0.63433f, -0.519181f, -0.57278f, 1.0f}, + {-0.410116f, -0.354341f, -0.840385f, 1.0f}, + {-0.492485f, -0.216982f, -0.842839f, 1.0f}, + {-0.62289f, -0.765208f, 0.16268f, 1.0f}, + {-0.598806f, -0.771092f, -0.216446f, 1.0f}, + {-0.78103f, -0.607371f, 0.145233f, 1.0f}, + {-0.761995f, -0.606802f, -0.226174f, 1.0f}, + {-0.897393f, -0.375621f, -0.231507f, 1.0f}, + {-0.011427f, 0.229595f, 0.973219f, 1.0f}, + {-0.346026f, -0.464639f, 0.815093f, 1.0f}, + {-0.20484f, -0.508409f, 0.836398f, 1.0f}, + {-0.246376f, -0.785512f, 0.567689f, 1.0f}, + {-0.2724f, -0.493419f, 0.826036f, 1.0f}, + {-0.333106f, -0.765195f, 0.550924f, 1.0f}, + {-0.446812f, -0.718611f, 0.532876f, 1.0f}, + {-0.041625f, 0.227385f, 0.972915f, 1.0f}, + {-0.133066f, -0.153095f, 0.979212f, 1.0f}, + {-0.046696f, 0.236801f, 0.970435f, 1.0f}, + {-0.172016f, -0.140268f, 0.975057f, 1.0f}, + {-0.192557f, -0.129714f, 0.972675f, 1.0f}, + {-0.566259f, -0.220583f, 0.794162f, 1.0f}, + {-0.400734f, -0.428221f, 0.809962f, 1.0f}, + {-0.556649f, -0.646009f, 0.522316f, 1.0f}, + {-0.484538f, -0.354535f, 0.799705f, 1.0f}, + {-0.687549f, -0.521002f, 0.505799f, 1.0f}, + {-0.803051f, -0.323735f, 0.500305f, 1.0f}, + {0.063674f, 0.182801f, 0.981086f, 1.0f}, + {-0.186457f, -0.139112f, 0.972565f, 1.0f}, + {0.116811f, 0.124614f, 0.985305f, 1.0f}, + {-0.204765f, -0.128017f, 0.970404f, 1.0f}, + {-0.231795f, -0.079997f, 0.96947f, 1.0f}, + {-0.977642f, -0.140469f, 0.156478f, 1.0f}, + {-0.978699f, 0.134445f, 0.155155f, 1.0f}, + {-0.802146f, 0.126056f, -0.583671f, 1.0f}, + {-0.806456f, -0.134337f, -0.575832f, 1.0f}, + {-0.529857f, -0.083744f, -0.843943f, 1.0f}, + {-0.814415f, 0.036147f, -0.579156f, 1.0f}, + {-0.531439f, 0.039655f, -0.846168f, 1.0f}, + {-0.518769f, 0.09388f, -0.849744f, 1.0f}, + {-0.976402f, -0.16335f, 0.141266f, 1.0f}, + {-0.959335f, -0.161133f, -0.23176f, 1.0f}, + {-0.987964f, 0.024151f, 0.152788f, 1.0f}, + {-0.971692f, 0.032358f, -0.234026f, 1.0f}, + {-0.96212f, 0.140881f, -0.233407f, 1.0f}, + {-0.985334f, 0.072828f, 0.154317f, 1.0f}, + {-0.808215f, 0.046288f, -0.587065f, 1.0f}, + {-0.802218f, 0.107292f, -0.587311f, 1.0f}, + {-0.518548f, 0.067554f, -0.852376f, 1.0f}, + {-0.523399f, 0.02011f, -0.85185f, 1.0f}, + {-0.978854f, 0.133317f, 0.15515f, 1.0f}, + {-0.963572f, 0.130257f, -0.233584f, 1.0f}, + {-0.97064f, 0.064307f, -0.231782f, 1.0f}, + {-0.807362f, -0.129874f, -0.575586f, 1.0f}, + {-0.811294f, -0.032894f, -0.583713f, 1.0f}, + {-0.526044f, -0.032726f, -0.849827f, 1.0f}, + {-0.52594f, -0.093604f, -0.845355f, 1.0f}, + {-0.987558f, -0.021185f, 0.15582f, 1.0f}, + {-0.972536f, -0.029548f, -0.230869f, 1.0f}, + {-0.963569f, -0.145627f, -0.224337f, 1.0f}, + {0.152193f, -0.044498f, 0.987349f, 1.0f}, + {-0.588854f, 0.067098f, 0.80545f, 1.0f}, + {-0.601519f, -0.097306f, 0.79291f, 1.0f}, + {-0.854471f, -0.143646f, 0.499245f, 1.0f}, + {-0.60045f, 0.002594f, 0.799658f, 1.0f}, + {-0.860648f, 0.012178f, 0.509055f, 1.0f}, + {-0.848758f, 0.108156f, 0.517603f, 1.0f}, + {0.160041f, 0.020944f, 0.986888f, 1.0f}, + {-0.243568f, -0.039467f, 0.96908f, 1.0f}, + {0.154224f, -0.033299f, 0.987475f, 1.0f}, + {-0.238012f, -0.014958f, 0.971147f, 1.0f}, + {-0.234799f, 0.012421f, 0.971965f, 1.0f}, + {0.158405f, 0.007119f, 0.987349f, 1.0f}, + {-0.586796f, 0.05514f, 0.807855f, 1.0f}, + {-0.58399f, 0.08147f, 0.807662f, 1.0f}, + {-0.845819f, 0.116353f, 0.520626f, 1.0f}, + {-0.850942f, 0.069998f, 0.520575f, 1.0f}, + {0.155101f, -0.01739f, 0.987746f, 1.0f}, + {-0.2324f, 0.034566f, 0.972006f, 1.0f}, + {-0.234244f, 0.03375f, 0.971592f, 1.0f}, + {-0.59056f, -0.073702f, 0.803622f, 1.0f}, + {-0.590313f, 0.000693f, 0.807174f, 1.0f}, + {-0.854124f, -0.010208f, 0.519969f, 1.0f}, + {-0.848743f, -0.115698f, 0.515993f, 1.0f}, + {0.158497f, 0.025022f, 0.987042f, 1.0f}, + {-0.234404f, 0.013802f, 0.972041f, 1.0f}, + {-0.236392f, -0.019013f, 0.971472f, 1.0f}, + {-0.14415f, -0.075228f, -0.986692f, 1.0f}, + {0.918643f, 0.368696f, -0.141976f, 1.0f}, + {0.458069f, 0.870785f, -0.178623f, 1.0f}, + {0.311134f, 0.773562f, 0.552085f, 1.0f}, + {0.145131f, 0.832085f, 0.535324f, 1.0f}, + {0.056653f, 0.573845f, 0.817002f, 1.0f}, + {0.19515f, 0.817607f, 0.541697f, 1.0f}, + {0.082119f, 0.567948f, 0.818958f, 1.0f}, + {0.164531f, 0.539084f, 0.826025f, 1.0f}, + {0.248047f, 0.944832f, -0.21393f, 1.0f}, + {0.212488f, 0.961733f, 0.17297f, 1.0f}, + {0.326147f, 0.924374f, -0.197892f, 1.0f}, + {0.282052f, 0.941975f, 0.182015f, 1.0f}, + {0.415338f, 0.888161f, 0.196636f, 1.0f}, + {0.754966f, 0.313345f, 0.576056f, 1.0f}, + {0.46949f, 0.67923f, 0.564114f, 1.0f}, + {0.292705f, 0.465917f, 0.835012f, 1.0f}, + {0.629592f, 0.524941f, 0.572758f, 1.0f}, + {0.410345f, 0.354082f, 0.840382f, 1.0f}, + {0.49251f, 0.212247f, 0.844029f, 1.0f}, + {0.603932f, 0.77978f, -0.164954f, 1.0f}, + {0.578163f, 0.787199f, 0.214581f, 1.0f}, + {0.771717f, 0.618829f, -0.14664f, 1.0f}, + {0.75443f, 0.615286f, 0.228599f, 1.0f}, + {0.901039f, 0.366627f, 0.23176f, 1.0f}, + {0.006721f, -0.226487f, -0.973991f, 1.0f}, + {0.342559f, 0.466829f, -0.815306f, 1.0f}, + {0.207065f, 0.507795f, -0.836223f, 1.0f}, + {0.245437f, 0.785729f, -0.567794f, 1.0f}, + {0.269303f, 0.490024f, -0.829067f, 1.0f}, + {0.321113f, 0.765758f, -0.557227f, 1.0f}, + {0.433145f, 0.726461f, -0.533517f, 1.0f}, + {0.041095f, -0.229669f, -0.972401f, 1.0f}, + {0.135322f, 0.152284f, -0.979029f, 1.0f}, + {0.044245f, -0.235696f, -0.970819f, 1.0f}, + {0.172137f, 0.140231f, -0.975041f, 1.0f}, + {0.193007f, 0.129423f, -0.972624f, 1.0f}, + {0.566798f, 0.218907f, -0.794241f, 1.0f}, + {0.396962f, 0.430812f, -0.810446f, 1.0f}, + {0.539793f, 0.658337f, -0.52461f, 1.0f}, + {0.480891f, 0.358446f, -0.800163f, 1.0f}, + {0.678003f, 0.532109f, -0.50712f, 1.0f}, + {0.804925f, 0.318705f, -0.500523f, 1.0f}, + {-0.065161f, -0.181277f, -0.981271f, 1.0f}, + {0.18511f, 0.140514f, -0.97262f, 1.0f}, + {-0.115719f, -0.126486f, -0.985196f, 1.0f}, + {0.203257f, 0.130587f, -0.970378f, 1.0f}, + {0.231796f, 0.080024f, -0.969467f, 1.0f}, + {0.975941f, 0.151532f, -0.156774f, 1.0f}, + {0.976997f, -0.146279f, -0.155178f, 1.0f}, + {0.801037f, -0.135488f, 0.58308f, 1.0f}, + {0.811456f, 0.108797f, 0.574197f, 1.0f}, + {0.531879f, 0.075684f, 0.843432f, 1.0f}, + {0.814143f, -0.065429f, 0.576966f, 1.0f}, + {0.531776f, -0.048702f, 0.845484f, 1.0f}, + {0.518596f, -0.096073f, 0.849605f, 1.0f}, + {0.980816f, 0.134971f, -0.140652f, 1.0f}, + {0.964338f, 0.129478f, 0.230843f, 1.0f}, + {0.986605f, -0.055793f, -0.153293f, 1.0f}, + {0.970117f, -0.065721f, 0.233567f, 1.0f}, + {0.960462f, -0.152111f, 0.233183f, 1.0f}, + {0.985836f, -0.065318f, -0.154468f, 1.0f}, + {0.808555f, -0.041252f, 0.586972f, 1.0f}, + {0.802446f, -0.105417f, 0.58734f, 1.0f}, + {0.518634f, -0.066731f, 0.852388f, 1.0f}, + {0.52345f, -0.019423f, 0.851835f, 1.0f}, + {0.979027f, -0.132074f, -0.155124f, 1.0f}, + {0.963815f, -0.128405f, 0.233607f, 1.0f}, + {0.971043f, -0.057907f, 0.23178f, 1.0f}, + {0.806288f, 0.1354f, 0.575818f, 1.0f}, + {0.811164f, 0.039084f, 0.583511f, 1.0f}, + {0.526049f, 0.033588f, 0.849791f, 1.0f}, + {0.525565f, 0.095166f, 0.845414f, 1.0f}, + {0.987302f, 0.030631f, -0.155876f, 1.0f}, + {0.972307f, 0.037403f, 0.230695f, 1.0f}, + {0.96206f, 0.155088f, 0.224474f, 1.0f}, + {-0.152254f, 0.043936f, -0.987364f, 1.0f}, + {0.585239f, -0.070864f, -0.807758f, 1.0f}, + {0.6029f, 0.091564f, -0.792545f, 1.0f}, + {0.859068f, 0.119229f, -0.497781f, 1.0f}, + {0.600693f, -0.008971f, -0.799429f, 1.0f}, + {0.860476f, -0.038564f, -0.50803f, 1.0f}, + {0.845602f, -0.118002f, -0.520608f, 1.0f}, + {-0.155651f, -0.023142f, -0.987541f, 1.0f}, + {0.23916f, 0.037854f, -0.970242f, 1.0f}, + {-0.154423f, 0.029643f, -0.98756f, 1.0f}, + {0.237943f, 0.013353f, -0.971187f, 1.0f}, + {0.234696f, -0.013478f, -0.971975f, 1.0f}, + {-0.158408f, -0.007235f, -0.987347f, 1.0f}, + {0.58962f, -0.052176f, -0.805994f, 1.0f}, + {0.58395f, -0.081664f, -0.807671f, 1.0f}, + {0.845927f, -0.115571f, -0.520625f, 1.0f}, + {0.852772f, -0.063332f, -0.518429f, 1.0f}, + {-0.155801f, 0.017923f, -0.987626f, 1.0f}, + {0.232147f, -0.034782f, -0.972059f, 1.0f}, + {0.234265f, -0.032738f, -0.971621f, 1.0f}, + {0.589311f, 0.079123f, -0.804022f, 1.0f}, + {0.590284f, 0.002538f, -0.807192f, 1.0f}, + {0.853985f, 0.018728f, -0.51996f, 1.0f}, + {0.847036f, 0.125086f, -0.516608f, 1.0f}, + {-0.159017f, -0.02508f, -0.986957f, 1.0f}, + {0.237052f, -0.0122f, -0.97142f, 1.0f}, + {0.236002f, 0.020503f, -0.971536f, 1.0f}, + {0.253521f, -0.027038f, 0.966952f, 1.0f}, + {0.289621f, 0.048064f, 0.955934f, 1.0f}, + {-0.197802f, -0.972841f, 0.120228f, 1.0f}, + {-0.756571f, -0.633878f, 0.160621f, 1.0f}, + {-0.628084f, -0.52647f, -0.57301f, 1.0f}, + {-0.773382f, -0.264498f, -0.576127f, 1.0f}, + {-0.503698f, -0.177241f, -0.845502f, 1.0f}, + {-0.708273f, -0.412053f, -0.573202f, 1.0f}, + {-0.463863f, -0.26999f, -0.843764f, 1.0f}, + {-0.411901f, -0.344718f, -0.843509f, 1.0f}, + {-0.93609f, -0.313639f, 0.159267f, 1.0f}, + {-0.923396f, -0.311894f, -0.223746f, 1.0f}, + {-0.853241f, -0.496579f, 0.159339f, 1.0f}, + {-0.842852f, -0.490363f, -0.221687f, 1.0f}, + {-0.74733f, -0.626788f, -0.220532f, 1.0f}, + {-0.484392f, -0.858979f, 0.165888f, 1.0f}, + {-0.412899f, -0.704914f, -0.576724f, 1.0f}, + {-0.530162f, -0.624398f, -0.573634f, 1.0f}, + {-0.348615f, -0.40727f, -0.844155f, 1.0f}, + {-0.281298f, -0.450338f, -0.847388f, 1.0f}, + {-0.640703f, -0.751006f, 0.159654f, 1.0f}, + {-0.631588f, -0.742915f, -0.221753f, 1.0f}, + {-0.483823f, -0.846657f, -0.221556f, 1.0f}, + {-0.348024f, -0.727814f, -0.590903f, 1.0f}, + {-0.350174f, -0.730303f, -0.586546f, 1.0f}, + {-0.282233f, -0.441266f, -0.851838f, 1.0f}, + {-0.343095f, -0.417405f, -0.841462f, 1.0f}, + {-0.324622f, -0.9343f, 0.147324f, 1.0f}, + {-0.364369f, -0.901334f, -0.234161f, 1.0f}, + {-0.294852f, -0.922318f, -0.249785f, 1.0f}, + {0.127402f, 0.105554f, 0.986219f, 1.0f}, + {-0.453846f, -0.380287f, 0.805857f, 1.0f}, + {-0.56157f, -0.18441f, 0.806618f, 1.0f}, + {-0.810505f, -0.269623f, 0.519986f, 1.0f}, + {-0.511794f, -0.297801f, 0.805842f, 1.0f}, + {-0.738842f, -0.430022f, 0.518839f, 1.0f}, + {-0.654853f, -0.548846f, 0.519554f, 1.0f}, + {0.152912f, 0.059707f, 0.986435f, 1.0f}, + {-0.22286f, -0.068741f, 0.972424f, 1.0f}, + {0.143345f, 0.083851f, 0.986114f, 1.0f}, + {-0.201435f, -0.117114f, 0.972475f, 1.0f}, + {-0.178839f, -0.150272f, 0.972335f, 1.0f}, + {0.095026f, 0.116935f, 0.988583f, 1.0f}, + {-0.28093f, -0.522707f, 0.804895f, 1.0f}, + {-0.385169f, -0.449602f, 0.805918f, 1.0f}, + {-0.554679f, -0.650227f, 0.519169f, 1.0f}, + {-0.412103f, -0.745483f, 0.523857f, 1.0f}, + {0.106767f, 0.119837f, 0.987036f, 1.0f}, + {-0.153544f, -0.179965f, 0.971616f, 1.0f}, + {-0.104692f, -0.221242f, 0.969583f, 1.0f}, + {0.064846f, -0.65701f, 0.751087f, 1.0f}, + {-0.117099f, -0.604646f, 0.787839f, 1.0f}, + {-0.238071f, -0.830433f, 0.50369f, 1.0f}, + {-0.072091f, -0.879854f, 0.469744f, 1.0f}, + {0.164482f, 0.07942f, 0.983178f, 1.0f}, + {0.023864f, -0.286284f, 0.957848f, 1.0f}, + {0.192675f, -0.332606f, 0.923174f, 1.0f}, + {0.932381f, -0.259238f, -0.251917f, 1.0f}, + {0.214823f, -0.976315f, -0.0257f, 1.0f}, + {-0.067915f, -0.730693f, -0.67932f, 1.0f}, + {-0.29728f, -0.740485f, -0.60275f, 1.0f}, + {-0.345389f, -0.423568f, -0.837435f, 1.0f}, + {-0.174611f, -0.746734f, -0.641794f, 1.0f}, + {-0.273374f, -0.432497f, -0.859193f, 1.0f}, + {-0.204669f, -0.424359f, -0.88206f, 1.0f}, + {-0.070467f, -0.993894f, 0.084908f, 1.0f}, + {-0.199203f, -0.939872f, -0.277413f, 1.0f}, + {0.083837f, -0.996201f, 0.023538f, 1.0f}, + {-0.049382f, -0.942306f, -0.33109f, 1.0f}, + {0.082443f, -0.923736f, -0.374053f, 1.0f}, + {0.588915f, -0.792144f, -0.160269f, 1.0f}, + {0.223578f, -0.598974f, -0.768924f, 1.0f}, + {0.018227f, -0.708405f, -0.705571f, 1.0f}, + {-0.151223f, -0.411565f, -0.898747f, 1.0f}, + {-0.028519f, -0.348097f, -0.937025f, 1.0f}, + {0.331032f, -0.94131f, -0.065979f, 1.0f}, + {0.186727f, -0.891369f, -0.41303f, 1.0f}, + {0.442586f, -0.750617f, -0.490603f, 1.0f}, + {0.478597f, -0.170155f, -0.86139f, 1.0f}, + {0.449853f, -0.333117f, -0.828653f, 1.0f}, + {0.10784f, -0.195317f, -0.974793f, 1.0f}, + {0.121042f, -0.08109f, -0.98933f, 1.0f}, + {0.856978f, -0.454265f, -0.243375f, 1.0f}, + {0.703023f, -0.424971f, -0.570226f, 1.0f}, + {0.763901f, -0.231062f, -0.602549f, 1.0f}, + {0.316542f, 0.050476f, 0.947234f, 1.0f}, + {0.381766f, -0.661389f, 0.645616f, 1.0f}, + {0.194452f, -0.674444f, 0.712259f, 1.0f}, + {0.066605f, -0.900047f, 0.430673f, 1.0f}, + {0.295886f, -0.673348f, 0.677535f, 1.0f}, + {0.204668f, -0.901742f, 0.380752f, 1.0f}, + {0.319642f, -0.886119f, 0.335594f, 1.0f}, + {0.344003f, 0.039533f, 0.938136f, 1.0f}, + {0.291495f, -0.346421f, 0.891641f, 1.0f}, + {0.331195f, 0.052087f, 0.942124f, 1.0f}, + {0.340622f, -0.339915f, 0.876604f, 1.0f}, + {0.379769f, -0.339112f, 0.860685f, 1.0f}, + {0.288122f, 0.041184f, 0.956708f, 1.0f}, + {0.638457f, -0.543273f, 0.545185f, 1.0f}, + {0.470877f, -0.637607f, 0.609699f, 1.0f}, + {0.426565f, -0.855906f, 0.292347f, 1.0f}, + {0.658891f, -0.723709f, 0.205201f, 1.0f}, + {0.313642f, 0.049385f, 0.948256f, 1.0f}, + {0.431045f, -0.320257f, 0.843585f, 1.0f}, + {0.510747f, -0.280486f, 0.81269f, 1.0f}, + {0.837002f, -0.209269f, 0.505602f, 1.0f}, + {0.802033f, -0.346815f, 0.486275f, 1.0f}, + {0.896531f, -0.426435f, 0.119942f, 1.0f}, + {0.957839f, -0.252406f, 0.137242f, 1.0f}, + {0.258015f, 0.00394f, 0.966133f, 1.0f}, + {0.582624f, -0.19118f, 0.789936f, 1.0f}, + {0.589388f, -0.131475f, 0.79708f, 1.0f}, + {-0.287577f, -0.048372f, -0.956535f, 1.0f}, + {0.198435f, 0.972693f, -0.120382f, 1.0f}, + {0.75625f, 0.634268f, -0.160596f, 1.0f}, + {0.628747f, 0.525637f, 0.573047f, 1.0f}, + {0.771548f, 0.270308f, 0.575889f, 1.0f}, + {0.503287f, 0.178663f, 0.845448f, 1.0f}, + {0.708069f, 0.412431f, 0.573183f, 1.0f}, + {0.463718f, 0.270283f, 0.843749f, 1.0f}, + {0.412345f, 0.344115f, 0.843538f, 1.0f}, + {0.933652f, 0.320836f, -0.159245f, 1.0f}, + {0.920846f, 0.31948f, 0.223553f, 1.0f}, + {0.853338f, 0.496419f, -0.159319f, 1.0f}, + {0.842721f, 0.490591f, 0.221678f, 1.0f}, + {0.747993f, 0.62601f, 0.220494f, 1.0f}, + {0.486272f, 0.857883f, -0.16606f, 1.0f}, + {0.422419f, 0.699132f, 0.576867f, 1.0f}, + {0.534938f, 0.620131f, 0.573828f, 1.0f}, + {0.351168f, 0.404842f, 0.844265f, 1.0f}, + {0.282891f, 0.449287f, 0.847416f, 1.0f}, + {0.639184f, 0.752314f, -0.159589f, 1.0f}, + {0.634228f, 0.740655f, 0.221778f, 1.0f}, + {0.492889f, 0.841718f, 0.220389f, 1.0f}, + {0.344695f, 0.731633f, 0.588132f, 1.0f}, + {0.354745f, 0.728356f, 0.58622f, 1.0f}, + {0.281612f, 0.441565f, 0.851889f, 1.0f}, + {0.344948f, 0.42364f, 0.83758f, 1.0f}, + {0.329697f, 0.932424f, -0.147941f, 1.0f}, + {0.369905f, 0.899204f, 0.233672f, 1.0f}, + {0.292541f, 0.922863f, 0.250488f, 1.0f}, + {-0.127328f, -0.105626f, -0.98622f, 1.0f}, + {0.452897f, 0.381286f, -0.805919f, 1.0f}, + {0.560978f, 0.186341f, -0.806586f, 1.0f}, + {0.808738f, 0.275058f, -0.51989f, 1.0f}, + {0.512116f, 0.297539f, -0.805735f, 1.0f}, + {0.739003f, 0.429674f, -0.518898f, 1.0f}, + {0.654333f, 0.549441f, -0.519581f, 1.0f}, + {-0.154123f, -0.05962f, -0.986251f, 1.0f}, + {0.224f, 0.069567f, -0.972103f, 1.0f}, + {-0.143485f, -0.083657f, -0.98611f, 1.0f}, + {0.201632f, 0.116847f, -0.972467f, 1.0f}, + {0.178081f, 0.151054f, -0.972353f, 1.0f}, + {-0.096725f, -0.116127f, -0.988513f, 1.0f}, + {0.272469f, 0.527486f, -0.804686f, 1.0f}, + {0.37915f, 0.455293f, -0.805577f, 1.0f}, + {0.551622f, 0.652956f, -0.519001f, 1.0f}, + {0.409738f, 0.74689f, -0.523709f, 1.0f}, + {-0.106673f, -0.119896f, -0.987039f, 1.0f}, + {0.148091f, 0.18393f, -0.97172f, 1.0f}, + {0.094656f, 0.226466f, -0.969409f, 1.0f}, + {-0.057093f, 0.655574f, -0.75297f, 1.0f}, + {0.116511f, 0.604885f, -0.787743f, 1.0f}, + {0.241107f, 0.829251f, -0.504192f, 1.0f}, + {0.076523f, 0.8789f, -0.470829f, 1.0f}, + {-0.165602f, -0.079076f, -0.983017f, 1.0f}, + {-0.02625f, 0.287105f, -0.957539f, 1.0f}, + {-0.184445f, 0.331315f, -0.925317f, 1.0f}, + {-0.918139f, 0.307483f, 0.249951f, 1.0f}, + {-0.237124f, 0.970905f, 0.033391f, 1.0f}, + {0.051613f, 0.72725f, 0.684429f, 1.0f}, + {0.288954f, 0.74184f, 0.605128f, 1.0f}, + {0.345062f, 0.42362f, 0.837543f, 1.0f}, + {0.16745f, 0.746483f, 0.643991f, 1.0f}, + {0.270893f, 0.432477f, 0.859989f, 1.0f}, + {0.201275f, 0.423732f, 0.883142f, 1.0f}, + {0.068721f, 0.99406f, -0.084396f, 1.0f}, + {0.192004f, 0.940796f, 0.27935f, 1.0f}, + {-0.086679f, 0.995982f, -0.022519f, 1.0f}, + {0.041748f, 0.941642f, 0.334017f, 1.0f}, + {-0.102445f, 0.918519f, 0.381874f, 1.0f}, + {-0.612212f, 0.772778f, 0.167365f, 1.0f}, + {-0.244198f, 0.58337f, 0.774626f, 1.0f}, + {-0.055447f, 0.693821f, 0.718009f, 1.0f}, + {0.143653f, 0.408676f, 0.901303f, 1.0f}, + {0.023121f, 0.344286f, 0.93858f, 1.0f}, + {-0.381127f, 0.920733f, 0.083623f, 1.0f}, + {-0.237799f, 0.870759f, 0.430384f, 1.0f}, + {-0.464582f, 0.731191f, 0.499523f, 1.0f}, + {-0.471995f, 0.195241f, 0.85971f, 1.0f}, + {-0.426702f, 0.367833f, 0.82621f, 1.0f}, + {-0.102936f, 0.201636f, 0.974036f, 1.0f}, + {-0.119198f, 0.08862f, 0.988908f, 1.0f}, + {-0.830814f, 0.504489f, 0.23503f, 1.0f}, + {-0.678302f, 0.468454f, 0.56609f, 1.0f}, + {-0.751971f, 0.272992f, 0.600012f, 1.0f}, + {-0.316709f, -0.050527f, -0.947176f, 1.0f}, + {-0.389848f, 0.665917f, -0.636061f, 1.0f}, + {-0.186203f, 0.673686f, -0.715176f, 1.0f}, + {-0.063945f, 0.89984f, -0.431507f, 1.0f}, + {-0.291326f, 0.673557f, -0.679301f, 1.0f}, + {-0.205683f, 0.90167f, -0.380377f, 1.0f}, + {-0.338172f, 0.884537f, -0.321301f, 1.0f}, + {-0.342817f, -0.048898f, -0.938129f, 1.0f}, + {-0.284356f, 0.341225f, -0.895939f, 1.0f}, + {-0.33077f, -0.052014f, -0.942277f, 1.0f}, + {-0.336331f, 0.340607f, -0.877991f, 1.0f}, + {-0.382938f, 0.338003f, -0.859716f, 1.0f}, + {-0.289586f, -0.042998f, -0.956186f, 1.0f}, + {-0.647116f, 0.541916f, -0.536253f, 1.0f}, + {-0.486081f, 0.631535f, -0.60406f, 1.0f}, + {-0.470765f, 0.837891f, -0.276261f, 1.0f}, + {-0.678115f, 0.709698f, -0.191021f, 1.0f}, + {-0.313783f, -0.05446f, -0.947932f, 1.0f}, + {-0.4368f, 0.326674f, -0.838147f, 1.0f}, + {-0.5123f, 0.278688f, -0.812331f, 1.0f}, + {-0.830844f, 0.231994f, -0.505842f, 1.0f}, + {-0.792438f, 0.361865f, -0.491016f, 1.0f}, + {-0.872501f, 0.470682f, -0.131151f, 1.0f}, + {-0.946178f, 0.292718f, -0.138073f, 1.0f}, + {-0.260458f, -0.000585f, -0.965485f, 1.0f}, + {-0.571557f, 0.193703f, -0.797372f, 1.0f}, + {-0.587948f, 0.137308f, -0.79716f, 1.0f}, +}; extern long texture_2fd1a0(int) __asm__("FUN_001f44b8"); extern void initialize_matrix_2fd1a0(void *) __asm__("FUN_001f9fc8"); extern void transform_2fd1a0(void *, void *, float) __asm__("FUN_001f9a68"); @@ -377,7 +5674,7 @@ extern void approach_two_stage_ffcb0(float *, float *, float, float, float, floa extern void lerp_vector_ffcb0(void *, void *, void *, float) __asm__("FUN_001f9a40"); extern void vec_add_ffcb0(void *, void *, void *) __asm__("FUN_001f9a10"); extern void FUN_L00_00216f90(void *, void *, int, int); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void FUN_L00_002eaa30(void *); extern void FUN_L06_00312b40(float, float, float, float, float, float); extern void FUN_L06_00312a78(void *); @@ -438,7 +5735,7 @@ void FUN_L06_002ffcb0(char *moby) { qcopy(pos, (void *)(state + base + 0x30)); qcopy(rot, (void *)(state + base + 0x70)); } - FUN_L00_002eaaa0(pos, rot, 1, scale_frames_ffcb0(300), 0); + jet_mount(pos, rot, 1, scale_frames_ffcb0(300), 0); FUN_L06_00312b40(0.001f, 1.0f, 1.0f, 0.001f, 1.0f, 1.0f); FUN_L06_00312a78(pos); FUN_L06_00312ad0(rot); @@ -729,7 +6026,7 @@ void FUN_L06_00300720(void) { extern char D_0013E533[]; extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); extern float fast_sin(float) __asm__("FUN_001f9de0"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); void mark_moby_for_removal(struct Obj *obj) __asm__("FUN_0020c828"); @@ -762,8 +6059,8 @@ void FUN_L06_00300df0(char *moby) { case 2: if (*(float *)(data + 0xC) > 1.0f) fast_vec_scale(data, data, 0.985f); - FUN_001f9a10(moby + 0x10, moby + 0x10, data); - FUN_001f9a10(moby + 0x40, moby + 0x40, data + 0x10); + fast_vec_add(moby + 0x10, moby + 0x10, data); + fast_vec_add(moby + 0x40, moby + 0x40, data + 0x10); if (*(int *)(D_0013E533 + 0x2EA1) != 0x72) mark_moby_for_removal(moby); break; @@ -884,7 +6181,8 @@ extern f32 frame_time_macro __asm__("D_0015ED6C") __attribute__((section(".sdata extern f32 frame_time_sq_macro __asm__("D_0015ED70") __attribute__((section(".sdata"))); extern f32 frame_scale_sq_macro __asm__("D_0015ED64") __attribute__((section(".sdata"))); /* Update of moby class 1105 (fred): steps the conversation and camera states, then turns the head toward the hero. */ -void FUN_L06_00301070(struct Moby *m) { +void fred_update(struct Moby *m) __asm__("FUN_L06_00301070"); +void fred_update(struct Moby *m) { Data_301070 *d = *(struct Data_301070 **)&m->pvars; float rate, head_rate; int tracking; @@ -1132,21 +6430,21 @@ extern void FUN_L06_00312a78(void *); extern void FUN_L06_00312ad0(void *); extern void FUN_L06_00312ce8(int); extern void FUN_L06_00312b40(float, float, float, float, float, float); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void FUN_L00_00216f90(void *, void *, int, int); extern void FUN_L00_002ea9d8(void *); extern void FUN_L00_002eaa30(void *); extern void FUN_L06_002356a0(int, int); extern void FUN_L06_00304088(char *); -extern void FUN_001f99f8(void *); +extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float vector_distance_xy(void *, void *) __asm__("FUN_001f9b80"); -extern int FUN_001f96f8(int); -extern float FUN_001f96b0(float) __asm__("FUN_L06_00216fa8"); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); +extern float FUN_L06_00216fa8(float); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); -extern int FUN_001f9740(void *); +extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); extern float FUN_002132a8(float, float); -extern int FUN_L01_0027a248(int, int); +extern int jet_game_state(int, int) __asm__("FUN_L01_0027a248"); extern void continue_audio_stream_if_ready(void) __asm__("FUN_00215b10"); extern int FUN_L00_00211250(void); extern void FUN_001f4600(int, char *) __asm__("FUN_L06_00210fc8"); @@ -1188,7 +6486,7 @@ void FUN_L06_00301b90(unsigned char *m) { if (FUN_L06_003047f8((const u8 *)D_L06_0015FFD8_301b90 + (*(int *)(d + 0x2C) << 8)) != 2) return; m[0x20] = 3; *(int *)(d + 0xB0) = 1; - FUN_L01_0027a248(6, 9); + jet_game_state(6, 9); if (*(short *)D_0015172A == 3) continue_audio_stream_if_ready(); FUN_L06_002ffc38(*(int *)(d + 0x10)); FUN_L06_002e9e30(*(int *)(d + 0x14)); @@ -1202,11 +6500,11 @@ void FUN_L06_00301b90(unsigned char *m) { p = D_L06_001B0C30_301b90[*(int *)(d + 0x24)]; qcopy(va, (char *)p + 0x20); qcopy(vb, (char *)p + 0x10); - FUN_001f99f8(vc); + clear_u64_value(vc); vc[2] = fast_arc_tan(vb[0] - va[0], vb[1] - va[1]); r = vector_distance_xy(va, vb); vc[1] = -fast_arc_tan(r, vb[2] - va[2]); - FUN_L00_002eaaa0(va, vc, 2, FUN_001f96f8(300), 0); + jet_mount(va, vc, 2, scale_game_frames(300), 0); FUN_L06_00312b40(D_L06_00162098, D_L06_0016209C, D_L06_001620A0, D_L06_001620A4, D_L06_001620A8, D_L06_001620B0); @@ -1231,7 +6529,7 @@ void FUN_L06_00301b90(unsigned char *m) { if (nb == **p - 1) { m[0x20] = 4; FUN_L06_00302400((struct Moby *)m, 1); - *(int *)(d + 0xB4) = truncate_float_to_s32(FUN_001f96b0(D_L06_001620C4)); + *(int *)(d + 0xB4) = truncate_float_to_s32(FUN_L06_00216fa8(D_L06_001620C4)); FUN_L06_00312ce8(2); FUN_L06_002356a0(0, 1); D_L06_0015F404 = 0; @@ -1241,7 +6539,7 @@ void FUN_L06_00301b90(unsigned char *m) { x = *(int *)(d + 0xB0) - 30; if (x < 0) x = 0; qcopy(va, (char *)D_L06_001B0C30_301b90[*(int *)(d + 0x24)] + 0x10 + (x << 4)); - FUN_001f99f8(vc); + clear_u64_value(vc); vc[2] = fast_arc_tan(va[0] - vb[0], va[1] - vb[1]); r = vector_distance_xy(vb, va); vc[1] = -fast_arc_tan(r, va[2] - vb[2]); @@ -1252,29 +6550,29 @@ void FUN_L06_00301b90(unsigned char *m) { case 4: { int x; char *q; - x = FUN_001f96f8(0x708); + x = scale_game_frames(0x708); if (*(int *)(d + 0xB4) == x) { if (*(short *)D_0015172A == 3) continue_audio_stream_if_ready(); } else { - x = FUN_001f96f8(900); + x = scale_game_frames(900); if (*(int *)(d + 0xB4) == x) FUN_L06_00302400((struct Moby *)m, 2); else { - x = FUN_001f96f8(300); + x = scale_game_frames(300); if (*(int *)(d + 0xB4) == x && *(short *)D_0015172A == 3) continue_audio_stream_if_ready(); } } - if (FUN_001f9740(d + 0xC0) != 0) { + if (fast_dec_timer(d + 0xC0) != 0) { allocate_voice_for_group_entry(0, 0, (int)hero.moby); - *(int *)(d + 0xC0) = truncate_float_to_s32(FUN_001f96b0(FUN_002132a8(480.0f, 600.0f))); + *(int *)(d + 0xC0) = truncate_float_to_s32(FUN_L06_00216fa8(FUN_002132a8(480.0f, 600.0f))); D_L06_00167400[88] = 0.4f; - ((int *)D_L06_00167400)[90] = FUN_001f96f8(60); + ((int *)D_L06_00167400)[90] = scale_game_frames(60); } if (D_L06_0015F5C4 == 0) FUN_001f4600((int)FUN_L06_003021d8, (char *)m); if (hero.state.current == 0x72) { m[0x20] = 6; return; } if (D_L06_0015F5C4 != 0) return; - if (FUN_001f9740(d + 0xB4) == 0) return; + if (fast_dec_timer(d + 0xB4) == 0) return; m[0x20] = 5; - x = FUN_001f96f8(15); + x = scale_game_frames(15); q = D_L06_0015FFD8_301b90 + (*(int *)(d + 0x30) << 8); *(float *)(d + 0xB8) = 0.0f; *(int *)(d + 0xBC) = x; @@ -1288,7 +6586,7 @@ void FUN_L06_00301b90(unsigned char *m) { D_L06_0015F400 = 0.0f; return; } - if (FUN_001f9740(d + 0xBC) == 0) return; + if (fast_dec_timer(d + 0xBC) == 0) return; approach_value((float *)(d + 0xB8), 1.0f, frame_time * 6.0f); D_L06_0015F400 = *(float *)(d + 0xB8); return; @@ -1454,7 +6752,8 @@ extern int D_L06_0016210C __attribute__((sda)); extern int D_L06_00162110 __attribute__((sda)); extern unsigned char D_0013D4D5[] __attribute__((section(".data"))); /* Update of moby class 1109 (shuttle): waits at one of three camera points, takes the hero's choice of destination, flies there through a cutscene and hands over to the level's travel sequence. */ -void FUN_L06_00302578(struct Moby *moby) { +void shuttle_update(struct Moby *moby) __asm__("FUN_L06_00302578"); +void shuttle_update(struct Moby *moby) { Data_302578 *d = *(Data_302578 **)&moby->pvars; float old_pos[4]; float old_rot[4]; @@ -1945,13 +7244,13 @@ void FUN_L06_00303748(float scale, char *moby, char *pos, char *push, int count) int color1, color2, life, size, fade; i++; random_vector_03b68(position, 0.0f, 1.0f); - FUN_001f9a10(position, position, pos); + fast_vec_add(position, position, pos); random_vector_03b68(direction, 0.0f, 0.9f); - FUN_001f9a10(direction, direction, push); + fast_vec_add(direction, direction, push); transform_2fd1a0(velocity, direction, random_float_between_03b68(D_L06_00162114, D_L06_00162118) * frame_time_03b68); random_vector_03b68(direction, 0.0f, 0.9f); - FUN_001f9a10(direction, direction, push); + fast_vec_add(direction, direction, push); transform_2fd1a0(acceleration, direction, random_float_between_03b68(D_L06_00162124, D_L06_00162128) * frame_time_03b68); velocity[3] = random_float_between_03b68(D_L06_0016211C, D_L06_00162120) * scale; @@ -1986,7 +7285,6 @@ extern int scale_game_frames_03b68(int) __asm__("FUN_001f96f8"); extern void FUN_L06_0030bef8_03b68(void *, int, int, int) __asm__("FUN_L06_0030bef8"); extern void clear_vector_03b68(void *) __asm__("FUN_001f99f8"); extern void random_vector_03b68(void *, float, float) __asm__("FUN_L00_00257d78"); -extern void push_piece_03b68(float, struct Moby *, void *, void *, int) __asm__("FUN_L06_00303748"); extern void add_vector_03b68(void *, void *, void *) __asm__("FUN_001f9a10"); extern void subtract_vector_03b68(void *, void *, void *) __asm__("FUN_001f9a28"); extern void scale_vector_03b68(void *, void *, float) __asm__("FUN_001f9a68"); @@ -2028,7 +7326,7 @@ void FUN_L06_00303b68(struct Moby *moby) { do { id = *list & 0x7FFF; random_vector_03b68(push, 1.0f, 2.0f); - push_piece_03b68(30.0f, moby, &((struct Moby *)(D_L06_0015FFD8_03b68 + (id << 8)))->pos, push, 1); + FUN_L06_00303748(30.0f, moby, &((struct Moby *)(D_L06_0015FFD8_03b68 + (id << 8)))->pos, push, 1); add_vector_03b68(middle, middle, &((struct Moby *)(D_L06_0015FFD8_03b68 + (id << 8)))->pos); count++; if (largest < ((struct Moby *)((id << 8) + (int)D_L06_0015FFD8_03b68))->bsphere.w) { @@ -2127,13 +7425,13 @@ extern void event_304098(int, int, void *) __asm__("FUN_0022dba0"); extern float vector_distance_304098(void *, void *) __asm__("FUN_001f9b80"); extern int try_set_help_message_304098(int, int) __asm__("FUN_00215130"); extern int scale_game_frames_304098(int) __asm__("FUN_001f96f8"); -extern int dismiss_help_message_304098(int) __asm__("FUN_L00_002644e0"); +extern int FUN_L00_002644e0(int); extern int tick_countdown_304098(int *) __asm__("FUN_001f9740"); extern void fade_to_black_304098(int) __asm__("FUN_001f4a58"); extern void start_camera_move_304098(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void set_camera_position_304098(void *) __asm__("FUN_L00_002ea9d8"); extern void set_camera_rotation_304098(void *) __asm__("FUN_L00_002eaa30"); -extern void set_camera_effect_304098(float, float, float, float, float, float) __asm__("FUN_L02_002f8aa0"); +extern void FUN_L02_002f8aa0(float, float, float, float, float, float); extern void copy_camera_304098(void *, void *, int, int) __asm__("FUN_L00_00216f90"); extern void finish_camera_move_304098(int) __asm__("FUN_L00_002eac18"); extern void clear_vector_304098(void *) __asm__("FUN_001f99f8"); @@ -2151,7 +7449,8 @@ extern float D_L06_001621A4 __attribute__((sda)); extern float D_L06_001621A8 __attribute__((sda)); extern float D_L06_001621B0 __attribute__((sda)); extern char D_0013E633[], D_0014171B[], D_0013D24D[], D_L16_00167240[] __attribute__((section(".data"))); -void FUN_L06_00304098(struct Moby *moby) { +void red_button_update(struct Moby *moby) __asm__("FUN_L06_00304098"); +void red_button_update(struct Moby *moby) { Data_304098 *data = *(struct Data_304098 **)&moby->pvars; Vector_304098 camera_position; Vector_304098 camera_rotation; @@ -2194,7 +7493,7 @@ void FUN_L06_00304098(struct Moby *moby) { help_message_available = try_set_help_message_304098(4, 0x1783) != 0; if ((*(int *)(D_0013A5E0 + 0x2504) & 0x10) && help_message_available) { allocate_voice_for_target_entry_304098(2, 0, moby); - dismiss_help_message_304098(4); + FUN_L00_002644e0(4); moby->state = 4; data->timer = scale_game_frames_304098(0x1E); } @@ -2209,7 +7508,7 @@ void FUN_L06_00304098(struct Moby *moby) { data->vel = 0.0f; fade_to_black_304098(scale_game_frames_304098(0xF)); start_camera_move_304098(&camera_position, &camera_rotation, 2, scale_game_frames_304098(0x12C), 0); - set_camera_effect_304098(D_L06_00162198, D_L06_0016219C, D_L06_001621A0, + FUN_L02_002f8aa0(D_L06_00162198, D_L06_0016219C, D_L06_001621A0, D_L06_001621A4, D_L06_001621A8, D_L06_001621B0); set_camera_position_304098(&camera_position); set_camera_rotation_304098(&camera_rotation); @@ -2371,7 +7670,7 @@ extern float FUN_L00_00257c48(float lo, float hi); extern float fast_vec_dist(void *, void *); extern int D_L06_00162234; extern int D_L06_00162238; -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern s32 fast_tween_color(s32, s32, f32) __asm__("func_001FA6E0"); extern s32 truncate_float_to_s32_c(f32) __asm__("func_001FA6D0"); extern float D_L06_001621F8 __attribute__((sda)); @@ -2387,7 +7686,7 @@ extern int D_L06_00162224 __attribute__((sda)); extern int D_L06_00162228 __attribute__((sda)); extern float D_L06_0016222C __attribute__((sda)); extern float D_L06_00162230 __attribute__((sda)); -extern void FUN_001f9ff8(float *, float); +extern void set_scale_matrix(float *, float) __asm__("FUN_001f9ff8"); extern void FUN_L00_00257d78(void *, float, float); extern void FUN_L06_00217300(void *); extern void add_vector_xyz_c(void *, void *, void *) __asm__("FUN_001f9a10"); @@ -2452,7 +7751,7 @@ void FUN_L06_003049f8(char *moby) int k; int l; - if (FUN_L00_0028d8c0(moby, d->f18) == 0) { + if (voice_is_playing(moby, d->f18) == 0) { d->f18 = allocate_voice_for_target_entry(0, 4, moby); } FUN_L06_00305000_c(moby); @@ -2508,7 +7807,7 @@ void FUN_L06_003049f8(char *moby) int j; euler_rotation_matrix(u.m.a, (float *)(moby + 0x40)); - FUN_001f9ff8(u.m.b, D_L06_00162208); + set_scale_matrix(u.m.b, D_L06_00162208); multiply_matrix(u.m.a, u.m.a, u.m.b); for (i = 0; i < 4; i++) { euler_rotation_matrix(u.m.b, &D_L06_001FE890[i * 4]); @@ -2557,9 +7856,9 @@ void FUN_L06_00305000(char *m) { Q[1] = D_L06_001621EC; Q[2] = D_L06_001621F0; transform_vector_by_basis(P, P, m + 0xC0); - FUN_001f9a10(P, P, m + 0x10); + fast_vec_add(P, P, m + 0x10); transform_vector_by_basis(Q, Q, m + 0xC0); - FUN_001f9a10(Q, Q, m + 0x10); + fast_vec_add(Q, Q, m + 0x10); coll_line_fix(P, Q, 0, (int)m, (int)A); P[0] = D_L06_001621E8; P[1] = -D_L06_001621EC; @@ -2568,9 +7867,9 @@ void FUN_L06_00305000(char *m) { Q[1] = -D_L06_001621EC; Q[2] = D_L06_001621F0; transform_vector_by_basis(P, P, m + 0xC0); - FUN_001f9a10(P, P, m + 0x10); + fast_vec_add(P, P, m + 0x10); transform_vector_by_basis(Q, Q, m + 0xC0); - FUN_001f9a10(Q, Q, m + 0x10); + fast_vec_add(Q, Q, m + 0x10); coll_line_fix(P, Q, 0, (int)m, (int)A); } diff --git a/src/overlays/l06/gameplay/entities/hangar_door.c b/src/overlays/l06/gameplay/entities/hangar_door.c index 4af97fbbba..92271cd168 100644 --- a/src/overlays/l06/gameplay/entities/hangar_door.c +++ b/src/overlays/l06/gameplay/entities/hangar_door.c @@ -173,14 +173,14 @@ void FUN_L06_002f9698(char *arg) { extern char *D_L06_0015FFD8; extern char D_0013E533[]; extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); -extern float FUN_001fa580(float, float); -extern float FUN_001fa5c8(float, float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); +extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern short *D_L06_001ABFC0_p[] __asm__("D_L06_001ABFC0"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern short D_L06_00161ED8 __attribute__((sda)); float FUN_L06_002f96f8(char *self) { @@ -188,18 +188,18 @@ float FUN_L06_002f96f8(char *self) { float hi, lo, ang, dist, v[3]; short *p; if ((unsigned char)self[0x21] == 0xFF) { - return FUN_001f9e90(*(float *)(self + 0x10) - *(float *)(owner + 0x10), + return fast_arc_tan(*(float *)(self + 0x10) - *(float *)(owner + 0x10), *(float *)(self + 0x14) - *(float *)(owner + 0x14)); } lo = -(*(float *)&D_L06_00161ED8 * DEG_TO_RAD); hi = *(float *)&D_L06_00161ED8 * DEG_TO_RAD; - ang = FUN_001f9e90(*(float *)(self + 0x10) - *(float *)(owner + 0x10), + ang = fast_arc_tan(*(float *)(self + 0x10) - *(float *)(owner + 0x10), *(float *)(self + 0x14) - *(float *)(owner + 0x14)); dist = FUN_001f9b48(owner + 0x10, self + 0x10); - v[0] = FUN_001f9dc8(ang) * 2.0f; - v[1] = FUN_001f9de0(ang) * 2.0f; + v[0] = fast_cos(ang) * 2.0f; + v[1] = fast_sin(ang) * 2.0f; v[2] = 0.0f; - FUN_001f9a10(v, v, D_0013E533 + 0xE9D); + fast_vec_add(v, v, D_0013E533 + 0xE9D); p = D_L06_001ABFC0_p[(unsigned char)self[0x21]]; if (p == 0) { return 0.0f; @@ -208,10 +208,10 @@ float FUN_L06_002f96f8(char *self) { int idx = *(unsigned short *)p & 0x7FFF; char *e = (char *)(idx * 256 + (int)D_L06_0015FFD8); if ((unsigned char)e[0x20] == 8 || FUN_001f9b48(e + 0x10, owner + 0x10) < dist) { - float d = FUN_001f9e90( + float d = fast_arc_tan( *(float *)(D_L06_0015FFD8 + idx * 256 + 0x10) - *(float *)(owner + 0x10), *(float *)(D_L06_0015FFD8 + idx * 256 + 0x14) - *(float *)(owner + 0x14)); - float r = FUN_001fa5c8(d, ang); + float r = fast_subtract_rotations(d, ang); if (r > 0.0f && r < hi) { hi = r; } else if (r < 0.0f && r > lo) { @@ -219,7 +219,7 @@ float FUN_L06_002f96f8(char *self) { } } } while (*p++ >= 0); - return FUN_001fa580(FUN_001fa580(lo, fast_difference_between_rotations(hi, lo) * 0.5f), ang); + return fast_add_rotations(fast_add_rotations(lo, fast_difference_between_rotations(hi, lo) * 0.5f), ang); } extern int D_L06_001ABFC0[]; extern int D_L06_0015FFD8_d __asm__("D_L06_0015FFD8"); @@ -294,13 +294,13 @@ void FUN_L06_002fb090(char *moby) { extern char D_L06_00167540[] __attribute__((section(".data"))); extern f32 D_0015ED70_s __asm__("D_0015ED70"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float FUN_00213f38(float *, float *, float, float, float, float); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void lerp_vector(void *, void *, void *, float) __asm__("FUN_001f9a40"); -extern void FUN_001f9bf8(void *, void *, float); +extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void FUN_L00_002ea9d8(void *); extern void FUN_L00_002eaa30(void *); @@ -319,18 +319,18 @@ int FUN_L06_002fb2a8(char *moby) { t = *(float *)&D_0015ED70_s * 3.0f; FUN_00213f38((float *)(data + 0x118), (float *)(data + 0x11C), 1.0f, t, t, frame_time + frame_time); - FUN_001f9bf8(v1, moby + 0xC0, 8.0f); - FUN_001f9a10(v1, v1, moby + 0x10); + fast_vec_normalize(v1, moby + 0xC0, 8.0f); + fast_vec_add(v1, v1, moby + 0x10); x = &hero; v1[2] = x->motion.pos.f[2] + 2.0f; - FUN_001f9bf8(v2, x->unk0, -7.0f); - FUN_001f9a10(v2, v2, &x->motion.pos); + fast_vec_normalize(v2, x->unk0, -7.0f); + fast_vec_add(v2, v2, &x->motion.pos); v2[2] += 4.0f; pos = moby + 0x10; lerp_vector(v0, v1, v2, *(float *)(data + 0x118)); } - m[2] = FUN_001f9e90(*(float *)(moby + 0x10) - v0[0], *(float *)(moby + 0x14) - v0[1]); - m[1] = -FUN_001f9e90(FUN_001f9b80(v0, pos), *(float *)(moby + 0x18) - v0[2]) - + m[2] = fast_arc_tan(*(float *)(moby + 0x10) - v0[0], *(float *)(moby + 0x14) - v0[1]); + m[1] = -fast_arc_tan(vector_distance(v0, pos), *(float *)(moby + 0x18) - v0[2]) - (1.0f - *(float *)(data + 0x118)) * 30.0f * DEG_TO_RAD; FUN_L00_002ea9d8(v0); FUN_L00_002eaa30(m); @@ -376,18 +376,18 @@ int FUN_L06_002fb668(char *moby) { t = frame_time_sq * 0.5f; FUN_00213f38((float *)(data + 0x118), (float *)(data + 0x11C), 1.0f, t, t, frame_time * 0.5f); - FUN_001f9bf8(v1, moby + 0xC0, 8.0f); - FUN_001f9a10(v1, v1, moby + 0x10); + fast_vec_normalize(v1, moby + 0xC0, 8.0f); + fast_vec_add(v1, v1, moby + 0x10); x = &hero; v1[2] = x->motion.pos.f[2] + 2.0f; - FUN_001f9bf8(v2, x->unk0, -7.0f); - FUN_001f9a10(v2, v2, &x->motion.pos); + fast_vec_normalize(v2, x->unk0, -7.0f); + fast_vec_add(v2, v2, &x->motion.pos); v2[2] += 4.0f; pos = moby + 0x10; lerp_vector(v0, v1, v2, *(float *)(data + 0x118)); } - m[2] = FUN_001f9e90(*(float *)(moby + 0x10) - v0[0], *(float *)(moby + 0x14) - v0[1]); - m[1] = -FUN_001f9e90(FUN_001f9b80(v0, pos), *(float *)(moby + 0x18) - v0[2]) - + m[2] = fast_arc_tan(*(float *)(moby + 0x10) - v0[0], *(float *)(moby + 0x14) - v0[1]); + m[1] = -fast_arc_tan(vector_distance(v0, pos), *(float *)(moby + 0x18) - v0[2]) - (1.0f - *(float *)(data + 0x118)) * 30.0f * DEG_TO_RAD; FUN_L06_00312a78(v0); FUN_L06_00312ad0(m); @@ -441,7 +441,8 @@ extern float FUN_L00_0025be00(float *, float *, float, float, float, float); extern int D_L06_0015F5C4; extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); -void FUN_L06_002b4770(char *m) { +void hangar_door_update(char *m) __asm__("FUN_L06_002b4770"); +void hangar_door_update(char *m) { char *d = *(char **)(m + 0x78); float z; float a; @@ -471,7 +472,7 @@ void FUN_L06_002b4770(char *m) { } switch (((unsigned char *)m)[0x20]) { case 0: - *(float *)(d + 0xC) = FUN_001f9b80(m + 0x10, D_L06_001600EC + *(int *)d * 0x80 + 0x30); + *(float *)(d + 0xC) = vector_distance(m + 0x10, D_L06_001600EC + *(int *)d * 0x80 + 0x30); *(float *)(d + 4) = *(float *)(m + 0x48); if (*(float *)(m + 0x44) != 0.0f) { m[0x20] = 1; @@ -605,7 +606,7 @@ int FUN_L06_002e9ea0(int index) { /* Ported from rac1-decomp (src/overlays/l06_blarg/vendor_002B5990.c: func_L06_002F4F08), where it is exact; names translated to the US level program. */ extern float fast_add_rotations(float, float); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); @@ -618,7 +619,8 @@ extern int func_0022ED80_r(int, int, int) __asm__("FUN_0022da68"); extern short D_L06_00161D24 __attribute__((sda)); extern short D_L06_00161D28 __attribute__((sda)); -void FUN_L06_002f3ad8(char *m) { +void toxic_gas_vent_update(char *m) __asm__("FUN_L06_002f3ad8"); +void toxic_gas_vent_update(char *m) { char *d = *(char **)(m + 0x78); float s; if (*(int *)(d + 0x90) >= 0) { @@ -647,7 +649,7 @@ void FUN_L06_002f3ad8(char *m) { *(int *)(d + 0x94) = -1; break; case 1: - if (FUN_L00_0028d8c0(m, *(int *)(d + 0x94)) == 0) { + if (voice_is_playing(m, *(int *)(d + 0x94)) == 0) { *(int *)(d + 0x94) = func_0022ED80_r(0, 4, (int)m); } FUN_L06_002f3d70(m); @@ -657,7 +659,7 @@ void FUN_L06_002f3ad8(char *m) { *(float *)(m + 0x48) = fast_add_rotations(*(float *)(d + 0x84), s); break; case 2: - if (FUN_L00_0028d8c0(m, *(int *)(d + 0x94)) == 0) { + if (voice_is_playing(m, *(int *)(d + 0x94)) == 0) { *(int *)(d + 0x94) = func_0022ED80_r(0, 4, (int)m); } FUN_L06_002f3d70(m); @@ -986,12 +988,12 @@ extern int D_L06_00161DA0 __attribute__((sda)); extern int D_L06_00161DA4 __attribute__((sda)); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern void FUN_L00_00216f90(void *, void *, int, int); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void allocate_voice_for_target_entry_alt(int, int, int) __asm__("FUN_0022da68"); extern void memcard_save_data(s32, s32) __asm__("func_0020B178"); float absolute_float_c2(float input) __asm__("func_001F99C0"); s32 FUN_L00_00203908(s32 a, s32 b); -void FUN_L00_002502a0(int idx); +void jet_clear_persistent(int idx) __asm__("FUN_L00_002502a0"); void FUN_L00_00263d40(int a, int b); void FUN_L06_00239528(void); void FUN_L06_002f5d78(char *moby); @@ -1346,12 +1348,12 @@ extern int random_int_2f6470(int) __asm__("FUN_00213260"); extern int make_particle_color_2f6470(int, int, float) __asm__("FUN_001fa6e0"); extern int make_particle_color2_2f6470(float) __asm__("FUN_001fa6d0"); extern void random_vector_2f6470(void *, float, float) __asm__("FUN_L00_00257d78"); -extern void spawn_spark_2f6470(void *, void *, int, float, unsigned char, unsigned char, int) __asm__("FUN_L00_002730e0"); +extern void FUN_L00_002730e0(void *, void *, int, float, unsigned char, unsigned char, int); extern void collision_setup_2f6470(void *, char *, int, float, void *) __asm__("FUN_L00_00259888"); extern void collision_response_2f6470(int, void *) __asm__("FUN_L00_00259a88"); extern int collision_check_2f6470(char *, int, int) __asm__("FUN_L00_0025a420"); extern void play_sound_2f6470(int, int) __asm__("FUN_L00_00203908"); -extern void set_update_2f6470(void *, char *) __asm__("FUN_L06_00210fc8"); +extern void FUN_L06_00210fc8(void *, char *); #include "rnc/audio/voice_pool.h" #include "rnc/ui/help/help_record.h" @@ -1455,7 +1457,7 @@ void FUN_L06_002f6470(char *moby) { } else { approach_value_2f6470((float *)(data + 0x18), 0.0f, frame_time_2f6470 + frame_time_2f6470); } - if (*(float *)(data + 0x18) != 0.0f) set_update_2f6470(FUN_L06_002f6dd0, moby); + if (*(float *)(data + 0x18) != 0.0f) FUN_L06_00210fc8(FUN_L06_002f6dd0, moby); if (D_00141968[43].count == 0) { if (*(short *)(data + 0x16) == 0 && collision_check_2f6470(moby, 0x330000, 0)) { (*(short *)(data + 0x14))++; @@ -1525,7 +1527,7 @@ void FUN_L06_002f6470(char *moby) { dot = random_float_between_alt_2f6470(D_L06_00161E24, D_L06_00161E28); frame = make_particle_color2_2f6470(random_float_between_alt_2f6470((float)D_L06_00161E2C, (float)D_L06_00161E30)); random_vector_2f6470(&vectors.effect, D_L06_00161E34 * D_0015ED6C, D_L06_00161E38 * D_0015ED6C); - spawn_spark_2f6470(&vectors.offset, &vectors.effect, color, dot, (unsigned char)scale_game_frames_2f6470(frame), (unsigned char)random_int_2f6470(255), 0); + FUN_L00_002730e0(&vectors.offset, &vectors.effect, color, dot, (unsigned char)scale_game_frames_2f6470(frame), (unsigned char)random_int_2f6470(255), 0); } while (j >= 0); } while ((i = vectors.i) < 9); moby[0x20] = 3; @@ -1777,7 +1779,7 @@ extern float D_L06_00161ED0 __attribute__((sda)); extern float D_L06_00161ED4 __attribute__((sda)); extern int D_L06_00161EDC __attribute__((sda)); extern int D_L06_00161EE0 __attribute__((sda)); -extern int FUN_L00_001f2868(); +extern int collect_mobies_in_sphere() __asm__("FUN_L00_001f2868"); extern int FUN_L00_0024f7c8(); extern int FUN_L00_00259740(); extern int is_point_inside_clip_volume_c(void *arg0, int arg1) __asm__("func_00214720"); @@ -1789,12 +1791,12 @@ f32 compute_interpolated_record_value(void *anim) __asm__("FUN_0020c9e0"); float FUN_L00_0025abf0(float *a, float *b, float *out, float speed, float g); float FUN_L06_002f96f8_c(char *self) __asm__("FUN_L06_002f96f8"); float absolute_float_c3(float input) __asm__("func_001F99C0"); -int FUN_L00_0025c698(void *moby, void *motion); +int mine_fall(void *moby, void *motion) __asm__("FUN_L00_0025c698"); s32 FUN_L00_00258b50(void *m, void *c, void *v, Vec4 *out, f32 f); s32 FUN_L00_00261b48(s32 path_index, OvlVec4 *start, OvlVec4 *end, OvlVec4 *out); void FUN_L00_00258278(unsigned char *m, float *ptr, float t, float b, float c, float limit); void FUN_L00_0025a120(char *o); -void FUN_L00_0025c558(u8 *a, void *b, int c, int d, int e, float f); +void trooper_start_knockback(u8 *a, void *b, int c, int d, int e, float f) __asm__("FUN_L00_0025c558"); void FUN_L00_0025f3e8(char *owner, char *pos, float scale, float flash); void FUN_L00_00263ac8(float x, int a, int b, unsigned char *p); void FUN_L00_00263e30(unsigned char *m, int n, int cnt, int base, int range, int cnt2, int flag); @@ -1831,7 +1833,8 @@ extern void func_0020D678_91A8(Moby *) __asm__("FUN_0020c828"); extern char D_L06_00167540_macro[] __asm__("D_L06_00167540"); extern int *D_L06_001B0C30_macro[] __asm__("D_L06_001B0C30"); -void FUN_L06_002f7d78(Moby *moby) +void alien_snapper_update(Moby *moby) __asm__("FUN_L06_002f7d78"); +void alien_snapper_update(Moby *moby) { SnapperVars_91A8 *vars = (SnapperVars_91A8 *)moby->pvars; Moby *target; @@ -1925,7 +1928,7 @@ void FUN_L06_002f7d78(Moby *moby) } } } else if (moby->anim_flags & 2) { - if (FUN_001f9b80(&moby->pos, ((char *)&D_0013F3D0)) < D_L06_00161ED0) { + if (vector_distance(&moby->pos, ((char *)&D_0013F3D0)) < D_L06_00161ED0) { moby->state = 8; vars->angle_jitter = random_float_between_c2(vars->jitter_degrees * 0.017453292f, -(vars->jitter_degrees * 0.017453292f)); if (moby->prev_seq != 1) { @@ -1961,7 +1964,7 @@ void FUN_L06_002f7d78(Moby *moby) case 6: moby->state = 5; qcopy(&vars->home, &((Node_2F69D0 *)D_L06_001600EC)[vars->node].v30); - vars->return_speed = FUN_001f9b80(&moby->pos, &vars->home) / (float)scale_game_frames_alt(60); + vars->return_speed = vector_distance(&moby->pos, &vars->home) / (float)scale_game_frames_alt(60); vars->f8C = func_L00_0025BC48_91A8(&moby->pos, &vars->home, 0, vars->return_speed, -vars->f80); vars->f94 = 5; vars->fAD = 3; @@ -2001,7 +2004,7 @@ void FUN_L06_002f7d78(Moby *moby) func_00214D28_91A8(&vars->speed, vars->base_speed * D_0015ED6C_c2, D_0015ED70 * 6.0f); func_L00_002592B0_91A8(moby, func_L00_001FF860_91A8(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), &vars->turn_speed, 0.05f, 0.3f, D_0015ED6C_c2 * 6.2831855f); - dist = FUN_001f9b80(&moby->pos, &target->pos); + dist = vector_distance(&moby->pos, &target->pos); if (D_L06_00161EC4 < dist) { dist = D_L06_00161EC4; } @@ -2030,7 +2033,7 @@ void FUN_L06_002f7d78(Moby *moby) if (moby->prev_seq != 5) { func_00213DE0_91A8(moby, 5, 0, scale_game_frames_alt(10)); } - } else if (FUN_001f9b80(&moby->pos, &target->pos) < D_L06_00161EC4) { + } else if (vector_distance(&moby->pos, &target->pos) < D_L06_00161EC4) { moby->state = 0xB; if (moby->prev_seq != 4) { func_00213DE0_91A8(moby, 4, 0, scale_game_frames_alt(10)); @@ -2056,14 +2059,14 @@ void FUN_L06_002f7d78(Moby *moby) } break; case 8: { - if (D_L06_00161EC4 < FUN_001f9b80(&moby->pos, &target->pos)) { + if (D_L06_00161EC4 < vector_distance(&moby->pos, &target->pos)) { func_00214D28_91A8(&vars->speed, vars->base_speed * D_0015ED6C_c2, D_0015ED70 * 6.0f); } else { func_00214D28_91A8(&vars->speed, 0.0f, D_0015ED70 * 20.0f); } func_L00_002592B0_91A8(moby, func_L00_001FF860_91A8(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), &vars->turn_speed, 0.05f, 0.3f, D_0015ED6C_c2 * 6.2831855f); - dist = FUN_001f9b80(&moby->pos, &target->pos); + dist = vector_distance(&moby->pos, &target->pos); if (D_L06_00161EC4 < dist) { dist = D_L06_00161EC4; } @@ -2082,7 +2085,7 @@ void FUN_L06_002f7d78(Moby *moby) func_L00_00262DF0_91A8(0.5f, vars->path, &moby->pos, &moby->pos); if (D_L06_00161EC8 < distance_xyz_c(&moby->pos, &vars->home) || vars->f164 == 2) { moby->state = 0xC; - } else if (FUN_001f9b80(&moby->pos, &target->pos) < D_L06_00161EC4) { + } else if (vector_distance(&moby->pos, &target->pos) < D_L06_00161EC4) { if (func_001F9B88_91A8(target->pos.z - moby->pos.z) < 1.0f) { char *hero = ((char *)&D_0013F350); @@ -2176,7 +2179,7 @@ void FUN_L06_002f7d78(Moby *moby) func_L00_001FF860_91A8(*(float *)(hero + 0x80) - moby->pos.x, *(float *)(hero + 0x84) - moby->pos.y), &vars->turn_speed, D_0015ED70 * 6.2831855f, D_0015ED70 * 6.2831855f, D_0015ED6C_c2 * 12.566371f); - if (FUN_001f9b80(&moby->pos, hero + 0x80) < 4.0f) { + if (vector_distance(&moby->pos, hero + 0x80) < 4.0f) { moby->state = 0x10; if (moby->prev_seq != 4) { func_00213DE0_91A8(moby, 4, 0, scale_game_frames_alt(20)); @@ -2299,13 +2302,13 @@ int D_L06_00161EE8 = 0x80808080; int D_L06_00161EEC = 0x80604040; extern int FUN_001fa6e0(int, int, float); extern int FUN_00213928_c() __asm__("FUN_00213928"); -extern int FUN_L00_002598b0(); +extern int play_entity_sound() __asm__("FUN_L00_002598b0"); extern int FUN_L00_0025a420_c() __asm__("FUN_L00_0025a420"); extern int tick_countdown_32_alt(void *) __asm__("FUN_001f9740"); float absolute_float_c(float input) __asm__("func_001F99C0"); int FUN_L00_0025ff38_c(float best, char *a, char *o, int *excluded, int excluded_count, void *region, int region_count) __asm__("FUN_L00_0025ff38"); void FUN_L00_00257470_c(unsigned char *m, int flags, int arg) __asm__("FUN_L00_00257470"); -void FUN_L00_0025c558(u8 *a, void *b, int c, int d, int e, float f); +void trooper_start_knockback(u8 *a, void *b, int c, int d, int e, float f) __asm__("FUN_L00_0025c558"); void FUN_L00_0025d458_c(void *a, void *s) __asm__("FUN_L00_0025d458"); void FUN_L00_0025d538_c(s32 id, void *s) __asm__("FUN_L00_0025d538"); void FUN_L06_002f9698_c(char *arg) __asm__("FUN_L06_002f9698"); @@ -2564,7 +2567,8 @@ extern unsigned char D_0013D3A7_q[] __asm__("D_0013D3A7"); extern unsigned char D_0013D4FD_q[] __asm__("D_0013D4FD"); extern unsigned char D_0013D407_q[] __asm__("D_0013D407"); -void FUN_L06_002f9a28(unsigned char *moby) +void alien_queen_update(unsigned char *moby) __asm__("FUN_L06_002f9a28"); +void alien_queen_update(unsigned char *moby) { unsigned char *data = *(unsigned char **)(moby + 0x78); char *target; @@ -2911,13 +2915,13 @@ extern int fun_00213928(void *, void *, void *, int, int *, float *, int, int) _ extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void set_animation_parameter(int, int) __asm__("FUN_001ff570"); extern void FUN_L00_00257470(void *, int, int); -extern void FUN_L00_00284e50(void *, void *); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern void FUN_00212f90(void *, int, int, int); -extern void FUN_L00_0025d458(void *, void *); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *, void *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); extern float scale_recovery_time(float) __asm__("FUN_L06_00216fa8"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern void euler_rotation_basis(void *, void *) __asm__("FUN_001fa030"); extern float fast_add_rotations(float, float); extern float fast_sin(float); @@ -3009,7 +3013,7 @@ void FUN_L06_002fa9c0(char *moby) { moby[0x20] = 14; FUN_L00_00257470(moby, 0, -1); base = D_L06_001600EC + (*(int *)(data + 0xF8) << 7); - FUN_L00_00284e50(base + 0x30, base + 0x70); + jet_reset_camera(base + 0x30, base + 0x70); *(unsigned short *)(moby + 0x34) &= 0xEFFF; if ((unsigned char)moby[0x53] != 10) FUN_00212f90(moby, 10, 0, scale_game_frames(10)); @@ -3018,10 +3022,10 @@ void FUN_L06_002fa9c0(char *moby) { } } hit_response_done: - FUN_L00_0025d458(moby, data + 0x60); + trooper_anim_update(moby, data + 0x60); } *(unsigned char *)(moby + 0xA4) = 0xFF; - FUN_L00_0025d538(moby, data + 0x60); + trooper_anim_finish(moby, data + 0x60); if ((data[0x2E] & 2) && (unsigned char)moby[0x20] != 15) { if (*(int *)(data + 0x10C) != -1) { set_animation_parameter(*(int *)(data + 0x10C), 0); @@ -3043,7 +3047,7 @@ void FUN_L06_002fa9c0(char *moby) { moby[0x20] = 3; *(int *)(data + 0x170) = 0; qcopy(moby + 0x10, data + 0xC0); - *(float *)(moby + 0x48) = FUN_001f9e90(hero.motion.pos.f[0] - *(float *)(moby + 0x10), + *(float *)(moby + 0x48) = fast_arc_tan(hero.motion.pos.f[0] - *(float *)(moby + 0x10), hero.motion.pos.f[1] - *(float *)(moby + 0x14)); euler_rotation_basis(moby + 0xC0, moby + 0x40); if ((unsigned char)moby[0x53] != 6) @@ -3057,7 +3061,7 @@ void FUN_L06_002fa9c0(char *moby) { base = D_L06_001600EC + (*(int *)(data + 0xF8) << 7); FUN_L00_00216f90(base + 0x30, base + 0x70, 0x72, 1); qcopy(moby + 0x10, data + 0xC0); - *(float *)(moby + 0x48) = FUN_001f9e90(hero.motion.pos.f[0] - *(float *)(moby + 0x10), + *(float *)(moby + 0x48) = fast_arc_tan(hero.motion.pos.f[0] - *(float *)(moby + 0x10), hero.motion.pos.f[1] - *(float *)(moby + 0x14)); euler_rotation_basis(moby + 0xC0, moby + 0x40); if ((unsigned char)moby[0x53] != 6) @@ -3085,7 +3089,7 @@ void FUN_L06_002fa9c0(char *moby) { extern char *D_L06_0016016C __asm__("D_L06_001600EC"); extern int *D_L06_001B0FB0[] __asm__("D_L06_001B0C30"); extern void FUN_L00_00216f90(void *, void *, int, int); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); void FUN_L06_002fb148(char *moby) { float v0[4], m[4], v1[4]; @@ -3098,10 +3102,10 @@ void FUN_L06_002fb148(char *moby) { normalize_vector_xyz(v1, moby + 0xC0, 8.0f); add_vector_xyz(v0, v0, v1); clear_u64_value(m); - m[2] = FUN_001f9e90(*(float *)(moby + 0x10) - v0[0], *(float *)(moby + 0x14) - v0[1]); + m[2] = fast_arc_tan(*(float *)(moby + 0x10) - v0[0], *(float *)(moby + 0x14) - v0[1]); m[1] = - -FUN_001f9e90(FUN_001f9b80(v0, moby + 0x10), *(float *)(moby + 0x18) - v0[2]) - 0.5235988f; - FUN_L00_002eaaa0(v0, m, 1, 0, 0); + -fast_arc_tan(vector_distance(v0, moby + 0x10), *(float *)(moby + 0x18) - v0[2]) - 0.5235988f; + jet_mount(v0, m, 1, 0, 0); FUN_L00_002ea9d8(v0); FUN_L00_002eaa30(m); *D_L06_001B0FB0[*(int *)(data + 0xEC)] = 0; @@ -3178,8 +3182,8 @@ extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); extern float absolute_float(float) __asm__("FUN_001f99c0"); -extern void FUN_001f9bf8(void *, void *, float); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern float FUN_001f9b48(void *, void *); extern float D_L06_00161F1C __attribute__((sda)); extern float D_L06_00161F20 __attribute__((sda)); @@ -3233,10 +3237,10 @@ void FUN_L06_002fbfb0(char *moby) { moby[0x20] = 2; return; } - FUN_001f9bf8(v, data + 0x30, D_L06_00161F1C); - FUN_001f9a10(moby + 0x10, data + 0x10, v); - FUN_001f9bf8(v, data + 0x30, -D_L06_00161F20); - FUN_001f9a10(*(char **)(data + 0x40) + 0x10, data + 0x10, v); + fast_vec_normalize(v, data + 0x30, D_L06_00161F1C); + fast_vec_add(moby + 0x10, data + 0x10, v); + fast_vec_normalize(v, data + 0x30, -D_L06_00161F20); + fast_vec_add(*(char **)(data + 0x40) + 0x10, data + 0x10, v); FUN_L00_00250df8(*(char **)(data + 0x40)); moby[0x20] = 5; return; @@ -3259,10 +3263,10 @@ void FUN_L06_002fbfb0(char *moby) { b = FUN_001f9b48(child + 0x10, data + 0x10); FUN_00213f38(&a, &((float *)data)[2], D_L06_00161F1C, frame_time_sq * 10.0f, frame_time_sq * 20.0f, frame_time * 5.0f); FUN_00213f38(&b, &((float *)data)[0x11], D_L06_00161F20, frame_time_sq * 10.0f, frame_time_sq * 20.0f, frame_time * 5.0f); - FUN_001f9bf8(v, data + 0x30, a); - FUN_001f9a10(moby + 0x10, data + 0x10, v); - FUN_001f9bf8(v, data + 0x30, -b); - FUN_001f9a10(*(char **)(data + 0x40) + 0x10, data + 0x10, v); + fast_vec_normalize(v, data + 0x30, a); + fast_vec_add(moby + 0x10, data + 0x10, v); + fast_vec_normalize(v, data + 0x30, -b); + fast_vec_add(*(char **)(data + 0x40) + 0x10, data + 0x10, v); FUN_L00_00250df8(*(char **)(data + 0x40)); if (absolute_float(a - D_L06_00161F1C) < 0.01f && absolute_float(b - D_L06_00161F20) < 0.01f) moby[0x20] = 5; return; @@ -3322,10 +3326,10 @@ void FUN_L06_002fbfb0(char *moby) { FUN_00213f38(&phase_b, &((float *)data)[0x11], target_b, acceleration * frame_time_sq, max_speed * frame_time_sq, damping * frame_time); FUN_00213f38((float *)(moby + 0x44), &((float *)data)[3], target_rot_a, rotation_acceleration * DEG_TO_RAD * frame_time_sq, rotation_speed * DEG_TO_RAD * frame_time_sq, rotation_damping * DEG_TO_RAD * frame_time); FUN_00213f38((float *)(*(char **)(data + 0x40) + 0x44), &((float *)data)[0x12], target_rot_b, rotation_acceleration * DEG_TO_RAD * frame_time_sq, rotation_speed * DEG_TO_RAD * frame_time_sq, rotation_damping * DEG_TO_RAD * frame_time); - FUN_001f9bf8(v, data + 0x30, phase_a); - FUN_001f9a10(moby + 0x10, data + 0x10, v); - FUN_001f9bf8(v, data + 0x30, -phase_b); - FUN_001f9a10(*(char **)(data + 0x40) + 0x10, data + 0x10, v); + fast_vec_normalize(v, data + 0x30, phase_a); + fast_vec_add(moby + 0x10, data + 0x10, v); + fast_vec_normalize(v, data + 0x30, -phase_b); + fast_vec_add(*(char **)(data + 0x40) + 0x10, data + 0x10, v); FUN_L00_00250df8(*(char **)(data + 0x40)); if (!fast_dec_timer(data + 0x4c)) return; moby[0xbc] = next_phase; @@ -3454,10 +3458,10 @@ int D_L06_00161F74 = 0x80208020; int D_L06_00161F78 = -1; extern int FUN_001fa6e0(int, int, float); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); -extern void FUN_L00_00260738(char *, void *, void *, void *); -extern void FUN_L00_00298840(int); +extern void update_entity_matrix(char *, void *, void *, void *) __asm__("FUN_L00_00260738"); +extern void start_scene(int) __asm__("FUN_L00_00298840"); extern void FUN_L01_00231348(int, int, int); -extern void FUN_L01_0027a248(int, int); +extern void jet_game_state(int, int) __asm__("FUN_L01_0027a248"); extern void FUN_L06_00227cf8(void); extern void fade_to_black(s32 n) __asm__("FUN_001f4a58"); extern void scale_vector_xyz_c(void *, void *, float) __asm__("FUN_001f9a68"); @@ -3552,12 +3556,12 @@ void FUN_L06_002fc640(Moby_2FDA70 *moby) { char *b = D_L06_001600EC_c + (d->f7C << 7); FUN_L00_00216f90(b + 0x30, b + 0x70, 0, 1); } - FUN_L01_0027a248(0, 10); + jet_game_state(0, 10); ((Moby_2FDA70 *)D_L06_0015FFD8_c)[d->f6C].f34 |= 1; ((Moby_2FDA70 *)D_L06_0015FFD8_c)[d->f6C].f34 |= 2; if (D_0013D5DD_2FDA70[0x10] != 0 && D_L06_00161F78 == 0) { D_L06_00161F78 = 1; - FUN_L00_00298840(3); + start_scene(3); moby->state = 2; break; } @@ -3574,7 +3578,7 @@ void FUN_L06_002fc640(Moby_2FDA70 *moby) { FUN_L00_00216f90(b + 0x30, b + 0x70, 0, 1); } FUN_L01_00231348(1, 0x43, (int)(D_L06_0015FFD8_c + (d->f6C << 8))); - FUN_L01_0027a248(2, 7); + jet_game_state(2, 7); } else if (d->f84 == 0) { fade_to_black(scale_game_frames_alt(0x10)); FUN_L06_002f5360_c(D_L06_0015FFD8_c + (d->f64 << 8)); @@ -3604,7 +3608,7 @@ void FUN_L06_002fc640(Moby_2FDA70 *moby) { && ((Hero_2FDA70 *)(D_0013F350))->f30E == 0 && fast_dec_timer(&d->f90) != 0 && moby->pos.z + 0.29f < ((Hero_2FDA70 *)(D_0013F350))->pos.z - && FUN_001f9b80(&((Hero_2FDA70 *)(D_0013F350))->pos, &moby->pos) < 1.0f) { + && vector_distance(&((Hero_2FDA70 *)(D_0013F350))->pos, &moby->pos) < 1.0f) { allocate_voice_for_target_entry(0, 0, (int)moby); if (moby->state == 3) { moby->state = 5; @@ -3615,7 +3619,7 @@ void FUN_L06_002fc640(Moby_2FDA70 *moby) { FUN_L06_002f53e8_c(D_L06_0015FFD8_c + (d->f68 << 8)); d->f90 = scale_game_frames_alt(0x78); } - } else if (FUN_001f9b80(&moby->pos, &((Hero_2FDA70 *)(D_0013F350))->pos) < 24.0f + } else if (vector_distance(&moby->pos, &((Hero_2FDA70 *)(D_0013F350))->pos) < 24.0f && moby->state == 3 && ((Hero_2FDA70 *)(D_0013F350))->pos.z + 5.0f < moby->pos.z) { d->f84 = 1; @@ -3624,7 +3628,7 @@ void FUN_L06_002fc640(Moby_2FDA70 *moby) { FUN_L06_002f53e8_c(D_L06_0015FFD8_c + (d->f64 << 8)); FUN_L06_002f53e8_c(D_L06_0015FFD8_c + (d->f60 << 8)); d->f90 = scale_game_frames_alt(0x78); - } else if (FUN_001f9b80(&moby->pos, &((Hero_2FDA70 *)(D_0013F350))->pos) < 24.0f + } else if (vector_distance(&moby->pos, &((Hero_2FDA70 *)(D_0013F350))->pos) < 24.0f && moby->state == 4 && moby->pos.z < ((Hero_2FDA70 *)(D_0013F350))->pos.z - 5.0f) { moby->state = 6; @@ -3655,7 +3659,7 @@ void FUN_L06_002fc640(Moby_2FDA70 *moby) { } case 7: case 8: - if (FUN_001f9b80(&((Hero_2FDA70 *)(D_0013F350))->pos, &moby->pos) >= 1.0f) { + if (vector_distance(&((Hero_2FDA70 *)(D_0013F350))->pos, &moby->pos) >= 1.0f) { if (moby->state == 7) { moby->state = 3; } else { @@ -3684,5 +3688,5 @@ void FUN_L06_002fc640(Moby_2FDA70 *moby) { moby->f90 = FUN_001fa6e0(D_L06_00161F6C, D_L06_00161F70, f); } add_vector_xyz(&v0, &v0, &moby->pos); - FUN_L00_00260738(d->f20, &v0, &v10, &moby->rot); + update_entity_matrix(d->f20, &v0, &v10, &moby->rot); } diff --git a/src/overlays/l06/gameplay/hero/00222fb8.c b/src/overlays/l06/gameplay/hero/00222fb8.c index c69816dcb1..f3cd921a91 100644 --- a/src/overlays/l06/gameplay/hero/00222fb8.c +++ b/src/overlays/l06/gameplay/hero/00222fb8.c @@ -298,12 +298,12 @@ extern f32 D_L06_001745E8 __attribute__((section(".data"))); void FUN_001f99f8_c(void *) __asm__("FUN_001f99f8"); void hero_get_collision_ray_endpoints(void *, void *, s32, f32, f32) __asm__("FUN_L00_002126b8"); -s32 FUN_001efa68(void *, void *, s32, s32, s32); +s32 collision_line(void *, void *, s32, s32, s32) __asm__("FUN_001efa68"); s32 coll_sound_class(void) __asm__("FUN_L00_001f3608"); s32 collision_hit_material(void) __asm__("FUN_001f0b58"); f32 resolve_camera_surface_height(void *, void *) __asm__("FUN_002135f0"); s32 FUN_L00_0025e3b8(s32); -u8 *FUN_002141f8(s32); +u8 *suck_get_aim_height(s32) __asm__("FUN_002141f8"); f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); void sceVu0Normalize(void *, void *) __asm__("FUN_00125180"); f32 FUN_L00_00233d30(void *); @@ -425,7 +425,7 @@ void FUN_L06_00229650(void) { g = hero_lui.unk234 * 2.9f; } hero_get_collision_ray_endpoints(&v10, &v0, k, g, -48.0f); - if (FUN_001efa68(&v10, &v0, 2, hero_lui.moby, 0) == 0) { + if (collision_line(&v10, &v0, 2, hero_lui.moby, 0) == 0) { goto tail; } r = coll_sound_class(); @@ -439,7 +439,7 @@ void FUN_L06_00229650(void) { if (hero_lui.motion.pos.f[2] < hero_lui.water_surface_z && hero_lui.unk2F8 <= 0) { hero_lui.unk2F8 = 1; } - if (FUN_001efa68(&v10, &v0, 0x24, hero_lui.moby, 0) == 0) { + if (collision_line(&v10, &v0, 0x24, hero_lui.moby, 0) == 0) { goto d1; } r = coll_sound_class(); @@ -451,7 +451,7 @@ void FUN_L06_00229650(void) { if (hero_lui.ground_type == 0xD) { hero_lui.water_surface_z = D_L06_001745E8; v10.f[2] = D_L06_001745E8 - 0.01f; - if (FUN_001efa68(&v10, &v0, 4, hero_lui.moby, 0) == 0) { + if (collision_line(&v10, &v0, 4, hero_lui.moby, 0) == 0) { goto d1; } } @@ -462,7 +462,7 @@ void FUN_L06_00229650(void) { if (FUN_L00_0025e3b8(HH.moby)) { hero_lui.unk30A = 1; } - p = FUN_002141f8(HH.moby); + p = suck_get_aim_height(HH.moby); if (p != 0 && (*(u16 *)(p + 0x1E) & 8)) { hero_lui.unk30A = 1; } @@ -541,7 +541,7 @@ void FUN_L06_00229650(void) { } FUN_L00_002335c8(&v30, 0.2f, a, 0.45f); FUN_L00_002335c8(&v40, 0.2f, a, -0.45f); - if (FUN_001efa68(&v30, &v0, 0x22, hero_lui.moby, 0)) { + if (collision_line(&v30, &v0, 0x22, hero_lui.moby, 0)) { f = HH.point.f[2] - hero_lui.ground_z.f; hero_lui.unk2C0.f[i] = f; if (0.4f < FUN_001f99c0(f)) { @@ -846,8 +846,8 @@ extern void FUN_L00_002132b8(f32, f32); extern void FUN_L00_00217118(f32, f32); extern void FUN_L00_002118c8_c(f32, s32) __asm__("FUN_L00_002118c8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); -extern void FUN_L00_00211e30(s32, f32, f32, f32); -extern s32 FUN_001f9740(void *); +extern void turn_to(s32, f32, f32, f32) __asm__("FUN_L00_00211e30"); +extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 FUN_L00_00229a98(void); extern void FUN_L00_00211e98(void); @@ -886,7 +886,7 @@ extern void release_voice_slot(s32) __asm__("FUN_0022d798"); extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); extern void FUN_L00_00209a40(s32, s32); extern void FUN_L00_00209ca8(s32, s32, s32); -extern void FUN_L00_002a3ec8(s32, s32, s32, f32, f32, f32, f32); +extern void pool_splash(s32, s32, s32, f32, f32, f32, f32) __asm__("FUN_L00_002a3ec8"); extern f32 FUN_L00_0025bc98(f32 *, f32, f32 *, s32, f32, f32, f32); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); @@ -900,7 +900,7 @@ extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 FUN_L00_00209018(void *, s32); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern void FUN_L00_0020a1e0(f32, f32); @@ -924,21 +924,21 @@ extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 FUN_001f9b48_c(void *, void *) __asm__("FUN_001f9b48"); extern s32 FUN_L00_002595a0(f32 *, f32 *, f32, f32, f32); extern void FUN_L00_0025bc00(f32 *, s32, f32, f32); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern f32 square_root(f32) __asm__("FUN_001f9988"); -extern f32 FUN_L00_00233a78(void *); -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); -extern f32 FUN_L00_00213350(void *); +extern f32 gravity_z(void *) __asm__("FUN_L00_00233a78"); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); +extern f32 forward_component(void *) __asm__("FUN_L00_00213350"); extern struct HeroTableRow2C D_L06_0017C3A8[]; extern struct LevelTable_QS D_L06_00167400; #define Q D_L06_00167400 extern void FUN_L00_00233ba0(void *, void *, f32); -extern void FUN_L00_00233b20(void *, void *, f32); +extern void gravity_set_z(void *, void *, f32) __asm__("FUN_L00_00233b20"); extern void FUN_L00_002336e8(void *, void *, f32); extern void make_hit_descriptor(void *, struct MobyView *, s32, f32, void *) __asm__("FUN_L00_00259888"); extern s32 collect_mobies_in_sphere(f32, void *, s32, struct MobyView *, void *) __asm__("FUN_L00_001f2868"); @@ -950,8 +950,8 @@ extern void FUN_L00_002a9b80(struct MobyView *, void *); extern s32 FUN_L00_002a96f8(struct MobyView *, void *, f32, f32, s32, f32, f32, f32); extern void FUN_L00_002335c8_c(void *, f32, f32, f32) __asm__("FUN_L00_002335c8"); extern f32 D_L06_001C4470[]; -extern s32 FUN_L00_002598b0(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32); -extern f32 FUN_001f9ab0(void *, void *); +extern s32 play_entity_sound(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32) __asm__("FUN_L00_002598b0"); +extern f32 fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); struct PlayerSpeedTuning { u8 pad0[8]; f32 x08; @@ -967,10 +967,10 @@ extern s32 FUN_001efa68_c(void *, void *, s32, struct MobyView *, s32) __asm__(" extern void FUN_L00_00215b68(void); extern void FUN_L00_00233660(void *, f32, f32, f32); extern s32 FUN_L00_0025e3b8_c(s32) __asm__("FUN_L00_0025e3b8"); -extern void FUN_L00_00259bc8(s32, struct MobyView *, s32, void *, void *, f32); +extern void spawn_nearby_effect(s32, struct MobyView *, s32, void *, void *, f32) __asm__("FUN_L00_00259bc8"); extern s32 D_L06_00178680[]; extern void FUN_L00_00209ec8(void); -extern void FUN_L00_002338d0(void *, void *); +extern void gravity_flatten(void *, void *) __asm__("FUN_L00_002338d0"); extern s32 hero_slot_item_id(s32) __asm__("FUN_L00_0020d498"); extern void FUN_L00_0020b5b8(void); extern void FUN_L00_0020bed0(void); @@ -983,7 +983,7 @@ extern void FUN_L00_0020d2f8(void *); extern f32 randf_sym(f32, f32) __asm__("FUN_L00_00257c48"); extern void FUN_L00_0026d598(void *, void *, s32); extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); -extern s32 FUN_L00_0025d808(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); +extern s32 sample_path(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); extern s32 FUN_L00_0025d7a0(void *, s32, s32, s32); extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); extern void hero_integrate_velocity(void) __asm__("FUN_L00_00214108"); @@ -1040,8 +1040,8 @@ void FUN_L06_0022e020(void) { v0.f[0] = 1.0f; transform_vector_by_basis(&hero.motion.unk170, &v0, &D_L06_00167558[0x1F8]); hero.motion.move_yaw = *(f32 *)D_L06_00167558; - FUN_L00_00211e30(0, frame_scale_sq, frame_scale_sq * 0.0f, D_0015ED6C_c * 174.53293f); - if (D_L06_0015F688 > 0 && FUN_001f9740(&D_L06_0015F688) != 0) { + turn_to(0, frame_scale_sq, frame_scale_sq * 0.0f, D_0015ED6C_c * 174.53293f); + if (D_L06_0015F688 > 0 && fast_dec_timer(&D_L06_0015F688) != 0) { s32 t; if (usage_stats.stat[18].count < 0xFFFF) { usage_stats.stat[18].count++; @@ -1064,7 +1064,7 @@ void FUN_L06_0022e020(void) { if (hero.state.current == HERO_STATE_CROUCH || hero.state.current == 0x17) { if (hero.unk229C > 0.2f || ((struct MobyView *)hero.moby)->b53 == 0xE || ((struct MobyView *)hero.moby)->b53 == 0xF) { if (hero.state.current == HERO_STATE_CROUCH) { - FUN_L00_00211e30(0, frame_scale_sq * 0.002f, frame_scale_sq * 0.07f, + turn_to(0, frame_scale_sq * 0.002f, frame_scale_sq * 0.07f, D_0015ED6C_c * 6.981317f); } else if (hero.state.current == 0x17) { FUN_L00_00211e98(); @@ -1226,7 +1226,7 @@ void FUN_L06_0022e020(void) { if ((struct MobyView *)hero.unk964 != NULL) { hero.motion.move_yaw = fast_arc_tan(((struct MobyView *)hero.unk964)->u10.f10 - moby->u10.f10, ((struct MobyView *)hero.unk964)->u10.f14.v - moby->u10.f14.v); - FUN_L00_00211e30(0, frame_scale_sq * 0.02f, frame_scale_sq * 0.15f, D_0015ED6C_c * 6.2831855f); + turn_to(0, frame_scale_sq * 0.02f, frame_scale_sq * 0.15f, D_0015ED6C_c * 6.2831855f); } break; case 0x25: { @@ -1242,7 +1242,7 @@ void FUN_L06_0022e020(void) { approach_value(&hero.unk960, D_0015ED6C_c * 27.0f, frame_time_sq * 80.0f); hero.motion.move_yaw = fast_arc_tan(((struct MobyView *)hero.unk964)->u10.f10 - moby->u10.f10, ((struct MobyView *)hero.unk964)->u10.f14.v - moby->u10.f14.v); - FUN_L00_00211e30(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.15f, D_0015ED6C_c * 7.330383f); + turn_to(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.15f, D_0015ED6C_c * 7.330383f); } else if (hero.state.step == 1) { approach_value(&hero.unk960, 0.0f, frame_time_sq * 42.0f); } @@ -1259,7 +1259,7 @@ void FUN_L06_0022e020(void) { FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, 0.0f, D_0015ED6C_c * 3.8397243f); } else { f32 an = fast_add_rotations( - -fast_arc_tan(FUN_001f9b80(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); + -fast_arc_tan(vector_distance(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, an, D_0015ED6C_c * 6.4577184f); } v20.f[0] = fast_cos(fast_add_rotations(hero.motion.rot.f[2], -1.5707964f)) * -0.57f; @@ -1304,7 +1304,7 @@ void FUN_L06_0022e020(void) { FUN_L00_0025bc98(&hero.unk9AC, a, &hero.unk9B8, 0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f, 0.0f); } hero.motion.move_yaw = hero.unk9AC; - FUN_L00_00211e30(0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f, D_0015ED6C_c * 4.712389f); + turn_to(0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f, D_0015ED6C_c * 4.712389f); FUN_001f9a28_c(&v0, &((struct MobyView *)hero.unk994)->u10.v10, &hero.motion.pos); fast_vec_normalize(&v0, &v0, 1.0f); if (v0.f[2] < 0.23f) { @@ -1343,14 +1343,14 @@ void FUN_L06_0022e020(void) { } if (hero.unk99C != 0) { f32 s; - if (FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { + if (vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.displacement, frame_time_sq * 40.0f); - if (hero.unk9BE != 0 && FUN_L00_00233a78(&hero.motion.velocity) > 0.0f) { + if (hero.unk9BE != 0 && gravity_z(&hero.motion.velocity) > 0.0f) { FUN_001f9a28_c(&v30, &hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 57.0f); } } - s = FUN_001f9af0(&hero.motion.velocity) * (D_0015ED6C_c * 0.015f); + s = fast_vec_length(&hero.motion.velocity) * (D_0015ED6C_c * 0.015f); fast_vec_scale(&v30, &hero.motion.velocity, -1.0f); fast_vec_normalize(&v30, &v30, s); add_vector_xyz(&hero.motion.velocity, &hero.motion.velocity, &v30); @@ -1358,7 +1358,7 @@ void FUN_L06_0022e020(void) { { struct MobyView *r; if ((struct MobyView *)hero.unk994 != NULL && (r = ((struct MobyView *)hero.unk994)->pm78) != NULL) { - f32 len = FUN_001f9af0(&hero.motion.velocity); + f32 len = fast_vec_length(&hero.motion.velocity); if (r->fC < len) { approach_value(&len, r->fC, frame_time_sq * 15.0f); fast_vec_normalize(&hero.motion.velocity, &hero.motion.velocity, len); @@ -1379,9 +1379,9 @@ void FUN_L06_0022e020(void) { add_vector_xyz(&v30, &((struct MobyView *)hero.unk994)->u10.v10, &vC0); FUN_001f9a28_c(&hero.motion.velocity, &v30, &vD0); old = hero.unk9A4; - FUN_L00_0025b8c0(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); + vendor_spring(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); d = hero.unk9A4 - old; - if (FUN_001f9af0(&vC0) > hero.unk9A4) { + if (fast_vec_length(&vC0) > hero.unk9A4) { fast_vec_normalize(&vC0, &vC0, d); add_vector_xyz(&hero.motion.pos, &hero.motion.pos, &vC0); } @@ -1390,7 +1390,7 @@ void FUN_L06_0022e020(void) { f32 mx = D_0015ED6C_c * 14.0f; f32 sp = vector_length_xy(&hero.motion.velocity); if (sp < mx) { - FUN_L00_0025b8c0(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); + vendor_spring(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); v30.f[0] = fast_cos(hero.unk9AC) * hero.unk9B4; v30.f[1] = fast_sin(hero.unk9AC) * hero.unk9B4; v30.f[2] = 0.0f; @@ -1407,7 +1407,7 @@ void FUN_L06_0022e020(void) { up = hero.unk9BC == 1; } else { v30.q = hero.motion.displacement.q; - up = FUN_L00_00213350(&v30) > 0.0f; + up = forward_component(&v30) > 0.0f; } if (up) { if (moby->b53 != 0x35) { @@ -1443,12 +1443,12 @@ void FUN_L06_0022e020(void) { mx = frame_time_sq * 70.0f; t2 = scale_game_frames(33); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk4B0); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unk4B8 = 1.0f; } } @@ -1480,7 +1480,7 @@ void FUN_L06_0022e020(void) { } hero.target_speed = 0.0f; if ((struct MobyView *)hero.unkA54 != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = D_0015ED6C_c * 4.5f; } @@ -1493,7 +1493,7 @@ void FUN_L06_0022e020(void) { } if (hero.unkA58 != 0 || (struct MobyView *)hero.unkA54 != NULL) { hero.motion.move_yaw = hero.unkA5C; - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); } else if (hero.anim_frame < 25.0f) { FUN_L00_00214ed8(8.0f, 1.0471976f, 1.0471976f); } @@ -1521,16 +1521,16 @@ void FUN_L06_0022e020(void) { } FUN_L00_00211870(27.0f); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 130.0f); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unkA70 = 1.0f; } - if (FUN_L00_00233a78(&hero.motion.velocity) < D_0015ED6C_c * -37.0f) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, D_0015ED6C_c * -37.0f); + if (gravity_z(&hero.motion.velocity) < D_0015ED6C_c * -37.0f) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, D_0015ED6C_c * -37.0f); } } break; @@ -1559,10 +1559,10 @@ void FUN_L06_0022e020(void) { } hero.motion.move_yaw = hero.unkA5C; if (ok) { - FUN_L00_00211e30(1, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, + turn_to(1, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); } else { - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); } } else { @@ -1600,7 +1600,7 @@ void FUN_L06_0022e020(void) { tb = &D_L06_0017C3A8[hero.attack_record]; hero.target_speed = 0.0f; if ((struct MobyView *)hero.unkA54 != NULL && scale_game_frames(4) > hero.state_timer) { - f32 d = FUN_001f9b80(&((struct MobyView *)hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; + f32 d = vector_distance(&((struct MobyView *)hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; f32 off; f32 tol; f32 mx; @@ -1661,7 +1661,7 @@ void FUN_L06_0022e020(void) { hero.anim_speed = 1.0f / (fast_difference_between_rotations(hero.unkA5C, hero.motion.rot.f[2]) + 1.0f); } hero.motion.move_yaw = hero.unkA5C; - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); } else { s32 ok = 1; if (tb->kind == 1 && hero.unkA9C == 0 && hero.anim_frame > 7.0f) { @@ -1696,14 +1696,14 @@ void FUN_L06_0022e020(void) { hero.motion.velocity.f[2] = 0.0f; } hero.motion.move_yaw = fast_add_rotations(hero.unkA68, 3.1415927f); - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); break; case 0x20: { s32 t1; s32 t2; if (hero.unkA58 != 0 || (struct MobyView *)hero.unkA54 != NULL) { hero.motion.move_yaw = hero.unkA5C; - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); } else if (hero.state_timer < scale_game_frames(4)) { FUN_L00_00214ed8(11.0f, 0.87266463f, -1.0f); } @@ -1776,7 +1776,7 @@ void FUN_L06_0022e020(void) { hero.target_speed = 0.0f; if (hero.unkA58 != 0) { hero.motion.move_yaw = hero.unkA5C; - FUN_L00_00211e30(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); + turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); } else { FUN_L00_00214ed8(11.0f, 0.87266463f, -1.0f); } @@ -1806,7 +1806,7 @@ void FUN_L06_0022e020(void) { Vec4 *p = &hero.move_impulse; FUN_L00_002132b8(0.7f, 0.0f); v0.q = hero.move_impulse.q; - hero.target_speed += FUN_L00_00213350(&v0); + hero.target_speed += forward_component(&v0); if (hero.target_speed < D_0015ED6C_c * 0.7f) { hero.target_speed = D_0015ED6C_c * 0.7f; } @@ -1814,7 +1814,7 @@ void FUN_L06_0022e020(void) { } k = 1.0f; if (hero.state.step == 1 && hero.unk3BE == 0) { - FUN_L00_00211e30(0, frame_scale_sq * 0.008f, frame_scale_sq * 0.15f, D_0015ED6C_c * 9.948377f); + turn_to(0, frame_scale_sq * 0.008f, frame_scale_sq * 0.15f, D_0015ED6C_c * 9.948377f); } else { f32 c = hero.unk229C; f32 r = hero.motion.unk188; @@ -1830,7 +1830,7 @@ void FUN_L06_0022e020(void) { FUN_L00_00211f38(); } else { f32 f = hero.unk229C + 0.35f; - FUN_L00_00211e30(0, frame_scale_sq * 0.005f * f, frame_scale_sq * 0.1f, + turn_to(0, frame_scale_sq * 0.005f * f, frame_scale_sq * 0.1f, D_0015ED6C_c * 4.712389f * f); } } @@ -1943,9 +1943,9 @@ void FUN_L06_0022e020(void) { if (hero.state.current == 0x42) { r = hero.unk5CC * (f32)hero.unk578; } - FUN_L00_0025d808((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); + sample_path((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); if (hero.unk590 != 0) { - FUN_L00_0025d808((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); + sample_path((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); } if (scale_game_frames(90) < hero.unk19C) { s32 h; @@ -1955,11 +1955,11 @@ void FUN_L06_0022e020(void) { qcopy(&v20, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - h = FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); + h = sample_path((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); qcopy(&v30, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - if ((h | FUN_L00_0025d808((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || + if ((h | sample_path((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || hero.unk584 != 0) { f32 a = fast_subtract_rotations( hero.unk57C, fast_arc_tan(v30.f[0] - v20.f[0], v30.f[1] - v20.f[1])) * @@ -2016,7 +2016,7 @@ void FUN_L06_0022e020(void) { } idx = FUN_L00_0025d7a0((void *)hero.unk560, hero.unk564, hero.unk578, hero.unk584); FUN_001f9a28_c(&v20, (Vec4 *)hero.unk560 + (idx + 1), &v0); - if (FUN_001f9af0(&v20) < 0.001f) { + if (fast_vec_length(&v20) < 0.001f) { if (hero.unk564 == idx) { hero.unk570 = scale_game_frames(1); break; @@ -2026,13 +2026,13 @@ void FUN_L06_0022e020(void) { hero.unk580 = fast_arc_tan(vector_length_xy(&v20), v20.f[2]); } hero.motion.move_yaw = fast_add_rotations(hero.unk57C, hero.unk588); - FUN_L00_00211e30(0, frame_scale_sq * 0.015f, frame_scale_sq * 0.15f, D_0015ED6C_c * 6.2831855f); + turn_to(0, frame_scale_sq * 0.015f, frame_scale_sq * 0.15f, D_0015ED6C_c * 6.2831855f); if (((hero.state.current == 0x29 || hero.state.current == 0x2A) && hero.unk418 == 0) || hero.state.current == 0x42) { if (hero.unk5C4 != 0) { f32 a = fast_arc_tan(hero.unk550.f[0] - hero.motion.pos.f[0], hero.unk550.f[1] - hero.motion.pos.f[1]); if (fast_difference_between_rotations(hero.motion.rot.f[2], a) < 1.5707964f) { hero.motion.move_yaw = a; - FUN_L00_00211e30(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, + turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, D_0015ED6C_c * 6.2831855f); } } @@ -2063,7 +2063,7 @@ void FUN_L06_0022e020(void) { hero.motion.pos.f[2] += v20.f[2]; FUN_001f9a28_c(&v30, &hero.unk500, &hero.motion.pos); v30.f[2] = 0.0f; - if (FUN_001f9af0(&v30) > D_0015ED6C_c) { + if (fast_vec_length(&v30) > D_0015ED6C_c) { fast_vec_normalize(&v30, &v30, D_0015ED6C_c); } hero.motion.pos.f[0] += v30.f[0]; @@ -2109,8 +2109,8 @@ void FUN_L06_0022e020(void) { si = hero.unk564; sf = hero.unk568; qcopy(&v20, &hero.motion.pos); - FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); - e = fast_arc_tan(FUN_001f9b80(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); + sample_path((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); + e = fast_arc_tan(vector_distance(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); if (e > 0.0f) { sp = e * 1.9098593f * (D_0015ED6C_c * -2.5f); if (e > 0.2617994f && hero.unk5A8 != 2 && hero.unk5A8 != 3) { @@ -2147,9 +2147,9 @@ void FUN_L06_0022e020(void) { f32 mx = D_0015ED6C_c * 7.0f; f32 fl; f32 len; - fl = -FUN_001f9af0(&v20); - FUN_L00_0025b8c0(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); - len = FUN_001f9af0(&v20); + fl = -fast_vec_length(&v20); + vendor_spring(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); + len = fast_vec_length(&v20); if (len < hero.unk5DC) { hero.unk5DC = len; } @@ -2177,7 +2177,7 @@ void FUN_L06_0022e020(void) { case 0x18: case 0x19: hero.motion.move_yaw = fast_add_rotations(hero.unk4E4, 3.1415927f); - FUN_L00_00211e30(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, D_0015ED6C_c * 6.2831855f); + turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, D_0015ED6C_c * 6.2831855f); FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, 0.0f, D_0015ED6C_c * 4.712389f); FUN_001f9a28_c(&hero.motion.velocity, &hero.unk4D0, &hero.motion.pos); FUN_L00_0025f730(&hero.motion.velocity, D_0015ED6C_c * 4.0f); @@ -2186,7 +2186,7 @@ void FUN_L06_0022e020(void) { case 0x4A: case 0x4B: hero.motion.move_yaw = fast_add_rotations(hero.unk4E4, 3.1415927f); - FUN_L00_00211e30(0, frame_scale_sq * 0.02f, frame_scale_sq * 0.2f, D_0015ED6C_c * 4.712389f); + turn_to(0, frame_scale_sq * 0.02f, frame_scale_sq * 0.2f, D_0015ED6C_c * 4.712389f); FUN_001f9a28_c(&hero.motion.velocity, &hero.unk4D0, &hero.motion.pos); FUN_L00_0025f730(&hero.motion.velocity, D_0015ED6C_c * 1.7f); approach_value(&hero.unk4F0, hero.motion.pos.f[2], D_0015ED6C_c * 3.0f); @@ -2232,7 +2232,7 @@ void FUN_L06_0022e020(void) { add_vector_xyz(&m40[1], &v0, &v10); fast_vec_scale(&m40[1], &m40[1], 0.5f); hero.motion.move_yaw = a; - FUN_L00_00211e30(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, D_0015ED6C_c * 6.2831855f); + turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, D_0015ED6C_c * 6.2831855f); fl = hero.motion.unk164; approach_value(&fl, hero.target_speed * D_0015ED6C_c, frame_time_sq * 5.0f); FUN_001f9a28_c(&hero.motion.velocity, &m40[1], &hero.motion.pos); @@ -2269,8 +2269,8 @@ void FUN_L06_0022e020(void) { FUN_L00_00215340(); FUN_L00_002132b8(0.7f, D_0015ED6C_c * 0.0f); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(D_0015ED6C_c * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(D_0015ED6C_c * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(D_0015ED6C_c * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(D_0015ED6C_c * 50.0f)); } break; case 0x77: { @@ -2282,8 +2282,8 @@ void FUN_L06_0022e020(void) { len = vector_length_xy(&hero.motion.velocity); FUN_L00_001ff600(frame_scale * -0.100000024f * len + len, &hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(D_0015ED6C_c * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(D_0015ED6C_c * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(D_0015ED6C_c * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(D_0015ED6C_c * 50.0f)); } break; } @@ -2303,13 +2303,13 @@ void FUN_L06_0022e020(void) { } FUN_L00_002118c8_c(hero.unk229C * m, 0); if (hero.unk229C > 0.2f && !(PD.u1A0.i1A0 & 3)) { - FUN_L00_00211e30(0, frame_scale_sq * 0.027f, frame_scale_sq * 0.3f, + turn_to(0, frame_scale_sq * 0.027f, frame_scale_sq * 0.3f, D_0015ED6C_c * 5.934119f * hero.unk229C); } if (PD.u1A0.i1A0 & 3) { f32 o = hero.motion.move_yaw; hero.motion.move_yaw = *(f32 *)D_L06_00167558; - FUN_L00_00211e30(0, frame_scale_sq * 0.017f, frame_scale_sq * 0.3f, D_0015ED6C_c * 4.712389f); + turn_to(0, frame_scale_sq * 0.017f, frame_scale_sq * 0.3f, D_0015ED6C_c * 4.712389f); hero.motion.move_yaw = o; } { @@ -2322,11 +2322,11 @@ void FUN_L06_0022e020(void) { FUN_L00_00215340(); FUN_L06_002291d0(1); if (big) { - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); hero.unk304 = hero.motion.velocity.f[2]; } else { - FUN_L00_0025b8c0(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, + vendor_spring(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, frame_scale_sq * 0.35f, D_0015ED6C_c * 2.5f); } break; @@ -2357,11 +2357,11 @@ void FUN_L06_0022e020(void) { sp = D_0015ED6C_c * 5.0f; } FUN_L00_002118c8_c(sp, 0); - FUN_L00_00211e30(0, frame_scale_sq * 0.025f, frame_scale_sq * 0.3f, D_0015ED6C_c * 12.566371f); + turn_to(0, frame_scale_sq * 0.025f, frame_scale_sq * 0.3f, D_0015ED6C_c * 12.566371f); FUN_L00_00212088(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); FUN_L00_00215340(); - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); if (hero.motion.pos.f[2] < hero.unk410) { approach_value(&hero.unk410, hero.motion.pos.f[2], D_0015ED6C_c * 4.0f); @@ -2409,7 +2409,7 @@ void FUN_L06_0022e020(void) { if (hero.unk418 != 0 || (t198 < t420 && hero.state.current != HERO_STATE_HIGH_JUMP && hero.state.current != HERO_STATE_PACK_LONG_JUMP && hero.state.current != 0xC && hero.state.current != 0x11 && hero.state.current != 0x1C && hero.state.current != 0x4C)) { f32 sv; - FUN_L00_00211e30(0, frame_scale_sq * 0.015f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); + turn_to(0, frame_scale_sq * 0.015f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); sv = hero.ground_speed; if (hero.unk418 >= 2) { hero.ground_speed = sv * 0.4f; @@ -2459,7 +2459,7 @@ void FUN_L06_0022e020(void) { if (hero.motion.pos.f[2] < hero.unk410) { hero.unk410 = hero.motion.pos.f[2]; } - if (hero.state_timer > hero.unk420 && FUN_L00_00233a78(&hero.motion.velocity) < 0.001f && + if (hero.state_timer > hero.unk420 && gravity_z(&hero.motion.velocity) < 0.001f && (hero.unk41C == 0 || hero.state_timer > hero.unk3D4)) { hero.unk41E = 1; if (hero.unk3F8 != 0.0f) { @@ -2485,7 +2485,7 @@ void FUN_L06_0022e020(void) { fast_vec_scale(&v10, &hero.motion.displacement, 7.0f); for (i = 0; i < n; i++) { if (FUN_L00_0025e3b8_c(D_L06_00178680[i]) != 0) { - FUN_L00_00259bc8(D_L06_00178680[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, + spawn_nearby_effect(D_L06_00178680[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, 1.0f); } } @@ -2542,12 +2542,12 @@ void FUN_L06_0022e020(void) { } k = 1.0f; if (hero.vehicle_mode == 3) { - FUN_L00_00211e30(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, D_0015ED6C_c * 5.5850534f); + turn_to(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, D_0015ED6C_c * 5.5850534f); } else if (hero.vehicle_mode == 1) { - FUN_L00_00211e30(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, D_0015ED6C_c * 7.8539815f); + turn_to(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, D_0015ED6C_c * 7.8539815f); } else if (hero.vehicle_mode == 0) { if (hero.state.step == 1) { - FUN_L00_00211e30(0, frame_scale_sq * 0.016f, frame_scale_sq * 0.15f, + turn_to(0, frame_scale_sq * 0.016f, frame_scale_sq * 0.15f, D_0015ED6C_c * 9.948377f); } else { FUN_L00_00211f38(); @@ -2571,7 +2571,7 @@ void FUN_L06_0022e020(void) { } case 0x66: FUN_001f9a28_c(&v0, &hero.unk1640, &hero.motion.pos); - if (FUN_001f9ab0(&v0, &hero.motion.unk150) < 0.0f) { + if (fast_vec_dot(&v0, &hero.motion.unk150) < 0.0f) { clear_u64_value(&hero.motion.unk150); } clear_u64_value(&hero.motion.velocity); @@ -2626,7 +2626,7 @@ void FUN_L06_0022e020(void) { moby_point_position((struct MobyView *)hero.moby, k | 1, &v20); add_vector_xyz(&v0, &v10, &v20); fast_vec_scale(&v0, &v0, 0.5f); - FUN_L00_002598b0((struct MobyView *)hero.moby, 0.25f, &v0, 0x10000, 1.0f, 1.0f, 0, 1, 0); + play_entity_sound((struct MobyView *)hero.moby, 0.25f, &v0, 0x10000, 1.0f, 1.0f, 0, 1, 0); } approach_value(&hero.anim_speed, 1.0f, 0.2f); if (hero.unkA58 != 0 || (struct MobyView *)hero.unkA54 != NULL) { @@ -2634,7 +2634,7 @@ void FUN_L06_0022e020(void) { hero.anim_speed = 1.0f / (fast_difference_between_rotations(hero.unkA5C, hero.motion.rot.f[2]) + 1.0f); } hero.motion.move_yaw = hero.unkA5C; - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, D_0015ED6C_c * 15.009831f); } else { ok = 1; if (tb->kind == 1 && hero.unkA9C == 0 && hero.anim_frame > 7.0f) { @@ -2662,10 +2662,10 @@ void FUN_L06_0022e020(void) { case 0x4F: { f32 sp = D_0015ED6C_c * 2.0f; FUN_L00_002118c8_c(sp, 0); - FUN_L00_00211e30(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, D_0015ED6C_c * 8.726646f); + turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, D_0015ED6C_c * 8.726646f); FUN_L00_00212088(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); break; } @@ -2698,10 +2698,10 @@ void FUN_L06_0022e020(void) { k = 0.0f; } if (hero.motion.speed_xy < sp * 0.5f) { - FUN_L00_00211e30(0, frame_scale_sq * 0.035f * g, frame_scale_sq * 0.15f, + turn_to(0, frame_scale_sq * 0.035f * g, frame_scale_sq * 0.15f, D_0015ED6C_c * 9.599311f * g); } else { - FUN_L00_00211e30(0, frame_scale_sq * 0.008f * g, frame_scale_sq * 0.15f, + turn_to(0, frame_scale_sq * 0.008f * g, frame_scale_sq * 0.15f, D_0015ED6C_c * 9.948377f * g); } FUN_L00_00212088(frame_time_sq * 7.5f * k, frame_time_sq * 8.5f); @@ -2778,7 +2778,7 @@ void FUN_L06_0022e020(void) { add_vector_xyz(&m40[1], &v0, &v10); fast_vec_scale(&m40[1], &m40[1], 0.5f); hero.motion.move_yaw = a; - FUN_L00_00211e30(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, D_0015ED6C_c * 6.2831855f); + turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, D_0015ED6C_c * 6.2831855f); fl = hero.motion.unk164; approach_value(&fl, hero.target_speed * D_0015ED6C_c, frame_time_sq * 5.0f); FUN_001f9a28_c(&hero.motion.velocity, &m40[1], &hero.motion.pos); @@ -2833,7 +2833,7 @@ void FUN_L06_0022e020(void) { if (k < 0.0f) { k = 0.0f; } - FUN_L00_00211e30(0, frame_scale_sq * 0.035f * g, frame_scale_sq * 0.1f, + turn_to(0, frame_scale_sq * 0.035f * g, frame_scale_sq * 0.1f, D_0015ED6C_c * 2.268928f * g); FUN_L00_00212088(frame_time_sq * 7.5f * k, frame_time_sq * 8.5f); if (hero.unk3B8 != 0 && hero.unk308 == 0) { diff --git a/src/overlays/l06/gameplay/hero/0023b440.c b/src/overlays/l06/gameplay/hero/0023b440.c index 75ffcc6988..fda27e420e 100644 --- a/src/overlays/l06/gameplay/hero/0023b440.c +++ b/src/overlays/l06/gameplay/hero/0023b440.c @@ -43,12 +43,12 @@ extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L06_0015F638; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_00208f20(float a, float b, float c, float d); extern float FUN_L00_00232b90(float a, float b, float c); -extern float FUN_L00_00233a78(float *v); +extern float gravity_z(float *v) __asm__("FUN_L00_00233a78"); extern float FUN_L00_00233c30(float *pos, float *vel, int *steps, float step); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float FUN_L00_00259468(float *a, float *b, int *out, float f); @@ -64,7 +64,7 @@ extern float vector_length_xyz(void *a); extern int D_00141660 __attribute__((section(".data"))); extern int D_L06_0015F6DC; extern int D_L06_0016CF00 __attribute__((section(".data"))); -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_002050b8(int); extern int FUN_L00_0020c758(float *, float *); @@ -80,7 +80,7 @@ extern int hero_handle_jump_press(void) __asm__("FUN_L00_00229660"); extern int FUN_L00_00229910(void); extern int FUN_L00_00229a98(void); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int FUN_L00_0025d808(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); +extern int sample_path(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); extern int FUN_L00_0025df68(void *, void *, void *, int *, float *, int, float, float, float); extern int pad_pressed_within(int, int, int *) __asm__("FUN_L00_00266d60"); extern int FUN_L00_00266e00(int, int, int, int); @@ -107,7 +107,7 @@ extern void FUN_L00_00232628(void); extern void FUN_L00_00232640(int id); extern void FUN_L00_00233288(float a, float b, short c, unsigned char d, unsigned char e, unsigned char f); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void hud_keep_visible(int, int) __asm__("FUN_L00_00235e18"); extern void FUN_L00_00237ae8(void); extern void FUN_L00_00237ba0(void); @@ -730,7 +730,7 @@ void FUN_L06_0023b440(void) { } break; case 101: - if (FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { + if (vector_distance(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { if (frame_time * 2.7f > hero.motion.speed_xy) { if (fast_difference_between_rotations( hero.motion.rot.f[2], hero.unk1640.f[3]) < 0.034906585f) { @@ -754,7 +754,7 @@ void FUN_L06_0023b440(void) { if ((hero.unkA98 & 2) || hero.unk1650 != 0) { hero_set_state(HERO_STATE_IDLE, 1); } - if (0.2f < FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f)) { + if (0.2f < vector_distance(hero.motion.pos.f, hero.unk1640.f)) { hero_set_state(0x65, 1); } break; @@ -980,7 +980,7 @@ void FUN_L06_0023b440(void) { v1[1] = fast_sin(hero.unk57C) * 5.0f; v1[2] = 0.0f; add_vector_xyz(v1, v1, v0); - if (FUN_001efa68(v0, v1, 2, 0, 0)) { + if (collision_line(v0, v1, 2, 0, 0)) { ok = 0; } } @@ -1146,7 +1146,7 @@ void FUN_L06_0023b440(void) { path_seg = hero.unk564; path_t = hero.unk568; /* Step a copy of the hero position along its current path. */ - if (FUN_L00_0025d808((int *)hero.unk560, v0, &path_seg, + if (sample_path((int *)hero.unk560, v0, &path_seg, &path_t, hero.unk584, d)) { scale_vector_xyz(v1, hero.motion.displacement.f, scale_game_frames(0x30)); @@ -1177,7 +1177,7 @@ void FUN_L06_0023b440(void) { } } if (hero.state_timer > hero.unk420) { - if (FUN_L00_00233a78(hero.motion.velocity.f) < 0.001f) { + if (gravity_z(hero.motion.velocity.f) < 0.001f) { hero.unk41E = 1; } } @@ -1412,7 +1412,7 @@ void FUN_L06_0023b440(void) { if (hero_set_state(HERO_STATE_IDLE, 0)) { set_hero_animation(0xC, 9, -1.0f); } - FUN_L00_00233b20(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); + gravity_set_z(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); FUN_L00_0025f730(hero.motion.unk150.f, frame_time * 7.0f); hero.unk1C4 = scale_game_frames(7); if (hero.state.prev == 0x2D) { @@ -1922,7 +1922,7 @@ void FUN_L06_0023b440(void) { scale_game_frames(0xE) < hero.state_timer && (hero.unk41E == 0 || (hero.ground_distance > 0.7f && - absolute_float(FUN_L00_00233a78(hero.motion.velocity.f)) < + absolute_float(gravity_z(hero.motion.velocity.f)) < frame_time * 5.8f))) { hero_set_state(0xE, 1); } else if (D_0013D4DC[-0x1A] != 0 && hero_slot_item_id(3) != 4 && diff --git a/src/overlays/l06/gameplay/hero/hero_set_state.c b/src/overlays/l06/gameplay/hero/hero_set_state.c index 8b67dc768d..0e4ccfe56b 100644 --- a/src/overlays/l06/gameplay/hero/hero_set_state.c +++ b/src/overlays/l06/gameplay/hero/hero_set_state.c @@ -31,10 +31,10 @@ extern T2C_235E08 D_L06_0017C3A8[]; extern char *hero_slot_moby(int) __asm__("FUN_L00_0020d460"); extern float D_L06_0017C570[][25]; extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_0020d658(int back); -extern float FUN_L00_002339d0(float *v); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float dot_vectors_xyz(void *a, void *b); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); @@ -69,8 +69,8 @@ extern void FUN_L00_00213de8(float); extern void FUN_L00_00214ed8(float a, float b, float c); extern void set_hero_animation(int, int, float) __asm__("FUN_L00_002323b8"); extern void FUN_L00_002325e0(int bank, int seq); -extern void FUN_L00_00250320(void *, void *, void *, void *); -extern void FUN_L00_0025d808(int a, char *pos, char *b, char *c, int d, float f) __asm__("FUN_L00_0025d808"); +extern void get_moby_color(void *, void *, void *, void *) __asm__("FUN_L00_00250320"); +extern void sample_path(int a, char *pos, char *b, char *c, int d, float f) __asm__("FUN_L00_0025d808"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L00_00262500(int a, char *b); extern void FUN_L00_00262528(char *o, int a, int b); @@ -386,7 +386,7 @@ int hero_set_state(int a, int b) { char *v = (char *)&p->motion.unk110; p->state.control_mode = 1; p->unk2284 = 0; - p->ground_speed = FUN_L00_002339d0((float *)v); + p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.unk150, v); if (b) { int id = 6; @@ -442,7 +442,7 @@ int hero_set_state(int a, int b) { *(unsigned int *)(h + 0x64) | (1 << current_level_index) | 0x80000000; } p->motion.move_yaw = - FUN_001f9e90(*(float *)(((char *)p->unk964) + 0x10) - p->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)p->unk964) + 0x10) - p->motion.pos.f[0], *(float *)(((char *)p->unk964) + 0x14) - p->motion.pos.f[1]); if (b) { set_hero_animation(0x2F, 2, (float)scale_game_frames(5)); @@ -518,7 +518,7 @@ int hero_set_state(int a, int b) { if (*(float *)(d + 0x2C) != 0.0f) q->unk9CC = *(float *)(d + 0x2C); q->unk9AC = - FUN_001f9e90(*(float *)(((char *)q->unk994) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unk994) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unk994) + 0x14) - q->motion.pos.f[1]); q->unk9A4 = FUN_001f9b48(&q->motion.pos, ((char *)q->unk994) + 0x10); q->unk9B0 = frame_time_sq * 27.0f; @@ -584,7 +584,7 @@ int hero_set_state(int a, int b) { p->unk5B8 = 0; p->unk5BC = 0; p->unk5C0 = 0; - FUN_L00_0025d808(p->unk560, (char *)&out, (char *)&i, (char *)&f, + sample_path(p->unk560, (char *)&out, (char *)&i, (char *)&f, p->unk584, 1.0f); subtract_vector_xyz(&d.v, &out, &p->motion.pos); if (0.001f < vector_length_xyz(&d.v)) { @@ -598,10 +598,10 @@ int hero_set_state(int a, int b) { if (((char *)q->unk5D8) != 0) { if (1.5707964f < fast_difference_between_rotations( - FUN_001f9e90( + fast_arc_tan( *(float *)(((char *)q->unk5D8) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unk5D8) + 0x14) - q->motion.pos.f[1]), - fast_add_rotations(q->unk588, FUN_001f9e90(d.v.x, d.v.y)))) { + fast_add_rotations(q->unk588, fast_arc_tan(d.v.x, d.v.y)))) { q->unk588 = 1.5707964f; q->unk58C = 1; } @@ -1133,7 +1133,7 @@ int hero_set_state(int a, int b) { if (1.5707964f < fast_difference_between_rotations( q->motion.rot.f[2], - FUN_001f9e90(q->unk500.f[0] - q->unk540.f[0], + fast_arc_tan(q->unk500.f[0] - q->unk540.f[0], q->unk500.f[1] - q->unk540.f[1]))) id = 0x1F; set_hero_animation(id, 0, (float)scale_game_frames(5)); @@ -1374,7 +1374,7 @@ int hero_set_state(int a, int b) { if (q->items[0].item_id == 0xA && ((char *)q->unkA50) != 0) { q->unkA58 = 1; q->unkA5C = - FUN_001f9e90(*(float *)(((char *)q->unkA50) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unkA50) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unkA50) + 0x14) - q->motion.pos.f[1]); } break; @@ -1467,7 +1467,7 @@ int hero_set_state(int a, int b) { { struct Hero *q = &hero; q->unk22F4 = 1; - FUN_L00_00250320(((void *)q->moby), &c0, &c1, &c2); + get_moby_color(((void *)q->moby), &c0, &c1, &c2); q->unk22F8 = (c2 << 16) | ((c1 << 8) | 0x80000000) | c0; } return 0; diff --git a/src/overlays/l06/gameplay/vendor/003083b0.c b/src/overlays/l06/gameplay/vendor/003083b0.c index e0e20165b0..9e17aac834 100644 --- a/src/overlays/l06/gameplay/vendor/003083b0.c +++ b/src/overlays/l06/gameplay/vendor/003083b0.c @@ -93,7 +93,7 @@ void FUN_L06_003083b0(struct Moby *moby) { } #include "rnc/gameplay/entities/moby.h" #include "qcopy.h" -extern int FUN_001fa728(char *, float); +extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); @@ -161,7 +161,7 @@ void FUN_L06_00308c68(struct Moby *m) { qcopy(&v1, &*(SparkVector *)&m->pos); v1.w = 3.0f; - if (FUN_001fa728(&v1, 64.0f) == -1) { + if (fast_bsphere_check(&v1, 64.0f) == -1) { return; } switch (m->state) { @@ -254,7 +254,7 @@ void FUN_L06_00308c68(struct Moby *m) { extern char *D_L06_0015FFD8; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); -extern int FUN_001fa728(char *, float); +extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern short *D_L06_001ABFC0[]; extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); @@ -271,7 +271,7 @@ void FUN_L06_00309240(int idx) { if (*(short *)(m + 0xA6) == 0x5E8 && (unsigned char)m[0x20] == 1) { qcopy(v, m + 0x10); v[3] = 0.25f; - if (FUN_001fa728((char *)v, 64.0f) >= 0) { + if (fast_bsphere_check((char *)v, 64.0f) >= 0) { data = *(char **)(m + 0x78); m[0x20] = 2; *(int *)(data + 0x28) = @@ -290,7 +290,7 @@ void FUN_L06_00309240(int idx) { extern char D_L06_0016CFE0[]; extern int D_L06_0015F5C4; extern int scale_game_frames(int) __asm__("FUN_001f96f8"); -extern void FUN_L00_002637f8(int); +extern void cutscene_set_camera_target(int) __asm__("FUN_L00_002637f8"); void FUN_L06_00309348(unsigned char *moby) { switch (moby[0x20]) { @@ -303,7 +303,7 @@ void FUN_L06_00309348(unsigned char *moby) { char *p = D_L06_0016CFE0; if (*(int *)(p + 0x30) == 5) { if (scale_game_frames(0x7F) >= *(int *)(p + 0x34)) { - FUN_L00_002637f8(*(int *)(p + 0x180)); + cutscene_set_camera_target(*(int *)(p + 0x180)); } } } diff --git a/src/overlays/l06/world/loaders/00252dd0.c b/src/overlays/l06/world/loaders/00252dd0.c index a343efe82f..c12905b01f 100644 --- a/src/overlays/l06/world/loaders/00252dd0.c +++ b/src/overlays/l06/world/loaders/00252dd0.c @@ -446,3 +446,5 @@ void FUN_L06_002fc630(unsigned char *moby) { void FUN_L06_00304088(unsigned char *moby) { moby[0x20] = 0x5; } + +s32 D_L06_0017459C[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/l07/gameplay/entities/0030cd20.c b/src/overlays/l07/gameplay/entities/0030cd20.c index ee5d1953d4..6269380fab 100644 --- a/src/overlays/l07/gameplay/entities/0030cd20.c +++ b/src/overlays/l07/gameplay/entities/0030cd20.c @@ -175,9 +175,9 @@ struct SwingGateVars { extern struct Moby *D_L07_0015FFD8; extern int FUN_0022da68(int, int, struct Moby *); -extern float FUN_001f9dc8(float); -extern float FUN_001fa580(float, float); -extern float FUN_001fa5c8(float, float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); +extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); void FUN_L07_0031b3f0(struct Moby *moby) { struct SwingGateVars *vars = (struct SwingGateVars *)moby->pvars; @@ -204,8 +204,8 @@ void FUN_L07_0031b3f0(struct Moby *moby) { case 2: break; case 3: - vars->vel = FUN_001fa580(vars->vel, FUN_001f9dc8(moby->rot.y) * (vars->speed * frame_time)); - moby->rot.y = FUN_001fa580(moby->rot.y, vars->vel); + vars->vel = fast_add_rotations(vars->vel, fast_cos(moby->rot.y) * (vars->speed * frame_time)); + moby->rot.y = fast_add_rotations(moby->rot.y, vars->vel); vars->vel = vars->vel * vars->damp; target = &D_L07_0015FFD8[vars->target]; if (target == 0 || target->state == 0xFE || target->state == 0xFD) @@ -221,7 +221,7 @@ void FUN_L07_0031b3f0(struct Moby *moby) { moby->state = 2; break; } - f = FUN_001fa5c8(moby->rot.y, vars->rate); + f = fast_subtract_rotations(moby->rot.y, vars->rate); moby->rot.y = f; if (0.0f < f) { moby->rot.y = 0; diff --git a/src/overlays/l07/gameplay/entities/snagglebeast.c b/src/overlays/l07/gameplay/entities/snagglebeast.c index b3fdafb3cd..d71f085af1 100644 --- a/src/overlays/l07/gameplay/entities/snagglebeast.c +++ b/src/overlays/l07/gameplay/entities/snagglebeast.c @@ -20,7 +20,7 @@ extern u64 get_effect_texture(int) __asm__("FUN_001f44b8"); extern void vu1_add_g_sregister_l07(int, u64) __asm__("FUN_00233980"); extern void draw_geometry_quad(void *, int, int) __asm__("FUN_001f7d30"); extern void FUN_L00_0024f7c8(void *, int, void *); -extern float FUN_L00_0025e310(float); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void build_spherical_offset(void *, float, float, float) __asm__("FUN_00214db0"); @@ -107,7 +107,7 @@ void FUN_L07_00312948(char *moby, int phase, float speed, float radius, quad.colors[1] = quad.colors[3]; quad.colors[3] = ((u32)truncate_float_to_s32(convert_integer_to_float(0) * row_alpha) << 24) | inner_color; quad.colors[2] = quad.colors[3]; - wrapped = FUN_L00_0025e310(angle + spin * 0.02f); + wrapped = normalize_angle(angle + spin * 0.02f); build_spherical_offset(&quad.positions[2], radius, wrapped, latitude); wrapped = fast_add_rotations(wrapped, 0.3926991f); build_spherical_offset(&quad.positions[3], radius, wrapped, latitude); @@ -159,7 +159,7 @@ extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern u64 get_effect_texture(int) __asm__("FUN_001f44b8"); extern void draw_geometry_quad(void *, int, int) __asm__("FUN_001f7d30"); -extern float FUN_L00_0025e310(float); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_sin(float) __asm__("FUN_001f9de0"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); @@ -221,7 +221,7 @@ void FUN_L07_00312e70(char *moby, float radius, int phase, float speed, int colo for (angle = -3.1415927f; angle < step + 3.1415927f; angle += step) { qcopy(&quad.positions[0], &quad.positions[1]); qcopy(&quad.positions[2], &quad.positions[3]); - wrapped = FUN_L00_0025e310(angle + spin * 0.02f); + wrapped = normalize_angle(angle + spin * 0.02f); offset[1] = radius * fast_cos(wrapped); offset[2] = radius * fast_sin(wrapped); offset[0] = 0.0f; @@ -319,16 +319,16 @@ void *FUN_L07_00313350(void *unused, void *dp, void *op) { extern char *hit_lookup_13420(void *, int, int) __asm__("FUN_L00_0025a420"); extern int hit_test_13420(void *, void *, void *, int, int *, int, int, int) __asm__("FUN_00213928"); extern void FUN_L00_00257470(void *, int, int); -extern void FUN_L00_0025d458(void *, void *); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *, void *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern void FUN_00212f90(void *, int, int, int); extern void FUN_L00_002223f8(int, int); extern void FUN_L00_00266858(void *, int); -extern void FUN_L00_002502a0(int); -extern void FUN_L00_00284e50(void *, void *); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern void FUN_L00_00200228(float, void *); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void release_voice_slot(int) __asm__("FUN_0022d798"); extern int FUN_0022da68(int, int, void *); extern int D_001413D4 __attribute__((section(".data"))); @@ -375,15 +375,15 @@ void FUN_L07_00313420(char *moby, char *data, float *health) { *(unsigned short *)(moby + 0x34) &= 0xefff; FUN_L00_00257470(moby, 0, -1); data[0x67] = 0x78; - FUN_L00_0025d458(moby, data + 0x60); + trooper_anim_update(moby, data + 0x60); if ((u8)moby[0x53] != 2) FUN_00212f90(moby, 2, 0, random_int_between(10, 13)); if (D_001413D4 == 0x78) FUN_L00_002223f8(0, 1); if (*(int *)(data + 0x1f0) != -1) { FUN_L00_00266858(moby, 1); FUN_L00_00257470(moby, 0, -1); - FUN_L00_002502a0((u8)moby[0xb0]); + jet_clear_persistent((u8)moby[0xb0]); owner = D_L07_001600EC + (*(int *)(data + 0x1f0) << 7); - FUN_L00_00284e50(owner + 0x30, owner + 0x70); + jet_reset_camera(owner + 0x30, owner + 0x70); } moby[0x20] = 10; } else { @@ -398,8 +398,8 @@ void FUN_L07_00313420(char *moby, char *data, float *health) { scratch.threshold *= frame; *health -= *(float *)(hit + 0x2c); *(u8 *)(data + 0x67) = 0xfa; - *(short *)(data + 0x26) = FUN_001f96f8(0); - FUN_L00_0025d458(moby, data + 0x60); + *(short *)(data + 0x26) = scale_game_frames(0); + trooper_anim_update(moby, data + 0x60); if ((u8)moby[0x20] < 10 && *health < scratch.threshold) { int slot; if (D_001413D4 == 0x78) FUN_L00_002223f8(0, 1); @@ -433,7 +433,7 @@ void FUN_L07_00313420(char *moby, char *data, float *health) { else data[0x1c6] = 0; *(u8 *)(moby + 0xa4) = 0xff; } - FUN_L00_0025d538(moby, data + 0x60); + trooper_anim_finish(moby, data + 0x60); output = *(float *)(data + 0x1fc) + 0.3f; *(float *)(data + 0x1fc) = output; if (output > 0.0f) *(float *)(data + 0x1fc) = 0.0f; @@ -457,20 +457,20 @@ void FUN_L07_00313920(float *out, float value) { /* Ported from rac1-decomp (src/overlays/l07_umbris/vendor_00313D28.c: func_L07_00314D68), where it is exact; names translated to the US level program. */ extern char *D_L07_001B0530[]; -extern int FUN_L01_00276fe8(void *, void *, int, float, void *, void *, void *); +extern int follow_path(void *, void *, int, float, void *, void *, void *) __asm__("FUN_L01_00276fe8"); extern int FUN_L01_0028b510(void *, void *, float); extern void *FUN_L07_00313350_u(void *, void *, void *) __asm__("FUN_L07_00313350"); void FUN_L07_00313988(char *m, char *a, void *b, void *c) { float v[8]; void *r = FUN_L07_00313350_u(m, a, v); - if (FUN_L01_00276fe8(v, r, *(int *)(a + 0x188), 0.0f, m + 0x10, b, c)) + if (follow_path(v, r, *(int *)(a + 0x188), 0.0f, m + 0x10, b, c)) return; { int i = FUN_L01_0028b510(b, D_L07_001B0530[*(int *)(a + 0x290)], 0.0f); int j = FUN_L01_0028b510(D_L07_001B0530[*(int *)(a + 0x290)] + (i * 16 + 0x10), D_L07_001B0530[*(int *)(a + 0x188)], 0.0f); - if (FUN_L01_00276fe8(v, r, *(int *)(a + 0x188), 0.0f, m + 0x10, + if (follow_path(v, r, *(int *)(a + 0x188), 0.0f, m + 0x10, D_L07_001B0530[*(int *)(a + 0x188)] + (j * 16 + 0x10), c)) return; i = FUN_L01_0028b510(m + 0x10, D_L07_001B0530[*(int *)(a + 0x188)], 0.0f); @@ -509,10 +509,10 @@ struct HeroView_313af0 { extern s32 level_frame_count __asm__("D_L07_0015F5CC"); extern float D_0015ED6C; extern struct ChaserTarget D_L07_00173EC0; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern int FUN_L00_00259028(struct Moby *, void *, int, void *); extern void clamp_vector_length(void *, void *, float) __asm__("FUN_001f9c90"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern int FUN_L00_002583f0(void *, struct Moby *, int, float, float); int FUN_L07_00313af0(struct Moby *m, struct ChaserVars *d, Vec4 *goal, int mode, float range) { @@ -522,7 +522,7 @@ int FUN_L07_00313af0(struct Moby *m, struct ChaserVars *d, Vec4 *goal, int mode, int r; float dist; - dist = FUN_001f9b80(&m->pos, goal); + dist = vector_distance(&m->pos, goal); r = 4; path = D_L07_001B0530[d->path]; if (range < dist) { @@ -533,7 +533,7 @@ int FUN_L07_00313af0(struct Moby *m, struct ChaserVars *d, Vec4 *goal, int mode, add_vector_xyz(&m->pos, &m->pos, v); } } else { - FUN_L00_00258278(m, FUN_001f9e90(hero.motion.pos.f[0] - m->pos.x, hero.motion.pos.f[1] - m->pos.y), + FUN_L00_00258278(m, fast_arc_tan(hero.motion.pos.f[0] - m->pos.x, hero.motion.pos.f[1] - m->pos.y), d->turn, frame_time_sq * 2.0943952f, frame_time_sq * 0.69813168f, D_0015ED6C * 2.0943952f); } if ((level_frame_count & 3) == 3 && FUN_L00_002583f0(&m->pos, m, 0, 0.1f, 1.0f)) { @@ -574,12 +574,12 @@ float FUN_L07_00313d30(struct ChaserAnim *a, struct ChaserSpeed *s, float x, flo /* Ported from rac1-decomp (src/overlays/l07_umbris/vendor_00313D28.c: func_L07_003151C0), where it is exact; names translated to the US level program. */ extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); void blend_moby_animation(MobyAnim *moby, int new_seq, int frame_index, int blend_frames) __asm__("FUN_00212f90"); int FUN_L07_00313de8(unsigned char *m, unsigned char *obj, float *vec, int a, int b) { - float h = FUN_001f9e90(vec[0] - *(float *)(m + 0x10), vec[1] - *(float *)(m + 0x14)); + float h = fast_arc_tan(vec[0] - *(float *)(m + 0x10), vec[1] - *(float *)(m + 0x14)); if (*(float *)(obj + 0x98) < fast_difference_between_rotations(*(float *)(m + 0x48), h)) { *(int *)(obj + 0x168) = 0; *(float *)(m + 0x58) = 1.0f; @@ -587,7 +587,7 @@ int FUN_L07_00313de8(unsigned char *m, unsigned char *obj, float *vec, int a, in obj[0x1F6] = a; obj[0x1F5] = b; qcopy(obj + 0xC0, vec); - if (FUN_001f9e90(vec[0] - *(float *)(m + 0x10), vec[1] - *(float *)(m + 0x14)) < 0.0f) { + if (fast_arc_tan(vec[0] - *(float *)(m + 0x10), vec[1] - *(float *)(m + 0x14)) < 0.0f) { if (m[0x53] != 3) { int r = random_int_between(0, 1); blend_moby_animation(m, 3, r, random_int_between(0xF, 0x14)); @@ -606,13 +606,13 @@ int FUN_L07_00313de8(unsigned char *m, unsigned char *obj, float *vec, int a, in /* Ported from rac1-decomp (src/overlays/l07_umbris/vendor_00313D28.c: func_L07_00315338), where it is exact; names translated to the US level program. */ extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); -extern void FUN_L00_002628d8(char *, char *, int, float, float); +extern void update_joint_animation(char *, char *, int, float, float) __asm__("FUN_L00_002628d8"); void FUN_L07_00313f60(char *moby, char *d, float *t) { float a; float k; if (((unsigned char *)moby)[0x20] < 10) { - a = FUN_001f9e90(t[0] - *(float *)(moby + 0x10), t[1] - *(float *)(moby + 0x14)); + a = fast_arc_tan(t[0] - *(float *)(moby + 0x10), t[1] - *(float *)(moby + 0x14)); *(float *)(d + 0x268) = fast_subtract_rotations(a, *(float *)(moby + 0x48)); } else { *(int *)(d + 0x268) = 0; @@ -624,7 +624,7 @@ void FUN_L07_00313f60(char *moby, char *d, float *t) { } k = frame_scale_sq; *(float *)(d + 0x264) = *(float *)(d + 0x1FC); - FUN_L00_002628d8(moby, d + 0x200, 0xB, k * 0.030f, k * 0.3f); + update_joint_animation(moby, d + 0x200, 0xB, k * 0.030f, k * 0.3f); } typedef struct { char pad0[0x44]; @@ -682,14 +682,14 @@ extern ChaserSpawnRecord D_L07_00179B40[]; extern int D_L07_0020C600[][4]; #include "rnc/gameplay/state/item_state.h" extern void FUN_L00_00263ac8(float, int, int, void *); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern int FUN_00214720(void *, int); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void FUN_L00_0025a120(struct Moby *); extern int get_target_sight(void *, void *, float) __asm__("FUN_L07_002886d8"); extern int FUN_L00_001fefc8(void *); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern float FUN_001f99c0(float); extern void FUN_L00_002defe0(int); extern void enqueue_callback_list_1(void (*)(), void *) __asm__("FUN_001f4600"); @@ -698,7 +698,7 @@ extern void FUN_L00_00235d80(void); extern void FUN_L00_00235ea0(void); extern void FUN_L06_00249738(void); extern void FUN_L05_0028be78(int *, int, int); -extern void FUN_L00_002ddca0(void *); +extern void suck_reset(void *) __asm__("FUN_L00_002ddca0"); extern int FUN_001160d8(void); extern int tick_countdown_32_alt(s32 *) __asm__("FUN_001f9740"); extern int FUN_00213260(int); @@ -723,16 +723,17 @@ extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float FUN_L07_00317e60(void *, void *); extern void FUN_L07_00318e98(int); extern void FUN_L00_00257d78(void *, float, float); -extern int FUN_L00_0025d808(void *, void *, int *, float *, float, int); +extern int sample_path(void *, void *, int *, float *, float, int) __asm__("FUN_L00_0025d808"); extern float FUN_L00_0025abf0(void *, void *, void *, float, float); -extern char *FUN_L00_002c52a8(void *, int, int, int); +extern char *spawn_on_path(void *, int, int, int) __asm__("FUN_L00_002c52a8"); extern void set_animation_parameter(int, int) __asm__("FUN_001ff570"); extern void FUN_L06_002e6148(char *); extern void FUN_L00_0023e838(int); extern void mark_moby_for_removal(void *); -extern void FUN_L00_00259fe8(struct Moby *, float); +extern void jet_animate(struct Moby *, float) __asm__("FUN_L00_00259fe8"); extern void FUN_L07_00312150(char *); -void FUN_L07_00314150(unsigned char *moby) { +void snagglebeast_update(unsigned char *moby) __asm__("FUN_L07_00314150"); +void snagglebeast_update(unsigned char *moby) { Vec4 oldpos; ChaserSight sight; Vec4 position; @@ -772,22 +773,22 @@ void FUN_L07_00314150(unsigned char *moby) { FUN_L07_00313420((char *)moby, (char *)data, health); follow_target = 0; get_target_sight((struct Moby *)moby, &sight, 30.0f); - target_distance = FUN_001f9b80(&sight, moby + 0x10); - target_angle = FUN_001f9e90(sight.pos.f[0] - *(float *)(moby + 0x10), sight.pos.f[1] - *(float *)(moby + 0x14)); - hero_distance = FUN_001f9b80(moby + 0x10, ((char *)&hero) + 0x80); + target_distance = vector_distance(&sight, moby + 0x10); + target_angle = fast_arc_tan(sight.pos.f[0] - *(float *)(moby + 0x10), sight.pos.f[1] - *(float *)(moby + 0x14)); + hero_distance = vector_distance(moby + 0x10, ((char *)&hero) + 0x80); { char *g = ((char *)&hero); - hero_angle = FUN_001f9e90(*(float *)(g + 0x80) - *(float *)(moby + 0x10), *(float *)(g + 0x84) - *(float *)(moby + 0x14)); + hero_angle = fast_arc_tan(*(float *)(g + 0x80) - *(float *)(moby + 0x10), *(float *)(g + 0x84) - *(float *)(moby + 0x14)); } if (FUN_L00_001fefc8(data + 0x1F7)) { - if ((FUN_001f9b80(moby + 0x10, ((char *)&hero) + 0x80) > 8.0f && moby[0x20] != 5) - || (FUN_001f9b80(moby + 0x10, ((char *)&hero) + 0x80) > 6.0f && (moby[0x20] == 5 || moby[0xBC] % 3U == 1))) { + if ((vector_distance(moby + 0x10, ((char *)&hero) + 0x80) > 8.0f && moby[0x20] != 5) + || (vector_distance(moby + 0x10, ((char *)&hero) + 0x80) > 6.0f && (moby[0x20] == 5 || moby[0xBC] % 3U == 1))) { follow_target = 1; } } timer19a = 0; - timer194 = FUN_001f9770(data + 0x194) != 0; - if (FUN_001f9770(data + 0x19A) && target_distance > 9.0f) timer19a = 1; + timer194 = fast_dec_timer_s16(data + 0x194) != 0; + if (fast_dec_timer_s16(data + 0x19A) && target_distance > 9.0f) timer19a = 1; sight_ready = 0; if (data[0x1C7] != 0) { char *g = ((char *)&hero); @@ -797,7 +798,7 @@ void FUN_L07_00314150(unsigned char *moby) { } } target_close = 0; - if (FUN_001f9770(data + 0x198)) { + if (fast_dec_timer_s16(data + 0x198)) { if (((moby[0x20] == 5 || moby[0xBC] % 3U == 1) && target_distance < 14.0f) || (moby[0x20] != 5 && target_distance < 10.0f)) target_close = 1; } { @@ -868,7 +869,7 @@ void FUN_L07_00314150(unsigned char *moby) { } if (moby[0xBC] % 3U == 2) *(int *)(data + 0x1B4) += 0xF; if (moby[0x20] != 8 && moby[0x20] != 0) FUN_L00_002defe0((int)moby); - if (data[0x1C5] == 1) { + if ((int)data[0x1C5] - 1 == 0) { if (*(int *)(data + 0x1F8) == -1) *(int *)(data + 0x1F8) = FUN_0022da68(0xF, 4, (int)moby); *(float *)(data + 0x1C8) += frame_scale * 0.01f; if (*(float *)(data + 0x1C8) >= 1.0f) data[0x1C5] = 0; @@ -935,7 +936,7 @@ void FUN_L07_00314150(unsigned char *moby) { *(int *)(data + 0x1A8) = -1; *(int *)(data + 0x1B0) = -1; *(int *)(data + 0x1C0) = FUN_L01_0028b510(moby + 0x10, D_L07_001B0530[*(int *)(data + 0x188)], 0.0f); - FUN_L00_002ddca0(moby); + suck_reset(moby); *(float *)(moby + 0x2C) *= 1.75f; data[0x1C7] = 0; *(float *)(data + 0x98) = 1.7453293f; @@ -1006,7 +1007,7 @@ void FUN_L07_00314150(unsigned char *moby) { float rot; rot = *(float *)(moby + 0x48); if (level_frame_count % 6 == 0) FUN_L07_0029b8d8((char *)moby, 0, 600000.0f, 5.0f); - if ((level_frame_count - 2) % 6 == 0) FUN_L07_0029b8d8((char *)moby, 1, 600000.0f, 5.0f); + if ((frame_count_l07 - 2) % 6 == 0) FUN_L07_0029b8d8((char *)moby, 1, 600000.0f, 5.0f); if (FUN_L07_00313de8(moby, data, (float *)(((char *)&hero) + 0x80), 9, 0)) break; FUN_L00_00258278((struct Moby *)moby, target_angle, (float *)(data + 0x168), frame_time_sq * 2.0943952f, frame_time_sq * 0.6981317f, frame_time * 2.0943952f); if (fast_difference_between_rotations(*(float *)(moby + 0x48), rot) > frame_time * 0.17453292f) { @@ -1021,8 +1022,8 @@ void FUN_L07_00314150(unsigned char *moby) { } } if (moby[0x52] == 9 || moby[0x52] == 0xD) moby[0x20] = FUN_L07_003122b0(moby, (char *)data, (float *)&sight); - if ((moby[0xBC] % 3U == 0 && FUN_001f9b80(&sight, moby + 0x10) > 13.0f) - || (moby[0xBC] % 3U == 1 && FUN_001f9b80(&sight, moby + 0x10) > 20.0f)) { + if ((moby[0xBC] % 3U == 0 && vector_distance(&sight, moby + 0x10) > 13.0f) + || (moby[0xBC] % 3U == 1 && vector_distance(&sight, moby + 0x10) > 20.0f)) { *(short *)(data + 0x198) = scale_ticks(0x23); *(int *)(data + 0x160) = scale_ticks(0x1E); moby[0x20] = 1; @@ -1148,22 +1149,22 @@ void FUN_L07_00314150(unsigned char *moby) { thr = 6.0f; if (*(int *)(data + 0x29C) != -1 && (data[0x19C] & 3) == 0 && FUN_00214720(&sight, *(int *)(data + 0x29C))) { qcopy(&velocity, D_L07_001B0530[*(int *)(data + 0x1A0)] + FUN_L01_0028b510(&sight, D_L07_001B0530[*(int *)(data + 0x1A0)], 0.0f) * 16 + 0x10); - dd = FUN_001f9b80(moby + 0x10, &velocity); + dd = vector_distance(moby + 0x10, &velocity); } else { qcopy(&velocity, &sight); qcopy(&velocity, D_L07_001B0530[*(int *)(data + 0x290)] + FUN_L01_0028b510(&velocity, D_L07_001B0530[*(int *)(data + 0x290)], 0.0f) * 16 + 0x10); - dd = FUN_001f9b80(moby + 0x10, &velocity); + dd = vector_distance(moby + 0x10, &velocity); if (dd < *(float *)(data + 0x9C) + 1.0f) qcopy(&velocity, &sight); } } else { qcopy(&velocity, D_L07_001B0530[*(int *)(data + 0x188)] + *(int *)(data + 0x1A8) * 16 + 0x10); - dd = FUN_001f9b80(moby + 0x10, &velocity); + dd = vector_distance(moby + 0x10, &velocity); } FUN_L07_00313d30((struct ChaserAnim *)moby, (struct ChaserSpeed *)data, dd, thr, 1.5f); if ((*(int *)(data + 0x298) & 3) == 0) FUN_L07_00313988((char *)moby, (char *)data, &velocity, data + 0x140); qcopy(&position, data + 0x140); *(int *)(data + 0x298) += 1; - if (*(float *)(data + 0x98) < fast_difference_between_rotations(*(float *)(moby + 0x48), FUN_001f9e90(position.f[0] - *(float *)(moby + 0x10), position.f[1] - *(float *)(moby + 0x14)))) { + if (*(float *)(data + 0x98) < fast_difference_between_rotations(*(float *)(moby + 0x48), fast_arc_tan(position.f[0] - *(float *)(moby + 0x10), position.f[1] - *(float *)(moby + 0x14)))) { *(float *)(moby + 0x58) = 1.0f; data[0x1F4] = moby[0x20]; data[0x1F6] = 0xA; @@ -1265,7 +1266,7 @@ void FUN_L07_00314150(unsigned char *moby) { case 7: { float diff; if (data[0x1F5] == 0) qcopy(data + 0xC0, ((char *)&hero) + 0x80); - diff = fast_subtract_rotations(FUN_001f9e90(*(float *)(data + 0xC0) - *(float *)(moby + 0x10), *(float *)(data + 0xC4) - *(float *)(moby + 0x14)), *(float *)(moby + 0x48)); + diff = fast_subtract_rotations(fast_arc_tan(*(float *)(data + 0xC0) - *(float *)(moby + 0x10), *(float *)(data + 0xC4) - *(float *)(moby + 0x14)), *(float *)(moby + 0x48)); if (!target_close && (moby[0x70] & 2)) { if (diff < 0.0001f) { if (moby[0x53] != 3) FUN_00212f90(moby, 3, 5, random_int_between(0xA, 0xD)); @@ -1276,7 +1277,7 @@ void FUN_L07_00314150(unsigned char *moby) { if (moby[0x52] == 3 || moby[0x52] == 0xE || moby[0x52] == 0xD) { float dz = FUN_0020c9e0(moby); if (dz < 14.5f || (dz > 19.0f && dz < 35.5f) || dz > 40.5f) { - FUN_L00_00258278((struct Moby *)moby, FUN_001f9e90(*(float *)(data + 0xC0) - *(float *)(moby + 0x10), *(float *)(data + 0xC4) - *(float *)(moby + 0x14)), + FUN_L00_00258278((struct Moby *)moby, fast_arc_tan(*(float *)(data + 0xC0) - *(float *)(moby + 0x10), *(float *)(data + 0xC4) - *(float *)(moby + 0x14)), (float *)(data + 0x168), frame_time_sq * 2.0943952f, frame_time_sq * 0.6981317f, frame_time * 2.0943952f); } if (diff > 0.001f && moby[0x53] == 3) { @@ -1287,7 +1288,7 @@ void FUN_L07_00314150(unsigned char *moby) { } else { *(int *)(data + 0x84) = 0; } - if (fast_difference_between_rotations(*(float *)(moby + 0x48), FUN_001f9e90(*(float *)(data + 0xC0) - *(float *)(moby + 0x10), *(float *)(data + 0xC4) - *(float *)(moby + 0x14))) < *(float *)(data + 0x98) * 0.25f) { + if (fast_difference_between_rotations(*(float *)(moby + 0x48), fast_arc_tan(*(float *)(data + 0xC0) - *(float *)(moby + 0x10), *(float *)(data + 0xC4) - *(float *)(moby + 0x14))) < *(float *)(data + 0x98) * 0.25f) { qzero(data + 0x100); if (moby[0x53] != data[0x1F6]) { int anim = data[0x1F6]; @@ -1325,15 +1326,15 @@ void FUN_L07_00314150(unsigned char *moby) { char *o1 = *(char **)(level_mobys + (((ChaserPathPoints *)data)->linked_mobys[k] << 8) + 0x78); char *o2 = *(char **)(level_mobys + (((ChaserPathPoints *)data)->linked_mobys[k2] << 8) + 0x78); if (*(int *)(o1 + 0x28) != -1 && *(int *)(o2 + 0x28) != -1) { - float d1 = FUN_001f9b80(((char *)&hero) + 0x80, D_L07_001600EC + (*(int *)(o1 + 0x28) << 7) + 0x30); + float d1 = vector_distance(((char *)&hero) + 0x80, D_L07_001600EC + (*(int *)(o1 + 0x28) << 7) + 0x30); int sel; - if (FUN_001f9b80(((char *)&hero) + 0x80, D_L07_001600EC + (*(int *)(o2 + 0x28) << 7) + 0x30) < d1) { + if (vector_distance(((char *)&hero) + 0x80, D_L07_001600EC + (*(int *)(o2 + 0x28) << 7) + 0x30) < d1) { sel = *(int *)(o2 + 0x28); k = k2; } else { sel = *(int *)(o1 + 0x28); } - *(float *)(moby + 0x48) = FUN_001f9e90(*(float *)(D_L07_001600EC + sel * 0x80 + 0x30) - *(float *)(moby + 0x10), + *(float *)(moby + 0x48) = fast_arc_tan(*(float *)(D_L07_001600EC + sel * 0x80 + 0x30) - *(float *)(moby + 0x10), *(float *)(D_L07_001600EC + sel * 0x80 + 0x34) - *(float *)(moby + 0x14)); } } @@ -1388,15 +1389,15 @@ void FUN_L07_00314150(unsigned char *moby) { *(int *)(data + 0x164) -= 1; *health -= 1.0f; data[0x67] = 0xFA; - FUN_L00_0025d458(moby, (short *)(data + 0x60)); + trooper_anim_update(moby, (short *)(data + 0x60)); if (*health <= 0.0f) { *health = 0.0f; if (moby[0x53] != 8) FUN_00212f90(moby, 8, 0, random_int_between(0xA, 0xD)); if (*(int *)(data + 0x1F0) != -1) { FUN_L00_00266858(moby, 1); FUN_L00_00257470(moby, 0, -1); - FUN_L00_002502a0(moby[0xB0]); - FUN_L00_00284e50(D_L07_001600EC + (*(int *)(data + 0x1F0) << 7) + 0x30, D_L07_001600EC + (*(int *)(data + 0x1F0) << 7) + 0x70); + jet_clear_persistent(moby[0xB0]); + jet_reset_camera(D_L07_001600EC + (*(int *)(data + 0x1F0) << 7) + 0x30, D_L07_001600EC + (*(int *)(data + 0x1F0) << 7) + 0x70); } moby[0x20] = 0xA; } else { @@ -1419,8 +1420,8 @@ void FUN_L07_00314150(unsigned char *moby) { data[0x19C] &= 0xFD; break; case 2: { - float d1 = FUN_001f9b80(((char *)&hero) + 0x80, D_L07_001B0530[*(int *)(data + 0x1A0)] + 0x30); - if (FUN_001f9b80(((char *)&hero) + 0x80, D_L07_001B0530[*(int *)(data + 0x1A0)] + 0x40) < d1) { + float d1 = vector_distance(((char *)&hero) + 0x80, D_L07_001B0530[*(int *)(data + 0x1A0)] + 0x30); + if (vector_distance(((char *)&hero) + 0x80, D_L07_001B0530[*(int *)(data + 0x1A0)] + 0x40) < d1) { qcopy(data + 0x120, D_L07_001B0530[*(int *)(data + 0x1A0)] + 0x30); } else { qcopy(data + 0x120, D_L07_001B0530[*(int *)(data + 0x1A0)] + 0x40); @@ -1556,9 +1557,9 @@ void FUN_L07_00314150(unsigned char *moby) { pidx = FUN_L01_0028b510(((char *)&hero) + 0x80, path, 0.0f); do { *(float *)(data + 0x1AC) += 10.0f; - FUN_L00_0025d808(path, &start, &pidx, &pfrac, *(float *)(data + 0x1AC), 1); - d1 = FUN_001f9b80(((char *)&hero) + 0x80, &start); - d2 = FUN_001f9b80(moby + 0x10, &start); + sample_path(path, &start, &pidx, &pfrac, *(float *)(data + 0x1AC), 1); + d1 = vector_distance(((char *)&hero) + 0x80, &start); + d2 = vector_distance(moby + 0x10, &start); } while (d1 < 8.0f || d2 < 12.0f); FUN_L07_00313920((float *)&start, 0.5f); subtract_vector_xyz(&direction, &start, ((char *)&hero) + 0x80); @@ -1573,7 +1574,7 @@ void FUN_L07_00314150(unsigned char *moby) { } FUN_0022da68(0xB, 0, (int)moby); { - char *obj = FUN_L00_002c52a8(&direction, slot, cnt, 0); + char *obj = spawn_on_path(&direction, slot, cnt, 0); if (obj != 0) { qcopy_nc(*(char **)(obj + 0x78) + 0x10, &velocity); *(float *)(*(char **)(obj + 0x78) + 0x28) = zv; @@ -1624,7 +1625,7 @@ void FUN_L07_00314150(unsigned char *moby) { if (*(int *)(data + 0x164) <= 0) { if (FUN_L07_00313de8(moby, data, (float *)(data + 0x150), 7, 1)) break; } - FUN_L00_00258278((struct Moby *)moby, FUN_001f9e90(*(float *)(data + 0x150) - *(float *)(moby + 0x10), *(float *)(data + 0x154) - *(float *)(moby + 0x14)), + FUN_L00_00258278((struct Moby *)moby, fast_arc_tan(*(float *)(data + 0x150) - *(float *)(moby + 0x10), *(float *)(data + 0x154) - *(float *)(moby + 0x14)), (float *)(data + 0x168), frame_time_sq * 2.0943952f, frame_time_sq * 0.6981317f, frame_time * 2.0943952f); switch (*(int *)(data + 0x164)) { case 0: @@ -1665,7 +1666,7 @@ void FUN_L07_00314150(unsigned char *moby) { } break; case 3: { - float r = FUN_001f9b80(moby + 0x10, &sight.position30); + float r = vector_distance(moby + 0x10, &sight.position30); *(float *)(data + 0x16C) += frame_scale; if (r <= *(float *)(data + 0x16C)) *(int *)(data + 0x164) = 4; if (tick_countdown_32_alt((int *)(data + 0x160))) *(int *)(data + 0x160) = scale_ticks(0x14); @@ -1705,7 +1706,7 @@ void FUN_L07_00314150(unsigned char *moby) { *(float *)(data + 0x108) = 1.0f; qcopy(&position, moby + 0x10); position.f[2] = *(float *)(data + 0x1B8) + 1.0f; - FUN_L00_0025e450(moby, data + 0x100, &position, 0.0f, 0.0f, 0x14, 0xC, 0x40, 7.0f, 5.0f, 10.0f, 1.0f, -1, 50.0f, 1, 1, -1, 0); + spawn_explosion(moby, data + 0x100, &position, 0.0f, 0.0f, 0x14, 0xC, 0x40, 7.0f, 5.0f, 10.0f, 1.0f, -1, 50.0f, 1, 1, -1, 0); *(unsigned short *)(moby + 0x34) |= 0x41; if (*(int *)(data + 0x1CC) != -1) FUN_L06_002e6148(level_mobys + (*(int *)(data + 0x1CC) << 8)); moby[0x20] = 0x10; @@ -1737,7 +1738,7 @@ void FUN_L07_00314150(unsigned char *moby) { break; } subtract_vector_xyz(data + 0x100, moby + 0x10, &oldpos); - if (moby[0x20] < 0xA) FUN_L00_00259fe8((struct Moby *)moby, 2.5f); + if (moby[0x20] < 0xA) jet_animate((struct Moby *)moby, 2.5f); FUN_L07_00312150((char *)data); } #endif @@ -2265,14 +2266,14 @@ extern s32 sight_19040(struct Moby *, void *, f32) __asm__("FUN_L07_002886d8"); extern char *hit_lookup_19040(struct Moby *, s32, s32) __asm__("FUN_L00_0025a420"); extern s32 hit_test_19040(struct Moby *, char *, void *, s32, s32 *, s32, s32, s32) __asm__("FUN_00213928"); extern f32 FUN_001f9b48(void *, void *); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern f32 FUN_001f99c0(f32); extern void FUN_L00_0025a120(struct Moby *); extern void make_hit_descriptor_19040(void *, void *, s32, f32, void *) __asm__("FUN_L00_00259888"); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, float, int, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_00257470(void *, int, int); -extern void FUN_L00_00259fe8(struct Moby *, f32); +extern void jet_animate(struct Moby *, f32) __asm__("FUN_L00_00259fe8"); extern s32 tick_countdown_32_alt(s32 *) __asm__("FUN_001f9740"); extern s32 coll_sphere(f32, void *, s32, struct Moby *) __asm__("FUN_L00_001f0d60"); extern int scale_ticks(int) __asm__("FUN_001f96f8"); @@ -2298,7 +2299,8 @@ extern struct Moby *debris_target __asm__("D_L07_00173ED8") __attribute__((secti /* Floating mine: wakes when its target or a seen point comes close, then bobs and chases the seen point. It blows up when a hit lands (not from classes 0x456/0x365/0x367), on contact with a solid moby or when its timer runs out, and is removed once 64 units from home. */ -void FUN_L07_00319040(struct Moby *moby) { +void homing_mine_update(struct Moby *moby) __asm__("FUN_L07_00319040"); +void homing_mine_update(struct Moby *moby) { Mine_19040 *vars; f32 *health; char sight[0x50]; @@ -2329,7 +2331,7 @@ void FUN_L07_00319040(struct Moby *moby) { if (touching >= 2 && hit != NULL && (*(struct Moby **)(hit + 0x20))->oclass != 0x456 && (*(struct Moby **)(hit + 0x20))->oclass != 0x365 && (*(struct Moby **)(hit + 0x20))->oclass != 0x367) { clear_u64_value(dir.f); - FUN_L00_0025e450(moby, &dir, NULL, 0.0f, 0.0f, 3, 3, 5, 2.0f, 1.0f, 4.0f, 1.0f, 2, 7.0f, 0, 1, -1, 0); + spawn_explosion(moby, &dir, NULL, 0.0f, 0.0f, 3, 3, 5, 2.0f, 1.0f, 4.0f, 1.0f, 2, 7.0f, 0, 1, -1, 0); FUN_L00_00257470(moby, 0, -1); mark_moby_for_removal(moby); return; @@ -2348,7 +2350,7 @@ void FUN_L07_00319040(struct Moby *moby) { vars->timeout = timer; moby->rot.z = fast_add_rotations(moby->rot.z, turn); if ((vars->target != NULL && - FUN_001f9b80(&moby->pos, &(vars->target)->pos) < 20.0f && + vector_distance(&moby->pos, &(vars->target)->pos) < 20.0f && FUN_001f99c0(moby->pos.z - (vars->target)->pos.z) < 3.0f) || (*(s32 *)(sight + 0x40) != 0 && FUN_001f9b48(&moby->pos, sight) < 8.0f)) { vars->speed = 0.0f; @@ -2397,7 +2399,7 @@ void FUN_L07_00319040(struct Moby *moby) { debris_target != NULL && debris_target->oclass != 0x363 && debris_target->oclass != 0x456 && debris_target->oclass != 0x458 && debris_target->oclass != 0x365 && debris_target->oclass != 0x367) { - FUN_L00_0025e450(moby, &dir, NULL, 0.0f, 0.0f, 3, 3, 5, 2.0f, 1.0f, 4.0f, 1.0f, 2, 7.0f, 0, 1, -1, 0); + spawn_explosion(moby, &dir, NULL, 0.0f, 0.0f, 3, 3, 5, 2.0f, 1.0f, 4.0f, 1.0f, 2, 7.0f, 0, 1, -1, 0); mark_moby_for_removal(moby); return; } @@ -2408,13 +2410,13 @@ void FUN_L07_00319040(struct Moby *moby) { add_vector_xyz(&moby->pos, &moby->pos, &push); } if (!tick_countdown_32_alt(&vars->timeout)) break; - FUN_L00_0025e450(moby, &dir, NULL, 0.0f, 0.0f, 3, 3, 5, 2.0f, 1.0f, 4.0f, 1.0f, 2, 7.0f, 0, 1, -1, 0); + spawn_explosion(moby, &dir, NULL, 0.0f, 0.0f, 3, 3, 5, 2.0f, 1.0f, 4.0f, 1.0f, 2, 7.0f, 0, 1, -1, 0); mark_moby_for_removal(moby); return; case 4: break; } - FUN_L00_00259fe8(moby, 0.7f); + jet_animate(moby, 0.7f); } extern int scale_ticks(int) __asm__("FUN_001f96f8"); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); @@ -2456,7 +2458,7 @@ typedef struct { s32 bob_timer; /* 0xAC */ } SwooperVars; -/* What FUN_L07_002886d8 reports about the hero. */ +/* What get_target_sight reports about the hero. */ typedef struct { Vec4 pos; u8 pad10[0x30]; @@ -2488,19 +2490,19 @@ extern f32 D_0015ED6C; extern s32 FUN_L07_002886d8(struct Moby *, SwooperSight *, f32); extern f32 FUN_001f9b48(void *, void *); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern f32 FUN_001f99c0(f32); extern void FUN_L00_0025a120(struct Moby *); extern MobyHit *find_moby_hit(struct Moby *, s32, s32) __asm__("FUN_L00_0025a420"); extern s32 fun_00213928(struct Moby *, MobyHit *, void *, s32, s32 *, s32, s32, s32) __asm__("FUN_00213928"); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, float, int, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_00257470(void *, int, int); extern void clamp_vector_length(void *, void *, f32) __asm__("FUN_001f9c90"); extern f32 spring_turn(f32 *, f32, f32, f32, f32, f32) __asm__("FUN_L00_00258110"); extern s32 tick_countdown_32_alt(s32 *) __asm__("FUN_001f9740"); extern s32 coll_sphere(f32, void *, s32, struct Moby *) __asm__("FUN_L00_001f0d60"); -extern void FUN_L00_00259fe8(struct Moby *, f32); +extern void jet_animate(struct Moby *, f32) __asm__("FUN_L00_00259fe8"); /* Swooper: holds at its goal, dives at the hero once it sees it and bursts on contact. */ void FUN_L07_003196e0(struct Moby *moby) { @@ -2534,7 +2536,7 @@ void FUN_L07_003196e0(struct Moby *moby) { fun_00213928(moby, hit, collision, 0, &touching, 0, 0, 4); if (touching >= 2 && hit != NULL && hit->moby->oclass != 0x363 && hit->moby->oclass != 0x458 && hit->moby->oclass != 0x367) { - FUN_L00_0025e450(moby, &vars->velocity, NULL, 0.0f, 0.0f, 3, 3, 5, 2.0f, 1.0f, 4.0f, 1.0f, 2, 7.0f, 0, 1, -1, 0); + spawn_explosion(moby, &vars->velocity, NULL, 0.0f, 0.0f, 3, 3, 5, 2.0f, 1.0f, 4.0f, 1.0f, 2, 7.0f, 0, 1, -1, 0); FUN_L00_00257470(moby, 0, -1); FUN_L07_00319698(moby, spawner_vars); } @@ -2547,22 +2549,22 @@ void FUN_L07_003196e0(struct Moby *moby) { clear_u64_value(&vars->velocity); qcopy(&vars->home, &moby->pos); moby->rot.y = 0.0f; - moby->rot.z = FUN_001f9e90(vars->goal.f[0] - moby->pos.x, vars->goal.f[1] - moby->pos.y); + moby->rot.z = fast_arc_tan(vars->goal.f[0] - moby->pos.x, vars->goal.f[1] - moby->pos.y); vars->unk29 = 0; moby->state = 1; moby->command = 0; break; case 1: subtract_vector_xyz(&vars->velocity, &vars->goal, &moby->pos); - FUN_L00_00258278(moby, FUN_001f9e90(vars->goal.f[0] - moby->pos.x, vars->goal.f[1] - moby->pos.y), + FUN_L00_00258278(moby, fast_arc_tan(vars->goal.f[0] - moby->pos.x, vars->goal.f[1] - moby->pos.y), &vars->turn_speed, frame_time_sq * 6.2831855f, D_0015ED6C * 3.1415927f, D_0015ED6C * 6.2831855f); qcopy(&moby->pos, &vars->goal); - if ((vars->perch != NULL && FUN_001f9b80(&moby->pos, &vars->perch->pos) < 20.0f && + if ((vars->perch != NULL && vector_distance(&moby->pos, &vars->perch->pos) < 20.0f && FUN_001f99c0(moby->pos.z - vars->perch->pos.z) < 3.0f) || (sight.found != 0 && FUN_001f9b48(&moby->pos, &sight.pos) < spawner_vars->view_range && - FUN_001f9b80(&moby->pos, &vars->spawner->pos) > 2.0f && - fast_difference_between_rotations(moby->rot.z, FUN_001f9e90(sight.pos.f[0] - moby->pos.x, + vector_distance(&moby->pos, &vars->spawner->pos) > 2.0f && + fast_difference_between_rotations(moby->rot.z, fast_arc_tan(sight.pos.f[0] - moby->pos.x, sight.pos.f[1] - moby->pos.y)) < spawner_vars->view_angle * 0.017453292f)) { if (moby->prev_seq != 1) { @@ -2591,10 +2593,10 @@ void FUN_L07_003196e0(struct Moby *moby) { moby->command = 0; } } - FUN_L00_00258278(moby, FUN_001f9e90(sight.pos.f[0] - moby->pos.x, sight.pos.f[1] - moby->pos.y), + FUN_L00_00258278(moby, fast_arc_tan(sight.pos.f[0] - moby->pos.x, sight.pos.f[1] - moby->pos.y), &vars->turn_speed, frame_time_sq * 3.1415927f, D_0015ED6C * 3.1415927f, D_0015ED6C * 6.2831855f); - pitch = FUN_001f9e90(FUN_001f9b80(&moby->pos, &sight.pos), sight.pos.f[2] - moby->pos.z); + pitch = fast_arc_tan(vector_distance(&moby->pos, &sight.pos), sight.pos.f[2] - moby->pos.z); moby->rot.y = spring_turn(&vars->pitch_speed, moby->rot.y, pitch, frame_time_sq * 3.1415927f, D_0015ED6C * 3.1415927f, D_0015ED6C * 6.2831855f); subtract_vector_xyz(&dir, &sight.pos, &moby->pos); @@ -2615,7 +2617,7 @@ void FUN_L07_003196e0(struct Moby *moby) { debris_target->oclass != 0x363 && debris_target->oclass != 0x456 && debris_target->oclass != 0x458 && debris_target->oclass != 0x365 && debris_target->oclass != 0x367) { - FUN_L00_0025e450(moby, &vars->velocity, NULL, 0.0f, 0.0f, 3, 3, 5, 2.0f, 1.0f, 4.0f, 1.0f, 2, 7.0f, 0, 1, -1, 0); + spawn_explosion(moby, &vars->velocity, NULL, 0.0f, 0.0f, 3, 3, 5, 2.0f, 1.0f, 4.0f, 1.0f, 2, 7.0f, 0, 1, -1, 0); FUN_L07_00319698(moby, spawner_vars); } qcopy(&probe, &moby->pos); @@ -2629,13 +2631,13 @@ void FUN_L07_003196e0(struct Moby *moby) { } break; case 3: - FUN_L00_0025e450(moby, &vars->velocity, NULL, 0.0f, 0.0f, 3, 3, 5, 2.0f, 1.0f, 4.0f, 1.0f, 2, 7.0f, 0, 1, -1, 0); + spawn_explosion(moby, &vars->velocity, NULL, 0.0f, 0.0f, 3, 3, 5, 2.0f, 1.0f, 4.0f, 1.0f, 2, 7.0f, 0, 1, -1, 0); FUN_L07_00319698(moby, spawner_vars); break; case 4: break; } - FUN_L00_00259fe8(moby, 0.7f); + jet_animate(moby, 0.7f); } /* Pvars of a breakable crate-like prop. */ @@ -2682,21 +2684,21 @@ void FUN_L07_00319f48(struct Moby *m) { break_spawn_shard(&p, &vel, cls, scale, random_int_between(0x32, 0x50), 1.0f, 1.0f, 0.75f, 0); } - FUN_L00_0025e450(m, &h->pos, h, 3.0f, 1.0f, 10, 3, 16, 4.0f, 2.0f, 9.0f, 1.0f, 0, 15.0f, 1, 1, -1, 0); + spawn_explosion(m, &h->pos, h, 3.0f, 1.0f, 10, 3, 16, 4.0f, 2.0f, 9.0f, 1.0f, 0, 15.0f, 1, 1, -1, 0); mark_moby_for_removal(m); return; } m->hit_slot = 0xFF; } -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); -extern float FUN_001fa688(float, float); -extern float FUN_L00_0025e310(float); -extern int FUN_001f96f8(int); -extern int FUN_001f9770(void *); -extern void FUN_L00_0025d458(void *, void *); -extern void FUN_L00_0025d538(void *, void *); +extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +extern void trooper_anim_update(void *, void *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern void FUN_00212f90(void *, int, int, int); extern void FUN_L00_00257470(void *, int, int); extern void FUN_L00_0024f7c8(void *, int, void *); @@ -2705,7 +2707,8 @@ extern char *level_mobys __asm__("D_L07_0015FFD8"); extern void FUN_L07_0030b538(void *, void *, void *, int); extern float D_0015ED6C; -void FUN_L07_0031a250(unsigned char *moby) { +void machinegun_turret_update(unsigned char *moby) __asm__("FUN_L07_0031a250"); +void machinegun_turret_update(unsigned char *moby) { char *data; char *hit; char *collision; @@ -2727,25 +2730,25 @@ void FUN_L07_0031a250(unsigned char *moby) { FUN_L00_00257470(moby, 0, -1); *(u16 *)(moby + 0x34) &= 0xefff; *(u8 *)(data + 0x67) = 0xfa; - *(s16 *)(data + 0x26) = FUN_001f96f8(60); - FUN_L00_0025d458(moby, animation); - *(s16 *)(data + 0x7c) = FUN_001f96f8(60); + *(s16 *)(data + 0x26) = scale_game_frames(60); + trooper_anim_update(moby, animation); + *(s16 *)(data + 0x7c) = scale_game_frames(60); if ((u8)moby[0x53] != 2) FUN_00212f90(moby, 2, 0, 5); moby[0x20] = 2; } *(u8 *)(moby + 0xa4) = 0xff; - FUN_L00_0025d538(moby, animation); + trooper_anim_finish(moby, animation); switch ((u8)moby[0x20]) { case 0: if (*(int *)(data + 0x70) != -1) { char *target = (char *)(*(int *)(data + 0x70) * 0x100 + (int)level_mobys); - *(float *)(data + 0x80) = FUN_001f9e90(*(float *)(target + 0x10) - *(float *)(moby + 0x10), + *(float *)(data + 0x80) = fast_arc_tan(*(float *)(target + 0x10) - *(float *)(moby + 0x10), *(float *)(target + 0x14) - *(float *)(moby + 0x14)); if (*(float *)(data + 0x80) < 0.0f) *(float *)(data + 0x80) += 6.2831855f; } if (*(int *)(data + 0x74) != -1) { char *target = (char *)(*(int *)(data + 0x74) * 0x100 + (int)level_mobys); - *(float *)(data + 0x84) = FUN_001f9e90(*(float *)(target + 0x10) - *(float *)(moby + 0x10), + *(float *)(data + 0x84) = fast_arc_tan(*(float *)(target + 0x10) - *(float *)(moby + 0x10), *(float *)(target + 0x14) - *(float *)(moby + 0x14)); if (*(float *)(data + 0x84) < 0.0f) *(float *)(data + 0x84) += 6.2831855f; if (*(float *)(data + 0x84) < *(float *)(data + 0x80)) @@ -2755,7 +2758,7 @@ void FUN_L07_0031a250(unsigned char *moby) { } *(float *)(data + 0x88) = 0.0f; *(float *)(data + 0x8c) = *(float *)(data + 0x84) - *(float *)(data + 0x80); - *(float *)(moby + 0x48) = FUN_L00_0025e310(*(float *)(data + 0x80)); + *(float *)(moby + 0x48) = normalize_angle(*(float *)(data + 0x80)); *(float *)(data + 0x90) = *(float *)(moby + 0x18); data[0x29] = 0; moby[0xbc] = 0; @@ -2779,31 +2782,31 @@ void FUN_L07_0031a250(unsigned char *moby) { *(s16 *)(data + 0x7e) = 1; } } - *(float *)(moby + 0x48) = FUN_L00_0025e310(*(float *)(data + 0x80) + *(float *)(data + 0x88)); - if (FUN_001f9770(data + 0x7c) == 0) return; + *(float *)(moby + 0x48) = normalize_angle(*(float *)(data + 0x80) + *(float *)(data + 0x88)); + if (fast_dec_timer_s16(data + 0x7c) == 0) return; if ((u8)moby[0xbc] == 0) { if (*(int *)(data + 0x98) == 0 || (*(u16 *)(data + 0x9c) & 1)) { FUN_L00_0024f7c8(moby, 0, position); - velocity[0] = FUN_001f9dc8(*(float *)(moby + 0x48)) * (D_0015ED6C * 15.0f); - velocity[1] = FUN_001f9de0(*(float *)(moby + 0x48)) * (D_0015ED6C * 15.0f); + velocity[0] = fast_cos(*(float *)(moby + 0x48)) * (D_0015ED6C * 15.0f); + velocity[1] = fast_sin(*(float *)(moby + 0x48)) * (D_0015ED6C * 15.0f); velocity[2] = 0.0f; FUN_0022da68(0, 0, moby); FUN_L07_0030b538(position, velocity, moby, (u8)data[0x9e]); } if (*(int *)(data + 0x98) != 0) { - if (FUN_001f9770(data + 0x9c) != 0) { + if (fast_dec_timer_s16(data + 0x9c) != 0) { moby[0xbc] = 1; *(u16 *)(data + 0x9c) = *(u16 *)(data + 0x98); } } else { *(u16 *)(data + 0x9c) ^= 1; } - } else if (FUN_001f9770(data + 0x9c) != 0) { + } else if (fast_dec_timer_s16(data + 0x9c) != 0) { moby[0xbc] = 0; *(u16 *)(data + 0x9c) = *(u16 *)(data + 0x94); } - *(s16 *)(data + 0x7c) = FUN_001f96f8(6); - distance = FUN_001f9b80(moby + 0x10, D_0013F3D0); + *(s16 *)(data + 0x7c) = scale_game_frames(6); + distance = vector_distance(moby + 0x10, D_0013F3D0); if (!(55.0f < distance)) { if (!(35.0f < distance) || (u8)moby[0x31] != 0) return; } @@ -2823,8 +2826,8 @@ void FUN_L07_0031a250(unsigned char *moby) { direction = D_0015ED6C; } *(float *)(moby + 0x48) = fast_add_rotations(*(float *)(moby + 0x48), direction * 12.566371f); - if (FUN_001f9770(data + 0x7c) == 0) return; - *(s16 *)(data + 0x7c) = FUN_001f96f8(180); + if (fast_dec_timer_s16(data + 0x7c) == 0) return; + *(s16 *)(data + 0x7c) = scale_game_frames(180); moby[0x20] = 3; break; case 3: @@ -2834,13 +2837,13 @@ void FUN_L07_0031a250(unsigned char *moby) { *(float *)(moby + 0x18) -= frame_time * 5.0f; else *(float *)(moby + 0x18) = *(float *)(data + 0x90) - 0.7f; - direction = FUN_L00_0025e310(*(float *)(data + 0x80) + *(float *)(data + 0x88)); - distance = FUN_001fa688(*(float *)(moby + 0x48), direction); + direction = normalize_angle(*(float *)(data + 0x80) + *(float *)(data + 0x88)); + distance = fast_difference_between_rotations(*(float *)(moby + 0x48), direction); if (D_0015ED6C * 12.566371f < distance) *(float *)(moby + 0x48) = fast_add_rotations(*(float *)(moby + 0x48), D_0015ED6C * 12.566371f); else - *(float *)(moby + 0x48) = FUN_L00_0025e310(*(float *)(data + 0x80) + *(float *)(data + 0x88)); - if (FUN_001f9770(data + 0x7c) != 0) { + *(float *)(moby + 0x48) = normalize_angle(*(float *)(data + 0x80) + *(float *)(data + 0x88)); + if (fast_dec_timer_s16(data + 0x7c) != 0) { FUN_0022da68(2, 0, moby); if ((u8)moby[0x53] != 3) FUN_00212f90(moby, 3, 0, 5); moby[0x20] = 4; @@ -2860,3 +2863,4 @@ void FUN_L07_0031a250(unsigned char *moby) { break; } } + diff --git a/src/overlays/l07/gameplay/entities/taxi_platform.c b/src/overlays/l07/gameplay/entities/taxi_platform.c index 2c445ce8e5..78cb3a9fdf 100644 --- a/src/overlays/l07/gameplay/entities/taxi_platform.c +++ b/src/overlays/l07/gameplay/entities/taxi_platform.c @@ -18,7 +18,8 @@ extern void add_draw_callback(void *, void *) __asm__("FUN_001f4600"); extern void func_00233AB8(void) __asm__("FUN_L07_002ba260"); -void FUN_L07_002fbdb8(char *arg) { +void purple_ship_update(char *arg) __asm__("FUN_L07_002fbdb8"); +void purple_ship_update(char *arg) { arg[0x30] = 8; *(short *)(arg + 0xA6) = 0x215; add_draw_callback((void *)func_00233AB8, arg); @@ -32,7 +33,7 @@ void FUN_L07_002fbdb8(char *arg) { extern char *func_0020D348_m(int); extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void set_vector_length_xy(void *, void *, float) __asm__("FUN_001f9c48"); extern void FUN_L00_00250df8(void *); extern void make_hit_descriptor(char *arg, int a, int b, void *src, float scale) __asm__("FUN_L00_00259888"); @@ -60,7 +61,7 @@ unsigned char *FUN_L07_0030b538(void *pos, float *dir, int a, int b) { make_hit_descriptor(d, (int)m, 0x10001, V, 1.0f); d[0x18] = 1; d[0x19] = 1; - blend_moby_animation_u(m, 1, 0, FUN_001f96f8(5)); + blend_moby_animation_u(m, 1, 0, scale_game_frames(5)); *(short *)(m + 0x34) = 0x208; *(int *)(d + 0x50) = a; *(int *)(d + 0x54) = b; @@ -111,7 +112,8 @@ extern int is_point_inside_clip_volume() __asm__("FUN_00214720"); extern char D_L07_00208560[]; extern void FUN_L02_002a40d0(void *, float); -void FUN_L07_0030d440(unsigned char *moby) { +void ocean_umbris_update(unsigned char *moby) __asm__("FUN_L07_0030d440"); +void ocean_umbris_update(unsigned char *moby) { switch (moby[0x20]) { case 0: FUN_L02_002a40d0(D_L07_00208560, 0.66666669f); @@ -128,23 +130,23 @@ void FUN_L07_0030d440(unsigned char *moby) { /* Slows and steers a moby toward another when it is below and close in height. */ /* Ported from rac1-decomp (src/overlays/l07_umbris/vendor_002CE470.c: func_L07_0030F4C0), where it is exact; names translated to the US level program. */ -extern float FUN_001f9b80(void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); -extern void FUN_L00_00259bc8(char *m, float t, int a, int b, void *pos, void *vel); +extern void spawn_nearby_effect(char *m, float t, int a, int b, void *pos, void *vel) __asm__("FUN_L00_00259bc8"); float absolute_float(float input) __asm__("func_001F99C0"); void FUN_L07_0030e0e0(char *a, char *b, char *c) { float v[4]; float w[4]; if (*(float *)(a + 0x18) < *(float *)(b + 0x18) + *(float *)(c + 0x10) * 0.3f) { - float d = FUN_001f9b80(b + 0x10, a + 0x10); + float d = vector_distance(b + 0x10, a + 0x10); if (absolute_float(d - *(float *)(c + 8)) < 0.3f) { - FUN_001f9a28(v, a + 0x10, b + 0x10); + fast_vec_sub(v, a + 0x10, b + 0x10); fast_vec_normalize(w, v, *(float *)(c + 8) - 0.05f); fast_vec_normalize(v, v, 1.0f); v[2] = 1.0f; - FUN_L00_00259bc8(a, *(float *)(c + 0x1c), (int)b, 0x10001, w, v); + spawn_nearby_effect(a, *(float *)(c + 0x1c), (int)b, 0x10001, w, v); } } } @@ -276,8 +278,8 @@ void FUN_L07_0030f0f8(char *a, char *b, float f12, float f13, float f14) { } /* Ported from rac1-decomp (src/overlays/l07_umbris/vendor_002CE470.c: func_L07_003105C0), where it is exact; names translated to the US level program. */ -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); int FUN_L07_0030f1e0(char *moby, char *obj, float a, float lo, float up, float hi, float down, @@ -296,8 +298,8 @@ int FUN_L07_0030f1e0(char *moby, char *obj, float a, float lo, float up, float h } else if (speed < vmin) { speed = vmin; } - *(float *)(obj + 0xD0) = FUN_001f9dc8(*(float *)(moby + 0x48)) * speed; - *(float *)(obj + 0xD4) = FUN_001f9de0(*(float *)(moby + 0x48)) * speed; + *(float *)(obj + 0xD0) = fast_cos(*(float *)(moby + 0x48)) * speed; + *(float *)(obj + 0xD4) = fast_sin(*(float *)(moby + 0x48)) * speed; return r; } extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); @@ -332,7 +334,7 @@ void FUN_L07_003120d8(char *moby) { extern char D_L07_00180340[]; extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern void FUN_L00_0023e838(int); @@ -341,7 +343,7 @@ void FUN_L07_00312150(char *a) { float f; int c; float *p; - if (FUN_001f9770(a + 0x284)) { + if (fast_dec_timer_s16(a + 0x284)) { if (*(short *)(a + 0x280) != -1) { FUN_L00_0023e838(*(short *)(a + 0x280)); *(short *)(a + 0x280) = -1; @@ -367,7 +369,7 @@ void FUN_L07_00312150(char *a) { /* steps a hit-effect emitter: orient, spawn a puff, and reseed the timer */ /* Ported from rac1-decomp (src/overlays/l07_umbris/vendor_002CE470.c: func_L07_00313690), where it is exact; names translated to the US level program. */ -extern int FUN_001f9740(int *counter); +extern int fast_dec_timer(int *counter) __asm__("FUN_001f9740"); extern int FUN_0022da68(int, int, int); extern int FUN_L07_0030e370_c() __asm__("FUN_L07_0030e370"); extern void FUN_L00_001ff600(float, void *, void *); @@ -377,9 +379,9 @@ int FUN_L07_003122b0(void *mp, char *obj, float *vec) { unsigned char *moby = mp; float A[4]; float B[4]; - if (FUN_001f9740((int *)(obj + 0x160))) { + if (fast_dec_timer((int *)(obj + 0x160))) { moby_point_position(moby, *(int *)(obj + 0x164) & 1, A); - FUN_001f9a28(B, vec, A); + fast_vec_sub(B, vec, A); FUN_L00_001ff600(10.7f, B, B); B[2] += 0.5f; if (B[2] > 0.0f) @@ -387,11 +389,11 @@ int FUN_L07_003122b0(void *mp, char *obj, float *vec) { fast_vec_normalize(B, B, frame_time * 9.0f); FUN_L07_0030e370_c(A, B, moby); FUN_0022da68(0, 0, (int)moby); - FUN_L07_00311eb8_u(10.0f, moby, obj, 0, A, FUN_001f96f8(0x1E), 0x800060FF, 0); - *(int *)(obj + 0x160) = FUN_001f96f8(9); + FUN_L07_00311eb8_u(10.0f, moby, obj, 0, A, scale_game_frames(0x1E), 0x800060FF, 0); + *(int *)(obj + 0x160) = scale_game_frames(9); if (++*(int *)(obj + 0x164) >= 0x15) { - *(short *)(obj + 0x198) = FUN_001f96f8(0x23); - *(int *)(obj + 0x160) = FUN_001f96f8(0x1E); + *(short *)(obj + 0x198) = scale_game_frames(0x23); + *(int *)(obj + 0x160) = scale_game_frames(0x1E); return 1; } } @@ -403,13 +405,13 @@ int FUN_L07_003122b0(void *mp, char *obj, float *vec) { /* Moves a moby along a path, easing between nodes and tracking the hero. */ extern char *D_L07_001B0530[]; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L01_00277fb8(void *); extern int allocate_voice_for_target_entry(int, int, void *) __asm__("func_0022DA68"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern int hero_set_state(int, int) __asm__("FUN_L00_002223f8"); extern void FUN_L00_00227638(void); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); extern void scale_vector_xyz(void *out, void *a, f32 s) __asm__("FUN_001f9a68"); @@ -428,7 +430,7 @@ void FUN_L07_002cd2b0(unsigned char *moby) { } path = D_L07_001B0530[*(int *)(data + 0xB4)]; qcopy(orig, moby + 0x10); - FUN_001f9770(data + 0xBA); + fast_dec_timer_s16(data + 0xBA); if (moby[0x20] == 0) { float f; char *pts; @@ -481,7 +483,7 @@ void FUN_L07_002cd2b0(unsigned char *moby) { case 2: if (*(short *)(data + 0xBA) != 0 || (F(data, 0xBC) < 0.0f && - FUN_001f9b80((moby + 0x10), &hero.motion.pos) < 2.0f && + vector_distance((moby + 0x10), &hero.motion.pos) < 2.0f && absolute_float(hero.motion.pos.f[2] - F(moby, 0x18)) < 4.0f && F(moby, 0x18) - hero.motion.pos.f[2] > 1.0f)) { int r; @@ -501,7 +503,7 @@ void FUN_L07_002cd2b0(unsigned char *moby) { int i; float f20, t; char *q; - if (!FUN_L00_0028d8c0(moby, *(int *)(data + 0xC4))) { + if (!voice_is_playing(moby, *(int *)(data + 0xC4))) { *(int *)(data + 0xC4) = allocate_voice_for_target_entry(0, 4, (int)moby); } F(data, 0xA8) += F(data, 0xAC) * frame_time; @@ -551,9 +553,9 @@ void FUN_L07_002cd2b0(unsigned char *moby) { break; } subtract_vector_xyz(delta, (moby + 0x10), orig); - FUN_L00_00260738(data + 0x60, delta, moby + 0x40, moby + 0x40); + update_entity_matrix(data + 0x60, delta, moby + 0x40, moby + 0x40); if (!FUN_L01_00277fb8(moby)) { - if (2.0f < FUN_001f9b80((moby + 0x10), &hero.motion.pos)) { + if (2.0f < vector_distance((moby + 0x10), &hero.motion.pos)) { if (*(short *)(data + 0xBA) == 0) { *(short *)(data + 0xB8) = 1; } @@ -563,14 +565,14 @@ void FUN_L07_002cd2b0(unsigned char *moby) { /* Moves a moby along a path between its two ends, hidden while its gate byte is set. */ extern char *D_L07_001B0530[]; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L01_00277fb8(void *); extern int allocate_voice_for_target_entry(int, int, void *) __asm__("func_0022DA68"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern unsigned char D_L07_0015FC88[] __attribute__((section(".sdata"))); extern int hero_set_state(int, int) __asm__("FUN_L00_002223f8"); extern void FUN_L00_00227638(void); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); extern void scale_vector_xyz(void *out, void *a, f32 s) __asm__("FUN_001f9a68"); float absolute_float(float input) __asm__("func_001F99C0"); @@ -590,7 +592,7 @@ void FUN_L07_002cdb28(struct Moby *moby) { } path = D_L07_001B0530[*(int *)(data + 0xB4)]; qcopy(orig, &moby->pos); - FUN_001f9770(data + 0xBA); + fast_dec_timer_s16(data + 0xBA); if (moby->state == 0) { float f; char *pts; @@ -645,7 +647,7 @@ void FUN_L07_002cdb28(struct Moby *moby) { case 2: if (*(short *)(data + 0xBA) != 0 || (*(float *)(data + 0xBC) < 0.0f && - FUN_001f9b80(&moby->pos, &hero.motion.pos) < 2.0f && + vector_distance(&moby->pos, &hero.motion.pos) < 2.0f && absolute_float(hero.motion.pos.f[2] - moby->pos.z) < 4.0f && moby->pos.z - hero.motion.pos.f[2] > 1.0f)) { int r; @@ -665,7 +667,7 @@ void FUN_L07_002cdb28(struct Moby *moby) { int i; float f20, t; char *q; - if (!FUN_L00_0028d8c0(moby, *(int *)(data + 0xC4))) { + if (!voice_is_playing(moby, *(int *)(data + 0xC4))) { *(int *)(data + 0xC4) = allocate_voice_for_target_entry(0, 4, (int)moby); } *(float *)(data + 0xA8) += *(float *)(data + 0xAC) * frame_time; @@ -720,9 +722,9 @@ void FUN_L07_002cdb28(struct Moby *moby) { break; } subtract_vector_xyz(delta, &moby->pos, orig); - FUN_L00_00260738(data + 0x60, delta, &moby->rot, &moby->rot); + update_entity_matrix(data + 0x60, delta, &moby->rot, &moby->rot); if (!FUN_L01_00277fb8(moby)) { - if (2.0f < FUN_001f9b80(&moby->pos, &hero.motion.pos)) { + if (2.0f < vector_distance(&moby->pos, &hero.motion.pos)) { if (*(short *)(data + 0xBA) == 0) { *(short *)(data + 0xB8) = 1; } @@ -759,7 +761,7 @@ extern void delete_moby_m(void *) __asm__("FUN_0020c828"); extern void start_scene(int) __asm__("FUN_L00_00298840"); extern int is_point_inside_clip_volume_i(void *, int) __asm__("FUN_00214720"); extern void FUN_L00_00216f90(void *, void *, int, int); -extern void FUN_L01_0027a248(int, int); +extern void jet_game_state(int, int) __asm__("FUN_L01_0027a248"); extern void FUN_L00_00299460(int); extern void clamp_vector_length(void *, void *, float) __asm__("FUN_001f9c90"); extern void FUN_L07_00270248(int x, int y, int w, int h); @@ -845,7 +847,7 @@ void FUN_L07_002f5ba0(struct Moby *moby) struct Moby *e = &level_mobys[data->moby_14]; e->flags &= 0xFFBE; } - FUN_L01_0027a248(2, 4); + jet_game_state(2, 4); moby->state = 8; break; case 8: @@ -937,7 +939,7 @@ struct AnimTimer { extern void update_moby_grids(struct Moby *, u32) __asm__("FUN_0020dc20"); extern void FUN_L00_0025d1b8(struct Moby *); -extern struct AnimTimer *FUN_002141f8(struct Moby *); +extern struct AnimTimer *suck_get_aim_height(struct Moby *) __asm__("FUN_002141f8"); /* resets a spawned moby from its class defaults and restarts its animation */ void FUN_L07_0030af40(struct Moby *m) { @@ -960,7 +962,7 @@ void FUN_L07_0030af40(struct Moby *m) { m->collision = ((struct SpawnClassView *)m->pclass)->unk10; FUN_L00_0025d1b8(m); FUN_L00_00250df8(m); - t = FUN_002141f8(m); + t = suck_get_aim_height(m); if (t != 0) t->frames = t->length; } @@ -978,16 +980,17 @@ extern s32 FUN_L00_002591d0(s32 *, s32, s32, s32); extern s32 FUN_L00_002592b8(s32 *, s32, s32, s32); extern void debug_print(char *, ...) __asm__("FUN_001e93b0"); extern s32 FUN_L01_0028b510(f32, void *, void *); -extern void FUN_L00_0025d458(void *, short *); -extern void FUN_L00_0025d538(struct Moby *, void *); -extern int FUN_L00_0025d808(f32, void *, void *, void *, void *, s32); -extern void FUN_001f9a28(void *, void *, void *); -extern void FUN_L00_00259fe8(struct Moby *, f32); +extern void trooper_anim_update(void *, short *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(struct Moby *, void *) __asm__("FUN_L00_0025d538"); +extern int sample_path(f32, void *, void *, void *, void *, s32) __asm__("FUN_L00_0025d808"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); +extern void jet_animate(struct Moby *, f32) __asm__("FUN_L00_00259fe8"); extern char D_L07_00211550[] __asm__("D_L07_00211550"); extern char D_L07_00211580[] __asm__("D_L07_00211580"); extern char D_L07_002115D0[] __asm__("D_L07_002115D0"); -void FUN_L07_0030b000(struct Moby *moby) { +void boltcrate_possibly_for_metal_detector_update(struct Moby *moby) __asm__("FUN_L07_0030b000"); +void boltcrate_possibly_for_metal_detector_update(struct Moby *moby) { char *data; char *path; f32 *remaining; @@ -1037,12 +1040,12 @@ void FUN_L07_0030b000(struct Moby *moby) { } *remaining -= step; *(u8 *)(data + 0x67) = 0xfa; - *(s16 *)(data + 0x26) = FUN_001f96f8(0x3c); - FUN_L00_0025d458(moby, (short *)(data + 0x60)); + *(s16 *)(data + 0x26) = scale_game_frames(0x3c); + trooper_anim_update(moby, (short *)(data + 0x60)); } moby->hit_slot = 0xff; } - FUN_L00_0025d538(moby, data + 0x60); + trooper_anim_finish(moby, data + 0x60); if (*(s32 *)(data + 0x70) == -1) return; path = D_L07_001B0530[*(s32 *)(data + 0x70)]; switch (moby->state) { @@ -1089,7 +1092,7 @@ void FUN_L07_0030b000(struct Moby *moby) { *(s32 *)(data + 0x78) = updated; break; } - FUN_L00_0025d808(*(f32 *)(data + 0x80), path, &position, &first, &next, 1); + sample_path(*(f32 *)(data + 0x80), path, &position, &first, &next, 1); i++; } while (i < *(s32 *)(data + 0x78)); if (!*(u8 *)(data + 0x94)) { @@ -1113,17 +1116,17 @@ void FUN_L07_0030b000(struct Moby *moby) { path + 0x10 + *(s32 *)(child + 0x90) * 16); f32 step = *(f32 *)(data + 0x7c) * frame_time; distance = segment_distance; - FUN_L00_0025d808(step, path, + sample_path(step, path, (char *)child + 0x80, (char *)child + 0x90, &distance, 1); } *(s32 *)(child + 0x94) = *(s32 *)(child + 0x90) + 1; if (cursor == 0 || *(u8 *)(cursor + 0x20) == 0xfe || *(u8 *)(cursor + 0x20) == 0xfd) { if (*(s32 *)(data + 0x84) != -1) { - FUN_001f9a28((char *)child + 0x60, (char *)child + 0x80, + fast_vec_sub((char *)child + 0x60, (char *)child + 0x80, (char *)cursor + 0x10); qcopy((void *)(cursor + 0x10), (void *)(child + 0x80)); - if (FUN_001f9740((int *)(child + 0x98)) && + if (fast_dec_timer((int *)(child + 0x98)) && *(s32 *)(child + 0x90) == *(s32 *)(data + 0x90)) FUN_L07_0030af40((struct Moby *)cursor); } @@ -1134,7 +1137,7 @@ void FUN_L07_0030b000(struct Moby *moby) { break; } } - FUN_L00_00259fe8(moby, 1.5f); + jet_animate(moby, 1.5f); } #endif #include "qcopy.h" @@ -1370,8 +1373,8 @@ extern int D_L07_00161B30 __attribute__((sda)); /* no foreign declaration */ extern unsigned short D_L07_00161B34 __attribute__((sda)); /* no foreign declaration */ extern int D_L07_00161B38 __attribute__((sda)); /* no foreign declaration */ extern int D_L07_00204700[][4]; -extern int FUN_L00_002a3ec8(); -extern int FUN_L01_002b7a48(); +extern int pool_splash() __asm__("FUN_L00_002a3ec8"); +extern int pool_init_tiles() __asm__("FUN_L01_002b7a48"); extern int is_point_inside_clip_volume_c(void *arg0, int arg1) __asm__("func_00214720"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern int fast_dec_timer(int *arg0) __asm__("FUN_001f9740"); @@ -1384,10 +1387,10 @@ int FUN_L07_00281ef8(int id); void FUN_L01_0026e090(int i, int v); void FUN_L01_0026e0e0(int list, int state); void FUN_L01_00275690(char *vec, float scale); -void FUN_L01_002b7c68(float *in, int *out); -void FUN_L01_002b7ef0(float s); -void FUN_L01_002b7fe0(char *p, int n); -void FUN_L01_002b8288(void *a, int b); +void pool_bind_tile(float *in, int *out) __asm__("FUN_L01_002b7c68"); +void pool_set_scale(float s) __asm__("FUN_L01_002b7ef0"); +void pool_flush(char *p, int n) __asm__("FUN_L01_002b7fe0"); +void pool_ripple(void *a, int b) __asm__("FUN_L01_002b8288"); void FUN_L07_0030cd20(void); void FUN_L07_0030cd48_c(int arg) __asm__("FUN_L07_0030cd48"); extern Rec_30D8E8 D_L07_001DCE40_2cd2b0[] __asm__("D_L07_001DCE40"); @@ -1406,7 +1409,8 @@ extern int FUN_L01_00275690_2cd2b0(void *, float) __asm__("FUN_L01_00275690"); extern void FUN_L01_002b7fe0_2cd2b0(void *, int) __asm__("FUN_L01_002b7fe0"); extern void FUN_L07_0030cd20_2cd2b0(void) __asm__("FUN_L07_0030cd20"); -void FUN_L07_0030c508(Moby_30D8E8 *m) { +void water_update(Moby_30D8E8 *m) __asm__("FUN_L07_0030c508"); +void water_update(Moby_30D8E8 *m) { Data_30D8E8 *d = m->data; int i; int j; @@ -1808,10 +1812,10 @@ extern void FUN_L00_001fff28(void *, int, float); extern void FUN_L00_0024f7c8(void *, int, void *); extern void FUN_L00_00257470(void *, int, int); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025d458(void *, short *); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *, short *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern void FUN_L00_0025e450_c(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); -extern void FUN_L07_002886d8(void *, void *, float); +extern void get_target_sight(void *, void *, float) __asm__("FUN_L07_002886d8"); extern void clear_u64_value(void *) __asm__("func_001F99F8"); extern void euler_rotation_matrix(float *, float *) __asm__("FUN_001fa050"); extern void fast_vec_normalize_c(void *, void *, f32) __asm__("FUN_001f9bf8"); @@ -1819,7 +1823,8 @@ extern void mark_moby_for_removal_c3(void *) __asm__("func_0020C828"); extern void transform_vector(void *, void *, void *) __asm__("func_001F9D20"); void attach_manipulator(void *owner, s32 slot_index, void *manip) __asm__("FUN_0020cb10"); -void FUN_L07_0030d4d8(char *m) { +void bombomatic_update(char *m) __asm__("FUN_L07_0030d4d8"); +void bombomatic_update(char *m) { char *d; char *s16; char *t; @@ -1912,12 +1917,12 @@ void FUN_L07_0030d4d8(char *m) { *(float *)t = tv; *(unsigned char *)(d + 0x67) = 0xFA; *(short *)(d + 0x26) = scale_game_frames(60); - FUN_L00_0025d458(m, (short *)(d + 0x60)); + trooper_anim_update(m, (short *)(d + 0x60)); } eb20: ((unsigned char *)m)[0xA4] = 0xFF; - FUN_L00_0025d538(m, d + 0x60); - FUN_L07_002886d8(m, v30, 20.0f); + trooper_anim_finish(m, d + 0x60); + get_target_sight(m, v30, 20.0f); switch (((unsigned char *)m)[0x20]) { case 0: { int r1 = scale_game_frames(*(int *)(d + 0xB0)); @@ -1946,7 +1951,7 @@ void FUN_L07_0030d4d8(char *m) { } case 2: { int i; - if (FUN_001f9770(d + 0xB8) != 0) { + if (fast_dec_timer_s16(d + 0xB8) != 0) { *(short *)(d + 0xB8) = scale_game_frames(7); if (((unsigned char *)m)[0x31] == 0) { if (!(vector_distance_xy_alt(m + 0x10, D_L07_00166E40) < 90.0f && (*(int *)(d + 0xC4) & 1) != 0)) { @@ -2035,7 +2040,7 @@ unsigned char *FUN_L07_0030dbb0(int a, void *pos, int b, float f0, float f1, flo *(unsigned short *)(moby + 0x34) |= 0x200; g = D_L07_00166E40; h = g - 0x140; - *(float *)(h + 0x160) = 0.3f - FUN_001f9b80(moby + 0x10, g) / 100.0f; + *(float *)(h + 0x160) = 0.3f - vector_distance(moby + 0x10, g) / 100.0f; *(int *)(h + 0x168) = scale_game_frames(0x14); FUN_L00_00250df8(moby); FUN_0022da68(0, 0, (int)moby); @@ -2048,7 +2053,7 @@ typedef u32 u128_0F0D0 __attribute__((mode(TI), aligned(16))); typedef struct { char b[0x90]; } __attribute__((aligned(16))) Pkt_0F0D0; -extern float FUN_L00_00200228(void *, float); +extern float split_float_fraction(void *, float) __asm__("FUN_L00_00200228"); extern int D_L07_0015F5CC; extern s64 get_effect_texture(s32) __asm__("func_001F44B8"); extern void fast_draw_quad_real(void *, int, int) __asm__("func_001F7D30"); @@ -2084,7 +2089,7 @@ void FUN_L07_0030dcf0(unsigned char *moby) { radius = *(float *)(data + 8) - band * radius_threshold; side = (1.0f - band * 0.5f) * *(float *)(data + 0x10); ft = convert_integer_to_float(D_L07_0015F5CC); - phase = FUN_L00_00200228(phase_work, ft / (band * 40.0f + 40.0f)); + phase = split_float_fraction(phase_work, ft / (band * 40.0f + 40.0f)); if ((index & 1) == 0) phase = -phase; *(float *)(packet + 0x50) = phase; @@ -2152,7 +2157,7 @@ void FUN_L07_0030dcf0(unsigned char *moby) { extern int D_L07_0015F5CC; extern int D_L07_00173ED8; extern int FUN_001efa68(void *, void *, int, int, int); -extern int FUN_L00_001f0d60(float, void *, int, void *); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern int FUN_L00_0025e450(); extern void FUN_L07_0029b8d8(char *, int, float, float); extern int allocate_voice_for_target_entry(int, int, void *) __asm__("func_0022DA68"); @@ -2203,7 +2208,7 @@ void FUN_L07_0030e458(struct Moby *m) { } #include "rnc/gameplay/entities/moby.h" -/* Knockback/launch parameters handed to FUN_L00_0025c558. */ +/* Knockback/launch parameters handed to trooper_start_knockback. */ typedef struct { u8 pad0[0x10]; f32 gravity; @@ -2226,8 +2231,8 @@ typedef struct { f32 unk54; } LaunchParams; -extern void FUN_L00_0025ab48(Vec4f *, f32 *, f32 *, f32 *); -extern void FUN_L00_0025c558(f32, struct Moby *, LaunchParams *, s32, s32, s32); +extern void trooper_knockback_arc(Vec4f *, f32 *, f32 *, f32 *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(f32, struct Moby *, LaunchParams *, s32, s32, s32) __asm__("FUN_L00_0025c558"); void FUN_L07_0030e720(struct Moby *moby, LaunchParams *l, Vec4f *dir) { Vec4f d; @@ -2249,8 +2254,8 @@ void FUN_L07_0030e720(struct Moby *moby, LaunchParams *l, Vec4f *dir) { l->unk54 = 9.0f; l->unk3D = 0; *(u128 *)&d = *(u128 *)dir; - FUN_L00_0025ab48(&d, &ang, &l->unk18, &l->unk1C); - FUN_L00_0025c558(ang, moby, l, 12, 1, 0); + trooper_knockback_arc(&d, &ang, &l->unk18, &l->unk1C); + trooper_start_knockback(ang, moby, l, 12, 1, 0); } void FUN_L07_0030e858(struct Moby *moby, LaunchParams *l, Vec4f *dir) { @@ -2273,8 +2278,8 @@ void FUN_L07_0030e858(struct Moby *moby, LaunchParams *l, Vec4f *dir) { l->unk54 = 19.0f; l->unk3D = 0; *(u128 *)&d = *(u128 *)dir; - FUN_L00_0025ab48(&d, &ang, &l->unk18, &l->unk1C); - FUN_L00_0025c558(ang, moby, l, 6, 1, 0); + trooper_knockback_arc(&d, &ang, &l->unk18, &l->unk1C); + trooper_start_knockback(ang, moby, l, 6, 1, 0); } #define NOT_SDA @@ -2288,7 +2293,7 @@ extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern int hit_reaction(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_L00_0025a478"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern void FUN_L00_00257470(void *, int, int); -extern void FUN_L00_0025d458(void *, short *); +extern void trooper_anim_update(void *, short *) __asm__("FUN_L00_0025d458"); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); void FUN_L07_0030e998(char *m, char *x, float *hp) { @@ -2333,13 +2338,13 @@ void FUN_L07_0030e998(char *m, char *x, float *hp) { FUN_L07_0030e720(m, x + 0x70, info + 0x10); FUN_L00_00257470(m, 0, -1); x[0x67] = 0x78; - FUN_L00_0025d458(m, (short *)(x + 0x60)); + trooper_anim_update(m, (short *)(x + 0x60)); m[0x20] = 0xE; } else { *hp -= *(float *)(info + 0x2C); ((unsigned char *)x)[0x67] = 0xFA; *(short *)(x + 0x26) = scale_game_frames(0x3C); - FUN_L00_0025d458(m, (short *)(x + 0x60)); + trooper_anim_update(m, (short *)(x + 0x60)); } } } @@ -2432,14 +2437,14 @@ struct WalkerData { f32 turnStep; /* 0x140 */ }; -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float FUN_001f99c0(float); -extern float FUN_001fa580(float, float); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern int point_in_path_xy(void *, void *, int) __asm__("FUN_L00_00259740"); extern int line_blocked_30eee8(void *, void *, int, struct Moby *, int) __asm__("FUN_001efa68"); -extern int FUN_L00_001f0d60(float, void *, int, void *); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); void FUN_L07_0030eee8(struct Moby *moby, struct WalkerData *data) { float probe[4]; @@ -2452,25 +2457,25 @@ void FUN_L07_0030eee8(struct Moby *moby, struct WalkerData *data) { return; } { - probe[0] = FUN_001f9dc8(moby->rot.z) * 5.2f; - probe[1] = FUN_001f9de0(moby->rot.z) * 5.2f; + probe[0] = fast_cos(moby->rot.z) * 5.2f; + probe[1] = fast_sin(moby->rot.z) * 5.2f; *(s32 *)&probe[2] = 0; add_vector_xyz(probe, probe, &moby->pos); if (point_in_path_xy(probe, data->path->pts, data->path->count) && !line_blocked_30eee8(&moby->pos, probe, 0x24, moby, 0) && - !FUN_L00_001f0d60(1.5f, probe, 0x24, moby)) + !coll_sphere(1.5f, probe, 0x24, moby)) return; step = FUN_001f99c0(data->turnStep); angle = moby->rot.z; for (swept = 0.0f; swept < 6.2831855f; swept += step) { - angle = FUN_001fa580(angle, data->turnStep); - probe[0] = FUN_001f9dc8(angle) * 5.2f; - probe[1] = FUN_001f9de0(angle) * 5.2f; + angle = fast_add_rotations(angle, data->turnStep); + probe[0] = fast_cos(angle) * 5.2f; + probe[1] = fast_sin(angle) * 5.2f; *(s32 *)&probe[2] = 0; add_vector_xyz(probe, probe, &moby->pos); if (point_in_path_xy(probe, data->path->pts, data->path->count) && !line_blocked_30eee8(&moby->pos, probe, 0x24, moby, 0) && - !FUN_L00_001f0d60(1.5f, probe, 0x24, moby)) { + !coll_sphere(1.5f, probe, 0x24, moby)) { data->heading = angle; return; } @@ -2577,9 +2582,9 @@ extern float resolve_camera_surface_height(void *, int) __asm__("func_002135F0") extern int D_L07_0015F5CC; extern int D_L07_001612D8; extern int DebugPrint_alt() __asm__("FUN_001e93b0"); -extern int FUN_001f0b58(void); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern int FUN_L00_00259740(void *, void *, int); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int FUN_L07_0030ebc8_c(char *moby, char *data) __asm__("FUN_L07_0030ebc8"); extern int is_point_inside_clip_volume_c2(void *arg0, int arg1) __asm__("func_00214720"); extern int tick_countdown_32_alt(int *arg0) __asm__("FUN_001f9740"); @@ -2614,7 +2619,8 @@ extern void func_L00_002A5158_30D8E8(void *, int, int, float, float, float, floa #define func_L00_002592B0_t(m,a,v,k,d,x) ((void (*)(char *, float, float *, float, float, float))FUN_L00_00258278)(m,a,v,k,d,x) -void FUN_L07_0030f5f0(unsigned char *moby) { +void sharkigator_update(unsigned char *moby) __asm__("FUN_L07_0030f5f0"); +void sharkigator_update(unsigned char *moby) { char *data; struct WalkerTarget target; float point[4]; @@ -2646,9 +2652,9 @@ void FUN_L07_0030f5f0(unsigned char *moby) { } goto end; } - FUN_L07_002886d8(moby, &target, 30.0f); + get_target_sight(moby, &target, 30.0f); FUN_L07_0030e998_c((char *)moby, data, (float *)(data + 0x20)); - FUN_L00_0025d538(moby, data + 0x60); + trooper_anim_finish(moby, data + 0x60); wander = tick_countdown_32_alt((int *)(data + 0x134)) != 0; if (*(int *)(data + 0x110) != 0 && moby[0x20] >= 7) { char *path = *(char **)(data + 0x148); @@ -2687,7 +2693,7 @@ void FUN_L07_0030f5f0(unsigned char *moby) { next_sequence = ((struct { unsigned char t[3][3]; } *)D_L07_00161B50_gp)->t[old_command][command]; } FUN_L00_0024f7c8(moby, 0, point); - if (FUN_L00_001f0d60(0.8f, point, 1, moby) != 0 && FUN_001f0b58() == 0) { + if (coll_sphere(0.8f, point, 1, moby) != 0 && collision_hit_material() == 0) { float height; float scale; height = **(float **)(data + 0x12C); @@ -3044,7 +3050,7 @@ void FUN_L07_0030f5f0(unsigned char *moby) { } goto end; case 12: - if (FUN_L00_0025c698(moby, data + 0x70) & 1) { + if (mine_fall(moby, data + 0x70) & 1) { ((void (*)(char *, char *))FUN_L07_0030ec58_c)((char *)moby, data); } goto end; @@ -3054,7 +3060,7 @@ void FUN_L07_0030f5f0(unsigned char *moby) { } goto end; case 14: - if (FUN_L00_0025c698(moby, data + 0x70) & (moby[0x70] & 2)) { + if (mine_fall(moby, data + 0x70) & (moby[0x70] & 2)) { FUN_L00_0025e450_c2(moby, data + 0xD0, 0, 0.0f, 0.0f, 3, 3, 5, 2.0f, 1.0f, 4.0f, 1.0f, -1, 7.0f, 0, 1, -1, 0); mark_moby_for_removal_c4(moby); @@ -3096,10 +3102,10 @@ void FUN_L07_0030f5f0(unsigned char *moby) { } } extern int rand(void) __asm__("FUN_001160d8"); -extern int FUN_001f96f8(int); -extern int FUN_001f9740(int *); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); +extern int fast_dec_timer(int *) __asm__("FUN_001f9740"); extern float FUN_L00_0025bc00(float *, float, int, float); -extern float FUN_L00_0025e310(float); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_sin(float) __asm__("FUN_001f9de0"); @@ -3107,7 +3113,7 @@ extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); extern float random_angle_radians(void) __asm__("FUN_00213308"); extern void FUN_L07_00288968(void *, void *, void *, void *, void *); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern float dot_vector_xyz(void *, void *) __asm__("FUN_001f9ab0"); @@ -3181,16 +3187,16 @@ void FUN_L07_003112c8(char *moby) { if (((unsigned char *)data)[0xBE] != 0) FUN_L01_0026e090(((unsigned char *)moby)[0x21], 2); *(float *)(moby + 0x40) = fast_add_rotations(*(float *)(data + 0xA4), - fast_sin(FUN_L00_0025e310(convert_integer_to_float(*(int *)(data + 0xAC)) * 0.75f)) * 0.017453292f); + fast_sin(normalize_angle(convert_integer_to_float(*(int *)(data + 0xAC)) * 0.75f)) * 0.017453292f); *(float *)(moby + 0x44) = fast_add_rotations(*(float *)(data + 0xA8), - fast_cos(FUN_L00_0025e310(convert_integer_to_float(*(int *)(data + 0xAC)) * 0.89f)) * 0.017453292f); + fast_cos(normalize_angle(convert_integer_to_float(*(int *)(data + 0xAC)) * 0.89f)) * 0.017453292f); break; case 2: *(float *)(moby + 0x40) = fast_add_rotations(*(float *)(data + 0xA4), - fast_sin(FUN_L00_0025e310(convert_integer_to_float(*(int *)(data + 0xAC)) * 0.75f)) * 0.017453292f); + fast_sin(normalize_angle(convert_integer_to_float(*(int *)(data + 0xAC)) * 0.75f)) * 0.017453292f); *(float *)(moby + 0x44) = fast_add_rotations(*(float *)(data + 0xA8), - fast_cos(FUN_L00_0025e310(convert_integer_to_float(*(int *)(data + 0xAC)) * 0.89f)) * 0.017453292f); - if (!FUN_001f9740((int *)(data + 0xAC))) break; + fast_cos(normalize_angle(convert_integer_to_float(*(int *)(data + 0xAC)) * 0.89f)) * 0.017453292f); + if (!fast_dec_timer((int *)(data + 0xAC))) break; if (((unsigned char *)data)[0xBE] != 0) { parent_data[0x19D] = data[0xBF]; parent[0x20] = 12; @@ -3236,9 +3242,9 @@ void FUN_L07_003112c8(char *moby) { if (hero.air_frames.s == 0 && (char *)hero.ground_moby == moby) { if (*(int *)(data + 0xAC) == 0) FUN_0022da68(0, 0, (int)moby); - timer = FUN_001f96f8(90); + timer = scale_game_frames(90); if (*(int *)(data + 0xAC) < timer) - *(int *)(data + 0xAC) = FUN_001f96f8(90); + *(int *)(data + 0xAC) = scale_game_frames(90); } if (*(int *)(data + 0xAC) != 0) { if (*(float *)(moby + 0x18) > *(float *)(data + 0xB8) - 2.6f) { @@ -3268,7 +3274,7 @@ void FUN_L07_003112c8(char *moby) { roll = fast_sin(*(float *)(data + 0xC4)) * 0.02f; if (*(int *)(data + 0xAC) != 0) { float forward, side; - FUN_001f9740((int *)(data + 0xAC)); + fast_dec_timer((int *)(data + 0xAC)); subtract_vector_xyz(scratch, &hero.motion.pos, moby + 0x10); forward = dot_vector_xyz(scratch, moby + 0xC0); side = dot_vector_xyz(scratch, moby + 0xD0) * -0.03f; @@ -3289,24 +3295,24 @@ void FUN_L07_003112c8(char *moby) { if (*(float *)(moby + 0x44) < -0.5235988f) *(float *)(moby + 0x44) = -0.5235988f; break; } - if (((unsigned char *)moby)[0x20] == 5 && FUN_001f9740((int *)(data + 0xC8))) { + if (((unsigned char *)moby)[0x20] == 5 && fast_dec_timer((int *)(data + 0xC8))) { float last = *(float *)(data + 0xCC); float height = *(float *)(data + 0xB8); if ((height <= last && *(float *)(moby + 0x18) < height) || (last <= height && height < *(float *)(moby + 0x18))) { FUN_0022da68(0, 0, (int)moby); - *(int *)(data + 0xC8) = rand() % FUN_001f96f8(20) + FUN_001f96f8(20); + *(int *)(data + 0xC8) = rand() % scale_game_frames(20) + scale_game_frames(20); } } *(float *)(data + 0xCC) = *(float *)(moby + 0x18); add_vector_xyz(delta, delta, moby + 0x10); - FUN_L00_00260738(data + 0x60, delta, rotation, moby + 0x40); + update_entity_matrix(data + 0x60, delta, rotation, moby + 0x40); } /* Falling leaf: drops off its branch after a random delay, swaying, then falls faster and vanishes near the ground. */ /* Ported from rac1-decomp (src/overlays/l07_umbris/vendor_002CE470.c: func_L07_00312FA8), where it is exact; names translated to the US level program. */ -extern float FUN_L00_0025e310(float); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); -extern void FUN_L00_002502f0(void *, int, int, int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); s32 allocate_voice_for_target_entry_c(s32 entry_index, s32 flags, void *target) __asm__("FUN_0022da68"); void mark_moby_for_removal_c(void *obj) __asm__("FUN_0020c828"); @@ -3329,7 +3335,7 @@ void FUN_L07_00311bc8(char *m) { *(short *)(d + 0x24) = 0; d[0x28] = 4; *(short *)(d + 0x3E) = 0xD; - FUN_L00_002502f0(m, 0x50, 0x40, 0x10); + set_moby_color(m, 0x50, 0x40, 0x10); *(float *)(m + 0x40) += random_float_between_alt(-0.034906585f, 0.034906585f); *(float *)(m + 0x44) += random_float_between_alt(-0.034906585f, 0.034906585f); *(float *)(m + 0x18) += random_float_between_alt(-0.02f, 0.02f); @@ -3347,16 +3353,16 @@ void FUN_L07_00311bc8(char *m) { break; case 2: *(float *)(m + 0x40) = - fast_sin(FUN_L00_0025e310(convert_integer_to_float(*(short *)(d + 0xA0)) * 0.75f)) * + fast_sin(normalize_angle(convert_integer_to_float(*(short *)(d + 0xA0)) * 0.75f)) * DEG_TO_RAD; { float c = - fast_cos(FUN_L00_0025e310(convert_integer_to_float(*(short *)(d + 0xA0)) * 0.89f)); + fast_cos(normalize_angle(convert_integer_to_float(*(short *)(d + 0xA0)) * 0.89f)); float e = frame_scale; *(float *)(m + 0x44) = c * DEG_TO_RAD; *(float *)(m + 0x18) -= e * 0.002f; } - if (FUN_001f9770(d + 0xA0)) { + if (fast_dec_timer_s16(d + 0xA0)) { *(float *)(d + 0xA4) = frame_scale * 0.002f; m[0x20] = 3; } @@ -3378,7 +3384,7 @@ void FUN_L07_00311bc8(char *m) { break; } subtract_vector_xyz(v, m + 0x10, prev); - FUN_L00_00260738(d + 0x60, v, m + 0x40, m + 0x40); + update_entity_matrix(d + 0x60, v, m + 0x40, m + 0x40); } /* Ported from rac1-decomp (src/overlays/l07_umbris/vendor_002CE470.c: func_L07_00313298), where it is exact; names translated to the US level program. */ @@ -3578,3 +3584,13 @@ void FUN_L07_00312420(struct Moby *arg) qcopy(pkt.d, v10); draw_geometry_quad(&pkt, 0, 1); } + +s32 D_L07_001CA928[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001CA92C[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_001CA930[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_001CA934[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_001CA938[1] __attribute__((section(".data"))) = {0}; + +char D_L07_00211580[] = "Moby 871 short on mines at %d in group %d compared to mine count in pVar %d\n"; + +char D_L07_002117F8[] = "Initialization failed for moby 1059 instance #%d. Deleting.\n"; diff --git a/src/overlays/l07/gameplay/vendor/0031d2e0.c b/src/overlays/l07/gameplay/vendor/0031d2e0.c index 34c31c647b..b2fa288cbf 100644 --- a/src/overlays/l07/gameplay/vendor/0031d2e0.c +++ b/src/overlays/l07/gameplay/vendor/0031d2e0.c @@ -153,7 +153,7 @@ extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern s32 random_integer_below(s32) __asm__("func_00213260"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void FUN_L00_002637f8(int); +extern void cutscene_set_camera_target(int) __asm__("FUN_L00_002637f8"); unsigned char *FUN_L00_0026d000(void *pos, int n, void *vel, int color, float r, float lo, float hi, float size); extern char *func_L00_0026DEA0_c(void *, int, void *, int, float, float, float, @@ -183,7 +183,7 @@ void FUN_L07_0031eba8(char *m) { t = *(int *)(S + 0x30) - 3; if ((unsigned)t < 2) { int idx = (unsigned)t > 1 ? 0 : 2; - FUN_L00_002637f8(((L07SparkState *)S)->arr[idx]); + cutscene_set_camera_target(((L07SparkState *)S)->arr[idx]); } if (*(int *)(S + 0x30) != a) return; @@ -224,7 +224,7 @@ void FUN_L07_0031eba8(char *m) { extern char D_L07_0016C8E0[]; extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void FUN_L00_00263b70(void *, void *, void *, float, float); +extern void draw_trail(void *, void *, void *, float, float) __asm__("FUN_L00_00263b70"); extern void normalize_vector_xyz(void *out, void *a, f32 len) __asm__("FUN_001f9bf8"); extern void subtract_vector_xyz(void *out, void *a, void *b) __asm__("FUN_001f9a28"); @@ -254,22 +254,26 @@ void FUN_L07_0031f900(unsigned char *moby) { moby_point_position(o, 3, b0); subtract_vector_xyz(c0, a0, b0); normalize_vector_xyz(c0, c0, *(float *)&D_L07_00161CD8); - FUN_L00_00263b70(a0, a0, c0, *(float *)&D_L07_00161CDC, + draw_trail(a0, a0, c0, *(float *)&D_L07_00161CDC, *(float *)&D_L07_00161CE0); moby_point_position(o, 1, a1); moby_point_position(o, 4, b1); subtract_vector_xyz(c1, a1, b1); normalize_vector_xyz(c1, c1, *(float *)&D_L07_00161CD8); - FUN_L00_00263b70(a1, a1, c1, *(float *)&D_L07_00161CDC, + draw_trail(a1, a1, c1, *(float *)&D_L07_00161CDC, *(float *)&D_L07_00161CE0); moby_point_position(o, 2, a2); moby_point_position(o, 5, b2); subtract_vector_xyz(c2, a2, b2); normalize_vector_xyz(c2, c2, *(float *)&D_L07_00161CD8); - FUN_L00_00263b70(a2, a2, c2, *(float *)&D_L07_00161CDC, + draw_trail(a2, a2, c2, *(float *)&D_L07_00161CDC, *(float *)&D_L07_00161CE0); } } break; } } + +char D_L07_00211B30[] = "ERRORS, killing moby %d \n"; + +char D_L07_00211B78[] = " spawn %d of %d at %3.3f,%3.3f,%3.3f dist:%f \n"; diff --git a/src/overlays/l07/gameplay/vendor/0031f3d8.c b/src/overlays/l07/gameplay/vendor/0031f3d8.c index 3048fd64d1..14836b5ba1 100644 --- a/src/overlays/l07/gameplay/vendor/0031f3d8.c +++ b/src/overlays/l07/gameplay/vendor/0031f3d8.c @@ -37,7 +37,8 @@ void mark_moby_for_removal_c(struct Obj *obj) __asm__("FUN_0020c828"); extern char *mk_a(int) __asm__("FUN_0020c4f8"); extern void upd_a(void *) __asm__("FUN_L00_00250df8"); -void FUN_L07_0031f3d8(char *self) { +void mushroom_update(char *self) __asm__("FUN_L07_0031f3d8"); +void mushroom_update(char *self) { int flag = 0; char *o = find_moby_hit(self, 0x10000, 0); switch (((unsigned char *)self)[0x20]) { @@ -80,7 +81,8 @@ void FUN_L07_0031f3d8(char *self) { void mark_moby_for_removal_c_c(struct Obj *obj) __asm__("FUN_0020c828"); -void FUN_L07_0031f5b0(char *self) { +void robot_head_update(char *self) __asm__("FUN_L07_0031f5b0"); +void robot_head_update(char *self) { int flag = 0; char *o = find_moby_hit(self, 0x10000, 0); switch (((unsigned char *)self)[0x20]) { @@ -124,7 +126,8 @@ extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68" void mark_moby_for_removal_c_c2(struct Obj *obj) __asm__("FUN_0020c828"); -void FUN_L07_0031f780(unsigned char *m) { +void seashell_update(unsigned char *m) __asm__("FUN_L07_0031f780"); +void seashell_update(unsigned char *m) { int flag = 0; float z; char *p, *pos, *vel; diff --git a/src/overlays/l07/rendering/view/002886d8.c b/src/overlays/l07/rendering/view/002886d8.c index 944aab0c33..c69ae26842 100644 --- a/src/overlays/l07/rendering/view/002886d8.c +++ b/src/overlays/l07/rendering/view/002886d8.c @@ -12,7 +12,8 @@ extern float FUN_001f9b80_25fcb8(void *, void *) __asm__("FUN_001f9b80"); extern short D_L07_001B08B0[] __attribute__((section(".data"))); extern char *D_L07_001D1600[] __attribute__((section(".data"))); extern struct Hero hero_lui __asm__("D_0013F350") __attribute__((section(".data"))); -int FUN_L07_002886d8(char *a, char *o, float best) { +int get_target_sight(char *a, char *o, float best) __asm__("FUN_L07_002886d8"); +int get_target_sight(char *a, char *o, float best) { struct Hero *g = &hero_lui; char *m; char *p; diff --git a/src/overlays/l07/world/loaders/0026b768.c b/src/overlays/l07/world/loaders/0026b768.c index a270c45471..02fd441ba1 100644 --- a/src/overlays/l07/world/loaders/0026b768.c +++ b/src/overlays/l07/world/loaders/0026b768.c @@ -435,3 +435,5 @@ s32 FUN_L07_0026b768(s32 full, s32 keep) { D_L07_0015F5CC++; return 0; } + +s32 D_L07_00173E9C[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/l08/gameplay/entities/batalia_deserter.c b/src/overlays/l08/gameplay/entities/batalia_deserter.c index 9bb351ea72..54ca7d8a50 100644 --- a/src/overlays/l08/gameplay/entities/batalia_deserter.c +++ b/src/overlays/l08/gameplay/entities/batalia_deserter.c @@ -96,14 +96,14 @@ typedef struct { char pad7C[3]; unsigned char b7F; } WM; -extern void FUN_L01_002783a8(void *, float); +extern void begin_dialogue_camera_transition(void *, float) __asm__("FUN_L01_002783a8"); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern void memcard_save_data(int, int) __asm__("FUN_0020b178"); extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float FUN_001f9e90_cf(float, float) __asm__("FUN_001fa688"); extern float FUN_001fa688_cf(float, float) __asm__("FUN_001f9e90"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); @@ -111,13 +111,13 @@ extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float truncate_float_to_s32_cf(float, float) __asm__("FUN_002132a8"); extern float vector_length_xy(void *); extern float vector_length_xyz_c(void *) __asm__("vector_length_xyz"); -extern int FUN_L00_00266448(void *, void *); -extern int FUN_L00_002668a0(void *, void *); +extern int update_npc_dialogue(void *, void *) __asm__("FUN_L00_00266448"); +extern int initialize_npc_dialogue(void *, void *) __asm__("FUN_L00_002668a0"); extern int random_float_between_cf(float) __asm__("FUN_001fa6d0"); extern int scale_game_frames_c(int) __asm__("scale_game_frames"); extern int tick_countdown_32(int *); extern unsigned char D_0015EDB0_b __asm__("D_0015EDB0"); -extern void FUN_L00_002628d8(float, float, void *, void *, int); +extern void update_joint_animation(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); extern void add_vector_xyz(void *, void *, void *); extern void subtract_vector_xyz_c(void *, void *, void *) __asm__("subtract_vector_xyz"); extern L16WatchPlayer D_0013E633_watch __asm__("D_0013E533"); @@ -153,7 +153,7 @@ extern float D_L08_001675C0_c[] __asm__("D_L08_001675C0"); extern void FUN_L08_00305138_c(void *) __asm__("FUN_L08_00305138"); extern void FUN_L00_0025a120(void *); extern float FUN_001f9b48(void *, void *); -extern void FUN_L00_002502a0(int); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); extern void unlock_planet(int) __asm__("FUN_L00_002607d0"); extern int random_integer_below(int) __asm__("FUN_00213260"); extern void build_spherical_offset(void *, float, float, float) __asm__("FUN_00214db0"); @@ -164,7 +164,8 @@ extern struct { } D_0013F350_g __asm__("D_0013F350"); /* Watcher moby update: wakes when the hero is near, then turns its head toward the hero or a random target. */ -void FUN_L08_00305270(WM *m) { +void batalia_deserter_update(WM *m) __asm__("FUN_L08_00305270"); +void batalia_deserter_update(WM *m) { L16WatchScratch scratch; WD8 *d = (WD8 *)m->data; float rate; @@ -180,7 +181,7 @@ void FUN_L08_00305270(WM *m) { switch (m->state) { case 0: if (m->animation != 1) - blend_moby_animation(m, 1, 0, FUN_001f96f8(20)); + blend_moby_animation(m, 1, 0, scale_game_frames(20)); if (D_0013DD49 && visited52[((unsigned char *)m)[0xB0] + current_level_index * 16] == 0xFF) { mark_moby_for_removal(m); return; @@ -189,22 +190,22 @@ void FUN_L08_00305270(WM *m) { d->p40 = (void *)D_L08_001622E8; m->state = 1; if (d->i64 >= 0) - FUN_L00_002668a0(m, (char *)d + 0x20); + initialize_npc_dialogue(m, (char *)d + 0x20); break; case 1: - if (FUN_001f9b80(m->position, (char *)&D_0013E633_watch + 0xE9D) < 8.0f) { - FUN_L00_002502a0(((unsigned char *)m)[0xB0]); + if (vector_distance(m->position, (char *)&D_0013E633_watch + 0xE9D) < 8.0f) { + jet_clear_persistent(((unsigned char *)m)[0xB0]); m->state = 2; } break; case 2: if (m->flags70 & 2) { if (m->animation != random_integer_below(2) + 1) - blend_moby_animation(m, random_integer_below(2) + 1, 0, FUN_001f96f8(20)); + blend_moby_animation(m, random_integer_below(2) + 1, 0, scale_game_frames(20)); } - if (D_0013F350_g.f2FC == 0 && (FUN_001f96f8(30) < D_0013F350_g.f300 || d->h56 != 0)) { - FUN_L00_00266448(m, (char *)d + 0x20); - FUN_L01_002783a8(m, 2.2f); + if (D_0013F350_g.f2FC == 0 && (scale_game_frames(30) < D_0013F350_g.f300 || d->h56 != 0)) { + update_npc_dialogue(m, (char *)d + 0x20); + begin_dialogue_camera_transition(m, 2.2f); } if (d->h24 == 4) { unlock_planet(9); @@ -220,7 +221,7 @@ void FUN_L08_00305270(WM *m) { if (m->animation == 1) { char *player = (char *)&D_0013E633_watch + 0xE9D; tracking = 1; - if (FUN_001f9b80(m->position, player) < 8.0f && + if (vector_distance(m->position, player) < 8.0f && FUN_001f9e90_cf( m->yaw, FUN_001fa688_cf(((L16WatchPlayer *)((char *)&D_0013E633_watch + 0xE1D))->aim[0] - @@ -274,8 +275,8 @@ void FUN_L08_00305270(WM *m) { } if (D_0015EDB0_b) d->height = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); } #include "sda.h" @@ -331,7 +332,7 @@ void FUN_L08_003063f0(struct Moby *moby) { } } extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); typedef struct { float target[4]; float eye[4]; @@ -389,15 +390,15 @@ typedef struct { } L14Player; extern float FUN_001f9b80_c(void *, void *) __asm__("FUN_001f9b80"); extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); -extern float FUN_001f9b20(void *); +extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); extern int FUN_001f9740_c(int *) __asm__("FUN_001f9740"); extern int FUN_001fa6d0(float); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void FUN_L00_002668a0_c(void *, void *) __asm__("FUN_L00_002668a0"); -extern void FUN_L00_00284e50(void *, void *); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern char D_L08_00162308[]; extern char *D_L08_001600EC; extern unsigned char *D_L08_0015FFD8; @@ -409,7 +410,8 @@ extern void hero_respawn(void) __asm__("FUN_L00_00211250"); extern void FUN_L00_00260860(int, int); /* Watcher moby update with a scripted reveal, then turns its head toward the hero or a random target. */ -void FUN_L08_003065d8(L14WatchMoby *m) { +void the_plumber_batalia_update(L14WatchMoby *m) __asm__("FUN_L08_003065d8"); +void the_plumber_batalia_update(L14WatchMoby *m) { L14WatchScratch scratch; L14WatchData *d = (L14WatchData *)m->data; float rate; @@ -428,11 +430,11 @@ void FUN_L08_003065d8(L14WatchMoby *m) { FUN_L00_002668a0_c(m, d); break; case 1: - if (FUN_L00_00266448(m, d)) - FUN_L01_002783a8(m, 2.7f); + if (update_npc_dialogue(m, d)) + begin_dialogue_camera_transition(m, 2.7f); if (d->h36 == 2) { char *t = D_L08_001600EC + d->i48 * 128; - FUN_L00_00284e50(t + 0x30, t + 0x70); + jet_reset_camera(t + 0x30, t + 0x70); m->state = 2; FUN_L08_002e1698(D_L08_0015FFD8 + d->i50 * 256); } @@ -448,7 +450,7 @@ void FUN_L08_003065d8(L14WatchMoby *m) { case 2: break; case 5: - FUN_L00_002502a0(m->bB0); + jet_clear_persistent(m->bB0); FUN_L00_00260860(0x1B, 1); memcard_save_data(0, -1); mark_moby_for_removal(m); @@ -464,10 +466,10 @@ void FUN_L08_003065d8(L14WatchMoby *m) { if (FUN_001f9b80_c(m->position, g) < 8.0f && (q = (L14Player *)(g - 0x80), fast_difference_between_rotations( - m->yaw, FUN_001f9e90(q->aim[0] - m->position[0], q->aim[1] - m->position[1]))) < + m->yaw, fast_arc_tan(q->aim[0] - m->position[0], q->aim[1] - m->position[1]))) < 1.5707964f) { if (fast_vec_length(g + 0x80) > 0.01f) - d->moving_timer = FUN_001f96f8(120); + d->moving_timer = scale_game_frames(120); else FUN_001f9740_c(&d->moving_timer); } else if (d->moving_timer) { @@ -481,7 +483,7 @@ void FUN_L08_003065d8(L14WatchMoby *m) { fast_add_rotations(m->yaw, random_float_between(-90.0f, 90.0f) * DEG_TO_RAD); build_spherical_offset(d->target, 6.0f, heading, random_float_between(0.0f, 30.0f) * DEG_TO_RAD); - FUN_001f9a10(d->target, d->target, m->position); + fast_vec_add(d->target, d->target, m->position); } if (d->moving_timer) { qcopy(scratch.target, hero.motion.unkD0.f); @@ -496,9 +498,9 @@ void FUN_L08_003065d8(L14WatchMoby *m) { float pitch; qcopy(scratch.eye, m->position); scratch.eye[2] += 1.0f; - FUN_001f9a28(scratch.delta, scratch.target, scratch.eye); - yaw = fast_subtract_rotations(FUN_001f9e90(scratch.delta[0], scratch.delta[1]), m->yaw); - pitch = -FUN_001f9e90(FUN_001f9b20(scratch.delta), scratch.delta[2]); + fast_vec_sub(scratch.delta, scratch.target, scratch.eye); + yaw = fast_subtract_rotations(fast_arc_tan(scratch.delta[0], scratch.delta[1]), m->yaw); + pitch = -fast_arc_tan(vector_length_xy(scratch.delta), scratch.delta[2]); if (yaw > 1.5707964f) yaw = 1.5707964f; else if (yaw < -1.5707964f) @@ -513,8 +515,8 @@ void FUN_L08_003065d8(L14WatchMoby *m) { } if (D_0015EDB0_b) d->height = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); } extern void hero_respawn(void) __asm__("FUN_L00_00211250"); @@ -674,7 +676,7 @@ struct G08c { extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern struct G08c D_L08_0016D060_c __asm__("D_L08_0016D060"); -extern void FUN_L00_002637f8(int); +extern void cutscene_set_camera_target(int) __asm__("FUN_L00_002637f8"); void FUN_L08_003084d8(struct Moby *moby) { int k; @@ -693,7 +695,7 @@ void FUN_L08_003084d8(struct Moby *moby) { k = 3; else if (D_L08_0016D060_c.a == 2 || D_L08_0016D060_c.a == 5) k = 2; - FUN_L00_002637f8((int)D_L08_0016D060_c.objs[k]); + cutscene_set_camera_target((int)D_L08_0016D060_c.objs[k]); } } } @@ -707,7 +709,7 @@ void FUN_L08_003084d8(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/l08_batalia/vendor_002EAF48.c: func_L08_0030A150), where it is exact; names translated to the US level program. */ extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void euler_rotation_basis(void *, void *) __asm__("FUN_001fa030"); extern void FUN_L08_0027fe00(float *, float *, int, float); @@ -725,7 +727,7 @@ void FUN_L08_00308c90(struct Moby *moby) { a[3] = 1.0f; euler_rotation_basis(b, &moby->rot); transform_vector_by_basis(a, a, b); - FUN_001f9a10(a, a, &moby->pos); + fast_vec_add(a, a, &moby->pos); c[0] = 0; c[1] = random_float_between_alt(*(float *)(data + 0x18) * frame_time, *(float *)(data + 0x1C) * frame_time); @@ -785,7 +787,7 @@ extern float D_L08_00162388; extern float D_L08_0016238C; extern float vector_length_xyz(void *); extern int D_L08_001623F0; -extern int FUN_001fa728(char *, float); +extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern int truncate_float_to_s32(); extern short D_L08_00162380 __attribute__((sda)); int D_L08_001623C4 = 0; @@ -836,7 +838,7 @@ void FUN_L08_003097b0(struct Moby *moby) { v[1] = D_L08_00162384; v[2] = D_L08_00162388; v[3] = D_L08_0016238C; - if (FUN_001fa728((char *)v, 1000.0f) >= 0) { + if (fast_bsphere_check((char *)v, 1000.0f) >= 0) { w[0] = *(float *)&D_L08_00162380; w[1] = D_L08_00162384; w[2] = D_L08_00162388; diff --git a/src/overlays/l08/gameplay/entities/bolt_thief.c b/src/overlays/l08/gameplay/entities/bolt_thief.c index 0d5cf87ad9..e8a817eea3 100644 --- a/src/overlays/l08/gameplay/entities/bolt_thief.c +++ b/src/overlays/l08/gameplay/entities/bolt_thief.c @@ -15,9 +15,9 @@ extern char D_L08_001675C0[]; extern float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); -extern float FUN_001f9dc8(float); -extern void FUN_001f9a28(void *, void *, void *); -extern void FUN_001f9bf8(void *, void *, float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); +extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); void build_spherical_offset(f32 *out, f32 scale, f32 a, f32 b) __asm__("FUN_00214db0"); int FUN_L08_002e0228(struct Moby *m) { @@ -29,10 +29,10 @@ int FUN_L08_002e0228(struct Moby *m) { if (p[i] != 0) { float d; build_spherical_offset(a, 1.0f, m->rot.z, -m->rot.y); - FUN_001f9a28(b, (char *)p[i] + 0x10, D_L08_001675C0); - FUN_001f9bf8(b, b, 1.0f); + fast_vec_sub(b, (char *)p[i] + 0x10, D_L08_001675C0); + fast_vec_normalize(b, b, 1.0f); d = fast_vec_dot(b, a); - if (FUN_001f9dc8(0.06981317f) < d) + if (fast_cos(0.06981317f) < d) return p[i]; } } @@ -72,7 +72,7 @@ void *FUN_L08_002e1c98(struct Moby *parent, int oClass, int joint, int pjoint) { qcopy(m + 0x40, &parent->rot); moby_point_position(m, joint, v0); moby_point_position(parent, pjoint, v10); - FUN_001f9a28(m + 0x10, v10, v0); + fast_vec_sub(m + 0x10, v10, v0); FUN_L00_00250df8(m); } return m; @@ -157,8 +157,8 @@ void FUN_L08_002e8788(char *moby) { extern float D_0015ED6C; extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); extern void FUN_L00_00250df8(void *); @@ -175,8 +175,8 @@ void FUN_L08_002e8ba0(struct Moby *a) { *(float *)(m + 0x48) = a->rot.z; moby_point_position(m, e[-1], v0); moby_point_position((void *)e[-2], e[0], v10); - FUN_001f9a28(v20, v10, v0); - FUN_001f9a10(m + 0x10, m + 0x10, v20); + fast_vec_sub(v20, v10, v0); + fast_vec_add(m + 0x10, m + 0x10, v20); } } if (*(int *)(data + 0x90) != 0) { @@ -193,7 +193,7 @@ void FUN_L08_002e8ba0(struct Moby *a) { } /* Ported from rac1-decomp (src/overlays/l08_batalia/vendor_002E0258.c: func_L08_002EADF0), where it is exact; names translated to the US level program. */ -extern void FUN_001f9a68(void *, void *, float); +extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern float D_L08_00161D38 __attribute__((sda)); void FUN_L08_002e9a18(struct Moby *arg) { @@ -211,8 +211,8 @@ void FUN_L08_002e9a18(struct Moby *arg) { *(float *)(part + 0x48) = arg->rot.z; moby_point_position(part, *(int *)(e - 4), v0); moby_point_position(*(void **)(e - 8), *(int *)e, v1); - FUN_001f9a28(v2, v1, v0); - FUN_001f9a10(part + 0x10, part + 0x10, v2); + fast_vec_sub(v2, v1, v0); + fast_vec_add(part + 0x10, part + 0x10, v2); } } if (*(char **)(data + 0x90) != 0) { @@ -227,7 +227,7 @@ void FUN_L08_002e9a18(struct Moby *arg) { FUN_L00_00250df8(o); o = *(char **)p; if (*(unsigned short *)(o + 0x34) & 0x8000) { - FUN_001f9a68(o + 0xD0, o + 0xD0, -1.0f); + fast_vec_scale(o + 0xD0, o + 0xD0, -1.0f); } } p += 16; @@ -254,7 +254,7 @@ extern f32 fast_cos(f32) __asm__("func_001F9DC8"); extern f32 fast_normalize_angle(f32) __asm__("func_001FA610"); extern f32 fast_sin(f32) __asm__("func_001F9DE0"); extern f32 fast_subtract_rotations_c(f32, f32) __asm__("func_001FA5C8"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern int D_0015EDB4_d __asm__("D_0015EDB4") __attribute__((section(".data"))); /* no foreign declaration */ extern int D_L08_0015F5CC_lui __asm__("D_L08_0015F5CC") __attribute__((section(".data"))); /* no foreign declaration */ extern f32 D_L08_00161AC0_gp __asm__("D_L08_00161AC0") __attribute__((sda)); /* no foreign declaration */ @@ -306,7 +306,7 @@ extern void FUN_L02_0020bc88(void *, void *, void *, s32, s32); extern void vu1_add_g_sregister(s32, u64) __asm__("func_00233980"); extern void func_00234C98_2E0258(int, long) __asm__("FUN_00233980"); extern long texture51(int) __asm__("FUN_001f44b8"); -extern void draw_quad51(void *, void *, void *, long, int) __asm__("FUN_L02_0020bc88"); +extern void FUN_L02_0020bc88_c(void *, void *, void *, long, int) __asm__("FUN_L02_0020bc88"); extern int func_001FA898_2E0258(float) __asm__("FUN_001fa6d0"); extern float func_001FA888_2E0258(int) __asm__("FUN_001fa6c0"); extern float func_001FA748_2E0258(float, float) __asm__("FUN_001fa580"); @@ -398,7 +398,7 @@ void FUN_L08_002deee0(Moby *moby) { xy[2] += (func_001FA898_2E0258(D_L08_00161B80) << 4) + 0x8000; xy[3] += (unsigned int)((func_001FA898_2E0258(D_L08_00161B84 * 16.0f) << 16) - (int)0x80000000); xy[3] += (func_001FA898_2E0258(D_L08_00161B80) << 4) + 0x8000; - draw_quad51(xy, uv_words, color_words, texture, 1); + FUN_L02_0020bc88_c(xy, uv_words, color_words, texture, 1); } texture = texture51(D_L08_00161BA4); uv_words[0] = D_L08_00161BC0; @@ -435,7 +435,7 @@ void FUN_L08_002deee0(Moby *moby) { xy[2] += func_001FA898_2E0258((D_L08_00161B80 - D_L08_00161B90) * 16.0f + relative[0]) + 0x8000; xy[3] += (unsigned int)((func_001FA898_2E0258((D_L08_00161B84 - D_L08_00161B94) * 16.0f + relative[1]) << 16) - (int)0x80000000); xy[3] += func_001FA898_2E0258((D_L08_00161B80 - D_L08_00161B90) * 16.0f + relative[0]) + 0x8000; - draw_quad51(xy, uv_words, color_words, texture, 1); + FUN_L02_0020bc88_c(xy, uv_words, color_words, texture, 1); } else data->linked[k] = 0; } } @@ -460,7 +460,7 @@ void FUN_L08_002deee0(Moby *moby) { xy[2] += func_001FA898_2E0258((D_L08_00161B80 - D_L08_00161B98) * 16.0f + relative[0]) + 0x8000; xy[3] += (unsigned int)((func_001FA898_2E0258((D_L08_00161B84 - D_L08_00161B9C) * 16.0f + relative[1]) << 16) - (int)0x80000000); xy[3] += func_001FA898_2E0258((D_L08_00161B80 - D_L08_00161B98) * 16.0f + relative[0]) + 0x8000; - draw_quad51(xy, uv_words, color_words, texture, 1); + FUN_L02_0020bc88_c(xy, uv_words, color_words, texture, 1); } indices++; } @@ -485,7 +485,7 @@ void FUN_L08_002deee0(Moby *moby) { xy[2] += (func_001FA898_2E0258(D_L08_00161B60) << 4) + 0x8000; xy[3] += (unsigned int)((func_001FA898_2E0258(D_L08_00161B64 * 16.0f) << 16) - (int)0x80000000); xy[3] += (func_001FA898_2E0258(D_L08_00161B60) << 4) + 0x8000; - draw_quad51(xy, uv_words, color_words, texture, 1); + FUN_L02_0020bc88_c(xy, uv_words, color_words, texture, 1); } texture = texture51(D_L08_00161BA4); uv_words[0] = D_L08_00161BD0; @@ -520,7 +520,7 @@ void FUN_L08_002deee0(Moby *moby) { xy[2] += (func_001FA898_2E0258(D_L08_00161B60 + (float)outer_x) << 4) + 0x8000; xy[3] += (unsigned int)((func_001FA898_2E0258(D_L08_00161B64 * 16.0f) << 16) - (int)0x80000000); xy[3] += (func_001FA898_2E0258(D_L08_00161B60) << 4) + 0x8000; - draw_quad51(xy, uv_words, color_words, texture, 1); + FUN_L02_0020bc88_c(xy, uv_words, color_words, texture, 1); } if (func_001F9850_2E0258(15) < data->timer) { color = func_001FA8A8_2E0258(0x5000FFFF, 0x500000FF, func_001FA888_2E0258(data->timer - func_001F9850_2E0258(15)) / (float)func_001F9850_2E0258(15)); @@ -548,7 +548,7 @@ void FUN_L08_002deee0(Moby *moby) { angle = func_001FA7D8_2E0258(func_001FA748_2E0258((*(float (*)[4])&moby->rot)[2] * 4.0f, 3.1415927f)); xy[3] += (unsigned int)((func_001FA898_2E0258(func_001F9FA8_2E0258(angle) * D_L08_00161B7C * 16.0f) << 16) - (int)0x80000000); xy[3] += func_001FA898_2E0258(func_001F9F90_2E0258(angle) * D_L08_00161B78 * 16.0f) + 0x8000; - draw_quad51(xy, uv_words, color_words, texture51(D_L08_00161BA8), 1); + FUN_L02_0020bc88_c(xy, uv_words, color_words, texture51(D_L08_00161BA8), 1); xy[3] = 0xFFFFF000000000L; xy[2] = 0xFFFFF000000000L; xy[1] = 0xFFFFF000000000L; @@ -565,7 +565,7 @@ void FUN_L08_002deee0(Moby *moby) { angle = func_001FA7D8_2E0258(func_001FA748_2E0258((*(float (*)[4])&moby->rot)[1] * 8.0f, 3.1415927f)); xy[3] += (unsigned int)((func_001FA898_2E0258(func_001F9FA8_2E0258(angle) * D_L08_00161B7C * 16.0f) << 16) - (int)0x80000000); xy[3] += func_001FA898_2E0258(func_001F9F90_2E0258(angle) * D_L08_00161B78 * 16.0f) + 0x8000; - draw_quad51(xy, uv_words, color_words, texture51(D_L08_00161BAC), 1); + FUN_L02_0020bc88_c(xy, uv_words, color_words, texture51(D_L08_00161BAC), 1); } /* Updates the mounted Batalia cannon: entry/exit, aiming, alternating barrels, waves, and attached visuals. */ /* Ported from rac1-decomp (src/overlays/l08_batalia/vendor_002E0258.c: func_L08_002E16A0), where it is exact; names translated to the US level program. */ @@ -598,7 +598,7 @@ extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); extern float D_0015ED6C; extern float D_0015ED70; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_difference_between_rotations(float, float) __asm__("func_001FA688"); extern int D_0013CAE4 __attribute__((section(".data"))); /* no foreign declaration */ extern int D_0013F350; @@ -620,7 +620,7 @@ extern int D_L08_00161BF0 __attribute__((sda)); extern int D_L08_00167480; extern int FUN_001f9770_c() __asm__("FUN_001f9770"); extern int FUN_L00_001fefc8(); -extern int FUN_L00_001ff378(); +extern int divide_vector_xyz() __asm__("FUN_L00_001ff378"); extern int FUN_L00_00211250(); extern int FUN_L00_00257b90(int, int); extern s32 D_0015ED84; @@ -641,7 +641,7 @@ int FUN_L08_002e0228_c(struct Moby *m) __asm__("FUN_L08_002e0228"); void FUN_L00_00216f90(void *pos, void *rot, int mode, int flag); void FUN_L00_002ea9d8(char *src); void FUN_L00_002eaa30(char *src); -void FUN_L00_002eaaa0(void *pa, void *pb, s32 mode, s32 w, s32 x); +void jet_mount(void *pa, void *pb, s32 mode, s32 w, s32 x) __asm__("FUN_L00_002eaaa0"); void FUN_L00_002eac18(int mode); void FUN_L08_002deee0_c(struct Moby *moby) __asm__("FUN_L08_002deee0"); void FUN_L08_00306b30(u8 *object, s32 mode); @@ -681,7 +681,7 @@ extern void func_001F99D8_2E16A0(void *,int) __asm__("FUN_001f9810"); extern void func_001FA1F8_2E16A0(void *,void *) __asm__("FUN_001fa030"); extern void func_001F9BC0_2E16A0(void *) __asm__("FUN_001f99f8"); extern void func_001F9EC0_2E16A0(void *,void *,void *) __asm__("FUN_001f9cf8"); -extern int hero_state52(int,int) __asm__("FUN_L08_00230b38"); +extern int FUN_L08_00230b38_c(int,int) __asm__("FUN_L08_00230b38"); extern void func_L00_002EC0C8_2E16A0(int) __asm__("FUN_L00_002eac18"); extern void fast_vec_normalize(void *,void *,float) __asm__("FUN_001f9bf8"); extern void func_L00_001FF328_2E16A0(void *,void *,float) __asm__("FUN_L00_001ff378"); @@ -745,7 +745,7 @@ void FUN_L08_002e0328(Moby *moby) { if (visited52[D_0015ED84][moby->mission] != 0xFF && (hero52.interact & 1)) func_L00_00211908_2E16A0(); if (((*(int *)D_0013A5E0_2E16A0 & 0x10) || (*(unsigned char *)(D_0014095F) & 1)) && visited52[D_0015ED84][moby->mission] == 0xFF) { hero52.interact = 0; - hero_state52(0, 1); + FUN_L08_00230b38_c(0, 1); moby->command = 2; (*(float (*)[4])&moby->rot)[1] = 0.0f; func_001FA1F8_2E16A0((*(float (*)[16])&moby->rot_row0), (*(float (*)[4])&moby->rot)); func_001F9BC0_2E16A0(direction); direction[2] = (*(float (*)[4])&moby->rot)[2]; @@ -780,7 +780,7 @@ void FUN_L08_002e0328(Moby *moby) { } else if (visited52[D_0015ED84][moby->mission] == 0xFF) { if (func_001F9D48_2E16A0(position, (*(float (*)[4])&hero52.moby->pos)) < 1.0f && hero52.pos[2] - (*(float (*)[4])&moby->pos)[2] < 7.0f && data->exit_timer == 0 && data->health > 0) { moby->command = 1; - hero_state52(50, 1); + FUN_L08_00230b38_c(50, 1); } } switch (moby->state) { @@ -1238,7 +1238,7 @@ void FUN_L08_002e1d70(struct Moby *moby) { } #include "rnc/gameplay/hero.h" extern float D_L08_00161C3C __attribute__((sda)); -extern f32 FUN_001f9e90(f32, f32); +extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); typedef struct { struct Moby *part; /* moved along with the anchor's joint */ @@ -1268,8 +1268,8 @@ void FUN_L08_002e2078(struct Moby *m) { part->rot.z = m->rot.z; moby_point_position(part, v->links[i].part_joint, a); moby_point_position(v->links[i].anchor, v->links[i].anchor_joint, b); - FUN_001f9a28(d, b, a); - FUN_001f9a10(&part->pos, &part->pos, d); + fast_vec_sub(d, b, a); + fast_vec_add(&part->pos, &part->pos, d); } } if (v->links[7].part != 0) { @@ -1282,7 +1282,7 @@ void FUN_L08_002e2078(struct Moby *m) { v->links[9].part->rot.x = fast_add_rotations(v->links[9].part->rot.x, D_L08_00161C3C * DEG_TO_RAD * D_0015ED6C); } if (v->links[3].part != 0) { - v->links[3].part->rot.z = FUN_001f9e90(hero.motion.pos.f[0] - v->links[3].part->pos.x, hero.motion.pos.f[1] - v->links[3].part->pos.y); + v->links[3].part->rot.z = fast_arc_tan(hero.motion.pos.f[0] - v->links[3].part->pos.x, hero.motion.pos.f[1] - v->links[3].part->pos.y); } for (i = 1; i < 34; i++) { if (links[i].part != 0) { @@ -1384,7 +1384,7 @@ extern u8 D_0014C050[]; extern SwarmPath *D_L08_001B0CB0[]; extern struct Moby *D_L08_0015FFD8_m __asm__("D_L08_0015FFD8"); -extern s32 FUN_L00_0028d8c0(struct Moby *, s32); +extern s32 voice_is_playing(struct Moby *, s32) __asm__("FUN_L00_0028d8c0"); extern s32 allocate_voice_for_target_entry(s32, s32, struct Moby *) __asm__("FUN_0022da68"); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern f32 random_float_between(f32, f32) __asm__("FUN_002132a8"); @@ -1402,8 +1402,8 @@ extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); extern void FUN_L00_00258278(struct Moby *, f32, f32 *, f32, f32, f32); -extern float FUN_L00_0025be00(float *, float *, float, float, float, float); -extern void FUN_L00_0025f090(void *, void *, s32, f32, f32); +extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); +extern void cart_burst(void *, void *, s32, f32, f32) __asm__("FUN_L00_0025f090"); extern struct Moby *FUN_L08_002de3e0(void *, struct Moby *, void *, f32, f32); extern void FUN_L08_002e2250_u(struct Moby *) __asm__("FUN_L08_002e2250"); @@ -1433,7 +1433,7 @@ void FUN_L08_002e24e8(struct Moby *moby) { if (D_L08_00161C4C != 0) { return; } - if (!FUN_L00_0028d8c0(moby, vars->sound)) { + if (!voice_is_playing(moby, vars->sound)) { vars->sound = allocate_voice_for_target_entry(3, 4, moby); } switch (moby->state) { @@ -1448,7 +1448,7 @@ void FUN_L08_002e24e8(struct Moby *moby) { qcopy(&moby->pos, &vars->follow[1].path->points[0]); FUN_L08_002e1d70(moby); moby->state = 2; - moby->rot.z = FUN_001f9e90(vars->follow[1].path->points[1].f[0] - moby->pos.x, + moby->rot.z = fast_arc_tan(vars->follow[1].path->points[1].f[0] - moby->pos.x, vars->follow[1].path->points[1].f[1] - moby->pos.y); moby->flags |= 0x4000; break; @@ -1456,7 +1456,7 @@ void FUN_L08_002e24e8(struct Moby *moby) { waypoint = (vars->follow[0].point + vars->follow[0].path->count + vars->follow[0].direction) % vars->follow[0].path->count; target = &D_L08_0015FFD8_m[vars->target_index]; FUN_L00_00258278(moby, - FUN_001f9e90(vars->follow[0].path->points[waypoint].f[0] - moby->pos.x, + fast_arc_tan(vars->follow[0].path->points[waypoint].f[0] - moby->pos.x, vars->follow[0].path->points[waypoint].f[1] - moby->pos.y), &vars->turn_speed, 0.004f, 0.3f, 0.02f); FUN_L08_002e2250_u(moby); @@ -1480,7 +1480,7 @@ void FUN_L08_002e24e8(struct Moby *moby) { moby_point_position(vars->links[4].part, 1, &muzzle); } pitch = random_float_between(0.17453292f, 0.5235988f); - yaw = fast_add_rotations(FUN_001f9e90(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), + yaw = fast_add_rotations(fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), 3.1415927f); yaw = fast_add_rotations(yaw, random_float_between(-0.2617994f, 0.7853982f)); if (yaw > 0.0f && yaw < 0.34f) { @@ -1503,9 +1503,9 @@ void FUN_L08_002e24e8(struct Moby *moby) { follower = &vars->follow[1]; next = (follower->point + 1) % follower->path->count; after = (follower->point + 2) % follower->path->count; - heading = FUN_001f9e90(follower->path->points[next].f[0] - follower->path->points[follower->point].f[0], + heading = fast_arc_tan(follower->path->points[next].f[0] - follower->path->points[follower->point].f[0], follower->path->points[next].f[1] - follower->path->points[follower->point].f[1]); - next_heading = FUN_001f9e90(follower->path->points[after].f[0] - follower->path->points[next].f[0], + next_heading = fast_arc_tan(follower->path->points[after].f[0] - follower->path->points[next].f[0], follower->path->points[after].f[1] - follower->path->points[next].f[1]); turn = fast_subtract_rotations(heading, next_heading); distance = FUN_001f9b48(&moby->pos, &follower->path->points[next]); @@ -1513,9 +1513,9 @@ void FUN_L08_002e24e8(struct Moby *moby) { &follower->path->points[next]); /* the blended heading is computed but unused: the turn below steers towards the next point */ fast_add_rotations(turn * distance, next_heading); - heading = FUN_001f9e90(follower->path->points[next].f[0] - moby->pos.x, + heading = fast_arc_tan(follower->path->points[next].f[0] - moby->pos.x, follower->path->points[next].f[1] - moby->pos.y); - FUN_L00_0025be00(&moby->rot.z, &vars->turn_speed, heading, + approach_angle(&moby->rot.z, &vars->turn_speed, heading, D_L08_00161C44 * DEG_TO_RAD * frame_time_sq, D_L08_00161C44 * DEG_TO_RAD * frame_time_sq, D_L08_00161C48 * DEG_TO_RAD * frame_time); qcopy(&point, &follower->path->points[next]); @@ -1549,7 +1549,7 @@ void FUN_L08_002e24e8(struct Moby *moby) { moby->state = 1; path = vars->follow[0].path; qcopy(&moby->pos, &path->points[0]); - moby->rot.z = FUN_001f9e90(path->points[1].f[0] - moby->pos.x, path->points[1].f[1] - moby->pos.y); + moby->rot.z = fast_arc_tan(path->points[1].f[0] - moby->pos.x, path->points[1].f[1] - moby->pos.y); moby->rot.x = 0.0f; FUN_L08_002e2078(moby); break; @@ -1559,14 +1559,14 @@ void FUN_L08_002e24e8(struct Moby *moby) { struct Moby *part = vars->links[i].part; if (part != NULL) { Vec4 *drift = (Vec4 *)part->pvars; - FUN_L00_0025f090(moby, &part->pos, -1, 3.0f, 13.0f); + cart_burst(moby, &part->pos, -1, 3.0f, 13.0f); subtract_vector_xyz(drift, &part->pos, &moby->pos); normalize_vector_xyz(drift, drift, frame_time * 5.0f); part->state = 1; vars->links[i].part = NULL; } } - FUN_L00_0025f090(moby, &moby->pos, -1, 5.0f, 13.0f); + cart_burst(moby, &moby->pos, -1, 5.0f, 13.0f); mark_moby_for_removal(moby); break; } @@ -1603,17 +1603,17 @@ extern char D_001413D0[]; extern void FUN_L00_00263ac8(float, struct Moby *, int, void *); extern void FUN_L00_0025a120(struct Moby *); extern void *FUN_L00_0025a420(void *, int, int); -extern void FUN_L00_0025c558(struct Moby *, void *, float, int, int, int); -extern int FUN_L00_0025c698(struct Moby *, void *); +extern void trooper_start_knockback(struct Moby *, void *, float, int, int, int) __asm__("FUN_L00_0025c558"); +extern int mine_fall(struct Moby *, void *) __asm__("FUN_L00_0025c698"); extern void FUN_L00_00257470(struct Moby *, int, int); -extern void FUN_L00_0025d538(struct Moby *, void *); +extern void trooper_anim_finish(struct Moby *, void *) __asm__("FUN_L00_0025d538"); extern void FUN_L00_0025f730(void *, float); extern int FUN_L00_0025f878(struct Moby *); extern void FUN_L00_002a7210(struct Moby *, struct Moby *, float, float); extern void FUN_00212f90(struct Moby *, int, int, int); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9e90(float, float); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); typedef struct { char pad0[0x29]; @@ -1641,7 +1641,8 @@ typedef struct { unsigned char x260[1]; } BoltThiefVars; -void FUN_L08_002e2df0(struct Moby *moby) { +void bolt_thief_update(struct Moby *moby) __asm__("FUN_L08_002e2df0"); +void bolt_thief_update(struct Moby *moby) { Vec4 point; Vec4 step; BoltThiefVars *data; @@ -1674,7 +1675,7 @@ void FUN_L08_002e2df0(struct Moby *moby) { data->f8C = speed10; data->bAD = 0; } - FUN_L00_0025c558(moby, data->x70, FUN_001f9e90(moby->pos.x - hero.motion.pos.f[0], moby->pos.y - hero.motion.pos.f[1]), 4, 1, 0); + trooper_start_knockback(moby, data->x70, fast_arc_tan(moby->pos.x - hero.motion.pos.f[0], moby->pos.y - hero.motion.pos.f[1]), 4, 1, 0); data->b67 = 0x78; FUN_L00_00257470(moby, 0, -1); moby->state = 8; @@ -1716,7 +1717,7 @@ void FUN_L08_002e2df0(struct Moby *moby) { follower = &data->follow[0]; next = (follower->point + follower->path->count + follower->direction) % follower->path->count; - heading = FUN_001f9e90(follower->path->points[next].f[0] - moby->pos.x, follower->path->points[next].f[1] - moby->pos.y); + heading = fast_arc_tan(follower->path->points[next].f[0] - moby->pos.x, follower->path->points[next].f[1] - moby->pos.y); FUN_L00_00258278(moby, heading, &data->f224, 0.01f, 0.3f, 0.1f); path = follower->path; qcopy(&point, &path->points[next]); @@ -1794,14 +1795,14 @@ void FUN_L08_002e2df0(struct Moby *moby) { follower = &data->follow[0]; found = 0; next = (follower->point + follower->path->count + follower->direction) % follower->path->count; - heading = FUN_001f9e90(follower->path->points[next].f[0] - moby->pos.x, follower->path->points[next].f[1] - moby->pos.y); + heading = fast_arc_tan(follower->path->points[next].f[0] - moby->pos.x, follower->path->points[next].f[1] - moby->pos.y); FUN_L00_00258278(moby, heading, &data->f224, 0.01f, 0.3f, 0.1f); qcopy(&point, &follower->path->points[next]); for (i = 0; i < 0x32; i++) { struct Moby *other = data->list[i]; if (other != 0 && (signed char)other->state >= 0) { - if (FUN_001f9b80(&moby->pos, &other->pos) < 6.0f) { + if (vector_distance(&moby->pos, &other->pos) < 6.0f) { if (moby->prev_seq != 6) { FUN_00212f90(moby, 6, 0, scale_game_frames(0x14)); } @@ -1837,7 +1838,7 @@ void FUN_L08_002e2df0(struct Moby *moby) { follower = &data->follow[1]; next = (follower->point + follower->path->count + follower->direction) % follower->path->count; - heading = FUN_001f9e90(follower->path->points[next].f[0] - moby->pos.x, follower->path->points[next].f[1] - moby->pos.y); + heading = fast_arc_tan(follower->path->points[next].f[0] - moby->pos.x, follower->path->points[next].f[1] - moby->pos.y); FUN_L00_00258278(moby, heading, &data->f224, 0.01f, 0.3f, 0.1f); qcopy(&point, &follower->path->points[next]); subtract_vector_xyz(&step, &point, &moby->pos); @@ -1856,7 +1857,7 @@ void FUN_L08_002e2df0(struct Moby *moby) { float distance; float heading; - heading = FUN_001f9e90(hero.motion.pos.f[0] - moby->pos.x, hero.motion.pos.f[1] - moby->pos.y); + heading = fast_arc_tan(hero.motion.pos.f[0] - moby->pos.x, hero.motion.pos.f[1] - moby->pos.y); hero_position = hero.motion.pos.f; FUN_L00_00258278(moby, heading, &data->f224, 0.01f, 0.3f, 0.1f); distance = FUN_001f9b48(hero_position, &moby->pos); @@ -1874,8 +1875,8 @@ void FUN_L08_002e2df0(struct Moby *moby) { break; } case 8: - if (FUN_L00_0025c698(moby, data->x70) & 3) { - FUN_L00_0025f090(moby, &moby->pos, -1, 1.0f, 13.0f); + if (mine_fall(moby, data->x70) & 3) { + cart_burst(moby, &moby->pos, -1, 1.0f, 13.0f); mark_moby_for_removal(moby); return; } @@ -1885,7 +1886,7 @@ void FUN_L08_002e2df0(struct Moby *moby) { } break; } - FUN_L00_0025d538(moby, data->x60); + trooper_anim_finish(moby, data->x60); } #include "rnc/overlay/hud.h" @@ -1966,7 +1967,7 @@ extern float D_L08_00161CB4_gp __asm__("D_L08_00161CB4") __attribute__((sda)); extern float D_L08_00161CB8; extern float D_L08_00161CBC_gp __asm__("D_L08_00161CBC") __attribute__((sda)); extern float D_L08_00161CD0_gp __asm__("D_L08_00161CD0") __attribute__((sda)); -extern float FUN_001f96b0(float); +extern float FUN_L04_001f1978(float); extern float FUN_L00_0025bc00(float *, float, float, int); extern float fast_add_rotations_c4(float, float) __asm__("func_001FA580"); extern float vector_distance_xy_alt(void *, void *) __asm__("FUN_001f9b80"); @@ -1976,8 +1977,8 @@ extern int D_L08_00161CC8; extern int D_L08_00161CCC_gp __asm__("D_L08_00161CCC") __attribute__((sda)); extern int D_L08_00161CD4_gp __asm__("D_L08_00161CD4") __attribute__((sda)); extern int D_L08_00174658; -extern int FUN_001efa68(void *, void *, int, int, int); -extern int FUN_L00_001f0d60(float, void *, int, void *); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern int FUN_L00_002604f0(void *, int, void *, void *, void *, void *); extern int queue_animation_update_alt(s32, s32, void *, void *, void *, void *, s32) __asm__("FUN_001ff308"); extern s32 level_bolts[] __asm__("D_0013DF38"); @@ -2049,7 +2050,7 @@ void FUN_L08_002e3870(struct Moby *moby) { add_vector_xyz(point, point, &moby->pos); fast_vec_scale_c(local, &moby->rot_row2, -2.0f); add_vector_xyz(local, local, &moby->pos); - if (FUN_001efa68(point, local, 2, 0, 0) != 0) { + if (collision_line(point, local, 2, 0, 0) != 0) { CollPos_4BE8 *hit = (CollPos_4BE8 *)D_L08_00174660; qcopy(vars->anchor, hit->pos); linked = ((int *)hit)[-2]; @@ -2335,7 +2336,7 @@ void FUN_L08_002e3870(struct Moby *moby) { moby->state = 2; break; } - if (FUN_L00_001f0d60(0.25f, &moby->pos, 0x22, moby) != 0) { + if (coll_sphere(0.25f, &moby->pos, 0x22, moby) != 0) { subtract_vector_xyz(direction, &moby->pos, ((CollPos_4BE8 *)D_L08_00174660)->pos); FUN_L00_001ff660(vars->velocity, vars->velocity, direction); if (fast_arc_tan(direction[2], func_001F9CE8_2E16A0(direction)) < 0.7853982f @@ -2346,7 +2347,7 @@ void FUN_L08_002e3870(struct Moby *moby) { moby->flags &= ~0x100; vars = (Vars_4BE8 *)moby->pvars; - frames = truncate_float_to_s32_c5(FUN_001f96b0(D_L08_00161CD0_gp + random_float_between_c5(-10.0f, 10.0f))); + frames = truncate_float_to_s32_c5(FUN_L04_001f1978(D_L08_00161CD0_gp + random_float_between_c5(-10.0f, 10.0f))); per_frame = 1.0f / convert_integer_to_float(frames); qcopy(vars->anchor, coll->pos); matrix_to_euler(&moby->rot_row0, &moby->rot); @@ -2660,7 +2661,7 @@ void FUN_L08_002e88d8(char *m) { char *t = *q; char *d2; d2 = *(char **)(t + 0x78); - FUN_L00_0025f090(m, t + 0x10, -1, 2.0f, 13.0f); + cart_burst(m, t + 0x10, -1, 2.0f, 13.0f); subtract_vector_xyz(d2, *q + 0x10, *(char **)(o1 + data + 0x64) + 0x10); normalize_vector_xyz(d2, d2, D_0015ED6C * 10.0f); (*q)[0x20] = 1; @@ -2675,7 +2676,7 @@ void FUN_L08_002e88d8(char *m) { base = b2 + off; sq = (char **)base; if (*sq != 0) { char *d2 = *(char **)(*sq + 0x78); - FUN_L00_0025f090(m, *sq + 0x10, -1, 2.0f, 13.0f); + cart_burst(m, *sq + 0x10, -1, 2.0f, 13.0f); subtract_vector_xyz(d2, *sq + 0x10, *(char **)(data + off + 0x64) + 0x10); normalize_vector_xyz(d2, d2, D_0015ED6C * 10.0f); (*sq)[0x20] = 1; @@ -2710,7 +2711,7 @@ extern u8 D_0014C050[]; extern SwarmPath *D_L08_001B0CB0[]; extern struct Moby *D_L08_0015FFD8_m __asm__("D_L08_0015FFD8"); -extern s32 FUN_L00_0028d8c0(struct Moby *, s32); +extern s32 voice_is_playing(struct Moby *, s32) __asm__("FUN_L00_0028d8c0"); extern s32 allocate_voice_for_target_entry(s32, s32, struct Moby *) __asm__("FUN_0022da68"); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern f32 random_float_between(f32, f32) __asm__("FUN_002132a8"); @@ -2719,7 +2720,7 @@ extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); -extern s32 FUN_001f9770(s16 *); +extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); extern f32 FUN_001f9b48(void *, void *); extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); @@ -2727,13 +2728,14 @@ extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); extern void FUN_L00_00258278(struct Moby *, f32, f32 *, f32, f32, f32); -extern void FUN_L00_0025f090(void *, void *, s32, f32, f32); +extern void cart_burst(void *, void *, s32, f32, f32) __asm__("FUN_L00_0025f090"); extern struct Moby *FUN_L08_002de3e0(void *, struct Moby *, void *, f32, f32); extern void FUN_L08_002e8788(char *); extern void FUN_L08_002e88d8_u(struct Moby *) __asm__("FUN_L08_002e88d8"); extern void FUN_L08_002e8ba0(struct Moby *); -void FUN_L08_002e8cd0(struct Moby *moby) { +void shrub_update(struct Moby *moby) __asm__("FUN_L08_002e8cd0"); +void shrub_update(struct Moby *moby) { SwarmVars *vars = (SwarmVars *)moby->pvars; SwarmPathFollower *follower; struct Moby *target; @@ -2759,7 +2761,7 @@ void FUN_L08_002e8cd0(struct Moby *moby) { if (D_L08_00161D30 != 0) { return; } - if (!FUN_L00_0028d8c0(moby, vars->sound)) { + if (!voice_is_playing(moby, vars->sound)) { vars->sound = allocate_voice_for_target_entry(3, 4, moby); } switch (moby->state) { @@ -2775,14 +2777,14 @@ void FUN_L08_002e8cd0(struct Moby *moby) { qcopy(&moby->pos, &vars->follow[1].path->points[0]); FUN_L08_002e8788((char *)moby); moby->state = 2; - moby->rot.z = FUN_001f9e90(vars->follow[1].path->points[1].f[0] - moby->pos.x, + moby->rot.z = fast_arc_tan(vars->follow[1].path->points[1].f[0] - moby->pos.x, vars->follow[1].path->points[1].f[1] - moby->pos.y); break; case 1: waypoint = (vars->follow[0].point + vars->follow[0].path->count + vars->follow[0].direction) % vars->follow[0].path->count; target = &D_L08_0015FFD8_m[vars->target_index]; FUN_L00_00258278(moby, - FUN_001f9e90(vars->follow[0].path->points[waypoint].f[0] - moby->pos.x, + fast_arc_tan(vars->follow[0].path->points[waypoint].f[0] - moby->pos.x, vars->follow[0].path->points[waypoint].f[1] - moby->pos.y), &vars->turn_speed, 0.004f, 0.3f, 0.02f); FUN_L08_002e88d8_u(moby); @@ -2802,7 +2804,7 @@ void FUN_L08_002e8cd0(struct Moby *moby) { moby->command = 0; moby_point_position(vars->parts[3].moby, 1, &muzzle); pitch = random_float_between(0.17453292f, 0.5235988f); - yaw = fast_add_rotations(FUN_001f9e90(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), + yaw = fast_add_rotations(fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), 3.1415927f); yaw = fast_add_rotations(yaw, random_float_between(-0.2617994f, 0.7853982f)); if (yaw > 0.0f && yaw < 0.34f) { @@ -2826,14 +2828,14 @@ void FUN_L08_002e8cd0(struct Moby *moby) { if (D_L08_0015F5C4 == 2 && vars->can_skip != 0 && D_L08_0016D090 == 0x200000000) { qcopy(&moby->pos, &follower->path->points[15]); follower->point = 15; - moby->rot.z = FUN_001f9e90(follower->path->points[11].f[0] - moby->pos.x, + moby->rot.z = fast_arc_tan(follower->path->points[11].f[0] - moby->pos.x, follower->path->points[11].f[1] - moby->pos.y); } next = (follower->point + 1) % follower->path->count; after = (follower->point + 2) % follower->path->count; - heading = FUN_001f9e90(follower->path->points[next].f[0] - follower->path->points[follower->point].f[0], + heading = fast_arc_tan(follower->path->points[next].f[0] - follower->path->points[follower->point].f[0], follower->path->points[next].f[1] - follower->path->points[follower->point].f[1]); - next_heading = FUN_001f9e90(follower->path->points[after].f[0] - follower->path->points[next].f[0], + next_heading = fast_arc_tan(follower->path->points[after].f[0] - follower->path->points[next].f[0], follower->path->points[after].f[1] - follower->path->points[next].f[1]); turn = fast_subtract_rotations(heading, next_heading); distance = FUN_001f9b48(&moby->pos, &follower->path->points[next]); @@ -2850,7 +2852,7 @@ void FUN_L08_002e8cd0(struct Moby *moby) { } add_vector_xyz(&moby->pos, &moby->pos, &step); FUN_L08_002e8ba0((char *)moby); - if (!FUN_001f9770(&vars->fire_timer)) { + if (!fast_dec_timer_s16(&vars->fire_timer)) { break; } vars->fire_timer = truncate_float_to_s32(multiply_global_factor_ed64(random_float_between(300.0f, 600.0f))); @@ -2871,7 +2873,7 @@ void FUN_L08_002e8cd0(struct Moby *moby) { moby->state = 1; path = vars->follow[0].path; qcopy(&moby->pos, &path->points[0]); - moby->rot.z = FUN_001f9e90(path->points[1].f[0] - moby->pos.x, path->points[1].f[1] - moby->pos.y); + moby->rot.z = fast_arc_tan(path->points[1].f[0] - moby->pos.x, path->points[1].f[1] - moby->pos.y); FUN_L08_002e8ba0((char *)moby); break; } @@ -2880,14 +2882,14 @@ void FUN_L08_002e8cd0(struct Moby *moby) { struct Moby *part = vars->parts[i].moby; if (part != NULL) { Vec4 *drift = (Vec4 *)part->pvars; - FUN_L00_0025f090(moby, &part->pos, -1, 3.0f, 13.0f); + cart_burst(moby, &part->pos, -1, 3.0f, 13.0f); subtract_vector_xyz(drift, &part->pos, &moby->pos); normalize_vector_xyz(drift, drift, frame_time * 5.0f); part->state = 1; vars->parts[i].moby = NULL; } } - FUN_L00_0025f090(moby, &moby->pos, -1, 5.0f, 13.0f); + cart_burst(moby, &moby->pos, -1, 5.0f, 13.0f); mark_moby_for_removal(moby); break; } @@ -2959,8 +2961,8 @@ void FUN_L08_002e9558(char *moby) { e += 0x10; } while (i < 8); } -extern void FUN_L00_0025f090(void *, void *, s32, f32, f32); -extern void FUN_001f9a28(void *, void *, void *); +extern void cart_burst(void *, void *, s32, f32, f32) __asm__("FUN_L00_0025f090"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); extern f32 random_float_between(f32, f32) __asm__("FUN_002132a8"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); @@ -3015,9 +3017,9 @@ void FUN_L08_002e9758(struct Moby *moby) { u8 *vector; char *position = data; vector = chosen->moby->pvars; - FUN_L00_0025f090(moby, &chosen->moby->pos, -1, 2.0f, 13.0f); + cart_burst(moby, &chosen->moby->pos, -1, 2.0f, 13.0f); position += selected * 16; - FUN_001f9a28(vector, &chosen->moby->pos, + fast_vec_sub(vector, &chosen->moby->pos, &(*(struct Moby **)(position + 0x64))->pos); normalize_vector_xyz(vector, vector, D_0015ED6C * 10.0f); chosen->moby->state = 1; @@ -3036,9 +3038,9 @@ void FUN_L08_002e9758(struct Moby *moby) { if (candidate->moby != 0) { u8 *vector = candidate->moby->pvars; char *position = data; - FUN_L00_0025f090(moby, &candidate->moby->pos, -1, 2.0f, 13.0f); + cart_burst(moby, &candidate->moby->pos, -1, 2.0f, 13.0f); position += index * 16; - FUN_001f9a28(vector, &candidate->moby->pos, + fast_vec_sub(vector, &candidate->moby->pos, &(*(struct Moby **)(position + 0x64))->pos); normalize_vector_xyz(vector, vector, D_0015ED6C * 10.0f); candidate->moby->state = 1; diff --git a/src/overlays/l08/gameplay/entities/bomb.c b/src/overlays/l08/gameplay/entities/bomb.c index bf2ca6eda6..7ee9e3f1dc 100644 --- a/src/overlays/l08/gameplay/entities/bomb.c +++ b/src/overlays/l08/gameplay/entities/bomb.c @@ -83,7 +83,7 @@ typedef struct Hero_2B94B0 { extern f32 fast_add_rotations(f32, f32) __asm__("func_001FA580"); extern f32 fast_sin(f32) __asm__("func_001F9DE0"); extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float D_0015ED70; extern int D_0015ED84; extern char *D_L08_0015FFD8; @@ -265,7 +265,7 @@ typedef int OvlQuad_c __attribute__((mode(TI))); typedef struct { u8 pad0[0x18]; - s32 moby; /* 0x18: passed to FUN_002141f8 (reads moby+0x34, moby+0x78); 0 when no moby was hit */ + s32 moby; /* 0x18: passed to suck_get_aim_height (reads moby+0x34, moby+0x78); 0 when no moby was hit */ s32 unk1C; /* 0x1C: > 0 gates copying point and the normal into the hero (shared/ui/help/00226f10.c) */ union { OvlQuad_c q; @@ -273,7 +273,7 @@ typedef struct { } point; /* 0x20: f[2] is read as the ground height */ u8 pad30[0x10]; /* 0x30: position after push-out (copied into hero.motion.pos) */ f32 normal_x; /* 0x40: start of the surface normal; its angle is tested against 50 degrees (0.87266463) */ - f32 normal_y; /* 0x44: FUN_001f9e90 (atan2) of normal_x, normal_y is stored in the hero */ + f32 normal_y; /* 0x44: fast_arc_tan (atan2) of normal_x, normal_y is stored in the hero */ f32 normal_z; /* 0x48: ledge probes compare atan2(normal_z, xy length) with 20 degrees */ } CollisionHit_2d23f0; @@ -286,16 +286,16 @@ extern f32 fast_vec_length_c(void *) __asm__("func_001F9AF0"); extern f32 random_float_between_c5(f32, f32) __asm__("func_002132A8"); extern float fast_add_rotations_c(float, float) __asm__("func_001FA580"); extern float D_L08_00174660[]; -extern int FUN_001efa68(void *, void *, int, void *, int); -extern int FUN_L00_001f0d60(float, void *, int, void *); -extern int FUN_L00_001f2868(void *, float, int, void *, void *); +extern int collision_line(void *, void *, int, void *, int) __asm__("FUN_001efa68"); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); +extern int collect_mobies_in_sphere(void *, float, int, void *, void *) __asm__("FUN_L00_001f2868"); extern int allocate_voice_for_target_entry(int, int, void *) __asm__("FUN_0022da68"); extern int tick_countdown_32_alt(void *) __asm__("FUN_001f9740"); extern s32 random_integer_below_c3(s32) __asm__("func_00213260"); extern s32 scale_game_frames_c(s32) __asm__("func_001F96F8"); extern float D_L08_00161860 __attribute__((sda)); extern void FUN_L00_001ff660_c(void *, void *, void *) __asm__("FUN_L00_001ff660"); -extern void FUN_L00_00259fe8(void *, float); +extern void jet_animate(void *, float) __asm__("FUN_L00_00259fe8"); extern void FUN_L00_0025d458_c(void *, short *) __asm__("FUN_L00_0025d458"); extern void FUN_L00_0025d538_c(void *, void *) __asm__("FUN_L00_0025d538"); extern void FUN_L00_0025e450_c3(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); @@ -322,7 +322,7 @@ void FUN_L08_002d23f0(char *moby) { d = *(char **)(moby + 0x78); if (*(unsigned char *)(moby + 0x20) != 0x37) { - if (FUN_L00_001f0d60(0.5f, moby + 0x10, 0x11, moby)) { + if (coll_sphere(0.5f, moby + 0x10, 0x11, moby)) { int g = D_L08_001746D8_2B94B0i; if (g != 0 && (g != *(int *)(d + 0x30) || *(int *)(d + 0x24) != 0)) { if (!(*(unsigned char *)(moby + 0xBC) & 2)) *(unsigned char *)(moby + 0x20) = 0x62; else *(unsigned char *)(moby + 0x20) = 0x63; @@ -366,7 +366,7 @@ void FUN_L08_002d23f0(char *moby) { c.r.x.st = st; c.r.x.f = 1.0f; qcopy(c.r.x.v, d + 0x10); - if (FUN_001efa68(c.r.start, c.r.end, 0, moby, 0)) { + if (collision_line(c.r.start, c.r.end, 0, moby, 0)) { char *tbl = (char *)&D_L08_00174640; int v = *(int *)(tbl + 0x18); if (v != 0) { @@ -435,7 +435,7 @@ void FUN_L08_002d23f0(char *moby) { c.p.f = 1.0f; clear_u64_value(&c.p); c.p.st = 0; - FUN_L00_001f2868(moby + 0x10, 1.0f, 0x10, moby, &c.p); + collect_mobies_in_sphere(moby + 0x10, 1.0f, 0x10, moby, &c.p); FUN_L00_0025e450_c3(moby, D_L08_0015F580_macro, 0, 0.0f, 0.0f, 7, 10, 20, 3.0f, 1.7f, 4.0f, 1.0f, -1, 7.0f, 0, 7, -1, 0); mark_moby_for_removal(moby); return; @@ -448,13 +448,13 @@ void FUN_L08_002d23f0(char *moby) { c.p.f = 1.0f; clear_u64_value(&c.p); c.p.st = 0; - FUN_L00_001f2868(p, 1.0f, 0x10, moby, &c.p); + collect_mobies_in_sphere(p, 1.0f, 0x10, moby, &c.p); FUN_L00_0025f090_c(moby, p, -1, 0.5f, 13.0f); mark_moby_for_removal(moby); return; } } - FUN_L00_00259fe8(moby, 0.2f); + jet_animate(moby, 0.2f); } #ifndef NON_MATCHING INCLUDE_ASM("config/us/overlays/asm/FUN_L08_002d42d8.s", FUN_L08_002d42d8); @@ -474,7 +474,7 @@ extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); extern float moby_animation_frame(void *) __asm__("FUN_0020c9e0"); extern int moby_animation_crossed_frame(void *, float) __asm__("FUN_00214cc8"); extern int FUN_L00_0024f7c8(); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void FUN_L00_00203908(int, int); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); @@ -486,7 +486,8 @@ void FUN_L08_002d5d08_u(struct Moby *moby) __asm__("FUN_L08_002d5d08"); void FUN_L08_002d6450(struct Moby *moby); char *FUN_L08_002dc8a0(char *src, char *pos, char *vec); -void FUN_L08_002d42d8(struct Moby *moby) { +void bomber_tank_update(struct Moby *moby) __asm__("FUN_L08_002d42d8"); +void bomber_tank_update(struct Moby *moby) { float old_position[4], old_rotation[4], velocity[4], joint_pos[4]; char *data = (char *)moby->pvars; void *position = &moby->pos; @@ -668,7 +669,7 @@ void FUN_L08_002d42d8(struct Moby *moby) { goto finish; finish: subtract_vector_xyz(velocity, &moby->pos, old_position); - FUN_L00_00260738(data + 0x60, velocity, &moby->rot, old_rotation); + update_entity_matrix(data + 0x60, velocity, &moby->rot, old_rotation); } #endif /* Per-frame update of a batalia turret moby: damage, its death state and its two helper parts. */ @@ -724,16 +725,16 @@ extern int FUN_L00_001fff28(); extern int allocate_voice_for_target_entry_alt(int,int,void*) __asm__("FUN_0022da68"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern void *FUN_L00_0025a420(void*,int,int); -extern void FUN_L00_0025e450(void *,void *,void *,float,float,int,int,int,float,float,float,float,int,float,int,int,int,int); +extern void spawn_explosion(void *,void *,void *,float,float,int,int,int,float,float,float,float,int,float,int,int,int,int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_00263d40(int, int); extern void blend_moby_animation(void *, s32, s32, s32) __asm__("FUN_00212f90"); -float FUN_L00_0025be00(float *cur, float *vel, float target, float lim, float accel, float maxv); +float approach_angle(float *cur, float *vel, float target, float lim, float accel, float maxv) __asm__("FUN_L00_0025be00"); int FUN_L00_0025ff38(float best, char *a, char *o, int *excluded, int excluded_count, void *region, int region_count); s32 allocate_voice_for_bank_entry(s32 entry_index, s32 flags, s32 owner) __asm__("FUN_0022db10"); void *FUN_L00_00263fd8(char *src, int cls, float *pos, void *mat, int a8, int a9, float *v10, float *v11, float scale, float *v12); void FUN_L00_00257470(unsigned char *m, int flags, int arg); -void FUN_L00_0025d458(void *a, void *s); -void FUN_L00_0025d538(s32 id, void *s); +void trooper_anim_update(void *a, void *s) __asm__("FUN_L00_0025d458"); +void trooper_anim_finish(s32 id, void *s) __asm__("FUN_L00_0025d538"); extern int D_0015ED84; extern float D_0015ED70; extern float D_0015ED6C_lui __asm__("D_0015ED6C"); @@ -744,7 +745,7 @@ extern Path_2D5FA8 *D_L08_001B0FB0_2D5FA8[] __asm__("D_L08_001B0CB0"); extern s32 D_001413D0[]; extern unsigned char D_0013D50F_2D5FA8[] __asm__("D_0013D408"); extern Hit_2D5FA8 *find_2D5FA8(Moby *, int, int) __asm__("FUN_L00_0025a420"); -extern Hit_2D5FA8 *pick_2D5FA8(Hit_2D5FA8 *, Hit_2D5FA8 *, Hit_2D5FA8 *, int) __asm__("FUN_L05_002899f8"); +extern Hit_2D5FA8 *FUN_L05_002899f8_c(Hit_2D5FA8 *, Hit_2D5FA8 *, Hit_2D5FA8 *, int) __asm__("FUN_L05_002899f8"); extern int damage_2D5FA8(Moby *, Hit_2D5FA8 *, float *, int, int *, float *, int, int) __asm__("FUN_00213928"); extern int ticks_2D5FA8(int) __asm__("FUN_001f96f8"); extern void animate_2D5FA8(Moby *, int, int, int) __asm__("FUN_00212f90"); @@ -789,7 +790,7 @@ void FUN_L08_002d4ca0(Moby *moby) { } else { part_b_source = 0; } - source = pick_2D5FA8(source, part_a_source, part_b_source, 0); + source = FUN_L05_002899f8_c(source, part_a_source, part_b_source, 0); if (source != 0 && source->moby != 0) { short source_class = source->moby->oclass; if (source_class == 0x1A9 || source_class == 0x47) source = 0; @@ -1273,7 +1274,7 @@ extern f32 D_L08_0015F580[] __attribute__((section(".sdata"))); extern void FUN_L02_002a40d0(void *, float); extern void enqueue_callback_list_1(void *, void *) __asm__("FUN_001f4600"); extern void FUN_L08_002da0d0(void *); -extern int FUN_L00_0028d8c0(struct Moby *, int); +extern int voice_is_playing(struct Moby *, int) __asm__("FUN_L00_0028d8c0"); extern void release_voice_slot(int) __asm__("FUN_0022d798"); extern char *FUN_L00_002d7e90(void *, float); extern float random_angle_radians(void) __asm__("FUN_00213308"); @@ -1283,7 +1284,7 @@ extern int FUN_L00_00257b90(int, int); extern int random_integer_below(int) __asm__("FUN_00213260"); extern void FUN_L00_0026f548(void *, void *, int, int); extern void random_vector(float *, float, float) __asm__("FUN_L00_00257d78"); -extern unsigned char *FUN_L00_002718d0(void *, void *, void *, float, float); +extern unsigned char *spawn_splash(void *, void *, void *, float, float) __asm__("FUN_L00_002718d0"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); @@ -1306,7 +1307,7 @@ void FUN_L08_002da0f0(struct Moby *moby) { return; if (!(D_L08_001D7060[2] <= hero.motion.pos.f[2] - hero.motion.displacement.f[2])) return; - if (FUN_L00_0028d8c0(hero.moby, hero.health.unk22B2)) { + if (voice_is_playing(hero.moby, hero.health.unk22B2)) { release_voice_slot(hero.health.unk22B2); hero.health.unk22B2 = -1; } @@ -1331,7 +1332,7 @@ void FUN_L08_002da0f0(struct Moby *moby) { v.f[2] = D_L08_001D7060[2] + 0.05f; sc = random_float_between(0.7f, 1.0f); sp = i == 0 ? 2.0f : -2.0f; - q = FUN_L00_002718d0(&v, D_L08_0015F580, &D_L08_001D7060[2], sc, sp); + q = spawn_splash(&v, D_L08_0015F580, &D_L08_001D7060[2], sc, sp); if (q) *(short *)(q + 0xA) = truncate_float_to_s32(multiply_global_factor_ed64(random_float_between(30.0f, 60.0f))); } @@ -1521,7 +1522,7 @@ extern float D_L08_00161988_gp __asm__("D_L08_00161988") __attribute__((sda)); extern float D_L08_0016198C_gp __asm__("D_L08_0016198C") __attribute__((sda)); extern float D_L08_00161990_gp __asm__("D_L08_00161990") __attribute__((sda)); extern float D_L08_001675C0[]; -extern float FUN_001f96b0(float); +extern float FUN_L04_001f1978(float); extern float FUN_L00_0025abf0(void *, void *, void *, float, float); extern float fast_difference_between_rotations_c3(float, float) __asm__("func_001FA688"); extern float fast_vec_dist(void *, void *); @@ -1529,13 +1530,13 @@ extern float vector_distance_xy_alt(void *, void *) __asm__("FUN_001f9b80"); extern int D_L08_001619AC_gp __asm__("D_L08_001619AC") __attribute__((sda)); extern int D_L08_001619D0_gp __asm__("D_L08_001619D0") __attribute__((sda)); extern int FUN_L00_00259028(char *m, char *p, float *pos, char *v); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int FUN_L08_0026a3d0(void *, float, void *); extern s32 scale_game_frames_c2(s32) __asm__("func_001F96F8"); extern s32 truncate_float_to_s32_c4(f32) __asm__("func_001FA6D0"); extern void FUN_L00_00258278(void*,void*,float,float,float,float); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025c558(void *, void *, float, int, int, int); +extern void trooper_start_knockback(void *, void *, float, int, int, int) __asm__("FUN_L00_0025c558"); extern void FUN_L00_0025d458_c2(void *, short *) __asm__("FUN_L00_0025d458"); extern void FUN_L00_0025d538_c2(void *, void *) __asm__("FUN_L00_0025d538"); extern void FUN_L00_0025f730(void*,float); @@ -1556,7 +1557,8 @@ extern float FUN_0020c9e0(struct Moby *); extern void func_L00_002592B0_x(float, void *, void *, float, float, float) __asm__("FUN_L00_00258278"); extern char camera_state_bytes[] __asm__("D_L08_00167480"); -void FUN_L08_002dabf0(struct Moby *moby) { +void blarg_bombthrower_update(struct Moby *moby) __asm__("FUN_L08_002dabf0"); +void blarg_bombthrower_update(struct Moby *moby) { Data_DBF68 *vars = (Data_DBF68 *)moby->pvars; Look_DBF68 search; float point[4]; @@ -1604,7 +1606,7 @@ void FUN_L08_002dabf0(struct Moby *moby) { vars->f84 = 0.0005f; vars->bAD = 0; hero_bytes = (char *)&hero; - FUN_L00_0025c558(moby, vars->blk70, + trooper_start_knockback(moby, vars->blk70, fast_arc_tan_c2(moby->pos.x - *(float *)(hero_bytes + 0x80), moby->pos.y - *(float *)(hero_bytes + 0x84)), 6, 1, 0); @@ -1622,7 +1624,7 @@ void FUN_L08_002dabf0(struct Moby *moby) { vars->f8C = D_L08_00161990_gp * frame_time; vars->bAD = 0; hero_bytes = (char *)&hero; - FUN_L00_0025c558(moby, vars->blk70, + trooper_start_knockback(moby, vars->blk70, fast_arc_tan_c2(moby->pos.x - *(float *)(hero_bytes + 0x80), moby->pos.y - *(float *)(hero_bytes + 0x84)), 9, 1, 0); @@ -1783,7 +1785,7 @@ void FUN_L08_002dabf0(struct Moby *moby) { subtract_vector_xyz(aim, &target->pos, &moby->pos); aim[2] = 0.0f; distance = fast_vec_length_c2(aim); - time = distance / FUN_001f96b0(D_L08_0016197C_gp); + time = distance / FUN_L04_001f1978(D_L08_0016197C_gp); distance = distance - (D_L08_00161988_gp * time + 2.0f); if (10.0f < distance) { distance = 10.0f; @@ -1828,7 +1830,7 @@ void FUN_L08_002dabf0(struct Moby *moby) { case 0x5A: case 0x5C: case 0x5D: - if (FUN_L00_0025c698(moby, vars->blk70) & 0x40) { + if (mine_fall(moby, vars->blk70) & 0x40) { old_waypoint = vars->waypoint; if ((vars->waypoint = (struct Moby *)FUN_L08_002daa10_c((char *)moby)) == 0) { vars->waypoint = old_waypoint; @@ -1848,7 +1850,7 @@ void FUN_L08_002dabf0(struct Moby *moby) { } break; case 0x63: - if (FUN_L00_0025c698(moby, vars->blk70) & 0x40) { + if (mine_fall(moby, vars->blk70) & 0x40) { moby->anim_speed = 0.0f; moby->state = 100; moby->collision = 0; @@ -1866,7 +1868,7 @@ void FUN_L08_002dabf0(struct Moby *moby) { /* Pvars of the hero-carrying lift. */ typedef struct { u8 pad0[0x20]; - u8 motion[0x40]; /* 0x20: carried-moby motion state for FUN_L00_00260738 */ + u8 motion[0x40]; /* 0x20: carried-moby motion state for update_entity_matrix */ Vec4 home_pos; /* 0x60 */ Vec4 home_rot; /* 0x70 */ s32 path; /* 0x80: -1 when it has no path */ @@ -1900,7 +1902,7 @@ extern void attach_manipulator(void *, s32, void *) __asm__("FUN_0020cb10"); extern void FUN_L00_00259f50(void *, void *); extern void FUN_L00_00261d78(s32, float, void *, void *); extern f32 distance_xyz(void *, void *) __asm__("FUN_001f9b48"); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void FUN_L08_002dc4a0(struct Moby *); void FUN_L08_002dc0c8(struct Moby *moby); void FUN_L08_002dc180(struct Moby *moby); @@ -1910,7 +1912,8 @@ void FUN_L08_002dc7f0(struct Moby *moby); /* Lift update: runs the lift's state machine (0 setup, 2 carry the hero * when riding, 3 travel to the selected stop) and moves anything riding it * by how far it moved this frame. */ -void FUN_L08_002dbdb0(struct Moby *moby) { +void shuttle_update(struct Moby *moby) __asm__("FUN_L08_002dbdb0"); +void shuttle_update(struct Moby *moby) { LiftVars *vars = (LiftVars *)moby->pvars; Vec4 old_pos; Vec4 old_rot; @@ -1975,13 +1978,13 @@ void FUN_L08_002dbdb0(struct Moby *moby) { if (vars->stop != -1) FUN_L08_002dc0c8((char *)moby); subtract_vector_xyz(&delta, &moby->pos, &old_pos); - FUN_L00_00260738(vars->motion, &delta, &old_rot, &moby->rot); + update_entity_matrix(vars->motion, &delta, &old_rot, &moby->rot); } /* Ported from rac1-decomp (src/overlays/l08_batalia/vendor_002B9438.c: func_L08_002DD440), where it is exact; names translated to the US level program. */ extern char D_L08_001DB280[]; extern int D_L08_001B0CB0[]; -extern void FUN_001f9cf8(void *, void *, void *); +extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); void FUN_L08_002dc0c8(struct Moby *moby) { char *data = (char *)moby->pvars; @@ -1993,7 +1996,7 @@ void FUN_L08_002dc0c8(struct Moby *moby) { char *p = (char *)t + 0x10; int i; for (i = 7; i >= 0; i--) { - FUN_001f9cf8(p, q, mat); + transform_vector_by_basis(p, q, mat); q += 0x10; add_vector_xyz(p, p, pos); p += 0x10; @@ -2016,7 +2019,7 @@ typedef struct { float e[1][4]; } Route_2dd4f8; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern int D_L08_001B0CB0[]; #include "rnc/gameplay/state/game_globals.h" @@ -2067,7 +2070,7 @@ void FUN_L08_002dc180(struct Moby *moby) { *(Route_2dd4f8 **)(data + 0x120) = c; } else if (f94) { *(Route_2dd4f8 **)(data + 0x120) = b; - } else if (32.0f < FUN_001f9b80(&moby->pos, pl) || D_L08_0015F5CC < 5) { + } else if (32.0f < vector_distance(&moby->pos, pl) || D_L08_0015F5CC < 5) { moby->visible = 0; moby->flags |= 1; *(int *)(data + 0x124) = 0; @@ -2398,7 +2401,7 @@ extern int D_L08_00161A30 __attribute__((sda)); extern s32 truncate_float_to_s32_c2(f32) __asm__("func_001FA6D0"); extern unsigned int D_L08_0015FFDC __attribute__((section(".sdata"))); extern void FUN_L00_00258278(void*,void*,float,float,float,float); -extern void FUN_L00_0025f090(void*,void*,int,float,float); +extern void cart_burst(void*,void*,int,float,float) __asm__("FUN_L00_0025f090"); extern void FUN_L00_0025f730(void*,float); extern void FUN_L00_00262cf0(void*,void*,float,float,float); extern void FUN_L00_00269958(void*,void*,int,int,int,int,int,int); @@ -2410,12 +2413,13 @@ extern Route_2dd4f8_2dd3c0 *D_L08_001B0FB0_r_c[] __asm__("D_L08_001B0CB0"); extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); extern int timer46(int*) __asm__("FUN_001f9740"); +void FUN_L08_002dd3c0(M46 *moby); void FUN_L08_002dd3c0(M46 *moby) { V46 target,delta,accel,effect,aux; D46 *data=moby->data; if (FUN_L00_0025a420(moby,0x210000,0) && moby->state!=4) { allocate_voice_for_target_entry_alt(0,0,moby); - FUN_L00_0025f090(moby,moby->position,-1,0.5f,13.0f); + cart_burst(moby,moby->position,-1,0.5f,13.0f); mark_moby_for_removal(moby); return; } @@ -2441,7 +2445,7 @@ void FUN_L08_002dd3c0(M46 *moby) { moby->rotation[0]=fast_add_rotations(moby->rotation[0],D_0015ED6C*6.2831855f); qcopy(target,data->target->position); target[2]+=5.0f; yaw=fast_arc_tan(moby->position[0]-target[0],moby->position[1]-target[1]); - pitch=fast_arc_tan(FUN_001f9b80(target,moby->position),moby->position[2]-target[2]); + pitch=fast_arc_tan(vector_distance(target,moby->position),moby->position[2]-target[2]); FUN_L00_00262cf0(target,target,data->roll,data->yaw,data->pitch); subtract_vector_xyz(delta,target,moby->position); FUN_L00_0025f730(delta,target_data->speed*D_0015ED6C); @@ -2510,7 +2514,7 @@ void FUN_L08_002dd3c0(M46 *moby) { next=(route->waypoint+route->path->count+route->direction)%route->path->count; yaw=fast_arc_tan(*(float*)((char*)route->path+(next<<4)+0x10)-moby->position[0],*(float*)((char*)route->path+(next<<4)+0x14)-moby->position[1]); FUN_L00_00258278(moby,&data->yaw_velocity,yaw,0.1f,1.3f,1.0f); - moby->rotation[1]=fast_arc_tan(FUN_001f9b80(route->path->e[next],moby->position),moby->position[2]-route->path->e[next][2]); + moby->rotation[1]=fast_arc_tan(vector_distance(route->path->e[next],moby->position),moby->position[2]-route->path->e[next][2]); qcopy_nc(target,route->path->e[next]); if (route->waypoint!=route->path->count-1) { int life0,life1,size1; @@ -2571,7 +2575,7 @@ void FUN_L08_002dd3c0(M46 *moby) { } } else if ((short)cls==0x1A8) { special=1; clear_u64_value(accel); - FUN_L00_0025e450(other,accel,other->position,0.0f,0.0f,50,60,60,12.0f,8.0f,9.0f,1.0f,-1,15.0f,1,1,-1,0); + spawn_explosion(other,accel,other->position,0.0f,0.0f,50,60,60,12.0f,8.0f,9.0f,1.0f,-1,15.0f,1,1,-1,0); mark_moby_for_removal(other); } } @@ -2595,7 +2599,7 @@ void FUN_L08_002dd3c0(M46 *moby) { if (FUN_L08_002025d0(moby->position,0x400,2,moby,0) || moby->position[0]<5.0f || moby->position[0]>500.0f || moby->position[1]<5.0f || moby->position[1]>500.0f || moby->position[2]<5.0f || moby->position[2]>500.0f || distance_xyz_c(D_0013F3D0,moby->position)<16.0f) moby->state=6; return; case 6: - if (D_L08_0015FFDC<(unsigned int)moby) FUN_L00_0025e450(moby,data->velocity,moby->position,0.0f,0.0f,15,10,10,3.0f,2.0f,9.0f,1.0f,-1,15.0f,1,1,-1,0); + if (D_L08_0015FFDC<(unsigned int)moby) spawn_explosion(moby,data->velocity,moby->position,0.0f,0.0f,15,10,10,3.0f,2.0f,9.0f,1.0f,-1,15.0f,1,1,-1,0); mark_moby_for_removal(moby); break; default: break; @@ -2603,9 +2607,9 @@ void FUN_L08_002dd3c0(M46 *moby) { } extern struct Moby *create_moby(s32) __asm__("FUN_0020c4f8"); extern float D_L08_001675C0[]; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern void FUN_L00_002502f0(void *, int, int, int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); extern int D_L08_00161A34 __attribute__((sda)); extern int D_L08_00161A38 __attribute__((sda)); extern int D_L08_00161A3C __attribute__((sda)); @@ -2623,7 +2627,7 @@ struct Moby *FUN_L08_002de3e0(void *pos, struct Moby *target, void *velocity, fl data = (char *)moby->pvars; qcopy(&moby->pos, pos); reference = D_L08_001675C0; - distance = FUN_001f9b80(reference, &moby->pos); + distance = vector_distance(reference, &moby->pos); reference = (float *)((char *)reference - 0x140); moby->rot.y = -fast_arc_tan(distance, reference[82] - moby->pos.z); *(volatile float *)&moby->rot.z = fast_arc_tan(reference[80] - moby->pos.x, @@ -2635,7 +2639,7 @@ struct Moby *FUN_L08_002de3e0(void *pos, struct Moby *target, void *velocity, fl *(volatile u8 *)&moby->state = 1; moby->draw_dist = 0xFF; moby->scale = scale; - FUN_L00_002502f0(moby, D_L08_00161A34, D_L08_00161A38, D_L08_00161A3C); + set_moby_color(moby, D_L08_00161A34, D_L08_00161A38, D_L08_00161A3C); *(float *)(data + 0x40) = pitch; *(float *)(data + 0x48) = 70.0f; *(float *)(data + 0x44) = yaw; @@ -2712,7 +2716,7 @@ extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern float D_L08_00161A44 __attribute__((sda)); extern unsigned char D_0013D408[]; extern void *find_moby_hit(void*,int,int) __asm__("FUN_L00_0025a420"); -extern void FUN_L00_0025e450(void *,void *,void *,float,float,int,int,int,float,float,float,float,int,float,int,int,int,int); +extern void spawn_explosion(void *,void *,void *,float,float,int,int,int,float,float,float,float,int,float,int,int,int,int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_00263d40(int, int); extern void FUN_L08_002dec90_c(char *m, char *pos) __asm__("FUN_L08_002dec90"); s32 allocate_voice_for_bank_entry(s32 entry_index, s32 flags, s32 owner) __asm__("FUN_0022db10"); @@ -2769,7 +2773,7 @@ void FUN_L08_002de848(char *m) { return; } if (coll_sphere(1.25f, pos, 0, m)) { - FUN_L00_0025e450(m, v, pos, 0.0f, 0.0f, 0x14, 0x28, 0x10, c10, 5.0f, 9.0f, 1.0f, -1, c15, 1, 1, -1, 0); + spawn_explosion(m, v, pos, 0.0f, 0.0f, 0x14, 0x28, 0x10, c10, 5.0f, 9.0f, 1.0f, -1, c15, 1, 1, -1, 0); mark_moby_for_removal(m); return; } @@ -2792,7 +2796,7 @@ void FUN_L08_002de848(char *m) { subtract_vector_xyz(b, m + 0x10, a); qcopy(d + 0x10, b); *(float *)(d + 0x18) = *(float *)(d + 0x18) + (D_0015ED6C + D_0015ED6C); - FUN_L00_0025e450(m, b, m + 0x10, 0.0f, 0.0f, 0x14, 0x28, 0x10, 10.0f, 5.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, -1, 0); + spawn_explosion(m, b, m + 0x10, 0.0f, 0.0f, 0x14, 0x28, 0x10, 10.0f, 5.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, -1, 0); m[0x20] = 2; } *(unsigned char *)(m + 0xA4) = 0xFF; diff --git a/src/overlays/l08/gameplay/entities/commando.c b/src/overlays/l08/gameplay/entities/commando.c index c8ea223777..f7dab45230 100644 --- a/src/overlays/l08/gameplay/entities/commando.c +++ b/src/overlays/l08/gameplay/entities/commando.c @@ -31,7 +31,7 @@ extern f32 D_L08_00161D34 __attribute__((sda)); extern SwarmPath *D_L08_001B0CB0[]; extern struct Moby *D_L08_0015FFD8; -extern s32 FUN_L00_0028d8c0(struct Moby *, s32); +extern s32 voice_is_playing(struct Moby *, s32) __asm__("FUN_L00_0028d8c0"); extern s32 allocate_voice_for_target_entry(s32, s32, struct Moby *) __asm__("FUN_0022da68"); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern f32 random_float_between(f32, f32) __asm__("FUN_002132a8"); @@ -49,7 +49,7 @@ extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void subtract_vector_xyz(void *, void *, void *); extern void moby_point_position(void *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern void FUN_L00_00258278(struct Moby *, f32, f32 *, f32, f32, f32); -extern void FUN_L00_0025f090(void *, void *, s32, f32, f32); +extern void cart_burst(void *, void *, s32, f32, f32) __asm__("FUN_L00_0025f090"); extern struct Moby *FUN_L08_002de3e0(void *, struct Moby *, void *, f32, f32); extern void FUN_L08_002e9558(struct Moby *); extern void FUN_L08_002e9758(struct Moby *); @@ -81,7 +81,7 @@ void FUN_L08_002e9b70(struct Moby *moby) { if (D_L08_00161D40 != 0) { return; } - if (!FUN_L00_0028d8c0(moby, vars->sound)) { + if (!voice_is_playing(moby, vars->sound)) { vars->sound = allocate_voice_for_target_entry(3, 4, moby); } switch (moby->state) { @@ -196,14 +196,14 @@ void FUN_L08_002e9b70(struct Moby *moby) { struct Moby *part = vars->parts[i].moby; if (part != NULL) { Vec4 *drift = (Vec4 *)part->pvars; - FUN_L00_0025f090(moby, &part->pos, -1, 3.0f, 13.0f); + cart_burst(moby, &part->pos, -1, 3.0f, 13.0f); subtract_vector_xyz(drift, &part->pos, &moby->pos); normalize_vector_xyz(drift, drift, frame_time * 5.0f); part->state = 1; vars->parts[i].moby = NULL; } } - FUN_L00_0025f090(moby, &moby->pos, -1, 5.0f, 13.0f); + cart_burst(moby, &moby->pos, -1, 5.0f, 13.0f); mark_moby_for_removal(moby); break; } @@ -263,7 +263,7 @@ extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); -extern void FUN_L01_002a1968(s32, s32); +extern void vendor_volume(s32, s32) __asm__("FUN_L01_002a1968"); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); /* Swings the gate to its driver's progress, fading a creak in while it @@ -296,20 +296,20 @@ void FUN_L08_002ea4c0(struct Moby *moby) { if (fast_difference_between_rotations(moby->rot.y, yaw) != 0.0f) { moby->rot.y = yaw; if (moby->oclass == 0x1D4) { - if (!FUN_L00_0028d8c0(moby, vars->voice)) { + if (!voice_is_playing(moby, vars->voice)) { vars->voice = allocate_voice_for_target_entry(0, 4, moby); - FUN_L01_002a1968(vars->voice, 1); + vendor_volume(vars->voice, 1); } else if (((VoiceView *)(D_0013E550 + vars->voice * 0x70))->volume < 0x400) { - FUN_L01_002a1968(vars->voice, ((VoiceView *)(D_0013E550 + vars->voice * 0x70))->volume + + vendor_volume(vars->voice, ((VoiceView *)(D_0013E550 + vars->voice * 0x70))->volume + 0x400 / scale_game_frames(60)); } } - } else if (moby->oclass == 0x1D4 && FUN_L00_0028d8c0(moby, vars->voice)) { + } else if (moby->oclass == 0x1D4 && voice_is_playing(moby, vars->voice)) { if (((VoiceView *)(D_0013E550 + vars->voice * 0x70))->volume < 0x100) { release_voice_slot(vars->voice); vars->voice = -1; } else { - FUN_L01_002a1968(vars->voice, ((VoiceView *)(D_0013E550 + vars->voice * 0x70))->volume - + vendor_volume(vars->voice, ((VoiceView *)(D_0013E550 + vars->voice * 0x70))->volume - 0x400 / scale_game_frames(60)); } } @@ -320,7 +320,7 @@ void FUN_L08_002ea4c0(struct Moby *moby) { D_0013D388[vars->flag + 0x30] = 1; moby->state = 2; allocate_voice_for_target_entry(1, 0, moby); - if (moby->oclass == 0x1D4 && FUN_L00_0028d8c0(moby, vars->voice)) + if (moby->oclass == 0x1D4 && voice_is_playing(moby, vars->voice)) release_voice_slot(vars->voice); } } @@ -383,7 +383,7 @@ extern float D_L08_00161DC8; extern float D_L08_00161DCC; extern float vector_length_xyz(void *); extern int D_L08_00161E08; -extern int FUN_001fa728(char *, float); +extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern int truncate_float_to_s32() __asm__("FUN_001fa6d0"); extern short D_L08_00161DC0 __attribute__((sda)); extern short D_L08_00161E04 __attribute__((sda)); @@ -434,7 +434,7 @@ void FUN_L08_002f1548(struct Moby *moby) { v[1] = D_L08_00161DC4; v[2] = D_L08_00161DC8; v[3] = D_L08_00161DCC; - if (FUN_001fa728((char *)v, 1000.0f) >= 0) { + if (fast_bsphere_check((char *)v, 1000.0f) >= 0) { w[0] = *(float *)&D_L08_00161DC0; w[1] = D_L08_00161DC4; w[2] = D_L08_00161DC8; @@ -653,8 +653,8 @@ extern s32 D_L08_0015F3F8_gp __asm__("D_L08_0015f3f8") __attribute__((sda)); extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern f32 square_root(f32) __asm__("FUN_001f9988"); -extern f32 FUN_L00_0025e310(f32); -extern f32 FUN_L00_00200228(f32, void *) __asm__("FUN_L00_00200228"); +extern f32 normalize_angle(f32) __asm__("FUN_L00_0025e310"); +extern f32 split_float_fraction(f32, void *) __asm__("FUN_L00_00200228"); extern s32 tick_countdown_16(s16 *) __asm__("FUN_001f9770"); extern s32 random_integer_between(s32, s32) __asm__("FUN_L00_00257b90"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); @@ -798,7 +798,7 @@ void FUN_L08_002f5e58(struct Moby *m) { for (j = 0; j <= b[8]; j++) { f32 a, c, t, base, angle, shape; x = convert_integer_to_float(j) / convert_integer_to_float(b[8]); - a = FUN_L00_0025e310(f[0x17] * time); + a = normalize_angle(f[0x17] * time); angle = x * 3.1415927f; c = fast_sin(a); t = f[0x16] * c; @@ -806,8 +806,8 @@ void FUN_L08_002f5e58(struct Moby *m) { noise_x = FUN_L08_002f5d98(x, (char *)d); base = base + (noise_x * f[0x34] + noise_y * f[0x35] + bend * f[0x36]); shape = height_a * x + height_b * (1.0f-x); - a = FUN_L00_0025e310(base + phase_a + f[0xb] * x + f[0xd] * y); - c = FUN_L00_0025e310(base + phase_b + f[0xc] * y + f[0xe] * x); + a = normalize_angle(base + phase_a + f[0xb] * x + f[0xd] * y); + c = normalize_angle(base + phase_b + f[0xc] * y + f[0xe] * x); sine = square_root(fast_sin(angle)); shape = shape * sine; shape = shape * (1.0f-y); @@ -817,8 +817,8 @@ void FUN_L08_002f5e58(struct Moby *m) { normalize_vector_xyz(&offset, &down[0], amp_b * t * sine * noise_x); a = fast_sin(y * 3.1415927f); c = fast_sin(angle); - t = fast_sin(FUN_L00_0025e310(base + f[0xb] * x)); - base = fast_sin(FUN_L00_0025e310(base + f[0xd] * y)); + t = fast_sin(normalize_angle(base + f[0xb] * x)); + base = fast_sin(normalize_angle(base + f[0xd] * y)); normalize_vector_xyz(&wave, &normal, a * c * (f[0x1e] * t + f[0x1f] * base)); normalize_vector_xyz(&sag, &down[0], shape); add_vector_xyz(&position, &velocity, &offset); @@ -840,8 +840,8 @@ void FUN_L08_002f5e58(struct Moby *m) { f32 a; s32 count; f32 *weight; - a = fast_sin(FUN_L00_0025e310(time * f[0x12])); - a = FUN_L00_00200228(time*f[0x10] + f[0x11]*a, &temp); + a = fast_sin(normalize_angle(time * f[0x12])); + a = split_float_fraction(time*f[0x10] + f[0x11]*a, &temp); count = 0; if (count <= b[8]) { weight = u; @@ -851,8 +851,8 @@ void FUN_L08_002f5e58(struct Moby *m) { count++; } while (count <= b[8]); } - a = fast_sin(FUN_L00_0025e310(time * f[0x15])); - a = FUN_L00_00200228(time*f[0x13] + f[0x14]*a, &temp); + a = fast_sin(normalize_angle(time * f[0x15])); + a = split_float_fraction(time*f[0x13] + f[0x14]*a, &temp); count = 0; if (count <= b[9]) { weight = v; @@ -1032,7 +1032,7 @@ void FUN_L08_002f70a0(struct Moby *m) { } pos.q = *(u128 *)at; pos.f[3] = convert_integer_to_float(d->radius); - if ((m->visible != 0 || FUN_001fa728((char *)&pos, 255.0f) != -1) && !hidden) { + if ((m->visible != 0 || fast_bsphere_check((char *)&pos, 255.0f) != -1) && !hidden) { enqueue_callback_list_1(FUN_L08_002f5e58, m); if (d->flags & 4) { if (d->light == -1) { @@ -1099,13 +1099,13 @@ typedef struct { char pad7C[3]; unsigned char b7F; } WM; -extern void FUN_L01_002783a8(void *, float); +extern void begin_dialogue_camera_transition(void *, float) __asm__("FUN_L01_002783a8"); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern void memcard_save_data(int, int) __asm__("FUN_0020b178"); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float FUN_001f9e90_cf(float, float) __asm__("FUN_001fa688"); extern float FUN_001fa688_cf(float, float) __asm__("FUN_001f9e90"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); @@ -1113,11 +1113,11 @@ extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float truncate_float_to_s32_cf(float, float) __asm__("FUN_002132a8"); extern float vector_length_xy(void *); extern float vector_length_xyz_c(void *) __asm__("vector_length_xyz"); -extern int FUN_L00_00266448(void *, void *); -extern int FUN_L00_002668a0(void *, void *); +extern int update_npc_dialogue(void *, void *) __asm__("FUN_L00_00266448"); +extern int initialize_npc_dialogue(void *, void *) __asm__("FUN_L00_002668a0"); extern int random_float_between_cf(float) __asm__("FUN_001fa6d0"); extern int tick_countdown_32(int *); -extern void FUN_L00_002628d8(float, float, void *, void *, int); +extern void update_joint_animation(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); extern void subtract_vector_xyz_c(void *, void *, void *) __asm__("subtract_vector_xyz"); extern L16WatchPlayer D_0013E633_watch __asm__("D_0013E533"); typedef struct { @@ -1151,18 +1151,19 @@ extern char D_L08_001621E0[]; extern int D_L08_001621D8 __attribute__((sda)); extern char *D_L08_001600EC; extern void FUN_L00_00262d38(int); -extern void FUN_L00_00284e50(void *, void *); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern float D_L08_001675C0_c[] __asm__("D_L08_001675C0"); extern void FUN_L08_00305138_c(void *) __asm__("FUN_L02_002e0cd8"); extern void FUN_L00_0025a120(void *); extern float FUN_001f9b48(void *, void *); -extern void FUN_L00_002502a0(int); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); extern void unlock_planet(int) __asm__("FUN_L00_002607d0"); extern int random_integer_below(int) __asm__("FUN_00213260"); extern void build_spherical_offset(void *, float, float, float) __asm__("FUN_00214db0"); -/* Watcher update, same routine as FUN_L08_00305270 with two more states and the joint pose copy. */ -void FUN_L08_00302ce8(WM *m) { +/* Watcher update, same routine as batalia_deserter_update with two more states and the joint pose copy. */ +void commando_update(WM *m) __asm__("FUN_L08_00302ce8"); +void commando_update(WM *m) { L16WatchScratch scratch; WD8 *d = (WD8 *)m->data; float rate; @@ -1195,10 +1196,10 @@ void FUN_L08_00302ce8(WM *m) { qcopy((char *)m + 0x40, b + j * 0x80 + 0x70); m->state = 2; } - FUN_L00_002668a0(m, (char *)d + 0x20); + initialize_npc_dialogue(m, (char *)d + 0x20); break; case 1: - if (FUN_L00_00266448(m, (char *)d + 0x20)) { + if (update_npc_dialogue(m, (char *)d + 0x20)) { char *b = D_L08_001600EC; int j = d->joint; qcopy(m->position, b + j * 0x80 + 0x30); @@ -1212,9 +1213,9 @@ void FUN_L08_00302ce8(WM *m) { if (m->animation != random_integer_below(2) + 1) blend_moby_animation(m, random_integer_below(2) + 1, 0, scale_game_frames(20)); } - if (FUN_L00_00266448(m, (char *)d + 0x20)) { + if (update_npc_dialogue(m, (char *)d + 0x20)) { m->state = 3; - FUN_L01_002783a8(m, 2.2f); + begin_dialogue_camera_transition(m, 2.2f); } break; case 3: @@ -1223,8 +1224,8 @@ void FUN_L08_00302ce8(WM *m) { if (d->h24 == 3) { unlock_planet(10); FUN_L00_00262d38(10); - FUN_L00_002502a0(((unsigned char *)m)[0xB0]); - FUN_L00_00284e50((char *)&D_0013E633_watch + 0xE9D, (char *)&D_0013E633_watch + 0xEAD); + jet_clear_persistent(((unsigned char *)m)[0xB0]); + jet_reset_camera((char *)&D_0013E633_watch + 0xE9D, (char *)&D_0013E633_watch + 0xEAD); memcard_save_data(0, -1); mark_moby_for_removal(m); return; @@ -1239,7 +1240,7 @@ void FUN_L08_00302ce8(WM *m) { if (m->animation == 1) { char *player = (char *)&D_0013E633_watch + 0xE9D; tracking = 1; - if (FUN_001f9b80(m->position, player) < 8.0f && + if (vector_distance(m->position, player) < 8.0f && FUN_001f9e90_cf( m->yaw, FUN_001fa688_cf(((L16WatchPlayer *)((char *)&D_0013E633_watch + 0xE1D))->aim[0] - @@ -1294,6 +1295,6 @@ void FUN_L08_00302ce8(WM *m) { } if (big_head_cheat_enabled) d->height = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); } diff --git a/src/overlays/l08/gameplay/hero/0021d9c0.c b/src/overlays/l08/gameplay/hero/0021d9c0.c index 6022eb2ac0..d8a94f72e9 100644 --- a/src/overlays/l08/gameplay/hero/0021d9c0.c +++ b/src/overlays/l08/gameplay/hero/0021d9c0.c @@ -15,7 +15,7 @@ /* Ported from rac1-decomp (src/overlays/l08_batalia/help_0021DFB8.c: func_L08_0021DFB8), where it is exact; names translated to the US level program. */ -extern int FUN_001f0b58(void); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern void fast_mem_zero16(void *, int) __asm__("FUN_001f9810"); extern void FUN_L00_0020b930(void); @@ -65,7 +65,7 @@ void FUN_L08_0021d9c0(void) { struct Hero *q = &hero; if (q->state.current != 0x7B) { if (coll_sphere(q->unk234 + 0.03f, &q->motion.unkD0, 2, 0)) { - if (FUN_001f0b58() == 0xB) { + if (collision_hit_material() == 0xB) { hero_set_state(0x7B, 1); return; } @@ -260,7 +260,7 @@ extern void FUN_L00_00217118(f32, f32); extern void stick_target(f32, s32) __asm__("FUN_L00_002118c8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void turn_to(s32, f32, f32, f32) __asm__("FUN_L00_00211e30"); -extern s32 FUN_001f9740(void *); +extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 FUN_L00_00229a98(void); extern void FUN_L00_00211e98(void); @@ -297,10 +297,10 @@ extern u8 D_L08_0017C7C0[]; extern void FUN_L00_00216e48(s32, struct MobyView *, s32); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); -extern s32 FUN_001f9770(s16 *); +extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); extern void FUN_L00_00209a40(s32, s32); extern void FUN_L00_00209ca8(s32, s32, s32); -extern void FUN_L00_002a3ec8(s32, s32, s32, f32, f32, f32, f32); +extern void pool_splash(s32, s32, s32, f32, f32, f32, f32) __asm__("FUN_L00_002a3ec8"); extern f32 FUN_L00_0025bc98(f32 *, f32, f32 *, s32, f32, f32, f32); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); @@ -314,7 +314,7 @@ extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 FUN_L00_00209018(void *, s32); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern void FUN_L00_0020a1e0(f32, f32); @@ -338,21 +338,21 @@ extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern s32 FUN_L00_002595a0(f32 *, f32 *, f32, f32, f32); extern void FUN_L00_0025bc00(f32 *, s32, f32, f32); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern f32 square_root(f32) __asm__("FUN_001f9988"); -extern f32 FUN_L00_00233a78(void *); -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); -extern f32 FUN_L00_00213350(void *); +extern f32 gravity_z(void *) __asm__("FUN_L00_00233a78"); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); +extern f32 forward_component(void *) __asm__("FUN_L00_00213350"); extern struct HeroTableRow2C D_L08_0017C428[]; extern struct LevelTable_QS D_L08_00167480; #define Q D_L08_00167480 extern void FUN_L00_00233ba0(void *, void *, f32); -extern void FUN_L00_00233b20(void *, void *, f32); +extern void gravity_set_z(void *, void *, f32) __asm__("FUN_L00_00233b20"); extern void FUN_L00_002336e8(void *, void *, f32); extern void make_hit_descriptor(void *, struct MobyView *, s32, f32, void *) __asm__("FUN_L00_00259888"); extern s32 collect_mobies_in_sphere(f32, void *, s32, struct MobyView *, void *) __asm__("FUN_L00_001f2868"); @@ -363,8 +363,8 @@ extern void FUN_L00_001ff290(void *, void *, void *); extern void FUN_L00_002a9b80(struct MobyView *, void *); extern s32 FUN_L00_002a96f8(struct MobyView *, void *, f32, f32, s32, f32, f32, f32); extern void FUN_L00_002335c8(void *, f32, f32, f32); -extern s32 FUN_L00_002598b0(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32); -extern f32 FUN_001f9ab0(void *, void *); +extern s32 play_entity_sound(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32) __asm__("FUN_L00_002598b0"); +extern f32 fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); struct PlayerSpeedTuning { u8 pad0[8]; f32 x08; @@ -376,14 +376,14 @@ extern struct PlayerSpeedTuning D_L08_0017C5B8; extern s32 FUN_L00_00216de8(s32, s32); extern void FUN_L00_00233708(void *, void *, f32); extern void FUN_L00_00233810(void *, void *, f32); -extern s32 FUN_001efa68(void *, void *, s32, struct MobyView *, s32); +extern s32 collision_line(void *, void *, s32, struct MobyView *, s32) __asm__("FUN_001efa68"); extern void FUN_L00_00215340(void); extern void FUN_L00_00233660(void *, f32, f32, f32); extern s32 FUN_L00_0025e3b8(s32); -extern void FUN_L00_00259bc8(s32, struct MobyView *, s32, void *, void *, f32); +extern void spawn_nearby_effect(s32, struct MobyView *, s32, void *, void *, f32) __asm__("FUN_L00_00259bc8"); extern s32 D_L08_00178700[]; extern void FUN_L00_00209ec8(void); -extern void FUN_L00_002338d0(void *, void *); +extern void gravity_flatten(void *, void *) __asm__("FUN_L00_002338d0"); extern s32 hero_slot_item_id(s32) __asm__("FUN_L00_0020d498"); extern void FUN_L00_0020b5b8(void); extern void FUN_L01_0022d090(void); @@ -396,7 +396,7 @@ extern void FUN_L00_0020d2f8(void *); extern f32 randf_sym(f32, f32) __asm__("FUN_L00_00257c48"); extern void FUN_L00_0026d598(void *, void *, s32); extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); -extern s32 FUN_L00_0025d808(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); +extern s32 sample_path(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); extern s32 FUN_L00_0025d7a0(void *, s32, s32, s32); extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); extern void hero_integrate_velocity(void) __asm__("FUN_L00_00214108"); @@ -457,7 +457,7 @@ void FUN_L08_002284e0(void) { transform_vector_by_basis(&hero.motion.unk170, &v0, &D_L08_001675D8[0x1F8]); hero.motion.move_yaw = *(f32 *)D_L08_001675D8; turn_to(0, frame_scale_sq, frame_scale_sq * 0.0f, frame_time * 174.53293f); - if (D_L08_0015F688 > 0 && FUN_001f9740(&D_L08_0015F688) != 0) { + if (D_L08_0015F688 > 0 && fast_dec_timer(&D_L08_0015F688) != 0) { s32 t; if (usage_stats.stat[18].count < 0xFFFF) { usage_stats.stat[18].count++; @@ -613,7 +613,7 @@ void FUN_L08_002284e0(void) { } if (hero.unk90A != 0) { s32 n; - FUN_001f9770(&hero.unk90A); + fast_dec_timer_s16(&hero.unk90A); n = (s16)hero.unk90A >> 2; FUN_L00_00209a40(n > 8 ? 8 : n, 0); } @@ -627,7 +627,7 @@ void FUN_L08_002284e0(void) { if (hero.state_timer == 1) { FUN_L00_00209ca8(3, 0x10, 0); if (D_L08_001612D0 != 0) { - FUN_L00_002a3ec8(D_L08_001612D0, D_L08_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L08_001612D0, D_L08_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, -0.3f); } hero.unk90A = scale_game_frames(70); @@ -738,7 +738,7 @@ void FUN_L08_002284e0(void) { stick_target(1.0f, 0); turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); hero.unk8EC = hero.motion.unk184; - FUN_001f9740(&hero.unk8F4); + fast_dec_timer(&hero.unk8F4); if (hero.state.step == 1) { hero.target_speed = frame_time * 6.0f; } else if (hero.state.current == 0x35) { @@ -768,7 +768,7 @@ void FUN_L08_002284e0(void) { if (hero.state.current != 0x35 || !(PD.u1A0.i1A0 & 0xA)) { hero.target_speed *= k; }; - if (FUN_001f9740(&hero.unk8F0) != 0) { + if (fast_dec_timer(&hero.unk8F0) != 0) { s32 lo2; s32 hi2; pl = &hero; @@ -791,7 +791,7 @@ void FUN_L08_002284e0(void) { } pl->unk8F0 = random_int_between(lo2, scale_game_frames(hi2)); } - if (hero.state.current == 0x35 && FUN_001f9770(&hero.unk8F8) != 0) { + if (hero.state.current == 0x35 && fast_dec_timer_s16(&hero.unk8F8) != 0) { struct MobyView *gm = MV(hero.items[3].moby); if (gm != NULL && gm->hA6 == 0x261) { s32 i; @@ -829,7 +829,7 @@ void FUN_L08_002284e0(void) { } build_spherical_offset(&hero.motion.velocity, sp, hero.motion.rot.f[2], yaw); } else if (hero.state.current == 0x34) { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); if (hero.state.prev == 0x35) { approach_value(&len, 0.0f, frame_time_sq * 8.0f); } else { @@ -877,11 +877,11 @@ void FUN_L08_002284e0(void) { break; case 0x6A: case 0x82: { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); approach_value(&len, 0.0f, frame_time_sq * 4.0f); fast_vec_normalize(&hero.motion.unk150, &hero.motion.unk150, len); qcopy(&hero.motion.velocity, &hero.motion.unk150); - if (FUN_001f9740(&hero.unk8F0) == 2) { + if (fast_dec_timer(&hero.unk8F0) == 2) { moby_point_position(MV(hero.moby), 4, &v0); v20.q = 0; v20.f[0] = 0.4f; @@ -928,7 +928,7 @@ void FUN_L08_002284e0(void) { } } turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); - FUN_001f9740(&hero.unk698); + fast_dec_timer(&hero.unk698); if (hero.state.current == 0x36) { if (PD.i1D4 != 0 && hero.unk698 != 0) { hero.target_speed = frame_time * 3.0f; @@ -1032,7 +1032,7 @@ void FUN_L08_002284e0(void) { FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, 0.0f, frame_time * 3.8397243f); } else { f32 an = fast_add_rotations( - -fast_arc_tan(FUN_001f9b80(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); + -fast_arc_tan(vector_distance(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, an, frame_time * 6.4577184f); } v20.f[0] = fast_cos(fast_add_rotations(hero.motion.rot.f[2], -1.5707964f)) * -0.57f; @@ -1116,14 +1116,14 @@ void FUN_L08_002284e0(void) { } if (hero.unk99C != 0) { f32 s; - if (FUN_001f9b80(&hero.motion.pos, &MV(hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { + if (vector_distance(&hero.motion.pos, &MV(hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.displacement, frame_time_sq * 40.0f); - if (hero.unk9BE != 0 && FUN_L00_00233a78(&hero.motion.velocity) > 0.0f) { + if (hero.unk9BE != 0 && gravity_z(&hero.motion.velocity) > 0.0f) { subtract_vector_xyz(&v30, &hero.motion.pos, &MV(hero.unk994)->u10.v10); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 57.0f); } } - s = FUN_001f9af0(&hero.motion.velocity) * (frame_time * 0.015f); + s = fast_vec_length(&hero.motion.velocity) * (frame_time * 0.015f); fast_vec_scale(&v30, &hero.motion.velocity, -1.0f); fast_vec_normalize(&v30, &v30, s); add_vector_xyz(&hero.motion.velocity, &hero.motion.velocity, &v30); @@ -1131,7 +1131,7 @@ void FUN_L08_002284e0(void) { { struct MobyView *r; if (MV(hero.unk994) != NULL && (r = MV(hero.unk994)->pm78) != NULL) { - f32 len = FUN_001f9af0(&hero.motion.velocity); + f32 len = fast_vec_length(&hero.motion.velocity); if (r->fC < len) { approach_value(&len, r->fC, frame_time_sq * 15.0f); fast_vec_normalize(&hero.motion.velocity, &hero.motion.velocity, len); @@ -1152,9 +1152,9 @@ void FUN_L08_002284e0(void) { add_vector_xyz(&v30, &MV(hero.unk994)->u10.v10, &vC0); subtract_vector_xyz(&hero.motion.velocity, &v30, &vD0); old = hero.unk9A4; - FUN_L00_0025b8c0(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); + vendor_spring(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); d = hero.unk9A4 - old; - if (FUN_001f9af0(&vC0) > hero.unk9A4) { + if (fast_vec_length(&vC0) > hero.unk9A4) { fast_vec_normalize(&vC0, &vC0, d); add_vector_xyz(&hero.motion.pos, &hero.motion.pos, &vC0); } @@ -1163,7 +1163,7 @@ void FUN_L08_002284e0(void) { f32 mx = frame_time * 14.0f; f32 sp = vector_length_xy(&hero.motion.velocity); if (sp < mx) { - FUN_L00_0025b8c0(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); + vendor_spring(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); v30.f[0] = fast_cos(hero.unk9AC) * hero.unk9B4; v30.f[1] = fast_sin(hero.unk9AC) * hero.unk9B4; v30.f[2] = 0.0f; @@ -1180,7 +1180,7 @@ void FUN_L08_002284e0(void) { up = hero.unk9BC == 1; } else { v30.q = hero.motion.displacement.q; - up = FUN_L00_00213350(&v30) > 0.0f; + up = forward_component(&v30) > 0.0f; } if (up) { if (moby->b53 != 0x35) { @@ -1216,12 +1216,12 @@ void FUN_L08_002284e0(void) { mx = frame_time_sq * 70.0f; t2 = scale_game_frames(33); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk4B0); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unk4B8 = 1.0f; } } @@ -1253,7 +1253,7 @@ void FUN_L08_002284e0(void) { } hero.target_speed = 0.0f; if (MV(hero.unkA54) != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &MV(hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &MV(hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = frame_time * 4.5f; } @@ -1294,16 +1294,16 @@ void FUN_L08_002284e0(void) { } FUN_L00_00211870(27.0f); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 130.0f); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unkA70 = 1.0f; } - if (FUN_L00_00233a78(&hero.motion.velocity) < frame_time * -37.0f) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); + if (gravity_z(&hero.motion.velocity) < frame_time * -37.0f) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); } } break; @@ -1373,7 +1373,7 @@ void FUN_L08_002284e0(void) { tb = &D_L08_0017C428[hero.attack_record]; hero.target_speed = 0.0f; if (MV(hero.unkA54) != NULL && scale_game_frames(4) > hero.state_timer) { - f32 d = FUN_001f9b80(&MV(hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; + f32 d = vector_distance(&MV(hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; f32 off; f32 tol; f32 mx; @@ -1632,7 +1632,7 @@ void FUN_L08_002284e0(void) { Vec4 *p = &hero.move_impulse; FUN_L00_002132b8(0.7f, 0.0f); v0.q = hero.move_impulse.q; - hero.target_speed += FUN_L00_00213350(&v0); + hero.target_speed += forward_component(&v0); if (hero.target_speed < frame_time * 0.7f) { hero.target_speed = frame_time * 0.7f; } @@ -1715,7 +1715,7 @@ void FUN_L08_002284e0(void) { v10.f[2] += random_float_between(frame_time, frame_time * 2.0f); FUN_L00_00271b18(&v0, &v10, random_float_between(37800.0f, 75600.0f)); } - f = FUN_001f9af0(&hero.motion.platform_delta); + f = fast_vec_length(&hero.motion.platform_delta); if (f > frame_time * 0.5f) { hero.motion.move_yaw = fast_arc_tan(hero.motion.platform_delta.f[0], hero.motion.platform_delta.f[1]); } else { @@ -1822,9 +1822,9 @@ void FUN_L08_002284e0(void) { if (hero.state.current == 0x42) { r = hero.unk5CC * (f32)hero.unk578; } - FUN_L00_0025d808((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); + sample_path((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); if (hero.unk590 != 0) { - FUN_L00_0025d808((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); + sample_path((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); } if (scale_game_frames(90) < hero.unk19C) { s32 h; @@ -1834,11 +1834,11 @@ void FUN_L08_002284e0(void) { qcopy(&v20, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - h = FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); + h = sample_path((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); qcopy(&v30, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - if ((h | FUN_L00_0025d808((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || + if ((h | sample_path((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || hero.unk584 != 0) { f32 a = fast_subtract_rotations( hero.unk57C, fast_arc_tan(v30.f[0] - v20.f[0], v30.f[1] - v20.f[1])) * @@ -1895,7 +1895,7 @@ void FUN_L08_002284e0(void) { } idx = FUN_L00_0025d7a0((void *)hero.unk560, hero.unk564, hero.unk578, hero.unk584); subtract_vector_xyz(&v20, (Vec4 *)hero.unk560 + (idx + 1), &v0); - if (FUN_001f9af0(&v20) < 0.001f) { + if (fast_vec_length(&v20) < 0.001f) { if (hero.unk564 == idx) { hero.unk570 = scale_game_frames(1); break; @@ -1942,7 +1942,7 @@ void FUN_L08_002284e0(void) { hero.motion.pos.f[2] += v20.f[2]; subtract_vector_xyz(&v30, &hero.unk500, &hero.motion.pos); v30.f[2] = 0.0f; - if (FUN_001f9af0(&v30) > frame_time) { + if (fast_vec_length(&v30) > frame_time) { fast_vec_normalize(&v30, &v30, frame_time); } hero.motion.pos.f[0] += v30.f[0]; @@ -1988,8 +1988,8 @@ void FUN_L08_002284e0(void) { si = hero.unk564; sf = hero.unk568; qcopy(&v20, &hero.motion.pos); - FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); - e = fast_arc_tan(FUN_001f9b80(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); + sample_path((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); + e = fast_arc_tan(vector_distance(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); if (e > 0.0f) { sp = e * 1.9098593f * (frame_time * -2.5f); if (e > 0.2617994f && hero.unk5A8 != 2 && hero.unk5A8 != 3) { @@ -2026,9 +2026,9 @@ void FUN_L08_002284e0(void) { f32 mx = frame_time * 7.0f; f32 fl; f32 len; - fl = -FUN_001f9af0(&v20); - FUN_L00_0025b8c0(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); - len = FUN_001f9af0(&v20); + fl = -fast_vec_length(&v20); + vendor_spring(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); + len = fast_vec_length(&v20); if (len < hero.unk5DC) { hero.unk5DC = len; } @@ -2140,8 +2140,8 @@ void FUN_L08_002284e0(void) { FUN_L00_00215340(); FUN_L00_002132b8(0.7f, frame_time * 0.0f); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; case 0x77: { @@ -2153,8 +2153,8 @@ void FUN_L08_002284e0(void) { len = vector_length_xy(&hero.motion.velocity); FUN_L00_001ff600(frame_scale * -0.100000024f * len + len, &hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; } @@ -2193,11 +2193,11 @@ void FUN_L08_002284e0(void) { FUN_L00_00215340(); FUN_L01_00232978(1); if (big) { - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); hero.unk304 = hero.motion.velocity.f[2]; } else { - FUN_L00_0025b8c0(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, + vendor_spring(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, frame_scale_sq * 0.35f, frame_time * 2.5f); } break; @@ -2232,7 +2232,7 @@ void FUN_L08_002284e0(void) { speed_step(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); FUN_L00_00215340(); - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); if (hero.motion.pos.f[2] < hero.unk410) { approach_value(&hero.unk410, hero.motion.pos.f[2], frame_time * 4.0f); @@ -2276,7 +2276,7 @@ void FUN_L08_002284e0(void) { if (hero.state_timer == scale_game_frames(20)) { FUN_L00_00209ca8(3, 0x10, 1); if (D_L08_001612D0 != 0) { - FUN_L00_002a3ec8(D_L08_001612D0, D_L08_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L08_001612D0, D_L08_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, 0.35f); } } @@ -2326,7 +2326,7 @@ void FUN_L08_002284e0(void) { qcopy(&v10, &v0); v10.f[0] += fast_cos(hero.motion.rot.f[2]) * 0.85f; v10.f[1] += fast_sin(hero.motion.rot.f[2]) * 0.85f; - if (FUN_001efa68(&v0, &v10, 4, MV(hero.moby), 0) != 0) { + if (collision_line(&v0, &v10, 4, MV(hero.moby), 0) != 0) { hero.unk4A4 = 1; } } @@ -2349,7 +2349,7 @@ void FUN_L08_002284e0(void) { if (hero.motion.pos.f[2] < hero.unk410) { hero.unk410 = hero.motion.pos.f[2]; } - if (hero.state_timer > hero.unk420 && FUN_L00_00233a78(&hero.motion.velocity) < 0.001f && + if (hero.state_timer > hero.unk420 && gravity_z(&hero.motion.velocity) < 0.001f && (hero.unk41C == 0 || hero.state_timer > hero.unk3D4)) { hero.unk41E = 1; if (hero.unk3F8 != 0.0f) { @@ -2372,7 +2372,7 @@ void FUN_L08_002284e0(void) { fast_vec_scale(&v10, &hero.motion.displacement, 7.0f); for (i = 0; i < n; i++) { if (FUN_L00_0025e3b8(D_L08_00178700[i]) != 0) { - FUN_L00_00259bc8(D_L08_00178700[i], MV(hero.moby), 0x10000, &hero.motion.pos, &v10, + spawn_nearby_effect(D_L08_00178700[i], MV(hero.moby), 0x10000, &hero.motion.pos, &v10, 1.0f); } } @@ -2455,7 +2455,7 @@ void FUN_L08_002284e0(void) { } case 0x66: subtract_vector_xyz(&v0, &hero.unk1640, &hero.motion.pos); - if (FUN_001f9ab0(&v0, &hero.motion.unk150) < 0.0f) { + if (fast_vec_dot(&v0, &hero.motion.unk150) < 0.0f) { clear_u64_value(&hero.motion.unk150); } clear_u64_value(&hero.motion.velocity); diff --git a/src/overlays/l08/gameplay/hero/002370d8.c b/src/overlays/l08/gameplay/hero/002370d8.c index 5b16cc07e1..32410e4eec 100644 --- a/src/overlays/l08/gameplay/hero/002370d8.c +++ b/src/overlays/l08/gameplay/hero/002370d8.c @@ -51,12 +51,12 @@ extern float D_L08_0015F638; extern float D_L08_001675D8 __attribute__((section(".data"))); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_00208f20(float a, float b, float c, float d); extern float FUN_L00_00232b90(float a, float b, float c); -extern float FUN_L00_00233a78(float *v); +extern float gravity_z(float *v) __asm__("FUN_L00_00233a78"); extern float FUN_L00_00233c30(float *pos, float *vel, int *steps, float step); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float FUN_L00_00259468(float *a, float *b, int *out, float f); @@ -74,7 +74,7 @@ extern int D_L08_0015F6DC_d __asm__("D_L08_0015F6DC"); extern int D_L08_0015F594 __attribute__((sda)); extern int D_L08_0015F73C; extern int D_L08_0016CF80 __attribute__((section(".data"))); -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_002050b8(int); #include "rnc/overlay/path.h" @@ -91,7 +91,7 @@ extern int hero_handle_jump_press(void) __asm__("FUN_L00_00229660"); extern int FUN_L00_00229910(void); extern int FUN_L00_00229a98(void); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int FUN_L00_0025d808(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); +extern int sample_path(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); extern int FUN_L00_0025df68(void *, void *, void *, int *, float *, int, float, float, float); extern int pad_pressed_within(int, int, int *) __asm__("FUN_L00_00266d60"); extern int FUN_L00_00266e00(int, int, int, int); @@ -120,7 +120,7 @@ extern void FUN_L00_00232628(void); extern void FUN_L00_00232640(int id); extern void FUN_L00_00233288(float a, float b, short c, unsigned char d, unsigned char e, unsigned char f); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void hud_keep_visible(int, int) __asm__("FUN_L00_00235e18"); extern void FUN_L00_00237ae8(void); extern void FUN_L00_00237ba0(void); @@ -896,7 +896,7 @@ void FUN_L08_002370d8(void) { } break; case 101: - if (FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { + if (vector_distance(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { if (frame_time * 2.7f > hero.motion.speed_xy) { if (fast_difference_between_rotations( hero.motion.rot.f[2], hero.unk1640.f[3]) < 0.034906585f) { @@ -920,7 +920,7 @@ void FUN_L08_002370d8(void) { if ((hero.unkA98 & 2) || hero.unk1650 != 0) { hero_set_state(HERO_STATE_IDLE, 1); } - if (0.2f < FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f)) { + if (0.2f < vector_distance(hero.motion.pos.f, hero.unk1640.f)) { hero_set_state(0x65, 1); } break; @@ -1199,7 +1199,7 @@ void FUN_L08_002370d8(void) { v1[1] = fast_sin(hero.unk57C) * 5.0f; v1[2] = 0.0f; add_vector_xyz(v1, v1, v0); - if (FUN_001efa68(v0, v1, 2, 0, 0)) { + if (collision_line(v0, v1, 2, 0, 0)) { ok = 0; } } @@ -1365,7 +1365,7 @@ void FUN_L08_002370d8(void) { path_seg = hero.unk564; path_t = hero.unk568; /* Step a copy of the hero position along its current path. */ - if (FUN_L00_0025d808((int *)hero.unk560, v0, &path_seg, + if (sample_path((int *)hero.unk560, v0, &path_seg, &path_t, hero.unk584, d)) { scale_vector_xyz(v1, hero.motion.displacement.f, scale_game_frames(0x30)); @@ -1396,7 +1396,7 @@ void FUN_L08_002370d8(void) { } } if (hero.state_timer > hero.unk420) { - if (FUN_L00_00233a78(hero.motion.velocity.f) < 0.001f) { + if (gravity_z(hero.motion.velocity.f) < 0.001f) { hero.unk41E = 1; } } @@ -1631,7 +1631,7 @@ void FUN_L08_002370d8(void) { if (hero_set_state(HERO_STATE_IDLE, 0)) { set_hero_animation(0xC, 9, -1.0f); } - FUN_L00_00233b20(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); + gravity_set_z(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); FUN_L00_0025f730(hero.motion.unk150.f, frame_time * 7.0f); hero.unk1C4 = scale_game_frames(7); if (hero.state.prev == 0x2D) { @@ -2140,7 +2140,7 @@ void FUN_L08_002370d8(void) { scale_game_frames(0xE) < hero.state_timer && (hero.unk41E == 0 || (hero.ground_distance > 0.7f && - absolute_float(FUN_L00_00233a78(hero.motion.velocity.f)) < + absolute_float(gravity_z(hero.motion.velocity.f)) < frame_time * 5.8f))) { hero_set_state(0xE, 1); } else if (D_0013D4C0[2] != 0 && hero_slot_item_id(3) != 4 && diff --git a/src/overlays/l08/gameplay/hero/hero_set_state.c b/src/overlays/l08/gameplay/hero/hero_set_state.c index d48b3adf66..9912440b71 100644 --- a/src/overlays/l08/gameplay/hero/hero_set_state.c +++ b/src/overlays/l08/gameplay/hero/hero_set_state.c @@ -28,10 +28,10 @@ extern char *hero_slot_moby(int) __asm__("FUN_L00_0020d460"); extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L08_0017C5F0[][25]; extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_0020d658(int back); -extern float FUN_L00_002339d0(float *v); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float dot_vectors_xyz(void *a, void *b); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); @@ -46,7 +46,7 @@ extern int FUN_L00_00216de8(int, int); extern int stick_direction_vs_facing(void) __asm__("FUN_L00_00221df8"); extern int FUN_L00_00229a98(void); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int FUN_L00_0025d808(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); +extern int sample_path(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); extern int FUN_L01_00226f10(int a); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); @@ -69,12 +69,12 @@ extern void FUN_L00_00214ed8(float a, float b, float c); extern void FUN_L00_00216ec0(int, int, int); extern void set_hero_animation(int, int, float) __asm__("FUN_L00_002323b8"); extern void FUN_L00_002325e0(int bank, int seq); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L00_00262500(int a, char *b); extern void FUN_L00_00262528(char *o, int a, int b); extern void FUN_L00_00262840(char *o); -extern void FUN_L00_002a3ec8(void *, int, int, float, float, float, float); +extern void pool_splash(void *, int, int, float, float, float, float) __asm__("FUN_L00_002a3ec8"); extern void FUN_L01_002405a0(void); extern void fill_transfer_words(void *, int, int) __asm__("func_001F97E8"); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); @@ -300,7 +300,7 @@ int hero_set_state(int a, int b) { if (p->state.prev_control_mode == 0x11) { FUN_L00_00209ca8(3, 0xA, 0); if (D_L08_001612D0 != 0) { - FUN_L00_002a3ec8(D_L08_001612D0, D_L08_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L08_001612D0, D_L08_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.4f, 0.3f); } } else if (p->motion.displacement.f[2] < frame_time * -0.5f) { @@ -310,7 +310,7 @@ int hero_set_state(int a, int b) { v = 0x28; FUN_L00_00209ca8(3, v, 1); if (D_L08_001612D0 != 0) { - FUN_L00_002a3ec8(D_L08_001612D0, D_L08_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L08_001612D0, D_L08_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.5f, -0.4f); } p->unk90A = scale_game_frames(0x4B); @@ -640,7 +640,7 @@ int hero_set_state(int a, int b) { char *v = (char *)&p->motion.unk110; p->state.control_mode = 1; p->unk2284 = 0; - p->ground_speed = FUN_L00_002339d0((float *)v); + p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.unk150, v); if (b) { int id = 6; @@ -696,7 +696,7 @@ int hero_set_state(int a, int b) { *(unsigned int *)(h + 0x64) | (1 << current_level_index) | 0x80000000; } p->motion.move_yaw = - FUN_001f9e90(*(float *)(((char *)p->unk964) + 0x10) - p->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)p->unk964) + 0x10) - p->motion.pos.f[0], *(float *)(((char *)p->unk964) + 0x14) - p->motion.pos.f[1]); if (b) { set_hero_animation(0x2F, 2, (float)scale_game_frames(5)); @@ -772,7 +772,7 @@ int hero_set_state(int a, int b) { if (*(float *)(d + 0x2C) != 0.0f) q->unk9CC = *(float *)(d + 0x2C); q->unk9AC = - FUN_001f9e90(*(float *)(((char *)q->unk994) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unk994) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unk994) + 0x14) - q->motion.pos.f[1]); q->unk9A4 = FUN_001f9b48(&q->motion.pos, ((char *)q->unk994) + 0x10); q->unk9B0 = frame_time_sq * 27.0f; @@ -836,7 +836,7 @@ int hero_set_state(int a, int b) { p->unk5C0 = 0; seg = p->unk564; t = p->unk568; - FUN_L00_0025d808(*(int **)&p->unk560, pos, &seg, &t, p->unk584, 1.0f); + sample_path(*(int **)&p->unk560, pos, &seg, &t, p->unk584, 1.0f); subtract_vector_xyz(vec, pos, &p->motion.pos); if (0.001f < vector_length_xyz(vec)) { normalize_vector_xyz(vec, vec, 1.0f); @@ -848,11 +848,11 @@ int hero_set_state(int a, int b) { struct Hero *q = &hero; if (((char *)q->unk5D8) != 0) { float ang = - FUN_001f9e90(*(float *)(((char *)q->unk5D8) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unk5D8) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unk5D8) + 0x14) - q->motion.pos.f[1]); if (1.5707964f < fast_difference_between_rotations( ang, fast_add_rotations(q->unk588, - FUN_001f9e90(vec[0], vec[1])))) { + fast_arc_tan(vec[0], vec[1])))) { q->unk588 = 1.5707964f; q->unk58C = 1; } @@ -1088,7 +1088,7 @@ int hero_set_state(int a, int b) { u->unk48C = 1.98f; u->unk430 = 1.95f; } else { - FUN_L00_00233b20((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); + gravity_set_z((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); u->unk41C = 1; u->unk3D0 = scale_game_frames(2); u->unk3D4 = scale_game_frames(0x23) + u->unk3D0; @@ -1346,7 +1346,7 @@ int hero_set_state(int a, int b) { if (1.5707964f < fast_difference_between_rotations( q->motion.rot.f[2], - FUN_001f9e90(q->unk500.f[0] - q->unk540.f[0], + fast_arc_tan(q->unk500.f[0] - q->unk540.f[0], q->unk500.f[1] - q->unk540.f[1]))) id = 0x1F; set_hero_animation(id, 0, (float)scale_game_frames(5)); @@ -1557,7 +1557,7 @@ int hero_set_state(int a, int b) { if (q->items[0].item_id == 0xA && ((char *)q->unkA50) != 0) { q->unkA58 = 1; q->unkA5C = - FUN_001f9e90(*(float *)(((char *)q->unkA50) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unkA50) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unkA50) + 0x14) - q->motion.pos.f[1]); } break; diff --git a/src/overlays/l09/gameplay/entities/airship_part.c b/src/overlays/l09/gameplay/entities/airship_part.c index 75c5f2bb29..fdb130f66d 100644 --- a/src/overlays/l09/gameplay/entities/airship_part.c +++ b/src/overlays/l09/gameplay/entities/airship_part.c @@ -94,6 +94,7 @@ extern f32 frame_time __asm__("D_0015ED6C") __attribute__((section(".sdata"))); extern f32 frame_time_sq_macro __asm__("D_0015ED70") __attribute__((section(".sdata"))); extern int D_L09_001613C8 __attribute__((sda)); /* Update for the airship parts (classes 0x49E-0x4A5): attach to the hull, ride it, then break off, tumble away and fall with smoke and sparks. */ +void FUN_L09_002c26c8(struct Moby *moby); void FUN_L09_002c26c8(struct Moby *moby) { float vec[4]; Buf_2c26c8 buf; diff --git a/src/overlays/l09/gameplay/entities/asteroid.c b/src/overlays/l09/gameplay/entities/asteroid.c index b07c58c5f7..3c841f4fdd 100644 --- a/src/overlays/l09/gameplay/entities/asteroid.c +++ b/src/overlays/l09/gameplay/entities/asteroid.c @@ -623,9 +623,9 @@ struct Moby *FUN_L09_002eaa50(struct Moby *owner) { extern float D_L09_00166F40[]; extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); -extern void FUN_001f9a68(void *, void *, float); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); +extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); void delete_moby(struct Obj *obj) __asm__("FUN_0020c828"); @@ -637,14 +637,14 @@ void FUN_L09_002ead30(unsigned char *m) { float len, t; m[0x23] -= 2; d = *(char **)(m + 0x78); - FUN_001f9a68(d, d, frame_scale * -0.0199999809f + 1.0f); + fast_vec_scale(d, d, frame_scale * -0.0199999809f + 1.0f); *(float *)(d + 8) -= frame_time_sq * 20.0f; - FUN_001f9a10(d + 0x20, d + 0x20, d); - FUN_001f9a28(m + 0x10, d + 0x20, D_L09_00166F40); + fast_vec_add(d + 0x20, d + 0x20, d); + fast_vec_sub(m + 0x10, d + 0x20, D_L09_00166F40); len = fast_vec_length(m + 0x10); if (len > 100.0f) { fast_vec_normalize(m + 0x10, m + 0x10, 100.0f); - FUN_001f9a10(m + 0x10, m + 0x10, D_L09_00166F40); + fast_vec_add(m + 0x10, m + 0x10, D_L09_00166F40); *(float *)(m + 0x2C) = *(float *)(d + 0x50) * (100.0f / len); } else { qcopy(m + 0x10, d + 0x20); @@ -692,8 +692,8 @@ extern float D_0015ED6C __attribute__((section(".sdata"))); extern float distance_xyz(void *, void *) __asm__("FUN_001f9b48"); extern int FUN_001efa68(void *, void *, int, int, int); extern int FUN_L00_00257b90(int, int); -extern int FUN_L00_0028dc90(int, int, int, int); -extern int FUN_L01_002a1968(int, int); +extern int trooper_play_sound(int, int, int, int) __asm__("FUN_L00_0028dc90"); +extern int vendor_volume(int, int) __asm__("FUN_L01_002a1968"); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern s32 random_integer_below_c2(s32) __asm__("FUN_00213260"); extern unsigned char D_0013F350[]; @@ -771,9 +771,9 @@ void FUN_L09_002eaea8(Moby *m) { for (i = 9; i >= 0; i--) { FUN_L09_002ea528_c((char *)m, v0); } - d->f58 = h = FUN_L00_0028dc90(6, 0, (int)m, 0xC1); + d->f58 = h = trooper_play_sound(6, 0, (int)m, 0xC1); if (h != 0) { - FUN_L01_002a1968(h, 0x800); + vendor_volume(h, 0x800); } if (((Hero_2EC188 *)(D_0013F350))->f2084 != 0x32) { float dist = distance_xyz(d->pos, D_L09_00166F40); @@ -797,7 +797,7 @@ void FUN_L09_002eaea8(Moby *m) { } d->f54 = d->f54 * (frame_scale_macro * -0.100000024f + 1.0f); if (d->f58 <= 0) { - d->f58 = FUN_L00_0028dc90(0, 0, (int)m, 0x107); + d->f58 = trooper_play_sound(0, 0, (int)m, 0x107); } } } @@ -841,9 +841,9 @@ void FUN_L09_002eaea8(Moby *m) { for (i = 9; i >= 0; i--) { FUN_L09_002ea528_c((char *)m, v0); } - d->f58 = h = FUN_L00_0028dc90(6, 0, (int)m, 0xC1); + d->f58 = h = trooper_play_sound(6, 0, (int)m, 0xC1); if (h != 0) { - FUN_L01_002a1968(h, 0x800); + vendor_volume(h, 0x800); } if (((Hero_2EC188 *)(D_0013F350))->f2084 != 0x32) { float dist = distance_xyz(d->pos, D_L09_00166F40); @@ -956,7 +956,8 @@ extern struct Moby *func_L09_002EBA58_2ECC50(void) __asm__("FUN_L09_002ea778"); extern int func_L09_00295880_2ECC50(void *, void *, void *, int, int, float) __asm__("FUN_L09_00294ae0"); extern float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); -void FUN_L09_002eb970(struct Moby *m) { +void asteroid_update(struct Moby *m) __asm__("FUN_L09_002eb970"); +void asteroid_update(struct Moby *m) { Data_2ECC50 *d = (*(Data_2ECC50 **)&m->pvars); Path_2ECC50 *path; float v0[4]; @@ -1107,7 +1108,7 @@ extern float D_L09_00166F40_edc30[] __asm__("D_L09_00166F40"); extern float frame_time_edc30 __asm__("D_0015ED6C"); extern void mark_moby_for_removal_edc30(struct Moby *) __asm__("FUN_0020c828"); extern char *find_moby_hit_edc30(struct Moby *, int, int) __asm__("FUN_L00_0025a420"); -extern int dec_byte_timer_edc30(u8 *) __asm__("FUN_L00_001fefc8"); +extern int FUN_L00_001fefc8(u8 *); extern void FUN_L00_00257470_edc30(struct Moby *, int, int) __asm__("FUN_L00_00257470"); extern void FUN_L00_0025f8e0_edc30(void *, float) __asm__("FUN_L00_0025f8e0"); extern int allocate_target_entry_edc30(int, int, struct Moby *) __asm__("FUN_0022da68"); @@ -1127,7 +1128,8 @@ extern void FUN_L00_0025e450_edc30(struct Moby *, void *, void *, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); /* Level 9 breakable stack: when hit, swaps in the next damaged class (0x512 -> 0x513 -> 0x514), bursts debris and smoke and removes itself once gone. */ -void FUN_L09_002edc30(struct Moby *moby) { +void display_update(struct Moby *moby) __asm__("FUN_L09_002edc30"); +void display_update(struct Moby *moby) { float center[4]; float top[4]; float push[4]; @@ -1149,7 +1151,7 @@ void FUN_L09_002edc30(struct Moby *moby) { if (moby->state == 0) { moby->state = 1; } - if (dec_byte_timer_edc30(&moby->command) == 0 || hit == 0) { + if (FUN_L00_001fefc8(&moby->command) == 0 || hit == 0) { return; } if (moby->oclass < 0x514) { @@ -1233,7 +1235,7 @@ extern float fast_cos(float); extern float fast_sin(float); extern float vector_length_xyz(void *); extern int FUN_L00_00257b90(int, int); -extern void FUN_L00_0025d458(void *m, short *p); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); extern void add_vector_xyz(void *, void *, void *); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern void normalize_vector_xyz(void *, void *, float); @@ -1248,7 +1250,7 @@ void FUN_L09_002ee110(struct Moby *m) { *(float *)d = *(float *)d - *(float *)(r + 0x2C); if (0.0f < *(float *)d) { d[0x47] = 0x46; - FUN_L00_0025d458(m, (short *)(d + 0x40)); + trooper_anim_update(m, (short *)(d + 0x40)); } else { char *pos = &m->pos; v.x = fast_cos(m->rot.z) * (frame_time * 20.0f); @@ -1582,8 +1584,8 @@ char *FUN_L09_002efe48(void *unused, float lower_radius, float upper_radius, voi void FUN_L09_002f0040(struct Moby *moby) { char *data = (char *)moby->pvars; - FUN_001f9a10(&moby->pos, &moby->pos, data); - FUN_001f9a68(data, data, 1.0f + frame_scale * -0.019999980926513672f); + fast_vec_add(&moby->pos, &moby->pos, data); + fast_vec_scale(data, data, 1.0f + frame_scale * -0.019999980926513672f); if (moby->anim_flags & 2) { delete_moby(moby); } @@ -1628,7 +1630,7 @@ extern float D_L09_00161A18 __attribute__((sda)); extern int allocate_voice_for_target_entry_alt(int, int, int) __asm__("FUN_0022da68"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern int tick_countdown_32_alt(int *) __asm__("FUN_001f9740"); -extern void FUN_L00_00260738(char *, void *, void *, void *); +extern void update_entity_matrix(char *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void FUN_L00_00262b00(float, float, char *, float *, float *); extern void FUN_L00_00262b80(void *, char *, char *, float, float, float); extern void scale_vector_xyz_c3(void *, void *, float) __asm__("FUN_001f9a68"); @@ -1651,7 +1653,8 @@ extern int func_0022ED80_2F9A50(int, int, void *) __asm__("FUN_0022da68"); extern unsigned char D_0013E633_2F9A50[] __asm__("D_0013F350"); extern unsigned char D_0013F3D0[]; -void FUN_L09_002f86a0(Moby *moby) +void platform_update(Moby *moby) __asm__("FUN_L09_002f86a0"); +void platform_update(Moby *moby) { PlatVars_2F9A50 *data = (*(PlatVars_2F9A50 **)&moby->pvars); Vec_2F9A50 movement; diff --git a/src/overlays/l09/gameplay/entities/elevator.c b/src/overlays/l09/gameplay/entities/elevator.c index cdf26d4d41..c2dc84be15 100644 --- a/src/overlays/l09/gameplay/entities/elevator.c +++ b/src/overlays/l09/gameplay/entities/elevator.c @@ -20,17 +20,17 @@ extern int D_L09_001BA650[]; extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float FUN_001f9b48(void *, void *); -extern int FUN_001f9770(void *); -extern int FUN_L00_0028d8c0(void *, int); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L01_00277fb8(void *); extern s32 allocate_voice_for_target_entry(s32, s32, void *) __asm__("func_0022DA68"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern int hero_set_state(int, int) __asm__("FUN_L00_002223f8"); extern void FUN_L00_00227638(void); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); extern void scale_vector_xyz(void *out, void *a, f32 s) __asm__("FUN_001f9a68"); @@ -42,7 +42,8 @@ extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); #define F(p, o) (*(float *)((p) + (o))) extern s32 D_0014C190_257218[][64] __asm__("D_0014C190"); -void FUN_L09_003033a0(unsigned char *moby) { +void elevator_update(unsigned char *moby) __asm__("FUN_L09_003033a0"); +void elevator_update(unsigned char *moby) { char *data = *(char **)(moby + 0x78); char *path; float orig[4], delta[4], tmp[4]; @@ -69,7 +70,7 @@ void FUN_L09_003033a0(unsigned char *moby) { on = 1; } qcopy(orig, moby + 0x10); - FUN_001f9770(data + 0xBA); + fast_dec_timer_s16(data + 0xBA); if (moby[0x20] == 0) { float f; char *pts; @@ -127,7 +128,7 @@ void FUN_L09_003033a0(unsigned char *moby) { case 2: if (*(short *)(data + 0xBA) != 0 || (F(data, 0xBC) < 0.0f && - FUN_001f9b80((moby + 0x10), &hero.motion.pos) < 2.0f && + vector_distance((moby + 0x10), &hero.motion.pos) < 2.0f && absolute_float(hero.motion.pos.f[2] - F(moby, 0x18)) < 4.0f && F(moby, 0x18) - hero.motion.pos.f[2] > 1.0f)) { int r; @@ -147,7 +148,7 @@ void FUN_L09_003033a0(unsigned char *moby) { int i; float f20, t; char *q; - if (!FUN_L00_0028d8c0(moby, *(int *)(data + 0xC4))) { + if (!voice_is_playing(moby, *(int *)(data + 0xC4))) { *(int *)(data + 0xC4) = allocate_voice_for_target_entry(0, 4, (int)moby); } F(data, 0xA8) += F(data, 0xAC) * frame_time; @@ -198,9 +199,9 @@ void FUN_L09_003033a0(unsigned char *moby) { break; } subtract_vector_xyz(delta, (moby + 0x10), orig); - FUN_L00_00260738(data + 0x60, delta, moby + 0x40, moby + 0x40); + update_entity_matrix(data + 0x60, delta, moby + 0x40, moby + 0x40); if (!FUN_L01_00277fb8(moby)) { - if (2.0f < FUN_001f9b80((moby + 0x10), &hero.motion.pos)) { + if (2.0f < vector_distance((moby + 0x10), &hero.motion.pos)) { if (*(short *)(data + 0xBA) == 0) { *(short *)(data + 0xB8) = 1; } @@ -232,9 +233,9 @@ extern s32 fptodp(f32) __asm__("FUN_00120478"); extern void debug_print(char *, s32, s32) __asm__("FUN_001e93b0"); extern s32 FUN_00213928(struct Moby *, VendorHitSource *, f32 *, s32, s32 *, s32, s32, s32); extern void FUN_L00_00257470(struct Moby *, s32, s32); -extern void FUN_L00_0025d458(struct Moby *, u8 *); -extern void FUN_L00_0025d538(struct Moby *, u8 *); -extern s32 FUN_001f96f8(s32); +extern void trooper_anim_update(struct Moby *, u8 *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(struct Moby *, u8 *) __asm__("FUN_L00_0025d538"); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); void FUN_L09_00303b30(struct Moby *moby, VendorVars *vars, f32 *health) { VendorHitSource *src; @@ -276,18 +277,18 @@ void FUN_L09_00303b30(struct Moby *moby, VendorVars *vars, f32 *health) { } FUN_L00_00257470(moby, 0, -1); vars->anim[7] = 0x78; - FUN_L00_0025d458(moby, vars->anim); + trooper_anim_update(moby, vars->anim); moby->state = 3; } else { *health -= src->damage; vars->anim[7] = 0xFA; - vars->hurt_timer = FUN_001f96f8(60); - FUN_L00_0025d458(moby, vars->anim); + vars->hurt_timer = scale_game_frames(60); + trooper_anim_update(moby, vars->anim); } } moby->hit_slot = 0xFF; } - FUN_L00_0025d538(moby, vars->anim); + trooper_anim_finish(moby, vars->anim); } /* Pressure plate: waits for its trigger slot, hums while armed, wakes its linked moby when stepped on, then shatters. */ /* Ported from rac1-decomp (src/overlays/l09_gaspar/vendor_002C2B08.c: func_L09_003050C0), where it is exact; names translated to the US level program. */ @@ -307,7 +308,8 @@ extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); -void FUN_L09_00303d10(struct Moby *m) { +void refueling_station_update(struct Moby *m) __asm__("FUN_L09_00303d10"); +void refueling_station_update(struct Moby *m) { char *d = (char *)m->pvars; float v[4]; unsigned char *q; @@ -325,7 +327,7 @@ void FUN_L09_00303d10(struct Moby *m) { case 1: if ((D_L09_0015F5CC & 7) == (((int)m >> 8) & 7)) { if (*(int *)(d + 0x7C) == -1 || - (FUN_L00_0028d8c0(m, *(int *)(d + 0x7C)) == 0 && *(int *)(d + 0x7C) == -1)) { + (voice_is_playing(m, *(int *)(d + 0x7C)) == 0 && *(int *)(d + 0x7C) == -1)) { *(int *)(d + 0x7C) = func_0022ED80_r(1, 4, m); } } @@ -348,7 +350,7 @@ void FUN_L09_00303d10(struct Moby *m) { } break; case 2: - if (FUN_001f9770(d + 0x74)) { + if (fast_dec_timer_s16(d + 0x74)) { if (*(int *)(d + 0x70) != -1) { unsigned char *o = (unsigned char *)(D_L09_0015FFD8_u + (*(int *)(d + 0x70) << 8)); if (o != 0 && o[0x20] != 0xFE && o[0x20] != 0xFD && @@ -427,7 +429,7 @@ void FUN_L09_00303fc8(struct Moby *moby, VendorVars2 *vars, f32 *health) { moby->state = 3; } else { *health -= src->damage; - vars->hurt_timer = FUN_001f96f8(60); + vars->hurt_timer = scale_game_frames(60); } } moby->hit_slot = 0xFF; @@ -518,7 +520,7 @@ extern Moby *D_L09_0015FFD8; extern char D_0013D388[]; extern char D_L09_00209050[]; extern char D_L09_00209080[]; -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); extern f32 distance_xyz(void *, void *) __asm__("FUN_001f9b48"); extern float D_L09_00166F40[]; @@ -528,7 +530,7 @@ extern float subtract_vector_xyz_alt(float, float) __asm__("FUN_001fa580"); extern float vector_length_xyz_alt(float, float) __asm__("FUN_001fa5c8"); extern int D_L09_0015F5CC; extern int stub_printf() __asm__("FUN_001e93b0"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void FUN_L00_0024f7c8(void *, int, void *); @@ -537,6 +539,7 @@ void FUN_L00_0025e450(f32 burst, f32 unused_float, f32 owner_effect, f32 owner_e extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern Moby *func_L09_00305580_305710(void *, void *, int) __asm__("FUN_L09_003041d0"); +void FUN_L09_00304360(Moby *m); void FUN_L09_00304360(Moby *m) { Data_305710 *d = (*(Data_305710 **)&m->pvars); float v20[4]; @@ -600,7 +603,7 @@ void FUN_L09_00304360(Moby *m) { } if (d->loose == 0 && hull != 0 && next != 0 && next->oclass == 0x49D) { if ((*(Data_305710 **)&next->pvars)->loose != 0) { - dist = FUN_001f9b80(((f32 *)&m->pos), ((f32 *)&hull->pos)); + dist = vector_distance(((f32 *)&m->pos), ((f32 *)&hull->pos)); m->rot.y = subtract_vector_xyz_alt(m->rot.y, vector_length_xyz_alt(-angle_atan2(dist, hull->pos.z - m->pos.z), m->rot.y) * 0.1f); m->rot.z = subtract_vector_xyz_alt(m->rot.z, vector_length_xyz_alt(angle_atan2(hull->pos.x - m->pos.x, hull->pos.y - m->pos.y), m->rot.z) * 0.1f); } else { @@ -615,7 +618,7 @@ void FUN_L09_00304360(Moby *m) { } v40[2] -= frame_time_sq * 9.8f; add_vector_xyz(((f32 *)&m->pos), ((f32 *)&m->pos), v40); - dist = FUN_001f9b80(((f32 *)&m->pos), ((f32 *)&hull->pos)); + dist = vector_distance(((f32 *)&m->pos), ((f32 *)&hull->pos)); m->rot.y = subtract_vector_xyz_alt(m->rot.y, vector_length_xyz_alt(-angle_atan2(dist, hull->pos.z - m->pos.z), m->rot.y) * 0.1f); m->rot.z = subtract_vector_xyz_alt(m->rot.z, vector_length_xyz_alt(angle_atan2(hull->pos.x - m->pos.x, hull->pos.y - m->pos.y), m->rot.z) * 0.1f); } @@ -651,11 +654,11 @@ void FUN_L09_00304360(Moby *m) { t = d->timer - 3; v30[2] -= frame_time_sq * 9.8f * 2.0f * convert_integer_to_float(n - t); add_vector_xyz(((f32 *)&m->pos), ((f32 *)&m->pos), v30); - dist = FUN_001f9b80(((f32 *)&m->pos), ((f32 *)&hull->pos)); + dist = vector_distance(((f32 *)&m->pos), ((f32 *)&hull->pos)); m->rot.y = subtract_vector_xyz_alt(m->rot.y, vector_length_xyz_alt(-angle_atan2(dist, hull->pos.z - m->pos.z), m->rot.y) * 0.5f); m->rot.z = subtract_vector_xyz_alt(m->rot.z, vector_length_xyz_alt(angle_atan2(hull->pos.x - m->pos.x, hull->pos.y - m->pos.y), m->rot.z) * 0.5f); } - if (FUN_001f9770(&d->timer)) { + if (fast_dec_timer_s16(&d->timer)) { if (d->hull != -1) { Moby *o = &D_L09_0015FFD8[d->hull]; if (o != 0 && o->state != 0xFE && o->state != 0xFD @@ -687,13 +690,14 @@ extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float atan2_f(float, float) __asm__("FUN_001f9e90"); extern void scale_vector_00304360(float, void *, void *) __asm__("FUN_001f9bf8"); -extern float FUN_001f9af0(void *); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern char D_L09_00209050[]; extern char D_L09_00209080[]; extern void print_missing_link(char *, short) __asm__("FUN_001e93b0"); extern void effect_00304360(f32, f32, f32, f32, f32, f32, f32, void *, void *, int, int, int, int, int, int, int, int, int) __asm__("FUN_L00_0025e450"); +void FUN_L09_00304360(unsigned char *moby); void FUN_L09_00304360(unsigned char *moby) { unsigned char *data = *(unsigned char **)(moby + 0x78); unsigned char *link; @@ -764,15 +768,15 @@ case 1: data[0x68] = 1; } else if (link2 != 0 && *(short *)(link2 + 0xa6) == 0x49d) { if (*(unsigned char *)(*(char **)(link2 + 0x78) + 0x68) != 0) { - angle = FUN_001f9b80(moby + 0x10, link + 0x10); + angle = vector_distance(moby + 0x10, link + 0x10); height = F(link, 0x18); rotation_scale = 0.1f; } else { subtract_vector_xyz(work, link + 0x10, moby + 0x10); - scale_vector_00304360((FUN_001f9af0(work) - 1.3f) * 0.7f, work, work); + scale_vector_00304360((fast_vec_length(work) - 1.3f) * 0.7f, work, work); if (*(short *)(link2 + 0xa6) == 0x49d && link2[0x20] != 0xfe && link2[0x20] != 0xfd) { subtract_vector_xyz(work2, link2 + 0x10, moby + 0x10); - scale_vector_00304360((FUN_001f9af0(work2) - 1.3f) * 0.7f, work2, work2); + scale_vector_00304360((fast_vec_length(work2) - 1.3f) * 0.7f, work2, work2); add_vector_xyz(work3, work, work2); } else { qcopy(work3, work); @@ -780,7 +784,7 @@ case 1: work3[2] = work3[2] - frame_time_sq * 9.8f; rotation_scale = 0.1f; add_vector_xyz(moby + 0x10, moby + 0x10, work3); - angle = FUN_001f9b80(moby + 0x10, link + 0x10); + angle = vector_distance(moby + 0x10, link + 0x10); height = F(link, 0x18); } angle = atan2_f(angle, height - F(moby, 0x18)); @@ -799,7 +803,7 @@ case 1: unsigned char *link2 = (unsigned char *)((char *)moby_list + (index << 8)); if (link2[0x20] == 1) link2[0xbc] = 1; } - *(short *)(data + 0x6a) = FUN_001f96f8(10); + *(short *)(data + 0x6a) = scale_game_frames(10); moby[0x30] = 0xff; moby[0x20] = 2; return; @@ -816,19 +820,19 @@ case 2: } if (link != 0) { subtract_vector_xyz(work, link + 0x10, moby + 0x10); - scale_vector_00304360(FUN_001f9af0(work) - 1.3f, work, work); + scale_vector_00304360(fast_vec_length(work) - 1.3f, work, work); qcopy(work2, work); - tick = FUN_001f96f8(10); + tick = scale_game_frames(10); work2[2] -= (frame_time_sq * 9.8f + frame_time_sq * 9.8f) * convert_integer_to_float(tick - (*(short *)(data + 0x6a) - 3)); add_vector_xyz(moby + 0x10, moby + 0x10, work2); - angle = FUN_001f9b80(moby + 0x10, link + 0x10); + angle = vector_distance(moby + 0x10, link + 0x10); angle = atan2_f(angle, F(link, 0x18) - F(moby, 0x18)); F(moby, 0x44) = fast_add_rotations(F(moby, 0x44), fast_subtract_rotations(-angle, F(moby, 0x44)) * 0.5f); angle = atan2_f(F(link, 0x10) - F(moby, 0x10), F(link, 0x14) - F(moby, 0x14)); F(moby, 0x48) = fast_add_rotations(F(moby, 0x48), fast_subtract_rotations(angle, F(moby, 0x48)) * 0.5f); } - if (FUN_001f9770(data + 0x6a) == 0) return; + if (fast_dec_timer_s16(data + 0x6a) == 0) return; index = *(int *)(data + 0x60); if (index != -1) { unsigned char *link; @@ -921,17 +925,17 @@ extern void FUN_L08_00313ba8(void); extern int FUN_L00_0023e738(void *, float, float, float, float, float); extern void FUN_L00_0023e838(int); extern void FUN_L00_0026dd20(void *, void *, int, int, float); -extern void FUN_L00_001ff378(void *, void *, float); -extern void FUN_L00_001edf60(void *, int, void *, int, int, int, float, float, float); +extern void divide_vector_xyz(void *, void *, float) __asm__("FUN_L00_001ff378"); +extern void suck_draw_reticle(void *, int, void *, int, int, int, float, float, float) __asm__("FUN_L00_001edf60"); extern void FUN_L00_002eac18(int); extern void FUN_L00_002ea9d8(void *); extern void FUN_L00_002eaa30(void *); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void fast_mem_zero16(void *, int) __asm__("FUN_001f9810"); extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); -extern float FUN_001f9af0(void *); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); @@ -947,7 +951,8 @@ extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void FUN_L00_001fff28(void *, int, float); -void FUN_L09_00304c80(struct Moby *moby) { +void turret_update(struct Moby *moby) __asm__("FUN_L09_00304c80"); +void turret_update(struct Moby *moby) { Vec4 seat; Vec4 offset; Vec4 tmp; @@ -967,13 +972,13 @@ void FUN_L09_00304c80(struct Moby *moby) { moby_point_position(moby, 3, &seat); seat.f[2] += 0.4f; if (moby->state >= 4) { - if (FUN_001f9770(&vars->mount_delay) != 0 && moby->command == 1 && + if (fast_dec_timer_s16(&vars->mount_delay) != 0 && moby->command == 1 && hero.state.control_mode != 0x14 && hero.state.control_mode != 7 && hero.state.current != 0x3D) { qcopy(&hero.motion.pos, &seat); qcopy(&hero.motion.rot, &moby->rot); hero.motion.rot.f[2] = fast_add_rotations(1.5707964f, hero.motion.rot.f[2]); - offset.f[0] = FUN_001f9dc8(hero.motion.rot.f[2]) * -0.7f; - offset.f[1] = FUN_001f9de0(hero.motion.rot.f[2]) * -0.7f; + offset.f[0] = fast_cos(hero.motion.rot.f[2]) * -0.7f; + offset.f[1] = fast_sin(hero.motion.rot.f[2]) * -0.7f; offset.f[2] = 0.0f; add_vector_xyz(&hero.motion.pos, &hero.motion.pos, &offset); fast_mem_zero16(&hero.motion.velocity, 0x90); @@ -986,7 +991,7 @@ void FUN_L09_00304c80(struct Moby *moby) { } else { if (moby->state != 5) { vars->dismount_delay = 2; - FUN_L00_002eaaa0(&moby->pos, &moby->rot, 0, 0, 0); + jet_mount(&moby->pos, &moby->rot, 0, 0, 0); if (moby->prev_seq != 5) { blend_moby_animation(moby, 5, 0, scale_game_frames(5)); } @@ -1022,7 +1027,7 @@ void FUN_L09_00304c80(struct Moby *moby) { sound_probe_ignore[0] = moby; return; case 4: - if (FUN_001f9b80(&moby->pos, &hero.motion.pos) < 4.0f || hero.ground_moby == moby) { + if (vector_distance(&moby->pos, &hero.motion.pos) < 4.0f || hero.ground_moby == moby) { moby->pos.z += ((vars->rest_z - 1.0f) - moby->pos.z) * 0.11f; vars->yaw_speed = fast_add_rotations(vars->yaw_speed, fast_add_rotations(fast_subtract_rotations( @@ -1079,7 +1084,7 @@ void FUN_L09_00304c80(struct Moby *moby) { tmp.f[1] = stick_y; len = vector_length_xy(&tmp); if (len > 1.0f) { - FUN_L00_001ff378(&tmp, &tmp, len); + divide_vector_xyz(&tmp, &tmp, len); } vars->yaw_speed += frame_time_sq * 3.1415927f * -tmp.f[0]; vars->pitch_speed += frame_time_sq * 0.7853982f * -tmp.f[1]; @@ -1115,7 +1120,7 @@ void FUN_L09_00304c80(struct Moby *moby) { rnd.f[1] = random_float_between(-1.0f, 1.0f); rnd.f[2] = random_float_between(-1.0f, 1.0f); dir.q = rnd.q; - normalize_vector_xyz(&dir, &dir, FUN_001f9af0(&shot) * (frame_scale * (0.65f - 1.0f) + 1.0f)); + normalize_vector_xyz(&dir, &dir, fast_vec_length(&shot) * (frame_scale * (0.65f - 1.0f) + 1.0f)); add_vector_xyz(&dir, &shot, &dir); normalize_vector_xyz(&dir, &dir, random_float_between(frame_time * 3.0f, frame_time * 6.0f)); FUN_L00_0026dd20(&muzzle, &dir, 0x5F2F4F6F, random_int_between(scale_game_frames(5), scale_game_frames(10)), 50000.0f); @@ -1142,7 +1147,7 @@ void FUN_L09_00304c80(struct Moby *moby) { rnd.f[1] = random_float_between(-1.0f, 1.0f); rnd.f[2] = random_float_between(-1.0f, 1.0f); dir.q = rnd.q; - normalize_vector_xyz(&dir, &dir, FUN_001f9af0(&shot) * (frame_scale * (0.65f - 1.0f) + 1.0f)); + normalize_vector_xyz(&dir, &dir, fast_vec_length(&shot) * (frame_scale * (0.65f - 1.0f) + 1.0f)); add_vector_xyz(&dir, &shot, &dir); normalize_vector_xyz(&dir, &dir, random_float_between(frame_time * 3.0f, frame_time * 6.0f)); FUN_L00_0026dd20(&muzzle, &dir, 0x5F2F4F6F, random_int_between(scale_game_frames(5), scale_game_frames(10)), 50000.0f); @@ -1156,7 +1161,7 @@ void FUN_L09_00304c80(struct Moby *moby) { } else if (moby->prev_seq != 5 && (moby->anim_flags & 2)) { blend_moby_animation(moby, 5, 0, 1); } - if (FUN_001f9770(&vars->dismount_delay) != 0) { + if (fast_dec_timer_s16(&vars->dismount_delay) != 0) { FUN_L00_00250df8(moby); moby->flags |= 4; FUN_L08_00313ba8(); @@ -1170,13 +1175,13 @@ void FUN_L09_00304c80(struct Moby *moby) { dir.f[2] = fast_add_rotations(1.5707964f, moby->rot.z); FUN_L00_002eaa30(&dir); } - FUN_L00_001edf60(moby, 0xFF0F0FFF, 0, 0xD, -1, 4, 1.0f, 0.0f, 90.0f); + suck_draw_reticle(moby, 0xFF0F0FFF, 0, 0xD, -1, 4, 1.0f, 0.0f, 90.0f); break; } } -extern void FUN_001f9cf8(void *, void *, void *); +extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void FUN_001f9bf8(f32, void *, void *); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void FUN_L00_00259858(void *, void *, s32, f32); extern s32 collect_mobies_in_sphere(f32, void *, s32, void *, void *) __asm__("FUN_L00_001f2868"); extern char D_L09_002090B0[]; @@ -1198,7 +1203,7 @@ void FUN_L09_00305a28(struct Moby *moby) { } if ((D_L09_0015F5CC & 7) == (((int)moby >> 8) & 7)) { if (*(s32 *)(data + 0x14) == -1 || - (FUN_L00_0028d8c0(moby, *(s32 *)(data + 0x14)) == 0 && + (voice_is_playing(moby, *(s32 *)(data + 0x14)) == 0 && *(s32 *)(data + 0x14) == -1)) { *(s32 *)(data + 0x14) = allocate_voice_for_target_entry(0, 4, moby); } @@ -1209,9 +1214,9 @@ void FUN_L09_00305a28(struct Moby *moby) { *(OvlQuad *)work = 0; work[2] = (end - (start + start)) / count_as_float; qcopy(work + 4, (char *)moby + 0x10); - FUN_001f9cf8(work, work, (char *)moby + 0xc0); + transform_vector_by_basis(work, work, (char *)moby + 0xc0); FUN_001f9bf8(F(data, 0), work + 8, work); - FUN_001f9a10(work + 4, work + 4, work + 8); + fast_vec_add(work + 4, work + 4, work + 8); FUN_L00_00259858(work + 12, moby, *(s32 *)(data + 0x10), *(float *)(data + 0xc)); i = 0; if (*(s32 *)(data + 8) > 0) do { @@ -1221,7 +1226,7 @@ void FUN_L09_00305a28(struct Moby *moby) { *(s16 *)(hit + 0xb2), F(data, 0xc)); } i++; - FUN_001f9a10(work + 4, work + 4, work); + fast_vec_add(work + 4, work + 4, work); } while (i < *(s32 *)(data + 8)); } #define NOT_SDA @@ -1234,7 +1239,7 @@ void FUN_L09_00305a28(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/l09_gaspar/vendor_002C2B08.c: func_L09_003095D0), where it is exact; names translated to the US level program. */ extern char *func_0020D348_m(int); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void FUN_L00_00250df8(void *); extern void FUN_L00_0025d1b8(void *); @@ -1249,7 +1254,7 @@ char *FUN_L09_00308220(struct Moby *owner, int cls) { moby[0x20] = 0; qcopy(moby + 0x10, &owner->pos); qcopy(moby + 0x40, &owner->rot); - moby[0xBC] = FUN_001f96f8(10); + moby[0xBC] = scale_game_frames(10); FUN_L00_00250df8(moby); FUN_L00_0025d1b8(moby); *(float *)(moby + 0x2C) = owner->scale; @@ -1285,7 +1290,7 @@ extern float D_L09_0015F5D4; extern int FUN_L00_001fefc8(); extern int allocate_voice_for_target_entry_alt(int, int, int) __asm__("FUN_0022da68"); extern unsigned char D_0014C050_c[] __asm__("D_0014C050"); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void mark_moby_for_removal_c(void *) __asm__("func_0020C828"); extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); extern void scale_vector_xyz_c(void *, void *, float) __asm__("FUN_001f9a68"); @@ -1317,7 +1322,8 @@ extern void func_0020D678_309688(void *) __asm__("FUN_0020c828"); extern unsigned char D_0014171B_309688[] __asm__("D_0014C050"); extern char alternate_item_available[] __asm__("D_0013D388"); -void FUN_L09_003082d8(Moby *moby) +void barrier_update(Moby *moby) __asm__("FUN_L09_003082d8"); +void barrier_update(Moby *moby) { BarrierData_309688 *data = (*(BarrierData_309688 **)&moby->pvars); float origin[4], center[4], piece_pos[4], vel[4], push[4]; @@ -1604,7 +1610,7 @@ typedef struct { extern void attach_manipulator(struct Moby *, s32, void *) __asm__("FUN_0020cb10"); extern void scale_vector_00309c08(f32, void *, void *) __asm__("FUN_001f9a68"); extern s32 check_voice_target_00309c08(void *, s32) __asm__("FUN_L00_0028d8c0"); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern u8 D_0013F3D0[]; extern u8 D_0014C050[]; extern s32 D_L09_0015F5CC __attribute__((section(".data"))); @@ -1613,7 +1619,8 @@ extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern int FUN_L09_0030a298(struct Moby *); -void FUN_L09_00309c08(struct Moby *moby) { +void shuttle_update(struct Moby *moby) __asm__("FUN_L09_00309c08"); +void shuttle_update(struct Moby *moby) { PathFlyerVars_00309c08 *vars = (PathFlyerVars_00309c08 *)moby->pvars; PathNodes_00309c08 *path = (PathNodes_00309c08 *)D_L09_001B0630[vars->path]; Vec4 *position = &moby->pos; @@ -1731,7 +1738,7 @@ void FUN_L09_00309c08(struct Moby *moby) { break; } add_vector_xyz(&original, &original, &moby->pos); - FUN_L00_00260738((u8 *)vars + 0x20, &original, &rotation, &moby->rot); + update_entity_matrix((u8 *)vars + 0x20, &original, &rotation, &moby->rot); } extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); diff --git a/src/overlays/l09/gameplay/vendor/0030a678.c b/src/overlays/l09/gameplay/vendor/0030a678.c index 5d220ae8b8..dcb7b49bb5 100644 --- a/src/overlays/l09/gameplay/vendor/0030a678.c +++ b/src/overlays/l09/gameplay/vendor/0030a678.c @@ -13,7 +13,8 @@ extern void FUN_L01_002787a0(void *); extern void FUN_L01_00278e20(void *, int); void mark_moby_for_removal(struct Obj *obj) __asm__("FUN_0020c828"); -void FUN_L09_0030a678(struct Moby *m) { +void lamp_update(struct Moby *m) __asm__("FUN_L09_0030a678"); +void lamp_update(struct Moby *m) { int hit = 0; char *r = find_moby_hit(m, 0x10000, 0); switch (m->state) { diff --git a/src/overlays/l10/gameplay/entities/platform.c b/src/overlays/l10/gameplay/entities/platform.c index 13f7fe7505..9fbbfe4e9b 100644 --- a/src/overlays/l10/gameplay/entities/platform.c +++ b/src/overlays/l10/gameplay/entities/platform.c @@ -19,12 +19,12 @@ extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int FUN_001f9740(int *arg0); extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int FUN_L10_002d8058_u() __asm__("FUN_L10_002d8058"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); void build_spherical_offset(f32 *out, f32 scale, f32 a, f32 b) __asm__("FUN_00214db0"); int D_L10_00161BF0 = 240; @@ -34,13 +34,14 @@ extern float D_L10_00161BFC __attribute__((sda)); extern float D_L10_00161C00 __attribute__((sda)); extern float D_L10_00161C04 __attribute__((sda)); extern float D_L10_00161C08 __attribute__((sda)); -void FUN_L10_002d8c00(struct Moby *moby) { +void bombthrower_grass_update(struct Moby *moby) __asm__("FUN_L10_002d8c00"); +void bombthrower_grass_update(struct Moby *moby) { char *data = (char *)moby->pvars; float a[4]; float b[4]; if (moby->state == 0) { *(int *)data = - FUN_001f96f8(random_int_between(D_L10_00161BF0, D_L10_00161BF4)); + scale_game_frames(random_int_between(D_L10_00161BF0, D_L10_00161BF4)); moby->state = 1; } if (FUN_001f9740((int *)data)) { @@ -55,11 +56,11 @@ void FUN_L10_002d8c00(struct Moby *moby) { random_float_between_alt(D_L10_00161C04, D_L10_00161C08) * frame_time, q, r); - FUN_001f9a10(b, &moby->pos, a); + fast_vec_add(b, &moby->pos, a); FUN_L10_002d8058_u(moby, b, a); allocate_voice_for_target_entry(0, 0, (int)moby); *(int *)data = - FUN_001f96f8(random_int_between(D_L10_00161BF0, D_L10_00161BF4)); + scale_game_frames(random_int_between(D_L10_00161BF0, D_L10_00161BF4)); } } #include "qcopy.h" @@ -165,7 +166,7 @@ extern f32 random_angle_radians(void) __asm__("func_00213308"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int FUN_L01_00277fb8(void *); -extern void FUN_L00_00260738(char *, void *, void *, void *); +extern void update_entity_matrix(char *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void FUN_L00_00262b00(float, float, char *, float *, float *); extern void FUN_L00_00262b80(void *, char *, char *, float, float, float); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); @@ -235,7 +236,7 @@ void FUN_L10_00295c20(struct Moby *moby) { } } subtract_vector_xyz(v, &moby->pos, prev); - FUN_L00_00260738(d + 0x60, v, &moby->rot, &moby->rot); + update_entity_matrix(d + 0x60, v, &moby->rot, &moby->rot); } /* Spinning pickup: waits until the hero is close and level with it, then plays the scene, saves and goes away. */ extern char *D_L10_0015FFD8_p __asm__("D_L10_0015FFD8"); @@ -250,7 +251,8 @@ extern void FUN_L00_00284e50_p(void *, void *) __asm__("FUN_L00_00284e50"); extern int memcard_save_data(int, int) __asm__("FUN_0020b178"); extern int D_L10_0015F640; -void FUN_L10_00298668(struct Moby *m) { +void magnetboots_update(struct Moby *m) __asm__("FUN_L10_00298668"); +void magnetboots_update(struct Moby *m) { char *d = (char *)m->pvars; m->rot.z = fast_add_rotations(m->rot.z, frame_time * 1.5707964f); switch (m->state) { @@ -446,7 +448,7 @@ extern void * FUN_L00_00272060(void *, int, float, float, int, int, int, void *, extern void add_vectors(void *, void *, void *) __asm__("FUN_L00_001ff290"); extern void FUN_L00_00216f90(void *, void *, int, int); extern void FUN_L00_002e8568(int); -extern void FUN_L00_002e8590(float, float); +extern void follow_camera_set_lateral_spring(float, float) __asm__("FUN_L00_002e8590"); extern void FUN_L00_002e8648(void); extern void FUN_L00_002e8680(void); extern void fast_vec_normalize_c(void *, void *, f32) __asm__("FUN_001f9bf8"); @@ -469,12 +471,13 @@ extern struct Moby * D_L10_0015FFD8; #define func_001FA898_2BFBB8 ((int (*)(float))truncate_float_to_s32) #define func_001FA8A8_2BFBB8 fast_tween_color #define func_001F9908_2BFBB8 ((int (*)(int *))tick_countdown_32_alt) -#define func_L00_002E9A40_2BFBB8 FUN_L00_002e8590 +#define func_L00_002E9A40_2BFBB8 follow_camera_set_lateral_spring #define func_L00_002E9B30_2BFBB8 FUN_L00_002e8680 #define func_L00_002E9AF8_2BFBB8 FUN_L00_002e8648 #define func_L00_002E9A18_2BFBB8 FUN_L00_002e8568 -void FUN_L10_002be858(char *moby) +void gadgebot_telepot_pad_update(char *moby) __asm__("FUN_L10_002be858"); +void gadgebot_telepot_pad_update(char *moby) { int *data = *(int **)(moby + 0x78); float position[4]; @@ -610,7 +613,8 @@ extern unsigned char D_0014C050_bf[] __asm__("D_0014C050"); extern BfState D_L10_001BAA50; extern unsigned char D_L10_0015FC88[8]; -void FUN_L10_002befe8(unsigned char *m) { +void gate_update(unsigned char *m) __asm__("FUN_L10_002befe8"); +void gate_update(unsigned char *m) { float *d = *(float **)(m + 0x78); unsigned short id; switch (m[0x20]) { @@ -646,7 +650,7 @@ void FUN_L10_002befe8(unsigned char *m) { extern char D_0013E550[]; extern float D_0015ED6C_c __asm__("D_0015ED6C"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L00_0028dc90(int i, int a1, int v, int k); extern void *FUN_L00_0026fd28(char *a, char *b, unsigned char c, int d); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); @@ -683,7 +687,7 @@ void FUN_L10_002c7a20(struct Moby *moby) { FUN_L00_0026fd28((char *)v, (char *)r, 0x40, (int)moby); add_vector_xyz(v, v, s); FUN_L00_0026fd28((char *)v, (char *)r, 0x40, (int)moby); - if (FUN_L00_0028d8c0(moby, *(int *)(data + 0x10)) == 0) { + if (voice_is_playing(moby, *(int *)(data + 0x10)) == 0) { *(int *)(data + 0x10) = FUN_L00_0028dc90(0, 4, (int)moby, 0x519); } if (tick_countdown_32((int *)(data + 0xC))) { @@ -716,7 +720,7 @@ typedef struct { extern struct Moby *D_L10_00178380_u[] __asm__("D_L10_00178380"); extern void euler_rotation_basis(void *, void *) __asm__("FUN_001fa030"); -extern void FUN_001f9cf8(void *, void *, void *); +extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern int collect_mobies_in_sphere(void *, float, int, void *, void *) __asm__("FUN_L00_001f2868"); extern void *memcpy(void *, const void *, u32); @@ -746,8 +750,8 @@ void FUN_L10_002c9958(struct Moby *moby, HitBox *box) { } qzero(¢er); center.f[2] = radius; - FUN_001f9cf8(¢er, ¢er, mat); - FUN_001f9a10(¢er, ¢er, &moby->pos); + transform_vector_by_basis(¢er, ¢er, mat); + fast_vec_add(¢er, ¢er, &moby->pos); count = collect_mobies_in_sphere(¢er, radius, 0x10, moby, 0); if (count != 0) { struct Moby *found[count]; @@ -774,8 +778,8 @@ void FUN_L10_002c9958(struct Moby *moby, HitBox *box) { point.f[2] = box->depth * 0.5f; } point.f[1] = 0.0f; - FUN_001f9cf8(&point, &point, mat); - FUN_001f9a10(&point, &point, &moby->pos); + transform_vector_by_basis(&point, &point, mat); + fast_vec_add(&point, &point, &moby->pos); n = collect_mobies_in_sphere(&point, box->margin_x, 0x10, moby, 0); for (j = 0; j < n; j++) { if (D_L10_00178380_u[j] == other) { @@ -918,17 +922,17 @@ void FUN_L10_002d7b18(struct Moby *a, float t) { a->pos.z = t; } } -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern void set_vector_length_xy(void *, void *, float) __asm__("FUN_001f9c48"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void FUN_L00_001ff660(void *, void *, void *); extern void make_hit_descriptor(void *, void *, int, float, void *) __asm__("FUN_L00_00259888"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L01_00274b78(float, void *, void *); extern float vector_distance_xy(void *, void *) __asm__("FUN_001f9b80"); extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void FUN_L00_0026dd20(void *, void *, int, int, float); extern void mark_moby_for_removal_d7b80(void *) __asm__("FUN_0020c828"); extern char D_L10_001742C0[]; @@ -948,7 +952,7 @@ void FUN_L10_002d7b80(struct Moby *moby) { int i; qcopy(old, &moby->pos); - FUN_001f9a10(&moby->pos, &moby->pos, data); + fast_vec_add(&moby->pos, &moby->pos, data); FUN_L01_00274b78(20.0f, moby, found); switch (*(short *)(data + 0x12)) { case 0: @@ -961,7 +965,7 @@ void FUN_L10_002d7b80(struct Moby *moby) { qcopy(raised, &moby->pos); check[2] += 0.1f; raised[2] -= *(float *)(data + 0x1c) + *(float *)(data + 0x1c); - if (FUN_001efa68(check, raised, 2, (int)moby, 0)) + if (collision_line(check, raised, 2, (int)moby, 0)) FUN_L10_002d7b18(moby, *(float *)(D_L10_001742C0 + 0x28) + *(float *)(data + 0x1c)); else FUN_L10_002d7b18(moby, moby->pos.z - 0.1f); @@ -978,11 +982,11 @@ void FUN_L10_002d7b80(struct Moby *moby) { set_vector_length_xy(check, check, 1.0f); check[2] = 1.0f; make_hit_descriptor(hit, moby, 0x10001, *(float *)(data + 0x18), check); - if (FUN_001f9770(data + 0x10)) { + if (fast_dec_timer_s16(data + 0x10)) { mark_moby_for_removal_d7b80(moby); return; } - if (FUN_001efa68(old, &moby->pos, 0, *(int *)(data + 0x20), (int)hit)) { + if (collision_line(old, &moby->pos, 0, *(int *)(data + 0x20), (int)hit)) { char *collision = D_L10_001742C0; struct Moby *other = *(struct Moby **)(collision + 0x18); if (other == 0 || other->oclass != 0x359) { @@ -1004,11 +1008,11 @@ void FUN_L10_002d7b80(struct Moby *moby) { *(OvlQuad *)raised = *(OvlQuad *)rand_dir; FUN_L00_001ff660(rand_dir, data, D_L10_00174300); fast_vec_normalize(raised, raised, fast_vec_length(rand_dir) * 0.5f); - FUN_001f9a10(raised, rand_dir, raised); + fast_vec_add(raised, rand_dir, raised); fast_vec_normalize(raised, raised, random_float_between_alt(D_0015ED6C * 3.0f, D_0015ED6C * 6.0f)); FUN_L00_0026dd20(&moby->pos, raised, 0x7f2f4f6f, - random_int_between(FUN_001f96f8(10), FUN_001f96f8(15)), 30000.0f); + random_int_between(scale_game_frames(10), scale_game_frames(15)), 30000.0f); } mark_moby_for_removal_d7b80(moby); return; @@ -1071,7 +1075,7 @@ extern float FUN_L00_00200510(float, float, float); extern float probe_ground_height(void *, int, float) __asm__("func_00213508"); extern float seg_sqrt(float) __asm__("func_001F9988"); extern float D_0015ED6C; -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern void FUN_L00_001ff660(void *, void *, void *); extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); extern void scale_vector_xyz_c(void *, void *, float) __asm__("FUN_001f9a68"); @@ -1093,7 +1097,7 @@ int FUN_L10_002d8170(char *m, char *c, float *a2) { *(u128 *)v10 = 0; v10[2] = one; if (*(short *)(c + 0x14) == 0) { - if (FUN_001efa68(v0, m + 0x10, 0x10, (int)m, 0)) { + if (collision_line(v0, m + 0x10, 0x10, (int)m, 0)) { g = D_L10_001742C0; w6 = *(int *)(g + 0x18); if (w6 != 0) { @@ -1208,8 +1212,8 @@ extern float FUN_L00_0025ab48(float, float); extern float scale_game_frames_alt(float) __asm__("FUN_001f96f8"); extern float D_L10_00161BEC_gp __asm__("D_L10_00161BEC") __attribute__((sda)); extern int FUN_L00_001f2868(); -extern int FUN_L00_002502f0(); -extern int FUN_L00_00250320(); +extern int set_moby_color() __asm__("FUN_L00_002502f0"); +extern int get_moby_color() __asm__("FUN_L00_00250320"); extern int FUN_L00_0025a9f8(float, void *, int, void *, void *); extern void FUN_L00_0025a420(void *, void *, void *); extern void FUN_L00_0025f090(void *,void *,void *,int,int,int,int,int,float,float,float); @@ -1429,16 +1433,16 @@ void FUN_L10_002d85c8(char *m) { *(float *)(c + 8) = 0.0f; *(float *)(c + 4) = sine * speed; *(float *)(c + 8) = height; - *(short *)(c + 0x14) = FUN_001f96f8(0xf); + *(short *)(c + 0x14) = scale_game_frames(0xf); *(unsigned char *)(m + 0x20) = 2; } else { *(unsigned char *)(m + 0x20) = 3; } } *(unsigned char *)(m + 0xa4) = 0xff; - if (FUN_001f9770(c + 0x14)) { + if (fast_dec_timer_s16(c + 0x14)) { if (FUN_L10_002d8170(m, c, prev) == 3) { - *(short *)(c + 0x14) = FUN_001f96f8(0xf0); + *(short *)(c + 0x14) = scale_game_frames(0xf0); *(unsigned char *)(m + 0x20) = 1; goto finish; } @@ -1450,10 +1454,10 @@ void FUN_L10_002d85c8(char *m) { float angle1, speed1, height1; get_moby_color(m, &color0, &color1, &color2); - first = FUN_001f96f8(0xf0); - second = FUN_001f96f8(0xf0); + first = scale_game_frames(0xf0); + second = scale_game_frames(0xf0); set_moby_color(m, ((first - *(short *)(c + 0x14)) * 0x7f) / second, color1, color2); - if (FUN_001f9770(c + 0x14)) { + if (fast_dec_timer_s16(c + 0x14)) { *(unsigned char *)(m + 0x20) = 3; } else { hit = find_hit_moby(m, 0x830000, 0); @@ -1471,7 +1475,7 @@ void FUN_L10_002d85c8(char *m) { *(float *)(c + 8) = 0.0f; *(float *)(c + 4) = sine * speed1; *(float *)(c + 8) = height1; - *(short *)(c + 0x14) = FUN_001f96f8(0xf); + *(short *)(c + 0x14) = scale_game_frames(0xf); *(unsigned char *)(m + 0x20) = 2; } else { *(unsigned char *)(m + 0x20) = 3; @@ -1501,7 +1505,7 @@ void FUN_L10_002d85c8(char *m) { collision.id = *(unsigned short *)(m + 0xa6); add_vector_xyz(m + 0x10, m + 0x10, c); *(float *)(c + 8) -= D_0015ED70_d85c8 * 9.8f; - if (FUN_001f9770(c + 0x14)) { + if (fast_dec_timer_s16(c + 0x14)) { if (FUN_L10_002d8170(m, c, prev) != 0) done = 1; else if (*(float *)(m + 0x18) < 2.0f) done = 1; } else if (*(float *)(m + 0x18) < 2.0f) done = 1; @@ -1599,7 +1603,7 @@ void FUN_L10_002d8d30(char *m) { if (D_L10_0015F5CC & 1) { FUN_L10_002dd270(m, pos, path, *(float *)(d + 4), frame_time * 5.0f, len); } - if (FUN_L00_0028d8c0(m, *(int *)(d + 0x10)) == 0) { + if (voice_is_playing(m, *(int *)(d + 0x10)) == 0) { int r = trooper_play_sound(0, 0xC, m, 0x442); *(int *)(d + 0x10) = r; if (r != -1) { @@ -1652,7 +1656,8 @@ extern int FUN_L10_002d9000_c() __asm__("FUN_L10_002d9000"); extern OvlQuad D_L10_00167240; void mark_moby_for_removal_u(struct Obj *obj) __asm__("FUN_0020c828"); -void FUN_L10_002d90a8(unsigned char *m) { +void lab_door_update(unsigned char *m) __asm__("FUN_L10_002d90a8"); +void lab_door_update(unsigned char *m) { int *d = *(int **)(m + 0x78); OvlQuad v[2]; int it; @@ -1748,7 +1753,8 @@ extern f32 fabsf_fast(f32) __asm__("FUN_001f99c0"); extern s32 FUN_0022da68(s32, s32, struct Moby *); /* Floor plate: lit and opening its door while a moby (other than class 0x3EF) rests on it, dark and closing it otherwise. */ -void FUN_L10_002d92b8(struct Moby *m) { +void button_update(struct Moby *m) __asm__("FUN_L10_002d92b8"); +void button_update(struct Moby *m) { FloorPlateVars *v = (FloorPlateVars *)m->pvars; s32 pressed = 0; struct Moby *door; @@ -1789,7 +1795,7 @@ void FUN_L10_002d92b8(struct Moby *m) { if (v->sound_timer == 0) { FUN_0022da68(0, 0, door); FUN_0022da68(0, 0, m); - v->sound_timer = FUN_001f96f8(30); + v->sound_timer = scale_game_frames(30); } } FUN_L00_002502f0_u(m, 0x7F, 0x7F, 0x7F); @@ -1799,7 +1805,7 @@ void FUN_L10_002d92b8(struct Moby *m) { if (v->sound_timer == 0) { FUN_0022da68(1, 0, door); FUN_0022da68(0, 0, m); - v->sound_timer = FUN_001f96f8(30); + v->sound_timer = scale_game_frames(30); } } FUN_L00_002502f0_u(m, 8, 8, 8); @@ -1822,8 +1828,8 @@ extern int D_0015ED84; /* no foreign declaration */ extern int D_L10_001BA950[]; extern unsigned char D_0014C190_c[] __asm__("D_0014C190"); extern void FUN_L00_001ff290(void *, void *, void *); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int); -extern void FUN_L01_002f8530(void *, void *, unsigned int, float, int, float, float, float, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); +extern void spawn_debris_chunk(void *, void *, unsigned int, float, int, float, float, float, int) __asm__("FUN_L01_002f8530"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("func_001F9CF8"); void FUN_L10_002d9eb8(char *moby) { @@ -1846,7 +1852,7 @@ void FUN_L10_002d9eb8(char *moby) { if (find_moby_hit(moby, 0x40000, 0)) { char *c0 = moby + 0xC0; v20.q = 0; - FUN_L00_0025e450(moby, &v20, moby + 0x10, 0.0f, 0.0f, 5, 3, 4, 4.0f, 2.0f, 100000.0f, 3.0f, -1, 15.0f, 1, 1, -1, 0); + spawn_explosion(moby, &v20, moby + 0x10, 0.0f, 0.0f, 5, 3, 4, 4.0f, 2.0f, 100000.0f, 3.0f, -1, 15.0f, 1, 1, -1, 0); trooper_play_sound(0, 0, moby, 0x99); n = 0x1D; do { @@ -1866,14 +1872,14 @@ void FUN_L10_002d9eb8(char *moby) { c16 = random_int_between(0x3C, 0x78); f20 = random_float_between(2.0f, 3.0f); r2 = random_integer_below(4); - FUN_L01_002f8530(&v30, &v40, k, f21, c16, f20, 1.0f, 3.0f, r2 == 0); + spawn_debris_chunk(&v30, &v40, k, f21, c16, f20, 1.0f, 3.0f, r2 == 0); } while (n >= 0); v30.q = 0; v30.f[0] = 2.8599999f; v30.f[1] = 1.57000005f; v30.f[2] = 1.83099997f; transform_vector_by_basis(&v30, &v30, c0); - FUN_L00_0025e450(moby, &v20, &v30, 0.0f, 0.0f, 5, 3, 4, 4.0f, 2.0f, 100000.0f, 3.0f, -1, 15.0f, 1, 1, -1, 0); + spawn_explosion(moby, &v20, &v30, 0.0f, 0.0f, 5, 3, 4, 4.0f, 2.0f, 100000.0f, 3.0f, -1, 15.0f, 1, 1, -1, 0); FUN_L10_002dd848_c(moby); FUN_L10_002eb8c0(moby); *(int *)(D_0014C190_c + (((short)*(unsigned short *)(moby + 0xB2) >> 5) * 4 + (D_0015ED84 << 8))) |= 1 << (*(unsigned short *)(moby + 0xB2) & 0x1F); @@ -1890,13 +1896,13 @@ extern int stub_printf() __asm__("FUN_001e93b0"); extern void delete_moby(void *) __asm__("FUN_0020c828"); extern s32 random_integer_below(s32) __asm__("func_00213260"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int FUN_001fa6d0(float); extern float square_root(float) __asm__("FUN_001f9988"); extern float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern int fast_bsphere_check(void *, float) __asm__("FUN_001fa728"); extern void enqueue_callback_list_1(void *, void *) __asm__("FUN_001f4600"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); extern int tick_countdown_32(void *) __asm__("FUN_001f9740"); @@ -1943,7 +1949,7 @@ void FUN_L10_002da2c8(struct Moby *moby) { timer = D_L10_00161C98 * 60.0f; moby->rot.z = new_rotation; *(int *)(data + 0x30) = -1; - *(int *)(data + 0x34) = FUN_001f96f8(FUN_001fa6d0(timer)); + *(int *)(data + 0x34) = scale_game_frames(FUN_001fa6d0(timer)); } moby->flags |= 0x41; @@ -1958,7 +1964,7 @@ void FUN_L10_002da2c8(struct Moby *moby) { position1[3] = square_root(radius_squared + half_width * half_width); if (fast_vec_dist(&moby->pos, &D_L10_00167240) < 80.0f && 0.0f <= (float)fast_bsphere_check(position1, 80.0f)) enqueue_callback_list_1((void *)FUN_L10_002da690, moby); - if (FUN_L00_0028d8c0(moby, *(int *)(data + 0x30)) == 0) + if (voice_is_playing(moby, *(int *)(data + 0x30)) == 0) *(int *)(data + 0x30) = allocate_voice_for_target_entry(0, 4, (int)moby); break; } @@ -1996,7 +2002,7 @@ extern void multiply_matrix_da690(void *, void *, void *) __asm__("FUN_001fa378" extern float convert_integer_to_float_da690(int) __asm__("FUN_001fa6c0"); extern int truncate_float_to_s32_da690(float) __asm__("FUN_001fa6d0"); extern unsigned int fast_tween_color_da690(float, int, int) __asm__("FUN_001fa6e0"); -extern float scale_time_da690(float) __asm__("FUN_L10_001f2578"); +extern float FUN_L10_001f2578(float); extern void add_vector_xyz_da690(void *, void *, void *) __asm__("FUN_001f9a10"); extern void draw_geometry_quad_da690(void *, void *, int) __asm__("FUN_001f7d30"); /* Retail loads these words relative to gp (0x00166c00). */ @@ -2130,7 +2136,7 @@ void FUN_L10_002da690(void *moby) { convert_integer_to_float_da690((int)color >> 24)) << 24); if (((struct Moby *)moby)->state == 2) { float alpha = convert_integer_to_float_da690(*(int *)(data + 0x34)); - float duration = scale_time_da690(D_L10_00161C98 * 60.0f); + float duration = FUN_L10_001f2578(D_L10_00161C98 * 60.0f); color = (truncate_float_to_s32_da690(alpha * 255.0f / duration) << 24) | 0xffffff; } @@ -2163,7 +2169,6 @@ extern int D_L10_00161D68; extern float D_L10_00161D54 __attribute__((sda)); extern float D_L10_00161D58 __attribute__((sda)); extern float D_L10_00161D5C __attribute__((sda)); -extern int FUN_001f25d0(void *) __asm__("FUN_001f9740"); extern void FUN_001f28c8(void *) __asm__("FUN_001f99f8"); extern void FUN_001f28e0(void *, void *, void *) __asm__("FUN_001f9a10"); extern void FUN_001f2968(float, void *, void *) __asm__("FUN_001f9a68"); @@ -2211,7 +2216,7 @@ void FUN_L10_002dcc58(struct Moby *moby) { char *base = data + group_offset; char *other = data + (group_offset + 0x9600); char *buffer = (char *)scratch + item * 0x10; - if (FUN_001f25d0(entry) != 0) { + if (fast_dec_timer(entry) != 0) { char *dst = data + (item * 0x10 + group_offset); char *current = base + item * 0x10; char *out = buffer; @@ -2347,7 +2352,8 @@ extern int D_L10_001BA950[]; extern unsigned char D_0014C190[] NOT_SDA; void mark_moby_for_removal_d650(struct Obj *obj) __asm__("FUN_0020c828"); -void FUN_L10_002dd650(struct Moby *m) { +void block_cave_update(struct Moby *m) __asm__("FUN_L10_002dd650"); +void block_cave_update(struct Moby *m) { int i; char *e; float w[16]; diff --git a/src/overlays/l10/gameplay/entities/screamer.c b/src/overlays/l10/gameplay/entities/screamer.c index d1770241bb..d80393d9e3 100644 --- a/src/overlays/l10/gameplay/entities/screamer.c +++ b/src/overlays/l10/gameplay/entities/screamer.c @@ -63,11 +63,11 @@ extern f32 random_float_between_c(f32, f32) __asm__("func_002132A8"); extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); extern float D_0015ED6C; extern float D_0015ED70; -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations_c(float, float) __asm__("func_001FA688"); extern float probe_ground_height_c(void *, int, float) __asm__("func_00213508"); extern int FUN_001f9b80_c() __asm__("FUN_001f9b80"); -extern int FUN_L00_001f0d60(); +extern int coll_sphere() __asm__("FUN_L00_001f0d60"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern int tick_countdown_32_alt_c(int *) __asm__("FUN_001f9740"); extern s32 truncate_float_to_s32_c(f32) __asm__("func_001FA6D0"); @@ -76,7 +76,7 @@ extern void blend_moby_animation_c2(void *, s32, s32, s32) __asm__("FUN_00212f90 extern void clear_u64_value(void *) __asm__("func_001F99F8"); extern void mark_moby_for_removal_c(void *) __asm__("func_0020C828"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); -float FUN_L00_0025be00(float *cur, float *vel, float target, float lim, float accel, float maxv); +float approach_angle(float *cur, float *vel, float target, float lim, float accel, float maxv) __asm__("FUN_L00_0025be00"); int FUN_L00_0025c698_c(void *moby, void *motion) __asm__("FUN_L00_0025c698"); void FUN_L00_00257470_c(unsigned char *m, int flags, int arg) __asm__("FUN_L00_00257470"); void FUN_L00_00258278_c(unsigned char *m, float *ptr, float t, float b, float c, float limit) __asm__("FUN_L00_00258278"); @@ -124,7 +124,8 @@ extern V_2E0630 D_L10_001672C0_2E0630 __asm__("D_L10_00167240"); extern Path_2E0630 *D_L10_001B0C30_2E0630[] __asm__("D_L10_001B0930"); extern V_2E0630 D_L10_00174360_2E0630 __asm__("D_L10_001742E0"); -void FUN_L10_002df270(Moby *moby) { +void screamer_update(Moby *moby) __asm__("FUN_L10_002df270"); +void screamer_update(Moby *moby) { float waypoint[6]; D_2E0630 *data = (D_2E0630 *)moby->pvars; Moby *leader; @@ -416,7 +417,7 @@ typedef struct { char p2[0xDF]; } Ent; -/* Retail reaches D_L10_0015FFD8 here with the lui/lw macro; FUN_L10_002e1d38 reaches it through $gp. An alias 8 bytes lower keeps the macro form under SN. */ +/* Retail reaches D_L10_0015FFD8 here with the lui/lw macro; toxic_crab_update reaches it through $gp. An alias 8 bytes lower keeps the macro form under SN. */ extern Ent *D_L10_0015FFD0_e[] __asm__("D_L10_0015FFD0") __attribute__((section(".sdata"))); extern short *D_L10_001ABCC0[]; @@ -954,8 +955,8 @@ typedef struct Path_2E2B80 { extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern char D_0013F3D0[]; -extern float FUN_001f96b0(float); -extern float FUN_001f9e90(float, float); +extern float FUN_L04_001f1978(float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float truncate_float_to_s32_alt(float, float) __asm__("FUN_001fa6d0"); extern float D_0015ED6C; extern float D_0015ED70; @@ -1234,10 +1235,10 @@ extern char D_L10_00167240[]; extern char D_L10_001742C0[]; extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L10_0015F580[] __attribute__((section(".sdata"))); -extern float FUN_001f96b0(float); +extern float FUN_L04_001f1978(float); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9e90(float, float); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float FUN_L10_002e4840(struct Moby *self); @@ -1250,10 +1251,10 @@ extern float probe_ground_height(void *, int, float) __asm__("FUN_00213508"); extern int D_L10_0015F5CC; extern int D_L10_0015FFD8; extern char *D_L10_0015FFD0_w[] __asm__("D_L10_0015FFD0") __attribute__((section(".sdata"))); -extern int FUN_001efa68(void *, void *, int, void *, void *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern int FUN_L00_00258b50(void *, void *, void *, void *, float); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int random_integer_below(int) __asm__("FUN_00213260"); extern int tick_countdown_32(void *); extern s32 FUN_L00_0025e3b8(s32); @@ -1279,7 +1280,7 @@ extern void FUN_L00_0025d458(void *m, short *p); extern void FUN_L00_0025f3e8(void *, void *, int, float, float); extern void FUN_L00_00263ac8(float, int, int, unsigned char *); extern void FUN_L01_0026d930(char *p); -extern void FUN_L03_00250a78(float *p, float a, float b); +extern void trooper_set_knockback(float *p, float a, float b) __asm__("FUN_L03_00250a78"); extern void FUN_L10_002e0138(struct Moby *m); extern void FUN_L10_002e3a90_u(void *) __asm__("FUN_L10_002e3a90"); extern void FUN_L10_002e3de8(char *moby); @@ -1292,7 +1293,8 @@ extern void func_L00_0025D5B0_b(void *, void *, int, int, int, float) __asm__("F extern void func_L00_002592B0_b(char *moby, float target, float k, float d, float max, float *vel) __asm__("FUN_L00_00258278"); -void FUN_L10_002e1d38(Moby2E30F8 *m) { +void toxic_crab_update(Moby2E30F8 *m) __asm__("FUN_L10_002e1d38"); +void toxic_crab_update(Moby2E30F8 *m) { int see = 0; Crab2E30F8 *d = m->data; char *t; @@ -1312,7 +1314,7 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { from[2] < 2.0f || 1021.0f < from[2]) && !(to[0] < 2.0f || 1021.0f < to[0] || to[1] < 2.0f || 1021.0f < to[1] || to[2] < 2.0f || 1021.0f < to[2])) { - see = FUN_001efa68(from, to, 2, m, 0) == 0; + see = collision_line(from, to, 2, m, 0) == 0; } if (!see || (!(absolute_float(*(float *)(t + 0x18) - m->pos[2]) < 1.0f) && FUN_L00_0025e3b8(((int)hero.ground_moby)) == 0)) { @@ -1397,7 +1399,7 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { case 2: if (m->anim == 0) { if (d->i1A8 == 0) { - d->i1A8 = truncate_float_to_s32(FUN_001f96b0(random_float_between(0.0f, 20.0f))); + d->i1A8 = truncate_float_to_s32(FUN_L04_001f1978(random_float_between(0.0f, 20.0f))); } else if (tick_countdown_32(&d->i1A8)) { if (d->i1B4 != 0) { if (m->anim != 1) { @@ -1410,7 +1412,7 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { } } } else if (m->b70 & 2) { - if (FUN_001f9b80(m->pos, &hero.motion.pos) < *(float *)&D_L10_00161E40_gp) { + if (vector_distance(m->pos, &hero.motion.pos) < *(float *)&D_L10_00161E40_gp) { float x; m->state = 5; d->i1D8 = 0; @@ -1430,7 +1432,7 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { } break; case 3: { - float ang = FUN_001f9e90(d->f120 - m->pos[0], d->f124 - m->pos[1]); + float ang = fast_arc_tan(d->f120 - m->pos[0], d->f124 - m->pos[1]); FUN_L00_00258278((char *)m, &d->f190, ang, 0.02f, 0.3f, frame_time * 6.2831855f); if (d->i164 != 2) { m->state = 4; @@ -1476,7 +1478,7 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { } else if (d->i1D8 != 0) { approach_value(&d->fF4, 0.0f, frame_time_sq * 10.0f); } - ang = FUN_001f9e90(*(float *)(t + 0x10) - m->pos[0], *(float *)(t + 0x14) - m->pos[1]); + ang = fast_arc_tan(*(float *)(t + 0x10) - m->pos[0], *(float *)(t + 0x14) - m->pos[1]); diff = fast_difference_between_rotations(ang, m->f48); if (0.87266463f < diff) { float lim = d->f1A4 * frame_time * 0.25f; @@ -1495,7 +1497,7 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { if (hero.vehicle_mode != 1) { float rot = m->f48; int r; - m->f48 = FUN_001f9e90(v[0] - m->pos[0], v[1] - m->pos[1]); + m->f48 = fast_arc_tan(v[0] - m->pos[0], v[1] - m->pos[1]); dir[0] = fast_cos(m->f48) * 2.0f; dir[1] = fast_sin(m->f48) * 2.0f; dir[2] = 0.0f; @@ -1507,7 +1509,7 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { from2[2] += 1.0f; *(OvlQuad *)to2 = *(OvlQuad *)(t + 0x10); to2[2] += 1.0f; - if (FUN_001efa68(from2, to2, 2, m, 0)) { + if (collision_line(from2, to2, 2, m, 0)) { char *h = D_L10_001742C0; if ((*(char **)(h + 0x18) == 0 || *(short *)(*(char **)(h + 0x18) + 0xA6) != 0x31A) && @@ -1523,13 +1525,13 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { r = FUN_L00_00258b50(m, &d->iD0, dir, out, 1.0f); m->f48 = rot; if (r & 3) { - if (FUN_001f9b80(m->pos, old) < d->fF4 * 0.25f) { + if (vector_distance(m->pos, old) < d->fF4 * 0.25f) { d->i1D8 = 1; } else { d->i1D8 = 0; } if (D_L10_0015F5CC % 7 == 0 && d->i1A8 == 0) { - if (FUN_001f9b80(d->v1C0, m->pos) < d->fF4 && + if (vector_distance(d->v1C0, m->pos) < d->fF4 && diff <= D_L10_00161E4C * DEG_TO_RAD) { m->state = 6; d->i1A8 = scale_game_frames(0x3C); @@ -1566,7 +1568,7 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { d->i164 == 2) { m->state = 8; blend_moby_animation(m, 4, 0, scale_game_frames(0xC)); - } else if (FUN_001f9b80(m->pos, t + 0x10) < + } else if (vector_distance(m->pos, t + 0x10) < (*(short *)(t + 0xA6) == 0x359 ? 2.45f : 4.02f)) { if (hero.invulnerable_frames < scale_game_frames(10) && diff < 0.34906584f && see) { @@ -1586,7 +1588,7 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { float diff; diff = fast_difference_between_rotations( - FUN_001f9e90(*(float *)(t + 0x10) - m->pos[0], *(float *)(t + 0x14) - m->pos[1]), + fast_arc_tan(*(float *)(t + 0x10) - m->pos[0], *(float *)(t + 0x14) - m->pos[1]), m->f48); if (0.87266463f < diff) { float lim = d->f1A4 * frame_time * 0.25f; @@ -1602,7 +1604,7 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { from2[2] += 1.0f; *(OvlQuad *)to2 = *(OvlQuad *)(t + 0x10); to2[2] += 1.0f; - if (FUN_001efa68(from2, to2, 2, m, 0)) { + if (collision_line(from2, to2, 2, m, 0)) { char *h = D_L10_001742C0; if ((*(char **)(h + 0x18) == 0 || *(short *)(*(char **)(h + 0x18) + 0xA6) != 0x31A) && @@ -1624,7 +1626,7 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { d->i164 == 2) { m->state = 8; blend_moby_animation(m, 4, 0, scale_game_frames(0xC)); - } else if (FUN_001f9b80(m->pos, t + 0x10) < + } else if (vector_distance(m->pos, t + 0x10) < (*(short *)(t + 0xA6) == 0x359 ? 2.45f : 4.02f)) { if (hero.invulnerable_frames < scale_game_frames(10) && diff < D_L10_00161E4C * DEG_TO_RAD && see) { @@ -1643,7 +1645,7 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { float ang; fr = compute_interpolated_record_value(m); - ang = FUN_001f9e90(*(float *)(t + 0x10) - m->pos[0], *(float *)(t + 0x14) - m->pos[1]); + ang = fast_arc_tan(*(float *)(t + 0x10) - m->pos[0], *(float *)(t + 0x14) - m->pos[1]); FUN_L00_00258278((char *)m, &d->f190, ang, 0.03f, 0.3f, frame_time * 6.2831855f); if (m->anim >= 6 && m->anim <= 7 && 4.0f <= fr && fr <= 7.0f) { Hit2E30F8 hit; @@ -1667,13 +1669,13 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { collect_mobies_in_sphere(v, 0.75f, 0, m, &hit); v[2] += 0.5f; collect_mobies_in_sphere(v, 0.75f, 0, m, &hit); - FUN_001efa68(pos, v, 9, m, &hit); + collision_line(pos, v, 9, m, &hit); } else { moby_point_position(m, 1, v); collect_mobies_in_sphere(v, 0.75f, 0, m, &hit); v[2] += 0.5f; collect_mobies_in_sphere(v, 0.75f, 0, m, &hit); - FUN_001efa68(pos, v, 9, m, &hit); + collision_line(pos, v, 9, m, &hit); } } else if (m->anim >= 6 && m->anim <= 7 && (m->b70 & 2)) { float home = FUN_001f9b48(m->pos, d->v170); @@ -1700,11 +1702,11 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { float ang; approach_value(&d->fF4, d->f1A4 * 3.0f * frame_time, frame_time_sq * 20.0f); - ang = FUN_001f9e90(*(float *)(t + 0x10) - m->pos[0], *(float *)(t + 0x14) - m->pos[1]); + ang = fast_arc_tan(*(float *)(t + 0x10) - m->pos[0], *(float *)(t + 0x14) - m->pos[1]); FUN_L00_00258278((char *)m, &d->f190, ang, 0.02f, 0.3f, frame_time * 6.2831855f); rot = m->f48; m->f48 = fast_add_rotations( - FUN_001f9e90(*(float *)(t + 0x10) - m->pos[0], *(float *)(t + 0x14) - m->pos[1]), + fast_arc_tan(*(float *)(t + 0x10) - m->pos[0], *(float *)(t + 0x14) - m->pos[1]), 3.14159f); dir[0] = fast_cos(m->f48) * 2.0f; dir[1] = fast_sin(m->f48) * 2.0f; @@ -1734,7 +1736,7 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { float ang; approach_value(&d->fF4, d->f1A4 * frame_time, frame_time_sq * 5.0f); - ang = FUN_001f9e90(d->v170[0] - m->pos[0], d->v170[1] - m->pos[1]); + ang = fast_arc_tan(d->v170[0] - m->pos[0], d->v170[1] - m->pos[1]); func_L00_002592B0_b((char *)m, ang, 0.02f, 0.3f, frame_time * 6.2831855f, &d->f190); if (0.87266463f < fast_difference_between_rotations(ang, m->f48)) { float lim = d->f1A4 * frame_time * 0.25f; @@ -1764,7 +1766,7 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { break; } case 10: - if (FUN_L00_0025c698(m, d->v70) & 0x41) { + if (mine_fall(m, d->v70) & 0x41) { int anim; m->state = 7; d->fF4 = frame_time * 5.0f; @@ -1806,7 +1808,7 @@ void FUN_L10_002e1d38(Moby2E30F8 *m) { d->f98 = 0.75f; d->i94 = 9; d->f80 = x; - FUN_L03_00250a78(d->v70, 2.0f, 1.5f); + trooper_set_knockback(d->v70, 2.0f, 1.5f); d->fC0 = 7.0f; d->fC4 = 13.0f; func_L00_0025D5B0_b(m, d->v70, 0xD, 1, 0, fast_add_rotations(m->f48, 3.1415927f)); @@ -2279,12 +2281,12 @@ void FUN_L10_002e3ef0(void *mv) { extern Ent *D_L10_0015FFD0_e[] __asm__("D_L10_0015FFD0") __attribute__((section(".sdata"))); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); #include "rnc/data_labels.h" -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern float D_L10_00161E48 __attribute__((sda)); float FUN_L10_002e4840(struct Moby *self) { @@ -2292,25 +2294,25 @@ float FUN_L10_002e4840(struct Moby *self) { float hi, lo, ang, dist, v[3]; short *p; if (self->group == 0xFF) { - return FUN_001f9e90(self->pos.x - *(float *)(owner + 0x10), + return fast_arc_tan(self->pos.x - *(float *)(owner + 0x10), self->pos.y - *(float *)(owner + 0x14)); } lo = -(D_L10_00161E48 * DEG_TO_RAD); hi = D_L10_00161E48 * DEG_TO_RAD; - ang = FUN_001f9e90(self->pos.x - *(float *)(owner + 0x10), + ang = fast_arc_tan(self->pos.x - *(float *)(owner + 0x10), self->pos.y - *(float *)(owner + 0x14)); dist = FUN_001f9b48(owner + 0x10, &self->pos); - v[0] = FUN_001f9dc8(ang) * 2.0f; - v[1] = FUN_001f9de0(ang) * 2.0f; + v[0] = fast_cos(ang) * 2.0f; + v[1] = fast_sin(ang) * 2.0f; v[2] = 0.0f; - FUN_001f9a10(v, v, ((unsigned char *)&D_0013E533) + 0xE9D); + fast_vec_add(v, v, ((unsigned char *)&D_0013E533) + 0xE9D); p = D_L10_001ABCC0[self->group]; if (p != 0) { do { int idx = *(unsigned short *)p & 0x7FFF; if (D_L10_0015FFD0_e[2][idx].state == 5 || FUN_001f9b48(&D_L10_0015FFD0_e[2][idx].x, owner + 0x10) < dist) { - float d = FUN_001f9e90(D_L10_0015FFD0_e[2][idx].x - *(float *)(owner + 0x10), + float d = fast_arc_tan(D_L10_0015FFD0_e[2][idx].x - *(float *)(owner + 0x10), D_L10_0015FFD0_e[2][idx].y - *(float *)(owner + 0x14)); float r = fast_subtract_rotations(d, ang); if (r > 0.0f && r < hi) { @@ -2424,7 +2426,7 @@ extern unsigned char D_0014161B[]; extern unsigned char D_00141C48[]; extern void *FUN_L00_00263fd8_c(char *, int, float *, void *, int, int, float, float *, float *, float *) __asm__("FUN_L00_00263fd8"); extern void DebugPrint(char *, ...); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_0025f730_c(void *, float) __asm__("FUN_L00_0025f730"); extern void FUN_L03_00250ae8(void *, void *, int); extern void FUN_L10_002e5968_c(char *m) __asm__("FUN_L10_002e5968"); @@ -2438,7 +2440,8 @@ s32 is_value_within_interpolated_window(void *anim, f32 value) __asm__("FUN_0021 extern int D_0015ED84; extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); -void FUN_L10_002e4a88(Ship_5E48 *m) { +void blarg_ship_update(Ship_5E48 *m) __asm__("FUN_L10_002e4a88"); +void blarg_ship_update(Ship_5E48 *m) { ShipD_5E48 *d = m->d; Ship_5E48 *tgt; V_2E52B0 A; @@ -2513,7 +2516,7 @@ void FUN_L10_002e4a88(Ship_5E48 *m) { } else { d->i158 = 0; m->state = 4; - d->i168 = truncate_float_to_s32_c2(FUN_001f96b0(d->f160 * 60.0f)); + d->i168 = truncate_float_to_s32_c2(FUN_L04_001f1978(d->f160 * 60.0f)); } } break; @@ -2525,7 +2528,7 @@ void FUN_L10_002e4a88(Ship_5E48 *m) { *(u128_2E52B0 *)&A = *(u128_2E52B0 *)&tgt->pos; if ((&hero)->vehicle_mode != 1) { *(u128_2E52B0 *)&A = *(u128_2E52B0 *)&d->vF0; - FUN_001efa68(&m->pos, &A, 0, m, 0); + collision_line(&m->pos, &A, 0, m, 0); } else { if ((Ship_5E48 *)(&hero)->moby == tgt) { fast_vec_scale(&C, &(&hero)->motion.displacement, (float)scale_game_frames_c2(20)); @@ -2553,7 +2556,7 @@ void FUN_L10_002e4a88(Ship_5E48 *m) { FUN_L00_001ff290(&D, &C, &B); func_001F9BF0_2E52B0(&B, &A, &C); fast_vec_normalize(&B, &B, D_L10_00161EE8 * D_0015ED6C); - fast_vec_scale(&E, &B, FUN_001f96b0(3.0f)); + fast_vec_scale(&E, &B, FUN_L04_001f1978(3.0f)); FUN_L00_001ff290(&D, &E, &C); FUN_L03_00250ae8(m, &E, 0); FUN_L10_002cc1b8(&B, &C, (int)m, (int)tgt, scale_game_frames_c2(300), 1.0f); @@ -2564,7 +2567,7 @@ void FUN_L10_002e4a88(Ship_5E48 *m) { if (tick_countdown_32_alt(&d->i168)) { if (m->b53 != 2) blend_moby_animation(m, 2, 0, scale_game_frames_c2(10)); m->state = 5; - d->i168 = truncate_float_to_s32_c2(FUN_001f96b0(d->f164 * 60.0f)); + d->i168 = truncate_float_to_s32_c2(FUN_L04_001f1978(d->f164 * 60.0f)); } qcopy(&B, &D_L10_001B0C30_2E52B0[d->i144]->nodes[d->i158]); func_001F9BF0_2E52B0(&C, &B, &m->pos); @@ -2583,7 +2586,7 @@ void FUN_L10_002e4a88(Ship_5E48 *m) { *(u128_2E52B0 *)&A = *(u128_2E52B0 *)&tgt->pos; if ((&hero)->vehicle_mode != 1) { *(u128_2E52B0 *)&A = *(u128_2E52B0 *)&d->vF0; - FUN_001efa68(&m->pos, &A, 0, m, 0); + collision_line(&m->pos, &A, 0, m, 0); } else { if ((Ship_5E48 *)(&hero)->moby == tgt) { fast_vec_scale(&C, &(&hero)->motion.displacement, (float)scale_game_frames_c2(20)); @@ -2602,7 +2605,7 @@ void FUN_L10_002e4a88(Ship_5E48 *m) { blend_moby_animation(m, 3, 0, scale_game_frames_c2(10)); m->f58 = D_L10_00161EEC; m->state = 4; - d->i168 = truncate_float_to_s32_c2(FUN_001f96b0(d->f160 * 60.0f)); + d->i168 = truncate_float_to_s32_c2(FUN_L04_001f1978(d->f160 * 60.0f)); } qcopy(&B, &D_L10_001B0C30_2E52B0[d->i144]->nodes[d->i158]); func_001F9BF0_2E52B0(&C, &B, &m->pos); @@ -2628,20 +2631,20 @@ void FUN_L10_002e4a88(Ship_5E48 *m) { blend_moby_animation(m, 3, 0, scale_game_frames_c2(10)); m->f58 = D_L10_00161EEC; m->state = next; - d->i168 = truncate_float_to_s32_c2(FUN_001f96b0(d->f160 * 60.0f)); + d->i168 = truncate_float_to_s32_c2(FUN_L04_001f1978(d->f160 * 60.0f)); } else if (next == 6) { blend_moby_animation(m, 2, 0, scale_game_frames_c2(10)); m->state = next; } else { blend_moby_animation(m, 2, 0, scale_game_frames_c2(10)); m->state = 5; - d->i168 = truncate_float_to_s32_c2(FUN_001f96b0(d->f164 * 60.0f)); + d->i168 = truncate_float_to_s32_c2(FUN_L04_001f1978(d->f164 * 60.0f)); } break; } case 8: { float z = 0.0f; - FUN_L00_0025e450(m, d->a40, &m->pos, z, z, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, 5, 15.0f, 1, 1, -1, 0); + spawn_explosion(m, d->a40, &m->pos, z, z, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, 5, 15.0f, 1, 1, -1, 0); FUN_L00_00257470(m, 0, -1); FUN_L00_00263fd8_c((char *)m, 0x5FD, (float *)&m->pos, (char *)m + 0x40, 0, 0, 0.0f, D_L10_0015F580, D_L10_0015F580, D_L10_0015F580); FUN_L00_00263fd8_c((char *)m, 0x5FE, (float *)&m->pos, (char *)m + 0x40, 0, 0, 0.0f, D_L10_0015F580, D_L10_0015F580, D_L10_0015F580); @@ -2661,7 +2664,7 @@ void FUN_L10_002e4a88(Ship_5E48 *m) { } /* Hit handling and path following for a level 10 vendor moby. */ extern char *info_5968(void *, int, int) __asm__("FUN_L00_0025a420"); -extern void seek_5968(float, void *, void *) __asm__("FUN_L06_002f34d8"); +extern void FUN_L06_002f34d8(float, void *, void *); extern int absolute_float_cf(void *, void *, int) __asm__("FUN_L00_00259740"); extern int follow_5968(float, void *, void *, int, int, void *, int) __asm__("FUN_L00_0025ff38"); extern char *D_L10_001B0930_5968[] __asm__("D_L10_001B0930"); @@ -2708,7 +2711,7 @@ void FUN_L10_002e5968(struct Moby *m) { m->hit_slot = 0xFF; trooper_anim_finish(m, d + 0xC0); if (hero.vehicle_mode == 1) { - seek_5968(101.0f, m, d + 0x110); + FUN_L06_002f34d8(101.0f, m, d + 0x110); if (*(char **)(d + 0x110) == 0) { *(int *)(d + 0x114) = 2; } else { @@ -2821,7 +2824,8 @@ extern int D_0013ED98 __attribute__((section(".sdata"))); extern int D_0013EDA0 __attribute__((sda)); extern int D_L10_0013F640 __asm__("D_L10_0013F640") __attribute__((section(".sdata"))); -void FUN_L10_002e8358(struct Moby *moby) { +void nanotech_upgrade_vendor_update(struct Moby *moby) __asm__("FUN_L10_002e8358"); +void nanotech_upgrade_vendor_update(struct Moby *moby) { int *timer; float angle; int purchase; @@ -2834,10 +2838,10 @@ void FUN_L10_002e8358(struct Moby *moby) { return; } { - angle = FUN_001f9e90(hero.motion.pos.f[0] - moby->pos.x, + angle = fast_arc_tan(hero.motion.pos.f[0] - moby->pos.x, hero.motion.pos.f[1] - moby->pos.y); if (fast_difference_between_rotations(moby->rot.z, angle) < 1.5707964f && - FUN_001f9b80(&moby->pos, hero.motion.pos.f) < 4.0f && + vector_distance(&moby->pos, hero.motion.pos.f) < 4.0f && timer[1] == 0 && D_L10_0015F5C4_vendor != 2) { FUN_L00_00266858_vendor(moby, 1); if (alternate_item_available[4] == 0) { @@ -3072,12 +3076,13 @@ extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa6 extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_sin(float) __asm__("FUN_001f9de0"); -extern float FUN_001f9e90(float, float); -extern float FUN_001f9b80(void *, void *); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void FUN_L00_001ff290(void *, void *, void *); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); -void FUN_L10_002e8ab0(struct Moby *moby) { +void gun_update(struct Moby *moby) __asm__("FUN_L10_002e8ab0"); +void gun_update(struct Moby *moby) { Vars_2E8AB0 *vars = (Vars_2E8AB0 *)moby->pvars; int *bits; float rotation[4]; @@ -3161,19 +3166,19 @@ void FUN_L10_002e8ab0(struct Moby *moby) { } if (target != 0) { moby->rot.z = fast_add_rotations(moby->rot.z, 3.1415927f); - angle = FUN_001f9e90(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y); + angle = fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y); moby->rot.z = FUN_L00_00258110(&vars->turn_velocity, moby->rot.z, angle, D_0015ED70 * 1.5707964f, D_0015ED70 * 3.1415927f, D_0015ED6C * 0.7853982f); - angle = FUN_001f9e90(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y); + angle = fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y); if (fast_difference_between_rotations(moby->rot.z, angle) < 0.04363323f) { position[0] = fast_cos(moby->rot.z) * 1.5f; position[1] = fast_sin(moby->rot.z) * 1.5f; position[2] = 0.0f; FUN_L00_001ff290(displacement, position, &moby->pos); build_spherical_offset(rotation, D_0015ED6C * 40.0f, - FUN_001f9e90(target->pos.x - position[0], target->pos.y - position[1]), - FUN_001f9e90(FUN_001f9b80(position, &target->pos), target->pos.z - position[2])); + fast_arc_tan(target->pos.x - position[0], target->pos.y - position[1]), + fast_arc_tan(vector_distance(position, &target->pos), target->pos.z - position[2])); FUN_L09_00307ba8(moby, position, rotation, scale_game_frames(30)); if (target == (struct Moby *)((char *)D_L10_0015FFD0_e[2] + (vars->targets[0] << 8))) vars->targets[0] = -1; @@ -3255,7 +3260,8 @@ extern int truncate_float_e9648(float) __asm__("FUN_001fa6d0"); extern int tick_countdown_e9648(int *) __asm__("FUN_001f9740"); /* Level 10 door: swings open once the hero enters its clip volume and sets its save bit; starts open when the bit is already set. */ -void FUN_L10_002e9648(struct Moby *moby) { +void gate_1_update(struct Moby *moby) __asm__("FUN_L10_002e9648"); +void gate_1_update(struct Moby *moby) { DoorVars_e9648 *vars = (DoorVars_e9648 *)moby->pvars; unsigned short save_id; @@ -3295,11 +3301,11 @@ void FUN_L10_002e9648(struct Moby *moby) { D_L10_001BA950[(short)save_id >> 5] |= 1 << (save_id & 31); if (inside_clip_volume_e9648(&hero.motion.pos, vars->clip_volume)) FUN_L10_002f5a50(vars->sound); - vars->timer = truncate_float_e9648(scale_time(90.0f)); + vars->timer = truncate_float_e9648(FUN_L04_001f1978(90.0f)); moby->state = 2; return; case 2: - moby->rot.y = fast_add_rotations(moby->rot.y, -1.3962634f / scale_time(90.0f)); + moby->rot.y = fast_add_rotations(moby->rot.y, -1.3962634f / FUN_L04_001f1978(90.0f)); if (tick_countdown_e9648(&vars->timer)) moby->state = 3; return; @@ -3370,7 +3376,8 @@ extern int func_001F9878_2EAD50(float) __asm__("FUN_001fa6d0"); extern float func_001FA888_2EAD50(int) __asm__("FUN_001fa6c0"); extern int func_001F9908_2EAD50(int *) __asm__("FUN_001f9740"); -void FUN_L10_002e9990(GateMoby_2EAD50 *m) +void gate_2_update(GateMoby_2EAD50 *m) __asm__("FUN_L10_002e9990"); +void gate_2_update(GateMoby_2EAD50 *m) { GateVars_2EAD50 *d = m->vars; float v[3]; @@ -3416,18 +3423,18 @@ void FUN_L10_002e9990(GateMoby_2EAD50 *m) if (d->sound > 0) { func_L10_002F6E10_2EAD50(d->sound); } - d->timer = func_001F9878_2EAD50(scale_time(90.0f)); + d->timer = func_001F9878_2EAD50(FUN_L04_001f1978(90.0f)); m->state = 2; } break; } case 2: v[0] = func_001F9F90_2EAD50(fast_add_rotations(m->rotz, 3.14159265f)) * 1.5f * - func_001FA888_2EAD50(func_001F9878_2EAD50(scale_time(90.0f)) - d->timer) / - scale_time(90.0f); + func_001FA888_2EAD50(func_001F9878_2EAD50(FUN_L04_001f1978(90.0f)) - d->timer) / + FUN_L04_001f1978(90.0f); v[1] = func_001F9FA8_2EAD50(fast_add_rotations(m->rotz, 3.14159265f)) * 1.5f * - func_001FA888_2EAD50(func_001F9878_2EAD50(scale_time(90.0f)) - d->timer) / - scale_time(90.0f); + func_001FA888_2EAD50(func_001F9878_2EAD50(FUN_L04_001f1978(90.0f)) - d->timer) / + FUN_L04_001f1978(90.0f); v[2] = 0.0f; func_001F9BD8_2EAD50(&out, &d->home, v); m->pos = out; diff --git a/src/overlays/l10/gameplay/vendor/002ea1f0.c b/src/overlays/l10/gameplay/vendor/002ea1f0.c index 88220c27ac..072d35f9c7 100644 --- a/src/overlays/l10/gameplay/vendor/002ea1f0.c +++ b/src/overlays/l10/gameplay/vendor/002ea1f0.c @@ -66,7 +66,7 @@ void FUN_L10_002ea1f0(char *m) { extern char *spawn_spark(void *, void *, void *, int, int, int, int, int, int) __asm__("FUN_00218888"); extern float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern float random_float_between(float a, float b) __asm__("FUN_002132a8"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern s32 random_integer_below(s32) __asm__("func_00213260"); @@ -106,7 +106,7 @@ void FUN_L10_002ea4e8(void *pos, short *timer, short *burst) { return; *burst = func_001FA898_r(random_float_between((float)D_L10_00161FAC, (float)D_L10_00161FB0)); - } else if (FUN_001f9770(burst)) { + } else if (fast_dec_timer_s16(burst)) { *burst = -func_001FA898_r(random_float_between((float)D_L10_00161FB4, (float)D_L10_00161FB8)); return; @@ -117,7 +117,7 @@ void FUN_L10_002ea4e8(void *pos, short *timer, short *burst) { p[3] = 2.0f; if (fast_bsphere_check((char *)p, 32.0f) == -1 && random_integer_below(3) != 0) return; - if (!FUN_001f9770(timer)) + if (!fast_dec_timer_s16(timer)) return; clear_u64_value(vel); vel[2] = D_L10_00161F68 * frame_time; @@ -148,7 +148,7 @@ void FUN_L10_002ea4e8(void *pos, short *timer, short *burst) { extern char *spawn_spark(void *, void *, void *, int, int, int, int, int, int) __asm__("FUN_00218888"); extern float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern float random_float_between(float a, float b) __asm__("FUN_002132a8"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern s32 random_integer_below(s32) __asm__("func_00213260"); @@ -187,7 +187,7 @@ void FUN_L10_002ea7b0(void *pos, short *timer) { p[3] = 5.0f; if (fast_bsphere_check((char *)p, 32.0f) == -1 && random_integer_below(3) != 0) return; - if (!FUN_001f9770(timer)) + if (!fast_dec_timer_s16(timer)) return; clear_u64_value(vel); vel[2] = D_L10_00161FBC * frame_time; @@ -215,7 +215,7 @@ void FUN_L10_002ea7b0(void *pos, short *timer) { extern char *spawn_spark(void *, void *, void *, int, int, int, int, int, int) __asm__("FUN_00218888"); extern f32 random_float_between(f32, f32) __asm__("func_002132A8"); extern float square_root(float) __asm__("FUN_001f9988"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); @@ -250,7 +250,7 @@ void FUN_L10_002eaa08(void *pos, short *timer, short *burst, float height) { float s; int a, b, c, c1; if (*burst >= 0) { - if (FUN_001f9770(burst)) { + if (fast_dec_timer_s16(burst)) { *burst = -func_001FA898_r(random_float_between((float)*(int *)&D_L10_00162044, (float)*(int *)&D_L10_00162048)); return; } @@ -262,7 +262,7 @@ void FUN_L10_002eaa08(void *pos, short *timer, short *burst, float height) { p[3] = 3.0f; p[2] -= 4.0f; if (fast_bsphere_check((char *)p, 32.0f) == -1) return; - if (!FUN_001f9770(timer)) return; + if (!fast_dec_timer_s16(timer)) return; s = random_float_between(1.0f - *(float *)&D_L10_00162020, *(float *)&D_L10_00162020 + 1.0f); a = func_001FA898_r((float)*(int *)&D_L10_00162018 * s); b = func_001FA898_r((float)*(int *)&D_L10_0016201C * s); @@ -291,7 +291,7 @@ struct L10Data { }; extern struct L10Data D_L10_0016CCE0; -extern void FUN_L00_002637f8(int); +extern void cutscene_set_camera_target(int) __asm__("FUN_L00_002637f8"); void FUN_L10_002eacd8(struct Moby *m) { switch (m->state) { @@ -312,7 +312,7 @@ void FUN_L10_002eacd8(struct Moby *m) { i = 2; else if (v == 7) i = 3; - FUN_L00_002637f8(D_L10_0016CCE0.slot[i]); + cutscene_set_camera_target(D_L10_0016CCE0.slot[i]); } } break; diff --git a/src/overlays/l11/gameplay/entities/bob.c b/src/overlays/l11/gameplay/entities/bob.c index 7257591040..529ad35c2e 100644 --- a/src/overlays/l11/gameplay/entities/bob.c +++ b/src/overlays/l11/gameplay/entities/bob.c @@ -19,7 +19,7 @@ /* Per-frame update of a pickup moby: waits for the player to come near, then grants the item. */ /* Ported from rac1-decomp (src/overlays/l11_pokitaru/vendor_002CC828.c: func_L11_002CC828), where it is exact; names translated to the US level program. */ -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern int help_request(int, int) __asm__("FUN_L00_00203908"); extern unsigned char D_0013D4E3[]; @@ -41,7 +41,7 @@ void FUN_L11_002cb668(struct Moby *moby) { break; case 2: fast_add_rotations(moby->rot.z, frame_time * 4.7123890f); - if (FUN_001f9b80(&moby->pos, D_0013E533 + 0xE9D) < 2.0f) { + if (vector_distance(&moby->pos, D_0013E533 + 0xE9D) < 2.0f) { D_0013D4C2[4] = 1; D_0013D4E3[0xB] = 1; memcard_save_data(0, -1); @@ -57,7 +57,7 @@ void FUN_L11_002cb668(struct Moby *moby) { extern char *func_0020D348_m(int); extern f32 fast_subtract_rotations(f32, f32) __asm__("func_001FA5C8"); -extern float FUN_L00_0025be00(float *p, float a, float *v, float b, float c, float d); +extern float approach_angle(float *p, float a, float *v, float b, float c, float d) __asm__("FUN_L00_0025be00"); extern float fast_add_rotations_c(float, float) __asm__("func_001FA580"); void FUN_L11_002cb810(struct Moby *moby) { @@ -86,7 +86,7 @@ void FUN_L11_002cb810(struct Moby *moby) { f = fast_add_rotations_c(*(float *)(data + 4), 0.20769417f); else f = fast_subtract_rotations(*(float *)(data + 4), 0.20769417f); - if (FUN_L00_0025be00(&moby->rot.z, f, (float *)data, frame_time_sq * 0.34906584f, frame_time_sq * 0.34906584f, frame_time * 0.7853982f) == 0.0f) + if (approach_angle(&moby->rot.z, f, (float *)data, frame_time_sq * 0.34906584f, frame_time_sq * 0.34906584f, frame_time * 0.7853982f) == 0.0f) MOBY(moby)->state = 3; break; } @@ -161,35 +161,36 @@ typedef struct { extern void FUN_L05_00317398(void *); extern int FUN_00214720(void *, int); -extern int FUN_L00_00266448(void *, void *); -extern int FUN_L00_002668a0(void *, void *); -extern void FUN_L01_002783a8(void *, float); +extern int update_npc_dialogue(void *, void *) __asm__("FUN_L00_00266448"); +extern int initialize_npc_dialogue(void *, void *) __asm__("FUN_L00_002668a0"); +extern void begin_dialogue_camera_transition(void *, float) __asm__("FUN_L01_002783a8"); extern void FUN_L00_00260860(int, int); -extern void FUN_L00_00284e50(void *, void *); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern void memcard_save_data_d0710(int, int) __asm__("FUN_0020b178"); extern void FUN_L00_002039a0(void); extern int help_request(int, int) __asm__("FUN_L00_00203908"); extern unsigned char D_0013D4C3 __attribute__((section(".data"))); extern int D_L11_0015F5C4; -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9e90(float, float); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); -extern float FUN_001fa5c8(float, float); +extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); -extern int FUN_001f9740(int *); +extern int fast_dec_timer(int *) __asm__("FUN_001f9740"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); extern void FUN_00214db0(void *, float, float, float); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); -extern void FUN_L00_002628d8(float, float, void *, void *, int); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); +extern void update_joint_animation(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); -/* Watcher update, same routine as FUN_L08_00302ce8 with this level's states and data layout. */ -void FUN_L11_002d0710(WM11 *m) { +/* Watcher update, same routine as commando_update with this level's states and data layout. */ +void bob_update(WM11 *m) __asm__("FUN_L11_002d0710"); +void bob_update(WM11 *m) { WS11 scratch; WD11 *d = (WD11 *)m->data; float rate; @@ -203,13 +204,13 @@ void FUN_L11_002d0710(WM11 *m) { } else { m->state = 1; } - FUN_L00_002668a0(m, d); + initialize_npc_dialogue(m, d); d->f0C = 3.7f; break; case 1: if (FUN_00214720(hero.motion.pos.f, d->region)) { - if (FUN_L00_00266448(m, d)) { - FUN_L01_002783a8(m, 2.7f); + if (update_npc_dialogue(m, d)) { + begin_dialogue_camera_transition(m, 2.7f); m->state = 2; } } @@ -219,7 +220,7 @@ void FUN_L11_002d0710(WM11 *m) { m->state = 1; if (d->h04 == 2) { FUN_L00_00260860(3, 1); - FUN_L00_00284e50(hero.motion.pos.f, hero.motion.pos.f + 4); + jet_reset_camera(hero.motion.pos.f, hero.motion.pos.f + 4); memcard_save_data_d0710(0, -1); FUN_L00_002039a0(); help_request(0x2AFB, 0x3D); @@ -233,26 +234,26 @@ void FUN_L11_002d0710(WM11 *m) { if (m->animation == 0) { char *player = D_0013E533 + 0xE9D; tracking = 1; - if (FUN_001f9b80(m->position, player) < 8.0f && + if (vector_distance(m->position, player) < 8.0f && fast_difference_between_rotations( - m->yaw, FUN_001f9e90(((WP11 *)(D_0013E533 + 0xE1D))->aim[0] - m->position[0], + m->yaw, fast_arc_tan(((WP11 *)(D_0013E533 + 0xE1D))->aim[0] - m->position[0], ((WP11 *)(D_0013E533 + 0xE1D))->aim[1] - m->position[1])) < 1.5707964f) { if (fast_vec_length(player + 0x80) > 0.01f) d->moving_timer = scale_game_frames(120); else - FUN_001f9740(&d->moving_timer); + fast_dec_timer(&d->moving_timer); } else if (d->moving_timer) { d->moving_timer = 0; qcopy(d->target, hero.motion.unkD0.f); } - if (FUN_001f9740(&d->target_timer)) { + if (fast_dec_timer(&d->target_timer)) { float heading; d->target_timer = truncate_float_to_s32(multiply_global_factor_ed64(random_float_between(180.0f, 300.0f))); heading = fast_add_rotations(m->yaw, random_float_between(-90.0f, 90.0f) * DEG_TO_RAD); FUN_00214db0(d->target, 6.0f, heading, random_float_between(0.0f, 30.0f) * DEG_TO_RAD); - FUN_001f9a10(d->target, d->target, m->position); + fast_vec_add(d->target, d->target, m->position); } if (d->moving_timer) { qcopy(scratch.target, hero.motion.unkD0.f); @@ -267,9 +268,9 @@ void FUN_L11_002d0710(WM11 *m) { float pitch; qcopy(scratch.eye, m->position); scratch.eye[2] += 1.0f; - FUN_001f9a28(scratch.delta, scratch.target, scratch.eye); - yaw = FUN_001fa5c8(FUN_001f9e90(scratch.delta[0], scratch.delta[1]), m->yaw); - pitch = -FUN_001f9e90(vector_length_xy(scratch.delta), scratch.delta[2]); + fast_vec_sub(scratch.delta, scratch.target, scratch.eye); + yaw = fast_subtract_rotations(fast_arc_tan(scratch.delta[0], scratch.delta[1]), m->yaw); + pitch = -fast_arc_tan(vector_length_xy(scratch.delta), scratch.delta[2]); if (yaw > 1.5707964f) yaw = 1.5707964f; else if (yaw < -1.5707964f) @@ -283,8 +284,8 @@ void FUN_L11_002d0710(WM11 *m) { } if (big_head_cheat_enabled) d->height = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); } extern float distance_xyz(void *, void *) __asm__("FUN_001f9b48"); @@ -299,7 +300,8 @@ extern void FUN_L11_002d1340(void *); extern void FUN_L11_002d14b0(void *); void FUN_L11_002d27b0(WM11 *m); -void FUN_L11_002d0fa8(struct Moby *moby) { +void resort_owner_update(struct Moby *moby) __asm__("FUN_L11_002d0fa8"); +void resort_owner_update(struct Moby *moby) { FUN_L02_002e0cd8(moby); if (moby->visible && distance_xyz(&moby->pos, D_L11_001677C0) < 38.0f) { FUN_L00_0025a120(moby); @@ -310,17 +312,17 @@ void FUN_L11_002d0fa8(struct Moby *moby) { FUN_L11_002d14b0(moby); FUN_L11_002d27b0(moby); } -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_sin(float) __asm__("FUN_001f9de0"); extern int FUN_00214cc8(void *, float); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern float FUN_L00_0025abf0(void *, void *, float, int, float); extern void FUN_L00_002604f0(void *, void *, void *, void *, void *, void *); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void FUN_00212f90(void *, int, int, int); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); extern float D_0015ED70; @@ -354,9 +356,9 @@ void FUN_L11_002d1030(void *mp) { case 10: { char *m48 = (char *)moby + 0x48; - ang = FUN_001f9e90(*(float *)(d + 0x120) - *(float *)((char *)moby + 0x10), + ang = fast_arc_tan(*(float *)(d + 0x120) - *(float *)((char *)moby + 0x10), *(float *)(d + 0x124) - *(float *)((char *)moby + 0x14)); - FUN_L00_0025be00((float *)(m48), ang, (float *)(d + 0x150), D_0015ED70 * 12.566371f, + approach_angle((float *)(m48), ang, (float *)(d + 0x150), D_0015ED70 * 12.566371f, D_0015ED70 * 25.132742f, D_0015ED6C * 12.566371f); *(float *)(d + 0x130) = fast_cos(*(float *)(m48)) * *(float *)(d + 0x154); f0 = fast_sin(*(float *)(m48)); @@ -378,8 +380,8 @@ void FUN_L11_002d1030(void *mp) { } case 7: if (FUN_00214cc8(moby, 9.0f)) { - FUN_001f9a28(d + 0x130, d + 0x120, (char *)moby + 0x10); - f0 = (float)FUN_001f96f8(0x3C); + fast_vec_sub(d + 0x130, d + 0x120, (char *)moby + 0x10); + f0 = (float)scale_game_frames(0x3C); fast_vec_scale(d + 0x130, d + 0x130, 1.0f / f0); f0 = vector_length_xy(d + 0x130); *(float *)(d + 0x138) = FUN_L00_0025abf0((char *)moby + 0x10, d + 0x120, f0, 0, -(D_0015ED70 * 10.8f)); @@ -406,12 +408,12 @@ void FUN_L11_002d1030(void *mp) { break; } if (moby->prev_seq != 5) - FUN_00212f90(moby, 5, 0, FUN_001f96f8(0x14)); + FUN_00212f90(moby, 5, 0, scale_game_frames(0x14)); break; case 13: if (D_L11_0016D260[12] != 1) break; - if (D_L11_0016D260[13] != FUN_001f96f8(0x7D0)) + if (D_L11_0016D260[13] != scale_game_frames(0x7D0)) break; FUN_L11_002cb990((struct Moby *)(D_L11_0015FFD8 + (*(int *)(d + 0x104) << 8))); break; @@ -424,7 +426,7 @@ void FUN_L11_002d1030(void *mp) { /* moves the parts' positions and stores the moby's displacement since last frame */ /* Ported from rac1-decomp (src/overlays/l11_pokitaru/vendor_002CC828.c: func_L11_002D2500), where it is exact; names translated to the US level program. */ -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void FUN_L00_00258830(int, int, float, float, float, int); extern void FUN_L00_00261d78(float, void *, void *, void *); @@ -451,19 +453,19 @@ void FUN_L11_002d1340(void *mp) { break; } } - FUN_001f9a28(d + 0x140, moby + 0x10, A); + fast_vec_sub(d + 0x140, moby + 0x10, A); } extern int FUN_L11_002d2460(struct Moby *moby); extern int FUN_L11_002d2340(struct Moby *moby, char *other); extern int FUN_L11_002d25e8(struct Moby *m, float *out); -extern void set_state_14b0(struct Moby *moby, int state) __asm__("FUN_L11_002d2088"); +extern void FUN_L11_002d2088_c(struct Moby *moby, int state) __asm__("FUN_L11_002d2088"); extern float ground_height_14b0(void *) __asm__("FUN_L00_00259710"); extern void scale_vector_14b0(void *out, void *a, f32 s) __asm__("FUN_001f9bf8"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); extern void euler_rotation_basis(void *, void *) __asm__("FUN_001fa030"); extern void FUN_L05_0028be78(void *, int, int); -extern void FUN_L00_002502a0(int); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); extern void FUN_L00_00266858(void *, int); extern int FUN_L11_0030a830(struct Moby *arg); extern void FUN_L11_0030a840(unsigned char *arg); @@ -486,10 +488,10 @@ extern float D_L11_00161410 __attribute__((sda)); extern float D_L11_00161414 __attribute__((sda)); extern float D_L11_00161418 __attribute__((sda)); -/* Pvars of the path-walking NPC run by FUN_L11_002d0fa8. */ +/* Pvars of the path-walking NPC run by resort_owner_update. */ struct PokKeeperVars { u8 pad00[0x20]; - u8 talk[0xC]; /* 0x20: talk prompt (FUN_L00_002668a0 / FUN_L00_00266448) */ + u8 talk[0xC]; /* 0x20: talk prompt (initialize_npc_dialogue / update_npc_dialogue) */ f32 talk_range; /* 0x2C */ u8 pad30[0x26]; s16 unk56; @@ -528,22 +530,22 @@ void FUN_L11_002d14b0(void *arg) { float r[4]; if (moby->state >= 3 && moby->state <= 5 && proximity == 0) { - set_state_14b0(moby, 6); + FUN_L11_002d2088_c(moby, 6); return; } if (moby->state >= 4 && moby->state <= 6) { scale_vector_14b0(v, &moby->rot_row0, 3.0f); - FUN_001f9a10(v, v, &moby->pos); + fast_vec_add(v, v, &moby->pos); if (FUN_L11_002d25e8(moby, v)) { qcopy(&d->target, v); d->target.z = ground_height_14b0(&d->target); d->next_state = 3; - set_state_14b0(moby, 7); + FUN_L11_002d2088_c(moby, 7); } } switch (moby->state) { case 0: - FUN_L00_002668a0(moby, d->talk); + initialize_npc_dialogue(moby, d->talk); moby->update_dist = 0xFF; FUN_L05_0028be78(&d->unk60[0], 1, d->unk70[0]); FUN_L05_0028be78(&d->unk60[1], 1, d->unk70[1]); @@ -564,7 +566,7 @@ void FUN_L11_002d14b0(void *arg) { qcopy_nc(&moby->pos, &path_points_14b0[d->points[3]].pos); qcopy_nc(&moby->rot, &path_points_14b0[d->points[3]].rot); FUN_L11_002cb990((struct Moby *)(D_L11_0015FFD8 + (d->unk104 << 8))); - set_state_14b0(moby, 0xE); + FUN_L11_002d2088_c(moby, 0xE); d->talk_range = 10.0f; FUN_L11_0030a840((unsigned char *)(D_L11_0015FFD8 + (d->gates[0] << 8))); FUN_L11_0030a840((unsigned char *)(D_L11_0015FFD8 + (d->gates[1] << 8))); @@ -576,7 +578,7 @@ void FUN_L11_002d14b0(void *arg) { d->leg = 1; qcopy_nc(&moby->pos, &path_points_14b0[d->points[1]].pos); qcopy_nc(&moby->rot, &path_points_14b0[d->points[1]].rot); - set_state_14b0(moby, 6); + FUN_L11_002d2088_c(moby, 6); path_points_14b0[d->unk114].pos.z -= 500.0f; FUN_L11_0030a840((unsigned char *)(D_L11_0015FFD8 + (d->gates[0] << 8))); break; @@ -585,142 +587,142 @@ void FUN_L11_002d14b0(void *arg) { path_points_14b0[d->unk114].pos.z -= 500.0f; d->leg = 0; d->talk_range = 5.0f; - set_state_14b0(moby, 1); + FUN_L11_002d2088_c(moby, 1); break; case 1: if (d->unk56 == 0) { - if (hero.air_frames.s == 0 && FUN_L00_00266448(moby, d->talk)) { - FUN_L01_002783a8(moby, 2.5f); - set_state_14b0(moby, 2); + if (hero.air_frames.s == 0 && update_npc_dialogue(moby, d->talk)) { + begin_dialogue_camera_transition(moby, 2.5f); + FUN_L11_002d2088_c(moby, 2); } - } else if (FUN_001f9b80(&moby->pos, &hero.motion.pos) < 6.0f) { - set_state_14b0(moby, 3); + } else if (vector_distance(&moby->pos, &hero.motion.pos) < 6.0f) { + FUN_L11_002d2088_c(moby, 3); } break; case 2: if (D_L11_0015F5C4 != 2) - set_state_14b0(moby, 3); + FUN_L11_002d2088_c(moby, 3); break; case 3: - if (FUN_001f9b80(&moby->pos, &hero.motion.pos) > 6.0f && + if (vector_distance(&moby->pos, &hero.motion.pos) > 6.0f && FUN_L11_002d2340(moby, (char *)&hero.motion.pos) && proximity == 1) - set_state_14b0(moby, 4); + FUN_L11_002d2088_c(moby, 4); break; case 4: - if (FUN_001f9b80(&moby->pos, &hero.motion.pos) < 3.0f || + if (vector_distance(&moby->pos, &hero.motion.pos) < 3.0f || !FUN_L11_002d2340(moby, (char *)&hero.motion.pos) || proximity == 2) - set_state_14b0(moby, 3); - else if (FUN_001f9b80(&moby->pos, &hero.motion.pos) > 8.0f) - set_state_14b0(moby, 5); + FUN_L11_002d2088_c(moby, 3); + else if (vector_distance(&moby->pos, &hero.motion.pos) > 8.0f) + FUN_L11_002d2088_c(moby, 5); break; case 5: - if (FUN_001f9b80(&moby->pos, &hero.motion.pos) < 3.0f || + if (vector_distance(&moby->pos, &hero.motion.pos) < 3.0f || !FUN_L11_002d2340(moby, (char *)&hero.motion.pos) || proximity == 2) - set_state_14b0(moby, 3); - else if (FUN_001f9b80(&moby->pos, &hero.motion.pos) < 4.0f) - set_state_14b0(moby, 4); + FUN_L11_002d2088_c(moby, 3); + else if (vector_distance(&moby->pos, &hero.motion.pos) < 4.0f) + FUN_L11_002d2088_c(moby, 4); break; case 6: FUN_L11_002d2340(moby, (char *)&path_points_14b0[d->points[d->leg]].pos); - if (FUN_001f9b80(&moby->pos, &d->target) < 1.0f) { + if (vector_distance(&moby->pos, &d->target) < 1.0f) { switch (d->leg) { case 0: { struct Moby *o = (struct Moby *)(D_L11_0015FFD8 + (d->gates[0] << 8)); qcopy(&d->target, &o->pos); scale_vector_14b0(v, &o->rot_row0, D_L11_00161418); - FUN_001f9a10(&d->target, &d->target, v); + fast_vec_add(&d->target, &d->target, v); scale_vector_14b0(v, &o->rot_row1, D_L11_00161414); - FUN_001f9a10(&d->target, &d->target, v); + fast_vec_add(&d->target, &d->target, v); scale_vector_14b0(v, &o->rot_row2, D_L11_00161410); - FUN_001f9a10(&d->target, &d->target, v); + fast_vec_add(&d->target, &d->target, v); d->next_state = 8; - set_state_14b0(moby, 7); + FUN_L11_002d2088_c(moby, 7); break; } case 1: { struct Moby *o = (struct Moby *)(D_L11_0015FFD8 + (d->gates[1] << 8)); qcopy(&d->target, &o->pos); scale_vector_14b0(v, &o->rot_row0, D_L11_00161418); - FUN_001f9a10(&d->target, &d->target, v); + fast_vec_add(&d->target, &d->target, v); scale_vector_14b0(v, &o->rot_row1, -D_L11_00161414); - FUN_001f9a10(&d->target, &d->target, v); + fast_vec_add(&d->target, &d->target, v); scale_vector_14b0(v, &o->rot_row2, D_L11_00161410); - FUN_001f9a10(&d->target, &d->target, v); + fast_vec_add(&d->target, &d->target, v); path_points_14b0[d->unk110].pos.z += 500.0f; d->next_state = 8; - set_state_14b0(moby, 7); + FUN_L11_002d2088_c(moby, 7); break; } case 2: - set_state_14b0(moby, 0xB); + FUN_L11_002d2088_c(moby, 0xB); break; case 3: path_points_14b0[d->unk114].pos.z += 500.0f; - set_state_14b0(moby, 0xC); + FUN_L11_002d2088_c(moby, 0xC); break; } } break; case 12: d->talk_range = 255.0f; - if (FUN_L00_00266448(moby, d->talk)) { - FUN_L00_002502a0(d->unk10C); + if (update_npc_dialogue(moby, d->talk)) { + jet_clear_persistent(d->unk10C); D_0013D3DC = 1; FUN_L00_00266858(moby, 2); qcopy_nc(&moby->pos, &path_points_14b0[d->points[d->leg]].pos); qcopy_nc(&moby->rot, &path_points_14b0[d->points[d->leg]].rot); euler_rotation_basis(&moby->rot_row0, &moby->rot); scale_vector_14b0(v, &moby->rot_row0, 2.0f); - FUN_001f9a10(v, v, &moby->pos); + fast_vec_add(v, v, &moby->pos); qcopy(r, &moby->rot); r[2] = fast_add_rotations(r[2], 3.14159f); qcopy(D_L11_0016D270, v); qcopy(D_L11_0016D270 + 0x10, r); *(short *)(D_L11_0016D270 + 0x36) = 1; - FUN_L01_002783a8(moby, 2.5f); - set_state_14b0(moby, 0xD); + begin_dialogue_camera_transition(moby, 2.5f); + FUN_L11_002d2088_c(moby, 0xD); } break; case 13: if (D_L11_0015F5C4 != 2) { FUN_L11_002cb990((struct Moby *)(D_L11_0015FFD8 + (d->unk104 << 8))); - set_state_14b0(moby, 0xE); + FUN_L11_002d2088_c(moby, 0xE); } break; case 7: if (moby->anim_flags & 2) - set_state_14b0(moby, d->next_state); + FUN_L11_002d2088_c(moby, d->next_state); break; case 8: - if (FUN_001f9b80(&moby->pos, &d->target) < 0.5f) - set_state_14b0(moby, 9); + if (vector_distance(&moby->pos, &d->target) < 0.5f) + FUN_L11_002d2088_c(moby, 9); break; case 9: { int i = d->leg != 0; if (FUN_L11_0030a830((struct Moby *)(D_L11_0015FFD8 + (d->gates[i] << 8)))) - set_state_14b0(moby, 0xA); + FUN_L11_002d2088_c(moby, 0xA); } break; case 10: - if (FUN_001f9b80(&moby->pos, &d->target) < 0.5f) { + if (vector_distance(&moby->pos, &d->target) < 0.5f) { int n = ++d->leg; qcopy(&d->target, &path_points_14b0[d->unkD0[n]].pos); d->next_state = 4; - set_state_14b0(moby, 7); + FUN_L11_002d2088_c(moby, 7); } break; case 11: if (FUN_L11_0030a830((struct Moby *)(D_L11_0015FFD8 + (d->unk100 << 8)))) { d->leg += 1; - set_state_14b0(moby, 3); + FUN_L11_002d2088_c(moby, 3); } break; case 14: if (D_0014C050[d->unk118 + D_0015ED84 * 16] == 0xFF && D_001413D4_14b0 != 0x32 && - FUN_L00_00266448(moby, d->talk)) { - FUN_L01_002783a8(moby, 2.5f); - set_state_14b0(moby, 0xF); + update_npc_dialogue(moby, d->talk)) { + begin_dialogue_camera_transition(moby, 2.5f); + FUN_L11_002d2088_c(moby, 0xF); } break; case 15: @@ -733,11 +735,11 @@ void FUN_L11_002d14b0(void *arg) { break; } } -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void FUN_00212f90(void *, int, int, int); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern float D_L11_001613D0 __attribute__((sda)); extern float D_L11_001613D4 __attribute__((sda)); float D_L11_00161400 = -3.0f; @@ -755,7 +757,7 @@ void FUN_L11_002d2088(struct Moby *moby, unsigned char state) { case 12: case 14: if (moby->prev_seq != 0) - FUN_00212f90(moby, 0, 0, FUN_001f96f8(0x14)); + FUN_00212f90(moby, 0, 0, scale_game_frames(0x14)); if (moby->state == 14) *(float *)(d + 0x2C) = 10.0f; clear_u64_value(d + 0x130); @@ -764,23 +766,23 @@ void FUN_L11_002d2088(struct Moby *moby, unsigned char state) { break; case 4: if (moby->prev_seq != 2) - FUN_00212f90(moby, 2, 0, FUN_001f96f8(0x14)); + FUN_00212f90(moby, 2, 0, scale_game_frames(0x14)); *(float *)(d + 0x154) = D_L11_001613D0 * frame_time; break; case 5: case 6: if (moby->prev_seq != 3) - FUN_00212f90(moby, 3, 0, FUN_001f96f8(0x14)); + FUN_00212f90(moby, 3, 0, scale_game_frames(0x14)); *(float *)(d + 0x154) = D_L11_001613D4 * frame_time; break; case 7: if (moby->prev_seq != 4) - FUN_00212f90(moby, 4, 0, FUN_001f96f8(0x14)); + FUN_00212f90(moby, 4, 0, scale_game_frames(0x14)); clear_u64_value(d + 0x130); break; case 8: if (moby->prev_seq != 3) - FUN_00212f90(moby, 3, 0, FUN_001f96f8(0x14)); + FUN_00212f90(moby, 3, 0, scale_game_frames(0x14)); { int *tbl = (int *)(d + 0xF0); unsigned int idx = 0U < *(unsigned int *)(d + 0x158); @@ -792,18 +794,18 @@ void FUN_L11_002d2088(struct Moby *moby, unsigned char state) { o += p << 8; qcopy(d + 0x120, o + 0x10); transform_vector_by_basis(tmp, &D_L11_001613E0, o + 0xC0); - FUN_001f9a10(d + 0x120, d + 0x120, tmp); + fast_vec_add(d + 0x120, d + 0x120, tmp); } break; case 9: case 16: if (moby->prev_seq != 0) - FUN_00212f90(moby, 0, 0, FUN_001f96f8(0x14)); + FUN_00212f90(moby, 0, 0, scale_game_frames(0x14)); clear_u64_value(d + 0x130); break; case 10: if (moby->prev_seq != 3) - FUN_00212f90(moby, 3, 0, FUN_001f96f8(0x14)); + FUN_00212f90(moby, 3, 0, scale_game_frames(0x14)); { int *tbl = (int *)(d + 0xF0); unsigned int idx = 0U < *(unsigned int *)(d + 0x158); @@ -815,7 +817,7 @@ void FUN_L11_002d2088(struct Moby *moby, unsigned char state) { o += p << 8; qcopy(d + 0x120, o + 0x10); transform_vector_by_basis(tmp, &D_L11_00161400, o + 0xC0); - FUN_001f9a10(d + 0x120, d + 0x120, tmp); + fast_vec_add(d + 0x120, d + 0x120, tmp); } break; default: @@ -836,7 +838,7 @@ struct TgtData { extern int *D_L11_001B0EB0[]; extern int point_in_path_xy(void *, void *, int) __asm__("FUN_L00_00259740"); -extern int FUN_L01_00276fe8(int *, int, int, void *, void *, void *, float); +extern int follow_path(int *, int, int, void *, void *, void *, float) __asm__("FUN_L01_00276fe8"); int FUN_L11_002d2340(struct Moby *moby, char *other) { struct TgtData *d = (struct TgtData *)moby->pvars; @@ -863,7 +865,7 @@ int FUN_L11_002d2340(struct Moby *moby, char *other) { default: break; } - return FUN_L01_00276fe8(buf, n, d->b[d->idx], &moby->pos, other, d->e, 0.2f) != 0; + return follow_path(buf, n, d->b[d->idx], &moby->pos, other, d->e, 0.2f) != 0; } extern int D_L11_0015FFD8; extern int FUN_L11_00316128(char *); @@ -914,7 +916,7 @@ int FUN_L11_002d2460(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/l11_pokitaru/vendor_002CC828.c: func_L11_002D37A8), where it is exact; names translated to the US level program. */ extern f32 vector_length_xyz(void *a) __asm__("FUN_001f9af0"); -extern int FUN_001efa68(void *, void *, int, void *, int); +extern int collision_line(void *, void *, int, void *, int) __asm__("FUN_001efa68"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void normalize_vector_xyz(void *out, void *a, f32 len) __asm__("FUN_001f9bf8"); extern void subtract_vector_xyz(void *out, void *a, void *b) __asm__("FUN_001f9a28"); @@ -953,7 +955,7 @@ int FUN_L11_002d25e8(struct Moby *m, float *out) { qcopy(b, pos); b[2] += 0.15f; a[2] = g + 0.15f; - if (FUN_001efa68(b, a, 2, m, 0)) { + if (collision_line(b, a, 2, m, 0)) { a[2] = g; qcopy(out, a); return 1; @@ -1009,9 +1011,9 @@ void FUN_L11_002d27b0(WM11 *m) { float pitch; qcopy(scratch.eye, m->position); scratch.eye[2] += 1.0f; - FUN_001f9a28(scratch.delta, scratch.target, scratch.eye); - yaw = FUN_001fa5c8(FUN_001f9e90(scratch.delta[0], scratch.delta[1]), m->yaw); - pitch = -FUN_001f9e90(vector_length_xy(scratch.delta), scratch.delta[2]); + fast_vec_sub(scratch.delta, scratch.target, scratch.eye); + yaw = fast_subtract_rotations(fast_arc_tan(scratch.delta[0], scratch.delta[1]), m->yaw); + pitch = -fast_arc_tan(vector_length_xy(scratch.delta), scratch.delta[2]); if (yaw > 1.2217305f) yaw = 1.2217305f; else if (yaw < -1.2217305f) @@ -1026,10 +1028,10 @@ void FUN_L11_002d27b0(WM11 *m) { } if (big_head_cheat_enabled) d->height = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); } -/* Pokitaru sentry pvars (class of FUN_L11_002f0e40). */ +/* Pokitaru sentry pvars (class of fred_pokitaru_update). */ struct PokSentryVars { char pad00[4]; short h04; @@ -1059,10 +1061,11 @@ extern char *D_L11_001600EC; extern struct UsageStat usage_stats_f0e40[] __asm__("D_00141968") __attribute__((section(".data"))); extern void mark_moby_for_removal_f0e40(void *) __asm__("FUN_0020c828"); extern float absolute_float_f0e40(float) __asm__("FUN_001f99c0"); -extern void FUN_L00_002502a0(int); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); extern void queue_dialogue_message(int, int) __asm__("FUN_L00_00263d40"); -void FUN_L11_002f0e40(struct Moby *moby) { +void fred_pokitaru_update(struct Moby *moby) __asm__("FUN_L11_002f0e40"); +void fred_pokitaru_update(struct Moby *moby) { WS11 scratch; struct PokSentryVars *d = (struct PokSentryVars *)moby->pvars; float rate; @@ -1083,12 +1086,12 @@ void FUN_L11_002f0e40(struct Moby *moby) { mark_moby_for_removal_f0e40(moby); return; } - FUN_L00_002668a0(moby, d); + initialize_npc_dialogue(moby, d); d->f0C = 4.0f; break; case 1: - if (FUN_L00_00266448(moby, d)) { - FUN_L01_002783a8(moby, 3.0f); + if (update_npc_dialogue(moby, d)) { + begin_dialogue_camera_transition(moby, 3.0f); moby->state = 2; } if (alternate_item_available[1] == 0 && discount_purchase_pricing[0] == 0) { @@ -1105,9 +1108,9 @@ void FUN_L11_002f0e40(struct Moby *moby) { distance_xyz(hero.motion.pos.f, &moby->pos) < 4.0f && absolute_float_f0e40(hero.motion.pos.f[2] - moby->pos.z) < 4.0f) { char *entry; - FUN_L00_002502a0(moby->mission); + jet_clear_persistent(moby->mission); entry = D_L11_001600EC + d->slot * 128; - FUN_L00_00284e50(entry + 0x30, entry + 0x70); + jet_reset_camera(entry + 0x30, entry + 0x70); } break; case 2: @@ -1130,26 +1133,26 @@ void FUN_L11_002f0e40(struct Moby *moby) { if (moby->prev_seq == 1) { char *player = D_0013E533 + 0xE9D; tracking = 1; - if (FUN_001f9b80(&moby->pos, player) < 8.0f && + if (vector_distance(&moby->pos, player) < 8.0f && fast_difference_between_rotations( - moby->rot.z, FUN_001f9e90(((WP11 *)(D_0013E533 + 0xE1D))->aim[0] - moby->pos.x, + moby->rot.z, fast_arc_tan(((WP11 *)(D_0013E533 + 0xE1D))->aim[0] - moby->pos.x, ((WP11 *)(D_0013E533 + 0xE1D))->aim[1] - moby->pos.y)) < 1.5707964f) { if (fast_vec_length(player + 0x80) > 0.01f) d->moving_timer = scale_game_frames(120); else - FUN_001f9740(&d->moving_timer); + fast_dec_timer(&d->moving_timer); } else if (d->moving_timer) { d->moving_timer = 0; qcopy(d->target, hero.motion.unkD0.f); } - if (FUN_001f9740(&d->target_timer)) { + if (fast_dec_timer(&d->target_timer)) { float heading; d->target_timer = truncate_float_to_s32(multiply_global_factor_ed64(random_float_between(180.0f, 300.0f))); heading = fast_add_rotations(moby->rot.z, random_float_between(-90.0f, 90.0f) * DEG_TO_RAD); FUN_00214db0(d->target, 6.0f, heading, random_float_between(0.0f, 30.0f) * DEG_TO_RAD); - FUN_001f9a10(d->target, d->target, &moby->pos); + fast_vec_add(d->target, d->target, &moby->pos); } if (d->moving_timer) { qcopy(scratch.target, hero.motion.unkD0.f); @@ -1164,9 +1167,9 @@ void FUN_L11_002f0e40(struct Moby *moby) { float pitch; qcopy(scratch.eye, &moby->pos); scratch.eye[2] += 1.0f; - FUN_001f9a28(scratch.delta, scratch.target, scratch.eye); - yaw = FUN_001fa5c8(FUN_001f9e90(scratch.delta[0], scratch.delta[1]), moby->rot.z); - pitch = -FUN_001f9e90(vector_length_xy(scratch.delta), scratch.delta[2]); + fast_vec_sub(scratch.delta, scratch.target, scratch.eye); + yaw = fast_subtract_rotations(fast_arc_tan(scratch.delta[0], scratch.delta[1]), moby->rot.z); + pitch = -fast_arc_tan(vector_length_xy(scratch.delta), scratch.delta[2]); if (yaw > 1.5707964f) yaw = 1.5707964f; else if (yaw < -1.5707964f) @@ -1180,8 +1183,8 @@ void FUN_L11_002f0e40(struct Moby *moby) { } if (big_head_cheat_enabled) d->height = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, moby, d->body, 0); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, moby, d->head, 1); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, moby, d->body, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, moby, d->head, 1); } #include "qcopy.h" @@ -1213,10 +1216,11 @@ extern int enqueue_callback_2518(void (*)(char *), char *) __asm__("FUN_001f4600 extern float D_L11_00161910 __attribute__((sda)); extern float D_L11_00161914 __attribute__((sda)); extern float D_L11_00161918 __attribute__((sda)); -/* L11 twin of FUN_L01_00308bd8: a three-part switch moby that, once the hero +/* L11 twin of teleporter_update: a three-part switch moby that, once the hero * stands on it in mission state 0xB and presses the button, swings its parts * open and moves the linked moby (or its fallback) along. */ -void FUN_L11_002f2518(struct Moby *moby) { +void teleporter_update(struct Moby *moby) __asm__("FUN_L11_002f2518"); +void teleporter_update(struct Moby *moby) { char *data = (char *)moby->pvars; switch (moby->state) { @@ -1557,7 +1561,7 @@ typedef struct { } MobyAnim_309378; extern char *FUN_L00_0026daa0(char *, int, int, int, float); -extern void *FUN_002141f8(char *); +extern void *suck_get_aim_height(char *) __asm__("FUN_002141f8"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); void blend_moby_animation_309378(MobyAnim_309378 *arg0, int arg1, int arg2, int arg3) __asm__("FUN_00212f90"); @@ -1578,7 +1582,7 @@ unsigned char *FUN_L11_00309378(char *src, char *pos, char *target, char *vec, i qcopy(moby + 0x40, vec); if (target != 0) { char *e; - e = FUN_002141f8(target); + e = suck_get_aim_height(target); if (e != 0) { *(unsigned short *)(e + 0x1E) |= 0x80; } @@ -1651,7 +1655,8 @@ extern float D_L11_00161DD8 __attribute__((sda)); extern float D_L11_00161DDC __attribute__((sda)); extern float D_L11_00161DEC __attribute__((sda)); extern float D_L11_00161DF0 __attribute__((sda)); -void FUN_L11_00309ac0(struct Moby *moby) { +void pokitaru_boat_update(struct Moby *moby) __asm__("FUN_L11_00309ac0"); +void pokitaru_boat_update(struct Moby *moby) { struct PokPv_309ac0 *pv = (struct PokPv_309ac0 *)moby->pvars; float start_pos[4]; float start_rot[4]; @@ -1711,7 +1716,7 @@ void FUN_L11_00309ac0(struct Moby *moby) { n = path[0]; qcopy(&moby->pos, (char *)path + n * 16 - 16); last = (float *)((char *)path + (n - 1) * 16); - moby->rot.z = FUN_001f9e90(last[4] - moby->pos.x, last[5] - moby->pos.y); + moby->rot.z = fast_arc_tan(last[4] - moby->pos.x, last[5] - moby->pos.y); moby->state = 5; } break; @@ -1783,7 +1788,7 @@ void FUN_L11_00309ac0(struct Moby *moby) { } moby->state = 3; } - FUN_L00_0025be00(&moby->rot.z, FUN_001f9e90(target[0] - moby->pos.x, target[1] - moby->pos.y), pv->vel_d8, + approach_angle(&moby->rot.z, fast_arc_tan(target[0] - moby->pos.x, target[1] - moby->pos.y), pv->vel_d8, D_L11_00161DD8 * 0.017453292f * frame_time_sq, D_L11_00161DD8 * 0.017453292f * frame_time_sq, D_L11_00161DDC * 0.017453292f * frame_time); @@ -1911,7 +1916,7 @@ void FUN_L11_0030a500(struct Moby *moby) { FUN_L00_001fff28(d->parts[i].joint, 0, d->angle[i]); } } - if (FUN_001f9b80(&moby->pos, D_L11_001677C0) > 38.0f) + if (vector_distance(&moby->pos, D_L11_001677C0) > 38.0f) return; if (moby->state == 1 && (level_frame & 1)) return; diff --git a/src/overlays/l11/gameplay/entities/oil_tanker_front.c b/src/overlays/l11/gameplay/entities/oil_tanker_front.c index 2c52c888d6..7fb6ee42d2 100644 --- a/src/overlays/l11/gameplay/entities/oil_tanker_front.c +++ b/src/overlays/l11/gameplay/entities/oil_tanker_front.c @@ -31,7 +31,7 @@ struct L11PatrolVars { u8 pad24[0x14]; s32 retimer; /* 0x38: nonzero restarts the timer at 0x244 */ u8 pad3C[0xD4]; - u8 move[7]; /* 0x110: movement state (FUN_L00_0025d458 / FUN_L00_0025d538) */ + u8 move[7]; /* 0x110: movement state (trooper_anim_update / trooper_anim_finish) */ u8 unk117; /* 0x117 */ u8 pad118[8]; u8 unk120[0x10]; /* 0x120 */ @@ -80,14 +80,14 @@ extern s32 FUN_L11_0030a830(void *); void mark_moby_for_removal(void *obj) __asm__("FUN_0020c828"); extern s32 FUN_001fa6d0(float); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_001f9b80(float *, float *); -extern void FUN_L00_0025ab48(void *, float *, void *, void *); -extern void FUN_L00_0025c558(void *, void *, s32, s32, s32, float); +extern float vector_distance(float *, float *) __asm__("FUN_001f9b80"); +extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(void *, void *, s32, s32, s32, float) __asm__("FUN_L00_0025c558"); extern void FUN_L00_00257470(void *, s32, s32); -extern void FUN_L00_0025d458(void *, void *); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *, void *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern void FUN_00212f90(void *, s32, s32, s32); -extern s32 FUN_001f96f8(s32); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern float random_float_between(float a, float b) __asm__("FUN_002132a8"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); @@ -160,8 +160,8 @@ void FUN_L11_00315968(struct Moby *moby) { d->unk174 = 11.0f; yaw = fast_arc_tan(moby->pos.x - hit->moby->pos.x, moby->pos.y - hit->moby->pos.y); v.q = hit->pos.q; - FUN_L00_0025ab48(&v, &yaw, &d->unk138, &d->unk13C); - FUN_L00_0025c558(moby, d->unk120, 3, 1, 0, yaw); + trooper_knockback_arc(&v, &yaw, &d->unk138, &d->unk13C); + trooper_start_knockback(moby, d->unk120, 3, 1, 0, yaw); if (moby->state < 0xC) { moby->state = 9; } else { @@ -181,8 +181,8 @@ void FUN_L11_00315968(struct Moby *moby) { d->unk174 = 11.0f; yaw = fast_arc_tan(moby->pos.x - hit->moby->pos.x, moby->pos.y - hit->moby->pos.y); v.q = hit->pos.q; - FUN_L00_0025ab48(&v, &yaw, &d->unk138, &d->unk13C); - FUN_L00_0025c558(moby, d->unk120, 3, 1, 0, yaw); + trooper_knockback_arc(&v, &yaw, &d->unk138, &d->unk13C); + trooper_start_knockback(moby, d->unk120, 3, 1, 0, yaw); if (moby->state < 0xC) { moby->state = 0xB; } else { @@ -195,16 +195,16 @@ void FUN_L11_00315968(struct Moby *moby) { case 11: break; } - FUN_L00_0025d458(moby, d->move); + trooper_anim_update(moby, d->move); } } moby->hit_slot = 0xFF; - FUN_L00_0025d538(moby, d->move); + trooper_anim_finish(moby, d->move); if (d->timer != 0) { if (moby->state == 2 || (moby->state == 3 && (moby->anim_flags & 2))) { moby->state = 0xA; if (moby->prev_seq != 2) { - FUN_00212f90(moby, 2, 0, FUN_001f96f8(10)); + FUN_00212f90(moby, 2, 0, scale_game_frames(10)); } } } @@ -227,7 +227,7 @@ void FUN_L11_00315968(struct Moby *moby) { p = &moby->pos; } qcopy(&v, p); - if (FUN_001f9b80(v.f, &d->goal.x) > d->reach || v.f[2] - d->goal.z > 3.0f) { + if (vector_distance(v.f, &d->goal.x) > d->reach || v.f[2] - d->goal.z > 3.0f) { d->unk214 = 2; } } @@ -348,11 +348,11 @@ extern float D_L11_00162308 __attribute__((sda)); extern float D_L11_0016230C __attribute__((sda)); extern float D_L11_00162310 __attribute__((sda)); extern struct Moby *spawn_moby_class(s32) __asm__("FUN_0020c4f8"); -extern float FUN_001f9b80(float *, float *); +extern float vector_distance(float *, float *) __asm__("FUN_001f9b80"); extern s32 FUN_00214720(void *, s32); extern s32 FUN_0022da68(s32, s32, void *); extern f32 advance_accelerated_scalar(f32 *, f32 *, f32, f32, f32, f32) __asm__("func_00213F38"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void FUN_L00_00250df8(struct Moby *); @@ -410,7 +410,7 @@ void FUN_L11_00316320(struct Moby *moby) { break; } case 1: - if (FUN_001f9b80(&moby->pos.x, &hero.motion.pos.f[0]) < 12.0f && + if (vector_distance(&moby->pos.x, &hero.motion.pos.f[0]) < 12.0f && FUN_00214720(&hero.motion.pos, d->unk10) != 0) { d->t = 0.0f; moby->state = 2; @@ -421,9 +421,9 @@ void FUN_L11_00316320(struct Moby *moby) { advance_accelerated_scalar(&d->t, &d->speed, 1.0f, frame_time_sq * 8.0f, frame_time_sq * 16.0f, frame_time * 8.0f); fast_vec_normalize(v, &moby->rot_row0, 0.5f); - FUN_001f9a10(&d->left->pos, &moby->pos, v); + fast_vec_add(&d->left->pos, &moby->pos, v); d->left->pos.z = moby->pos.z + d->t * 4.0f - 4.0f; - FUN_001f9a10(&d->right->pos, &moby->pos, v); + fast_vec_add(&d->right->pos, &moby->pos, v); d->right->pos.z = moby->pos.z + d->t * 4.0f - 4.0f; FUN_L00_00250df8(d->left); FUN_L00_00250df8(d->right); @@ -468,12 +468,12 @@ void FUN_L11_00316320(struct Moby *moby) { break; case 6: fast_vec_normalize(v, &moby->rot_row0, 0.5f); - FUN_001f9a10(&d->left->pos, &moby->pos, v); + fast_vec_add(&d->left->pos, &moby->pos, v); d->left->pos.z = moby->pos.z + D_L11_00162308; d->left->rot.x = -(D_L11_0016230C * 0.017453292f); d->left->rot.y = D_L11_00162310 * 0.017453292f; FUN_L00_00250df8(d->left); - FUN_001f9a10(&d->right->pos, &moby->pos, v); + fast_vec_add(&d->right->pos, &moby->pos, v); d->right->pos.z = moby->pos.z + D_L11_00162308; d->right->rot.x = D_L11_0016230C * 0.017453292f; d->right->rot.y = D_L11_00162310 * 0.017453292f; @@ -482,7 +482,7 @@ void FUN_L11_00316320(struct Moby *moby) { } } -/* Private variables of the chained moby class 0x527 (FUN_L11_003172c0 and its helpers). */ +/* Private variables of the chained moby class 0x527 (oil_tanker_front_update and its helpers). */ struct L11ChainVars { u8 pad0[0x60]; s32 path_index; /* 0x60: index into D_L11_001B0EB0 */ @@ -504,7 +504,7 @@ struct L11ChainVars { extern float D_L11_00162320 __attribute__((sda)); void mark_moby_for_removal(void *obj) __asm__("FUN_0020c828"); extern s32 FUN_0022da68(s32, s32, void *); -extern s32 FUN_L00_0028d8c0(void *, s32); +extern s32 voice_is_playing(void *, s32) __asm__("FUN_L00_0028d8c0"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); void FUN_L11_00317678(struct Moby *); void FUN_L11_00317820(struct Moby *); @@ -512,7 +512,8 @@ void FUN_L11_00317c98(struct Moby *); void FUN_L11_003180a0(struct Moby *, int); /* Chain head update: spawns the eight 0x4F1 links, waits for D_001413D4 to reach 0x32, then moves along its path and runs the link helpers. */ -void FUN_L11_003172c0(struct Moby *moby) { +void oil_tanker_front_update(struct Moby *moby) __asm__("FUN_L11_003172c0"); +void oil_tanker_front_update(struct Moby *moby) { struct L11ChainVars *d = (struct L11ChainVars *)moby->pvars; switch (moby->state) { @@ -584,7 +585,7 @@ void FUN_L11_003172c0(struct Moby *moby) { if (moby->state == 2) { FUN_L11_00317c98(moby); } - if (FUN_L00_0028d8c0(moby, d->sound) == 0) { + if (voice_is_playing(moby, d->sound) == 0) { d->sound = FUN_0022da68(0, 4, moby); } break; @@ -597,7 +598,7 @@ void FUN_L11_003172c0(struct Moby *moby) { extern f32 fast_add_rotations(f32 a, f32 b) __asm__("FUN_001fa580"); extern f32 fast_subtract_rotations(f32, f32) __asm__("func_001FA5C8"); -extern float FUN_001f9b80(float *, float *); +extern float vector_distance(float *, float *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern void lerp_vector(void *, void *, void *, float) __asm__("FUN_001f9a40"); @@ -618,9 +619,9 @@ void FUN_L11_00317678(struct Moby *moby) { qcopy(pc = c, t + (i + 2) % n * 16 + 0x10); x = fast_arc_tan(a[0] - b[0], a[1] - b[1]); y = fast_arc_tan(b[0] - c[0], b[1] - c[1]); - z = fast_arc_tan(FUN_001f9b80(a, pb), b[2] - a[2]); + z = fast_arc_tan(vector_distance(a, pb), b[2] - a[2]); moby->rot.y = fast_add_rotations( - fast_subtract_rotations(fast_arc_tan(FUN_001f9b80(pb, pc), c[2] - b[2]), z) * + fast_subtract_rotations(fast_arc_tan(vector_distance(pb, pc), c[2] - b[2]), z) * *(float *)(d + 0x6C), z); moby->rot.z = @@ -633,7 +634,7 @@ extern s32 D_L11_0016232C __attribute__((sda)); extern s32 D_L11_0015F5C4; extern float FUN_001f9b48(void *, void *); extern s32 FUN_001fa6d0(float); -extern s32 FUN_001f96f8(s32); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); /* A chain path in D_L11_001B0EB0: a point count, then the points (w = 42 marks a sound point). */ struct L11ChainPath { @@ -651,7 +652,7 @@ void FUN_L11_00317820(struct Moby *moby) { int i; fast_vec_normalize(v, &moby->rot_row0, D_L11_00162328); - FUN_001f9a10(v, v, &moby->pos); + fast_vec_add(v, v, &moby->pos); for (i = 0; i < d->count; i++) { int a = d->offsets[i]; int b = (a + 1) % p->count; @@ -679,7 +680,7 @@ void FUN_L11_00317820(struct Moby *moby) { if (D_L11_0015F5C4 == 0) { FUN_0022da68(2, 0, d->links[i]); } - *(s32 *)(lv + 0x28) = FUN_001f96f8(D_L11_0016232C); + *(s32 *)(lv + 0x28) = scale_game_frames(D_L11_0016232C); } } } @@ -711,17 +712,17 @@ void FUN_L11_00317820(struct Moby *moby) { qc = (float *)(path + c * 16); yaw0 = fast_arc_tan(qa[4] - qb[4], qa[5] - qb[5]); yaw1 = fast_arc_tan(qb[4] - qc[4], qb[5] - qc[5]); - pitch0 = -fast_arc_tan(FUN_001f9b80(&p->pts[b].x, &p->pts[a].x), + pitch0 = -fast_arc_tan(vector_distance(&p->pts[b].x, &p->pts[a].x), qa[6] - qb[6]); d->links[i]->rot.y = fast_add_rotations( - fast_subtract_rotations(-fast_arc_tan(FUN_001f9b80(&p->pts[c].x, &p->pts[b].x), + fast_subtract_rotations(-fast_arc_tan(vector_distance(&p->pts[c].x, &p->pts[b].x), qb[6] - qc[6]), pitch0) * t, pitch0); d->links[i]->rot.z = fast_add_rotations(fast_subtract_rotations(yaw1, yaw0) * t, yaw0); FUN_L00_00250df8(d->links[i]); fast_vec_normalize(v, &d->links[i]->rot_row0, D_L11_00162328); - FUN_001f9a10(v, v, &d->links[i]->pos); + fast_vec_add(v, v, &d->links[i]->pos); } } extern char D_00141C18[]; @@ -732,10 +733,10 @@ extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); void mark_moby_for_removal(void *obj) __asm__("FUN_0020c828"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern s32 FUN_0022da68(s32, s32, void *); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); void *FUN_L00_00263fd8(char *src, int cls, float *pos, void *mat, int a8, int a9, float *v10, float *v11, float scale, float *v12); -extern s32 FUN_001f96f8(s32); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); void FUN_L11_00318488(struct Moby *); /* Drops the chain's damaged links: takes the hits, shrinks the chain as its health falls and blows the head up when no link is left. */ @@ -790,10 +791,10 @@ void FUN_L11_00317c98(struct Moby *moby) { fast_vec_scale(vec, &moby->rot_row0, (dv = D_L11_0015F580, p2 = (char *)&moby->rot, D_L11_00162330 * frame_scale)); vec[2] += frame_scale * 0.08f; FUN_0022da68(2, 0, moby); - FUN_L00_0025f090(moby, p1, -1, 3.0f, 13.0f); - FUN_L00_00263fd8((char *)moby, 0x602, (float *)p1, p2, FUN_001f96f8(0x5A), 0, vec, dv, frame_time_sq * 12.0f, dv); - FUN_L00_00263fd8((char *)moby, 0x603, (float *)p1, p2, FUN_001f96f8(0x5A), 0, vec, dv, frame_time_sq * 12.0f, dv); - FUN_L00_00263fd8((char *)moby, 0x784, (float *)p1, p2, FUN_001f96f8(0x5A), 0, vec, dv, frame_time_sq * 12.0f, dv); + cart_burst(moby, p1, -1, 3.0f, 13.0f); + FUN_L00_00263fd8((char *)moby, 0x602, (float *)p1, p2, scale_game_frames(0x5A), 0, vec, dv, frame_time_sq * 12.0f, dv); + FUN_L00_00263fd8((char *)moby, 0x603, (float *)p1, p2, scale_game_frames(0x5A), 0, vec, dv, frame_time_sq * 12.0f, dv); + FUN_L00_00263fd8((char *)moby, 0x784, (float *)p1, p2, scale_game_frames(0x5A), 0, vec, dv, frame_time_sq * 12.0f, dv); mark_moby_for_removal(moby); } } @@ -875,7 +876,7 @@ extern char D_L11_00162364[4] __attribute__((sda)); extern char D_L11_00162368[4] __attribute__((sda)); extern char D_L11_0016236C[4] __attribute__((sda)); extern void random_vector(float *, float, float) __asm__("FUN_L00_00257d78"); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void add_vector_xyz(void *, void *, void *); extern void scale_vector_xyz(void *, void *, float); extern void subtract_vector_xyz(void *dst, void *a, void *b); @@ -913,7 +914,7 @@ void FUN_L11_003181f0(struct Moby *m) { char *p1 = &m->pos; float *dv; char *p2; - FUN_L00_0025f090(m, p1, -1, 5.0f, 13.0f); + cart_burst(m, p1, -1, 5.0f, 13.0f); scale_vector_xyz( v, &m->rot_row0, (dv = D_L11_0015F580, p2 = &m->rot, *(float *)&D_L11_0016236C * frame_scale)); @@ -934,24 +935,24 @@ void FUN_L11_003181f0(struct Moby *m) { /* Ported from rac1-decomp (src/overlays/l11_pokitaru/vendor_00312BD8.c: func_L11_003198F8), where it is exact; names translated to the US level program. */ extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); void FUN_L11_00318488(struct Moby *m) { char *d = (char *)m->pvars; m->state = 1; m->collision = 0; - FUN_001f9a28(d + 0x10, &m->pos, d); + fast_vec_sub(d + 0x10, &m->pos, d); *(float *)(d + 0x20) = random_float_between_alt(20.0f, 60.0f) * DEG_TO_RAD * D_0015ED6C_n[1]; *(float *)(d + 0x24) = random_float_between_alt(20.0f, 60.0f) * DEG_TO_RAD * D_0015ED6C_n[1]; } /* Ported from rac1-decomp (src/overlays/l11_pokitaru/vendor_00312BD8.c: func_L11_00319FA0), where it is exact; names translated to the US level program. */ extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); -extern int FUN_001efa68(void *, void *, int, void *, void *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); extern int collect_mobies_in_sphere(float, void *, int, void *, void *) __asm__("FUN_L00_001f2868"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, int, float, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L11_00319028_c(char *moby) __asm__("FUN_L11_00319028"); extern void FUN_L11_003191c0_c(char *moby) __asm__("FUN_L11_003191c0"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); @@ -960,7 +961,8 @@ void mark_moby_for_removal(void *obj) __asm__("FUN_0020c828"); extern int func_001F9908_i(void *) __asm__("FUN_001f9740"); extern short D_L11_00162388 __attribute__((sda)); -void FUN_L11_00318b30(unsigned char *moby) { +void energy_sphere_update(unsigned char *moby) __asm__("FUN_L11_00318b30"); +void energy_sphere_update(unsigned char *moby) { char *data = *(char **)(moby + 0x78); float v[4]; float *vp; @@ -987,9 +989,9 @@ void FUN_L11_00318b30(unsigned char *moby) { vp = v; qcopy(vp, pos); add_vector_xyz(pos, pos, data); - if (func_001F9908_i(data + 0x20) || FUN_001efa68(vp, (char *)moby + 0x10, 0, moby, 0) || + if (func_001F9908_i(data + 0x20) || collision_line(vp, (char *)moby + 0x10, 0, moby, 0) || collect_mobies_in_sphere(0.333f, (char *)moby + 0x10, 0, *(void **)(data + 0x24), 0)) { - FUN_L00_0025e450(moby, data, (char *)moby + 0x10, 1.5f, 2.0f, 10, 3, 16, 4.0f, 2.0f, + spawn_explosion(moby, data, (char *)moby + 0x10, 1.5f, 2.0f, 10, 3, 16, 4.0f, 2.0f, 9.0f, -1, 1.0f, 15.0f, 1, 1, -1, 0); mark_moby_for_removal(moby); } @@ -1003,7 +1005,7 @@ void FUN_L11_00318b30(unsigned char *moby) { /* Ported from rac1-decomp (src/overlays/l11_pokitaru/vendor_00312BD8.c: func_L11_0031A180), where it is exact; names translated to the US level program. */ extern char *func_0020D348_m(int); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int FUN_L11_00318ed8_u() __asm__("FUN_L11_00318ed8"); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); extern void euler_rotation_basis(void *, void *) __asm__("FUN_001fa030"); @@ -1027,7 +1029,7 @@ char *FUN_L11_00318d10(char *src, void *pos, int ticks) { clear_u64_value(d); *(char **)(d + 0x24) = src; p = (unsigned char *)(d + 0x14); - *(int *)(d + 0x20) = FUN_001f96f8(ticks); + *(int *)(d + 0x20) = scale_game_frames(ticks); *(int *)(d + 0x28) = 5; euler_rotation_basis(mob + 0xC0, mob + 0x40); for (i = 0, t = 10; i < 4; i++, t += 10, p++) { @@ -1068,10 +1070,10 @@ void FUN_L11_00318e98(struct Moby *arg, void *src) { /* Ported from rac1-decomp (src/overlays/l11_pokitaru/vendor_00312BD8.c: func_L11_0031A348), where it is exact; names translated to the US level program. */ extern char *spawn_spark(void *, void *, void *, int, int, int, int, int, int) __asm__("FUN_00218888"); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float random_angle_radians(void) __asm__("FUN_00213308"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); @@ -1091,12 +1093,12 @@ void FUN_L11_00318ed8(struct Moby *m) { float v4[4]; float s = random_float_between_alt(2.5f, 3.0f); float a = random_angle_radians(); - fast_vec_normalize(v2, &m->rot_row1, s * FUN_001f9de0(a)); - fast_vec_normalize(v1, &m->rot_row2, s * FUN_001f9dc8(a)); - FUN_001f9a10(v1, v1, v2); - FUN_001f9a28(v0, &m->pos, v1); + fast_vec_normalize(v2, &m->rot_row1, s * fast_sin(a)); + fast_vec_normalize(v1, &m->rot_row2, s * fast_cos(a)); + fast_vec_add(v1, v1, v2); + fast_vec_sub(v0, &m->pos, v1); fast_vec_scale(v3, v1, - 1.0f / (float)FUN_001f96f8(*(int *)&D_L11_00162394 + *(int *)&D_L11_00162398 + + 1.0f / (float)scale_game_frames(*(int *)&D_L11_00162394 + *(int *)&D_L11_00162398 + *(int *)&D_L11_0016239C)); qcopy(v4, v3); v3[3] = *(float *)&D_L11_001623A0; @@ -1196,7 +1198,7 @@ extern float D_L11_001677C0_c[] __asm__("D_L11_001677C0"); extern float D_L11_001677D0[]; extern float FUN_001f9b48(void *, void *); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); -extern float FUN_L00_0025be00(float *p, float *v, float a, float b, float c, float d); +extern float approach_angle(float *p, float *v, float a, float b, float c, float d) __asm__("FUN_L00_0025be00"); extern float fast_cos(float) __asm__("func_001F9DC8"); extern float fast_sin(float) __asm__("func_001F9DE0"); extern int level_frame __asm__("D_L11_0015F5CC"); @@ -1204,7 +1206,7 @@ extern int FUN_001fa728_u(char *, float) __asm__("FUN_001fa728"); extern int random_integer_below_c2(int) __asm__("FUN_00213260"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern void allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L11_00319670(void *); extern void FUN_L11_0031a1c0(void *); @@ -1217,7 +1219,8 @@ extern void vu_euler_rotation_basis(void *, void *) __asm__("func_001FA030"); void blend_moby_animation_c(MobyAnim *arg0, int arg1, int arg2, int arg3) __asm__("FUN_00212f90"); extern short D_L11_001623D0 __attribute__((sda)); -void FUN_L11_00319838(struct Moby *moby) { +void blarg_ship_update(struct Moby *moby) __asm__("FUN_L11_00319838"); +void blarg_ship_update(struct Moby *moby) { float s0[4]; float s10[4]; float s20[4]; @@ -1270,7 +1273,7 @@ void FUN_L11_00319838(struct Moby *moby) { fast_add_rotations(*(float *)(d + 0x70), *(float *)(d + 0x74)); FUN_L11_0031a438(moby); if (moby->state == 2) { - FUN_L00_0025f090(moby, &moby->pos, -1, 2.0f, 13.0f); + cart_burst(moby, &moby->pos, -1, 2.0f, 13.0f); if (random_integer_below_c2(2)) { FUN_L11_0030f5a8(&moby->pos, D_L11_0015F580, 0x4C4); } else { @@ -1362,10 +1365,10 @@ void FUN_L11_00319838(struct Moby *moby) { float ang; subtract_vector_xyz(s70, tgt, &moby->pos.x); ang = fast_arc_tan(s70[0], s70[1]); - FUN_L00_0025be00(yaw, (float *)(d + 0x8C), ang, frame_time_sq * 12.566371f, + approach_angle(yaw, (float *)(d + 0x8C), ang, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, D_0015ED6C_n[1] * 12.566371f); ang = -fast_arc_tan(vector_length_xy(s70), s70[2]); - FUN_L00_0025be00(pitch, (float *)(d + 0x90), ang, frame_time_sq * 12.566371f, + approach_angle(pitch, (float *)(d + 0x90), ang, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, D_0015ED6C_n[1] * 12.566371f); if (level_frame % 10 == 0) { allocate_voice_for_target_entry(2, 0, (int)moby); @@ -1400,7 +1403,7 @@ void FUN_L11_00319838(struct Moby *moby) { subtract_vector_xyz(s0, &hero.motion.pos, d + 0xB0); qcopy(d + 0xB0, &hero.motion.pos); add_vector_xyz(&moby->pos, &moby->pos, s0); - FUN_L00_0025f090(moby, &moby->pos, -1, 2.0f, 13.0f); + cart_burst(moby, &moby->pos, -1, 2.0f, 13.0f); if (random_integer_below_c2(2)) { FUN_L11_0030f5a8(&moby->pos, D_L11_0015F580, 0x4C4); } else { @@ -1434,7 +1437,7 @@ short FUN_L11_0031a758(int idx) { extern char *D_L11_0015FFD8; extern char D_L11_001677C0[]; extern f32 D_L11_001677D0[]; -extern float FUN_001fa580(float, float); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern short *D_L11_001AC240[]; extern s32 random_integer_below_c(s32 arg0) __asm__("FUN_00213260"); extern void blend_moby_animation(void *arg0, int arg1, int arg2, int arg3) __asm__("FUN_00212f90"); @@ -1464,14 +1467,14 @@ char *FUN_L11_0031a7d8(int list) { C[1] = -0.17453292f; euler_rotation_basis(D, C); { - float f = FUN_001fa580(0.7853982f, (float)*(int *)(d + 0x88) * 1.5707964f); - fast_vec_normalize(A, E, FUN_001f9de0(f) * 12.0f); - FUN_001f9a10(B, D_L11_001677C0, A); - fast_vec_normalize(A, F, FUN_001f9dc8(f) * 12.0f); + float f = fast_add_rotations(0.7853982f, (float)*(int *)(d + 0x88) * 1.5707964f); + fast_vec_normalize(A, E, fast_sin(f) * 12.0f); + fast_vec_add(B, D_L11_001677C0, A); + fast_vec_normalize(A, F, fast_cos(f) * 12.0f); } - FUN_001f9a10(B, B, A); + fast_vec_add(B, B, A); fast_vec_normalize(A, D, 6.0f); - FUN_001f9a10(B, B, A); + fast_vec_add(B, B, A); qcopy(d + 0xB0, D_0013E533 + 0xE9D); qcopy(m + 0x10, B); m[0x20] = 5; @@ -1480,7 +1483,7 @@ char *FUN_L11_0031a7d8(int list) { *(float *)(d + 0x94) = 5.0f; *(int *)(d + 0x98) = 0; if (*(unsigned char *)(m + 0x53)) - blend_moby_animation(m, 0, 0, FUN_001f96f8(10)); + blend_moby_animation(m, 0, 0, scale_game_frames(10)); *(unsigned short *)(m + 0x34) &= 0xFFFE; *(int *)(m + 0x94) = *(int *)(*(char **)(m + 0x24) + 0x10); return m; diff --git a/src/overlays/l11/gameplay/entities/seesaw_platform.c b/src/overlays/l11/gameplay/entities/seesaw_platform.c index ab7c5d9d2f..72f6bf3032 100644 --- a/src/overlays/l11/gameplay/entities/seesaw_platform.c +++ b/src/overlays/l11/gameplay/entities/seesaw_platform.c @@ -51,7 +51,7 @@ extern float probe_ground_height(void *, int, float) __asm__("FUN_00213508"); extern void zero_vector_c788(void *) __asm__("FUN_001f99f8"); extern float atan2_c788(float, float) __asm__("FUN_001f9e90"); extern void FUN_L00_00216f90(void *, void *, int, int); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void FUN_0022da68_c788(int, int, struct Moby *) __asm__("FUN_0022da68"); extern void lerp_vector_c788(void *, void *, void *, float) __asm__("FUN_001f9a40"); extern void FUN_L00_002ea9d8(void *); @@ -149,7 +149,7 @@ void FUN_L11_0030c788(struct Moby *m) { zero_vector_c788(&rot); rot.z = atan2_c788(m->pos.x - pos.x, m->pos.y - pos.y); FUN_L00_00216f90(&pos, &rot, 0x72, 1); - FUN_L00_002eaaa0((char *)(D_L11_001600EC_c788 + (pv->from << 7)) + 0x30, + jet_mount((char *)(D_L11_001600EC_c788 + (pv->from << 7)) + 0x30, (char *)(D_L11_001600EC_c788 + (pv->to << 7)) + 0x70, 1, 0, 0); for (j = 0; j < 6; j++) { D_L11_001DA710[j]->flags &= ~1; @@ -369,11 +369,11 @@ extern float D_L11_00161F60 __attribute__((sda)); extern float D_L11_0015F3FC; extern struct Moby *create_moby_d800(int) __asm__("FUN_0020c4f8"); extern void FUN_0022da68_d800(int, int, struct Moby *) __asm__("FUN_0022da68"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern float approach_value_d800(float *, float, float) __asm__("FUN_00213ed8"); extern float absolute_float_d800(float) __asm__("FUN_001f99c0"); extern void FUN_L00_00216f90(void *, void *, int, int); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void approach_d800(float *, float *, float, float, float, float) __asm__("FUN_00213f38"); extern void lerp_vector_d800(void *, void *, void *, float) __asm__("FUN_001f9a40"); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); @@ -425,14 +425,14 @@ void FUN_L11_0030d800(struct Moby *m) { } case 2: old = pv->fade; - approach_value_d800(&pv->fade, 1.0f, 1.0f / (float)FUN_001f96f8(20)); + approach_value_d800(&pv->fade, 1.0f, 1.0f / (float)scale_game_frames(20)); D_L11_0015F3FC = 1.0f - absolute_float_d800(pv->fade); if (old < 0.0f && 0.0f <= pv->fade) { struct Moby *link = (struct Moby *)(D_L11_0015FFD8_d800 + (pv->link << 8)); char *cam; FUN_L00_00216f90(&link->pos, &link->rot, 0x72, 1); cam = (char *)(D_L11_001600EC_d800 + (pv->from << 7)); - FUN_L00_002eaaa0(cam + 0x30, cam + 0x70, 1, 0, 0); + jet_mount(cam + 0x30, cam + 0x70, 1, 0, 0); } else if (1.0f <= pv->fade) { m->state = 3; } @@ -462,7 +462,7 @@ void FUN_L11_0030d800(struct Moby *m) { break; case 4: old = pv->fade; - approach_value_d800(&pv->fade, 1.0f, 1.0f / (float)FUN_001f96f8(20)); + approach_value_d800(&pv->fade, 1.0f, 1.0f / (float)scale_game_frames(20)); D_L11_0015F3FC = 1.0f - absolute_float_d800(pv->fade); if (old < 0.0f && 0.0f <= pv->fade) { FUN_L00_00216f90(&hero.motion.pos, &hero.motion.rot, 0, 1); @@ -607,20 +607,20 @@ extern float D_L11_00161210; extern float D_L11_00161214; extern int D_L11_00161208; extern void print_e088(char *) __asm__("FUN_001e93b0"); -extern void FUN_L01_002b7a48(void *, int); -extern void FUN_L01_002b7ef0(float); +extern void pool_init_tiles(void *, int) __asm__("FUN_L01_002b7a48"); +extern void pool_set_scale(float) __asm__("FUN_L01_002b7ef0"); extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern void FUN_L01_002b7c68(void *, void *); +extern void pool_bind_tile(void *, void *) __asm__("FUN_L01_002b7c68"); extern void FUN_L01_0026e0e0(int, int); extern void approach_e088(float *, void *, float, float, float, float) __asm__("FUN_00213f38"); extern void FUN_L11_0030e690(struct Moby *); extern int random_below_e088(int) __asm__("FUN_00213260"); extern float rand_range_e088(float, float) __asm__("FUN_002132a8"); -extern void FUN_L00_002a3ec8(float, float, float, float, void *, int, int); +extern void pool_splash(float, float, float, float, void *, int, int) __asm__("FUN_L00_002a3ec8"); extern int FUN_L01_00275690(float, void *); -extern void FUN_L01_002b7fe0(void *, int); +extern void pool_flush(void *, int) __asm__("FUN_L01_002b7fe0"); extern void FUN_L11_0030e708(void); extern void enqueue_e088(void *, void *) __asm__("FUN_001f4600"); @@ -648,8 +648,8 @@ void FUN_L11_0030e088(struct Moby *m) { for (i = 19; i >= 0; i--) { D_L11_001DA880[i].unk1E = 0; } - FUN_L01_002b7a48(D_L11_001DA880, 20); - FUN_L01_002b7ef0(1.0f); + pool_init_tiles(D_L11_001DA880, 20); + pool_set_scale(1.0f); l = &D_L11_001CB280; l->unk0 = 16.0f; l->unk4 = 16.0f; @@ -683,7 +683,7 @@ void FUN_L11_0030e088(struct Moby *m) { D_L11_001DA880[pv[1]].unk1C = 0x1C; D_L11_001DA880[pv[1]].unk1D = 0x44; D_L11_001DA880[pv[1]].unk1E = 0xFFFF; - FUN_L01_002b7c68(&D_L11_001DA880[pv[1]], D_L11_001DA740 + pv[1] * 16); + pool_bind_tile(&D_L11_001DA880[pv[1]], D_L11_001DA740 + pv[1] * 16); m->state = 1; break; case 1: @@ -705,7 +705,7 @@ void FUN_L11_0030e088(struct Moby *m) { float x = D_L11_001DA880[pv[1]].x + rand_range_e088(-4.0f, 4.0f); float y = rand_range_e088(-4.0f, 4.0f); Ent *t = &D_L11_001DA880[pv[1]]; - FUN_L00_002a3ec8(x, t->y + y, 1.0f, -0.03f, t, 1, 1); + pool_splash(x, t->y + y, 1.0f, -0.03f, t, 1, 1); } break; case 2: @@ -722,7 +722,7 @@ void FUN_L11_0030e088(struct Moby *m) { float x = D_L11_001DA880[pv[1]].x + rand_range_e088(-4.0f, 4.0f); float y = rand_range_e088(-4.0f, 4.0f); Ent *t = &D_L11_001DA880[pv[1]]; - FUN_L00_002a3ec8(x, t->y + y, 1.0f, -0.03f, t, 1, 1); + pool_splash(x, t->y + y, 1.0f, -0.03f, t, 1, 1); } break; } @@ -737,7 +737,7 @@ void FUN_L11_0030e088(struct Moby *m) { D_L11_001DA880[pv[1]].unk1E = 0xFFFF; } if (pv[1] == 0) { - FUN_L01_002b7fe0(D_L11_001DA880, 20); + pool_flush(D_L11_001DA880, 20); enqueue_e088(FUN_L11_0030e708, m); } } @@ -887,23 +887,24 @@ extern void scale_vector_xyz(void *, void *, float) __asm__("FUN_001f9a68"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); -extern void FUN_001f9d20(void *, void *, void *); +extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern float absolute_float_eb90(float) __asm__("FUN_001f99c0"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern int hero_set_state(int, int) __asm__("FUN_L11_0024db50"); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); -/* Private variables of the tilting platform (FUN_L11_0030eb90). */ +/* Private variables of the tilting platform (seesaw_platform_update). */ struct L11TiltVars { u8 pad0[0x20]; - u8 unk20[0x3C]; /* 0x20: rider state for FUN_L00_00260738 */ + u8 unk20[0x3C]; /* 0x20: rider state for update_entity_matrix */ s32 unk5C; /* 0x5C */ f32 spin; /* 0x60: rot.y speed */ }; /* Tilting platform: rot.y springs back and is damped through its spin; the hero standing on it tilts it toward his side, and a tilt past D_L11_00161F84 degrees knocks him into hero state 6. */ -void FUN_L11_0030eb90(struct Moby *m) { +void seesaw_platform_update(struct Moby *m) __asm__("FUN_L11_0030eb90"); +void seesaw_platform_update(struct Moby *m) { Vec4f v; Vec4f rot; float matrix[16] __attribute__((aligned(16))); @@ -923,7 +924,7 @@ void FUN_L11_0030eb90(struct Moby *m) { if (hero.ground_moby == m && hero.air_frames.s == 0) { subtract_vector_xyz(&diff, &hero.motion.pos, &m->pos); transpose_rotation_matrix(matrix, &m->rot_row0); - FUN_001f9d20(&diff, &diff, matrix); + transform_vector(&diff, &diff, matrix); scaled = D_L11_00161F68 * diff.x; change = D_L11_00161F78 * 0.017453292f * frame_time_sq * scaled; if (d->spin * change < 0.0f && m->rot.y * change < 0.0f) { @@ -942,7 +943,7 @@ void FUN_L11_0030eb90(struct Moby *m) { } m->rot.y = fast_add_rotations(m->rot.y, d->spin); add_vector_xyz(&v, &v, &m->pos); - FUN_L00_00260738(d->unk20, &v, &rot, &m->rot); + update_entity_matrix(d->unk20, &v, &rot, &m->rot); } /* Waits for its linked moby, then either hands off to a cutscene or turns toward its target. */ extern char *D_L11_0015FFD8_t __asm__("D_L11_0015FFD8"); @@ -951,7 +952,7 @@ extern char D_0013D3E3_t[] __asm__("D_0013D3E3"); extern int FUN_L11_0030f270(char *); extern void FUN_0022da68_t(int, int, unsigned char *) __asm__("FUN_0022da68"); extern float FUN_001fa580_t(float, float) __asm__("FUN_001fa580"); -extern float FUN_L00_0025be00(float *p, float a, float *v, float b, float c, float d); +extern float approach_angle(float *p, float a, float *v, float b, float c, float d) __asm__("FUN_L00_0025be00"); void FUN_L11_0030f2a8(struct Moby *m) { int s = m->state; @@ -979,7 +980,7 @@ void FUN_L11_0030f2a8(struct Moby *m) { case 2: a = FUN_001fa580_t(d[2], 1.0471976f); r = frame_time_sq * 0.34906584f; - if (FUN_L00_0025be00(&m->rot.z, a, d + 1, r, r, frame_time * 0.7853982f) == 0.0f) { + if (approach_angle(&m->rot.z, a, d + 1, r, r, frame_time * 0.7853982f) == 0.0f) { m->state = 3; } break; @@ -1071,11 +1072,12 @@ extern float sin_f728(float) __asm__("FUN_001f9dc8"); extern float square_root(float) __asm__("FUN_001f9988"); extern void FUN_0022da68_f728(int, int, void *) __asm__("FUN_0022da68"); extern void mark_moby_for_removal_f728(void *) __asm__("FUN_0020c828"); -extern void FUN_L00_00259fe8(void *, float); +extern void jet_animate(void *, float) __asm__("FUN_L00_00259fe8"); extern struct Moby *D_L11_00174858 __attribute__((section(".data"))); /* Ship ammo / health pickup: falls and bounces, is pulled toward the hero's ship, and refills it on contact. */ -void FUN_L11_0030f728(struct Moby *m) { +void ammocrate_update(struct Moby *m) __asm__("FUN_L11_0030f728"); +void ammocrate_update(struct Moby *m) { struct Moby *ship = hero.ship_moby; char *pv = m->pvars; float dist = 100000.0f; @@ -1208,7 +1210,7 @@ void FUN_L11_0030f728(struct Moby *m) { if (1003.0f < m->pos.z) { m->pos.z = 1003.0f; } - FUN_L00_00259fe8(m, 0.5f); + jet_animate(m, 0.5f); } /* Ported from rac1-decomp (src/overlays/l11_pokitaru/vendor_002CC828.c: func_L11_00311260), where it is exact; names translated to the US level program. */ @@ -1343,7 +1345,7 @@ void FUN_L11_00310028(struct Moby *moby) { break; } } -/* pvars of the moby run by FUN_L11_00310180 (FUN_L11_00310698 does its hit handling) */ +/* pvars of the moby run by psytcopus_update (FUN_L11_00310698 does its hit handling) */ struct PokiPathVars { u8 pad_00[0x20]; f32 health; /* 0x20 */ @@ -1357,10 +1359,10 @@ struct PokiPathVars { u8 pad_59; u8 unk5A; /* 0x5A */ u8 pad_5B[5]; - u8 unk60[7]; /* 0x60: passed to FUN_L00_0025d458 / FUN_L00_0025d538 */ + u8 unk60[7]; /* 0x60: passed to trooper_anim_update / trooper_anim_finish */ u8 unk67; /* 0x67 */ u8 pad_68[8]; - u8 unk70[0x10]; /* 0x70: passed to FUN_L00_0025c558 / FUN_L00_0025c698 */ + u8 unk70[0x10]; /* 0x70: passed to trooper_start_knockback / mine_fall */ f32 unk80; /* 0x80 */ f32 unk84; /* 0x84 */ f32 unk88; /* 0x88 */ @@ -1439,7 +1441,8 @@ extern float abs_0698(float) __asm__("FUN_001f99c0"); /* Path moby update: hit handling first, then a state machine that turns toward the player or its target, spawns and fires a projectile (pvars 0x160) and dies by explosion or by reaching the end of its path. */ -void FUN_L11_00310180(struct Moby *m) { +void psytcopus_update(struct Moby *m) __asm__("FUN_L11_00310180"); +void psytcopus_update(struct Moby *m) { struct PokiPathVars *pv = (struct PokiPathVars *)m->pvars; struct Moby *target; Vec4f v; @@ -1480,7 +1483,7 @@ void FUN_L11_00310180(struct Moby *m) { { float *yaw = &m->rot.z; angle = atan2_0180(D_001413D0->pos.x - m->pos.x, D_001413D0->pos.y - m->pos.y); - FUN_L00_0025be00(yaw, angle, &pv->unk14C, frame_time_sq * 6.2831855f, + approach_angle(yaw, angle, &pv->unk14C, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); } if (pv->unk114 != 2) { @@ -1494,7 +1497,7 @@ void FUN_L11_00310180(struct Moby *m) { { float *yaw = &m->rot.z; angle = atan2_0180(target->pos.x - m->pos.x, target->pos.y - m->pos.y); - FUN_L00_0025be00(yaw, angle, &pv->unk14C, frame_time_sq * 6.2831855f, + approach_angle(yaw, angle, &pv->unk14C, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); } if (in_window_0180(m, 15.0f) != 0) { @@ -1515,7 +1518,7 @@ void FUN_L11_00310180(struct Moby *m) { { float *yaw = &m->rot.z; angle = atan2_0180(target->pos.x - m->pos.x, target->pos.y - m->pos.y); - FUN_L00_0025be00(yaw, angle, &pv->unk14C, frame_time_sq * 6.2831855f, + approach_angle(yaw, angle, &pv->unk14C, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); } if (pv->unk160 != 0 && in_window_0180(m, 33.0f) != 0) { @@ -1566,7 +1569,7 @@ void FUN_L11_00310180(struct Moby *m) { break; } } -/* Hit handling for the FUN_L11_00310180 moby: takes damage, picks the hurt or death reaction, keeps it on its path. */ +/* Hit handling for the psytcopus_update moby: takes damage, picks the hurt or death reaction, keeps it on its path. */ void FUN_L11_00310698(struct Moby *m) { struct PokiPathVars *pv = (struct PokiPathVars *)m->pvars; Vec4f v; @@ -1919,7 +1922,7 @@ typedef struct { extern struct UsageStat help_stats[] __asm__("D_00141968"); extern s32 D_0015EEA4; extern short D_L11_001F0CF8[]; /* outline of an ammo pip */ -/* The health bar's palette: FUN_L11_00313290 points clut at it in texture +/* The health bar's palette: jet_fighter_update points clut at it in texture memory and, the first time (saved), copies it to D_L11_001F1088. */ typedef struct { s32 *clut; @@ -1933,7 +1936,7 @@ extern void append_rotated_sprite_quad(f32, f32, f32, f32, f32, s32, s32, s64, s f32) __asm__("FUN_001f5ab0"); extern void FUN_L11_00310ad0(short *pts, int n, f32 x, f32 y, u32 col, u64 prim, f32 scale); extern void FUN_L11_00311048(f32 x, f32 y, f32 scale, f32 angle, u8 r, u8 g, u8 b, u8 a); -extern f32 FUN_L00_0025e310(f32); +extern f32 normalize_angle(f32) __asm__("FUN_L00_0025e310"); extern s32 help_request(s32 message, s32 help) __asm__("FUN_L00_00203908"); extern char *get_help_message_text(s32) __asm__("func_001FDD10"); extern void font_print_center_large(s32 x, s32 y, u64 color, char *text, s32 scale) __asm__("FUN_001f6c20"); @@ -2031,7 +2034,7 @@ void FUN_L11_00311d50(struct Moby *moby) { } alpha = truncate_float_to_s32(fade * 96.0f); FUN_L11_00311048(convert_integer_to_float(sx), convert_integer_to_float(sy), grow, - FUN_L00_0025e310(convert_integer_to_float(level_frame) / 30.0f), 0, 0xFF, 0, alpha); + normalize_angle(convert_integer_to_float(level_frame) / 30.0f), 0, 0xFF, 0, alpha); vars->locked = NULL; } else { blink = 0xFF; @@ -2113,7 +2116,7 @@ extern int FUN_L11_00308848(void *, void *, void *, float, float); extern f32 D_L11_00162090_gp __asm__("D_L11_00162090") __attribute__((sda)); extern unsigned char D_0013A4E0[]; extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void FUN_L11_00311210(void *, void *, void *, int); void build_spherical_offset(f32 *out, f32 scale, f32 a, f32 b) __asm__("FUN_00214db0"); @@ -2128,29 +2131,29 @@ void FUN_L11_003125a8(struct Moby *moby, char *obj, float p2, float p3) { build_spherical_offset((f32 *)a, *(float *)&D_L11_0016205C * *(float *)&D_L11_00162090_gp, p2, p3); - FUN_001f9a10(a, a, obj); + fast_vec_add(a, a, obj); if (FUN_001f9740_c(obj + 0x80) && (*(int *)(D_0013A4E0 + 0x2610) & 0x84)) { fast_vec_normalize(c, a, 2.2f); moby_point_position(moby, 3 + (obj[0x61] & 1), b); - FUN_001f9a10(b, b, c); + fast_vec_add(b, b, c); FUN_L11_00308848(moby, a, b, 200.0f, -1.0f); *(int *)(obj + 0x80) = D_L11_00162060; obj[0x61] ^= 1; FUN_0022da68_c(3, 0, (int)moby); } fast_vec_normalize(a, a, 23.0f); - FUN_001f9a10(d, a, &moby->pos); + fast_vec_add(d, a, &moby->pos); FUN_L11_00311210(d, obj + 0xE0, obj + 0xE4, 0); } /* on a pad press, fires the aimed shot and resets the cooldown */ /* Ported from rac1-decomp (src/overlays/l11_pokitaru/vendor_00312BD8.c: func_L11_00313BC0), where it is exact; names translated to the US level program. */ -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int FUN_L11_00309378(void *, void *, int, void *, float, int); extern f32 D_L11_00162090_gp __asm__("D_L11_00162090") __attribute__((sda)); extern unsigned char D_0013A4E0[]; extern void fast_dec_timer(int *arg0) __asm__("FUN_001f9740"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void FUN_0022da68(int, int, int); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); @@ -2169,12 +2172,12 @@ void FUN_L11_003126f8(struct Moby *moby, char *d) { *(unsigned short *)(d + 0x6A) = v; moby_point_position(moby, v + 7, a); fast_vec_normalize(b, d, 0.3f); - FUN_001f9a10(a, a, b); + fast_vec_add(a, a, b); if (*(int *)(d + 0x88) != 0 && !(500 < *(int *)(d + 0x8C))) t = *(int *)(d + 0x88); if (FUN_L11_00309378(moby, a, t, &moby->rot, *(float *)&D_L11_00162064 * *(float *)&D_L11_00162090_gp, - FUN_001f96f8(300))) { + scale_game_frames(300))) { func_0022ED80_i(2, 0, (int)moby); hero.ship_ammo -= 1; *(int *)(d + 0x84) = D_L11_00162068; @@ -2321,11 +2324,11 @@ extern void transform_by_basis_2838(void *, void *, void *) __asm__("FUN_001f9cf extern void update_view_context_2838(void) __asm__("FUN_001f2d98"); extern void enqueue_2838(void *, void *) __asm__("FUN_001f4600"); extern void approach_2838(float *, float *, float, float, float, float) __asm__("FUN_00213f38"); -extern float FUN_L00_0025b8c0(float *p, float *v, float t, float u1, float u2, float eps); +extern float vendor_spring(float *p, float *v, float t, float u1, float u2, float eps) __asm__("FUN_L00_0025b8c0"); extern float FUN_L00_0025bc98(float *, float *, int, float, float, float, float); extern void FUN_L00_001ff660(void *, void *, void *); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, float, int, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L11_00311d50(); void FUN_L11_00313f60(struct Moby *moby, float *a, float *b); @@ -2372,8 +2375,8 @@ void FUN_L11_00312838(struct Moby *m, ShipVars_2838 *o) { if (usage_stats.stat[28].count < 0xFFFF) { usage_stats.stat[28].count++; } - if (FUN_001f96f8(D_0015EEA4) / 600 > usage_stats.stat[28].unk2) { - usage_stats.stat[28].unk2 = FUN_001f96f8(D_0015EEA4) / 600; + if (scale_game_frames(D_0015EEA4) / 600 > usage_stats.stat[28].unk2) { + usage_stats.stat[28].unk2 = scale_game_frames(D_0015EEA4) / 600; } usage_stats.stat[28].level_mask = usage_stats.stat[28].level_mask | (1 << current_level_index) | 0x80000000; @@ -2415,8 +2418,8 @@ void FUN_L11_00312838(struct Moby *m, ShipVars_2838 *o) { kb = D_L11_001620B8; } FUN_L11_00313f60(m, &a, &b); - FUN_L00_0025b8c0(&o->f6C, &o->f90, a, D_L11_0016209C, D_L11_001620A0, ka); - FUN_L00_0025b8c0(&o->f70, &o->f94, b, D_L11_001620AC, D_L11_001620B0, kb); + vendor_spring(&o->f6C, &o->f90, a, D_L11_0016209C, D_L11_001620A0, ka); + vendor_spring(&o->f70, &o->f94, b, D_L11_001620AC, D_L11_001620B0, kb); FUN_L00_0025bc98(&o->f30, &o->f98, 0, o->f6C * D_L11_0016207C, D_L11_001620BC, D_L11_001620C0, D_L11_001620C4); o->f34 = fast_sub_rot_2838(o->f34, o->f70 * D_L11_00162014); @@ -2431,7 +2434,7 @@ void FUN_L11_00312838(struct Moby *m, ShipVars_2838 *o) { build_spherical_offset(dir, o->speed, o->f38, -o->f34); fast_vec_normalize(o->v10, dir, 1.0f); qcopy(old, &m->pos); - FUN_001f9a10(&m->pos, &m->pos, dir); + fast_vec_add(&m->pos, &m->pos, dir); { float lo = D_L11_00161FF4_gp; float range = D_L11_00161FF8 - lo; @@ -2457,11 +2460,11 @@ void FUN_L11_00312838(struct Moby *m, ShipVars_2838 *o) { wr.e[1].v[2] = D_L11_00162030 * D_L11_0016208C; tbl.e[0].q = wr.e[0].q; tbl.e[1].q = wr.e[1].q; - FUN_L00_0025b8c0(&o->fB4, &o->fC8, tbl.e[o->sel].v[0], D_L11_00162104, D_L11_00162108, + vendor_spring(&o->fB4, &o->fC8, tbl.e[o->sel].v[0], D_L11_00162104, D_L11_00162108, D_L11_0016210C); - FUN_L00_0025b8c0(&o->fB8, &o->fCC, tbl.e[o->sel].v[1], D_L11_00162110, D_L11_00162114, + vendor_spring(&o->fB8, &o->fCC, tbl.e[o->sel].v[1], D_L11_00162110, D_L11_00162114, D_L11_00162118); - FUN_L00_0025b8c0(&o->fBC, &o->fD0, tbl.e[o->sel].v[2], D_L11_0016211C, D_L11_00162120, + vendor_spring(&o->fBC, &o->fD0, tbl.e[o->sel].v[2], D_L11_0016211C, D_L11_00162120, D_L11_00162124); diff[0] = o->fB4; diff[1] = o->fB8; @@ -2469,7 +2472,7 @@ void FUN_L11_00312838(struct Moby *m, ShipVars_2838 *o) { diff[3] = 0.0f; euler_basis_2838(mat, &o->f30); transform_by_basis_2838(target, diff, mat); - FUN_001f9a10(wr.e[0].v, &m->pos, target); + fast_vec_add(wr.e[0].v, &m->pos, target); FUN_L00_002ea9d8(wr.e[0].v); wr.e[1].v[0] = fast_add_rot_2838(o->f30 * D_L11_00162038, o->f6C * D_L11_00162034); wr.e[1].v[1] = fast_sub_rot_2838(fast_add_rot_2838(o->f34, D_L11_0016203C), @@ -2504,12 +2507,12 @@ void FUN_L11_00312838(struct Moby *m, ShipVars_2838 *o) { if (coll_sphere(2.0f, &m->pos, 0, m)) { p = D_L11_00174840; if (*(char **)(p + 0x18) == 0) { - FUN_L00_0025e450(m, D_L11_0015F580, 0, 8.0f, 100.0f, 0x1E, 0xA, 0x18, 16.0f, 8.0f, + spawn_explosion(m, D_L11_0015F580, 0, 8.0f, 100.0f, 0x1E, 0xA, 0x18, 16.0f, 8.0f, 9.0f, 1.0f, -1, 50.0f, 1, 1, -1, 0); m->visible = 0; m->state = 7; m->flags |= 1; - o->iF8 = FUN_001f96f8(0x5A); + o->iF8 = scale_game_frames(0x5A); } else { hc = *(short *)(*(char **)(p + 0x18) + 0xA6); if (hc != 0 && hc != 0x192 && hc != 0x4C2 && hc != 0x4C3) { @@ -2533,7 +2536,7 @@ void FUN_L11_00312838(struct Moby *m, ShipVars_2838 *o) { FUN_L00_001ff660(vel, dir, p + 0x40); fast_vec_normalize(vel, vel, frame_time + frame_time); fast_vec_normalize(up.v, p + 0x40, 1.0f); - FUN_L00_0025e450(m, vel, 0, 8.0f, 100.0f, 0x1E, 0xA, 0x18, 16.0f, 8.0f, + spawn_explosion(m, vel, 0, 8.0f, 100.0f, 0x1E, 0xA, 0x18, 16.0f, 8.0f, 9.0f, 1.0f, -1, 50.0f, 1, 1, -1, 0); m->state = 7; } @@ -2551,7 +2554,7 @@ void FUN_L11_00312838(struct Moby *m, ShipVars_2838 *o) { -fast_add_rot_2838(o->f24, -(o->f70 / 7.0f) - 0.1f)); } /* Per-frame update for the player's ship moby on Pokitaru: takes hits, boards and leaves the ship, - and runs the flight states. Same source as the exact FUN_L17_002ed018 with Pokitaru's states. */ + and runs the flight states. Same source as the exact fighter_jet_update with Pokitaru's states. */ typedef struct { char pad00[0x10]; @@ -2594,21 +2597,22 @@ extern int timer_3290(void *) __asm__("FUN_001f9740"); extern int alloc_voice_3290(int, int, struct Moby *) __asm__("FUN_0022da68"); extern void release_voice_3290(int) __asm__("FUN_0022d798"); extern void print_3290(char *) __asm__("FUN_001e93b0"); -extern void ship_set_hero_state_3290(int, int) __asm__("FUN_L11_0024db50"); -extern float FUN_L00_00250430(void *, void *); +extern void FUN_L11_0024db50(int, int); +extern float jet_distance(void *, void *) __asm__("FUN_L00_00250430"); extern int try_set_help_message(int, int) __asm__("FUN_00215130"); -extern void FUN_L01_0027a248(int, int); +extern void jet_game_state(int, int) __asm__("FUN_L01_0027a248"); extern void set_animation_parameter(int, int) __asm__("FUN_001ff570"); extern void refresh_moby_spatial_bounds_from_basis(void *) __asm__("FUN_0020e098"); extern void hero_respawn(void) __asm__("FUN_L00_00211250"); -extern void FUN_L00_002502a0(int); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); extern void FUN_L11_003112b8(void *, void *); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L11_0031a758(int); extern int FUN_L11_0031a7d8(int); s32 hp_bar_saved __asm__("D_L11_00162170") = 0; -void FUN_L11_00313290(struct Moby *moby) { +void jet_fighter_update(struct Moby *moby) __asm__("FUN_L11_00313290"); +void jet_fighter_update(struct Moby *moby) { ShipVars_2838 *v; ShipHit_3290 *hit; W4_2838 dir; @@ -2630,7 +2634,7 @@ void FUN_L11_00313290(struct Moby *moby) { if (hit->flags & 1) { k = hit->damage * D_L11_00162078; build_spherical_offset(dir, v->speed, v->f38, -v->f34); - FUN_001f9a10(&moby->pos, &moby->pos, hit->push); + fast_vec_add(&moby->pos, &moby->pos, hit->push); FUN_L00_001ff660(dir, dir, hit->push); v->f38 = fast_add_rot_2838( v->f38, @@ -2647,10 +2651,10 @@ void FUN_L11_00313290(struct Moby *moby) { v->s62 = 0xB4; g->motion.pos.f[2] += 0.2f; g->moby->collision_disable = 0; - ship_set_hero_state_3290(0, 1); + FUN_L11_0024db50(0, 1); g->ship_moby = 0; g->ship_oclass = -1; - FUN_L00_0025e450(moby, dir, 0, 0.0f, 0.0f, 10, 3, 16, 4.0f, 2.0f, 9.0f, 1.0f, -1, + spawn_explosion(moby, dir, 0, 0.0f, 0.0f, 10, 3, 16, 4.0f, 2.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, -1, 0); } } @@ -2694,15 +2698,15 @@ void FUN_L11_00313290(struct Moby *moby) { break; case 1: { struct Hero *g = &hero; - if (FUN_L00_00250430(moby, g->moby) < D_L11_00161FD0) { + if (jet_distance(moby, g->moby) < D_L11_00161FD0) { if (item_available[7] != 0) { try_set_help_message(7, 0x2B09); } else { - n = FUN_001f96f8(D_0015EEA4) - help_stats[0x3C].unk2 * 600; - if (n > (int)((float)FUN_001f96f8(0x12) * 60.0f) || help_stats[0x3C].unk2 * 600 == 0) { + n = scale_game_frames(D_0015EEA4) - help_stats[0x3C].unk2 * 600; + if (n > (int)((float)scale_game_frames(0x12) * 60.0f) || help_stats[0x3C].unk2 * 600 == 0) { help_request(0x2AFA, 0x3C); - } else if (FUN_001f96f8(D_0015EEA4) / 600 > help_stats[0x3C].unk2) { - help_stats[0x3C].unk2 = FUN_001f96f8(D_0015EEA4) / 600; + } else if (scale_game_frames(D_0015EEA4) / 600 > help_stats[0x3C].unk2) { + help_stats[0x3C].unk2 = scale_game_frames(D_0015EEA4) / 600; } } if (item_available[7] != 0 && (D_0013CAE4 & 0x10)) { @@ -2723,13 +2727,13 @@ void FUN_L11_00313290(struct Moby *moby) { D_L11_0015F3FC = v->fade; if (v->fade == 1.0f) { struct Hero *g; - ship_set_hero_state_3290(0x32, 1); + FUN_L11_0024db50(0x32, 1); moby->pos.z += 30.0f; - FUN_L01_0027a248(2, 6); + jet_game_state(2, 6); zero_vector_c788(&v->f30); zero_vector_c788(&v->f20); v->f38 = v->f28 = moby->rot.z; - v->i114 = FUN_001f96f8(0x708); + v->i114 = scale_game_frames(0x708); if (help_stats[0x55].count == 0) { help_request(0x2AFC, 0x55); } @@ -2750,7 +2754,7 @@ void FUN_L11_00313290(struct Moby *moby) { g->unk15FA = 3; g->unk15FB = 3; g->ship_flags = 0; - FUN_L00_002eaaa0(D_L11_001677C0, D_L11_001677C0 + 0x10, 1, 0, 0); + jet_mount(D_L11_001677C0, D_L11_001677C0 + 0x10, 1, 0, 0); v->count = 0; v->speed = D_L11_00161FD4; v->f6C = 0.0f; @@ -2780,7 +2784,7 @@ void FUN_L11_00313290(struct Moby *moby) { int alive = FUN_L11_0031a758(v->i10C); if (v->sEA != 0 && alive < 5 - v->sE8 && timer_3290(&v->i114) && FUN_L11_0031a7d8(v->i10C)) { - v->i114 = FUN_001f96f8(0xF0); + v->i114 = scale_game_frames(0xF0); } } if (v->sE8 <= 0) { @@ -2796,10 +2800,10 @@ void FUN_L11_00313290(struct Moby *moby) { struct Hero *g = &hero; g->unk20A5 = 0; g->moby->collision_disable = 0; - ship_set_hero_state_3290(0, 1); + FUN_L11_0024db50(0, 1); FUN_L00_002eac18(0); set_animation_parameter(g->unk160C, 0); - FUN_L01_0027a248(0, 8); + jet_game_state(0, 8); qcopy_nc(&moby->pos, v->home_pos); qcopy_nc(&moby->rot, v->home_rot); moby->scale = *(float *)((char *)moby->pclass + 0x24); @@ -2844,9 +2848,9 @@ void FUN_L11_00313290(struct Moby *moby) { struct Hero *g = &hero; g->unk20A5 = 0; g->moby->collision_disable = 0; - ship_set_hero_state_3290(0, 1); + FUN_L11_0024db50(0, 1); FUN_L00_002eac18(0); - FUN_L01_0027a248(0, 8); + jet_game_state(0, 8); moby->visible = 0; moby->collision = 0; moby->flags |= 1; @@ -2866,7 +2870,7 @@ void FUN_L11_00313290(struct Moby *moby) { FUN_L00_00216f90(p + 0x30, p + 0x70, 0, 1); } if (moby->mission != 0xFF) { - FUN_L00_002502a0(moby->mission); + jet_clear_persistent(moby->mission); } moby->state = 9; } @@ -2905,7 +2909,7 @@ void FUN_L11_00313290(struct Moby *moby) { } if (moby->state == 3 || moby->state == 4) { FUN_L11_003112b8(moby, v); - if (FUN_L00_0028d8c0(moby, v->voice) == 0) { + if (voice_is_playing(moby, v->voice) == 0) { v->voice = alloc_voice_3290(0, 4, moby); } } else { @@ -2992,7 +2996,7 @@ void FUN_L11_00313f60(struct Moby *moby, float *a, float *b) { hero.ship_flags |= 2; } } -/* pvars of the class 0x4DE creature run by FUN_L11_00314318. */ +/* pvars of the class 0x4DE creature run by puffoid_update. */ typedef struct { u8 pad00[0x20]; f32 unk20; /* 0x20 */ @@ -3013,7 +3017,7 @@ typedef struct { u8 padCA[6]; void *unkD0; /* 0xD0 */ u8 padD4[0x4C]; - u8 unk120[0x5C]; /* 0x120: FUN_L00_0025c698 / FUN_L00_002dc9f0 state */ + u8 unk120[0x5C]; /* 0x120: mine_fall / FUN_L00_002dc9f0 state */ f32 smoke; /* 0x17C: nonzero: dying states give off smoke */ s32 unk180; /* 0x180: block set up by FUN_L01_0026d930 */ f32 unk184; /* 0x184 */ @@ -3071,13 +3075,13 @@ extern float random_float_4318(float, float) __asm__("FUN_002132a8"); extern int random_below_4318(int) __asm__("FUN_00213260"); extern float random_angle_4318(void) __asm__("FUN_00213308"); extern float ground_height_4318(void *, int, float) __asm__("FUN_00213508"); -extern float floor_height_4318(void *) __asm__("FUN_L00_00259710"); +extern float FUN_L00_00259710(void *); extern int on_path_4318(void *, void *, int) __asm__("FUN_L00_00259740"); extern void spray_4318(struct Moby *, void *, float, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); extern float jump_speed_4318(void *, void *, int, float, float) __asm__("FUN_L00_0025abf0"); extern float turn_to_4318(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); extern int FUN_L00_0025c698_4318(struct Moby *, void *) __asm__("FUN_L00_0025c698"); -extern void explode_4318(struct Moby *, void *, int, float, float) __asm__("FUN_L00_0025f3e8"); +extern void FUN_L00_0025f3e8(struct Moby *, void *, int, float, float); extern void follow_carrier_4318(struct Moby *, void *, void *, void *, void *, void *) __asm__("FUN_L00_00260400"); extern int FUN_L00_00261968_4318(int, void *, void *) __asm__("FUN_L00_00261968"); extern void move_4318(struct Moby *, void *, float, float, float, int) __asm__("FUN_L00_00258830"); @@ -3099,7 +3103,8 @@ extern float sin_4318(float) __asm__("FUN_001f9de0"); /* Update for the class 0x4DE creature: spawns on a path or a carrier moby, wanders, chases and attacks the target, jumps between path points, and smokes while it dies. */ -void FUN_L11_00314318(struct Moby *moby) { +void puffoid_update(struct Moby *moby) __asm__("FUN_L11_00314318"); +void puffoid_update(struct Moby *moby) { CreatureVars_4318 *d = (CreatureVars_4318 *)moby->pvars; struct Moby *target; float pos[4]; @@ -3153,7 +3158,7 @@ void FUN_L11_00314318(struct Moby *moby) { moby->collision = 0; moby->flags |= 1; } else { - moby->pos.z = floor_height_4318(&moby->pos); + moby->pos.z = FUN_L00_00259710(&moby->pos); moby->state = 2; if (moby->prev_seq != 0) { set_anim_4318(moby, 0, 0, 5); @@ -3329,7 +3334,7 @@ void FUN_L11_00314318(struct Moby *moby) { case 11: if (FUN_L00_0025c698_4318(moby, d->unk120) & 0x160) { zero_vector_4318(pos); - explode_4318(moby, &moby->pos, -1, 0.5f, 10.0f); + FUN_L00_0025f3e8(moby, &moby->pos, -1, 0.5f, 10.0f); mark_for_removal_4318(moby); return; } @@ -3459,7 +3464,7 @@ void FUN_L11_00314318(struct Moby *moby) { &moby->pos, &moby->rot); if (FUN_L00_0025c698_4318(moby, d->unk120) & 0x160) { zero_vector_4318(pos); - explode_4318(moby, &moby->pos, -1, 0.5f, 10.0f); + FUN_L00_0025f3e8(moby, &moby->pos, -1, 0.5f, 10.0f); mark_for_removal_4318(moby); return; } diff --git a/src/overlays/l11/gameplay/hero/0023c7a0.c b/src/overlays/l11/gameplay/hero/0023c7a0.c index 62ad2cb731..a64698c07a 100644 --- a/src/overlays/l11/gameplay/hero/0023c7a0.c +++ b/src/overlays/l11/gameplay/hero/0023c7a0.c @@ -15,7 +15,7 @@ /* Per-frame update of the player state flags from the current state. */ /* Ported from rac1-decomp (src/overlays/l11_pokitaru/help_0023CD98.c: func_L11_0023CD98), where it is exact; names translated to the US level program. */ -extern int FUN_001f0b58(void); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern void fast_mem_zero16(void *, int) __asm__("FUN_001f9810"); extern void FUN_L00_0020b930(void); @@ -64,7 +64,7 @@ void FUN_L11_0023c7a0(void) { struct Hero *c = &hero; if (c->state.current != 0x7B) { if (coll_sphere(c->unk234 + 0.03f, &c->motion.unkD0, 2, 0)) { - if (FUN_001f0b58() == 0xB) { + if (collision_hit_material() == 0xB) { hero_set_state(0x7B, 1); return; } @@ -242,7 +242,7 @@ extern void FUN_L00_00217118(f32, f32); extern void stick_target(f32, s32) __asm__("FUN_L00_002118c8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void turn_to(s32, f32, f32, f32) __asm__("FUN_L00_00211e30"); -extern s32 FUN_001f9740(void *); +extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 FUN_L00_00229a98(void); extern void FUN_L00_00211e98(void); @@ -282,10 +282,10 @@ extern u8 D_L11_0017C9C0[]; extern void FUN_L00_00216e48(s32, struct MobyView *, s32); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); -extern s32 FUN_001f9770(s16 *); +extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); extern void FUN_L00_00209a40(s32, s32); extern void FUN_L00_00209ca8(s32, s32, s32); -extern void FUN_L00_002a3ec8(s32, s32, s32, f32, f32, f32, f32); +extern void pool_splash(s32, s32, s32, f32, f32, f32, f32) __asm__("FUN_L00_002a3ec8"); extern f32 FUN_L00_0025bc98(f32 *, f32, f32 *, s32, f32, f32, f32); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); @@ -299,7 +299,7 @@ extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 FUN_L00_00209018(void *, s32); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern void FUN_L00_0020a1e0(f32, f32); @@ -323,21 +323,21 @@ extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern s32 FUN_L00_002595a0(f32 *, f32 *, f32, f32, f32); extern void FUN_L00_0025bc00(f32 *, s32, f32, f32); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern f32 square_root(f32) __asm__("FUN_001f9988"); -extern f32 FUN_L00_00233a78(void *); -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); -extern f32 FUN_L00_00213350(void *); +extern f32 gravity_z(void *) __asm__("FUN_L00_00233a78"); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); +extern f32 forward_component(void *) __asm__("FUN_L00_00213350"); extern struct HeroTableRow2C D_L11_0017C628[]; extern struct LevelTable_QS D_L11_00167680; #define Q D_L11_00167680 extern void FUN_L00_00233ba0(void *, void *, f32); -extern void FUN_L00_00233b20(void *, void *, f32); +extern void gravity_set_z(void *, void *, f32) __asm__("FUN_L00_00233b20"); extern void FUN_L00_002336e8(void *, void *, f32); extern void make_hit_descriptor(void *, struct MobyView *, s32, f32, void *) __asm__("FUN_L00_00259888"); extern s32 collect_mobies_in_sphere(f32, void *, s32, struct MobyView *, void *) __asm__("FUN_L00_001f2868"); @@ -348,8 +348,8 @@ extern void FUN_L00_001ff290(void *, void *, void *); extern void FUN_L00_002a9b80(struct MobyView *, void *); extern s32 FUN_L00_002a96f8(struct MobyView *, void *, f32, f32, s32, f32, f32, f32); extern void FUN_L00_002335c8(void *, f32, f32, f32); -extern s32 FUN_L00_002598b0(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32); -extern f32 FUN_001f9ab0(void *, void *); +extern s32 play_entity_sound(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32) __asm__("FUN_L00_002598b0"); +extern f32 fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); struct PlayerSpeedTuning { u8 pad0[8]; f32 x08; @@ -361,14 +361,14 @@ extern struct PlayerSpeedTuning D_L11_0017C7B8; extern s32 FUN_L00_00216de8(s32, s32); extern void FUN_L00_00233708(void *, void *, f32); extern void FUN_L00_00233810(void *, void *, f32); -extern s32 FUN_001efa68(void *, void *, s32, struct MobyView *, s32); +extern s32 collision_line(void *, void *, s32, struct MobyView *, s32) __asm__("FUN_001efa68"); extern void FUN_L00_00215340(void); extern void FUN_L00_00233660(void *, f32, f32, f32); extern s32 FUN_L00_0025e3b8(s32); -extern void FUN_L00_00259bc8(s32, struct MobyView *, s32, void *, void *, f32); +extern void spawn_nearby_effect(s32, struct MobyView *, s32, void *, void *, f32) __asm__("FUN_L00_00259bc8"); extern s32 D_L11_00178900[]; extern void FUN_L00_00209ec8(void); -extern void FUN_L00_002338d0(void *, void *); +extern void gravity_flatten(void *, void *) __asm__("FUN_L00_002338d0"); extern s32 hero_slot_item_id(s32) __asm__("FUN_L00_0020d498"); extern void FUN_L00_0020b5b8(void); extern void FUN_L01_0022d090(void); @@ -381,7 +381,7 @@ extern void FUN_L00_0020d2f8(void *); extern f32 randf_sym(f32, f32) __asm__("FUN_L00_00257c48"); extern void FUN_L00_0026d598(void *, void *, s32); extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); -extern s32 FUN_L00_0025d808(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); +extern s32 sample_path(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); extern s32 FUN_L00_0025d7a0(void *, s32, s32, s32); extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); extern void hero_integrate_velocity(void) __asm__("FUN_L00_00214108"); @@ -440,7 +440,7 @@ void FUN_L11_00246b70(void) { transform_vector_by_basis(&hero.motion.unk170, &v0, &D_L11_001677D8[0x1F8]); hero.motion.move_yaw = *(f32 *)D_L11_001677D8; turn_to(0, frame_scale_sq, frame_scale_sq * 0.0f, frame_time * 174.53293f); - if (D_L11_0015F688 > 0 && FUN_001f9740(&D_L11_0015F688) != 0) { + if (D_L11_0015F688 > 0 && fast_dec_timer(&D_L11_0015F688) != 0) { s32 t; if (usage_stats.stat[18].count < 0xFFFF) { usage_stats.stat[18].count++; @@ -596,7 +596,7 @@ void FUN_L11_00246b70(void) { } if (hero.unk90A != 0) { s32 n; - FUN_001f9770(&hero.unk90A); + fast_dec_timer_s16(&hero.unk90A); n = (s16)hero.unk90A >> 2; FUN_L00_00209a40(n > 8 ? 8 : n, 0); } @@ -610,7 +610,7 @@ void FUN_L11_00246b70(void) { if (hero.state_timer == 1) { FUN_L00_00209ca8(3, 0x10, 0); if (D_L11_001612D0 != 0) { - FUN_L00_002a3ec8(D_L11_001612D0, D_L11_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L11_001612D0, D_L11_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, -0.3f); } hero.unk90A = scale_game_frames(70); @@ -721,7 +721,7 @@ void FUN_L11_00246b70(void) { stick_target(1.0f, 0); turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); hero.unk8EC = hero.motion.unk184; - FUN_001f9740(&hero.unk8F4); + fast_dec_timer(&hero.unk8F4); if (hero.state.step == 1) { hero.target_speed = frame_time * 6.0f; } else if (hero.state.current == 0x35) { @@ -751,7 +751,7 @@ void FUN_L11_00246b70(void) { if (hero.state.current != 0x35 || !(PD.u1A0.i1A0 & 0xA)) { hero.target_speed *= k; }; - if (FUN_001f9740(&hero.unk8F0) != 0) { + if (fast_dec_timer(&hero.unk8F0) != 0) { s32 lo2; s32 hi2; pl = &hero; @@ -774,7 +774,7 @@ void FUN_L11_00246b70(void) { } pl->unk8F0 = random_int_between(lo2, scale_game_frames(hi2)); } - if (hero.state.current == 0x35 && FUN_001f9770(&hero.unk8F8) != 0) { + if (hero.state.current == 0x35 && fast_dec_timer_s16(&hero.unk8F8) != 0) { struct MobyView *gm = MV(hero.items[3].moby); if (gm != NULL && gm->hA6 == 0x261) { s32 i; @@ -812,7 +812,7 @@ void FUN_L11_00246b70(void) { } build_spherical_offset(&hero.motion.velocity, sp, hero.motion.rot.f[2], yaw); } else if (hero.state.current == 0x34) { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); if (hero.state.prev == 0x35) { approach_value(&len, 0.0f, frame_time_sq * 8.0f); } else { @@ -860,11 +860,11 @@ void FUN_L11_00246b70(void) { break; case 0x6A: case 0x82: { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); approach_value(&len, 0.0f, frame_time_sq * 4.0f); fast_vec_normalize(&hero.motion.unk150, &hero.motion.unk150, len); qcopy(&hero.motion.velocity, &hero.motion.unk150); - if (FUN_001f9740(&hero.unk8F0) == 2) { + if (fast_dec_timer(&hero.unk8F0) == 2) { moby_point_position(MV(hero.moby), 4, &v0); v20.q = 0; v20.f[0] = 0.4f; @@ -911,7 +911,7 @@ void FUN_L11_00246b70(void) { } } turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); - FUN_001f9740(&hero.unk698); + fast_dec_timer(&hero.unk698); if (hero.state.current == 0x36) { if (PD.i1D4 != 0 && hero.unk698 != 0) { hero.target_speed = frame_time * 3.0f; @@ -1035,7 +1035,7 @@ void FUN_L11_00246b70(void) { FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, 0.0f, frame_time * 3.8397243f); } else { f32 an = fast_add_rotations( - -fast_arc_tan(FUN_001f9b80(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); + -fast_arc_tan(vector_distance(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, an, frame_time * 6.4577184f); } v20.f[0] = fast_cos(fast_add_rotations(hero.motion.rot.f[2], -1.5707964f)) * -0.57f; @@ -1119,14 +1119,14 @@ void FUN_L11_00246b70(void) { } if (hero.unk99C != 0) { f32 s; - if (FUN_001f9b80(&hero.motion.pos, &MV(hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { + if (vector_distance(&hero.motion.pos, &MV(hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.displacement, frame_time_sq * 40.0f); - if (hero.unk9BE != 0 && FUN_L00_00233a78(&hero.motion.velocity) > 0.0f) { + if (hero.unk9BE != 0 && gravity_z(&hero.motion.velocity) > 0.0f) { subtract_vector_xyz(&v30, &hero.motion.pos, &MV(hero.unk994)->u10.v10); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 57.0f); } } - s = FUN_001f9af0(&hero.motion.velocity) * (frame_time * 0.015f); + s = fast_vec_length(&hero.motion.velocity) * (frame_time * 0.015f); fast_vec_scale(&v30, &hero.motion.velocity, -1.0f); fast_vec_normalize(&v30, &v30, s); add_vector_xyz(&hero.motion.velocity, &hero.motion.velocity, &v30); @@ -1134,7 +1134,7 @@ void FUN_L11_00246b70(void) { { struct MobyView *r; if (MV(hero.unk994) != NULL && (r = MV(hero.unk994)->pm78) != NULL) { - f32 len = FUN_001f9af0(&hero.motion.velocity); + f32 len = fast_vec_length(&hero.motion.velocity); if (r->fC < len) { approach_value(&len, r->fC, frame_time_sq * 15.0f); fast_vec_normalize(&hero.motion.velocity, &hero.motion.velocity, len); @@ -1155,9 +1155,9 @@ void FUN_L11_00246b70(void) { add_vector_xyz(&v30, &MV(hero.unk994)->u10.v10, &vC0); subtract_vector_xyz(&hero.motion.velocity, &v30, &vD0); old = hero.unk9A4; - FUN_L00_0025b8c0(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); + vendor_spring(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); d = hero.unk9A4 - old; - if (FUN_001f9af0(&vC0) > hero.unk9A4) { + if (fast_vec_length(&vC0) > hero.unk9A4) { fast_vec_normalize(&vC0, &vC0, d); add_vector_xyz(&hero.motion.pos, &hero.motion.pos, &vC0); } @@ -1166,7 +1166,7 @@ void FUN_L11_00246b70(void) { f32 mx = frame_time * 14.0f; f32 sp = vector_length_xy(&hero.motion.velocity); if (sp < mx) { - FUN_L00_0025b8c0(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); + vendor_spring(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); v30.f[0] = fast_cos(hero.unk9AC) * hero.unk9B4; v30.f[1] = fast_sin(hero.unk9AC) * hero.unk9B4; v30.f[2] = 0.0f; @@ -1183,7 +1183,7 @@ void FUN_L11_00246b70(void) { up = hero.unk9BC == 1; } else { v30.q = hero.motion.displacement.q; - up = FUN_L00_00213350(&v30) > 0.0f; + up = forward_component(&v30) > 0.0f; } if (up) { if (moby->b53 != 0x35) { @@ -1219,12 +1219,12 @@ void FUN_L11_00246b70(void) { mx = frame_time_sq * 70.0f; t2 = scale_game_frames(33); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk4B0); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unk4B8 = 1.0f; } } @@ -1256,7 +1256,7 @@ void FUN_L11_00246b70(void) { } hero.target_speed = 0.0f; if (MV(hero.unkA54) != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &MV(hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &MV(hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = frame_time * 4.5f; } @@ -1297,16 +1297,16 @@ void FUN_L11_00246b70(void) { } FUN_L00_00211870(27.0f); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 130.0f); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unkA70 = 1.0f; } - if (FUN_L00_00233a78(&hero.motion.velocity) < frame_time * -37.0f) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); + if (gravity_z(&hero.motion.velocity) < frame_time * -37.0f) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); } } break; @@ -1376,7 +1376,7 @@ void FUN_L11_00246b70(void) { tb = &D_L11_0017C628[hero.attack_record]; hero.target_speed = 0.0f; if (MV(hero.unkA54) != NULL && scale_game_frames(4) > hero.state_timer) { - f32 d = FUN_001f9b80(&MV(hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; + f32 d = vector_distance(&MV(hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; f32 off; f32 tol; f32 mx; @@ -1595,7 +1595,7 @@ void FUN_L11_00246b70(void) { Vec4 *p = &hero.move_impulse; FUN_L00_002132b8(0.7f, 0.0f); v0.q = hero.move_impulse.q; - hero.target_speed += FUN_L00_00213350(&v0); + hero.target_speed += forward_component(&v0); if (hero.target_speed < frame_time * 0.7f) { hero.target_speed = frame_time * 0.7f; } @@ -1745,8 +1745,8 @@ void FUN_L11_00246b70(void) { FUN_L00_00215340(); FUN_L00_002132b8(0.7f, frame_time * 0.0f); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; case 0x77: { @@ -1758,8 +1758,8 @@ void FUN_L11_00246b70(void) { len = vector_length_xy(&hero.motion.velocity); FUN_L00_001ff600(frame_scale * -0.100000024f * len + len, &hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; } @@ -1798,11 +1798,11 @@ void FUN_L11_00246b70(void) { FUN_L00_00215340(); FUN_L01_00232978(1); if (big) { - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); hero.unk304 = hero.motion.velocity.f[2]; } else { - FUN_L00_0025b8c0(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, + vendor_spring(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, frame_scale_sq * 0.35f, frame_time * 2.5f); } break; @@ -1837,7 +1837,7 @@ void FUN_L11_00246b70(void) { speed_step(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); FUN_L00_00215340(); - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); if (hero.motion.pos.f[2] < hero.unk410) { approach_value(&hero.unk410, hero.motion.pos.f[2], frame_time * 4.0f); @@ -1881,7 +1881,7 @@ void FUN_L11_00246b70(void) { if (hero.state_timer == scale_game_frames(20)) { FUN_L00_00209ca8(3, 0x10, 1); if (D_L11_001612D0 != 0) { - FUN_L00_002a3ec8(D_L11_001612D0, D_L11_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L11_001612D0, D_L11_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, 0.35f); } } @@ -1931,7 +1931,7 @@ void FUN_L11_00246b70(void) { qcopy(&v10, &v0); v10.f[0] += fast_cos(hero.motion.rot.f[2]) * 0.85f; v10.f[1] += fast_sin(hero.motion.rot.f[2]) * 0.85f; - if (FUN_001efa68(&v0, &v10, 4, MV(hero.moby), 0) != 0) { + if (collision_line(&v0, &v10, 4, MV(hero.moby), 0) != 0) { hero.unk4A4 = 1; } } @@ -1954,7 +1954,7 @@ void FUN_L11_00246b70(void) { if (hero.motion.pos.f[2] < hero.unk410) { hero.unk410 = hero.motion.pos.f[2]; } - if (hero.state_timer > hero.unk420 && FUN_L00_00233a78(&hero.motion.velocity) < 0.001f && + if (hero.state_timer > hero.unk420 && gravity_z(&hero.motion.velocity) < 0.001f && (hero.unk41C == 0 || hero.state_timer > hero.unk3D4)) { hero.unk41E = 1; if (hero.unk3F8 != 0.0f) { @@ -1977,7 +1977,7 @@ void FUN_L11_00246b70(void) { fast_vec_scale(&v10, &hero.motion.displacement, 7.0f); for (i = 0; i < n; i++) { if (FUN_L00_0025e3b8(D_L11_00178900[i]) != 0) { - FUN_L00_00259bc8(D_L11_00178900[i], MV(hero.moby), 0x10000, &hero.motion.pos, &v10, + spawn_nearby_effect(D_L11_00178900[i], MV(hero.moby), 0x10000, &hero.motion.pos, &v10, 1.0f); } } @@ -2060,7 +2060,7 @@ void FUN_L11_00246b70(void) { } case 0x66: subtract_vector_xyz(&v0, &hero.unk1640, &hero.motion.pos); - if (FUN_001f9ab0(&v0, &hero.motion.unk150) < 0.0f) { + if (fast_vec_dot(&v0, &hero.motion.unk150) < 0.0f) { clear_u64_value(&hero.motion.unk150); } clear_u64_value(&hero.motion.velocity); diff --git a/src/overlays/l11/gameplay/hero/00253a18.c b/src/overlays/l11/gameplay/hero/00253a18.c index 6302e78a8d..1d33dc01b2 100644 --- a/src/overlays/l11/gameplay/hero/00253a18.c +++ b/src/overlays/l11/gameplay/hero/00253a18.c @@ -41,11 +41,11 @@ extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L11_0015F638; extern float D_L11_001677D8 __attribute__((section(".data"))); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_00208f20(float a, float b, float c, float d); extern float FUN_L00_00232b90(float a, float b, float c); -extern float FUN_L00_00233a78(float *v); +extern float gravity_z(float *v) __asm__("FUN_L00_00233a78"); extern float FUN_L00_00233c30(float *pos, float *vel, int *steps, float step); extern float FUN_L00_00266e80(int); extern float approach_value(float *p, float target, float maxstep) __asm__("FUN_00213ed8"); @@ -100,7 +100,7 @@ extern void FUN_L00_00232628(void); extern void FUN_L00_00232640(int id); extern void FUN_L00_00233288(float a, float b, short c, unsigned char d, unsigned char e, unsigned char f); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void hud_keep_visible(int, int) __asm__("FUN_L00_00235e18"); extern void FUN_L00_00237ae8(void); extern void FUN_L00_00237ba0(void); @@ -865,7 +865,7 @@ void FUN_L11_00253a18(void) { } break; case 101: - if (FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { + if (vector_distance(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { if (frame_time * 2.7f > hero.motion.speed_xy) { if (fast_difference_between_rotations( hero.motion.rot.f[2], hero.unk1640.f[3]) < 0.034906585f) { @@ -889,7 +889,7 @@ void FUN_L11_00253a18(void) { if ((hero.unkA98 & 2) || hero.unk1650 != 0) { hero_set_state(HERO_STATE_IDLE, 1); } - if (0.2f < FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f)) { + if (0.2f < vector_distance(hero.motion.pos.f, hero.unk1640.f)) { hero_set_state(0x65, 1); } break; @@ -1223,7 +1223,7 @@ void FUN_L11_00253a18(void) { if (hero_set_state(HERO_STATE_IDLE, 0)) { set_hero_animation(0xC, 9, -1.0f); } - FUN_L00_00233b20(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); + gravity_set_z(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); FUN_L00_0025f730(hero.motion.unk150.f, frame_time * 7.0f); hero.unk1C4 = scale_game_frames(7); if (hero.state.prev == 0x2D) { @@ -1724,7 +1724,7 @@ void FUN_L11_00253a18(void) { scale_game_frames(0xE) < hero.state_timer && (hero.unk41E == 0 || (hero.ground_distance > 0.7f && - absolute_float(FUN_L00_00233a78(hero.motion.velocity.f)) < + absolute_float(gravity_z(hero.motion.velocity.f)) < frame_time * 5.8f))) { hero_set_state(0xE, 1); } else if (D_0013D4C0[2] != 0 && hero_slot_item_id(3) != 4 && diff --git a/src/overlays/l11/gameplay/hero/hero_set_state.c b/src/overlays/l11/gameplay/hero/hero_set_state.c index 66ab158b9c..6809e806b2 100644 --- a/src/overlays/l11/gameplay/hero/hero_set_state.c +++ b/src/overlays/l11/gameplay/hero/hero_set_state.c @@ -31,7 +31,7 @@ extern float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_0020d658(int back); -extern float FUN_L00_002339d0(float *v); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float vector_length_xy(void *); @@ -66,12 +66,12 @@ extern void FUN_L00_00214ed8(float a, float b, float c); extern void FUN_L00_00216ec0(int, int, int); extern void set_hero_animation(int, int, float) __asm__("FUN_L00_002323b8"); extern void FUN_L00_002325e0(int bank, int seq); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L00_00262500(int a, char *b); extern void FUN_L00_00262528(char *o, int a, int b); extern void FUN_L00_00262840(char *o); -extern void FUN_L00_002a3ec8(int, int, int, float, float, float, float); +extern void pool_splash(int, int, int, float, float, float, float) __asm__("FUN_L00_002a3ec8"); extern void FUN_L01_002405a0(void); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); extern void clear_vector(void *); @@ -291,14 +291,14 @@ int hero_set_state(int a, int b) { if (p->state.prev_control_mode == 0x11) { FUN_L00_00209ca8(3, 0xA, 0); if (D_L11_001612D0 != 0) { - FUN_L00_002a3ec8(D_L11_001612D0, D_L11_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L11_001612D0, D_L11_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.4f, 0.3f); } } else if (p->motion.displacement.f[2] < frame_time * -0.5f) { int n = truncate_float_to_s32(absolute_float(p->motion.displacement.f[2]) * 300.0f); FUN_L00_00209ca8(3, n < 0x28 ? n : 0x28, 1); if (D_L11_001612D0 != 0) { - FUN_L00_002a3ec8(D_L11_001612D0, D_L11_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L11_001612D0, D_L11_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.5f, -0.4f); } p->unk90A = scale_game_frames(0x4B); @@ -625,7 +625,7 @@ int hero_set_state(int a, int b) { char *v = (char *)&p->motion.unk110; p->state.control_mode = 1; p->unk2284 = 0; - p->ground_speed = FUN_L00_002339d0((float *)v); + p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.unk150, v); if (b) { int id = 6; @@ -1022,7 +1022,7 @@ int hero_set_state(int a, int b) { u->unk48C = 1.98f; u->unk430 = 1.95f; } else { - FUN_L00_00233b20((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); + gravity_set_z((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); u->unk41C = 1; u->unk3D0 = scale_game_frames(2); u->unk3D4 = scale_game_frames(0x23) + u->unk3D0; diff --git a/src/overlays/l11/gameplay/vendor/0030e708.c b/src/overlays/l11/gameplay/vendor/0030e708.c index 7ebc674880..9141f7d57f 100644 --- a/src/overlays/l11/gameplay/vendor/0030e708.c +++ b/src/overlays/l11/gameplay/vendor/0030e708.c @@ -24,7 +24,8 @@ extern void FUN_L01_002787a0(void *); extern void FUN_L01_00278e20(void *, int); void mark_moby_for_removal(struct Moby *moby) __asm__("FUN_0020c828"); -void FUN_L11_0031d7d8(struct Moby *m) { +void lamp_update(struct Moby *m) __asm__("FUN_L11_0031d7d8"); +void lamp_update(struct Moby *m) { int hit = 0; char *r = find_moby_hit(m, 0x10000, 0); switch (m->state) { diff --git a/src/overlays/l12/gameplay/entities/0027b8e0.c b/src/overlays/l12/gameplay/entities/0027b8e0.c index 105eafe410..a5c89a90a2 100644 --- a/src/overlays/l12/gameplay/entities/0027b8e0.c +++ b/src/overlays/l12/gameplay/entities/0027b8e0.c @@ -43,7 +43,7 @@ extern void normalize_vector_triplet(void *) __asm__("FUN_00214128"); /* Ported from rac1-decomp (src/overlays/l12_hoven/mobyutil_00272D90.c: func_L12_0027C9B8), where it is exact; names translated to the US level program. */ extern void FUN_L00_00250df8(void *); -extern void func_001FA480(void *, void *) __asm__("FUN_001fa2b8"); +extern void FUN_001fa2b8(void *, void *); extern void func_0020DAF8(void *, int, void *) __asm__("FUN_0020cca8"); extern void func_0020EEE8(void *) __asm__("FUN_0020e098"); @@ -53,7 +53,7 @@ void FUN_L12_0027b9c0(struct Moby *parent, unsigned char *child, int mode) { qcopy(child + 0x10, workspace + 0x30); advance_moby_animation(child); FUN_L00_00250df8(child); - func_001FA480(child + 0xC0, workspace); + FUN_001fa2b8(child + 0xC0, workspace); normalize_vector_triplet(child + 0xC0); func_0020EEE8(child); if (parent->flags & 1) diff --git a/src/overlays/l12/gameplay/entities/003054b0.c b/src/overlays/l12/gameplay/entities/003054b0.c index dc43ec3643..3d08610715 100644 --- a/src/overlays/l12/gameplay/entities/003054b0.c +++ b/src/overlays/l12/gameplay/entities/003054b0.c @@ -64,7 +64,7 @@ extern int D_L12_00161F24 __attribute__((section(".sdata"))); extern int D_L12_00161F34 __attribute__((sda)); extern int D_L12_001FB670[]; extern int D_L12_001FB688[]; -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_001fefc8(void *); extern int FUN_L00_00257b90(int, int); extern int tick_countdown_32_alt(int *) __asm__("FUN_001f9740"); @@ -72,7 +72,7 @@ extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); extern void *FUN_L04_002aee30(void *, void *, void *, int); extern void FUN_L00_0024f7c8(void *, int, void *); -extern void FUN_L00_002628d8(char *, char *, int, float, float); +extern void update_joint_animation(char *, char *, int, float, float) __asm__("FUN_L00_002628d8"); extern void FUN_L00_00269958(void *, void *, int, int, int, int, int, int); extern void FUN_L00_0026ced0(void *, void *, int, int, float, int); extern void FUN_L12_003064e8_c2(char *) __asm__("FUN_L12_003064e8"); @@ -126,7 +126,7 @@ void FUN_L12_003054b0(char *moby) { qcopy_nc(pv1, m + 0x10); v1[2] += 1.5f; md->f60 = fast_arc_tan(vector_distance_xy_alt(v1, v0), v0[2] - v1[2]); - FUN_L00_002628d8(m, (char *)md, 0, D_0015ED64 * 0.008f, D_0015ED64 * 0.3f); + update_joint_animation(m, (char *)md, 0, D_0015ED64 * 0.008f, D_0015ED64 * 0.3f); yaw = fast_subtract_rotations(fast_add_rotations(fast_arc_tan(((Hero *)((char *)&hero))->motion.pos.f[0] - *(float *)(m + 0x10), ((Hero *)((char *)&hero))->motion.pos.f[1] - *(float *)(m + 0x14)), -1.5707964f), @@ -161,20 +161,20 @@ void FUN_L12_003054b0(char *moby) { D_L12_00161F34 = 0; } if ((D_L12_00161F00_gp != 0 || flag) && md->f80 > 0.0f) { - FUN_001f9770(&md->h98); - FUN_001f9770(&md->h9C); + fast_dec_timer_s16(&md->h98); + fast_dec_timer_s16(&md->h9C); if (md->h98 == 0) { if (fast_difference_between_rotations(*(float *)(d + idx * 0x30 + 0x18), yaw) < 0.06981317f) { md->h9E = scale_game_frames(0x14); } - if (FUN_001f9770(&md->h9E) == 0) { + if (fast_dec_timer_s16(&md->h9E) == 0) { if (FUN_L00_001fefc8(&md->b92) == 0) { if (FUN_L00_001fefc8(&md->b93) != 0) { allocate_voice_for_target_entry(0, 0, m); md->b93 = scale_game_frames(9); } } - if (FUN_001f9770(&md->h9C) != 0) { + if (fast_dec_timer_s16(&md->h9C) != 0) { float rz; float pitch; int n; @@ -570,10 +570,10 @@ extern float D_L12_00161F2C __attribute__((sda)); extern float D_L12_00161F30 __attribute__((sda)); #include "rnc/gameplay/state/game_globals.h" extern void FUN_L00_00258278(char *moby, float target, float *vel, float k, float d, float max); -extern void FUN_L00_0025b8c0(float *, float *, float, float, float, float); +extern void vendor_spring(float *, float *, float, float, float, float) __asm__("FUN_L00_0025b8c0"); extern void FUN_L00_00262b00(float, float, char *, float *, float *); extern void FUN_L00_00262b80(void *, char *, char *, float, float, float); -extern void FUN_L00_00298840(int); +extern void start_scene(int) __asm__("FUN_L00_00298840"); extern void FUN_L00_002ea9d8(void *); extern void FUN_L00_002eaa30(void *); extern void FUN_L00_002eac18(int); @@ -596,7 +596,8 @@ extern int D_L12_00161F00_gp __asm__("D_L12_00161F00") __attribute__((section(". extern int allocate_voice_for_target_entry(int, int, void *) __asm__("FUN_0022da68"); extern int D_L12_001B0930; -void FUN_L12_003069d0(char *moby) { +void planetbuster_maximus_part_update(char *moby) __asm__("FUN_L12_003069d0"); +void planetbuster_maximus_part_update(char *moby) { float v[4]; float w[4]; char *d = *(char **)(moby + 0x78); @@ -671,7 +672,7 @@ void FUN_L12_003069d0(char *moby) { *(int *)(d + 0x620) = scale_game_frames(0x5A); } if (!tick_countdown_32_alt((int *)(d + 0x620))) add = 19.0f; - FUN_L00_0025b8c0((float *)(moby + 0x18), (float *)(d + 0x62C), *(float *)(d + 0x618) + add, + vendor_spring((float *)(moby + 0x18), (float *)(d + 0x62C), *(float *)(d + 0x618) + add, D_0015ED64 * 0.03f, D_0015ED64 * 0.3f, D_0015ED6C_gp * 2.7f); } FUN_L00_00262b00(0.7f, D_0015ED6C_gp * 1.2217305f, moby, (float *)(d + 0x5CC), (float *)(d + 0x5C8)); @@ -784,7 +785,7 @@ void FUN_L12_003069d0(char *moby) { } } D_L12_001619B4 = 0; - FUN_L00_00298840(7); + start_scene(7); mark_moby_for_removal_c2(moby); return; } @@ -821,7 +822,7 @@ void FUN_L12_003069d0(char *moby) { extern void FUN_L00_00250df8(unsigned char *); extern float random_float_between(float, float) __asm__("FUN_002132a8"); extern void FUN_L00_0026de90(char *, int, float); -extern short *FUN_002141f8(unsigned char *); +extern short *suck_get_aim_height(unsigned char *) __asm__("FUN_002141f8"); void FUN_L12_003076e0(struct Moby *m) { char *d = (char *)m->pvars; @@ -851,7 +852,7 @@ void FUN_L12_003076e0(struct Moby *m) { for (i = 0; i < 14; i++) { FUN_L00_0026de90(&m->pos, 0, random_float_between(frame_time * 3.0f, frame_time * 5.0f)); } - r = FUN_002141f8(o); + r = suck_get_aim_height(o); if (r != 0) { *(float *)r = r[2]; } @@ -864,15 +865,16 @@ void FUN_L12_003076e0(struct Moby *m) { /* Door/switch moby: clears its linked mobys, waits for the hero, opens, fires its list one by one, closes. */ /* Ported from rac1-decomp (src/overlays/l12_hoven/vendor_002EDAA0.c: func_L12_00308C20), where it is exact; names translated to the US level program. */ -extern float FUN_001f9b80(void *, void *); -extern int FUN_001f9770(void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); void FUN_L12_003076e0(struct Moby *m); extern void FUN_L12_00307ab8(struct Moby *m); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); void mark_moby_for_removal(void *obj) __asm__("FUN_0020c828"); -void FUN_L12_00307840(struct Moby *m) { +void homing_mine_spawner_update(struct Moby *m) __asm__("FUN_L12_00307840"); +void homing_mine_spawner_update(struct Moby *m) { char *d = (char *)m->pvars; int *slots; int i; @@ -893,7 +895,7 @@ void FUN_L12_00307840(struct Moby *m) { break; case 1: if (*(int *)(d + 0xB4) != 2) { - if (FUN_001f9b80(&m->pos, d + 0x70) < *(float *)(d + 0xF8)) { + if (vector_distance(&m->pos, d + 0x70) < *(float *)(d + 0xF8)) { m->state = 2; } } @@ -910,7 +912,7 @@ void FUN_L12_00307840(struct Moby *m) { } break; case 3: - if (FUN_001f9770(d + 0xFC)) { + if (fast_dec_timer_s16(d + 0xFC)) { if (slots[*(int *)(d + 0xF0)] != -1) { FUN_L12_003076e0(m); m->command = m->command == 0; @@ -944,8 +946,8 @@ void FUN_L12_00307840(struct Moby *m) { /* Ported from rac1-decomp (src/overlays/l12_hoven/vendor_002EDAA0.c: func_L12_00308E98), where it is exact; names translated to the US level program. */ extern char D_0013E533[]; -extern int FUN_001f96f8(int); -extern int FUN_001f9770(void *); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_0025fcb8(char *, char *, float); float absolute_float(float input) __asm__("func_001F99C0"); @@ -954,10 +956,10 @@ void FUN_L12_00307ab8(struct Moby *m) { char *pad; if (m->state != 0) { if (*(int *)(d + 0x38) != 0) { - *(short *)(d + 0xFE) = FUN_001f96f8(0xB4); + *(short *)(d + 0xFE) = scale_game_frames(0xB4); } *(int *)(d + 0x38) = 0; - if (FUN_001f9770(d + 0xFE)) { + if (fast_dec_timer_s16(d + 0xFE)) { *(float *)(d + 0xF8) = *(float *)(d + 0xF4); } else { *(float *)(d + 0xF8) = *(float *)(d + 0xF4) + 5.0f; @@ -982,7 +984,7 @@ extern int FUN_L01_00275690(void *, float); extern int FUN_0022da68(int, int, void *); extern void release_voice_slot(int) __asm__("FUN_0022d798"); extern void enqueue_callback_list_1(void *, void *) __asm__("FUN_001f4600"); -extern void FUN_L00_002502a0(int); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); extern void FUN_L12_00308350(struct Moby *); /* Pvars: d[0] is the moby to watch, d[1] the voice slot held for this moby. */ @@ -1021,7 +1023,7 @@ void FUN_L12_003081b0(struct Moby *m) { d[1] = -1; if (((unsigned char *)D_L12_0015FFD8_p)[(d[0] << 8) + 0x20] == 7) { if (m->mission != 0xFF) { - FUN_L00_002502a0(m->mission); + jet_clear_persistent(m->mission); } FUN_0022da68(1, 0, m); m->collision = 0; @@ -1154,7 +1156,7 @@ extern char D_0013D388[]; extern char D_L12_0016CCF0[]; extern int D_L12_0015F5C4; extern int D_L12_0015F5CC; -extern void FUN_L00_00298840(int); +extern void start_scene(int) __asm__("FUN_L00_00298840"); extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); void FUN_L12_003093c8(struct Moby *moby) { @@ -1176,7 +1178,7 @@ void FUN_L12_003093c8(struct Moby *moby) { *(float *)(q + 0x18) = *(float *)(p + 0x258); qcopy(D_L12_0016CCF0 + 0x10, p + 0x10); *(short *)(q + 0x46) = 1; - FUN_L00_00298840(*(int *)(data + 8)); + start_scene(*(int *)(data + 8)); } } } @@ -1190,7 +1192,7 @@ typedef struct { int mobys[1]; } L12VendorMobyList; extern L12VendorMobyList D_L12_0016CCE0; -extern void FUN_L00_002637f8(int); +extern void cutscene_set_camera_target(int) __asm__("FUN_L00_002637f8"); void FUN_L12_003094a0(struct Moby *moby) { int state = moby->state; @@ -1211,7 +1213,7 @@ void FUN_L12_003094a0(struct Moby *moby) { case 1: index = 2; break; default: return; } - FUN_L00_002637f8(D_L12_0016CCE0.mobys[index]); + cutscene_set_camera_target(D_L12_0016CCE0.mobys[index]); break; } } @@ -1333,3 +1335,5 @@ void FUN_L12_0030bff0(M_bff0 *m) { break; } } + +s32 D_L12_001FB6CC[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/l12/gameplay/entities/hoven_turret.c b/src/overlays/l12/gameplay/entities/hoven_turret.c index cd75f85ec6..72792dbb82 100644 --- a/src/overlays/l12/gameplay/entities/hoven_turret.c +++ b/src/overlays/l12/gameplay/entities/hoven_turret.c @@ -51,9 +51,9 @@ extern float D_L12_00161DF4 __attribute__((sda)); extern float D_L12_00161DF8 __attribute__((sda)); extern int D_L12_00161E04; extern int D_L12_00161E08; -extern int FUN_001fa050(); -extern int FUN_001fa378(); -extern int FUN_001fa6e0(int, int, float); +extern int euler_rotation_matrix() __asm__("FUN_001fa050"); +extern int multiply_matrix() __asm__("FUN_001fa378"); +extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern s64 get_effect_texture(s32) __asm__("func_001F44B8"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void draw_geometry_quad(void *, int, int) __asm__("func_001F7D30"); @@ -242,12 +242,12 @@ extern f32 fast_add_rotations_c(f32, f32) __asm__("func_001FA580"); extern f32 fast_sin(f32) __asm__("func_001F9DE0"); extern float D_0015ED6C; extern float D_L12_0015F580[] __attribute__((section(".sdata"))); -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9e90(float, float); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern int D_0013F3D0; /* no foreign declaration */ extern int D_L12_001B0930; /* no foreign declaration */ -extern int FUN_001efa68(); -extern int FUN_001fa728(); +extern int collision_line() __asm__("FUN_001efa68"); +extern int fast_bsphere_check() __asm__("FUN_001fa728"); extern int FUN_L00_00259888(); extern int is_point_inside_clip_volume_c(void *arg0, int arg1) __asm__("func_00214720"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); @@ -356,8 +356,8 @@ void FUN_L12_00302f30(Moby *moby) { /* Ported from rac1-decomp (src/overlays/l12_hoven/vendor_002EDAA0.c: func_L12_003046C8), where it is exact; names translated to the US level program. */ extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9cf8(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void FUN_L00_002ea9d8(void *); extern void FUN_L00_002eaa30(void *); extern void FUN_L08_00313ba8(void *); @@ -367,16 +367,16 @@ void FUN_L12_003032e8(struct Moby *moby) { float m[8]; char *data = (char *)moby->pvars; FUN_L08_00313ba8(moby); - FUN_001f9cf8(m, &D_L12_00161EF0, &moby->rot_row0); - FUN_001f9a10(m, m, &moby->pos); + transform_vector_by_basis(m, &D_L12_00161EF0, &moby->rot_row0); + fast_vec_add(m, m, &moby->pos); FUN_L00_002ea9d8(m); m[4] = 0; m[5] = -*(float *)(data + 0x74); m[6] = fast_add_rotations(1.5707964f, moby->rot.z); FUN_L00_002eaa30(m + 4); } -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9e90(float, float); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern int tick_countdown_32_alt(int *) __asm__("FUN_001f9740"); extern int scale_ticks(int) __asm__("FUN_001f96f8"); @@ -423,8 +423,8 @@ void FUN_L12_00303370(void *moby) { pitch_limit = 0.05235988f; position.f[2] += 1.5f; } - yaw = FUN_001f9e90(position.f[0] - view_303370.position.f[0], position.f[1] - view_303370.position.f[1]); - pitch = FUN_001f9e90(FUN_001f9b80(&view_303370.position, &position), position.f[2] - view_303370.position.f[2]); + yaw = fast_arc_tan(position.f[0] - view_303370.position.f[0], position.f[1] - view_303370.position.f[1]); + pitch = fast_arc_tan(vector_distance(&view_303370.position, &position), position.f[2] - view_303370.position.f[2]); if (fast_difference_between_rotations(yaw, view_303370.yaw) < yaw_limit && fast_difference_between_rotations(pitch, -view_303370.pitch) < pitch_limit) found = 1; @@ -526,7 +526,7 @@ extern int D_L12_00161F00 __attribute__((sda)); extern int D_L12_00161F04 __attribute__((sda)); extern int D_L12_00161F20 __attribute__((section(".sdata"))); extern int D_L12_00161F24 __attribute__((section(".sdata"))); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int FUN_L12_002400d0(int, int); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); @@ -534,13 +534,13 @@ extern void FUN_L00_001fff28(void *, int, float); extern void FUN_L00_00211250(void); extern void FUN_L00_00216f90(void *, void *, int, int); extern void FUN_L00_0024f7c8(void *, int, void *); -extern void FUN_L00_002502a0(int); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, float, int, float, float, int, int, int, int); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_002607d0(int); extern void FUN_L00_00262cf0(void *, void *, float, float, float); -extern void FUN_L00_00298840(int); +extern void start_scene(int) __asm__("FUN_L00_00298840"); extern void FUN_L00_00299460(int); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void FUN_L08_002e7eb0(void *, void *, void *, int); extern void FUN_L12_00303370(void *); extern void FUN_L12_00304218_c() __asm__("FUN_L12_00304218"); @@ -568,7 +568,8 @@ extern int func_0020BFC8_304920(int, int) __asm__("FUN_0020b178"); extern f32 frame_scale_macro __asm__("D_0015ED60") __attribute__((section(".sdata"))); extern f32 frame_time_sq_macro __asm__("D_0015ED70") __attribute__((section(".sdata"))); -void FUN_L12_00303540(struct Moby *moby) { +void hoven_turret_update(struct Moby *moby) __asm__("FUN_L12_00303540"); +void hoven_turret_update(struct Moby *moby) { Data_304920 *data = *(Data_304920 **)&moby->pvars; ((Snd_304920 *)(D_0013E533 + 0x1D))->f6C = moby; @@ -599,10 +600,10 @@ void FUN_L12_00303540(struct Moby *moby) { FUN_L00_0024f7c8(moby, 3, out); } - if (FUN_001f9b80(((float *)&moby->pos), ((Hero *)(D_0013E533 + 0xE1D))->motion.pos.f) < 7.0f + if (vector_distance(((float *)&moby->pos), ((Hero *)(D_0013E533 + 0xE1D))->motion.pos.f) < 7.0f || ((Hero *)(D_0013E533 + 0xE1D))->ground_moby == moby) { moby->pos.z = moby->pos.z + ((data->fA0 - 1.2f) - moby->pos.z) * 0.11f; - data->fA4 = fast_add_rotations_c3(data->fA4, fast_add_rotations_c3(fast_subtract_rotations(FUN_001f9e90(((Hero *)(D_0013E533 + 0xE1D))->motion.pos.f[0] - moby->pos.x, ((Hero *)(D_0013E533 + 0xE1D))->motion.pos.f[1] - moby->pos.y), moby->rot.z), 1.5707964f) * 0.01f) * 0.9f; + data->fA4 = fast_add_rotations_c3(data->fA4, fast_add_rotations_c3(fast_subtract_rotations(fast_arc_tan(((Hero *)(D_0013E533 + 0xE1D))->motion.pos.f[0] - moby->pos.x, ((Hero *)(D_0013E533 + 0xE1D))->motion.pos.f[1] - moby->pos.y), moby->rot.z), 1.5707964f) * 0.01f) * 0.9f; moby->rot.z = fast_add_rotations_c3(moby->rot.z, data->fA4); } else { if (moby->pos.z < data->fA0) { @@ -614,9 +615,9 @@ void FUN_L12_00303540(struct Moby *moby) { allocate_voice_for_target_entry_alt(2, 0, (int)moby); } } - if (FUN_001f9b80(((float *)&moby->pos), ((float *)&((Hero *)(D_0013E533 + 0xE1D))->moby->pos)) < 1.3f) { + if (vector_distance(((float *)&moby->pos), ((float *)&((Hero *)(D_0013E533 + 0xE1D))->moby->pos)) < 1.3f) { if (scale_game_frames_alt(0xF) < ((Hero *)(D_0013E533 + 0xE1D))->grounded_frames) { - FUN_L00_002eaaa0(((float *)&moby->pos), ((float *)&moby->rot), 1, 0, 0); + jet_mount(((float *)&moby->pos), ((float *)&moby->rot), 1, 0, 0); if (moby->prev_seq != 5) { set_moby_animation(moby, 5, 0); } @@ -673,7 +674,7 @@ void FUN_L12_00303540(struct Moby *moby) { moby->pos.z = data->fA0; moby->rot.z = 3.1415927f; } else { - FUN_L00_002502a0(moby->mission); + jet_clear_persistent(moby->mission); FUN_L00_00299460(0xD); FUN_L00_002607d0(0xD); { @@ -733,7 +734,7 @@ void FUN_L12_00303540(struct Moby *moby) { if (moby->anim_flags & 2) { blend_moby_animation_c(moby, 5, 0, 1); } - FUN_001f9770(&data->f70); + fast_dec_timer_s16(&data->f70); if ((D_0013A5E0_e[0] & 0xA0) && data->f70 == 0) { Vec_304920 dir; Vec_304920 muz; @@ -784,7 +785,7 @@ void FUN_L12_00303540(struct Moby *moby) { break; case 7: enqueue_callback_list_1(FUN_L12_00304d98_c, moby); - if (FUN_001f9770(&data->fAE)) { + if (fast_dec_timer_s16(&data->fAE)) { Vec_304920 v; float a; float b; @@ -797,16 +798,16 @@ void FUN_L12_00303540(struct Moby *moby) { qcopy(v, ((Cam_304920 *)D_L12_00167180_304920)->f140); FUN_L00_00262cf0(v, v, a, b, c); t = random_float_between_c(0.5f, 1.3f); - FUN_L00_0025e450(moby, D_L12_0015F580_f, v, 0.0f, 0.0f, 7, 0xF, 0x19, t, t * 0.57f, 10.0f, 3, 0.7f, 0.0f, 0, 0, -1, 0); + spawn_explosion(moby, D_L12_0015F580_f, v, 0.0f, 0.0f, 7, 0xF, 0x19, t, t * 0.57f, 10.0f, 3, 0.7f, 0.0f, 0, 0, -1, 0); data->fAE = scale_game_frames_alt(random_int_between(5, 0xD)); } - if (FUN_001f9770(&data->fAC)) { + if (fast_dec_timer_s16(&data->fAC)) { FUN_L00_00211250(); } break; case 5: if (D_L12_0015F5C4_macro != 2) { - FUN_L00_00298840(1); + start_scene(1); moby->state = 8; } break; @@ -838,7 +839,7 @@ extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); extern f32 fast_add_rotations_c2(f32, f32) __asm__("func_001FA580"); extern f32 fast_cos(f32) __asm__("func_001F9DC8"); extern f32 fast_normalize_angle(f32) __asm__("func_001FA610"); -extern int FUN_001fa6e0(int, int, float); +extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); extern s64 get_effect_texture(s32) __asm__("func_001F44B8"); @@ -930,9 +931,9 @@ void FUN_L12_00304218(Moby *moby) { uv[2] = D_L12_00161E34; uv[3] = D_L12_00161E38; if (data->f8C > 100.0f) { - color = FUN_001fa6e0(0x6000FFFF, 0x6000FF00, (data->f8C - 100.0f) / 100.0f); + color = fast_tween_color(0x6000FFFF, 0x6000FF00, (data->f8C - 100.0f) / 100.0f); } else { - color = FUN_001fa6e0(0x600000FF, 0x6000FFFF, data->f8C / 100.0f); + color = fast_tween_color(0x600000FF, 0x6000FFFF, data->f8C / 100.0f); } filled = truncate_float_to_s32((1.0f - data->f8C / 200.0f) * 32.0f); dim_color = (color & 0xFFFFFF) + 0x20000000; @@ -971,9 +972,9 @@ void FUN_L12_00304218(Moby *moby) { func_L02_0020BF88_3055F8(xy, uv, colors, texture, 1); } if (scale_game_frames_alt(0xF) < data->f88) { - color = FUN_001fa6e0(0x5000FFFF, 0x500000FF, convert_integer_to_float(data->f88 - scale_game_frames_alt(0xF)) / (float)scale_game_frames_alt(0xF)); + color = fast_tween_color(0x5000FFFF, 0x500000FF, convert_integer_to_float(data->f88 - scale_game_frames_alt(0xF)) / (float)scale_game_frames_alt(0xF)); } else { - color = FUN_001fa6e0(0x5000FF00, 0x5000FFFF, convert_integer_to_float(data->f88) / (float)scale_game_frames_alt(0xF)); + color = fast_tween_color(0x5000FF00, 0x5000FFFF, convert_integer_to_float(data->f88) / (float)scale_game_frames_alt(0xF)); } uv[0] = D_L12_00161E4C; uv[1] = D_L12_00161E50; @@ -1061,7 +1062,7 @@ extern int coll_sphere(void *, int, struct Moby *, float) __asm__("FUN_L00_001f0 extern void FUN_L00_0025b8c0_304e00(float *, float *, float, float, float, float) __asm__("FUN_L00_0025b8c0"); extern void spawn_explosion_304e00(struct Moby *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_00257470(struct Moby *, int, int); -extern void FUN_L00_00259fe8(float, struct Moby *); +extern void jet_animate(float, struct Moby *) __asm__("FUN_L00_00259fe8"); extern void mark_moby_for_removal_304e00(struct Moby *) __asm__("FUN_0020c828"); typedef struct { @@ -1181,5 +1182,5 @@ void FUN_L12_00304e00(struct Moby *moby) { mark_moby_for_removal_304e00(moby); return; } - FUN_L00_00259fe8(1.0f, moby); + jet_animate(1.0f, moby); } diff --git a/src/overlays/l12/gameplay/entities/platform.c b/src/overlays/l12/gameplay/entities/platform.c index 41e20d2c91..213449ff8c 100644 --- a/src/overlays/l12/gameplay/entities/platform.c +++ b/src/overlays/l12/gameplay/entities/platform.c @@ -46,7 +46,7 @@ extern int random_integer_below_c(int) __asm__("FUN_00213260"); extern float random_float_between_c(float, float) __asm__("FUN_002132a8"); extern void move_scalar_c(float *, float *, float, float, float, float) __asm__("FUN_00213f38"); extern void move_slot_c(float, float, float, float, void *, int, int) __asm__("FUN_L00_002a3ec8"); -extern int check_moby_c(float, void *) __asm__("FUN_L01_00275690"); +extern int FUN_L01_00275690_c(float, void *) __asm__("FUN_L01_00275690"); extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); extern void register_callback_c(void *, void *) __asm__("FUN_L12_0021be50"); extern void FUN_L12_002bf6d0(struct Moby *); @@ -152,7 +152,7 @@ void FUN_L12_002bf140(struct Moby *moby) { slot = data[3]; if (slot >= 0) { float visible = 0.0f; - if (check_moby_c(64.0f, moby) != -1) visible = 1.0f; + if (FUN_L01_00275690_c(64.0f, moby) != -1) visible = 1.0f; if (data[6] != -1 && is_point_inside_clip_volume(D_L12_00167240, data[6]) == 0) visible = 0.0f; if (visible == 0.0f) { ((L12Slot *)D_L12_001CBF40_c)[data[3]].visibility = 0; @@ -448,13 +448,13 @@ extern f32 vector_length_xyz_c3(void *) __asm__("FUN_001f9af0"); extern float D_0015ED64; extern float D_0015ED6C; extern float D_0015ED70; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("func_001FA688"); extern float probe_ground_height_c2(void *, int, float) __asm__("func_00213508"); extern float D_L12_001618D8 __attribute__((sda)); extern float D_L12_001618DC __attribute__((sda)); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_00259740(void *, void *, int); extern int FUN_L00_002dc9f0(); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); @@ -463,8 +463,8 @@ extern s32 random_integer_below(s32) __asm__("func_00213260"); extern s32 tick_countdown_32_alt_c2(s32 *) __asm__("FUN_001f9740"); extern void FUN_L00_00257470_c(Level12VendorMoby *, int, int) __asm__("FUN_L00_00257470"); extern void FUN_L00_00258278(char *moby, float *vel, float target, float k, float d, float max); -extern void FUN_L00_00259bc8(void *, int, int, void *, void *, float); -extern void FUN_L00_0025c558(void *, void *, float, int, int, int); +extern void spawn_nearby_effect(void *, int, int, void *, void *, float) __asm__("FUN_L00_00259bc8"); +extern void trooper_start_knockback(void *, void *, float, int, int, int) __asm__("FUN_L00_0025c558"); extern void FUN_L00_0025fcb8(char *, float *, float); extern void FUN_L00_002628d8_c(char *, char *, int, float, float) __asm__("FUN_L00_002628d8"); extern void FUN_L12_002e3098_u(struct Moby *) __asm__("FUN_L12_002e3098"); @@ -478,7 +478,7 @@ float absolute_float(float input) __asm__("func_001F99C0"); int FUN_L00_00257b90(int lo, int hi); int FUN_L00_002591d0(char **out, int idx, int a, int b); int FUN_L00_002592b8(char **out, char *target, int a, int b); -int FUN_L00_0025c698(void *moby, void *motion); +int mine_fall(void *moby, void *motion) __asm__("FUN_L00_0025c698"); int FUN_L12_002e2eb8_c(struct Moby *m, float speed) __asm__("FUN_L12_002e2eb8"); s32 is_value_within_interpolated_window(void *anim, f32 value) __asm__("FUN_00214cc8"); void FUN_L00_0025a120(char *o); @@ -494,7 +494,7 @@ extern char *D_L12_001B0C30_2E2EF0[] __asm__("D_L12_001B0930"); extern char D_L12_00167240[]; extern void func_L12_002E4838_2E2EF0(void *) __asm__("FUN_L12_002e3528"); extern void func_L00_00264BB0_2E2EF0(void *,float) __asm__("FUN_L00_00263b38"); -extern int select54(char *,char *,float) __asm__("FUN_L01_00274b78"); +extern int FUN_L01_00274b78_c(char *,char *,float) __asm__("FUN_L01_00274b78"); extern void func_00213DE0_2E2EF0(void *,int,int,int) __asm__("FUN_00212f90"); extern void func_L01_0026E8E0_2E2EF0(char *) __asm__("FUN_L01_0026d930"); extern int func_001F9850_2E2EF0(int) __asm__("FUN_001f96f8"); @@ -550,7 +550,7 @@ void FUN_L12_002e1be0(TrollMoby54_2E2EF0 *moby) { int count, first, blocked, hit; func_L12_002E4838_2E2EF0(moby); func_L00_00264BB0_2E2EF0(data->collision_data,2.2f); - select54((char *)moby,(char *)&work,data->range); + FUN_L01_00274b78_c((char *)moby,(char *)&work,data->range); target=work.moby; if (!target) target=*(TrollMoby54_2E2EF0 **)D_0013E633_2E2EF0; if (moby->pos[2]<26.0f) { func_0020D678_2E2EF0(moby); return; } @@ -857,6 +857,7 @@ extern int truncate_float(float) __asm__("FUN_001fa6d0"); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern char *spawn_particle(void *, void *, void *, int, int, int, int, int, int) __asm__("FUN_00218888"); +void FUN_L12_002e3098(struct Moby *moby); void FUN_L12_002e3098(struct Moby *moby) { float pos[4]; float vel[4]; @@ -975,7 +976,7 @@ extern s32 random_integer_below_e3528(s32) __asm__("FUN_00213260"); extern f32 fast_add_rotations_e3528(f32, f32) __asm__("FUN_001fa580"); extern f32 fast_cos_e3528(f32) __asm__("FUN_001f9dc8"); extern f32 fast_sin_e3528(f32) __asm__("FUN_001f9de0"); -extern s32 count_group_e3528(s32, s32) __asm__("FUN_L01_0026e008"); +extern s32 FUN_L01_0026e008(s32, s32); extern void alert_group_e3528(s32, s32) __asm__("FUN_L01_0026e090"); extern void call_for_help_e3528(struct Moby *, s32, s32, Vec4f *, f32 *, f32) __asm__("FUN_L00_00259bc8"); extern TrollHit_e3528 *find_hit_e3528(struct Moby *, s32, s32) __asm__("FUN_L00_0025a420"); @@ -984,7 +985,7 @@ extern void knockback_e3528(void *, f32 *, f32 *, f32 *) __asm__("FUN_L00_0025ab extern void start_fall_e3528(struct Moby *, void *, s32, s32, s32, f32) __asm__("FUN_L00_0025c558"); extern void anim_reset_e3528(struct Moby *, void *) __asm__("FUN_L00_0025d458"); extern void anim_update_e3528(struct Moby *, void *) __asm__("FUN_L00_0025d538"); -extern void troll_alert_e3528(struct Moby *) __asm__("FUN_L12_002e3098"); +extern void FUN_L12_002e3098(struct Moby *); extern f32 D_L12_001618D0 __attribute__((sda)); extern f32 D_L12_001618D4 __attribute__((sda)); @@ -1013,7 +1014,7 @@ void FUN_L12_002e3528(struct Moby *moby) { if (vars->call_enabled != 0 && moby->state != 9) { s16 n = ++vars->call_timer; if (scale_game_frames_e3528(0x3C) * 15 < n && moby->visible == 0 && moby->group < 0xFF && - count_group_e3528(moby->group, -1) >= 4 && random_integer_below_e3528(0x45) == 0) { + FUN_L01_0026e008(moby->group, -1) >= 4 && random_integer_below_e3528(0x45) == 0) { v.f[0] = fast_cos_e3528(fast_add_rotations_e3528(moby->rot.z, 3.1415927f)); v.f[1] = fast_sin_e3528(fast_add_rotations_e3528(moby->rot.z, 3.1415927f)); v.f[2] = 0.0f; @@ -1060,7 +1061,7 @@ void FUN_L12_002e3528(struct Moby *moby) { vars->stun_timer = scale_game_frames_e3528(0x3C); anim_reset_e3528(moby, vars->anim); } - troll_alert_e3528(moby); + FUN_L12_002e3098(moby); } } moby->hit_slot = 0xFF; @@ -1157,7 +1158,7 @@ void FUN_L12_002e3c08(char *m, float *ang, void *target, int unused, int brake) extern char D_0013E533[]; extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); @@ -1169,7 +1170,7 @@ void FUN_L12_002e3e28(struct Moby *moby, float *out, int on) { float pad[12]; float g; if (on) { - FUN_001f9a28(a, D_0013E533 + 0xE9D, &moby->pos); + fast_vec_sub(a, D_0013E533 + 0xE9D, &moby->pos); clear_u64_value(m); m[2] = -moby->rot.z; euler_rotation_matrix(b, m); @@ -1236,7 +1237,7 @@ extern f32 random_angle_radians_c(void) __asm__("func_00213308"); extern f32 vector_length_xyz_c2(void *) __asm__("FUN_001f9af0"); extern float D_0015ED6C; extern float D_0015ED70; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern int FUN_L01_00277fb8(void *); extern int FUN_L08_002025d0(void *, int, int, void *, int); @@ -1244,7 +1245,7 @@ extern s32 FUN_L01_0026e008(s32, s32); extern s32 tick_countdown_32_alt_c(s32 *) __asm__("FUN_001f9740"); extern void FUN_L00_0025b6b8(void *, void *, void *, float); extern void FUN_L00_0025e450_c(void *, void *, void *, float, float, int, int, int, float, float, float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); -extern void FUN_L00_00260738(char *, void *, void *, void *); +extern void update_entity_matrix(char *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void add_vector_xyz_c3(void *, void *, void *) __asm__("FUN_001f9a10"); extern void clear_u64_value_c2(void *) __asm__("func_001F99F8"); extern void mark_moby_for_removal_c(void *) __asm__("func_0020C828"); @@ -1256,7 +1257,8 @@ void FUN_L12_002e3e28_c(struct Moby *moby, float *out, int on) __asm__("FUN_L12_ extern Path_2E51E8 *D_L12_001B0C30_2E51E8[] __asm__("D_L12_001B0930"); extern void func_L12_002E4F18_2E51E8(void *, void *, void *, int, int) __asm__("FUN_L12_002e3c08"); -void FUN_L12_002e3ed8(Moby *moby) { +void platform_update(Moby *moby) __asm__("FUN_L12_002e3ed8"); +void platform_update(Moby *moby) { float oldPos[4]; float oldRot[4]; float delta[4]; @@ -1446,7 +1448,7 @@ void FUN_L12_002e3ed8(Moby *moby) { data->vel[2] = data->vel[2] - D_0015ED70 * 7.0f; (*(float (*)[4])&moby->rot)[0] = fast_add_rotations_c2(data->fE8, (*(float (*)[4])&moby->rot)[0]); (*(float (*)[4])&moby->rot)[1] = fast_add_rotations_c2(data->fEC, (*(float (*)[4])&moby->rot)[1]); - if (data->walk.path != 0 && FUN_001f9b80((*(float (*)[4])&moby->pos), &data->walk.path->nodes[0]) < 0.5f) { + if (data->walk.path != 0 && vector_distance((*(float (*)[4])&moby->pos), &data->walk.path->nodes[0]) < 0.5f) { moby->state = 0; } if ((*(float (*)[4])&moby->pos)[2] < 0.0f) { @@ -1472,7 +1474,7 @@ void FUN_L12_002e3ed8(Moby *moby) { } } subtract_vector_xyz_c2(delta, (*(float (*)[4])&moby->pos), oldPos); - FUN_L00_00260738(data->f60, delta, oldRot, (*(float (*)[4])&moby->rot)); + update_entity_matrix(data->f60, delta, oldRot, (*(float (*)[4])&moby->rot)); } /* Level overlay code after gameplay/vendor; generated by `decomp overlays stubs`, stubs replaced by C as functions are matched. */ @@ -1533,7 +1535,7 @@ typedef struct { extern char D_0013E533[]; extern char D_0013E633[], D_0014171B[], D_0013D24D[], D_L16_00167240[]; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float FUN_001f9e90_cf(float, float) __asm__("FUN_001fa688"); extern float FUN_001fa688_cf(float, float) __asm__("FUN_001f9e90"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); @@ -1545,13 +1547,13 @@ extern void FUN_L01_002783a8_c(void *, float) __asm__("FUN_L01_002783a8"); extern unsigned char alternate_item_available[] __asm__("D_0013D388"); extern int D_L12_0015F5C4 __asm__("D_L12_0015F5C4"); extern void FUN_0020c828_c(void *) __asm__("FUN_0020c828"); -extern void FUN_L02_0025c758(void *); +extern void initialize_moby_grounding(void *) __asm__("FUN_L02_0025c758"); extern char *func_0020D348_m_x(int) __asm__("FUN_0020c4f8"); extern void FUN_L00_00250df8_x(void *) __asm__("FUN_L00_00250df8"); extern void FUN_L12_0027b9c0_x(void *, void *, int) __asm__("FUN_L12_0027b9c0"); extern void FUN_L00_00263d40_c(int, int) __asm__("FUN_L00_00263d40"); -extern int FUN_L00_00266448(void *, void *); -extern int FUN_L00_002668a0(void *, void *); +extern int update_npc_dialogue(void *, void *) __asm__("FUN_L00_00266448"); +extern int initialize_npc_dialogue(void *, void *) __asm__("FUN_L00_002668a0"); extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); extern int memcard_save_data(int, int) __asm__("FUN_0020b178"); extern int random_float_between_cf(float) __asm__("FUN_001fa6d0"); @@ -1559,10 +1561,10 @@ extern int scale_game_frames(int); extern int tick_countdown_32(int *); extern unsigned char D_0015EDB0_b __asm__("D_0015EDB0"); extern void FUN_L00_00216f90(void *, void *, int, int); -extern void FUN_L00_002502a0(int); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); extern void FUN_L00_00260860(int, int); -extern void FUN_L00_002628d8(float, float, void *, void *, int); -extern void FUN_L00_00284e50(void *, void *); +extern void update_joint_animation(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern void FUN_L12_002e6b60(char *); extern void add_vector_xyz(void *, void *, void *); extern void build_spherical_offset(void *, float, float, float) __asm__("FUN_00214db0"); @@ -1570,7 +1572,8 @@ extern void subtract_vector_xyz(void *, void *, void *); extern L16WatchPlayer D_0013E633_watch __asm__("D_0013E533"); extern char *D_L12_001600EC; -void FUN_L12_002e6c48(L16WatchMoby *m) { +void miner_update(L16WatchMoby *m) __asm__("FUN_L12_002e6c48"); +void miner_update(L16WatchMoby *m) { L16WatchScratch scratch; L16WatchData *d = m->data; float rate; @@ -1584,11 +1587,11 @@ void FUN_L12_002e6c48(L16WatchMoby *m) { return; } m->state = 1; - FUN_L00_002668a0(m, &d->activation); - FUN_L02_0025c758(m); + initialize_npc_dialogue(m, &d->activation); + initialize_moby_grounding(m); break; case 1: - if (alternate_item_available[1] == 0 && FUN_L00_00266448(m, &d->activation)) { + if (alternate_item_available[1] == 0 && update_npc_dialogue(m, &d->activation)) { FUN_L01_002783a8_c(m, 2.5f); *(int *)((char *)m + 0x58) = 0; m->state = 2; @@ -1600,10 +1603,10 @@ void FUN_L12_002e6c48(L16WatchMoby *m) { alternate_item_available[1] = 1; FUN_L00_00263d40_c(0x2EE7, scale_game_frames(300)); alternate_item_available[0x61] = 1; - FUN_L00_002502a0(m->widget); + jet_clear_persistent(m->widget); if (d->region != -1) { char *p = D_L12_001600EC + (d->region << 7); - FUN_L00_00284e50(p + 0x30, p + 0x70); + jet_reset_camera(p + 0x30, p + 0x70); } memcard_save_data(0, -1); m->state = 1; @@ -1615,7 +1618,7 @@ void FUN_L12_002e6c48(L16WatchMoby *m) { if (m->animation == 0) { char *player = (char *)&D_0013E633_watch + 0xE9D; tracking = 1; - if (FUN_001f9b80(m->position, player) < 8.0f && + if (vector_distance(m->position, player) < 8.0f && FUN_001f9e90_cf( m->yaw, FUN_001fa688_cf(((L16WatchPlayer *)((char *)&D_0013E633_watch + 0xE1D))->aim[0] - @@ -1670,8 +1673,8 @@ void FUN_L12_002e6c48(L16WatchMoby *m) { } if (D_0015EDB0_b) d->height = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 1); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, (char *)d + 0xE0, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 1); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, (char *)d + 0xE0, 0); if (*(int *)((char *)d + 0x180) == 0) { char *o = func_0020D348_m_x(0x11F); *(char **)((char *)d + 0x180) = o; @@ -1759,7 +1762,8 @@ extern void FUN_L04_002aee30(void *, void *, void *, int); /* Ogre update: initialization, path following, aiming, attack and removal. The retail unsigned group sentinel is 0xff; unordered angle comparisons keep the original branch outcomes. Quad copies include the fourth word. */ -void FUN_L12_002e72c0(struct Moby *moby) { +void blarg_trooper_update(struct Moby *moby) __asm__("FUN_L12_002e72c0"); +void blarg_trooper_update(struct Moby *moby) { TargetReport54_2E2EF0 work; Vec4 v; Vec4 delta; @@ -1773,7 +1777,7 @@ void FUN_L12_002e72c0(struct Moby *moby) { if (OGRE_CHILD) OGRE_CHILD->flags &= 0xffbe; } if (OGRE_B(0x269) && hero.state.current == 0 && hero.state.prev == 0x67) { - if (FUN_001f9b80(&moby->pos, &hero.motion.pos) < 30.0f) goto leave; + if (vector_distance(&moby->pos, &hero.motion.pos) < 30.0f) goto leave; } if (OGRE_I(0x270) != -1) { if (!is_point_inside_clip_volume(D_L12_00167240, OGRE_I(0x270))) { @@ -1787,7 +1791,7 @@ void FUN_L12_002e72c0(struct Moby *moby) { } if (OGRE_B(0x2e) == 2) goto leave; FUN_L12_002e81e0(moby); - select54((char *)moby, (char *)&work, OGRE_F(0x230)); + FUN_L01_00274b78_c((char *)moby, (char *)&work, OGRE_F(0x230)); target = (struct Moby *)work.moby; if (!target) { target = hero.moby; @@ -1875,11 +1879,11 @@ void FUN_L12_002e72c0(struct Moby *moby) { if (moby->prev_seq != 8 && moby->seq == moby->prev_seq) blend_moby_animation_ex(moby, 8, 0, scale_game_frames_e81e0(11), 5); path = (int *)D_L12_001B0930_w[OGRE_I(0x254)]; - if (FUN_001f9b80(&moby->pos, path + (OGRE_I(0x260) * 4 + 4)) < 3.0f) ++OGRE_I(0x260); + if (vector_distance(&moby->pos, path + (OGRE_I(0x260) * 4 + 4)) < 3.0f) ++OGRE_I(0x260); if (*path - 1 < OGRE_I(0x260)) OGRE_I(0x260) = *path - 1; FUN_L12_002e8808(moby, (float *)(path + (OGRE_I(0x260) * 4 + 4)), 0.0f, D_0015ED6C * 8.0f); if (OGRE_I(0x260) == *path - 1) goto state3; - else if (FUN_001f9b80(&moby->pos, &target->pos) < OGRE_F(0x264)) moby->state = 3; + else if (vector_distance(&moby->pos, &target->pos) < OGRE_F(0x264)) moby->state = 3; break; } case 3: { @@ -1910,7 +1914,7 @@ void FUN_L12_002e72c0(struct Moby *moby) { OGRE_F(0x188) = angle * 0.5f; OGRE_F(0x208) = angle * 0.5f; FUN_L12_002e8808(moby, (float *)&target->pos, OGRE_F(0x244), 0.0f); - if (FUN_001f9b80(&moby->pos, &target->pos) < 5.5f || OGRE_B(0x242)) { + if (vector_distance(&moby->pos, &target->pos) < 5.5f || OGRE_B(0x242)) { angle = fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y); if (angle_difference_8808(moby->rot.z, angle) < 0.08726646f) goto state5; } @@ -1962,7 +1966,7 @@ void FUN_L12_002e72c0(struct Moby *moby) { if ((moby->prev_seq != 5 || (moby->anim_flags & 2)) && moby->prev_seq != 0 && moby->seq == moby->prev_seq) blend_moby_animation_ex(moby, 0, 0, scale_game_frames_e81e0(8), 5); if (!random_integer_below_e81e0(9)) goto state5; - if (FUN_001f9b80(&moby->pos, &target->pos) > 10.5f && !OGRE_B(0x242)) goto state3; + if (vector_distance(&moby->pos, &target->pos) > 10.5f && !OGRE_B(0x242)) goto state3; angle = fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y); if (angle_difference_8808(moby->rot.z, angle) > 0.4886922f) moby->state = 3; break; @@ -1975,14 +1979,14 @@ void FUN_L12_002e72c0(struct Moby *moby) { else if (angle < -0.7853982f) angle = -0.7853982f; OGRE_F(0x188) = angle * 0.7f; OGRE_F(0x208) = angle * 0.4f; - if (FUN_001f9b80(&moby->pos, data + 0x220) < 1.0f) moby->state = 2; + if (vector_distance(&moby->pos, data + 0x220) < 1.0f) moby->state = 2; break; } case 4: { float angle; moby->flags &= 0xffbe; - if (FUN_L00_0025c698(moby, data + 0x70) & 0x60) { - if (FUN_001f9b80(&moby->pos, &target->pos) < 6.0f || OGRE_B(0x242)) { + if (mine_fall(moby, data + 0x70) & 0x60) { + if (vector_distance(&moby->pos, &target->pos) < 6.0f || OGRE_B(0x242)) { angle = fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y); if (angle_difference_8808(moby->rot.z, angle) < 0.12217305f) { state5: @@ -1998,7 +2002,7 @@ void FUN_L12_002e72c0(struct Moby *moby) { goto leave; } case 9: { - if (FUN_L00_0025c698(moby, data + 0x70) & 0x60) { + if (mine_fall(moby, data + 0x70) & 0x60) { FUN_L00_00257470(moby, 0, -1); FUN_L12_002e7290(moby, &moby->pos); goto leave; @@ -2019,8 +2023,8 @@ void FUN_L12_002e72c0(struct Moby *moby) { OGRE_F(0x188) = -OGRE_F(0x188); OGRE_F(0x208) = -OGRE_F(0x208); } - FUN_L00_002628d8(D_0015ED64 * 0.018f, D_0015ED64 * 0.3f, moby, data + 0x120, 5); - FUN_L00_002628d8(D_0015ED64 * 0.024f, D_0015ED64 * 0.3f, moby, data + 0x1a0, 6); + update_joint_animation(D_0015ED64 * 0.018f, D_0015ED64 * 0.3f, moby, data + 0x120, 5); + update_joint_animation(D_0015ED64 * 0.024f, D_0015ED64 * 0.3f, moby, data + 0x1a0, 6); } return; } @@ -2095,7 +2099,7 @@ extern void knockback_e81e0(void *, f32 *, f32 *, f32 *) __asm__("FUN_L00_0025ab extern void start_fall_e81e0(struct Moby *, void *, s32, s32, s32, f32) __asm__("FUN_L00_0025c558"); extern void anim_reset_e81e0(struct Moby *, void *) __asm__("FUN_L00_0025d458"); extern void anim_update_e81e0(struct Moby *, void *) __asm__("FUN_L00_0025d538"); -extern void ogre_leave_e81e0(struct Moby *) __asm__("FUN_L12_002e86d0"); +extern void FUN_L12_002e86d0(struct Moby *); /* Damage and alert step of the l12 ogre (cf. FUN_L12_002e3528): refreshes its speed while alerted, calls for help behind itself once its groups have 9 or @@ -2138,7 +2142,7 @@ void FUN_L12_002e81e0(struct Moby *moby) { } } if (vars->volume != -1 && is_point_inside_clip_volume_e81e0(&hero.motion.pos, vars->volume)) { - ogre_leave_e81e0(moby); + FUN_L12_002e86d0(moby); return; } coll = find_hit_e81e0(moby, 0x330000, 0); @@ -2187,13 +2191,13 @@ void FUN_L12_002e81e0(struct Moby *moby) { } /* Ported from rac1-decomp (src/overlays/l12_hoven/vendor_002C0310.c: func_L12_002E9988), where it is exact; names translated to the US level program. */ -extern float FUN_001fa5c8(float, float); +extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); void FUN_L12_002e8608(struct Moby *moby, float *pos) { char *data = (char *)moby->pvars; float a = fast_arc_tan(pos[0] - moby->pos.x, pos[1] - moby->pos.y); - float d = FUN_001fa5c8(a, moby->rot.z); + float d = fast_subtract_rotations(a, moby->rot.z); if (d > 1.2217305f) { d = 1.2217305f; } else if (d < -1.2217305f) { @@ -2215,6 +2219,7 @@ typedef struct { extern void FUN_L00_00257470(struct Moby *, int, int); +void FUN_L12_002e86d0(struct Moby *moby); void FUN_L12_002e86d0(struct Moby *moby) { moby->unkB4 = 0; FUN_L00_00257470(moby, 0, -1); @@ -2265,7 +2270,7 @@ extern float distance_8808(void *, void *) __asm__("FUN_001f9b80"); extern float moved_distance_8808(void *, void *) __asm__("FUN_001f9b48"); extern void turn_8808(void *, void *, float, float, float, float) __asm__("FUN_L00_0025be00"); extern void approach_8808(void *, float, float) __asm__("FUN_00213ed8"); -extern void steer_8808(void *, void *) __asm__("FUN_L12_00271dd8"); +extern void FUN_L12_00271dd8(void *, void *); extern void subtract_8808(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); @@ -2313,7 +2318,7 @@ void FUN_L12_002e8808(struct Moby *moby, float *target, float max_angle, float a } } *(OvlQuad *)old = *(OvlQuad *)&moby->pos; - steer_8808(moby, data + 0xd0); + FUN_L12_00271dd8(moby, data + 0xd0); if (*(int *)(data + 0x26c) != -1) { subtract_8808(delta, old, &moby->pos); fast_vec_normalize(delta, delta, 0.05f); @@ -2350,7 +2355,7 @@ extern void help_request(int, int) __asm__("FUN_L00_00203908"); extern void advance_moby_animation(void *) __asm__("FUN_0020d580"); extern void FUN_L00_00269958(void *, void *, int, int, int, int, int, int); extern char *FUN_L12_002ecce8(void *, void *, int, int, float, float, float); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, float, int, float, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern unsigned char D_001413F4 __attribute__((section(".data"))); extern int D_L12_00161F00 __attribute__((section(".sdata"))); extern int D_L12_00161F20 __attribute__((section(".sdata"))); @@ -2364,7 +2369,8 @@ extern unsigned char D_0013D4CB __attribute__((section(".data"))); extern unsigned short D_00141C50 __attribute__((section(".data"))); extern int D_L12_0015F580_gp __asm__("D_L12_0015F580") __attribute__((section(".sdata"))); -void FUN_L12_002e9f68(struct Moby *moby) { +void blarg_helicopter_update(struct Moby *moby) __asm__("FUN_L12_002e9f68"); +void blarg_helicopter_update(struct Moby *moby) { char *data = (char *)moby->pvars; struct Moby *child; float target[20] __attribute__((aligned(16))); @@ -2512,7 +2518,7 @@ void FUN_L12_002e9f68(struct Moby *moby) { int count, limit, a, b, color, life, size; float distance, angle, value, spread; if (current_level_index == 12 && !D_0013D4CB && !D_00141C50) help_request(0x2ee2, 0x5d); - distance = FUN_001f9b80(&moby->pos, &hero.motion.pos); + distance = vector_distance(&moby->pos, &hero.motion.pos); if (*(int *)(data + 0xc0) == 0) { if (distance < 21.0f && moby->pos.z - hero.motion.pos.f[2] > 1.0f) { if (D_L12_00167100.moby == 0) { @@ -2520,16 +2526,16 @@ void FUN_L12_002e9f68(struct Moby *moby) { } } else if (D_L12_00167100.moby == moby) D_L12_00167100.moby = 0; } - distance = FUN_001f9b80(&moby->pos, target); + distance = vector_distance(&moby->pos, target); if ((distance < 40.0f && moby->pos.z - target[2] > -2.0f) || *(int *)(data + 0xc0)) { angle = fast_arc_tan(target[0] - moby->pos.x, target[1] - moby->pos.y); moby->rot.z = spring_turn((float *)(data + 0x88), moby->rot.z, angle, 0.004f, 0.3f, frame_time * 0.7853982f); - value = FUN_001f9b80(target, &moby->pos); + value = vector_distance(target, &moby->pos); angle = fast_arc_tan(value, moby->pos.z - target[2]); moby->rot.y = spring_turn((float *)(data + 0x9c), moby->rot.y, angle, 0.004f, 0.3f, frame_time * 0.7853982f); clear_u64_value(data + 0x70); FUN_L12_002eae00(moby); - if (FUN_001f9770(data + 0x8c)) { + if (fast_dec_timer_s16(data + 0x8c)) { ++*(short *)(data + 0xbc); moby_point_position(moby, *(int *)(data + 0xb8), &position); *(int *)(data + 0xb8) = *(int *)(data + 0xb8) == 0; @@ -2596,7 +2602,7 @@ void FUN_L12_002e9f68(struct Moby *moby) { FUN_L12_002eae00(moby); break; case 5: - if (FUN_001f9770(data + 0x8e)) { + if (fast_dec_timer_s16(data + 0x8e)) { moby->state = moby->command; } else { value = *(float *)(data + 0x94) - frame_time_sq * 4.0f; @@ -2617,7 +2623,7 @@ void FUN_L12_002e9f68(struct Moby *moby) { FUN_L12_00308708(moby, *(struct Moby **)(data + 0xac)); *(struct Moby **)(data + 0xac) = 0; } - FUN_L00_0025e450(moby, ((char *)&D_L12_0015F580_gp), &moby->pos, 0.0f, 0.0f, 20, 3, 4, 4.0f, 2.0f, 100000.0f, 2, 3.0f, 15.0f, 1, 1, -1, 0); + spawn_explosion(moby, ((char *)&D_L12_0015F580_gp), &moby->pos, 0.0f, 0.0f, 20, 3, 4, 4.0f, 2.0f, 100000.0f, 2, 3.0f, 15.0f, 1, 1, -1, 0); if (*(int *)(data + 0xc0) == 0) FUN_L00_00257470(moby, 0, -1); index = *(int *)(data + 0xb0); if (index != -1 && (void *)((VoicePoolWindow *)(D_0013E550 + index * 0x70))->voice.owner == (void *)moby && ((VoicePoolWindow *)(D_0013E550 + index * 0x70))->voice.state) release_voice(index); @@ -2660,16 +2666,16 @@ void FUN_L12_002e9f68(struct Moby *moby) { /* Springs the moby's two rotation angles toward a heading taken from its data's direction vector. */ /* Ported from rac1-decomp (src/overlays/l12_hoven/vendor_002C0310.c: func_L12_002EC180), where it is exact; names translated to the US level program. */ -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float spring_turn(float *vel, float cur, float target, float k, float d, float max) __asm__("FUN_L00_00258110"); void FUN_L12_002eae00(struct Moby *moby) { char *data = (char *)moby->pvars; - float ang = FUN_001fa5c8(fast_arc_tan(*(float *)(data + 0x70), *(float *)(data + 0x74)), + float ang = fast_subtract_rotations(fast_arc_tan(*(float *)(data + 0x70), *(float *)(data + 0x74)), moby->rot.z); - float a = *(float *)(data + 0x94) * 0.2268928f * FUN_001f9dc8(ang) / (frame_time * 10.0f); - float b = *(float *)(data + 0x94) * -0.2268928f * FUN_001f9de0(ang) / (frame_time * 10.0f); + float a = *(float *)(data + 0x94) * 0.2268928f * fast_cos(ang) / (frame_time * 10.0f); + float b = *(float *)(data + 0x94) * -0.2268928f * fast_sin(ang) / (frame_time * 10.0f); float r0, k0, d0, m0, k1, d1, m1; k0 = frame_time_sq * 0.5235988f; d0 = frame_time_sq * 1.0471976f; @@ -2739,8 +2745,8 @@ extern f32 fast_subtract_rotations(f32, f32) __asm__("func_001FA5C8"); extern int hit_reaction(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_L00_0025a478"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern void allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); float absolute_float(float input) __asm__("func_001F99C0"); void FUN_L12_002eb220(struct Moby *m) { @@ -2767,7 +2773,7 @@ void FUN_L12_002eb220(struct Moby *m) { m->state = 6; } else if (res != 0xB) { *(unsigned char *)(d + 0x67) = 0xB4; - FUN_L00_0025d458(m, (short *)(d + 0x60)); + trooper_anim_update(m, (short *)(d + 0x60)); if (*(float *)(r + 0x1C) == 5627.925f && m->state != 5) { a = fast_arc_tan(m->pos.x - *(float *)(r + 0), m->pos.y - *(float *)(r + 4)); @@ -2791,9 +2797,9 @@ void FUN_L12_002eb220(struct Moby *m) { } } m->hit_slot = 0xFF; - FUN_L00_0025d538(m, d + 0x60); + trooper_anim_finish(m, d + 0x60); } -/* Data of the second watcher (FUN_L12_002eb570): the L16 watcher layout with +/* Data of the second watcher (edwina_update): the L16 watcher layout with * the turret and base mobys it spawns at 0x164/0x168. */ typedef struct { char pad00[0x20]; @@ -2831,7 +2837,8 @@ extern void FUN_L03_002db480_b570(void *) __asm__("FUN_L03_002db480"); extern void blend_moby_animation_b570(void *, int, int, int) __asm__("FUN_00212f90"); extern void FUN_L00_00260860_b570(int, int) __asm__("FUN_L00_00260860"); -void FUN_L12_002eb570(L16WatchMoby *m) { +void edwina_update(L16WatchMoby *m) __asm__("FUN_L12_002eb570"); +void edwina_update(L16WatchMoby *m) { L16WatchScratch scratch; L12WatchData *d = (L12WatchData *)m->data; float rate; @@ -2847,14 +2854,14 @@ void FUN_L12_002eb570(L16WatchMoby *m) { switch (m->state) { case 0: m->state = 1; - FUN_L00_002668a0(m, &d->activation); + initialize_npc_dialogue(m, &d->activation); d->activation.radius = 1.7f; - FUN_L02_0025c758(m); + initialize_moby_grounding(m); if (alternate_item_available[0x13C]) *(short *)((char *)d + 0x56) = -1; break; case 1: - if (alternate_item_available[0x13C] == 0 && FUN_L00_00266448(m, &d->activation)) { + if (alternate_item_available[0x13C] == 0 && update_npc_dialogue(m, &d->activation)) { FUN_L01_002783a8_c(m, 2.52f); *(int *)((char *)m + 0x58) = 0; m->state = 2; @@ -2863,10 +2870,10 @@ void FUN_L12_002eb570(L16WatchMoby *m) { case 2: if (D_L12_0015F5C4 != 2) { *(float *)((char *)m + 0x58) = 1.0f; - FUN_L00_002502a0(m->widget); + jet_clear_persistent(m->widget); if (d->region != -1) { char *p = D_L12_001600EC + (d->region << 7); - FUN_L00_00284e50(p + 0x30, p + 0x70); + jet_reset_camera(p + 0x30, p + 0x70); } m->state = 1; if (*(short *)((char *)d + 0x24) == 2) { @@ -2874,7 +2881,7 @@ void FUN_L12_002eb570(L16WatchMoby *m) { FUN_L00_00263d40_c(0x2EE6, -1); if (d->region != -1) { char *p = D_L12_001600EC + (d->region << 7); - FUN_L00_00284e50(p + 0x30, p + 0x70); + jet_reset_camera(p + 0x30, p + 0x70); } memcard_save_data(0, -1); } @@ -2886,7 +2893,7 @@ void FUN_L12_002eb570(L16WatchMoby *m) { if (m->animation == 0) { char *player = (char *)&D_0013E633_watch + 0xE9D; tracking = 1; - if (FUN_001f9b80(m->position, player) < 8.0f && + if (vector_distance(m->position, player) < 8.0f && FUN_001f9e90_cf( m->yaw, FUN_001fa688_cf(((L16WatchPlayer *)((char *)&D_0013E633_watch + 0xE1D))->aim[0] - @@ -2997,16 +3004,16 @@ void FUN_L12_002eb570(L16WatchMoby *m) { } if (D_0015EDB0_b) d->height = 2.75f; - FUN_L00_002628d8(rate * D_0015ED64_b570, head_rate * D_0015ED64_b570, m, d->body, 1); - FUN_L00_002628d8(rate * D_0015ED64_b570, head_rate * D_0015ED64_b570, m, d->head, 0); + update_joint_animation(rate * D_0015ED64_b570, head_rate * D_0015ED64_b570, m, d->body, 1); + update_joint_animation(rate * D_0015ED64_b570, head_rate * D_0015ED64_b570, m, d->head, 0); } /* Hit handler: counts hits toward a help message, bursts debris and blinks the moby until its timer runs out. */ extern char D_0013D408[]; extern int tick_countdown_32_alt(int *arg0) __asm__("FUN_001f9740"); extern int D_0015EE04 __attribute__((sda)); extern s32 D_L12_001619B4 __attribute__((sda)); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, int, float, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_00260a88(void *, int, int, int, int); extern void FUN_L00_00263d40(int, int); extern void clear_vector(void *) __asm__("func_001F99F8"); @@ -3033,7 +3040,7 @@ void FUN_L12_002ebca8(struct Moby *m, int flag) { clear_vector(b); FUN_L00_00260a88(m, 0x1F, 0x4A, 2, -1); *(int *)(d + 0xA4) = scale_game_frames(500); - FUN_L00_0025e450(m, b, a, 0.0f, 0.0f, 0x14, 3, 4, 4.0f, 2.0f, 100000.0f, -1, 3.0f, 15.0f, 1, + spawn_explosion(m, b, a, 0.0f, 0.0f, 0x14, 3, 4, 4.0f, 2.0f, 100000.0f, -1, 3.0f, 15.0f, 1, 1, -1, 0); } m->hit_slot = 0xFF; @@ -3071,7 +3078,8 @@ extern int func_L01_00276680_i(char *vec, float scale) __asm__("FUN_L01_00275690 extern float D_L12_001619A8 __attribute__((sda)); extern float D_L12_001619AC __attribute__((sda)); extern float D_L12_001619B0 __attribute__((sda)); -void FUN_L12_002ebea8(char *m) { +void helicopter_update(char *m) __asm__("FUN_L12_002ebea8"); +void helicopter_update(char *m) { char *d = *(char **)(m + 0x78); float A[4]; float B[4]; @@ -3151,14 +3159,15 @@ void FUN_L12_002ebea8(char *m) { /* Idle critter: waits a random time, then plays one of its fidget animations (or reacts when the hero comes close). */ /* Ported from rac1-decomp (src/overlays/l12_hoven/vendor_002C0310.c: func_L12_002ED550), where it is exact; names translated to the US level program. */ -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern int FUN_L00_001fefc8(void *); extern s32 random_integer_below(s32) __asm__("func_00213260"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern void blend_moby_animation(void *, s32, s32, s32) __asm__("FUN_00212f90"); -void FUN_L12_002ec1d0(unsigned char *m) { - float dist = FUN_001f9b80(m + 0x10, &hero.motion.pos); +void crane_arm_update(unsigned char *m) __asm__("FUN_L12_002ec1d0"); +void crane_arm_update(unsigned char *m) { + float dist = vector_distance(m + 0x10, &hero.motion.pos); switch (m[0x20]) { case 0: if (m[0x53] != 0) diff --git a/src/overlays/l12/gameplay/entities/water_reservoir.c b/src/overlays/l12/gameplay/entities/water_reservoir.c index 114ab834a7..1083a96032 100644 --- a/src/overlays/l12/gameplay/entities/water_reservoir.c +++ b/src/overlays/l12/gameplay/entities/water_reservoir.c @@ -41,7 +41,8 @@ extern float D_L12_00161A00 __attribute__((sda)); extern float D_L12_00161A04 __attribute__((sda)); extern float D_L12_00161A08 __attribute__((sda)); -void FUN_L12_002ec720(struct Moby *moby) { +void water_reservoir_update(struct Moby *moby) __asm__("FUN_L12_002ec720"); +void water_reservoir_update(struct Moby *moby) { float *data = (float *)moby->pvars; float pos[4], offset0[4], offset1[4], diff0[4], diff1[4]; float fraction, frame_scale; @@ -257,13 +258,14 @@ extern int coll_sphere_ece00(void *, float, int, struct Moby *) __asm__("FUN_L00 extern void make_hit_ece00(void *, struct Moby *, int, float, void *) __asm__("FUN_L00_00259888"); extern float fast_cos_ece00(float) __asm__("FUN_001f9dc8"); extern float fast_sin_ece00(float) __asm__("FUN_001f9de0"); -extern void apply_hit_ece00(int, void *) __asm__("FUN_L00_00259a88"); -extern void FUN_L00_0025e450(struct Moby *, void *, void *, float, float, int, int, int, float, float, float, float, - int, float, int, int, int, int); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void FUN_L00_00259a88(int, void *); +extern void spawn_explosion(struct Moby *, void *, void *, float, float, int, int, int, float, float, float, float, + int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); /* Level 12 shot: flies with a smoke trail, damages the first moby it hits other than its owner, then pops. */ -void FUN_L12_002ece00(struct Moby *moby) { +void rocket_update(struct Moby *moby) __asm__("FUN_L12_002ece00"); +void rocket_update(struct Moby *moby) { ShotVars_ece00 *vars = (ShotVars_ece00 *)moby->pvars; float old_pos[4]; float side[4]; @@ -313,7 +315,7 @@ void FUN_L12_002ece00(struct Moby *moby) { hit.unk18 = 1; hit.unk19 = 1; hit.oclass = moby->oclass; - apply_hit_ece00(D_L12_001742C0_ece00.moby, &hit); + FUN_L00_00259a88(D_L12_001742C0_ece00.moby, &hit); } moby->state = 2; } @@ -328,12 +330,12 @@ void FUN_L12_002ece00(struct Moby *moby) { add_vector_ece00(&moby->pos, &moby->pos, old_pos); if (current_level_index == 12 && camera_secondary_mode_ece00 == 50) { char *camera = D_L12_00167240 - 0x140; - FUN_L00_0025e450(moby, &D_L12_0015F580, 0, 0.0f, 0.0f, 3, 3, 5, 0.3f, 0.2f, 0.0f, 0.15f, -1, 0.0f, 0, 0, + spawn_explosion(moby, &D_L12_0015F580, 0, 0.0f, 0.0f, 3, 3, 5, 0.3f, 0.2f, 0.0f, 0.15f, -1, 0.0f, 0, 0, -1, 0); *(float *)(camera + 0x160) = 0.025f; *(int *)(camera + 0x168) = scale_game_frames(20); } else { - FUN_L00_0025f090(moby, &moby->pos, 0, 0.25f, 13.0f); + cart_burst(moby, &moby->pos, 0, 0.25f, 13.0f); } mark_moby_for_removal_ece00(moby); break; diff --git a/src/overlays/l12/gameplay/hero/0022de30.c b/src/overlays/l12/gameplay/hero/0022de30.c index 854e72fe59..94eeb919d4 100644 --- a/src/overlays/l12/gameplay/hero/0022de30.c +++ b/src/overlays/l12/gameplay/hero/0022de30.c @@ -158,7 +158,7 @@ s32 coll_sound_class(void) __asm__("FUN_L00_001f3608"); s32 collision_hit_material(void) __asm__("FUN_001f0b58"); f32 resolve_camera_surface_height(void *, void *) __asm__("FUN_002135f0"); s32 FUN_L00_0025e3b8(s32); -u8 *FUN_002141f8(s32); +u8 *suck_get_aim_height(s32) __asm__("FUN_002141f8"); f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); void sceVu0Normalize(void *, void *) __asm__("FUN_00125180"); f32 FUN_L00_00233d30(void *); @@ -242,7 +242,7 @@ void FUN_L12_00233e80(void) { if (FUN_L00_0025e3b8(HH.moby)) { hero.unk30A = 1; } - p = FUN_002141f8(HH.moby); + p = suck_get_aim_height(HH.moby); if (p != 0 && (*(u16 *)(p + 0x1E) & 8)) { hero.unk30A = 1; } @@ -481,7 +481,7 @@ extern void FUN_L00_00217118(f32, f32); extern void stick_target(f32, s32) __asm__("FUN_L00_002118c8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void turn_to(s32, f32, f32, f32) __asm__("FUN_L00_00211e30"); -extern s32 FUN_001f9740(void *); +extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 FUN_L00_00229a98(void); extern void FUN_L00_00211e98(void); @@ -521,10 +521,10 @@ extern u8 D_L12_0017C440[]; extern void FUN_L00_00216e48(s32, struct MobyView *, s32); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); -extern s32 FUN_001f9770(s16 *); +extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); extern void FUN_L00_00209a40(s32, s32); extern void FUN_L00_00209ca8(s32, s32, s32); -extern void FUN_L00_002a3ec8(s32, s32, s32, f32, f32, f32, f32); +extern void pool_splash(s32, s32, s32, f32, f32, f32, f32) __asm__("FUN_L00_002a3ec8"); extern f32 FUN_L00_0025bc98(f32 *, f32, f32 *, s32, f32, f32, f32); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); @@ -538,7 +538,7 @@ extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 FUN_L00_00209018(void *, s32); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern void FUN_L00_0020a1e0(f32, f32); @@ -562,22 +562,22 @@ extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern s32 FUN_L00_002595a0(f32 *, f32 *, f32, f32, f32); extern void FUN_L00_0025bc00(f32 *, s32, f32, f32); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern f32 square_root(f32) __asm__("FUN_001f9988"); -extern f32 FUN_L00_00233a78(void *); -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); -extern f32 FUN_L00_00213350(void *); +extern f32 gravity_z(void *) __asm__("FUN_L00_00233a78"); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); +extern f32 forward_component(void *) __asm__("FUN_L00_00213350"); extern struct HeroTableRow2C D_L12_0017C0A8[]; extern struct LevelTable_QS D_L12_00167100; #define Q D_L12_00167100 extern s32 D_0013CAE0[]; extern void FUN_L00_00233ba0(void *, void *, f32); -extern void FUN_L00_00233b20(void *, void *, f32); +extern void gravity_set_z(void *, void *, f32) __asm__("FUN_L00_00233b20"); extern void FUN_L00_002336e8(void *, void *, f32); extern void make_hit_descriptor(void *, struct MobyView *, s32, f32, void *) __asm__("FUN_L00_00259888"); extern s32 collect_mobies_in_sphere(f32, void *, s32, struct MobyView *, void *) __asm__("FUN_L00_001f2868"); @@ -588,8 +588,8 @@ extern void FUN_L00_001ff290(void *, void *, void *); extern void FUN_L00_002a9b80(struct MobyView *, void *); extern s32 FUN_L00_002a96f8(struct MobyView *, void *, f32, f32, s32, f32, f32, f32); extern void FUN_L00_002335c8(void *, f32, f32, f32); -extern s32 FUN_L00_002598b0(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32); -extern f32 FUN_001f9ab0(void *, void *); +extern s32 play_entity_sound(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32) __asm__("FUN_L00_002598b0"); +extern f32 fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); struct PlayerSpeedTuning { u8 pad0[8]; f32 x08; @@ -601,15 +601,15 @@ extern struct PlayerSpeedTuning D_L12_0017C238; extern s32 FUN_L00_00216de8(s32, s32); extern void FUN_L00_00233708(void *, void *, f32); extern void FUN_L00_00233810(void *, void *, f32); -extern s32 FUN_001efa68(void *, void *, s32, struct MobyView *, s32); +extern s32 collision_line(void *, void *, s32, struct MobyView *, s32) __asm__("FUN_001efa68"); extern s32 D_0013CB14[]; extern void FUN_L00_00215340(void); extern void FUN_L00_00233660(void *, f32, f32, f32); extern s32 FUN_L00_0025e3b8(s32); -extern void FUN_L00_00259bc8(s32, struct MobyView *, s32, void *, void *, f32); +extern void spawn_nearby_effect(s32, struct MobyView *, s32, void *, void *, f32) __asm__("FUN_L00_00259bc8"); extern s32 D_L12_00178380[]; extern void FUN_L00_00209ec8(void); -extern void FUN_L00_002338d0(void *, void *); +extern void gravity_flatten(void *, void *) __asm__("FUN_L00_002338d0"); extern s32 hero_slot_item_id(s32) __asm__("FUN_L00_0020d498"); extern void FUN_L00_0020b5b8(void); extern void FUN_L01_0022d090(void); @@ -622,7 +622,7 @@ extern void FUN_L00_0020d2f8(void *); extern f32 randf_sym(f32, f32) __asm__("FUN_L00_00257c48"); extern void FUN_L00_0026d598(void *, void *, s32); extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); -extern s32 FUN_L00_0025d808(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); +extern s32 sample_path(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); extern s32 FUN_L00_0025d7a0(void *, s32, s32, s32); extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); extern void hero_integrate_velocity(void) __asm__("FUN_L00_00214108"); @@ -685,7 +685,7 @@ void FUN_L12_00238900(void) { transform_vector_by_basis(&hero.motion.unk170, &v0, &D_L12_00167258[0x1F8]); hero.motion.move_yaw = *(f32 *)D_L12_00167258; turn_to(0, frame_scale_sq, frame_scale_sq * 0.0f, frame_time * 174.53293f); - if (D_L12_0015F688 > 0 && FUN_001f9740(&D_L12_0015F688) != 0) { + if (D_L12_0015F688 > 0 && fast_dec_timer(&D_L12_0015F688) != 0) { s32 t; if (usage_stats.stat[18].count < 0xFFFF) { usage_stats.stat[18].count++; @@ -845,7 +845,7 @@ void FUN_L12_00238900(void) { } if (hero.unk90A != 0) { s32 n; - FUN_001f9770(&hero.unk90A); + fast_dec_timer_s16(&hero.unk90A); n = (s16)hero.unk90A >> 2; FUN_L00_00209a40(n > 8 ? 8 : n, 0); } @@ -859,7 +859,7 @@ void FUN_L12_00238900(void) { if (hero.state_timer == 1) { FUN_L00_00209ca8(3, 0x10, 0); if (D_L12_001612D0 != 0) { - FUN_L00_002a3ec8(D_L12_001612D0, D_L12_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L12_001612D0, D_L12_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, -0.3f); } hero.unk90A = scale_game_frames(70); @@ -970,7 +970,7 @@ void FUN_L12_00238900(void) { stick_target(1.0f, 0); turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); hero.unk8EC = hero.motion.unk184; - FUN_001f9740(&hero.unk8F4); + fast_dec_timer(&hero.unk8F4); if (hero.state.step == 1) { hero.target_speed = frame_time * 6.0f; } else if (hero.state.current == 0x35) { @@ -1000,7 +1000,7 @@ void FUN_L12_00238900(void) { if (hero.state.current != 0x35 || !(PD.u1A0.i1A0 & 0xA)) { hero.target_speed *= k; }; - if (FUN_001f9740(&hero.unk8F0) != 0) { + if (fast_dec_timer(&hero.unk8F0) != 0) { s32 lo2; s32 hi2; pl = &hero; @@ -1023,7 +1023,7 @@ void FUN_L12_00238900(void) { } pl->unk8F0 = random_int_between(lo2, scale_game_frames(hi2)); } - if (hero.state.current == 0x35 && FUN_001f9770(&hero.unk8F8) != 0) { + if (hero.state.current == 0x35 && fast_dec_timer_s16(&hero.unk8F8) != 0) { struct MobyView *gm = MV(hero.items[3].moby); if (gm != NULL && gm->hA6 == 0x261) { s32 i; @@ -1061,7 +1061,7 @@ void FUN_L12_00238900(void) { } build_spherical_offset(&hero.motion.velocity, sp, hero.motion.rot.f[2], yaw); } else if (hero.state.current == 0x34) { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); if (hero.state.prev == 0x35) { approach_value(&len, 0.0f, frame_time_sq * 8.0f); } else { @@ -1109,11 +1109,11 @@ void FUN_L12_00238900(void) { break; case 0x6A: case 0x82: { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); approach_value(&len, 0.0f, frame_time_sq * 4.0f); fast_vec_normalize(&hero.motion.unk150, &hero.motion.unk150, len); qcopy(&hero.motion.velocity, &hero.motion.unk150); - if (FUN_001f9740(&hero.unk8F0) == 2) { + if (fast_dec_timer(&hero.unk8F0) == 2) { moby_point_position(MV(hero.moby), 4, &v0); v20.q = 0; v20.f[0] = 0.4f; @@ -1160,7 +1160,7 @@ void FUN_L12_00238900(void) { } } turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); - FUN_001f9740(&hero.unk698); + fast_dec_timer(&hero.unk698); if (hero.state.current == 0x36) { if (PD.i1D4 != 0 && hero.unk698 != 0) { hero.target_speed = frame_time * 3.0f; @@ -1284,7 +1284,7 @@ void FUN_L12_00238900(void) { FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, 0.0f, frame_time * 3.8397243f); } else { f32 an = fast_add_rotations( - -fast_arc_tan(FUN_001f9b80(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); + -fast_arc_tan(vector_distance(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, an, frame_time * 6.4577184f); } v20.f[0] = fast_cos(fast_add_rotations(hero.motion.rot.f[2], -1.5707964f)) * -0.57f; @@ -1368,14 +1368,14 @@ void FUN_L12_00238900(void) { } if (hero.unk99C != 0) { f32 s; - if (FUN_001f9b80(&hero.motion.pos, &MV(hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { + if (vector_distance(&hero.motion.pos, &MV(hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.displacement, frame_time_sq * 40.0f); - if (hero.unk9BE != 0 && FUN_L00_00233a78(&hero.motion.velocity) > 0.0f) { + if (hero.unk9BE != 0 && gravity_z(&hero.motion.velocity) > 0.0f) { subtract_vector_xyz(&v30, &hero.motion.pos, &MV(hero.unk994)->u10.v10); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 57.0f); } } - s = FUN_001f9af0(&hero.motion.velocity) * (frame_time * 0.015f); + s = fast_vec_length(&hero.motion.velocity) * (frame_time * 0.015f); fast_vec_scale(&v30, &hero.motion.velocity, -1.0f); fast_vec_normalize(&v30, &v30, s); add_vector_xyz(&hero.motion.velocity, &hero.motion.velocity, &v30); @@ -1383,7 +1383,7 @@ void FUN_L12_00238900(void) { { struct MobyView *r; if (MV(hero.unk994) != NULL && (r = MV(hero.unk994)->pm78) != NULL) { - f32 len = FUN_001f9af0(&hero.motion.velocity); + f32 len = fast_vec_length(&hero.motion.velocity); if (r->fC < len) { approach_value(&len, r->fC, frame_time_sq * 15.0f); fast_vec_normalize(&hero.motion.velocity, &hero.motion.velocity, len); @@ -1404,9 +1404,9 @@ void FUN_L12_00238900(void) { add_vector_xyz(&v30, &MV(hero.unk994)->u10.v10, &vC0); subtract_vector_xyz(&hero.motion.velocity, &v30, &vD0); old = hero.unk9A4; - FUN_L00_0025b8c0(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); + vendor_spring(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); d = hero.unk9A4 - old; - if (FUN_001f9af0(&vC0) > hero.unk9A4) { + if (fast_vec_length(&vC0) > hero.unk9A4) { fast_vec_normalize(&vC0, &vC0, d); add_vector_xyz(&hero.motion.pos, &hero.motion.pos, &vC0); } @@ -1415,7 +1415,7 @@ void FUN_L12_00238900(void) { f32 mx = frame_time * 14.0f; f32 sp = vector_length_xy(&hero.motion.velocity); if (sp < mx) { - FUN_L00_0025b8c0(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); + vendor_spring(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); v30.f[0] = fast_cos(hero.unk9AC) * hero.unk9B4; v30.f[1] = fast_sin(hero.unk9AC) * hero.unk9B4; v30.f[2] = 0.0f; @@ -1432,7 +1432,7 @@ void FUN_L12_00238900(void) { up = hero.unk9BC == 1; } else { v30.q = hero.motion.displacement.q; - up = FUN_L00_00213350(&v30) > 0.0f; + up = forward_component(&v30) > 0.0f; } if (up) { if (moby->b53 != 0x35) { @@ -1468,12 +1468,12 @@ void FUN_L12_00238900(void) { mx = frame_time_sq * 70.0f; t2 = scale_game_frames(33); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk4B0); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unk4B8 = 1.0f; } } @@ -1506,7 +1506,7 @@ void FUN_L12_00238900(void) { hero.target_speed = 0.0f; if (hero.unk12E2 != 0) { if (MV(hero.unkA54) != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &MV(hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &MV(hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = frame_time * 4.5f; } @@ -1519,7 +1519,7 @@ void FUN_L12_00238900(void) { } } else { if (MV(hero.unkA54) != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &MV(hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &MV(hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = frame_time * 4.5f; } @@ -1561,16 +1561,16 @@ void FUN_L12_00238900(void) { } FUN_L00_00211870(27.0f); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 130.0f); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unkA70 = 1.0f; } - if (FUN_L00_00233a78(&hero.motion.velocity) < frame_time * -37.0f) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); + if (gravity_z(&hero.motion.velocity) < frame_time * -37.0f) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); } } break; @@ -1658,7 +1658,7 @@ void FUN_L12_00238900(void) { tb = &D_L12_0017C0A8[hero.attack_record]; hero.target_speed = 0.0f; if (MV(hero.unkA54) != NULL && scale_game_frames(4) > hero.state_timer) { - f32 d = FUN_001f9b80(&MV(hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; + f32 d = vector_distance(&MV(hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; f32 off; f32 tol; f32 mx; @@ -1926,7 +1926,7 @@ void FUN_L12_00238900(void) { Vec4 *p = &hero.move_impulse; FUN_L00_002132b8(0.7f, 0.0f); v0.q = hero.move_impulse.q; - hero.target_speed += FUN_L00_00213350(&v0); + hero.target_speed += forward_component(&v0); if (hero.target_speed < frame_time * 0.7f) { hero.target_speed = frame_time * 0.7f; } @@ -2119,8 +2119,8 @@ void FUN_L12_00238900(void) { FUN_L00_00215340(); FUN_L00_002132b8(0.7f, frame_time * 0.0f); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; case 0x77: { @@ -2132,8 +2132,8 @@ void FUN_L12_00238900(void) { len = vector_length_xy(&hero.motion.velocity); FUN_L00_001ff600(frame_scale * -0.100000024f * len + len, &hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; } @@ -2178,11 +2178,11 @@ void FUN_L12_00238900(void) { FUN_L00_00215340(); FUN_L01_00232978(1); if (big) { - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); hero.unk304 = hero.motion.velocity.f[2]; } else { - FUN_L00_0025b8c0(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, + vendor_spring(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, frame_scale_sq * 0.35f, frame_time * 2.5f); } break; @@ -2217,7 +2217,7 @@ void FUN_L12_00238900(void) { speed_step(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); FUN_L00_00215340(); - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); if (hero.motion.pos.f[2] < hero.unk410) { approach_value(&hero.unk410, hero.motion.pos.f[2], frame_time * 4.0f); @@ -2261,7 +2261,7 @@ void FUN_L12_00238900(void) { if (hero.state_timer == scale_game_frames(20)) { FUN_L00_00209ca8(3, 0x10, 1); if (D_L12_001612D0 != 0) { - FUN_L00_002a3ec8(D_L12_001612D0, D_L12_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L12_001612D0, D_L12_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, 0.35f); } } @@ -2321,7 +2321,7 @@ void FUN_L12_00238900(void) { qcopy(&v10, &v0); v10.f[0] += fast_cos(hero.motion.rot.f[2]) * 0.85f; v10.f[1] += fast_sin(hero.motion.rot.f[2]) * 0.85f; - if (FUN_001efa68(&v0, &v10, 4, MV(hero.moby), 0) != 0) { + if (collision_line(&v0, &v10, 4, MV(hero.moby), 0) != 0) { hero.unk4A4 = 1; } } @@ -2345,7 +2345,7 @@ void FUN_L12_00238900(void) { if (hero.motion.pos.f[2] < hero.unk410) { hero.unk410 = hero.motion.pos.f[2]; } - if (hero.state_timer > hero.unk420 && FUN_L00_00233a78(&hero.motion.velocity) < 0.001f && + if (hero.state_timer > hero.unk420 && gravity_z(&hero.motion.velocity) < 0.001f && (hero.unk41C == 0 || hero.state_timer > hero.unk3D4)) { hero.unk41E = 1; if (hero.unk3F8 != 0.0f) { @@ -2368,7 +2368,7 @@ void FUN_L12_00238900(void) { fast_vec_scale(&v10, &hero.motion.displacement, 7.0f); for (i = 0; i < n; i++) { if (FUN_L00_0025e3b8(D_L12_00178380[i]) != 0) { - FUN_L00_00259bc8(D_L12_00178380[i], MV(hero.moby), 0x10000, &hero.motion.pos, &v10, + spawn_nearby_effect(D_L12_00178380[i], MV(hero.moby), 0x10000, &hero.motion.pos, &v10, 1.0f); } } @@ -2451,7 +2451,7 @@ void FUN_L12_00238900(void) { } case 0x66: subtract_vector_xyz(&v0, &hero.unk1640, &hero.motion.pos); - if (FUN_001f9ab0(&v0, &hero.motion.unk150) < 0.0f) { + if (fast_vec_dot(&v0, &hero.motion.unk150) < 0.0f) { clear_u64_value(&hero.motion.unk150); } clear_u64_value(&hero.motion.velocity); @@ -2561,3 +2561,5 @@ void FUN_L12_00238900(void) { hero.unk1A4 = 0; } } + +f32 D_L12_0017AD70[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/l12/gameplay/hero/002461f0.c b/src/overlays/l12/gameplay/hero/002461f0.c index a9100e8e9c..7b04d2f51d 100644 --- a/src/overlays/l12/gameplay/hero/002461f0.c +++ b/src/overlays/l12/gameplay/hero/002461f0.c @@ -41,11 +41,11 @@ extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L12_0015F638; extern float D_L12_00167258 __attribute__((section(".data"))); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_00208f20(float a, float b, float c, float d); extern float FUN_L00_00232b90(float a, float b, float c); -extern float FUN_L00_00233a78(float *v); +extern float gravity_z(float *v) __asm__("FUN_L00_00233a78"); extern float FUN_L00_00233c30(float *pos, float *vel, int *steps, float step); extern float FUN_L00_00266e80(int); extern float approach_value(float *p, float target, float maxstep) __asm__("FUN_00213ed8"); @@ -102,7 +102,7 @@ extern void FUN_L00_00232628(void); extern void FUN_L00_00232640(int id); extern void FUN_L00_00233288(float a, float b, short c, unsigned char d, unsigned char e, unsigned char f); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void hud_keep_visible(int, int) __asm__("FUN_L00_00235e18"); extern void FUN_L00_00237ae8(void); extern void FUN_L00_00237ba0(void); @@ -929,7 +929,7 @@ void FUN_L12_002461f0(void) { } break; case 101: - if (FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { + if (vector_distance(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { if (frame_time * 2.7f > hero.motion.speed_xy) { if (fast_difference_between_rotations( hero.motion.rot.f[2], hero.unk1640.f[3]) < 0.034906585f) { @@ -953,7 +953,7 @@ void FUN_L12_002461f0(void) { if ((hero.unkA98 & 2) || hero.unk1650 != 0) { hero_set_state(HERO_STATE_IDLE, 1); } - if (0.2f < FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f)) { + if (0.2f < vector_distance(hero.motion.pos.f, hero.unk1640.f)) { hero_set_state(0x65, 1); } break; @@ -1334,7 +1334,7 @@ void FUN_L12_002461f0(void) { if (hero_set_state(HERO_STATE_IDLE, 0)) { set_hero_animation(0xC, 9, -1.0f); } - FUN_L00_00233b20(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); + gravity_set_z(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); FUN_L00_0025f730(hero.motion.unk150.f, frame_time * 7.0f); hero.unk1C4 = scale_game_frames(7); if (hero.state.prev == 0x2D) { @@ -1835,7 +1835,7 @@ void FUN_L12_002461f0(void) { scale_game_frames(0xE) < hero.state_timer && (hero.unk41E == 0 || (hero.ground_distance > 0.7f && - absolute_float(FUN_L00_00233a78(hero.motion.velocity.f)) < + absolute_float(gravity_z(hero.motion.velocity.f)) < frame_time * 5.8f))) { hero_set_state(0xE, 1); } else if (D_0013D4C0[2] != 0 && hero_slot_item_id(3) != 4 && diff --git a/src/overlays/l12/gameplay/hero/hero_set_state.c b/src/overlays/l12/gameplay/hero/hero_set_state.c index a56016085d..d5ba7a110b 100644 --- a/src/overlays/l12/gameplay/hero/hero_set_state.c +++ b/src/overlays/l12/gameplay/hero/hero_set_state.c @@ -31,7 +31,7 @@ extern float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_0020d658(int back); -extern float FUN_L00_002339d0(float *v); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float vector_length_xy(void *); @@ -66,12 +66,12 @@ extern void FUN_L00_00214ed8(float a, float b, float c); extern void FUN_L00_00216ec0(int, int, int); extern void set_hero_animation(int, int, float) __asm__("FUN_L00_002323b8"); extern void FUN_L00_002325e0(int bank, int seq); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L00_00262500(int a, char *b); extern void FUN_L00_00262528(char *o, int a, int b); extern void FUN_L00_00262840(char *o); -extern void FUN_L00_002a3ec8(int, int, int, float, float, float, float); +extern void pool_splash(int, int, int, float, float, float, float) __asm__("FUN_L00_002a3ec8"); extern void FUN_L01_002405a0(void); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); extern void clear_vector(void *); @@ -299,14 +299,14 @@ int hero_set_state(int a, int b) { if (p->state.prev_control_mode == 0x11) { FUN_L00_00209ca8(3, 0xA, 0); if (D_L12_001612D0 != 0) { - FUN_L00_002a3ec8(D_L12_001612D0, D_L12_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L12_001612D0, D_L12_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.4f, 0.3f); } } else if (p->motion.displacement.f[2] < frame_time * -0.5f) { int n = truncate_float_to_s32(absolute_float(p->motion.displacement.f[2]) * 300.0f); FUN_L00_00209ca8(3, n < 0x28 ? n : 0x28, 1); if (D_L12_001612D0 != 0) { - FUN_L00_002a3ec8(D_L12_001612D0, D_L12_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L12_001612D0, D_L12_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.5f, -0.4f); } p->unk90A = scale_game_frames(0x4B); @@ -662,7 +662,7 @@ int hero_set_state(int a, int b) { char *v = (char *)&p->motion.unk110; p->state.control_mode = 1; p->unk2284 = 0; - p->ground_speed = FUN_L00_002339d0((float *)v); + p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.unk150, v); if (b) { int id = 6; @@ -1059,7 +1059,7 @@ int hero_set_state(int a, int b) { u->unk48C = 1.98f; u->unk430 = 1.95f; } else { - FUN_L00_00233b20((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); + gravity_set_z((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); u->unk41C = 1; u->unk3D0 = scale_game_frames(2); u->unk3D4 = scale_game_frames(0x23) + u->unk3D0; diff --git a/src/overlays/l12/gameplay/vendor/0030b6c8.c b/src/overlays/l12/gameplay/vendor/0030b6c8.c index 20ab6c340e..da158e4876 100644 --- a/src/overlays/l12/gameplay/vendor/0030b6c8.c +++ b/src/overlays/l12/gameplay/vendor/0030b6c8.c @@ -13,7 +13,8 @@ extern void FUN_L01_002787a0(void *); extern void FUN_L01_00278e20(void *, int); void mark_moby_for_removal(struct Moby *moby) __asm__("FUN_0020c828"); -void FUN_L12_0030b6c8(struct Moby *m) { +void lamp_update(struct Moby *m) __asm__("FUN_L12_0030b6c8"); +void lamp_update(struct Moby *m) { int hit = 0; char *r = find_moby_hit(m, 0x10000, 0); switch (m->state) { diff --git a/src/overlays/l12/math/interpolation/00271dd8.c b/src/overlays/l12/math/interpolation/00271dd8.c index 462d20b80c..f71d55a917 100644 --- a/src/overlays/l12/math/interpolation/00271dd8.c +++ b/src/overlays/l12/math/interpolation/00271dd8.c @@ -11,6 +11,7 @@ extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern s32 FUN_L00_00258b50(void *, void *, void *, void *, f32); /* steers the moby toward a point 100 units ahead along its heading */ +s32 FUN_L12_00271dd8(struct Moby *m, void *ctl); s32 FUN_L12_00271dd8(struct Moby *m, void *ctl) { Vec4 ahead; Vec4 out; diff --git a/src/overlays/l13/audio/voices/002982e8.c b/src/overlays/l13/audio/voices/002982e8.c index 6f403013eb..1e5c20f4c0 100644 --- a/src/overlays/l13/audio/voices/002982e8.c +++ b/src/overlays/l13/audio/voices/002982e8.c @@ -17,7 +17,8 @@ typedef struct { unsigned char flags; } Level13SoundEffectTarget; -int FUN_L13_002982e8(int index, const void *vector) { +int set_voice_position(int index, const void *vector) __asm__("FUN_L13_002982e8"); +int set_voice_position(int index, const void *vector) { int offset = index * 0x70; char *base = D_0013E533 + 0x1D; char *vector_base = base + 0xA0; diff --git a/src/overlays/l13/gameplay/entities/blarg_space_fighter.c b/src/overlays/l13/gameplay/entities/blarg_space_fighter.c index 581b589eb7..7c2a2f6289 100644 --- a/src/overlays/l13/gameplay/entities/blarg_space_fighter.c +++ b/src/overlays/l13/gameplay/entities/blarg_space_fighter.c @@ -115,13 +115,13 @@ extern f32 fast_add_rotations_c(f32, f32) __asm__("func_001FA580"); extern f32 random_angle_radians_c(void) __asm__("func_00213308"); extern f32 random_float_between(f32, f32) __asm__("func_002132A8"); extern float D_0015ED6C; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_L00_0025be00(float *, float *, float, float, float, float); +extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); extern float fast_difference_between_rotations(float, float) __asm__("func_001FA688"); -extern int FUN_001efa68(void *, void *, int, void *, int); -extern int FUN_L00_001f0d60(float, void *, int, void *); -extern int FUN_L00_0025e450(); +extern int collision_line(void *, void *, int, void *, int) __asm__("FUN_001efa68"); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); +extern int spawn_explosion() __asm__("FUN_L00_0025e450"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern int tick_countdown_32_alt(void *) __asm__("FUN_001f9740"); extern unsigned char *FUN_L00_002712b8(void *pos, float *vec, int s, int a, int col, int n, float x, float y, float z, float w, float pw); @@ -134,6 +134,7 @@ extern void scale_vector_xyz(void *, void *, float) __asm__("FUN_001f9a68"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("func_001F9CF8"); extern void func_L00_0025F4A8_alt(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); +void FUN_L13_002c1528(Moby_2C27B0 *m); void FUN_L13_002c1528(Moby_2C27B0 *m) { Rocket_2C27B0 *d = m->data; V4_2C27B0 old; @@ -189,20 +190,20 @@ void FUN_L13_002c1528(Moby_2C27B0 *m) { build_spherical_offset_c(&tmp, distance_xyz(&m->pos, &h->veh->pos) / (d->speed + 24.0f) * vd->f64, a, -b); add_vector_xyz(&tmp, &tmp, &h->veh->pos); yaw = fast_arc_tan(tmp.x - m->pos.x, tmp.y - m->pos.y); - pitch = -fast_arc_tan(FUN_001f9b80(&m->pos, &tmp), tmp.z - m->pos.z); + pitch = -fast_arc_tan(vector_distance(&m->pos, &tmp), tmp.z - m->pos.z); } else { yaw = fast_arc_tan(d->target->pos.x - m->pos.x, d->target->pos.y - m->pos.y); - pitch = -fast_arc_tan(FUN_001f9b80(&m->pos, &d->target->pos), d->target->pos.z - m->pos.z); + pitch = -fast_arc_tan(vector_distance(&m->pos, &d->target->pos), d->target->pos.z - m->pos.z); } if (fast_difference_between_rotations(yaw, m->rot.z) < 1.0471976f) { d->speed += (d->maxspeed - d->speed) * 0.05f; } - FUN_L00_0025be00(&m->rot.z, &d->yawv, yaw, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, D_0015ED6C * 25.132742f); - FUN_L00_0025be00(&m->rot.y, &d->pitchv, pitch, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, D_0015ED6C * 25.132742f); + approach_angle(&m->rot.z, &d->yawv, yaw, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, D_0015ED6C * 25.132742f); + approach_angle(&m->rot.y, &d->pitchv, pitch, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, D_0015ED6C * 25.132742f); qcopy(&d->tpos, &d->target->pos); } else { - FUN_L00_0025be00(&m->rot.z, &d->yawv, m->rot.z, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, D_0015ED6C * 25.132742f); - FUN_L00_0025be00(&m->rot.y, &d->pitchv, m->rot.y, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, D_0015ED6C * 25.132742f); + approach_angle(&m->rot.z, &d->yawv, m->rot.z, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, D_0015ED6C * 25.132742f); + approach_angle(&m->rot.y, &d->pitchv, m->rot.y, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, D_0015ED6C * 25.132742f); d->target = 0; } if (scale_game_frames_alt(0x78) < d->timer) { @@ -226,7 +227,7 @@ void FUN_L13_002c1528(Moby_2C27B0 *m) { return; } moby_point_position(m, 1, &hitpos); - if (FUN_001efa68(&old, &hitpos, 0, m, 0) != 0) { + if (collision_line(&old, &hitpos, 0, m, 0) != 0) { Moby_2C27B0 *o = D_L13_00174158; if (o == 0 || (o != d->owner && o->cls_id != 0x504 && o->cls_id != 0x534 && o->cls_id != 0x535 && o->cls_id != 0x536 && o->cls_id != 0x537 && o->cls_id != 0x538 && o->cls_id != 0x539 @@ -238,7 +239,7 @@ void FUN_L13_002c1528(Moby_2C27B0 *m) { mark_moby_for_removal(m); return; } - } else if (FUN_L00_001f0d60(1.5f, &m->pos, 0, m) != 0) { + } else if (coll_sphere(1.5f, &m->pos, 0, m) != 0) { Moby_2C27B0 *o = D_L13_00174158; if (o == 0 || (o != d->owner && o->cls_id != 0x504 && o->cls_id != 0x534 && o->cls_id != 0x535 && o->cls_id != 0x536 && o->cls_id != 0x537 && o->cls_id != 0x538 && o->cls_id != 0x539 @@ -265,7 +266,7 @@ void FUN_L13_002c1528(Moby_2C27B0 *m) { /* Ported from rac1-decomp (src/overlays/l13_gemlik/vendor_002C2638.c: func_L13_002C31B0), where it is exact; names translated to the US level program. */ extern char *func_0020D348_m(int); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void FUN_L00_00250df8(void *); extern void FUN_L00_0025d1b8(void *); void blend_moby_animation(MobyAnim *arg0, int arg1, int arg2, int arg3) __asm__("FUN_00212f90"); @@ -289,7 +290,7 @@ unsigned char *FUN_L13_002c1f28(char *owner, char *pos, char *vec) { *(short *)(data + 0x24) = 0x14; *(float *)(data + 0x30) = 0.5f; data[0x29] = 1; - *(int *)(data + 0x70) = FUN_001f96f8(0x168); + *(int *)(data + 0x70) = scale_game_frames(0x168); if (moby[0x53] != 1) { blend_moby_animation(moby, 1, 0, 10); } @@ -413,7 +414,7 @@ extern void FUN_L13_00305988(void *, void *, void *, float); extern char *D_L13_001600EC; extern float D_L13_0016149C __attribute__((sda)); extern float advance_accelerated_scalar(float, float, float, float, float *, float *) __asm__("FUN_00213f38"); -extern void FUN_001f99f8(void *); +extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); extern void allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); void FUN_L13_002c25b8(unsigned char *moby) { @@ -472,7 +473,7 @@ void FUN_L13_002c25b8(unsigned char *moby) { case 2: rot = (float *)(moby + 0x48); f = fast_arc_tan(*(float *)(target + 0x10) - *(float *)(moby + 0x10), *(float *)(target + 0x14) - *(float *)(moby + 0x14)); - FUN_L00_0025be00(rot, (float *)(d + 0xDC), f, frame_time_sq * 4.712389f, frame_time_sq * 4.712389f, frame_time * 10.12291f); + approach_angle(rot, (float *)(d + 0xDC), f, frame_time_sq * 4.712389f, frame_time_sq * 4.712389f, frame_time * 10.12291f); if (*(int *)(d + 0xB4) == 2) return; *(float *)(d + 0xEC) = 15.0f; moby[0xBC] = 1; @@ -482,7 +483,7 @@ void FUN_L13_002c25b8(unsigned char *moby) { case 4: rot = (float *)(moby + 0x48); f = fast_arc_tan(*(float *)(target + 0x10) - *(float *)(moby + 0x10), *(float *)(target + 0x14) - *(float *)(moby + 0x14)); - FUN_L00_0025be00(rot, (float *)(d + 0xDC), f, frame_time_sq * 12.566371f, frame_time_sq * 25.132742f, frame_time * 6.2831855f); + approach_angle(rot, (float *)(d + 0xDC), f, frame_time_sq * 12.566371f, frame_time_sq * 25.132742f, frame_time * 6.2831855f); switch (moby[0xBC]) { case 1: if (!(moby[0x70] & 2)) return; @@ -519,8 +520,8 @@ void FUN_L13_002c25b8(unsigned char *moby) { } *(float *)(d + 0xEC) += 5.0f; - if (FUN_001f9b80(moby + 0x10, target + 0x10) < *(float *)(d + 0xEC)) - *(float *)(d + 0xEC) = FUN_001f9b80(moby + 0x10, target + 0x10); + if (vector_distance(moby + 0x10, target + 0x10) < *(float *)(d + 0xEC)) + *(float *)(d + 0xEC) = vector_distance(moby + 0x10, target + 0x10); } if (*(int *)(d + 0xB4) != 2) return; if (moby[0x53] != 4) blend_moby_animation_c13(moby, 4, 0, 2); @@ -555,7 +556,7 @@ void FUN_L13_002c25b8(unsigned char *moby) { } break; case 8: - FUN_001f99f8(v0); + clear_u64_value(v0); func_L00_0025F4A8_alt(moby, v0, moby + 0x10, 0.0f, 0.0f, 10, 3, 16, 4.0f, 2.0f, 9.0f, 1.0f, 2, 15.0f, 1, 1, -1, 0); if (*(void **)(d + 0xF8)) mark_moby_for_removal(*(void **)(d + 0xF8)); if (*(void **)(d + 0xFC)) mark_moby_for_removal(*(void **)(d + 0xFC)); @@ -572,7 +573,7 @@ extern int FUN_L13_002c2d30_update(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L13_002c2d30_allocate(int, int, void *) __asm__("FUN_L13_00297fa0"); extern void FUN_L00_00262b00(float, float, void *, float *, float *); extern void FUN_L00_00262b80(void *, void *, void *, float, float, float); -extern float FUN_001f9de0(float); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); extern void FUN_L00_0024f7c8(void *, int, void *); extern int FUN_L00_00257b90(int, int); @@ -581,12 +582,12 @@ extern void FUN_L00_00269958(void *, void *, int, int, int, int, int, int); extern char *FUN_L00_0025a420(void *, int, int); extern int FUN_L13_002c2d30_collision(struct Moby *, void *, float *, int, int *, float *, int, int) __asm__("FUN_00213928"); extern void FUN_L00_00257470(struct Moby *, int, int); -extern void FUN_L00_0025d458(void *, short *); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *, short *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern int FUN_L00_0025ff38(float, void *, void *, int, int, void *, int); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float FUN_001f99c0(float); -extern int FUN_001efa68(void *, void *, int, void *, int); +extern int collision_line(void *, void *, int, void *, int) __asm__("FUN_001efa68"); extern char *D_L13_001B07B0[]; extern int frame_count __asm__("D_L13_0015F5CC"); extern float D_L13_00161490 __attribute__((sda)); @@ -613,8 +614,8 @@ void FUN_L13_002c2d30(unsigned char *moby) { } FUN_L00_00262b00(0.5f, frame_time * 1.39626336f, moby, (float *)(d + 0x100), (float *)(d + 0x104)); FUN_L00_00262b80(moby, d + 0x108, d + 0x10C, 0.104719758f, frame_time * 0.314159274f, frame_time * 0.366519153f); - *(float *)(moby + 0x10) = *(float *)(d + 0xC0) + FUN_001f9de0(*(float *)(d + 0x108)); - *(float *)(moby + 0x14) = *(float *)(d + 0xC4) + FUN_001f9de0(*(float *)(d + 0x10C)); + *(float *)(moby + 0x10) = *(float *)(d + 0xC0) + fast_sin(*(float *)(d + 0x108)); + *(float *)(moby + 0x14) = *(float *)(d + 0xC4) + fast_sin(*(float *)(d + 0x10C)); *(Q_2C27B0 *)z = 0; fl = random_float_between(4.5f, 5.5f); t = -(fl * frame_time); @@ -680,10 +681,10 @@ void FUN_L13_002c2d30(unsigned char *moby) { default: break; } - FUN_L00_0025d458(moby, d + 0x60); + trooper_anim_update(moby, d + 0x60); } moby[0xA4] = 0xFF; - FUN_L00_0025d538(moby, d + 0x60); + trooper_anim_finish(moby, d + 0x60); if (moby[0x20] == 4) { *(float *)(d + 0xD8) = 50.0f; } else { @@ -694,10 +695,10 @@ void FUN_L13_002c2d30(unsigned char *moby) { r2 = FUN_L00_0025ff38(*(float *)(d + 0xD8), moby, d + 0x70, 0, 0, ptr + 0x10, *(int *)ptr); } if (r2 != 2) { - if (*(float *)(d + 0xD8) < FUN_001f9b80(moby + 0x10, d + 0x70) || + if (*(float *)(d + 0xD8) < vector_distance(moby + 0x10, d + 0x70) || 8.0f < FUN_001f99c0(*(float *)(moby + 0x18) - *(float *)(d + 0x78))) { *(int *)(d + 0xB4) = 2; - } else if (moby[0x20] != 5 && FUN_001efa68(moby + 0x10, D_0013F350 + 0xD0, 2, moby, 0) != 0) { + } else if (moby[0x20] != 5 && collision_line(moby + 0x10, D_0013F350 + 0xD0, 2, moby, 0) != 0) { *(int *)(d + 0xB4) = 2; } } @@ -711,8 +712,8 @@ extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern int hit_reaction(void *, void *, void *, int, void *, void *, int, int) __asm__("FUN_L00_0025a478"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern void random_vector(float *, float, float) __asm__("FUN_L00_00257d78"); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void normalize_vector_xyz(void *out, void *a, f32 len) __asm__("FUN_001f9bf8"); @@ -743,13 +744,13 @@ void FUN_L13_002c37e0(struct Moby *moby, unsigned char *d, float *fp) { *fp = 0; moby->flags &= 0xEFFF; d[0x67] = 0x78; - FUN_L00_0025d458(moby, (short *)(d + 0x60)); + trooper_anim_update(moby, (short *)(d + 0x60)); moby->state = 3; } else { *fp = *fp - *(float *)(t + 0x2C); d[0x67] = 0xFA; *(short *)(d + 0x26) = scale_game_frames(0x3C); - FUN_L00_0025d458(moby, (short *)(d + 0x60)); + trooper_anim_update(moby, (short *)(d + 0x60)); normalize_vector_xyz(vec, t + 0x10, 0.1f); add_vector_xyz(&moby->pos, &moby->pos, vec); random_vector(vec, -0.1f, 0.1f); @@ -760,13 +761,13 @@ void FUN_L13_002c37e0(struct Moby *moby, unsigned char *d, float *fp) { moby->hit_slot = 0xFF; } } - FUN_L00_0025d538(moby, d + 0x60); + trooper_anim_finish(moby, d + 0x60); } /* steers a moby's pitch toward a target with a spring, then damps and clamps it */ /* Ported from rac1-decomp (src/overlays/l13_gemlik/vendor_002C2638.c: func_L13_002C4C10), where it is exact; names translated to the US level program. */ extern float spring_turn(float *vel, float cur, float target, float k, float d, float max) __asm__("FUN_L00_00258110"); -extern float FUN_L00_0025e310(float); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern void FUN_L00_00258278(char *moby, float *vel, float target, float k, float d, float max); float absolute_float(float input) __asm__("func_001F99C0"); @@ -786,7 +787,7 @@ void FUN_L13_002c3988(struct Moby *moby, char *d, float p2, float p3) { if (moby->rot.x < -1.5707964f) moby->rot.x = -1.5707964f; moby->rot.x = moby->rot.x * 0.98f; - FUN_L00_0025e310(moby->rot.x); + normalize_angle(moby->rot.x); } /* Ported from rac1-decomp (src/overlays/l13_gemlik/vendor_002C2638.c: func_L13_002C4D50), where it is exact; names translated to the US level program. */ @@ -820,7 +821,7 @@ int FUN_L13_002c3ac8(char *pt, int *tbl, int start, float ref) { /* Ported from rac1-decomp (src/overlays/l13_gemlik/vendor_002C2638.c: func_L13_002C4F10), where it is exact; names translated to the US level program. */ extern char *D_L13_001B07B0[]; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern void add_vector_xyz(void *, void *, void *); extern void normalize_vector_xyz(void *, void *, float); @@ -868,7 +869,7 @@ int FUN_L13_002c3c88(struct Moby *m, char *d, int aim) { float yaw = fast_arc_tan(g->motion.pos.f[0] - m->pos.x, g->motion.pos.f[1] - m->pos.y); FUN_L13_002c3988_c(m, d, yaw, - -fast_arc_tan(FUN_001f9b80(&m->pos, &g->motion.pos), + -fast_arc_tan(vector_distance(&m->pos, &g->motion.pos), g->motion.pos.f[2] - m->pos.z)); } return wrapped; @@ -876,7 +877,7 @@ int FUN_L13_002c3c88(struct Moby *m, char *d, int aim) { /* Ported from rac1-decomp (src/overlays/l13_gemlik/vendor_002C2638.c: func_L13_002C5190), where it is exact; names translated to the US level program. */ extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); void build_spherical_offset(f32 *out, f32 scale, f32 a, f32 b) __asm__("FUN_00214db0"); void FUN_L13_002c3f08(char *out, float scale) { @@ -890,7 +891,7 @@ void FUN_L13_002c3f08(char *out, float scale) { float b = fast_add_rotations(*(float *)(*(char **)(x + 0x15F0) + 0x44), *(float *)(d + 0x94)); build_spherical_offset(out, scale * *(float *)(d + 0x64), a, -b); - FUN_001f9a10(out, out, *(char **)(x + 0x15F0) + 0x10); + fast_vec_add(out, out, *(char **)(x + 0x15F0) + 0x10); } } extern char *D_L13_0015FFD8; @@ -898,7 +899,7 @@ extern char D_0013F3D0[]; extern float D_0015ED60; extern float D_0015ED6C; extern char D_00140940[]; -extern int FUN_001f9770(short *); +extern int fast_dec_timer_s16(short *) __asm__("FUN_001f9770"); extern void clamp_vector_length(void *, void *, float) __asm__("FUN_001f9c90"); int FUN_L13_002c3fc0(struct Moby *moby, char *vars, int aim) { @@ -990,11 +991,11 @@ int FUN_L13_002c3fc0(struct Moby *moby, char *vars, int aim) { } target_distance = FUN_001f9b48(&moby->pos, path + 0x10 + index * 16); if (step != *(signed char *)(vars + 0xD0)) { - if (FUN_001f9770((short *)(vars + 0xD2)) != 0) { + if (fast_dec_timer_s16((short *)(vars + 0xD2)) != 0) { float speed = D_0015ED60_gp * -0.04000002f + 1.0f; *(short *)(vars + 0xD2) = 10; *(float *)(vars + 0xCC) = *(float *)(vars + 0xCC) * speed; - distance = FUN_001f9b80(&moby->pos, D_0013F3D0); + distance = vector_distance(&moby->pos, D_0013F3D0); if ((*(float *)(vars + 0xCC) < D_0015ED60 * 0.1f) | (moby->visible == 0) | (distance < 40.0f)) { short old = *(short *)(vars + 0xB4); *(signed char *)(vars + 0xD0) = step; @@ -1268,7 +1269,7 @@ void FUN_L13_002c4428(Moby_2C56B0 *moby) { add_vector_xyz(v30, hpos, up); add_vector_xyz(v30, v30, v70); FUN_L00_0025f8e0(v30, 0.6f); - lead = FUN_001f9b80(&moby->pos, ((char *)&D_0013F3D0)); + lead = vector_distance(&moby->pos, ((char *)&D_0013F3D0)); normalize_vector_xyz(v50, &vehd->vel, vehd->f64 * (lead / (vehd->f64 + D_0015ED6C * 50.0f))); add_vector_xyz(v30, v30, v50); subtract_vector_xyz_c(v30, v30, &moby->pos); @@ -1683,7 +1684,7 @@ void FUN_L13_002cecb8(struct Moby *moby, unsigned char *d, float *health) { *(OvlQuad *)position = *(OvlQuad *)velocity; FUN_L00_00257470(moby, 0, -1); d[0x67] = 0x78; - FUN_L00_0025d458(moby, (short *)(d + 0x60)); + trooper_anim_update(moby, (short *)(d + 0x60)); moby_point_position(moby, 0, velocity); emit_effect_l13(moby, position, velocity, 0.0f, 0.0f, 10, 3, 16, 4.0f, 2.0f, 0.0f, 1.0f, @@ -1705,14 +1706,14 @@ void FUN_L13_002cecb8(struct Moby *moby, unsigned char *d, float *health) { *health -= *(float *)(src + 0x2c); d[0x67] = 0xfa; *(short *)(d + 0x26) = scale_game_frames(0x3c); - FUN_L00_0025d458(moby, (short *)(d + 0x60)); + trooper_anim_update(moby, (short *)(d + 0x60)); } } } mark: moby->hit_slot = 0xff; } - FUN_L00_0025d538(moby, d + 0x60); + trooper_anim_finish(moby, d + 0x60); } extern int FUN_001160d8(void); extern int start_moby_voice(int, int, void *) __asm__("FUN_L13_00297fa0"); @@ -1727,7 +1728,8 @@ extern int D_0014C190[]; /* Indexed by data[0x74 / 4]; state 1 clears the entry and removal sets it. */ extern int linked_state_flags[] __asm__("D_L13_001847A8"); -void FUN_L13_002cefc0(struct Moby *moby) { +void forcefield_tower_update(struct Moby *moby) __asm__("FUN_L13_002cefc0"); +void forcefield_tower_update(struct Moby *moby) { unsigned char *m = (unsigned char *)moby; int *data = *(int **)(m + 0x78); float position[4]; @@ -1895,7 +1897,7 @@ extern char D_L13_00160680[] __attribute__((section(".sdata"))); extern f32 distance_xyz(void *, void *) __asm__("func_001F9B48"); extern f32 random_float_between(f32, f32) __asm__("func_002132A8"); extern int FUN_L00_00257b90(int, int); -extern int FUN_L00_0025e450(); +extern int spawn_explosion() __asm__("FUN_L00_0025e450"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); extern void random_vector(float *, float, float) __asm__("FUN_L00_00257d78"); @@ -1991,7 +1993,8 @@ extern s32 frame_count __asm__("D_L13_0015F5CC"); extern char *moby_base_1638 __asm__("D_L13_0015FFD8"); /* Blob update: waits on its home point, jumps out at the hero when the ship comes near, splits when it hits something, and respawns. */ -void FUN_L13_002e1638(struct Moby *moby) { +void asteroid_update(struct Moby *moby) __asm__("FUN_L13_002e1638"); +void asteroid_update(struct Moby *moby) { struct BlobVars *vars = (struct BlobVars *)moby->pvars; f32 distance = distance_xyz_1638(&moby->pos, &hero_pos_1638); f32 size; @@ -2169,24 +2172,24 @@ int FUN_L13_002e4300(struct Moby *m, char *arg, float *t) { fl = m->flags; m->flags = fl & 0xEFFF; *(unsigned char *)(arg + 0x67) = 0x78; - FUN_L00_0025d458(m, (short *)e); + trooper_anim_update(m, (short *)e); result = 1; } else { *t = *t - lim; *(unsigned char *)(arg + 0x67) = 0xFA; *(short *)(arg + 0x26) = scale_game_frames(0x3C); - FUN_L00_0025d458(m, (short *)e); + trooper_anim_update(m, (short *)e); } } m->hit_slot = 0xFF; - FUN_L00_0025d538(m, e); + trooper_anim_finish(m, e); return result; } extern void FUN_L00_002591d0(char **, int, int, int); extern void FUN_L00_002592b8(char **, char *, int, int); -extern void FUN_L00_002502f0(void *, int, int, int); -extern int FUN_001f9770(short *); -extern int FUN_001f96f8(int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); +extern int fast_dec_timer_s16(short *) __asm__("FUN_001f9770"); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int FUN_0022da68(int, int, void *) __asm__("FUN_0022da68"); extern void FUN_L01_0026e0e0(int, int); extern void debug_print(char *, short, short, int) __asm__("FUN_001e93b0"); @@ -2248,7 +2251,7 @@ void FUN_L13_002e4448(char *moby) { data->unk74 = 0; data->unk76 = 0; - FUN_L00_002502f0(moby, 0x80, 0x80, 0x80); + set_moby_color(moby, 0x80, 0x80, 0x80); moby[0x20] = 1; break; case 1: @@ -2262,12 +2265,12 @@ void FUN_L13_002e4448(char *moby) { data->unk7A = 0; linked[0x20] = 2; if (linked_data->unk7C > 0) { - linked_data->unk70 = FUN_001f96f8(data->unk7C); + linked_data->unk70 = scale_game_frames(data->unk7C); } } linked_data->unk7A++; FUN_0022da68(3, 0, moby); - FUN_L00_002502f0(moby, 0, 0xFF, 0); + set_moby_color(moby, 0, 0xFF, 0); data->unk74 = 1; } if ((unsigned char)moby[0x20] == 2) { @@ -2279,7 +2282,7 @@ void FUN_L13_002e4448(char *moby) { moby[0x20] = 4; } else { if (data->unk7C >= 0) { - if (FUN_001f9770(&data->unk70) != 0) { + if (fast_dec_timer_s16(&data->unk70) != 0) { data->unk7A = 0; data->unk74 = 0; @@ -2288,16 +2291,16 @@ void FUN_L13_002e4448(char *moby) { FUN_L01_0026e0e0((unsigned char)moby[0x21], 3); debug_print(D_L13_001F4DB0, *(short *)(moby + 0xB2), *(short *)(moby + 0xA6), frame_count); moby[0x20] = 3; - } else if (FUN_001f9770(&data->unk72) != 0) { + } else if (fast_dec_timer_s16(&data->unk72) != 0) { FUN_0022da68(0, 0, moby); - data->unk72 = MIN(FUN_001f96f8(0x2D), FUN_001f96f8(5) + data->unk70 / FUN_001f96f8(0x28)); + data->unk72 = MIN(scale_game_frames(0x2D), scale_game_frames(5) + data->unk70 / scale_game_frames(0x28)); } } } } break; case 3: - FUN_L00_002502f0(moby, 0x80, 0x80, 0x80); + set_moby_color(moby, 0x80, 0x80, 0x80); data->unk7A = 0; data->unk74 = 0; @@ -2307,7 +2310,7 @@ void FUN_L13_002e4448(char *moby) { break; case 4: if (data->unk79 == 0 && data->unk70 != -1) { - if (FUN_001f9770(&data->unk70) != 0) { + if (fast_dec_timer_s16(&data->unk70) != 0) { data->unk7A = 0; data->unk74 = 0; @@ -2316,18 +2319,18 @@ void FUN_L13_002e4448(char *moby) { FUN_L01_0026e0e0((unsigned char)moby[0x21], 3); debug_print(D_L13_001F4DD0, *(short *)(moby + 0xB2), *(short *)(moby + 0xA6), frame_count); moby[0x20] = 3; - } else if (FUN_001f9770(&data->unk72) != 0) { + } else if (fast_dec_timer_s16(&data->unk72) != 0) { FUN_0022da68(0, 0, moby); - data->unk72 = MIN(FUN_001f96f8(0x2D), FUN_001f96f8(5) + data->unk70 / FUN_001f96f8(0x28)); + data->unk72 = MIN(scale_game_frames(0x2D), scale_game_frames(5) + data->unk70 / scale_game_frames(0x28)); } } - if (FUN_001f9770(&data->unk76) != 0) { - data->unk76 = FUN_001f96f8(0x14); + if (fast_dec_timer_s16(&data->unk76) != 0) { + data->unk76 = scale_game_frames(0x14); if (data->unk78 != 0) { - FUN_L00_002502f0(moby, 0, 0xFF, 0); + set_moby_color(moby, 0, 0xFF, 0); data->unk78 = 0; } else { - FUN_L00_002502f0(moby, 0, 0, 0xFF); + set_moby_color(moby, 0, 0, 0xFF); data->unk78 = 1; } } @@ -2488,7 +2491,7 @@ extern int frames_v(int) __asm__("FUN_001f96f8"); extern int ftoi_v(float) __asm__("FUN_001fa6d0"); extern float rndf_v(float, float) __asm__("FUN_002132a8"); extern void bone_v(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void spark_v(void *, void *, int, int, int, int, int, int) __asm__("FUN_L00_00269958"); +extern void FUN_L00_00269958(void *, void *, int, int, int, int, int, int); typedef struct { char pad[0xC4]; @@ -2510,15 +2513,15 @@ void FUN_L13_002e8920(struct Moby *m, char *d) { bone_v(m, D_L13_001D3520[i], a); if (frame_count & 1) { r = frames_v(rnd_v(0xF, 0x14)); - spark_v(a, &zv, 0xCF0000FF, 0xCF, r, ftoi_v(s * 350.0f), -100, 1); + FUN_L00_00269958(a, &zv, 0xCF0000FF, 0xCF, r, ftoi_v(s * 350.0f), -100, 1); } else if (m->command == 0 || D_L13_001D3478[m->command - 1] != D_L13_001D3508[i] || below_v(9) == 0) { r = frames_v(rnd_v(0xF, 0x16)); - spark_v(a, &zv, 0x6000FFFF, 0x80, r, ftoi_v(s * 600.0f), -100, 1); + FUN_L00_00269958(a, &zv, 0x6000FFFF, 0x80, r, ftoi_v(s * 600.0f), -100, 1); } k = ftoi_v(rndf_v(100.0f, 250.0f) * s); r = frames_v(rnd_v(8, 0xC)); - spark_v(a, &zv, 0xEFFF7F4F, 0xFF0000, r, k, -k, 1); + FUN_L00_00269958(a, &zv, 0xEFFF7F4F, 0xFF0000, r, k, -k, 1); } } } @@ -2657,7 +2660,7 @@ void FUN_L13_002e9018(struct Moby *m, char *p, float a, float b) { if (m->rot.x < -1.5707964f) m->rot.x = -1.5707964f; m->rot.x *= 0.985f; - FUN_L00_0025e310(m->rot.x); + normalize_angle(m->rot.x); } /* Level overlay code after unclassified; generated by `decomp overlays stubs`, stubs replaced by C as functions are matched. */ @@ -2670,11 +2673,11 @@ void FUN_L13_002e9018(struct Moby *m, char *p, float a, float b) { extern char *D_L13_001B07B0[]; extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void FUN_L13_002e9018_c(void *, void *, float, float) __asm__("FUN_L13_002e9018"); @@ -2708,19 +2711,19 @@ int FUN_L13_002e9160(struct Moby *m, char *d, int idx, int aim) { if (1.0f < t) t = 1.0f; fast_vec_scale(d + 0x70, d + 0x70, 1.0f - t); - FUN_001f9a28(v, path + (*(short *)(d + 0x9C) * 16 + 0x10), &m->pos); + fast_vec_sub(v, path + (*(short *)(d + 0x9C) * 16 + 0x10), &m->pos); fast_vec_normalize(v, v, *(float *)(d + 0xAC)); fast_vec_scale(v, v, t); - FUN_001f9a10(d + 0x70, d + 0x70, v); + fast_vec_add(d + 0x70, d + 0x70, v); fast_vec_normalize(d + 0x70, d + 0x70, *(float *)(d + 0xAC)); - FUN_001f9a10(&m->pos, &m->pos, d + 0x70); + fast_vec_add(&m->pos, &m->pos, d + 0x70); yaw = fast_arc_tan(v[0], v[1]); pitch = -fast_arc_tan(vector_length_xy(v), v[2]); if (m->state == 5) { struct Hero *g = &hero; yaw = fast_arc_tan(g->motion.pos.f[0] - m->pos.x, g->motion.pos.f[1] - m->pos.y); - pitch = -fast_arc_tan(FUN_001f9b80(&m->pos, &g->motion.pos), + pitch = -fast_arc_tan(vector_distance(&m->pos, &g->motion.pos), g->motion.pos.f[2] - m->pos.z); } if (aim != 0) @@ -2731,7 +2734,7 @@ int FUN_L13_002e9160(struct Moby *m, char *d, int idx, int aim) { extern char *D_L13_001B07B0_9408[] __asm__("D_L13_001B07B0"); extern float D_0015ED60_9408 __asm__("D_0015ED60"); extern float dist_9408(void *, void *) __asm__("FUN_001f9b48"); -extern int step_9408(char *, char *, int, int) __asm__("FUN_L13_002e9160"); +extern int FUN_L13_002e9160_c(char *, char *, int, int) __asm__("FUN_L13_002e9160"); int FUN_L13_002e9408(struct Moby *m, char *d, int idx, int aim) { char *path = D_L13_001B07B0_9408[*(int *)(&d[idx << 2] + 0xB0)]; @@ -2785,7 +2788,7 @@ int FUN_L13_002e9408(struct Moby *m, char *d, int idx, int aim) { *(float *)(d + 0xAC) = 0.0f; } } - r = step_9408(m, d, idx, aim); + r = FUN_L13_002e9160_c(m, d, idx, aim); } if (0.0f < *(float *)(path + (*(short *)(d + 0x9C) << 4) + 0x1C)) { r |= 2; @@ -2797,7 +2800,7 @@ int FUN_L13_002e9408(struct Moby *m, char *d, int idx, int aim) { extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L00_0025f8e0(float *v, float s); void FUN_L13_002e9680(void *unused, char *p, int idx) { @@ -2809,11 +2812,11 @@ void FUN_L13_002e9680(void *unused, char *p, int idx) { char *data = *(char **)(moby + 0x78); float *v = (float *)(data + 0x10); float t, r0, r1, r2; - FUN_L00_0025f090(unused, moby + 0x10, -1, 2.0f, 13.0f); + cart_burst(unused, moby + 0x10, -1, 2.0f, 13.0f); fast_vec_scale(v, p + 0x70, 0.95f); FUN_L00_0025f8e0(v, frame_time * 30.0f); moby[0x20] = 3; - FUN_001f9a10(moby + 0x10, moby + 0x10, v); + fast_vec_add(moby + 0x10, moby + 0x10, v); t = frame_time; t = t * 0.34906585f; r0 = random_float_between_alt(-t, t); @@ -2833,10 +2836,10 @@ void FUN_L13_002e9680(void *unused, char *p, int idx) { } extern void FUN_L00_00257470(struct Moby *, int, int); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern void FUN_L10_002f5a50(int); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void set_animation_parameter(int, int) __asm__("FUN_001ff570"); extern char *D_L13_001B07B0[]; extern float D_0015ED6C; @@ -2857,7 +2860,7 @@ void FUN_L13_002e97e0(struct Moby *moby, char *vars, int *result) { moby->flags &= 0xEFFF; FUN_L00_00257470(moby, 0, -1); vars[0x67] = 0x78; - FUN_L00_0025d458(moby, (short *)(vars + 0x60)); + trooper_anim_update(moby, (short *)(vars + 0x60)); vars[0x13B] = 4; scale = D_0015ED6C * 10.0f; velocity = D_L13_001600EC + (*(int *)(vars + 0x130) << 7); @@ -2884,7 +2887,7 @@ void FUN_L13_002e97e0(struct Moby *moby, char *vars, int *result) { int point = index * 16 + 0x10; int next = index * 16 + 0x20; - horizontal = FUN_001f9b80(path + point, path + next); + horizontal = vector_distance(path + point, path + next); } { int index = *(short *)(vars + 0x9C); @@ -2907,7 +2910,7 @@ void FUN_L13_002e97e0(struct Moby *moby, char *vars, int *result) { FUN_L10_002f5a50(*(int *)(vars + 0x12C)); moby->state = 7; *(float *)(vars + 0xAC) = D_0015ED6C * 80.0f; - *(int *)(vars + 0xF8) = FUN_001f96f8(600); + *(int *)(vars + 0xF8) = scale_game_frames(600); FUN_L13_002e86f8(moby, (unsigned char *)vars, 0x22, 1); *(short *)(vars + 0x138) = 0; vars[0x148] = 0; @@ -3257,7 +3260,7 @@ void FUN_L13_002ea330(char *a, char *b, float f) { float dist = FUN_001f9b48(b, *(char **)(base + 0x15F0) + 0x10); float k = *(float *)(d + 0x64); build_spherical_offset(a, dist / (k + f) * k, y, -x); - FUN_001f9a10(a, a, *(char **)(base + 0x15F0) + 0x10); + fast_vec_add(a, a, *(char **)(base + 0x15F0) + 0x10); } /* Ported from rac1-decomp (src/overlays/l13_gemlik/vendor_002C2638.c: func_L13_002EB838), where it is exact; names translated to the US level program. */ @@ -3276,11 +3279,11 @@ float FUN_L13_002ea400(float *pos, float *pitch, float *yaw, float lead) { qcopy(v, t + 0x10); } y = fast_arc_tan(v[0] - pos[0], v[1] - pos[1]); - p = -fast_arc_tan(FUN_001f9b80(pos, v), v[2] - pos[2]); + p = -fast_arc_tan(vector_distance(pos, v), v[2] - pos[2]); } else { struct Hero *p0 = &hero; y = fast_arc_tan(p0->motion.pos.f[0] - pos[0], p0->motion.pos.f[1] - pos[1]); - p = -fast_arc_tan(FUN_001f9b80(pos, &p0->motion.pos), p0->motion.pos.f[2] - pos[2]); + p = -fast_arc_tan(vector_distance(pos, &p0->motion.pos), p0->motion.pos.f[2] - pos[2]); } if (yaw != 0) *yaw = y; diff --git a/src/overlays/l13/gameplay/entities/elevator.c b/src/overlays/l13/gameplay/entities/elevator.c index 46539a1a51..49a3b2861e 100644 --- a/src/overlays/l13/gameplay/entities/elevator.c +++ b/src/overlays/l13/gameplay/entities/elevator.c @@ -186,7 +186,7 @@ void FUN_L13_002b0e80(char *moby) { /* Variables of the class-1380 lift (moby->pvars). */ typedef struct { u8 pad0[0x20]; - u8 path[0x40]; /* 0x20: passed to FUN_L00_00260738 with the moved delta */ + u8 path[0x40]; /* 0x20: passed to update_entity_matrix with the moved delta */ f32 top; /* 0x60 */ f32 bottom; /* 0x64 */ f32 speed; /* 0x68 */ @@ -206,23 +206,24 @@ extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern int float_to_int(float) __asm__("FUN_001fa6d0"); extern float absolute_float(float) __asm__("FUN_001f99c0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern s32 allocate_voice_2b39e0(s32, s32, void *) __asm__("FUN_0022da68"); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); -extern int FUN_L00_0028d8c0(void *, int); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void FUN_L00_002ea9d8(void *); extern void FUN_L00_002eaa30(void *); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void FUN_L00_002eac18(int); extern int hero_set_state(int, int) __asm__("FUN_L00_002223f8"); -extern void lift_view_2b39e0(struct Moby *, float *, float *) __asm__("FUN_L13_002b4060"); +extern void FUN_L13_002b4060(struct Moby *, float *, float *); extern void scale_vector_xyz(void *, void *, f32) __asm__("FUN_001f9a68"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); /* Updates the lift: rides between its two heights, blends the camera while the hero rides it and pulses its colour while it waits. */ -void FUN_L13_002b39e0(struct Moby *moby) { +void elevator_update(struct Moby *moby) __asm__("FUN_L13_002b39e0"); +void elevator_update(struct Moby *moby) { LiftVars *vars = (LiftVars *)moby->pvars; float delta[4]; float rot[4]; @@ -245,7 +246,7 @@ void FUN_L13_002b39e0(struct Moby *moby) { if (vars->blend < 1.0f) { float t = (1.0f - vars->blend) / (1.0f - old); char *base; - lift_view_2b39e0(moby, b, c); + FUN_L13_002b4060(moby, b, c); subtract_vector_xyz(a, D_L13_001670C0_2b39e0, b); base = D_L13_001670C0_2b39e0 - 0x140; scale_vector_xyz(a, a, t); @@ -264,11 +265,11 @@ void FUN_L13_002b39e0(struct Moby *moby) { case 2: case 3: { float target; - if (!FUN_L00_0028d8c0(moby, vars->voice)) { + if (!voice_is_playing(moby, vars->voice)) { vars->voice = allocate_voice_2b39e0(0, 4, moby); } if (moby->command != 0) { - lift_view_2b39e0(moby, a, b); + FUN_L13_002b4060(moby, a, b); FUN_L00_002ea9d8(a); FUN_L00_002eaa30(b); } @@ -294,12 +295,12 @@ void FUN_L13_002b39e0(struct Moby *moby) { } case 6: case 7: - if (FUN_L00_0028d8c0(moby, vars->voice)) { + if (voice_is_playing(moby, vars->voice)) { release_voice_slot(vars->voice); vars->voice = -1; } if (hero.ground_moby != moby || hero.air_frames.s != 0 || - FUN_001f9b80(&hero.motion.pos, &moby->pos) > 0.5f) { + vector_distance(&hero.motion.pos, &moby->pos) > 0.5f) { u8 s = moby->state; vars->armed = 0; if (s == 7) { @@ -324,11 +325,11 @@ void FUN_L13_002b39e0(struct Moby *moby) { moby->glow_color = (i << 16) | t | i; } if (hero.ground_moby != moby || hero.air_frames.s != 0 || - FUN_001f9b80(&hero.motion.pos, &moby->pos) > 1.1f) { + vector_distance(&hero.motion.pos, &moby->pos) > 1.1f) { vars->armed = 1; } if (vars->armed != 0 && hero.ground_moby == moby && hero.air_frames.s == 0 && - FUN_001f9b80(&hero.motion.pos, &moby->pos) < 0.5f) { + vector_distance(&hero.motion.pos, &moby->pos) < 0.5f) { moby->glow_color = 0x80208020; if (moby->state == 5) { moby->command = 2; @@ -337,11 +338,11 @@ void FUN_L13_002b39e0(struct Moby *moby) { } moby->state = 1; hero_set_state(0x72, 1); - FUN_L00_002eaaa0(D_L13_001670C0_2b39e0, D_L13_001670C0_2b39e0 + 0x10, 1, 0, 0); + jet_mount(D_L13_001670C0_2b39e0, D_L13_001670C0_2b39e0 + 0x10, 1, 0, 0); vars->blend = 0.0f; } else if (moby->state == 4) { char *p = (char *)&hero.motion.pos; - float d = FUN_001f9b80(&moby->pos, p); + float d = vector_distance(&moby->pos, p); if (absolute_float(*(float *)(p + 0x258) - vars->bottom) < 2.0f && d < 32.0f && d > 5.0f) { moby->command = 0; moby->state = 3; @@ -349,7 +350,7 @@ void FUN_L13_002b39e0(struct Moby *moby) { } } else if (moby->state == 5) { char *p = (char *)&hero.motion.pos; - float d = FUN_001f9b80(&moby->pos, p); + float d = vector_distance(&moby->pos, p); if (absolute_float(*(float *)(p + 0x258) - vars->top) < 2.0f && d < 32.0f && d > 5.0f) { moby->command = 0; moby->state = 2; @@ -360,7 +361,7 @@ void FUN_L13_002b39e0(struct Moby *moby) { } } add_vector_xyz(delta, delta, &moby->pos); - FUN_L00_00260738(vars->path, delta, rot, &moby->rot); + update_entity_matrix(vars->path, delta, rot, &moby->rot); } #define NOT_SDA @@ -368,22 +369,23 @@ void FUN_L13_002b39e0(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/l13_gemlik/vendor_002B2020.c: func_L13_002B5210), where it is exact; names translated to the US level program. */ -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); -extern float FUN_001fa5c8(float, float); +extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern unsigned char D_0013E533[]; extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +void FUN_L13_002b4060(struct Moby *moby, float *v, float *w); void FUN_L13_002b4060(struct Moby *moby, float *v, float *w) { float ang = moby->rot.z; float r = 2.5f; float z = 1.5f; unsigned char *x; if ((moby->command >= 2 && (moby->command & 1)) || (moby->state >= 2 && (moby->state & 1))) { - ang = FUN_001fa5c8(ang, 1.5707964f); + ang = fast_subtract_rotations(ang, 1.5707964f); } else { ang = fast_add_rotations(ang, 1.5707964f); } @@ -391,10 +393,10 @@ void FUN_L13_002b4060(struct Moby *moby, float *v, float *w) { r = 2.0f; z = 1.2f; } - v[0] = FUN_001f9dc8(ang) * r; - v[1] = FUN_001f9de0(ang) * r; + v[0] = fast_cos(ang) * r; + v[1] = fast_sin(ang) * r; v[2] = z; - FUN_001f9a10(v, v, &moby->pos); + fast_vec_add(v, v, &moby->pos); clear_u64_value(w); x = D_0013E533 + 0xE1D; w[2] = fast_arc_tan(*(float *)(x + 0xD0) - v[0], *(float *)(x + 0xD4) - v[1]); @@ -476,7 +478,8 @@ extern void FUN_L00_0025e450_2b0e80(void *, void *, void *, float, float, int, i extern void random_vector(float *, float, float) __asm__("FUN_L00_00257d78"); extern unsigned char D_0013F420_2b0e80[] __asm__("D_0013F420"); -void FUN_L13_002b41b8(Moby_2B5368 *m) { +void blarg_turret_update(Moby_2B5368 *m) __asm__("FUN_L13_002b41b8"); +void blarg_turret_update(Moby_2B5368 *m) { Data_2B5368 *data = m->data; Moby_2B5368 *t; Moby_2B5368 *gun; @@ -578,7 +581,7 @@ void FUN_L13_002b41b8(Moby_2B5368 *m) { /* Ported from rac1-decomp (src/overlays/l13_gemlik/vendor_002B2020.c: func_L13_002B5950), where it is exact; names translated to the US level program. */ extern char *FUN_L13_003061c8(float, float *, float *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); extern int frame_count __asm__("D_L13_0015F5CC"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); @@ -593,14 +596,14 @@ void FUN_L13_002b47a0(struct Moby *moby) { data = (char *)moby->pvars; if (frame_count % D_L13_0016138C == 0) { moby_point_position(moby, 0, v); - d = FUN_001f9b80(&moby->pos, *(char **)(data + 0x40) + 0x10); + d = vector_distance(&moby->pos, *(char **)(data + 0x40) + 0x10); x = (20.0f - d) / 20.0f * 5.0f + 2.5f; ang = fast_add_rotations(random_float_between(-x, x) * DEG_TO_RAD, moby->rot.z); - v2[0] = FUN_001f9dc8(ang) * (D_L13_00161388 * frame_time); - v2[1] = FUN_001f9de0(ang) * (D_L13_00161388 * frame_time); + v2[0] = fast_cos(ang) * (D_L13_00161388 * frame_time); + v2[1] = fast_sin(ang) * (D_L13_00161388 * frame_time); v2[2] = 0; - FUN_001f9a10(v, v, v2); + fast_vec_add(v, v, v2); FUN_L13_003061c8(*(float *)(data + 0x68), v, v2, moby); } } @@ -685,8 +688,8 @@ extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern int hit_reaction(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_L00_0025a478"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern void FUN_L00_00257470(void *, int, int); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); void blend_moby_animation(MobyAnim *arg0, int arg1, int arg2, int arg3) __asm__("FUN_00212f90"); void FUN_L13_002b4a58(struct Moby *m, char *p) { @@ -751,7 +754,7 @@ void FUN_L13_002b4a58(struct Moby *m, char *p) { } FUN_L00_00257470(m, 0, -1); p[0x67] = 0x78; - FUN_L00_0025d458(m, (short *)(p + 0x60)); + trooper_anim_update(m, (short *)(p + 0x60)); if (m->prev_seq != 3) blend_moby_animation(m, 3, 1, 0); m->state = 2; @@ -759,12 +762,12 @@ void FUN_L13_002b4a58(struct Moby *m, char *p) { *tm = f0 - f1; *(unsigned char *)(p + 0x67) = 0xFA; *(short *)(p + 0x26) = scale_game_frames(0x3C); - FUN_L00_0025d458(m, (short *)(p + 0x60)); + trooper_anim_update(m, (short *)(p + 0x60)); } } } m->hit_slot = 0xFF; - FUN_L00_0025d538(m, p + 0x60); + trooper_anim_finish(m, p + 0x60); } /* Updates the gem-lock turret: idle animations, then a burst of particles when destroyed. */ /* Ported from rac1-decomp (src/overlays/l13_gemlik/vendor_002B2020.c: func_L13_002B5E30), where it is exact; names translated to the US level program. */ @@ -791,12 +794,13 @@ extern float D_L13_001670C0[]; extern int FUN_L00_00257b90(int, int); extern int FUN_L13_002b4a58_c() __asm__("FUN_L13_002b4a58"); extern int random_integer_below(int) __asm__("FUN_00213260"); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, int, float, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); void blend_moby_animation(MobyAnim *arg0, int arg1, int arg2, int arg3) __asm__("FUN_00212f90"); void mark_moby_for_removal(struct Obj *obj) __asm__("FUN_0020c828"); -void FUN_L13_002b4c80(struct Moby *moby) { +void blarg_gunner_update(struct Moby *moby) __asm__("FUN_L13_002b4c80"); +void blarg_gunner_update(struct Moby *moby) { unsigned char *d = moby->pvars; float a[4]; float b[4]; @@ -834,7 +838,7 @@ void FUN_L13_002b4c80(struct Moby *moby) { if (moby->anim_flags & 2) { subtract_vector_xyz(a, D_L13_001670C0, &moby->pos); moby_point_position(moby, 0, b); - FUN_L00_0025e450(moby, a, b, 0.0f, 0.0f, 0x14, 9, 0x20, 10.0f, 7.0f, 20.0f, -1, 2.0f, + spawn_explosion(moby, a, b, 0.0f, 0.0f, 0x14, 9, 0x20, 10.0f, 7.0f, 20.0f, -1, 2.0f, 40.0f, 0, 1, -1, 0); mark_moby_for_removal(moby); } @@ -873,7 +877,7 @@ typedef struct { extern void kill_part(void *) __asm__("FUN_L00_00267a08"); -/* Passes the stored value to FUN_L00_00267a08 once, then clears it. */ +/* Passes the stored value to free_effect_particle once, then clears it. */ void FUN_L13_002b4fb8(Level13VendorMoby *moby) { if (moby->value != 0) { kill_part(moby->value); @@ -1071,8 +1075,8 @@ extern float D_L13_00161394 __attribute__((sda)); extern float D_L13_00161398 __attribute__((sda)); extern float D_L13_0016139C __attribute__((sda)); extern float D_L13_001670C0[]; -extern float FUN_001f96b0(float); -extern float FUN_001f9b80(void *, void *); +extern float FUN_L04_001f1978(float); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float FUN_L00_0025abf0(void *, void *, void *, float, float); extern float approach_value(float *, float, float); @@ -1080,13 +1084,13 @@ extern float fast_difference_between_rotations(float, float) __asm__("func_001FA extern float probe_ground_height(void *, int, float) __asm__("func_00213508"); extern int D_L13_0015F5C4; extern int D_L13_001613B0[] __attribute__((section(".sdata"))); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int fun_00213928(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_00213928"); -extern int FUN_L00_001f0d60(float, void *, int, void *); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern int FUN_L00_00257b90(int, int); extern int FUN_L00_00258830(void *, void *, float, float, float, int); extern int FUN_L00_00258b50(void *, void *, void *, void *, float); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int FUN_L00_002dc9f0(void *, void *); extern int FUN_L01_0026e008(int, int); extern int FUN_L01_0028b510(void *, void *, float); @@ -1100,13 +1104,13 @@ extern s32 random_integer_below(s32) __asm__("func_00213260"); short D_L13_001613A0 = 0x505; extern void FUN_L00_00257470(void *, int, int); extern void FUN_L00_00258278(char *moby, float *vel, float target, float k, float d, float max); -extern void FUN_L00_00259bc8(void *, int, int, void *, void *, float); +extern void spawn_nearby_effect(void *, int, int, void *, void *, float) __asm__("FUN_L00_00259bc8"); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025ab48(void *, float *, void *, void *); -extern void FUN_L00_0025c558(void *, void *, float, int, int, int); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(void *, void *, float, int, int, int) __asm__("FUN_L00_0025c558"); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L00_0025f730(void *, float); extern void FUN_L00_00263ac8(float, int, int, unsigned char *); extern void FUN_L01_0026d930(char *p); @@ -1124,7 +1128,8 @@ void FUN_L13_002b4f28(struct Moby *moby, char *data); void FUN_L13_002b4ff0(struct Moby *m, char *d); extern int func_001F9908_i(void *) __asm__("FUN_001f9740"); -void FUN_L13_002b50d8(RsMoby *m) { +void robosquawker_update(RsMoby *m) __asm__("FUN_L13_002b50d8"); +void robosquawker_update(RsMoby *m) { RsVars *v; RsVec old; RsTarget tgt; @@ -1166,9 +1171,9 @@ void FUN_L13_002b50d8(RsMoby *m) { v->h214 = scale_game_frames_alt(0xF0); } v->w38 = 0; - FUN_001f9770(&v->h208); + fast_dec_timer_s16(&v->h208); if (m->state != 0) { - if (FUN_001f9770(&v->h214) != 0) { + if (fast_dec_timer_s16(&v->h214) != 0) { v->f1FC = v->v1D0.f[3]; } else { v->f1FC = v->f200; @@ -1177,7 +1182,7 @@ void FUN_L13_002b50d8(RsMoby *m) { dmg = 0.0f; hit = FUN_L00_0025a420(m, 0x330000, 0); fun_00213928(m, hit, &v->f20, 0, &hits, &dmg, 0, 4); - FUN_001f9770(&v->h26); + fast_dec_timer_s16(&v->h26); if (v->h26 < scale_game_frames_alt(0x2D) && hit != 0 && m->state != 0x63) { if (hit->src->hA6 >= 0xB0 && hit->src->hA6 <= 0xB1 && v->h26 != 0) { hit->f2C = 0.0f; @@ -1201,26 +1206,26 @@ void FUN_L13_002b50d8(RsMoby *m) { v->f138 = frame_time * 10.0f; v->f13C = frame_time * 5.5f; *(u128 *)&va = *(u128 *)&hit->pos; - FUN_L00_0025ab48(&va, &ang, &v->f138, &v->f13C); - FUN_L00_0025c558(m, v->x120, ang, (rand() & 1) + 9, 1, 0); + trooper_knockback_arc(&va, &ang, &v->f138, &v->f13C); + trooper_start_knockback(m, v->x120, ang, (rand() & 1) + 9, 1, 0); v->f170 = 11.0f; v->f174 = 18.0f; m->state = 0x63; FUN_L13_002b4fb8((Level13VendorMoby *)v); v->x110[7] = 0x78; - FUN_L00_0025d458(m, (short *)v->x110); + trooper_anim_update(m, (short *)v->x110); FUN_L00_00257470(m, 0, -1); } else { *(u128 *)&va = *(u128 *)&hit->pos; - FUN_L00_0025ab48(&va, &ang, &v->f138, &v->f13C); - FUN_L00_0025c558(m, v->x120, ang, (rand() & 1) + 9, 1, 0); + trooper_knockback_arc(&va, &ang, &v->f138, &v->f13C); + trooper_start_knockback(m, v->x120, ang, (rand() & 1) + 9, 1, 0); v->f170 = 5.0f; v->f174 = 10.0f; m->state = 6; FUN_L13_002b4fb8((Level13VendorMoby *)v); *(unsigned char *)&v->x110[7] = 0xFA; v->h26 = scale_game_frames_alt(0x3C); - FUN_L00_0025d458(m, (short *)v->x110); + trooper_anim_update(m, (short *)v->x110); } } } @@ -1343,7 +1348,7 @@ void FUN_L13_002b50d8(RsMoby *m) { } FUN_L00_0025f730(&v->v40, h); add_vector_xyz(&va, &v->v40, &m->pos); - if (FUN_L00_001f0d60(1.2f, &va, 0, m) != 0) { + if (coll_sphere(1.2f, &va, 0, m) != 0) { clear_u64_value(&v->v40); if (m->b53 != 0) { blend_moby_animation_c(m, 0, 0, scale_game_frames_alt(3)); @@ -1373,7 +1378,7 @@ void FUN_L13_002b50d8(RsMoby *m) { FUN_L00_0025f730(&v->v40, frame_time * 4.0f); add_vector_xyz(&va, &v->v40, &m->pos); m->f58 = vector_length_xyz(&v->v40) * 20.0f + 1.0f; - if (FUN_L00_001f0d60(1.2f, &va, 0, m) != 0) { + if (coll_sphere(1.2f, &va, 0, m) != 0) { int i; v->w20C = scale_game_frames_alt(0x78); @@ -1446,7 +1451,7 @@ void FUN_L13_002b50d8(RsMoby *m) { approach_value(&v->v40.f[2], -(frame_time * 8.0f), frame_time_sq * 10.8f); FUN_L00_00258830(m, &v->v40, 0.6f, 0.5f, 0.0f, 0); if (m->b53 != 2 - && m->pos.f[2] - g <= frame_time * 8.0f * FUN_001f96b0(45.0f) + && m->pos.f[2] - g <= frame_time * 8.0f * FUN_L04_001f1978(45.0f) && m->b53 != 2) { blend_moby_animation_c(m, 2, 0, scale_game_frames_alt(5)); } @@ -1547,7 +1552,7 @@ void FUN_L13_002b50d8(RsMoby *m) { v->f13C = FUN_L00_0025abf0(&m->pos, &v->v1D0, &out, D_L13_00161398 * frame_time, -D_L13_0016139C); v->w144 = 0xD; v->b15D = 0; - FUN_L00_0025c558(m, v->x120, m->rot.f[2], (rand() & 1) + 9, 1, 0); + trooper_start_knockback(m, v->x120, m->rot.f[2], (rand() & 1) + 9, 1, 0); v->f170 = 5.0f; v->f174 = 10.0f; FUN_L13_002b4f28((unsigned char *)m, (char *)v); @@ -1556,7 +1561,7 @@ void FUN_L13_002b50d8(RsMoby *m) { break; } case 0xB: - if (FUN_L00_0025c698(m, v->x120) & 1) { + if (mine_fall(m, v->x120) & 1) { FUN_L13_002b4fb8((Level13VendorMoby *)v); qzero(v->x120); m->state = 3; @@ -1622,7 +1627,7 @@ void FUN_L13_002b50d8(RsMoby *m) { float d; r = absolute_float(m->pos.f[2] - tgt.pos.f[2]); - r = r / FUN_001f9b80(&m->pos, &tgt); + r = r / vector_distance(&m->pos, &tgt); if (v->w21C != -1) { FUN_L01_0028b5e0(m, D_L13_001B07B0[v->w21C], &tgt, &vb); } else { @@ -1639,7 +1644,7 @@ void FUN_L13_002b50d8(RsMoby *m) { v->f1F4 = -v->f1F4; } subtract_vector_xyz(&vc, &tgt, &v->v1D0); - d = FUN_001f9b80(&m->pos, &tgt); + d = vector_distance(&m->pos, &tgt); if ((d < 1.5f || (tgt.moby != 0 && tgt.moby->hA6 == 0x10E && tgt.moby->state != 0xFE && tgt.moby->state != 0xFD && d < 2.3f)) && !(res & 2)) { @@ -1678,7 +1683,7 @@ void FUN_L13_002b50d8(RsMoby *m) { same = m->b52 == m->b53; hh = compute_interpolated_record_value(m); dz = absolute_float(m->pos.f[2] - tgt.pos.f[2]); - d = FUN_001f9b80(&m->pos, &tgt); + d = vector_distance(&m->pos, &tgt); da = fast_difference_between_rotations(fast_arc_tan(tgt.pos.f[0] - m->pos.f[0], tgt.pos.f[1] - m->pos.f[1]), m->rot.f[2]); if (same && absolute_float(hh - 13.0f) < 0.2f @@ -1692,10 +1697,10 @@ void FUN_L13_002b50d8(RsMoby *m) { qcopy(&vb, &tgt); vb.f[2] += 0.75f; if (tm != 0) { - FUN_L00_00259bc8(tm, (int)m, 1, &vb, &va, 1.0f); + spawn_nearby_effect(tm, (int)m, 1, &vb, &va, 1.0f); } } - if ((m->b70 & 2) && FUN_001f9b80(&m->pos, &tgt) > 1.5f) { + if ((m->b70 & 2) && vector_distance(&m->pos, &tgt) > 1.5f) { m->state = 3; if (m->b53 != 5) { blend_moby_animation_c(m, 5, 0, scale_game_frames_alt(3)); @@ -1726,7 +1731,7 @@ void FUN_L13_002b50d8(RsMoby *m) { va.f[1] = fast_sin(m->rot.f[2]) * 2.0f; va.f[2] = 0.0f; res = FUN_L00_00258b50(m, &v->w180, &va, &vb, 1.0f); - if (FUN_001f9b80(&m->pos, &v->v1D0) < 2.0f) { + if (vector_distance(&m->pos, &v->v1D0) < 2.0f) { m->state = 1; if (m->b53 != 3) { blend_moby_animation_c(m, 3, 0, scale_game_frames_alt(3)); @@ -1759,7 +1764,7 @@ void FUN_L13_002b50d8(RsMoby *m) { break; } case 6: - if (FUN_L00_0025c698(m, v->x120) & 1) { + if (mine_fall(m, v->x120) & 1) { qzero(v->x120); m->state = 3; if (m->b53 != 5) { @@ -1786,11 +1791,11 @@ void FUN_L13_002b50d8(RsMoby *m) { int t; m->h34 &= 0xEFFF; - if (FUN_L00_0025c698(m, v->x120) & 0x140) { + if (mine_fall(m, v->x120) & 0x140) { clear_u64_value(&va); t = (int)((float)scale_game_frames_alt(1) * 60.0f); if (FUN_L01_002efbf8(D_L13_001613B0, 3, t) >= 0) { - FUN_L00_0025f090(m, &m->pos, 4, 0.5f, 13.0f); + cart_burst(m, &m->pos, 4, 0.5f, 13.0f); } mark_moby_for_removal_c(m); return; @@ -1806,7 +1811,7 @@ void FUN_L13_002b50d8(RsMoby *m) { float a; r = absolute_float(m->pos.f[2] - tgt.pos.f[2]); - r = r / FUN_001f9b80(&m->pos, &tgt); + r = r / vector_distance(&m->pos, &tgt); if (v->w21C != -1) { FUN_L01_0028b5e0(m, D_L13_001B07B0[v->w21C], &v->v1D0, &vb); } else { @@ -1819,7 +1824,7 @@ void FUN_L13_002b50d8(RsMoby *m) { va.f[2] = 0.0f; res = FUN_L00_00258b50(m, &v->w180, &va, &vb, 1.0f); subtract_vector_xyz(&vc, &tgt, &v->v1D0); - if (FUN_001f9b80(&m->pos, &tgt) < 1.5f && r <= 1.0f) { + if (vector_distance(&m->pos, &tgt) < 1.5f && r <= 1.0f) { m->state = 4; if (m->b53 != 6) { blend_moby_animation_c(m, 6, 0, scale_game_frames_alt(3)); @@ -1872,7 +1877,7 @@ void FUN_L13_002b50d8(RsMoby *m) { if (o->hA6 != 0 && o->hA6 != 0x3F) { continue; } - if (FUN_001f9b80(&vb, &o->pos) < 2.0f) { + if (vector_distance(&vb, &o->pos) < 2.0f) { float z; float a; float d; @@ -1899,7 +1904,7 @@ void FUN_L13_002b50d8(RsMoby *m) { v->f198 = 0.0f; m->pos.f[2] = g; } - if (v->p218 == 0 || FUN_001f9b80(&m->pos, v->p218 + 0x10) > convert_integer_to_float(v->h216)) { + if (v->p218 == 0 || vector_distance(&m->pos, v->p218 + 0x10) > convert_integer_to_float(v->h216)) { m->state = 5; if (m->b53 != 5) { blend_moby_animation_c(m, 5, 0, scale_game_frames_alt(3)); @@ -1909,7 +1914,7 @@ void FUN_L13_002b50d8(RsMoby *m) { break; } } - FUN_L00_0025d538(m, v->x110); + trooper_anim_finish(m, v->x110); if (m->pos.f[0] < 2.0f || m->pos.f[0] > 1021.0f || m->pos.f[1] < 2.0f || m->pos.f[1] > 1021.0f || m->pos.f[2] < 2.0f || m->pos.f[2] > 1021.0f) { @@ -2082,9 +2087,9 @@ extern f32 distance_xyz(void *, void *) __asm__("func_001F9B48"); extern f32 fast_add_rotations(f32, f32) __asm__("func_001FA580"); extern f32 fast_sin(f32) __asm__("func_001F9DE0"); extern float D_L13_001672E0[]; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_L00_0025e310(float); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern float seg_sqrt(float) __asm__("func_001F9988"); extern int frame_count __asm__("D_L13_0015F5CC"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); @@ -2176,13 +2181,13 @@ int FUN_L13_002b8be0(int a, char *p, char *a2, void *a3, float f0, float f1, flo { float x = (v[0] - scr[4]) * 0.0625f; float y = (v[1] - scr[5]) * 0.0625f; - float ang = FUN_L00_0025e310(convert_integer_to_float(frame_count) / 20.0f); + float ang = normalize_angle(convert_integer_to_float(frame_count) / 20.0f); FUN_L13_002b7d50(tab, 0x1E, 0xFFFFF3, 0x500000FF, x, y, 1.0f, ang); } { float x = (v[0] - scr[4]) * 0.0625f; float y = (v[1] - scr[5]) * 0.0625f; - float ang = FUN_L00_0025e310(convert_integer_to_float(frame_count) / 20.0f); + float ang = normalize_angle(convert_integer_to_float(frame_count) / 20.0f); FUN_L13_002b7d50(tab, 0x1E, 0xFFFFF3, 0x500000FF, x, y, 1.3f, -ang); } } @@ -2205,7 +2210,7 @@ int FUN_L13_002b8be0(int a, char *p, char *a2, void *a3, float f0, float f1, flo h = absolute_float(fast_subtract_rotations(fast_arc_tan(*(float *)(m + 0x10) - *(float *)((char *)a + 0x10), *(float *)(m + 0x14) - *(float *)((char *)a + 0x14)), *(float *)(p + 0x38))); - k = absolute_float(fast_subtract_rotations(-fast_arc_tan(FUN_001f9b80((char *)a + 0x10, np), + k = absolute_float(fast_subtract_rotations(-fast_arc_tan(vector_distance((char *)a + 0x10, np), *(float *)(m + 0x18) - *(float *)((char *)a + 0x18)), *(float *)(p + 0x34))); s = seg_sqrt(h * h + k * k); @@ -2216,13 +2221,13 @@ int FUN_L13_002b8be0(int a, char *p, char *a2, void *a3, float f0, float f1, flo { float x = (v[0] - scr[4]) * 0.0625f; float y = (v[1] - scr[5]) * 0.0625f; - float ang = FUN_L00_0025e310(convert_integer_to_float(frame_count) / 20.0f); + float ang = normalize_angle(convert_integer_to_float(frame_count) / 20.0f); FUN_L13_002b7d50(tab, 0x1E, 0xFFFFF3, 0x500000FF, x, y, 1.0f, ang); } { float x = (v[0] - scr[4]) * 0.0625f; float y = (v[1] - scr[5]) * 0.0625f; - float ang = FUN_L00_0025e310(convert_integer_to_float(frame_count) / 20.0f); + float ang = normalize_angle(convert_integer_to_float(frame_count) / 20.0f); FUN_L13_002b7d50(tab, 0x1E, 0xFFFFF3, 0x500000FF, x, y, 1.3f, -ang); } } else { @@ -2243,7 +2248,7 @@ int FUN_L13_002b8be0(int a, char *p, char *a2, void *a3, float f0, float f1, flo { float x = (v[0] - scr[4]) * 0.0625f; float y = (v[1] - scr[5]) * 0.0625f; - float ang = FUN_L00_0025e310(convert_integer_to_float(frame_count) / 20.0f); + float ang = normalize_angle(convert_integer_to_float(frame_count) / 20.0f); FUN_L13_002b7d50(D_L13_001CBD40, 0x1E, 0xFFFFF3, 0xFF00FF00, x, y, 1.0f, -ang); } } @@ -2257,7 +2262,7 @@ int FUN_L13_002b8be0(int a, char *p, char *a2, void *a3, float f0, float f1, flo { float x = (v[0] - scr[4]) * 0.0625f; float y = (v[1] - scr[5]) * 0.0625f; - float ang = FUN_L00_0025e310(convert_integer_to_float(frame_count) / 20.0f); + float ang = normalize_angle(convert_integer_to_float(frame_count) / 20.0f); FUN_L13_002b7d50(D_L13_001CBD40, 0x1E, 0xFFFFF3, 0xFF00FF00, x, y, 1.0f, -ang); } } @@ -2283,9 +2288,9 @@ int FUN_L13_002b8be0(int a, char *p, char *a2, void *a3, float f0, float f1, flo extern char D_L13_001670D0[]; extern int D_L13_0015F5C4; extern char D_0013C940[]; -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); int FUN_L13_002b8be0(int a, char *p, char *a2, void *a3, float f0, float f1, float f2, char *cur, char *g); -extern void FUN_001f9740(int *arg0); +extern void tick_countdown_32(int *arg0) __asm__("FUN_001f9740"); #define W(p, o) (*(int *)((char *)(p) + (o))) #define P(p, o) (*(char **)((char *)(p) + (o))) @@ -2300,7 +2305,7 @@ void FUN_L13_002b95b8(int a, char *p) { char *r; float v[4]; if (!(D_L13_0015F5C4 >= 3 && D_L13_0015F5C4 <= 4)) { - FUN_001f9740((int *)(p + 0x8C)); + tick_countdown_32((int *)(p + 0x8C)); } if (W(p, 0x8C) != 0 && P(p, 0x88) != 0 && H(P(p, 0x88), 0xA6) == W(p, 0x124) && B(P(p, 0x88), 0x20) != 0xFE && B(P(p, 0x88), 0x20) != 0xFD) { @@ -2339,7 +2344,7 @@ void FUN_L13_002b95b8(int a, char *p) { } if (r != P(p, 0x88)) { W(p, 0x118) = W(p, 0x118) + 1; - if (FUN_001f96f8(0x3C) < W(p, 0x118)) { + if (scale_game_frames(0x3C) < W(p, 0x118)) { W(p, 0xEC) = 0; W(p, 0x124) = -1; W(p, 0x88) = 0; @@ -2361,7 +2366,7 @@ void FUN_L13_002b95b8(int a, char *p) { extern char *msg_string(s32) __asm__("func_001FDD10"); extern char D_L13_001CBC60[]; -extern float FUN_L00_0025e310(float); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern int D_L13_001CBE70[]; extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern s32 font_print_center_large(s32, s32, u64, s32, s32) __asm__("func_001F6C20"); @@ -2420,7 +2425,7 @@ void FUN_L13_002b97f8(char *moby) { k = t * 5.0f + 1.0f; if (m > 1.0f) m = 1.0f; c = func_001FA898_r(m * 96.0f); - func_L13_002B9590_f(convert_integer_to_float(sp10), convert_integer_to_float(sp14), k, FUN_L00_0025e310(convert_integer_to_float(frame_count) / 30.0f), 0, 0xFF, 0, c); + func_L13_002B9590_f(convert_integer_to_float(sp10), convert_integer_to_float(sp14), k, normalize_angle(convert_integer_to_float(frame_count) / 30.0f), 0, 0xFF, 0, c); *(int *)(d + 0xEC) = 0; } else { a = 0xFF; @@ -2498,18 +2503,18 @@ void FUN_L13_002b9df8(struct Moby *moby, char *obj, float p2, float p3) { char c[16]; char d[16]; build_spherical_offset(a, frame_time * 400.0f, p2, p3); - FUN_001f9a10(a, a, obj); + fast_vec_add(a, a, obj); if (fast_dec_timer(obj + 0x80) && (*(int *)(D_0013A4E0 + 0x2610) & 0x84)) { allocate_voice_for_target_entry(3, 0, (int)moby); fast_vec_normalize(c, a, 2.2f); moby_point_position(moby, 3 + (obj[0x61] & 1), b); - FUN_001f9a10(b, b, c); + fast_vec_add(b, b, c); FUN_L11_00308848(moby, a, b, 200.0f, -1.0f); - *(int *)(obj + 0x80) = FUN_001f96f8(4); + *(int *)(obj + 0x80) = scale_game_frames(4); obj[0x61] ^= 1; } fast_vec_normalize(a, a, 23.0f); - FUN_001f9a10(d, a, &moby->pos); + fast_vec_add(d, a, &moby->pos); FUN_L11_00311210(d, obj + 0xE0, obj + 0xE4, 0); } /* Fires a timed burst from a moby while a pad button is held and ammo remains. */ @@ -2530,13 +2535,13 @@ void FUN_L13_002b9f58(struct Moby *moby, char *obj) { *(short *)(obj + 0x6A) = t; moby_point_position(moby, t + 7, a); fast_vec_normalize(b, obj, 0.3f); - FUN_001f9a10(a, a, b); + fast_vec_add(a, a, b); s = frame_time * 100.0f; - h = FUN_001f96f8(300); + h = scale_game_frames(300); if (FUN_L13_002e6a58(moby, a, s, *(int *)(obj + 0xEC), pos, h) != 0) { allocate_voice_for_target_entry(2, 0, (int)moby); u[0x15F6]--; - *(int *)(obj + 0x84) = FUN_001f96f8(30); + *(int *)(obj + 0x84) = scale_game_frames(30); } } } @@ -2638,7 +2643,8 @@ extern int jet_allocate_voice(int,int,int) __asm__("FUN_0022da68"); extern int jet_check_trigger(void *,int) __asm__("FUN_00214720"); extern int jet_fast_dec_death_timer(void *) __asm__("FUN_001f9770"); -void FUN_L13_002bb068(Jet *m) { +void fighter_jet_update(Jet *m) __asm__("FUN_L13_002bb068"); +void fighter_jet_update(Jet *m) { JetData *d; JetVec impulse; int state,initial_state; @@ -2862,7 +2868,7 @@ void FUN_L13_002bb068(Jet *m) { } #ifdef NON_MATCHING #include "rnc/input/pad_state.h" -extern float FUN_L00_0025b8c0(float *, float *, float, float, float, float); +extern float vendor_spring(float *, float *, float, float, float, float) __asm__("FUN_L00_0025b8c0"); extern float FUN_L00_0025bc98(float *, float, float *, int, float, float, float); extern float FUN_L13_002ba088(int, int, float, float, float, float, float); extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); @@ -2909,7 +2915,7 @@ void FUN_L13_002ba178(void *moby, void *obj) { m->flags &= 0xFEFF; *(u128 *)impulse = *(u128 *)velocity; if (B(m,0xBC) == 0) { - if (d->missile_index > FUN_001f96f8(120)) { + if (d->missile_index > scale_game_frames(120)) { if (((struct PadState *)D_0013C940)->raw_pressed & 0x40) { id = d->weapon_sound; if (id != -1) { @@ -2946,7 +2952,7 @@ void FUN_L13_002ba178(void *moby, void *obj) { } else { d->speed = 0.0001f; } - if (d->missile_index > FUN_001f96f8(5)) { + if (d->missile_index > scale_game_frames(5)) { float x, y, turn_rate, pitch_rate; turn_rate = frame_scale*0.1f; pitch_rate = frame_scale*0.25f; @@ -2961,8 +2967,8 @@ void FUN_L13_002ba178(void *moby, void *obj) { x *= multiplier; y *= multiplier; } - FUN_L00_0025b8c0(&F(d,0x6C),&F(d,0x90),x,frame_scale_sq*0.03f,frame_scale_sq,turn_rate); - FUN_L00_0025b8c0(&F(d,0x70),&F(d,0x94),y,frame_scale_sq*0.03f,frame_scale_sq,pitch_rate); + vendor_spring(&F(d,0x6C),&F(d,0x90),x,frame_scale_sq*0.03f,frame_scale_sq,turn_rate); + vendor_spring(&F(d,0x70),&F(d,0x94),y,frame_scale_sq*0.03f,frame_scale_sq,pitch_rate); FUN_L00_0025bc98(&d->angles[0],F(d,0x6C),&F(d,0x98),0,frame_scale_sq*0.05f,frame_scale_sq,frame_scale); d->angles[1] = fast_subtract_rotations(d->angles[1],F(d,0x70)*(frame_scale*0.012271847f)); d->angles[2] = fast_subtract_rotations(d->angles[2],F(d,0x6C)*(frame_scale*0.012271847f)); @@ -3019,9 +3025,9 @@ void FUN_L13_002ba178(void *moby, void *obj) { F(d,0xB8)=offsets[d->animation_frame][1]; F(d,0xBC)=offsets[d->animation_frame][2]; } else { - FUN_L00_0025b8c0(&F(d,0xB4),&F(d,0xC8),offsets[d->animation_frame][0],frame_scale_sq*0.15f,frame_scale_sq*0.8f,frame_scale); - FUN_L00_0025b8c0(&F(d,0xB8),&F(d,0xCC),offsets[d->animation_frame][1],frame_scale_sq*0.15f,frame_scale_sq*0.8f,frame_scale); - FUN_L00_0025b8c0(&F(d,0xBC),&F(d,0xD0),offsets[d->animation_frame][2],frame_scale_sq*0.15f,frame_scale_sq*0.8f,frame_scale); + vendor_spring(&F(d,0xB4),&F(d,0xC8),offsets[d->animation_frame][0],frame_scale_sq*0.15f,frame_scale_sq*0.8f,frame_scale); + vendor_spring(&F(d,0xB8),&F(d,0xCC),offsets[d->animation_frame][1],frame_scale_sq*0.15f,frame_scale_sq*0.8f,frame_scale); + vendor_spring(&F(d,0xBC),&F(d,0xD0),offsets[d->animation_frame][2],frame_scale_sq*0.15f,frame_scale_sq*0.8f,frame_scale); } offset[0]=F(d,0xB4); offset[1]=F(d,0xB8); offset[2]=F(d,0xBC); offset[3]=0; euler_rotation_basis(matrix,d->angles); @@ -3042,12 +3048,12 @@ void FUN_L13_002ba178(void *moby, void *obj) { FUN_L00_002eaa30(rotation); if (H(D_L13_00167100,0x86)!=5) { stub_printf(D_L13_001F4450); - FUN_L00_002eaaa0(camera_position,rotation,0,0,0); + jet_mount(camera_position,rotation,0,0,0); } - FUN_L00_0025b8c0(&F(d,0xB0),&F(d,0xC0),speed_fraction*0.34906578f+1.134464f,0.05f,1.0f,1.0f); + vendor_spring(&F(d,0xB0),&F(d,0xC0),speed_fraction*0.34906578f+1.134464f,0.05f,1.0f,1.0f); angle=F(d,0xB0)*0.5f; y=fast_sin(angle); - y=y/FUN_001f9dc8(angle); + y=y/fast_cos(angle); D_L13_0016CDF0=y; update_view_context(); m->rotation[0]=fast_add_rotations(d->angles[0],F(d,0x6C)*0.5f); @@ -3074,15 +3080,15 @@ void FUN_L13_002ba178(void *moby, void *obj) { normalize_vector_xyz(impulse,impulse,frame_time+frame_time); normalize_vector_xyz(vertical,((struct JetCollision *)D_L13_00174140)->normal,1.0f); jet_explosion(m,impulse,0,8.0f,100.0f,30,10,24,16.0f,8.0f,9.0f,6,1.0f,50.0f,1,1,-1,0); - d->death_timer=FUN_001f96f8(240); m->state=6; + d->death_timer=scale_game_frames(240); m->state=6; } - d->timer=FUN_001f96f8(10); + d->timer=scale_game_frames(10); } } else { ((JetPlayer *)D_0013F350)->health=0.0f; jet_explosion(m,impulse,0,8.0f,100.0f,30,10,24,16.0f,8.0f,9.0f,6,1.0f,50.0f,1,1,-1,0); m->flags|=0x41; - d->death_timer=FUN_001f96f8(240); m->state=6; + d->death_timer=scale_game_frames(240); m->state=6; } } diff --git a/src/overlays/l13/gameplay/entities/qwarks_starfighter_part.c b/src/overlays/l13/gameplay/entities/qwarks_starfighter_part.c index db9201e1ee..4333f891d4 100644 --- a/src/overlays/l13/gameplay/entities/qwarks_starfighter_part.c +++ b/src/overlays/l13/gameplay/entities/qwarks_starfighter_part.c @@ -441,9 +441,9 @@ extern f32 fast_subtract_rotations(f32, f32) __asm__("func_001FA5C8"); extern f32 random_float_between(f32, f32) __asm__("func_002132A8"); extern float D_L13_00160660[] __attribute__((section(".sdata"))); extern float vector_distance_xy(void *, void *) __asm__("FUN_001f9b80"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float FUN_L00_00258110(float *vel, float cur, float target, float k, float d, float max); -extern float FUN_L00_0025e310(float); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern float fast_difference_between_rotations(float, float) __asm__("func_001FA688"); extern int D_0015ED84; extern int D_0015EEA4; @@ -453,9 +453,9 @@ int D_L13_00161954 = -1; extern int D_L13_001D3448[]; extern int D_L13_001D34D8[]; extern int DebugPrint_alt() __asm__("FUN_001e93b0"); -extern int FUN_001efa68(void *, void *, int, void *, void *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); -extern int FUN_001fa728(void *, float); +extern int fast_bsphere_check(void *, float) __asm__("FUN_001fa728"); extern int FUN_L00_0023e738(float *, float, float, float, float, float); extern int FUN_L01_0028b510(void *, void *, float); extern int FUN_L13_002e9160(void *, void *, int, int); @@ -472,8 +472,8 @@ extern void FUN_L00_00235ea0(); extern void FUN_L00_0023e838(int); extern void FUN_L00_0024f7c8(void *, int, void *); extern void FUN_L00_00258278(void *moby, float *vel, float target, float k, float d, float max); -extern void FUN_L00_0025d538(void *, void *); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, float, int, float, float, int, int, int, int); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L13_002e8920(void *, void *); extern void splash_L13(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L13_002e8d28(void *, void *); @@ -657,7 +657,7 @@ void FUN_L13_002eb098(Moby388 *moby) { if (moby->bBC != 4) { FUN_L13_002e9a48(moby, data); } else { - FUN_L00_0025d538(moby, (char *)data + 0x60); + trooper_anim_finish(moby, (char *)data + 0x60); } break; case 5: { @@ -712,14 +712,14 @@ void FUN_L13_002eb098(Moby388 *moby) { subtract_vector_xyz(ray_start, data->v80, joint); normalize_vector_xyz(ray_start, ray_start, 8.0f); add_vector_xyz(ray_start, ray_start, joint); - if (FUN_001efa68(ray_start, data->v80, 0, moby, 0) != 0) { + if (collision_line(ray_start, data->v80, 0, moby, 0) != 0) { if (D_L13_00174158[0] == 0 || D_L13_00174158[0]->cls_id == 0xD4) { data->i100 = 0; } } qcopy(probe, data->v80); probe[3] = 1.0f; - if (FUN_001fa728(probe, 100.0f) <= 0 && moby->b31 == 0) { + if (fast_bsphere_check(probe, 100.0f) <= 0 && moby->b31 == 0) { DebugPrint_alt(D_L13_001F4F18); data->i100 = 0; } @@ -730,8 +730,8 @@ void FUN_L13_002eb098(Moby388 *moby) { } else { char *hero = ((char *)&D_0013F350); float yaw, pitch, distance; - yaw = FUN_001f9e90(*(float *)(hero + 0x80) - moby->pos[0], *(float *)(hero + 0x84) - moby->pos[1]); - pitch = -FUN_001f9e90(vector_distance_xy(moby->pos, hero + 0x80), *(float *)(hero + 0x88) - moby->pos[2]); + yaw = fast_arc_tan(*(float *)(hero + 0x80) - moby->pos[0], *(float *)(hero + 0x84) - moby->pos[1]); + pitch = -fast_arc_tan(vector_distance_xy(moby->pos, hero + 0x80), *(float *)(hero + 0x88) - moby->pos[2]); FUN_L13_002e9018(moby, data, yaw, pitch); if (*(Moby388 **)(hero + 0x15F0) != 0 && (*(Moby388 **)(hero + 0x15F0))->cls_id == 0x45) { (*(Moby388 **)(hero + 0x15F0))->bBC = 1; @@ -756,17 +756,17 @@ void FUN_L13_002eb098(Moby388 *moby) { float yaw_error, abs_yaw_error, pitch_error, abs_pitch_error; qcopy(ship_moby->pos, data->v80); ship = (char *)ship_moby->d; - yaw_error = fast_subtract_rotations(FUN_001f9e90(moby->pos[0] - ship_moby->pos[0], moby->pos[1] - ship_moby->pos[1]), *(float *)(ship + 0x38)); + yaw_error = fast_subtract_rotations(fast_arc_tan(moby->pos[0] - ship_moby->pos[0], moby->pos[1] - ship_moby->pos[1]), *(float *)(ship + 0x38)); abs_yaw_error = absolute_float(yaw_error); - pitch_error = fast_subtract_rotations(-FUN_001f9e90(vector_distance_xy((*(Moby388 **)(hero + 0x15F0))->pos, moby->pos), + pitch_error = fast_subtract_rotations(-fast_arc_tan(vector_distance_xy((*(Moby388 **)(hero + 0x15F0))->pos, moby->pos), moby->pos[2] - (*(Moby388 **)(hero + 0x15F0))->pos[2]), *(float *)(ship + 0x34)); abs_pitch_error = absolute_float(pitch_error); if (abs_yaw_error > 0.38397244f) { - *(float *)(ship + 0x38) = fast_add_rotations(*(float *)(ship + 0x38), FUN_L00_0025e310((abs_yaw_error - 0.38397244f) / 0.17453292f * yaw_error)); + *(float *)(ship + 0x38) = fast_add_rotations(*(float *)(ship + 0x38), normalize_angle((abs_yaw_error - 0.38397244f) / 0.17453292f * yaw_error)); } if (abs_pitch_error > 0.38397244f) { - *(float *)(ship + 0x34) = fast_add_rotations(*(float *)(ship + 0x34), FUN_L00_0025e310((abs_pitch_error - 0.38397244f) / 0.17453292f * pitch_error)); + *(float *)(ship + 0x34) = fast_add_rotations(*(float *)(ship + 0x34), normalize_angle((abs_pitch_error - 0.38397244f) / 0.17453292f * pitch_error)); } } } @@ -774,11 +774,11 @@ void FUN_L13_002eb098(Moby388 *moby) { if (moby->bBC != 4) { FUN_L13_002e9a48(moby, data); } else { - FUN_L00_0025d538(moby, (char *)data + 0x60); + trooper_anim_finish(moby, (char *)data + 0x60); } { char *hero = ((char *)&D_0013F350); - if (fast_difference_between_rotations(moby->rot[2], FUN_001f9e90(*(float *)(hero + 0x80) - moby->pos[0], *(float *)(hero + 0x84) - moby->pos[1])) < 1.0471976f) { + if (fast_difference_between_rotations(moby->rot[2], fast_arc_tan(*(float *)(hero + 0x80) - moby->pos[0], *(float *)(hero + 0x84) - moby->pos[1])) < 1.0471976f) { enqueue_callback_list_1(FUN_L13_002ea8c8, moby); } } @@ -822,7 +822,7 @@ void FUN_L13_002eb098(Moby388 *moby) { Path388 *path = (Path388 *)walker_paths[data->paths[data->b13B]]; int i = data->s9C; int n = path->n; - target_yaw = FUN_001f9e90(path->pts[(i + 3 >= n - 1) ? n - 1 : i + 3][0] - path->pts[i][0], + target_yaw = fast_arc_tan(path->pts[(i + 3 >= n - 1) ? n - 1 : i + 3][0] - path->pts[i][0], path->pts[(i + 3 < n - 1) ? i + 3 : n - 1][1] - path->pts[i][1]); } { @@ -833,7 +833,7 @@ void FUN_L13_002eb098(Moby388 *moby) { Path388 *path2 = (Path388 *)walker_paths[data->paths[data->b13B]]; int i2 = data->s9C; int n2 = path2->n; - target_pitch = -FUN_001f9e90(flat_distance, path2->pts[(i2 + 3 >= n2 - 1) ? n2 - 1 : i2 + 3][2] - path2->pts[i2][2]); + target_pitch = -fast_arc_tan(flat_distance, path2->pts[(i2 + 3 >= n2 - 1) ? n2 - 1 : i2 + 3][2] - path2->pts[i2][2]); } FUN_L00_00258278(moby, &data->fA8, target_yaw, frame_time_sq * 3.1415927f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); moby->rot[1] = FUN_L00_00258110(&data->fA4, moby->rot[1], target_pitch, frame_time_sq * 3.1415927f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); @@ -876,7 +876,7 @@ void FUN_L13_002eb098(Moby388 *moby) { moby->rot[1] = *(float *)(view + 0x154); moby->scale *= 0.98f; if (data->iF8 == scale_game_frames_alt(0x1E)) { - FUN_L00_0025e450(moby, &data->f70, 0, 0.0f, 0.0f, 0x1E, 8, 0x20, 5.0f, 3.0f, 0.0f, 7, 1.0f, 0.0f, 1, 5, -1, 0); + spawn_explosion(moby, &data->f70, 0, 0.0f, 0.0f, 0x1E, 8, 0x20, 5.0f, 3.0f, 0.0f, 7, 1.0f, 0.0f, 1, 5, -1, 0); } func_L13_002E9F90_2(moby, data); if (tick_countdown_32_alt(&data->iF8) != 0) { @@ -940,7 +940,7 @@ void FUN_L13_002eb098(Moby388 *moby) { } path = walker_paths[data->paths[0]]; qcopy(moby->pos, path + 0x10); - moby->rot[2] = FUN_001f9e90(*(float *)(path + 0x20) - moby->pos[0], *(float *)(path + 0x24) - moby->pos[1]); + moby->rot[2] = fast_arc_tan(*(float *)(path + 0x20) - moby->pos[0], *(float *)(path + 0x24) - moby->pos[1]); data->b10C = 1; data->s9C = 0; data->s9E = 0; @@ -1205,10 +1205,10 @@ void FUN_L13_002ece00(struct Moby *moby) { #include "types.h" extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void euler_rotation_basis(void *, void *) __asm__("FUN_001fa030"); -extern void FUN_001f9cf8(void *, void *, void *); +extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern int collect_mobies_in_sphere(void *, float, int, void *, void *) __asm__("FUN_L00_001f2868"); extern void FUN_L10_0024c7f0(float, void *, void *, int, void *); extern void *memcpy(void *, const void *, unsigned int); @@ -1235,8 +1235,8 @@ void FUN_L13_002ed158(void *moby, void *data) { radius = (float)max_size * 0.5f; qzero(query); query[2] = radius; - FUN_001f9cf8(query, query, matrix); - FUN_001f9a10(query, query, moby + 0x10); + transform_vector_by_basis(query, query, matrix); + fast_vec_add(query, query, moby + 0x10); count = collect_mobies_in_sphere(query, radius, 0x10, moby, 0); if (count == 0) return; candidates = __builtin_alloca(((unsigned)count << 5) >> 3); @@ -1245,7 +1245,7 @@ void FUN_L13_002ed158(void *moby, void *data) { candidate = *(void **)((u32)candidates + (i << 2)); if (candidate == 0 || (unsigned char)candidate[0x20] == 0xfe || (unsigned char)candidate[0x20] == 0xfd) continue; - FUN_001f9a28(candidate_pos, candidate + 0x10, moby + 0x10); + fast_vec_sub(candidate_pos, candidate + 0x10, moby + 0x10); transpose_rotation_matrix(rotation_matrix, matrix); transform_vector(local_pos, candidate_pos, rotation_matrix); qcopy(probe, local_pos); @@ -1260,8 +1260,8 @@ void FUN_L13_002ed158(void *moby, void *data) { if (probe[2] < -height_tolerance) probe[2] = (float)-half_height * 0.5f; else if (height_tolerance < probe[2]) probe[2] = height_limit; probe[1] = 0.0f; - FUN_001f9cf8(probe, probe, matrix); - FUN_001f9a10(probe, probe, moby + 0x10); + transform_vector_by_basis(probe, probe, matrix); + fast_vec_add(probe, probe, moby + 0x10); hit_count = collect_mobies_in_sphere(probe, 0.7f, 0x10, moby, 0); for (j = 0; j < hit_count; j++) { if (sphere_hits_ed158[j] == candidate) @@ -1276,13 +1276,14 @@ extern void stub_printf(char *, int, int) __asm__("FUN_001e93b0"); extern void glow_n(void *, int, int, int) __asm__("FUN_L00_002502f0"); extern void FUN_L13_002ed158(void *, void *); extern int ftoi_n(float) __asm__("FUN_001fa6d0"); -extern void stop_n(int) __asm__("FUN_L00_0023e838"); +extern void FUN_L00_0023e838(int); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); -extern void spin_n(void *, int, int) __asm__("FUN_L00_0024efb0"); +extern void FUN_L00_0024efb0_c(void *, int, int) __asm__("FUN_L00_0024efb0"); extern s32 D_0014C190_257218[][64] __asm__("D_0014C190"); extern char D_L13_001F4FB0[]; -void FUN_L13_002ed4a8(unsigned char *m) { +void forcefield_update(unsigned char *m) __asm__("FUN_L13_002ed4a8"); +void forcefield_update(unsigned char *m) { char *d = *(char **)(m + 0x78); int a; switch (m[0x20]) { @@ -1318,7 +1319,7 @@ void FUN_L13_002ed4a8(unsigned char *m) { break; case 3: if (*(short *)(d + 0xE) != -1) { - stop_n(*(short *)(d + 0xE)); + FUN_L00_0023e838(*(short *)(d + 0xE)); *(short *)(d + 0xE) = -1; } mark_moby_for_removal(m); @@ -1333,7 +1334,7 @@ void FUN_L13_002ed4a8(unsigned char *m) { *(short *)(d + 0xC) += 0x1000; a = 0x10C0; } - spin_n(*(void **)(m + 0x24), a, 0); + FUN_L00_0024efb0_c(*(void **)(m + 0x24), a, 0); } #define NOT_SDA @@ -1351,7 +1352,8 @@ typedef struct { extern char D_0013E030[]; -void FUN_L13_002f3750(Level13VendorMoby *moby) { +void purple_ship_update(Level13VendorMoby *moby) __asm__("FUN_L13_002f3750"); +void purple_ship_update(Level13VendorMoby *moby) { if (*(void **)(D_0013E030) != moby) { moby->field94 = 0; moby->flags |= 3; @@ -1546,7 +1548,7 @@ extern int D_L13_0015FFD8; /* no foreign declaration */ extern int debug_print_alt() __asm__("FUN_001e93b0"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); extern void FUN_L00_0024efb0(unsigned char *, int, int); -extern void FUN_L00_002502f0(void *, int, int, int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); extern int func_001FA898_d(float) __asm__("FUN_001fa6d0"); void FUN_L13_002f8a78(char *moby) { @@ -1582,7 +1584,7 @@ void FUN_L13_002f8a78(char *moby) { mark_moby_for_removal(moby); return; } - FUN_L00_002502f0(moby, 0x80, 0x80, 0x80); + set_moby_color(moby, 0x80, 0x80, 0x80); *(unsigned short *)(moby + 0x34) |= 0xA08; if (*(int *)(d + 0x18) == 0) { *(float *)(d + 0x10) = 1.0f; @@ -1649,3 +1651,5 @@ void FUN_L13_002f8a78(char *moby) { } FUN_L00_0024efb0(*(unsigned char **)(moby + 0x24), step, 0); } + +char D_L13_001F4F38[] = "tractor too long, abort\n"; diff --git a/src/overlays/l13/gameplay/entities/rocket.c b/src/overlays/l13/gameplay/entities/rocket.c index 15b6f72412..4827e26071 100644 --- a/src/overlays/l13/gameplay/entities/rocket.c +++ b/src/overlays/l13/gameplay/entities/rocket.c @@ -75,16 +75,16 @@ void FUN_L13_00305988(struct Moby *moby, char *pos, int arg2, float arg3) { FUN_L00_00250df8(moby); } extern char *FUN_L00_0025a420(void *, int, int); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void set_vector_length_xy(void *, void *, float) __asm__("FUN_001f9c48"); extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern float vector_distance_xy(void *, void *) __asm__("FUN_001f9b80"); -extern float FUN_001fa6c0(int); -extern int FUN_001f96f8(int); +extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int FUN_001fa6d0(float); -extern int FUN_001efa68(void *, void *, int, void *, void *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern float FUN_002132a8(float, float); extern int FUN_L00_002712b8(void *, void *, int, int, int, int, float, float, float, float, float); @@ -99,6 +99,7 @@ typedef struct { float x, y, z, w; } __attribute__((aligned(16))) L13Vector_5a58; +void FUN_L13_00305a58(struct Moby *moby); void FUN_L13_00305a58(struct Moby *moby) { extern struct { char pad[0x18]; struct Moby *moby; int pad1; L13Vector_5a58 pos; L13Vector_5a58 pad2; L13Vector_5a58 matrix; } D_L13_00174140; extern int D_L13_0015F580; @@ -145,13 +146,13 @@ void FUN_L13_00305a58(struct Moby *moby) { (*(struct Moby **)(target + 0x20))->oclass == 0x1df) goto special; } - FUN_001f9a10(&moby->pos, &moby->pos, data); + fast_vec_add(&moby->pos, &moby->pos, data); for (i = 0; i < 4; i++) { - fast_vec_scale(&work.direction, data, -FUN_001fa6c0(i) * 0.25f); - FUN_001f9a10(&work.velocity, &moby->pos, &work.direction); + fast_vec_scale(&work.direction, data, -convert_integer_to_float(i) * 0.25f); + fast_vec_add(&work.velocity, &moby->pos, &work.direction); length = FUN_002132a8(25000.0f, 35000.0f); target = (struct Moby *)FUN_L00_002712b8( - &work.velocity, &D_L13_0015F580, FUN_001f96f8(15), 0x60, 0x4040ff, 3, + &work.velocity, &D_L13_0015F580, scale_game_frames(15), 0x60, 0x4040ff, 3, length, 500.0f, 1.0f, -0.0004f, 0.0f); if (target != 0) *((char *)target + 9) = FUN_001fa6d0(4.0f) - 0x80; @@ -175,7 +176,7 @@ void FUN_L13_00305a58(struct Moby *moby) { *(OvlQuad *)&work.direction = *(OvlQuad *)&work.random_direction; length = fast_vec_length(&work.random_direction); fast_vec_normalize(&work.direction, &work.direction, length * 0.1f); - FUN_001f9a10(&work.direction, &work.random_direction, &work.direction); + fast_vec_add(&work.direction, &work.random_direction, &work.direction); fast_vec_normalize(&work.direction, &work.direction, FUN_002132a8(D_0015ED6C + D_0015ED6C, D_0015ED6C * 4.0f)); FUN_L07_0029a2a0(&moby->pos, &work.direction); @@ -184,7 +185,7 @@ void FUN_L13_00305a58(struct Moby *moby) { FUN_L13_003060b8(moby); goto remove; } - if (FUN_001efa68(&work.old_pos, &moby->pos, stationary, + if (collision_line(&work.old_pos, &moby->pos, stationary, moby, work.hit) == 0) goto bounds; { @@ -204,11 +205,11 @@ void FUN_L13_00305a58(struct Moby *moby) { FUN_L00_001ff660(&work.direction, data, &D_L13_00174140.matrix); length = fast_vec_length(&work.direction); fast_vec_normalize(&work.random_direction, &work.random_direction, length * 0.5f); - FUN_001f9a10(&work.random_direction, &work.direction, &work.random_direction); + fast_vec_add(&work.random_direction, &work.direction, &work.random_direction); fast_vec_normalize(&work.random_direction, &work.random_direction, FUN_002132a8(D_0015ED6C * 3.0f, D_0015ED6C * 6.0f)); FUN_L00_0026dd20(&moby->pos, &work.random_direction, 0x7f2f4f6f, - random_int_between(FUN_001f96f8(10), FUN_001f96f8(15)), 30000.0f); + random_int_between(scale_game_frames(10), scale_game_frames(15)), 30000.0f); } } { @@ -248,13 +249,13 @@ void FUN_L13_003060b8(struct Moby *moby) { } /* Ported from rac1-decomp (src/overlays/l13_gemlik/vendor_002EBD00.c: func_L13_003075E0), where it is exact; names translated to the US level program. */ -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, float, int, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); void FUN_L13_00306148(struct Moby *moby) { char vector[16]; clear_u64_value(vector); - FUN_L00_0025e450(moby, vector, &moby->pos, 0.0f, 0.0f, 5, 1, 5, 0.0f, 0.0f, 0.0f, 1.0f, 0, + spawn_explosion(moby, vector, &moby->pos, 0.0f, 0.0f, 5, 1, 5, 0.0f, 0.0f, 0.0f, 1.0f, 0, 0.0f, 0, 1, -1, 0); } #include "qcopy.h" @@ -265,7 +266,7 @@ extern char *func_0020D348_m_c(int); extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern void FUN_L00_00250df8(void *); extern void blend_moby_animation(void *, s32, s32, s32) __asm__("FUN_00212f90"); @@ -289,7 +290,7 @@ char *FUN_L13_003061c8(float speed, float *pos, float *dir, void *arg) { qcopy(m + 0x10, pos); qcopy(p + 0x10, pos); qcopy(p, dir); - blend_moby_animation(m, 1, 0, FUN_001f96f8(5)); + blend_moby_animation(m, 1, 0, scale_game_frames(5)); *(short *)(m + 0x34) = 0x208; *(int *)(p + 0x24) = 1; *(void **)(p + 0x20) = arg; @@ -419,7 +420,7 @@ void FUN_L13_00306300(struct Moby *moby) { } goto remove; } - if (FUN_001efa68(&work.old_pos, &moby->pos, stationary, *(void **)(data + 0x20), work.hit) == 0) + if (collision_line(&work.old_pos, &moby->pos, stationary, *(void **)(data + 0x20), work.hit) == 0) goto bounds; qcopy(&moby->pos, &D_L13_00174140.pos); if (moby->visible != 0) { @@ -512,7 +513,7 @@ void FUN_L13_003073c8(struct Moby *moby, void *vars) { fast_vec_normalize(random_direction, random_direction, scale * FUN_002132a8(3.5f, 6.5f) * D_0015ED6C); add_vector_xyz(random_direction, random_direction, &work.velocity); - lo = FUN_001f96f8(60); hi = FUN_001f96f8(120); + lo = scale_game_frames(60); hi = scale_game_frames(120); duration = random_int_between(lo, hi); FUN_L13_0030c138(&work.pos, random_direction, duration, 0); } while (i >= 0); @@ -538,7 +539,7 @@ void FUN_L13_003073c8(struct Moby *moby, void *vars) { fast_vec_normalize(random_direction, random_direction, scale * FUN_002132a8(6.5f, 10.0f) * D_0015ED6C); add_vector_xyz(random_direction, random_direction, &work.velocity); - lo = FUN_001f96f8(60); hi = FUN_001f96f8(90); + lo = scale_game_frames(60); hi = scale_game_frames(90); duration = random_int_between(lo, hi); FUN_L13_0030c138(&work.pos, random_direction, duration, 1); } while (i >= 0); @@ -554,8 +555,8 @@ void FUN_L13_003073c8(struct Moby *moby, void *vars) { add_vector_xyz(&work.random_direction, &work.random_direction, &work.direction); clamp_vector_length(&work.random_direction, &work.random_direction, D_0015ED6C * 10.0f); { - int lo = FUN_001f96f8(60); - int hi = FUN_001f96f8(90); + int lo = scale_game_frames(60); + int hi = scale_game_frames(90); duration = random_int_between(lo, hi); } FUN_L13_0030c138(&work.pos, &work.random_direction, duration, 1); @@ -578,13 +579,13 @@ void FUN_L13_003073c8(struct Moby *moby, void *vars) { color = &colors.v[random_integer_below(6)]; second_color = &second_colors.v[random_integer_below(6)]; { - int lo = FUN_001f96f8(15); - int hi = FUN_001f96f8(20); + int lo = scale_game_frames(15); + int hi = scale_game_frames(20); duration = random_int_between(lo, hi); } { - int lo = FUN_001f96f8(25); - int hi = FUN_001f96f8(30); + int lo = scale_game_frames(25); + int hi = scale_game_frames(30); duration2 = random_int_between(lo, hi); } FUN_L00_0026a9f0(&work.pos, &work.velocity, *color, *second_color, @@ -594,27 +595,27 @@ void FUN_L13_003073c8(struct Moby *moby, void *vars) { if (distance > 9.0f) { float amount; amount = scale * 4.0f; - duration = FUN_001f96f8(15); + duration = scale_game_frames(15); FUN_L00_002df808(moby, &work.pos, &work.velocity, duration, 127,127,127,32, amount); - duration = FUN_001f96f8(24); + duration = scale_game_frames(24); FUN_L00_002df808(moby, &work.pos, &work.velocity, duration, 32,127,0,32, amount); } { float amount; amount = scale * 4.0f; - duration = FUN_001f96f8(20); + duration = scale_game_frames(20); FUN_L00_002df808(moby, &work.pos, &work.velocity, duration, 63,127,0,48, amount); } { float amount; amount = scale * 3.5f; - duration = FUN_001f96f8(27); + duration = scale_game_frames(27); FUN_L00_002df808(moby, &work.pos, &work.velocity, duration, 16,96,0,64, amount); } { float amount; amount = scale * 3.0f; - duration = FUN_001f96f8(29); + duration = scale_game_frames(29); FUN_L00_002df808(moby, &work.pos, &work.velocity, duration, 0,32,0,32, amount); } } @@ -657,13 +658,14 @@ extern int allocate_voice_7b10(int, int, int) __asm__("FUN_0022da68"); extern int scale_game_frames_7b10(int) __asm__("FUN_001f96f8"); extern float random_float_7b10(float, float) __asm__("FUN_002132a8"); extern float int_to_float_7b10(int) __asm__("FUN_001fa6c0"); -extern float lerp_7b10(float, float, float) __asm__("FUN_L00_0025b6a8"); +extern float FUN_L00_0025b6a8(float, float, float); extern int collect_mobies_7b10(float, void *, int, void *, void *) __asm__("FUN_L00_001f2868"); extern void blast_mobys_7b10(struct Moby *, void *, void *, int, int, int, int, int, float, float, float) __asm__("FUN_L00_0025a9f8"); extern float scale_time_7b10(float) __asm__("FUN_001f96b0"); extern void remove_7b10(struct Moby *) __asm__("FUN_0020c828"); -void FUN_L13_00307b10(struct Moby *moby) { +void poison_vessel_update(struct Moby *moby) __asm__("FUN_L13_00307b10"); +void poison_vessel_update(struct Moby *moby) { struct BlastVars *vars = (struct BlastVars *)moby->pvars; struct BlastHit *hit; float *health; @@ -721,7 +723,7 @@ void FUN_L13_00307b10(struct Moby *moby) { case 1: qcopy(pos, &moby->pos); pos[2] += 1.0f; - hits = collect_mobies_7b10(lerp_7b10(D_L13_00161E30, D_L13_00161E34, + hits = collect_mobies_7b10(FUN_L00_0025b6a8(D_L13_00161E30, D_L13_00161E34, int_to_float_7b10(vars->timer) / int_to_float_7b10(scale_game_frames_7b10(D_L13_00161E2C))), pos, 0x10, moby, 0); @@ -807,7 +809,7 @@ extern float fast_add_rotations_c(float, float) __asm__("func_001FA580"); extern float fast_difference_between_rotations(float, float) __asm__("func_001FA688"); extern int D_L13_00161E70; extern int FUN_L00_00258b50(struct Moby *, void *, void *, void *, float); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int FUN_L00_00261b48(int, void *, void *, void *); extern s32 rand(void); extern s32 truncate_float_to_s32_c(f32) __asm__("func_001FA6D0"); @@ -816,7 +818,7 @@ extern void FUN_L00_00258278(void *moby, float *vel, float target, float k, floa extern void FUN_L00_00259888_c2(void *, struct Moby *, int, float, void *) __asm__("FUN_L00_00259888"); extern void FUN_L00_00259d08(void *, void *, void *, void *, struct Moby *, Shot_309330 *, int); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025be00(float *, float, float *, float, float, float); +extern void approach_angle(float *, float, float *, float, float, float) __asm__("FUN_L00_0025be00"); extern void FUN_L00_0025e450_c(void *, void *, void *, float, float, int, int, int, float, float, float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_00261d78(int, void *, void *, float); extern void FUN_L00_00263ac8(float, struct Moby *, int, void *); @@ -831,7 +833,8 @@ extern float D_L13_00161E74_gp __asm__("D_L13_00161E74") __attribute__((sda)); extern float D_L13_00161E78_gp __asm__("D_L13_00161E78") __attribute__((sda)); extern void func_L00_002592B0_309330(struct Moby *, float, float *, float, float, float) __asm__("FUN_L13_00263fc8"); -void FUN_L13_00307e98(struct Moby *moby) { +void blarg_space_commando_update(struct Moby *moby) __asm__("FUN_L13_00307e98"); +void blarg_space_commando_update(struct Moby *moby) { Vars_309330 *vars = (Vars_309330 *)moby->pvars; struct Moby *target; Vec4 point; @@ -868,7 +871,7 @@ void FUN_L13_00307e98(struct Moby *moby) { moby->state = 1; break; case 1: - FUN_L00_0025be00(&moby->rot.z, fast_arc_tan_c(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), + approach_angle(&moby->rot.z, fast_arc_tan_c(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), &vars->turn, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 3.1415927f); if (vars->unk164 != 2) { f32 dist = vector_distance_xy_alt(&moby->pos, &target->pos); @@ -925,7 +928,7 @@ void FUN_L13_00307e98(struct Moby *moby) { } break; case 4: - FUN_L00_0025be00(&moby->rot.z, fast_arc_tan_c(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), + approach_angle(&moby->rot.z, fast_arc_tan_c(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), &vars->turn, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 3.1415927f); if (tick_countdown_32_alt(&vars->timer) != 0) { moby->state = 3; @@ -947,7 +950,7 @@ void FUN_L13_00307e98(struct Moby *moby) { } break; case 5: - FUN_L00_0025be00(&moby->rot.z, fast_arc_tan_c(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), + approach_angle(&moby->rot.z, fast_arc_tan_c(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), &vars->turn, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 3.1415927f); FUN_L00_0024f7c8(moby, 0, &point); qcopy(&origin, &moby->pos); @@ -1098,7 +1101,7 @@ void FUN_L13_00307e98(struct Moby *moby) { } break; case 15: - hit = FUN_L00_0025c698(moby, &vars->vel); + hit = mine_fall(moby, &vars->vel); if (hit & 0x40) { qzero(&vars->vel); moby->state = 1; @@ -1110,7 +1113,7 @@ void FUN_L13_00307e98(struct Moby *moby) { } break; case 16: - if (FUN_L00_0025c698(moby, &vars->vel) & 0x160) { + if (mine_fall(moby, &vars->vel) & 0x160) { FUN_L00_0025e450_c(moby, &vars->vel, 0, 0.0f, 0.0f, 10, 3, 16, 4.0f, 2.0f, 9.0f, -1, 1.0f, 15.0f, 1, 1, -1, 0); mark_moby_for_removal_c2(moby); } @@ -1291,7 +1294,7 @@ void FUN_L13_00308d10(struct Moby *moby) { case 13: moby->flags &= ~0x1000; stop_moby_sound_8d10(moby, 0, -1); - FUN_L00_0025e450(moby, D_L13_00160680, 0, 0.0f, 0.0f, 10, 3, 16, 4.0f, 2.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, -1, 0); + spawn_explosion(moby, D_L13_00160680, 0, 0.0f, 0.0f, 10, 3, 16, 4.0f, 2.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, -1, 0); mark_moby_for_removal_8d10(moby); return; default: @@ -1366,8 +1369,8 @@ void FUN_L13_00309370(struct Moby *m) { } *(float *)(d + 0x1FC) = scale_game_frames(D_L13_00161E84); } -extern int FUN_001efa68(void *, void *, int, void *, void *); -extern int FUN_001f9740(int *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); +extern int fast_dec_timer(int *) __asm__("FUN_001f9740"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern float dot_vector_xyz(void *, void *) __asm__("FUN_001f9ab0"); extern float approach_value(float *, float, float) __asm__("FUN_00213ed8"); @@ -1409,7 +1412,7 @@ void FUN_L13_003094f8(struct Moby *moby) { float prior_height, dot; timer = func_001FA898_r(data->anchor.w); - FUN_001f9740(&timer); + fast_dec_timer(&timer); data->anchor.w = (float)timer; if (!timer) return; @@ -1436,12 +1439,12 @@ void FUN_L13_003094f8(struct Moby *moby) { upper.z = upper.z + 1.0f; qcopy(&lower, &data->point[15 - i]); lower.z = lower.z - 3.0f; - if (FUN_001efa68(&upper, &lower, 2, 0, 0) != 0 && prior_height < next.z) { + if (collision_line(&upper, &lower, 2, 0, 0) != 0 && prior_height < next.z) { approach_value(&next.z, D_L13_00174140.height + 0.35f, frame_time * 4.0f); } if (1.0f <= data->point[15 - i].w && - FUN_001efa68(&data->point[15 - i], &next, 2, 0, 0)) { + collision_line(&data->point[15 - i], &next, 2, 0, 0)) { next.w = 0.98f; } else { if (next.w < 1.0f) @@ -1462,7 +1465,7 @@ void FUN_L13_003094f8(struct Moby *moby) { work.hit.c = (unsigned short)moby->oclass; work.hit.a = 0; work.hit.b = 1; - FUN_001efa68(&data->point[j], &data->point[j + 1], 0, moby, &work.hit); + collision_line(&data->point[j], &data->point[j + 1], 0, moby, &work.hit); } j++; } while (j < 15); @@ -1511,18 +1514,18 @@ extern void *D_L13_001612D4; extern int D_L13_001612D8; int D_L13_00161EF0 = -1; extern unsigned short D_L13_00161EF4 __attribute__((sda)); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float rand_range_9e88(float, float) __asm__("FUN_002132a8"); extern int random_below_9e88(int) __asm__("FUN_00213260"); -extern void FUN_L01_002b7a48(void *, int); -extern void FUN_L01_002b7c68(void *, void *); -extern void FUN_L01_002b7ef0(float); -extern void FUN_L01_002b7fe0(void *, int); -extern void FUN_L01_002b8288(float, float, float, float, void *, int); -extern void FUN_L00_002a3ec8(float, float, float, float, void *, int, int); +extern void pool_init_tiles(void *, int) __asm__("FUN_L01_002b7a48"); +extern void pool_bind_tile(void *, void *) __asm__("FUN_L01_002b7c68"); +extern void pool_set_scale(float) __asm__("FUN_L01_002b7ef0"); +extern void pool_flush(void *, int) __asm__("FUN_L01_002b7fe0"); +extern void pool_ripple(float, float, float, float, void *, int) __asm__("FUN_L01_002b8288"); +extern void pool_splash(float, float, float, float, void *, int, int) __asm__("FUN_L00_002a3ec8"); extern int FUN_L01_00275690(float, void *); extern void enqueue_callback_list_1(void *, void *) __asm__("FUN_001f4600"); extern void FUN_L13_0030a460(void); @@ -1552,8 +1555,8 @@ void FUN_L13_00309e88(struct Moby *moby) { Light_9e88 *l; char *tb; float a; - FUN_L01_002b7a48(Tiles_9e88, 22); - FUN_L01_002b7ef0(1.0f); + pool_init_tiles(Tiles_9e88, 22); + pool_set_scale(1.0f); moby->update_dist = 0xFF; l = &D_L13_001CAB80; l->f00 = 16.0f; @@ -1565,8 +1568,8 @@ void FUN_L13_00309e88(struct Moby *moby) { l->f18 = 0.9f; l->f20 = 0.1f; a = fast_arc_tan(D_L13_001801C0[4], D_L13_001801C0[5]); - l->f30 = FUN_001f9dc8(a) * 0.57735f; - l->f34 = FUN_001f9de0(a) * 0.57735f; + l->f30 = fast_cos(a) * 0.57735f; + l->f34 = fast_sin(a) * 0.57735f; l->f38 = -0.57735f; l->i28 = 0x2D; l->i2C = 0x2E; @@ -1581,7 +1584,7 @@ void FUN_L13_00309e88(struct Moby *moby) { D_L13_001612D4 = tb; D_L13_00161208 = 0; for (i = 0; i < 22; i++) { - FUN_L01_002b7c68(&Tiles_9e88[i], tb + i * 16); + pool_bind_tile(&Tiles_9e88[i], tb + i * 16); Tiles_9e88[b->idx].c1E = D_L13_001F1E20[b->idx]; } for (k = 0; k < 22; k++) { @@ -1589,7 +1592,7 @@ void FUN_L13_00309e88(struct Moby *moby) { Tile_9e88 *t = &Tiles_9e88[k]; float x = t->x + rand_range_9e88(-6.0f, 6.0f); float y = t->y + rand_range_9e88(-6.0f, 6.0f); - FUN_L01_002b8288(x, y, 2.0f, 0.2f, Tiles_9e88, 22); + pool_ripple(x, y, 2.0f, 0.2f, Tiles_9e88, 22); } } for (n = 0; n < 22; n++) @@ -1604,7 +1607,7 @@ void FUN_L13_00309e88(struct Moby *moby) { f = b->top; f -= b->bottom; f *= 0.5f; - moby->pos.z = b->bottom + (FUN_001f9dc8(b->angle) * f + f); + moby->pos.z = b->bottom + (fast_cos(b->angle) * f + f); h = &hero; if (h->state.control_mode != 0x14 && h->state.control_mode != 0x19 && h->state.current != 0x3D && h->state.current != 0x7B && @@ -1616,7 +1619,7 @@ void FUN_L13_00309e88(struct Moby *moby) { float x = Tiles_9e88[b->idx].x + rand_range_9e88(-4.0f, 4.0f); float y = rand_range_9e88(-4.0f, 4.0f); Tile_9e88 *t = &Tiles_9e88[b->idx]; - FUN_L00_002a3ec8(x, t->y + y, 1.0f, -0.05f, t, 1, 1); + pool_splash(x, t->y + y, 1.0f, -0.05f, t, 1, 1); } break; } @@ -1631,7 +1634,7 @@ void FUN_L13_00309e88(struct Moby *moby) { else Tiles_9e88[b->idx].c1E = D_L13_001F1E20[b->idx]; if (b->idx == 0) { - FUN_L01_002b7fe0(Tiles_9e88, 22); + pool_flush(Tiles_9e88, 22); enqueue_callback_list_1(FUN_L13_0030a460, moby); } if (b->idx == D_L13_00161EF0) { @@ -1729,14 +1732,14 @@ extern void scale_vector_xyz(void *, void *, float) __asm__("FUN_001f9a68"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern float advance_accelerated_scalar(float *, float *, float, float, float, float) __asm__("FUN_00213f38"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int allocate_voice(int, int, void *) __asm__("FUN_0022da68"); extern void release_voice_slot(int) __asm__("FUN_0022d798"); extern int hero_set_state(int, int) __asm__("FUN_L00_002223f8"); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void FUN_L00_002ea9d8(void *); extern void FUN_L00_002eaa30(void *); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void FUN_L00_002eac18(int); extern void FUN_L13_0030ad38(struct Moby *, float *, float *); @@ -1783,7 +1786,7 @@ void FUN_L13_0030a6d8(struct Moby *moby) { case 2: case 3: { float target; - if (!FUN_L00_0028d8c0(moby, vars->voice)) + if (!voice_is_playing(moby, vars->voice)) vars->voice = allocate_voice(0, 4, moby); if (moby->command != 0) { FUN_L13_0030ad38(moby, a, b); @@ -1810,7 +1813,7 @@ void FUN_L13_0030a6d8(struct Moby *moby) { case 7: if (vars->timer != 0 && tick_timer(&vars->timer)) hero_set_state(0, 0); - if (FUN_L00_0028d8c0(moby, vars->voice)) { + if (voice_is_playing(moby, vars->voice)) { release_voice_slot(vars->voice); vars->voice = -1; } @@ -1838,7 +1841,7 @@ void FUN_L13_0030a6d8(struct Moby *moby) { moby->command = 3; moby->state = 1; hero_set_state(0x72, 1); - FUN_L00_002eaaa0(D_L13_001670C0, D_L13_001670C0 + 0x10, 1, 0, 0); + jet_mount(D_L13_001670C0, D_L13_001670C0 + 0x10, 1, 0, 0); vars->blend = 0.0f; break; } @@ -1861,16 +1864,16 @@ void FUN_L13_0030a6d8(struct Moby *moby) { } } add_vector_xyz(delta, delta, &moby->pos); - FUN_L00_00260738(vars->path, delta, rot, &moby->rot); + update_entity_matrix(vars->path, delta, rot, &moby->rot); } /* Ported from rac1-decomp (src/overlays/l13_gemlik/vendor_002EBD00.c: func_L13_0030C1F0), where it is exact; names translated to the US level program. */ extern char D_0013E533[]; -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); void FUN_L13_0030ad38(struct Moby *moby, float *p, float *q) { @@ -1886,11 +1889,11 @@ void FUN_L13_0030ad38(struct Moby *moby, float *p, float *q) { a = 1.5707964f; q[0] = -moby->rot.y; } - p[0] = FUN_001f9dc8(a) * k; - p[1] = FUN_001f9de0(a) * k; + p[0] = fast_cos(a) * k; + p[1] = fast_sin(a) * k; p[2] = 1.5f; transform_vector_by_basis(p, p, &moby->rot_row0); - FUN_001f9a10(p, p, &moby->pos); + fast_vec_add(p, p, &moby->pos); base = D_0013E533 + 0xE1D; q[2] = fast_arc_tan(*(float *)(base + 0xD0) - p[0], *(float *)(base + 0xD4) - p[1]); } @@ -1975,8 +1978,8 @@ extern char D_0013F3D0[]; extern int is_point_inside_clip_volume_alt(void *, int); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern void FUN_L00_00216f90(void *, void *, int, int); -extern void FUN_L01_0027a248(int, int); -extern void FUN_L00_00298840(int); +extern void jet_game_state(int, int) __asm__("FUN_L01_0027a248"); +extern void start_scene(int) __asm__("FUN_L00_00298840"); extern void FUN_L00_00299460(int); extern void FUN_L00_002607d0(int); extern void FUN_L00_0028e8a0(void *); @@ -1992,7 +1995,7 @@ void FUN_L13_0030b628(struct Moby *moby) { if (alternate_item_available[0x64] == 0) { alternate_item_available[0x64] = 1; moby->state = 2; - FUN_L00_00298840(0); + start_scene(0); return; } moby->state = 3; @@ -2015,7 +2018,7 @@ void FUN_L13_0030b628(struct Moby *moby) { other->flags |= 0x41; } moby->state = 5; - FUN_L00_00298840(1); + start_scene(1); } else { moby->state = 6; goto after_state_4; @@ -2079,9 +2082,9 @@ void FUN_L13_0030b628(struct Moby *moby) { struct Moby *other = (struct Moby *)(D_L13_0015FFD8_m + data[8] * 0x100); other->flags |= 0x41; } - FUN_L01_0027a248(0, 5); + jet_game_state(0, 5); moby->state = 8; - FUN_L00_00298840(2); + start_scene(2); return; } moby->state = 12; @@ -2095,7 +2098,7 @@ void FUN_L13_0030b628(struct Moby *moby) { break; case 9: if (D_L13_0015F5C4 != 2) { - FUN_L00_00298840(3); + start_scene(3); moby->state = 10; } break; @@ -2239,7 +2242,7 @@ typedef struct { extern L13Action D_L13_0016CB60; extern int D_L13_0015F5C4; -extern void FUN_L00_002637f8(int); +extern void cutscene_set_camera_target(int) __asm__("FUN_L00_002637f8"); void FUN_L13_0030bdf0(struct Moby *moby) { switch (moby->state) { @@ -2249,7 +2252,7 @@ void FUN_L13_0030bdf0(struct Moby *moby) { break; case 1: if (D_L13_0015F5C4 == 2 && D_L13_0016CB60.state == 2) { - FUN_L00_002637f8(D_L13_0016CB60.target); + cutscene_set_camera_target(D_L13_0016CB60.target); } break; } @@ -2364,7 +2367,7 @@ void FUN_L13_0030c060(struct Moby *moby) { extern char *func_0020D348_m(int); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern void FUN_L00_002502f0(void *, int, int, int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); extern void FUN_L00_00250df8(void *); char *FUN_L13_0030c138(void *a, void *b, int c, int d) { @@ -2377,7 +2380,7 @@ char *FUN_L13_0030c138(void *a, void *b, int c, int d) { *(short *)(m + 0x32) = 0xFF; m[0x31] = 1; m[0x23] = random_int_between(0x40, 0x80); - FUN_L00_002502f0(m, 0x20, 0x60, 0x10); + set_moby_color(m, 0x20, 0x60, 0x10); qcopy(m + 0x10, a); qcopy(data, b); r1 = random_float_between_alt(frame_time * 6.2831855f, frame_time * 12.566371f); @@ -2397,14 +2400,14 @@ char *FUN_L13_0030c138(void *a, void *b, int c, int d) { return (char *)m; } extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_001fa580(float, float); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float FUN_001f96b0_c3b8(float) __asm__("FUN_L13_0020a9f8"); extern int FUN_001fa6d0(float); -extern float FUN_001fa6c0(int); +extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void FUN_0020c828(void *); extern void FUN_L13_0030c2b0(void *); extern void spawn_spark(void *, void *, void *, int, int, int, int, int, int) __asm__("FUN_00218888"); @@ -2464,10 +2467,10 @@ void FUN_L13_0030c3b8(struct Moby *moby) { velocity.f[2] = random_float_between_alt(D_L13_00161F30 * frame_time * 0.9f, D_L13_00161F30 * frame_time * 1.1f); angle = random_float_between_alt(-D_L13_00161F50, D_L13_00161F50) * 0.017453292f; - direction = FUN_001fa580(fast_arc_tan(*(float *)data, *(float *)(data + 4)), angle); - acceleration.f[0] = FUN_001f9dc8(direction) * (D_L13_00161F24 * frame_time); - direction = FUN_001fa580(fast_arc_tan(*(float *)data, *(float *)(data + 4)), angle); - acceleration.f[1] = FUN_001f9de0(direction) * (D_L13_00161F24 * frame_time); + direction = fast_add_rotations(fast_arc_tan(*(float *)data, *(float *)(data + 4)), angle); + acceleration.f[0] = fast_cos(direction) * (D_L13_00161F24 * frame_time); + direction = fast_add_rotations(fast_arc_tan(*(float *)data, *(float *)(data + 4)), angle); + acceleration.f[1] = fast_sin(direction) * (D_L13_00161F24 * frame_time); acceleration.f[2] = 0.0f; acceleration.f[2] = random_float_between_alt(D_L13_00161F28 * frame_time * 0.9f, D_L13_00161F28 * frame_time * 1.1f); @@ -2495,12 +2498,12 @@ void FUN_L13_0030c3b8(struct Moby *moby) { velocity.f[2] = random_float_between_alt(D_L13_00161F44 * frame_time * 0.7f, D_L13_00161F44 * frame_time * 1.5f); angle = random_float_between_alt(-D_L13_00161F54, D_L13_00161F54) * amount; - direction = FUN_001fa580(fast_arc_tan(*(float *)data, *(float *)(data + 4)), + direction = fast_add_rotations(fast_arc_tan(*(float *)data, *(float *)(data + 4)), angle); - acceleration.f[0] = FUN_001f9dc8(direction) * (D_L13_00161F48 * frame_time); - direction = FUN_001fa580(fast_arc_tan(*(float *)data, *(float *)(data + 4)), + acceleration.f[0] = fast_cos(direction) * (D_L13_00161F48 * frame_time); + direction = fast_add_rotations(fast_arc_tan(*(float *)data, *(float *)(data + 4)), angle); - acceleration.f[1] = FUN_001f9de0(direction) * (D_L13_00161F48 * frame_time); + acceleration.f[1] = fast_sin(direction) * (D_L13_00161F48 * frame_time); acceleration.f[2] = 0.0f; acceleration.f[2] = random_float_between_alt(D_L13_00161F4C * frame_time * 0.7f, D_L13_00161F4C * frame_time * 1.5f); @@ -2514,16 +2517,16 @@ void FUN_L13_0030c3b8(struct Moby *moby) { D_L13_00161F14, a, b, c, -1); } while (i >= 0); } - moby->rot.x = FUN_001fa580(moby->rot.x, *(float *)(data + 0x10)); - moby->rot.y = FUN_001fa580(moby->rot.y, *(float *)(data + 0x14)); - FUN_001f9a10(&moby->pos, &moby->pos, data); + moby->rot.x = fast_add_rotations(moby->rot.x, *(float *)(data + 0x10)); + moby->rot.y = fast_add_rotations(moby->rot.y, *(float *)(data + 0x14)); + fast_vec_add(&moby->pos, &moby->pos, data); *(float *)(data + 8) -= D_0015ED70 * 14.6f; if (!(moby->pos.x < 0.0f) && !(moby->pos.y < 0.0f) && !(moby->pos.z < 0.0f)) { short life = *(short *)(data + 0x18); short duration = *(short *)(data + 0x1a); if (life < duration / 4) { - *(float *)((char *)moby + 0x2c) = *(float *)(data + 0x1c) * FUN_001fa6c0(life) / - FUN_001fa6c0(*(short *)(data + 0x1a) / 4); + *(float *)((char *)moby + 0x2c) = *(float *)(data + 0x1c) * convert_integer_to_float(life) / + convert_integer_to_float(*(short *)(data + 0x1a) / 4); } if (fast_dec_timer_s16(data + 0x18) == 0) goto collision; } @@ -2531,7 +2534,7 @@ void FUN_L13_0030c3b8(struct Moby *moby) { return; collision: if (moby->command != 1) return; - if (FUN_001efa68(&old_pos, &moby->pos, 2, (void *)(*(int *)&D_001413D0_lui), 0) == 0) return; + if (collision_line(&old_pos, &moby->pos, 2, (void *)(*(int *)&D_001413D0_lui), 0) == 0) return; FUN_L13_0030c2b0(moby); FUN_0020c828(moby); } @@ -2540,21 +2543,22 @@ void FUN_L13_0030c3b8(struct Moby *moby) { extern unsigned char D_0013D408[]; extern float D_L13_0015F580[] __attribute__((section(".sdata"))); extern void fun_00213928(void *, void *, void *, int, void *, int, int, int) __asm__("FUN_00213928"); -extern void FUN_L00_0025d458(void *, void *); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *, void *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern int FUN_L01_0026e008(int, int); extern void allocate_voice_for_bank_entry(int, int, int) __asm__("FUN_0022db10"); extern void queue_dialogue_message(int, int) __asm__("FUN_L00_00263d40"); extern int allocate_voice_for_target_entry(int, int, void *) __asm__("FUN_0022da68"); extern void FUN_L01_002787a0(void *); extern void FUN_L00_0025f8e0(void *, float); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void FUN_L00_00263fd8(void *, int, void *, void *, int, int, float, void *, void *, void *); extern void FUN_0020c828(void *); #include "qzero.h" extern s32 D_L13_001BA7D0[]; -void FUN_L13_0030cdb8(struct Moby *moby) { +void blarg_ship_update(struct Moby *moby) __asm__("FUN_L13_0030cdb8"); +void blarg_ship_update(struct Moby *moby) { char *data; void *hit; OvlVec4 vector; @@ -2580,11 +2584,11 @@ void FUN_L13_0030cdb8(struct Moby *moby) { } else { ((unsigned char *)data)[0x67] = 0xfa; *(float *)(data + 0x20) -= cost; - FUN_L00_0025d458(moby, data + 0x60); + trooper_anim_update(moby, data + 0x60); } moby->hit_slot = 0xff; } - FUN_L00_0025d538(moby, data + 0x60); + trooper_anim_finish(moby, data + 0x60); break; case 2: { void *pos; @@ -2608,14 +2612,20 @@ void FUN_L13_0030cdb8(struct Moby *moby) { qzero(&vector); FUN_L00_0025f8e0(&vector, 1.5f); vector.f[2] += 1.7f; - FUN_001f9a10(&vector, &vector, pos); + fast_vec_add(&vector, &vector, pos); FUN_L00_00263fd8(moby, i, &vector, rot, 0, 0, 0.0f, zero_vector, zero_vector, zero_vector); } } - FUN_L00_0025e450(moby, pos, 0, 0.0f, 0.0f, 10, 3, 0x10, + spawn_explosion(moby, pos, 0, 0.0f, 0.0f, 10, 3, 0x10, 6.0f, 3.0f, 9.0f, 1.1f, 0, 15.0f, 1, 3, -1, 0); FUN_0020c828(moby); break; } } } + +s32 D_L13_001CABA8[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001CABAC[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_001CABB0[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_001CABB4[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_001CABB8[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/l13/math/interpolation/00265170.c b/src/overlays/l13/math/interpolation/00265170.c index a72398a2a6..9944871f13 100644 --- a/src/overlays/l13/math/interpolation/00265170.c +++ b/src/overlays/l13/math/interpolation/00265170.c @@ -10,7 +10,8 @@ extern char *D_L13_0015FFD8; extern char *D_L13_0015FFE0; -void FUN_L13_00265170(int id, int state) { +void jet_group_flag(int id, int state) __asm__("FUN_L13_00265170"); +void jet_group_flag(int id, int state) { char *moby = D_L13_0015FFD8; if ((unsigned long)D_L13_0015FFE0 >= (unsigned long)moby) { do { @@ -28,7 +29,8 @@ extern int D_L13_0015FFE0_d __asm__("D_L13_0015FFE0"); * Ported from rac1-decomp, where it is exact; names translated to * the US level program (data still reached through the MACRO_ADDR form). */ // Sets flag bits and a data pointer on every live object in the pool whose id appears in a zero-terminated list. -void FUN_L13_002651c8(short *ids, int a, int b, int c) { +void jet_group_switch(short *ids, int a, int b, int c) __asm__("FUN_L13_002651c8"); +void jet_group_switch(short *ids, int a, int b, int c) { char *m; for (m = D_L13_0015FFD8_d; m <= D_L13_0015FFE0_d; m += 0x100) { int n; diff --git a/src/overlays/l14/gameplay/entities/blarg_heavy_interceptor.c b/src/overlays/l14/gameplay/entities/blarg_heavy_interceptor.c index 8895fff063..60242a7336 100644 --- a/src/overlays/l14/gameplay/entities/blarg_heavy_interceptor.c +++ b/src/overlays/l14/gameplay/entities/blarg_heavy_interceptor.c @@ -98,7 +98,7 @@ typedef struct { u8 pad29[0x15]; s16 unk3E; u8 pad40[0x20]; - u8 carry[0x40]; /* 0x60: carried-object state for FUN_L00_00260738 */ + u8 carry[0x40]; /* 0x60: carried-object state for update_entity_matrix */ u8 start_end; /* 0xA0: 0 starts at the far end */ u8 padA1[3]; f32 t; /* 0xA4: position along the path, 0 to 1 */ @@ -113,7 +113,7 @@ typedef struct { s32 voice; /* 0xC4 */ s32 silent; /* 0xC8 */ s32 show_volume; /* 0xCC: clip volume that makes it visible, -1 once shown */ - f32 ease[3]; /* 0xD0: per-axis easing state for FUN_L00_0025b8c0 */ + f32 ease[3]; /* 0xD0: per-axis easing state for vendor_spring */ } PathMoverVars; typedef struct { @@ -128,16 +128,16 @@ extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); extern s32 truncate_float_to_s32(f32 f) __asm__("FUN_001fa6d0"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float FUN_001f9b48(void *, void *); -extern s32 FUN_001f9770(s16 *); -extern int FUN_L00_0028d8c0(void *, int); +extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L01_00277fb8(void *); extern s32 allocate_voice_for_target_entry(s32, s32, void *) __asm__("func_0022DA68"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); extern void FUN_L14_002ac2b8(struct Moby *); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void release_voice_slot(s32 idx) __asm__("FUN_0022d798"); extern void scale_vector_xyz(void *out, void *a, f32 s) __asm__("FUN_001f9a68"); @@ -145,6 +145,7 @@ extern void subtract_vector_xyz(void *out, void *a, void *b) __asm__("FUN_001f9a float absolute_float(float input) __asm__("FUN_001f99c0"); extern s32 D_0014C190_257218[][64] __asm__("D_0014C190"); +void FUN_L14_002aba80(struct Moby *moby); void FUN_L14_002aba80(struct Moby *moby) { PathMoverVars *vars = (PathMoverVars *)moby->pvars; MoverPath *path; @@ -186,7 +187,7 @@ void FUN_L14_002aba80(struct Moby *moby) { } } qcopy(&orig, &moby->pos); - FUN_001f9770(&vars->wait); + fast_dec_timer_s16(&vars->wait); if (moby->state == 0) { f32 t; Vec4 *points; @@ -244,7 +245,7 @@ void FUN_L14_002aba80(struct Moby *moby) { hero.unk1F4 = 4; } if (vars->wait != 0 || - (vars->rise < 0.0f && FUN_001f9b80(&moby->pos, &hero.motion.pos) < 2.0f && + (vars->rise < 0.0f && vector_distance(&moby->pos, &hero.motion.pos) < 2.0f && absolute_float(hero.motion.pos.f[2] - moby->pos.z) < 4.0f && moby->pos.z - hero.motion.pos.f[2] > 1.0f)) { s32 voice; @@ -268,7 +269,7 @@ void FUN_L14_002aba80(struct Moby *moby) { f32 fi; Vec4 *from; - if (!FUN_L00_0028d8c0(moby, vars->voice)) { + if (!voice_is_playing(moby, vars->voice)) { vars->voice = allocate_voice_for_target_entry(0, 4, moby); } vars->speed += vars->target_speed * frame_time; @@ -312,9 +313,9 @@ void FUN_L14_002aba80(struct Moby *moby) { scale_vector_xyz(&step, &step, frac); add_vector_xyz(&goal, &step, from); } - FUN_L00_0025b8c0(&moby->pos.x, &vars->ease[0], goal.f[0], 0.005f, 0.2f, 0.0f); - FUN_L00_0025b8c0(&moby->pos.y, &vars->ease[1], goal.f[1], 0.005f, 0.2f, 0.0f); - FUN_L00_0025b8c0(&moby->pos.z, &vars->ease[2], goal.f[2], 0.005f, 0.2f, 0.0f); + vendor_spring(&moby->pos.x, &vars->ease[0], goal.f[0], 0.005f, 0.2f, 0.0f); + vendor_spring(&moby->pos.y, &vars->ease[1], goal.f[1], 0.005f, 0.2f, 0.0f); + vendor_spring(&moby->pos.z, &vars->ease[2], goal.f[2], 0.005f, 0.2f, 0.0f); vars->rise = moby->pos.z - orig.f[2]; } break; @@ -323,9 +324,9 @@ void FUN_L14_002aba80(struct Moby *moby) { FUN_L14_002ac2b8(moby); } subtract_vector_xyz(&delta, &moby->pos, &orig); - FUN_L00_00260738(vars->carry, &delta, &moby->rot, &moby->rot); + update_entity_matrix(vars->carry, &delta, &moby->rot, &moby->rot); if (!FUN_L01_00277fb8(moby)) { - if (2.0f < FUN_001f9b80(&moby->pos, &hero.motion.pos)) { + if (2.0f < vector_distance(&moby->pos, &hero.motion.pos)) { if (vars->wait == 0) { vars->retrigger = 1; } @@ -335,7 +336,7 @@ void FUN_L14_002aba80(struct Moby *moby) { /* Eases the moby toward the first or last point of its path. */ extern int *D_L14_001B0BB0[]; -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); void FUN_L14_002ac2b8(struct Moby *moby) { char *d = (char *)moby->pvars; @@ -345,9 +346,9 @@ void FUN_L14_002ac2b8(struct Moby *moby) { qcopy(t, (char *)p + p[0] * 16); else qcopy(t, (char *)p + 0x10); - FUN_L00_0025b8c0(&moby->pos.x, (float *)(d + 0xD0), t[0], 0.005f, 0.2f, 0.0f); - FUN_L00_0025b8c0(&moby->pos.y, (float *)(d + 0xD4), t[1], 0.005f, 0.2f, 0.0f); - FUN_L00_0025b8c0(&moby->pos.z, (float *)(d + 0xD8), t[2], 0.005f, 0.2f, 0.0f); + vendor_spring(&moby->pos.x, (float *)(d + 0xD0), t[0], 0.005f, 0.2f, 0.0f); + vendor_spring(&moby->pos.y, (float *)(d + 0xD4), t[1], 0.005f, 0.2f, 0.0f); + vendor_spring(&moby->pos.z, (float *)(d + 0xD8), t[2], 0.005f, 0.2f, 0.0f); } /* Per-frame update of a path-following flyer, a state machine on m->state: 0 checks its three paths * and sets it up (or hides it, state 8), 1 patrols the path in pvars 0x78 and scans for a target, @@ -398,7 +399,7 @@ extern s32 allocate_voice_c618(s32, s32, void *) __asm__("FUN_0022da68"); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern s32 random_integer_below(s32 n) __asm__("FUN_00213260"); extern f32 FUN_001fa6c0(s16); -extern s32 FUN_001fa728(u8 *, f32); +extern s32 fast_bsphere_check(u8 *, f32) __asm__("FUN_001fa728"); typedef struct { u8 pad0[0x18]; struct Moby *target; /* 0x18 */ @@ -430,6 +431,7 @@ extern f32 D_L14_001613A0_c618 __asm__("D_L14_001613A0") __attribute__((sda)); extern f32 D_L14_001613A4_c618 __asm__("D_L14_001613A4") __attribute__((sda)); extern Vec4 D_L14_00174560; +void FUN_L14_002ac618(struct Moby *m); void FUN_L14_002ac618(struct Moby *m) { char *d = (char *)m->pvars; float v[4]; @@ -524,7 +526,7 @@ void FUN_L14_002ac618(struct Moby *m) { m->glow_color = 0xFF000000 | (D_L14_00161408 << 16) | (D_L14_00161404 << 8) | D_L14_00161400; if (FUN_L14_002b4670(*(int *)(d + 0x70))) { m->state = 3; - *(s16 *)(d + 0x1F2) = FUN_001f96f8(D_L14_001613D0); + *(s16 *)(d + 0x1F2) = scale_game_frames(D_L14_001613D0); } *(s16 *)(d + 0x202) = 0; *(s16 *)(d + 0x200) = 1; @@ -565,7 +567,7 @@ void FUN_L14_002ac618(struct Moby *m) { *(s32 *)(d + 0x1D0) = -1; FUN_L14_002b44a8(*(int *)(d + 0x70)); m->state = 3; - *(s16 *)(d + 0x1F2) = FUN_001f96f8(D_L14_001613D0); + *(s16 *)(d + 0x1F2) = scale_game_frames(D_L14_001613D0); break; } case 3: @@ -587,7 +589,7 @@ void FUN_L14_002ac618(struct Moby *m) { ease_c618((f32 *)(d + 0x174), v[1], (f32 *)(d + 0x184), 0.003f, 0.2f, 0.0f); ease_c618((f32 *)(d + 0x178), v[2], (f32 *)(d + 0x188), 0.003f, 0.2f, 0.0f); FUN_L14_002ae7d8(m); - if ((s8)(*(struct Moby **)(d + 0x18C))->state < 0 || FUN_001f9770((s16 *)(d + 0x1F2))) { + if ((s8)(*(struct Moby **)(d + 0x18C))->state < 0 || fast_dec_timer_s16((s16 *)(d + 0x1F2))) { *(float *)(d + 0x8C) = 0.0f; *(int *)(d + 0x80) = 0; *(s16 *)(d + 0x208) = 0; @@ -603,7 +605,7 @@ void FUN_L14_002ac618(struct Moby *m) { m->glow_color = 0xFF000000 | (D_L14_00161414 << 16) | (D_L14_00161410 << 8) | D_L14_0016140C; qcopy(v, &m->pos); v[3] = D_L14_0016139C; - if (FUN_001fa728((u8 *)v, FUN_001fa6c0(m->draw_dist)) >= 0) { + if (fast_bsphere_check((u8 *)v, FUN_001fa6c0(m->draw_dist)) >= 0) { float *p; FUN_L00_0024f7c8_c618(m, 2, w); @@ -639,7 +641,7 @@ void FUN_L14_002ac618(struct Moby *m) { *(float *)(d + 0x8C) = p->points[*(int *)(d + 0x80)].f[3]; *(s16 *)(d + 0x208) = 0; FUN_L14_002ae900(m, 0.01f, 5.0f, -1.0f); - blend_moby_animation_c618(m, 0, 0, FUN_001f96f8(10)); + blend_moby_animation_c618(m, 0, 0, scale_game_frames(10)); } } break; @@ -698,7 +700,7 @@ void FUN_L14_002ac618(struct Moby *m) { s32 voice; float ang; - *(s16 *)(d + 0x1F0) = FUN_001f96f8(D_L14_001613D4); + *(s16 *)(d + 0x1F0) = scale_game_frames(D_L14_001613D4); FUN_L14_002b44a8(*(int *)(d + 0x70)); voice = *(s32 *)(d + 0x1D0); if (voice != -1) { @@ -753,13 +755,13 @@ void FUN_L14_002ac618(struct Moby *m) { FUN_0020c828(m); return; } - if (FUN_001f9770((s16 *)(d + 0x1F0)) || coll_sphere(0.5f, &m->pos, 0, m)) { + if (fast_dec_timer_s16((s16 *)(d + 0x1F0)) || coll_sphere(0.5f, &m->pos, 0, m)) { FUN_L00_0025e450_c618(m, d + 0x40, &m->pos, 2.0f, 1.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, 1, 15.0f, 1, 5, -1, 0); FUN_0020c828(m); return; } FUN_L00_0026cbb0(&m->pos, D_L14_0015F580, 0x4F007FFF, 0x1FFFFFFF, - random_int_between(FUN_001f96f8(10), FUN_001f96f8(20)), 1, 60000.0f); + random_int_between(scale_game_frames(10), scale_game_frames(20)), 1, 60000.0f); for (i = 0; i < 2; i++) { int a = random_integer_below(6); float size; @@ -777,7 +779,7 @@ void FUN_L14_002ac618(struct Moby *m) { p[3] = 0x44; q = p + 0x20; - *(s16 *)(p + 0xA) = FUN_001f96f8(60); + *(s16 *)(p + 0xA) = scale_game_frames(60); *(int *)(q + 4) = 2; q[0xA] = 0x60; q[0xB] = p[0xA]; @@ -794,10 +796,10 @@ void FUN_L14_002ac618(struct Moby *m) { } else { m->command = 0; } - if (m->state == 1 && !FUN_L00_0028d8c0(m, *(s32 *)(d + 0x1D0))) { + if (m->state == 1 && !voice_is_playing(m, *(s32 *)(d + 0x1D0))) { *(s32 *)(d + 0x1D0) = allocate_voice_c618(0, 4, m); } - if ((m->state == 3 || m->state == 4) && !FUN_L00_0028d8c0(m, *(s32 *)(d + 0x1D0))) { + if ((m->state == 3 || m->state == 4) && !voice_is_playing(m, *(s32 *)(d + 0x1D0))) { *(s32 *)(d + 0x1D0) = allocate_voice_c618(2, 4, m); } } @@ -807,8 +809,8 @@ void FUN_L14_002ac618(struct Moby *m) { extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern int hit_reaction(void *, void *, void *, int, void *, void *, int, int) __asm__("FUN_L00_0025a478"); extern void FUN_L00_00257470(void *, int, int); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); void blend_moby_animation(MobyAnim *arg0, int arg1, int arg2, int arg3) __asm__("FUN_00212f90"); void FUN_L14_002ad8b8(struct Moby *moby) { @@ -852,10 +854,10 @@ void FUN_L14_002ad8b8(struct Moby *moby) { case 11: break; } - FUN_L00_0025d458(moby, (short *)(data + 0x60)); + trooper_anim_update(moby, (short *)(data + 0x60)); } moby->hit_slot = 0xFF; - FUN_L00_0025d538(moby, data + 0x60); + trooper_anim_finish(moby, data + 0x60); } /* Draws the moby's ring of lights: builds a matrix facing the camera from the moby's axis, transforms the ring * vertices through it and draws them, then flips the matrix and draws the back face. */ @@ -1236,7 +1238,7 @@ void FUN_L14_002ae260(struct Moby *m) { extern float FUN_001f9b48(void *, void *); extern int *D_L14_001B0BB0[]; -extern void FUN_L00_0025d808(int a, char *pos, char *b, char *c, int d, float f) __asm__("FUN_L00_0025d808"); +extern void sample_path(int a, char *pos, char *b, char *c, int d, float f) __asm__("FUN_L00_0025d808"); extern int FUN_L00_0025d808_2af688(void *, void *, void *, void *, int, float) __asm__("FUN_L00_0025d808"); @@ -1292,7 +1294,7 @@ extern float FUN_L00_0025b8c0_c(float *p, float *v, float t, float u1, float u2, extern int *D_L14_001B0BB0[]; extern f32 D_L14_001613A0_d __asm__("D_L14_001613A0") __attribute__((sda)); extern f32 D_L14_001613A4_d __asm__("D_L14_001613A4") __attribute__((sda)); -extern void FUN_L00_0025d808(int a, char *pos, char *b, char *c, int d, float f) __asm__("FUN_L00_0025d808"); +extern void sample_path(int a, char *pos, char *b, char *c, int d, float f) __asm__("FUN_L00_0025d808"); extern int FUN_L00_0025d808_2af918(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); @@ -1389,10 +1391,10 @@ extern f32 D_L14_001613C8 __attribute__((sda)); extern f32 D_L14_001613CC __attribute__((sda)); extern void FUN_L00_00262b00(f32, f32, u8 *, f32 *, f32 *); extern void FUN_L00_00262b80(u8 *, u8 *, u8 *, f32, f32, f32); -extern s32 FUN_001f9770(s16 *); -extern s32 FUN_001f96f8(s32); +extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); /* 0x002AEA08, 208 bytes. Per-frame update of a moby's aim and turn state from * level tuning constants. The ten constants are small data ($gp-relative), @@ -1408,20 +1410,20 @@ void FUN_L14_002aea08(u8 *moby) { FUN_L00_00262b80(moby, data + 0x1A8, data + 0x1AC, D_L14_001613B0, D_L14_001613B4, D_L14_001613B8); if (*(u8 *)(moby + 0x20) == 1) { - if (FUN_001f9770((s16 *)(data + 0x1B4))) { - *(s16 *)(data + 0x1B4) = FUN_001f96f8(D_L14_001613BC); + if (fast_dec_timer_s16((s16 *)(data + 0x1B4))) { + *(s16 *)(data + 0x1B4) = scale_game_frames(D_L14_001613BC); t = D_L14_001613C0; if (random_integer_below(2)) t = -t; *(f32 *)(data + 0x1B0) = fast_add_rotations(*(f32 *)(moby + 0x48), t); } - FUN_L00_0025b8c0((f32 *)(moby + 0x48), (f32 *)(data + 0x1B8), *(f32 *)(data + 0x1B0), + vendor_spring((f32 *)(moby + 0x48), (f32 *)(data + 0x1B8), *(f32 *)(data + 0x1B0), D_L14_001613C4, D_L14_001613C8, D_L14_001613CC); } } extern s32 random_integer_below(s32 n) __asm__("FUN_00213260"); extern f32 FUN_001fa6c0(s16); -extern s32 FUN_001fa728(u8 *, f32); +extern s32 fast_bsphere_check(u8 *, f32) __asm__("FUN_001fa728"); extern void build_moby_bone_transform(u8 *, s32, u8 *) __asm__("FUN_0020cca8"); extern void fast_vec_normalize(u8 *, u8 *, f32) __asm__("FUN_001f9bf8"); @@ -1438,7 +1440,7 @@ void FUN_L14_002aead8(u8 *moby) { if (random_integer_below(5)) { qcopy(v, moby + 0x10); v[3] = D_L14_0016139C; - if (FUN_001fa728((u8 *)v, FUN_001fa6c0(*(s16 *)(moby + 0x32))) >= 0) { + if (fast_bsphere_check((u8 *)v, FUN_001fa6c0(*(s16 *)(moby + 0x32))) >= 0) { p = data + 0xA0; build_moby_bone_transform(moby, 1, p); fast_vec_normalize(p, p, 1.0f); @@ -1568,7 +1570,7 @@ void FUN_L14_002aee28(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/l14_oltanis/vendor_002ACCC0.c: func_L14_002B0168), where it is exact; names translated to the US level program. */ extern char D_L14_001674C0[]; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern unsigned char *D_L14_0015FFD0_e[] __asm__("D_L14_0015FFD0") __attribute__((section(".sdata"))); extern int D_L14_001D8680[]; @@ -1591,7 +1593,7 @@ char *FUN_L14_002aef28(int index, int *ids) { } } if (!found) { - float d = FUN_001f9b80(D_L14_001674C0, moby + 0x10); + float d = vector_distance(D_L14_001674C0, moby + 0x10); if (bestd < d) { bestd = d; best = moby; @@ -1638,7 +1640,7 @@ extern int D_L14_00161530 __attribute__((sda)); /* no foreign declaration */ extern int D_L14_00161534 __attribute__((sda)); /* no foreign declaration */ extern int debug_print_alt() __asm__("FUN_001e93b0"); extern int FUN_001f9770_c2(void *) __asm__("FUN_001f9770"); -extern int FUN_L00_002502f0(); +extern int set_moby_color() __asm__("FUN_L00_002502f0"); extern int is_point_inside_clip_volume_c(void *arg0, int arg1) __asm__("func_00214720"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern int tick_countdown_32_alt(void *) __asm__("FUN_001f9740"); @@ -1651,8 +1653,8 @@ extern void set_moby_animation_c2(void *, s32, s32) __asm__("func_00212ED8"); int FUN_L14_00268038(char *a, char *o, float best); void FUN_L14_002b4340_c(struct Moby *m) __asm__("FUN_L14_002b4340"); extern int func_001E9730_2B4E40() __asm__("FUN_001e93b0"); -extern char D_L14_001FC0C0_2B4E40[] __asm__("D_L14_001FBD50"); -extern char D_L14_001FC0E8_2B4E40[] __asm__("D_L14_001FBD78"); +extern char D_L14_001FBD50[]; +extern char D_L14_001FBD78[]; extern void func_L14_002B5590_2B4E40(unsigned char *m) __asm__("FUN_L14_002b4340"); extern void func_0020D678_2B4E40(void *) __asm__("FUN_0020c828"); extern int func_001F9908_2B4E40(void *) __asm__("FUN_001f9740"); @@ -1673,7 +1675,8 @@ extern float func_L00_001FF860_2B4E40(float, float) __asm__("FUN_001f9e90"); extern int func_002140B0_2B4E40(int) __asm__("FUN_00213260"); extern void func_L00_001FF4B0_2B4E40(void *, void *, float) __asm__("FUN_001f9bf8"); -void FUN_L14_002b3bf0(char *moby) { +void machinegun_turret_update(char *moby) __asm__("FUN_L14_002b3bf0"); +void machinegun_turret_update(char *moby) { char *data; float v20[4]; float v30[4]; @@ -1697,12 +1700,12 @@ void FUN_L14_002b3bf0(char *moby) { *(int *)(data + 0x8C) = 0; *(short *)(data + 0x74) = 0; if (*(int *)(data + 0x80) == -1) { - func_001E9730_2B4E40(D_L14_001FC0C0_2B4E40, *(short *)(moby + 0xB2)); + func_001E9730_2B4E40(D_L14_001FBD50, *(short *)(moby + 0xB2)); func_0020D678_2B4E40(moby); return; } if (*(int *)(data + 0x90) == -1) { - func_001E9730_2B4E40(D_L14_001FC0E8_2B4E40, *(short *)(moby + 0xB2)); + func_001E9730_2B4E40(D_L14_001FBD78, *(short *)(moby + 0xB2)); func_0020D678_2B4E40(moby); return; } @@ -1923,10 +1926,10 @@ void FUN_L14_002b4340(struct Moby *m) { FUN_L00_00257470(m, 0, -1); break; } - FUN_L00_0025d458(m, (short *)(d + 0x60)); + trooper_anim_update(m, (short *)(d + 0x60)); } m->hit_slot = 0xFF; - FUN_L00_0025d538(m, d + 0x60); + trooper_anim_finish(m, d + 0x60); } /* Returns 0 unless every object on the list is ready, then wakes the waiting ones and sets their timers. */ extern short *D_L14_001ABF40_b45[] __asm__("D_L14_001ABF40"); @@ -2164,7 +2167,8 @@ extern char *func_L14_00302968_2B5938(int a0, float *a1, float *a2, float f, int extern void func_L00_0025F4A8_2B5938(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); -void FUN_L14_002b46e8(Moby_2B5938 *moby) { +void minibomber_update(Moby_2B5938 *moby) __asm__("FUN_L14_002b46e8"); +void minibomber_update(Moby_2B5938 *moby) { Data_2B5938 *d = moby->d; float v[12]; float *tgt; @@ -2322,7 +2326,7 @@ void FUN_L14_002b46e8(Moby_2B5938 *moby) { tg = 0.0f; a = blend_scalar_alt(tg, d->f104, (float)d->f102 / convert_integer_to_float(scale_game_frames_c(D_L14_00161560))); FUN_L00_001fff28(d->f120, 2, a); - if (FUN_001f9b80(moby->pos, d->fB0->pos) < D_L14_00161570) { + if (vector_distance(moby->pos, d->fB0->pos) < D_L14_00161570) { if (d->f10C == 0) { d->fE8 = 0; d->fEC = 0.0f; @@ -2441,7 +2445,7 @@ void FUN_L14_002b46e8(Moby_2B5938 *moby) { } } if (moby->state > 1 && moby->state != 9) { - if (FUN_L00_0028d8c0(moby, d->f108) == 0) { + if (voice_is_playing(moby, d->f108) == 0) { d->f108 = allocate_voice_for_target_entry_alt(0, 4, (int)moby); } } @@ -2504,7 +2508,7 @@ void FUN_L14_002b5290(struct Moby *m) { FUN_L00_0025d458_c(m, d + 0x60); } m->hit_slot = 0xFF; - FUN_L00_0025d538(m, d + 0x60); + trooper_anim_finish(m, d + 0x60); } /* Ported from rac1-decomp (src/overlays/l14_oltanis/vendor_002ACCC0.c: func_L14_002B6678), where it is exact; names translated to the US level program. */ @@ -2644,7 +2648,7 @@ extern float random_float_between(float, float); extern int scale_game_frames(int); extern void build_look_at_matrix(void *, void *, void *, float); extern void FUN_L00_0026c6e8(void *, void *); -extern void FUN_L00_002d3838(int, void *, int, int); +extern void mine_camera_blast(int, void *, int, int) __asm__("FUN_L00_002d3838"); extern char D_L14_001D88D0[] __asm__("D_L14_001D88D0"); extern float D_L14_0015F580_x[] __asm__("D_L14_0015F580") __attribute__((section(".sdata"))); extern PuffParticle *spawn_puff(void *, float, float, float, int, void *, float, @@ -2704,7 +2708,7 @@ void FUN_L14_002b5968(struct Moby *moby, float *point, float angle) { pos[2] = original_pos[2] + randf_sym(0.0f, 0.2f); FUN_L00_0026c6e8(pos, direction); } - FUN_L00_002d3838((int)D_L14_001D88D0, original_pos, 0, 0); + mine_camera_blast((int)D_L14_001D88D0, original_pos, 0, 0); } /* Points the mover at the second-to-last node of its active path and clears its offset. */ @@ -2765,7 +2769,7 @@ void FUN_L14_002b5c98(u8 *moby) { extern int *D_L14_001B0BB0[]; extern float D_L14_00161540 __attribute__((sda)); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); @@ -2787,7 +2791,7 @@ void FUN_L14_002b5d18(struct Moby *moby) { else p = (char *)D_L14_001B0BB0[*(int *)(d + 0x150)]; qcopy(&moby->pos, p + 0x10); - FUN_001f9a28(v, p + 0x20, &moby->pos); + fast_vec_sub(v, p + 0x20, &moby->pos); moby->rot.z = fast_arc_tan(v[0], v[1]); *(int *)(d + 0xE4) = 0; clear_u64_value(d + 0xF0); @@ -2866,7 +2870,7 @@ extern int frames_d(int) __asm__("FUN_001f96f8"); extern int rand_below_d(int) __asm__("FUN_00213260"); extern float rand_between_d(float, float) __asm__("FUN_002132a8"); extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); -extern int FUN_L00_0028dc90(int, int, void *, int); +extern int trooper_play_sound(int, int, void *, int) __asm__("FUN_L00_0028dc90"); extern void e450_b78(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern char *FUN_L00_0026cbb0(void *, void *, int, int, int, int, float); @@ -2908,7 +2912,7 @@ void FUN_L14_002bac78(struct Moby *m) { if (coll_sphere(0.75f, &m->pos, 0, 0) != 0 || (abs_d(m->pos.x - hero.motion.pos.f[0]) < 10.0f && abs_d(m->pos.y - hero.motion.pos.f[1]) < 10.0f)) { clear_d(joint); - FUN_L00_0028dc90(1, 0, m, (*(struct Moby **)(d + 0x20))->oclass); + trooper_play_sound(1, 0, m, (*(struct Moby **)(d + 0x20))->oclass); e450_b78(m, joint, &m->pos, 2.0f, 4.0f, 5, 2, 4, 1.0f, 0.5f, 9.0f, 1.0f, -1, 5.0f, 0, 2, -1, 0); FUN_L14_002bb4d8((u8 *)m); @@ -3035,7 +3039,7 @@ struct L14PathRec { /* Pvars of a moby that waits for the race to start, rides its path and leaves at a trigger volume. */ struct L14RacerVars { u8 pad0[0x40]; - Vec4 trail; /* 0x40: effect state (FUN_L00_0025e450) */ + Vec4 trail; /* 0x40: effect state (spawn_explosion) */ u8 pad50[0x10]; s32 path; /* 0x60: index into D_L14_0015F70C (-1: none) */ u8 pad64[8]; @@ -3075,14 +3079,15 @@ extern unsigned char *FUN_L14_002dea98(char *owner, char *pos); extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_sin(float) __asm__("FUN_001f9de0"); extern void FUN_L14_002e0170(struct Moby *, s32 *, int); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, int, float, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); void FUN_L14_002d6358(struct Moby *m); int FUN_L14_002d64d0(struct Moby *m); void FUN_L14_002d67e8(struct Moby *m); void FUN_L14_002d7198(struct Moby *m); void FUN_L14_002d7490(struct Moby *m); +void FUN_L14_002d5f40(struct Moby *m); void FUN_L14_002d5f40(struct Moby *m) { struct L14RacerVars *d = (struct L14RacerVars *)m->pvars; u8 pos[16]; @@ -3112,7 +3117,7 @@ void FUN_L14_002d5f40(struct Moby *m) { return; case 1: if (race_state->phase == 0x14) { - d->timer = FUN_001f96f8(d->delay); + d->timer = scale_game_frames(d->delay); m->state = 2; } return; @@ -3124,7 +3129,7 @@ void FUN_L14_002d5f40(struct Moby *m) { m->state = 3; set_moby_animation(m, 2, 0); m->anim_speed = 0.5f; - d->timer = FUN_001f96f8(D_L14_00161A2C); + d->timer = scale_game_frames(D_L14_00161A2C); d->inv_time = 1.0f / convert_integer_to_float(d->timer); qcopy(&m->pos, (char *)D_L14_001B0BB0[d->end_point] + 0x10); case 3: @@ -3139,7 +3144,7 @@ void FUN_L14_002d5f40(struct Moby *m) { case 4: if (FUN_L14_002d64d0(m)) { m->state = 5; - d->timer = FUN_001f96f8(D_L14_00161A34); + d->timer = scale_game_frames(D_L14_00161A34); } break; case 5: @@ -3159,7 +3164,7 @@ void FUN_L14_002d5f40(struct Moby *m) { sv[1] = vel[1]; } FUN_L14_002e0170(m, &D_L14_00161A5C, 0); - FUN_L00_0025e450(m, &d->trail, &m->pos, 0.0f, 0.0f, 5, 2, 4, 4.0f, 2.0f, 9.0f, 1, 1.0f, + spawn_explosion(m, &d->trail, &m->pos, 0.0f, 0.0f, 5, 2, 4, 4.0f, 2.0f, 9.0f, 1, 1.0f, 15.0f, 1, 5, -1, 0); FUN_0020c828(m); return; @@ -3168,3 +3173,7 @@ void FUN_L14_002d5f40(struct Moby *m) { } FUN_L14_002d7490(m); } + +char D_L14_001FBD50[] = "Turret with no aiming cuboid. UID: %d\n"; + +char D_L14_001FBD78[] = "Turret with no waking cuboid. UID: %d\n"; diff --git a/src/overlays/l14/gameplay/entities/bolt_thief.c b/src/overlays/l14/gameplay/entities/bolt_thief.c index c5e3e20a5b..acbcb2bd26 100644 --- a/src/overlays/l14/gameplay/entities/bolt_thief.c +++ b/src/overlays/l14/gameplay/entities/bolt_thief.c @@ -224,27 +224,28 @@ extern char *D_L14_001B0BB0[]; extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern char *FUN_L14_002ffaf8(void *, void *); extern char D_L14_001FCF20[], D_L14_001FCF58[], D_L14_001FCFA0[], D_L14_001FCFD8[], D_L14_001FD020[]; -extern float FUN_001f9e90(float,float); -extern float FUN_L00_0025b8c0(float *p, float *v, float t, float u1, float u2, float eps); +extern float fast_arc_tan(float,float) __asm__("FUN_001f9e90"); +extern float vendor_spring(float *p, float *v, float t, float u1, float u2, float eps) __asm__("FUN_L00_0025b8c0"); extern int stub_printf() __asm__("FUN_001e93b0"); -extern int FUN_L00_0025c698(void *,void *); +extern int mine_fall(void *,void *) __asm__("FUN_L00_0025c698"); extern int FUN_L14_002fea80(struct Moby *moby); extern float D_L14_00161FBC __attribute__((sda)); extern float D_L14_00161FC0 __attribute__((sda)); extern void FUN_L00_00257470(void *, int, int); -extern void FUN_L00_0025c558(void *, void *, int, int, int, float); -extern void FUN_L00_0025d538(void *, void *); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void trooper_start_knockback(void *, void *, int, int, int, float) __asm__("FUN_L00_0025c558"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L14_002ffc08(void *); extern void FUN_L14_002fe900(void *); extern void FUN_L14_002fec28(void *); extern void FUN_L14_002feca8(void *); extern void blend_moby_animation(void *, s32, s32, s32) __asm__("FUN_00212f90"); extern void set_moby_animation(void *, int, int) __asm__("FUN_00212ed8"); -extern void turn_e50(char*,float,float*,float,float,float) __asm__("FUN_L00_00258278"); +extern void FUN_L00_00258278(char*,float,float*,float,float,float); -/* Same routine as FUN_L16_002e37a0, without the child hit test. */ -void FUN_L14_002fe2a0(L16CrateMoby *moby) { +/* Same routine as bolt_thief_update, without the child hit test. */ +void bolt_thief_update(L16CrateMoby *moby) __asm__("FUN_L14_002fe2a0"); +void bolt_thief_update(L16CrateMoby *moby) { L16CrateData *d = moby->data; char *hit; @@ -262,8 +263,8 @@ void FUN_L14_002fe2a0(L16CrateMoby *moby) { d->knock_rise = frame_time * 12.0f; d->knock_flags = 1; d->knock_bAD = 0; - FUN_L00_0025c558(moby, d->knock, 1, 1, 0, - FUN_001f9e90(moby->position[0] - player->motion.pos.f[0], moby->position[1] - player->motion.pos.f[1])); + trooper_start_knockback(moby, d->knock, 1, 1, 0, + fast_arc_tan(moby->position[0] - player->motion.pos.f[0], moby->position[1] - player->motion.pos.f[1])); d->ticks = 0x78; FUN_L00_00257470(moby, 0, -1); moby->state = 6; @@ -314,8 +315,8 @@ void FUN_L14_002fe2a0(L16CrateMoby *moby) { case 1: { struct Hero *player = &hero; - turn_e50((char *)moby, - FUN_001f9e90(player->motion.pos.f[0] - moby->position[0], player->motion.pos.f[1] - moby->position[1]), + FUN_L00_00258278((char *)moby, + fast_arc_tan(player->motion.pos.f[0] - moby->position[0], player->motion.pos.f[1] - moby->position[1]), &d->turn, 0.005f, 0.2f, 0.0f); FUN_L14_002feca8(moby); break; @@ -353,9 +354,9 @@ void FUN_L14_002fe2a0(L16CrateMoby *moby) { FUN_L14_002fec28(moby); qcopy(target, path + *(int *)path * 16); zero = 0.0f; - FUN_L00_0025b8c0(moby->position, &a->vx, target[0], D_L14_00161FBC, D_L14_00161FC0, zero); - FUN_L00_0025b8c0(moby->position + 1, &a->vy, target[1], D_L14_00161FBC, D_L14_00161FC0, zero); - FUN_L00_0025b8c0(moby->position + 2, &a->vz, target[2], D_L14_00161FBC, D_L14_00161FC0, zero); + vendor_spring(moby->position, &a->vx, target[0], D_L14_00161FBC, D_L14_00161FC0, zero); + vendor_spring(moby->position + 1, &a->vy, target[1], D_L14_00161FBC, D_L14_00161FC0, zero); + vendor_spring(moby->position + 2, &a->vz, target[2], D_L14_00161FBC, D_L14_00161FC0, zero); if ((moby->status & 2) && moby->frame == moby->animation) { if (a->mode == 1) { moby->state = 1; @@ -387,15 +388,15 @@ void FUN_L14_002fe2a0(L16CrateMoby *moby) { d->turn = d->vx = d->vy = d->vz = d->timer; path = D_L14_001B0BB0[d->path]; qcopy(moby->position, path + 0x10); - moby->rotation[2] = FUN_001f9e90(*(float *)(path + 0x20) - *(float *)(path + 0x10), + moby->rotation[2] = fast_arc_tan(*(float *)(path + 0x20) - *(float *)(path + 0x10), *(float *)(path + 0x24) - *(float *)(path + 0x14)); } else { FUN_L14_002feca8(moby); } break; case 6: - if (FUN_L00_0025c698(moby, d->knock) & 3) { - FUN_L00_0025f090(moby, moby->position, -1, 1.0f, 13.0f); + if (mine_fall(moby, d->knock) & 3) { + cart_burst(moby, moby->position, -1, 1.0f, 13.0f); mark_moby_for_removal(moby); return; } @@ -405,7 +406,7 @@ void FUN_L14_002fe2a0(L16CrateMoby *moby) { } break; } - FUN_L00_0025d538(moby, d->effect); + trooper_anim_finish(moby, d->effect); } /* Level overlay code after unclassified; generated by `decomp overlays stubs`, stubs replaced by C as functions are matched. */ @@ -413,9 +414,9 @@ void FUN_L14_002fe2a0(L16CrateMoby *moby) { /* Ported from rac1-decomp (src/overlays/l16_kalebo3/vendor_002A50F0.c: func_L16_002E5408), where it is exact; names translated to the US level program. */ extern float absolute_float(float) __asm__("func_001F99C0"); -extern float FUN_001f9e90(float, float); -extern float FUN_L00_0025b8c0(float *p, float *v, float t, float u1, float u2, float eps); -extern int FUN_L00_0025d808(char *, float *, float *, float *, int, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); +extern float vendor_spring(float *p, float *v, float t, float u1, float u2, float eps) __asm__("FUN_L00_0025b8c0"); +extern int sample_path(char *, float *, float *, float *, int, float) __asm__("FUN_L00_0025d808"); extern float D_L14_00161FB8 __attribute__((sda)); extern char *D_L14_001B0BB0[]; extern void subtract_vector_xyz(void *, void *, void *); @@ -436,25 +437,25 @@ int FUN_L14_002fea80(struct Moby *moby) { path = D_L14_001B0BB0[*(int *)(data + 0xDC)]; else path = D_L14_001B0BB0[*(int *)(data + 0xD8)]; - r = FUN_L00_0025d808(path, pos, (float *)(data + 0xD0), (float *)(data + 0xD4), 0, t); - FUN_L00_0025b8c0(&moby->pos.x, (float *)(data + 0xE4), pos[0], D_L14_00161FBC, + r = sample_path(path, pos, (float *)(data + 0xD0), (float *)(data + 0xD4), 0, t); + vendor_spring(&moby->pos.x, (float *)(data + 0xE4), pos[0], D_L14_00161FBC, D_L14_00161FC0, 0.0f); - FUN_L00_0025b8c0(&moby->pos.y, (float *)(data + 0xE8), pos[1], D_L14_00161FBC, + vendor_spring(&moby->pos.y, (float *)(data + 0xE8), pos[1], D_L14_00161FBC, D_L14_00161FC0, 0.0f); - FUN_L00_0025b8c0(&moby->pos.z, (float *)(data + 0xEC), pos[2], D_L14_00161FBC, + vendor_spring(&moby->pos.z, (float *)(data + 0xEC), pos[2], D_L14_00161FBC, D_L14_00161FC0, 0.0f); subtract_vector_xyz(delta, pos, &moby->pos); if (absolute_float(delta[0]) > 0.01f) { if (absolute_float(delta[1]) > 0.01f) { - FUN_L00_00258278(moby, FUN_001f9e90(delta[0], delta[1]), (float *)(data + 0xF0), + FUN_L00_00258278(moby, fast_arc_tan(delta[0], delta[1]), (float *)(data + 0xF0), D_L14_00161FBC, D_L14_00161FC0, 0.0f); } } return r; } extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); -extern void FUN_001f9a10(void *, void *, void *); -extern float FUN_001f9e90(float, float); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); #include "sda.h" extern unsigned char D_0015EDB0; #include "qcopy.h" @@ -517,18 +518,18 @@ typedef struct { } L14Player; extern unsigned char D_0015EDB0_b __asm__("D_0015EDB0"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); -extern int FUN_001f9740(int *); +extern int fast_dec_timer(int *) __asm__("FUN_001f9740"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void build_spherical_offset(void *, float, float, float) __asm__("FUN_00214db0"); -extern void FUN_L00_002628d8(float, float, void *, void *, int); +extern void update_joint_animation(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); typedef struct { u8 pad0[0x454]; u8 collected[1]; @@ -550,16 +551,17 @@ extern struct { } D_L14_0016CF60; extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); extern void FUN_L02_002e0cd8(void *); -extern void FUN_L00_002668a0(void *, void *); -extern int FUN_L00_00266448(void *, void *); -extern void FUN_L00_002502a0(int); -extern void FUN_L00_00284e50(void *, void *); +extern void initialize_npc_dialogue(void *, void *) __asm__("FUN_L00_002668a0"); +extern int update_npc_dialogue(void *, void *) __asm__("FUN_L00_00266448"); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern void FUN_L00_00262d38(int); extern void memcard_save_data(int, int) __asm__("FUN_0020b178"); extern s32 D_0014C190_257218[][64] __asm__("D_0014C190"); /* Watcher moby update: gated by its collectable and trigger, primes a camera target, then turns its head toward the hero. */ -void FUN_L14_002fefe0(L14WatchMoby *m) { +void sam_update(L14WatchMoby *m) __asm__("FUN_L14_002fefe0"); +void sam_update(L14WatchMoby *m) { L14WatchScratch scratch; L14WatchData *d = (L14WatchData *)m->data; float rate; @@ -584,7 +586,7 @@ void FUN_L14_002fefe0(L14WatchMoby *m) { return; } d->p20 = (void *)D_L14_00161FE8; - FUN_L00_002668a0(m, d); + initialize_npc_dialogue(m, d); m->state = 1; d->b8 = 1; break; @@ -593,15 +595,15 @@ void FUN_L14_002fefe0(L14WatchMoby *m) { if (d->b8 == 1 && is_point_inside_clip_volume(&hero.motion.pos, d->i40)) { if (visited52[m->bB0 + current_level_index * 16] != 0xFF) { char *t; - FUN_L00_002502a0(m->bB0); + jet_clear_persistent(m->bB0); t = D_L14_001600EC + d->i44 * 128; - FUN_L00_00284e50(t + 0x30, t + 0x70); + jet_reset_camera(t + 0x30, t + 0x70); } d->fC = 255.0f; } else { d->fC = 3.0f; } - if (FUN_L00_00266448(m, d)) { + if (update_npc_dialogue(m, d)) { char *t = D_L14_001600EC + d->i48 * 128; D_L14_0016CF60.h46 = 1; qcopy(D_L14_0016CF60.q10, t + 0x30); @@ -635,20 +637,20 @@ void FUN_L14_002fefe0(L14WatchMoby *m) { char *g = (char *)&hero.motion.pos; L14Player *q; tracking = 1; - if (FUN_001f9b80(m->position, g) < 8.0f && + if (vector_distance(m->position, g) < 8.0f && (q = (L14Player *)(g - 0x80), fast_difference_between_rotations( - m->yaw, FUN_001f9e90(q->aim[0] - m->position[0], q->aim[1] - m->position[1]))) < + m->yaw, fast_arc_tan(q->aim[0] - m->position[0], q->aim[1] - m->position[1]))) < 1.5707964f) { if (fast_vec_length(g + 0x80) > 0.01f) d->moving_timer = scale_game_frames(120); else - FUN_001f9740(&d->moving_timer); + fast_dec_timer(&d->moving_timer); } else if (d->moving_timer) { d->moving_timer = 0; qcopy(d->target, hero.motion.unkD0.f); } - if (FUN_001f9740(&d->target_timer)) { + if (fast_dec_timer(&d->target_timer)) { float heading; d->target_timer = truncate_float_to_s32(multiply_global_factor_ed64(random_float_between(180.0f, 300.0f))); @@ -656,7 +658,7 @@ void FUN_L14_002fefe0(L14WatchMoby *m) { fast_add_rotations(m->yaw, random_float_between(-90.0f, 90.0f) * DEG_TO_RAD); build_spherical_offset(d->target, 6.0f, heading, random_float_between(0.0f, 30.0f) * DEG_TO_RAD); - FUN_001f9a10(d->target, d->target, m->position); + fast_vec_add(d->target, d->target, m->position); } if (d->moving_timer) { qcopy(scratch.target, hero.motion.unkD0.f); @@ -671,9 +673,9 @@ void FUN_L14_002fefe0(L14WatchMoby *m) { float pitch; qcopy(scratch.eye, m->position); scratch.eye[2] += 1.0f; - FUN_001f9a28(scratch.delta, scratch.target, scratch.eye); - yaw = fast_subtract_rotations(FUN_001f9e90(scratch.delta[0], scratch.delta[1]), m->yaw); - pitch = -FUN_001f9e90(vector_length_xy(scratch.delta), scratch.delta[2]); + fast_vec_sub(scratch.delta, scratch.target, scratch.eye); + yaw = fast_subtract_rotations(fast_arc_tan(scratch.delta[0], scratch.delta[1]), m->yaw); + pitch = -fast_arc_tan(vector_length_xy(scratch.delta), scratch.delta[2]); if (yaw > 1.5707964f) yaw = 1.5707964f; else if (yaw < -1.5707964f) @@ -688,6 +690,6 @@ void FUN_L14_002fefe0(L14WatchMoby *m) { } if (D_0015EDB0_b) d->height = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); } diff --git a/src/overlays/l14/gameplay/entities/jet.c b/src/overlays/l14/gameplay/entities/jet.c index 6468b67b1f..1cff561d4f 100644 --- a/src/overlays/l14/gameplay/entities/jet.c +++ b/src/overlays/l14/gameplay/entities/jet.c @@ -44,7 +44,7 @@ extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float integer_to_float_l14(int) __asm__("FUN_001fa6c0"); -extern float normalize_rotation_l14(float) __asm__("FUN_L00_0025e310"); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern float spread_l14(float, float) __asm__("FUN_L00_00257c48"); extern void enqueue_callback_l14(void *, void *) __asm__("FUN_001f4600"); void FUN_L14_002df458(struct Moby *); @@ -94,7 +94,7 @@ void FUN_L14_002df138(u8 *moby) { b = 0.0f; } else { a = (f32)i; - b = fast_sin(normalize_rotation_l14(d[0x1E0 / 4] + (a * step))) * 0.1f; + b = fast_sin(normalize_angle(d[0x1E0 / 4] + (a * step))) * 0.1f; b += spread_l14(0.0f, 0.2f); } d[(i * 4) + 2] = b; @@ -122,8 +122,8 @@ void FUN_L14_002df138(u8 *moby) { for (i = 0; i < 19; i++) { c = (f32)i; d[(i * 4) + (0xA8 / 4)] = 0.0f; - t = normalize_rotation_l14(d[0x1E4 / 4] + (c * 0.99483764f)); - u = fast_sin(normalize_rotation_l14(d[0x1E8 / 4] + (c * 0.20944f))) * 0.75f; + t = normalize_angle(d[0x1E4 / 4] + (c * 0.99483764f)); + u = fast_sin(normalize_angle(d[0x1E8 / 4] + (c * 0.20944f))) * 0.75f; d[(i * 4) + (0xA8 / 4)] += (u * fast_sin(t)) + spread_l14(0.0f, 0.2f); d[(i * 4) + (0xA4 / 4)] = fast_cos(t) * 0.5f; d[(i * 4) + (0xA0 / 4)] = c * 0.39f; @@ -172,7 +172,7 @@ extern f32 fast_cos_df510(f32) __asm__("FUN_001f9dc8"); extern f32 fast_sin_df510(f32) __asm__("FUN_001f9de0"); extern void euler_matrix_df510(void *, void *) __asm__("FUN_001fa050"); extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); -extern float FUN_L00_00257e20(float, float, float, float, float); +extern float cubic_hermite_scalar(float, float, float, float, float) __asm__("FUN_L00_00257e20"); extern void cross_vectors_xyz(void *, void *, void *) __asm__("func_001F9AD8"); extern void draw_geometry_quad(void *, int, int) __asm__("func_001F7D30"); extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); @@ -318,7 +318,7 @@ void FUN_L14_002df510(struct Moby *m, void *path, int outer_alpha, int inner_alp qcopy(&q[0].v[1], &q[0].v[3]); qcopy(&q[1].v[0], &q[1].v[2]); qcopy(&q[1].v[1], &q[1].v[3]); - f = FUN_L00_00257e20(-1.0f, 0.0f, 1.0f, 0.0f, convert_integer_to_float(i) / convert_integer_to_float(n)) * 0.0f + 0.2f; + f = cubic_hermite_scalar(-1.0f, 0.0f, 1.0f, 0.0f, convert_integer_to_float(i) / convert_integer_to_float(n)) * 0.0f + 0.2f; w[0].z = f; w[1].z = 2.0f * f; q[0].uv[0][0] = *(float *)(d + 0x1EC) + 0.0f; @@ -410,24 +410,25 @@ extern int lift_inside(void *, int) __asm__("FUN_00214720"); extern void attach_manipulator(void *arg0, s32 arg1, void *arg2) __asm__("FUN_0020cb10"); extern void lift_print(const char *, short) __asm__("FUN_001e93b0"); extern void lift_remove(void *) __asm__("FUN_0020c828"); -extern void FUN_L01_002f5168(void *); +extern void gunship_follow_path(void *) __asm__("FUN_L01_002f5168"); extern void FUN_L00_0024f7c8(void *, int, void *); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void lift_xform(void *, void *, void *) __asm__("FUN_001f9d20"); extern void lift_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void lift_sub(void *, void *, void *) __asm__("FUN_001f9a28"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int lift_sound(int, int, void *) __asm__("FUN_0022da68"); extern float lift_add_rot(float, float) __asm__("FUN_001fa580"); extern void FUN_L00_001fff28(void *, int, float); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern int lift_frames(int) __asm__("FUN_001f96f8"); extern float lift_itof(int) __asm__("FUN_001fa6c0"); extern int lift_tick(short *) __asm__("FUN_001f9770"); extern float lift_length(void *) __asm__("FUN_001f9af0"); extern void lift_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); -void FUN_L14_002e7bd8(struct Moby *m) { +void shuttle_update(struct Moby *m) __asm__("FUN_L14_002e7bd8"); +void shuttle_update(struct Moby *m) { L14LiftVars *d; Vec4 old; Vec4 rot; @@ -480,7 +481,7 @@ void FUN_L14_002e7bd8(struct Moby *m) { d->riding = 0; d->from = d->height; } - FUN_L01_002f5168(m); + gunship_follow_path(m); rider = &D_L14_0015FFD8_lift[d->rider]; if (d->mode == 0x3039) { if (d->anchor != -1) @@ -491,12 +492,12 @@ void FUN_L14_002e7bd8(struct Moby *m) { lift_xform(&off, d->offset, mat); lift_add(&rider->pos, &base, &off); } - if (d->sound == -1 || (FUN_L00_0028d8c0(m, d->sound) == 0 && d->sound == -1)) + if (d->sound == -1 || (voice_is_playing(m, d->sound) == 0 && d->sound == -1)) d->sound = lift_sound(0, 4, m); d->angle = lift_add_rot(d->angle, 0.17453292f); FUN_L00_001fff28(d->wobble, 0, d->angle); lift_sub(&delta, &m->pos, &old); - FUN_L00_00260738(d->spring, &delta, &rot, &m->rot); + update_entity_matrix(d->spring, &delta, &rot, &m->rot); if (hero.state.control_mode == 13 && hero.unk964 == rider) { if (d->riding == 0) { d->riding = 1; @@ -1010,8 +1011,8 @@ void FUN_L14_002ec810(struct Moby *m) { /* Ported from rac1-decomp (src/overlays/l14_oltanis/vendor_002E0538.c: func_L14_002EE150), where it is exact; names translated to the US level program. */ extern char *func_0020D348_m(int); -extern float FUN_001f9b20(void *); -extern float FUN_001f9e90(float, float); +extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void FUN_L00_00250df8(void *); void blend_moby_animation(MobyAnim *arg0, int arg1, int arg2, int arg3) __asm__("FUN_00212f90"); @@ -1026,8 +1027,8 @@ char *FUN_L14_002eccf0(void *a, float *b, int c, int d) { *(short *)(m + 0x32) = 0x7F; m[0x31] = 1; data = *(char **)(m + 0x78); - *(float *)(m + 0x44) = -FUN_001f9e90(FUN_001f9b20(b), b[2]); - *(float *)(m + 0x48) = FUN_001f9e90(b[0], b[1]); + *(float *)(m + 0x44) = -fast_arc_tan(vector_length_xy(b), b[2]); + *(float *)(m + 0x48) = fast_arc_tan(b[0], b[1]); qcopy(m + 0x10, a); qcopy(data + 0x10, a); qcopy(data, b); @@ -1176,7 +1177,7 @@ extern float D_L14_00161CD0[]; extern float FUN_L00_00257c48(float, float); extern int D_L14_0015F5C4; extern int D_L14_00161CB4; -extern int FUN_001fa728(void *, float); +extern int fast_bsphere_check(void *, float) __asm__("FUN_001fa728"); extern int tick_countdown_32_alt(void *) __asm__("FUN_001f9740"); extern s32 random_integer_below(s32) __asm__("func_00213260"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); @@ -1187,7 +1188,7 @@ extern short D_L14_00161C5C __attribute__((sda)); extern short D_L14_00161C60 __attribute__((sda)); extern short D_L14_00161C64 __attribute__((sda)); extern void FUN_L00_0028e990(void); -extern void FUN_L00_00298840(int); +extern void start_scene(int) __asm__("FUN_L00_00298840"); extern void FUN_L01_002a2480(void); extern void FUN_L14_002ed530(char *); extern int *D_L14_001B0F30_ee[] __asm__("D_L14_001B0BB0"); @@ -1214,7 +1215,7 @@ void FUN_L14_002ed280(struct Moby *moby) { if (D_L14_0015F5C4 != 0) return; p = (unsigned char *)D_0013D24D + 0x13B; if (p[0x68] != 0) return; - FUN_L00_00298840(0); + start_scene(0); p[0x68] = st; MOBY(moby)->state = 2; FUN_L00_0028e990(); @@ -1235,7 +1236,7 @@ void FUN_L14_002ed280(struct Moby *moby) { qcopy(v, (char *)path + i * 16 + 0x10); v[2] += *(float *)&D_L14_00161C64; v[3] = *(float *)&D_L14_00161C60; - if (FUN_001fa728(v, 255.0f) > 0) { + if (fast_bsphere_check(v, 255.0f) > 0) { idx[n++] = i; } } @@ -1276,8 +1277,8 @@ extern s32 D_L14_00161CF4; extern s32 D_L14_00161CF8_macro[] __asm__("D_L14_00161CF8") __attribute__((section(".sdata"))); extern f32 D_L14_001DFD80_d530[40][4] __asm__("D_L14_001DFD80"); extern s16 D_L14_001E0000[40]; -extern f32 D_L14_001E0050_d530[3][16][4] __asm__("D_L14_001E0050"); -extern u16 D_L14_001E0350_d530[3][16] __asm__("D_L14_001E0350"); +f32 D_L14_001E0050_d530[3][16][4] __asm__("D_L14_001E0050") = {0}; +u16 D_L14_001E0350_d530[3][16] __asm__("D_L14_001E0350") = {0}; extern void arc_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern float arc_length(void *) __asm__("FUN_001f9af0"); extern float arc_itof(int) __asm__("FUN_001fa6c0"); @@ -1453,7 +1454,7 @@ extern V_2EF078 D_L14_001E0050[]; extern char D_L14_001674C0[]; extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); extern float D_L14_00161CD0_c[] __asm__("D_L14_00161CD0") __attribute__((section(".sdata"))); -extern float FUN_L00_00257e20(float, float, float, float, float); +extern float cubic_hermite_scalar(float, float, float, float, float) __asm__("FUN_L00_00257e20"); extern int D_L14_00161C70_gp __asm__("D_L14_00161C70") __attribute__((sda)); extern int D_L14_00161C78 __attribute__((sda)); extern int D_L14_00161C7C __attribute__((sda)); @@ -1585,7 +1586,7 @@ void FUN_L14_002edc18(void) { qcopy(&q[0].v[1], &q[0].v[3]); qcopy(&q[1].v[0], &q[1].v[2]); qcopy(&q[1].v[1], &q[1].v[3]); - sz[0].z = D_L14_00161C84 + (D_L14_00161C80 - D_L14_00161C84) * FUN_L00_00257e20(-1.0f, 0.0f, 1.0f, 0.0f, convert_integer_to_float(i) / convert_integer_to_float(0x28)); + sz[0].z = D_L14_00161C84 + (D_L14_00161C80 - D_L14_00161C84) * cubic_hermite_scalar(-1.0f, 0.0f, 1.0f, 0.0f, convert_integer_to_float(i) / convert_integer_to_float(0x28)); sz[1].z = sz[0].z * D_L14_00161C88; } qcopy(&m2[0], &m[0]); @@ -1605,7 +1606,7 @@ void FUN_L14_002edc18(void) { q[0].col[1] = c; q[0].col[0] = c; q[1].col[0] = q[1].col[1] = D_L14_00161C7C | ((a >> 1) << 24); - sz[0].z = (D_L14_00161C84 + (D_L14_00161C80 - D_L14_00161C84) * FUN_L00_00257e20(-1.0f, 0.0f, 1.0f, 0.0f, convert_integer_to_float(D_L14_00161CF8_macro[j]) / convert_integer_to_float(0x28))) * 0.75f; + sz[0].z = (D_L14_00161C84 + (D_L14_00161C80 - D_L14_00161C84) * cubic_hermite_scalar(-1.0f, 0.0f, 1.0f, 0.0f, convert_integer_to_float(D_L14_00161CF8_macro[j]) / convert_integer_to_float(0x28))) * 0.75f; sz[1].z = sz[0].z * 4.0f; qcopy(&q[0].v[0], &sz[0]); scale_vector_xyz(&q[0].v[1], &q[0].v[0], -1.0f); @@ -1765,7 +1766,8 @@ typedef struct { } L14VendorVars; extern s32 D_0014C190_257218[][64] __asm__("D_0014C190"); /* Vendor platform update: rides its two rails between the trigger volumes, with hum and motor sounds. */ -void FUN_L14_002ee8d8(struct Moby *m) { +void elevator_update(struct Moby *m) __asm__("FUN_L14_002ee8d8"); +void elevator_update(struct Moby *m) { L14VendorVars *d = (L14VendorVars *)m->pvars; Vec4 old; Vec4 rot; @@ -1848,7 +1850,7 @@ void FUN_L14_002ee8d8(struct Moby *m) { } break; case 2: - if (FUN_L00_0028d8c0(m, d->motor) == 0) { + if (voice_is_playing(m, d->motor) == 0) { d->motor = vendor_sound(0, 4, m); if (d->motor != 0) { if (d->motor_volume < 0) @@ -1863,11 +1865,11 @@ void FUN_L14_002ee8d8(struct Moby *m) { } FUN_L14_002ef630((u8 *)m); vendor_sub(&delta, &m->pos, &old); - FUN_L00_00260738(d->spring, &delta, &rot, &m->rot); + update_entity_matrix(d->spring, &delta, &rot, &m->rot); break; case 3: if (vendor_length(d->vel) >= 0.001f) { - if (FUN_L00_0028d8c0(m, d->motor) == 0) + if (voice_is_playing(m, d->motor) == 0) d->motor = vendor_sound(0, 4, m); level = vendor_itof(d->level); vendor_spring(&level, vendor_itof(d->motor_volume) * 0.25f, &d->level_vel, 0.003f, 0.2f, 0.0f); @@ -1902,7 +1904,7 @@ void FUN_L14_002ee8d8(struct Moby *m) { FUN_L14_002ef3e0(m); if (hero.ground_moby == m) { vendor_sub(&delta, &m->pos, &old); - FUN_L00_00260738(d->spring, &delta, &rot, &m->rot); + update_entity_matrix(d->spring, &delta, &rot, &m->rot); } } } @@ -1962,7 +1964,7 @@ extern char *D_L14_001B0BB0_c3[] __asm__("D_L14_001B0BB0"); extern float D_0015ED6C_c __asm__("D_0015ED6C"); extern float FUN_L00_0025b750(float, float, float); extern float FUN_L00_0025b8c0(float *p, float *v, float t, float u1, float u2, float eps); -extern int FUN_L00_0025d808() __asm__("FUN_L00_0025d808"); +extern int sample_path() __asm__("FUN_L00_0025d808"); extern int FUN_L00_0025d808_2f05d8(void *, void *, void *, void *, int, float) __asm__("FUN_L00_0025d808"); @@ -2195,15 +2197,15 @@ extern char D_0013E550[]; extern float advance_accelerated_scalar_c(float, float, float, float, float *, float *) __asm__("FUN_00213f38"); extern f32 taxi_add_rot(f32 a, f32 b) __asm__("FUN_001fa580"); extern f32 taxi_sub_rot(f32, f32) __asm__("FUN_001fa5c8"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L05_003195f8(char *); extern void lerp_vector(void *, void *, void *, float) __asm__("FUN_001f9a40"); -extern void FUN_001f9d20(void *, void *, void *); +extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); -extern void FUN_L00_00260738(void *a, void *b, void *c, void *d); +extern void update_entity_matrix(void *a, void *b, void *c, void *d) __asm__("FUN_L00_00260738"); extern void FUN_L00_00266858(void *, int); extern void FUN_L00_002e8450(int, float, float); -extern float FUN_L00_00257e20(float, float, float, float, float); +extern float cubic_hermite_scalar(float, float, float, float, float) __asm__("FUN_L00_00257e20"); extern void FUN_L05_00319510(void *); extern void FUN_L05_00319740(char *); extern void FUN_L05_003198e8(char *); @@ -2221,7 +2223,8 @@ void FUN_L14_002f13f8(struct Moby *moby); extern void taxi_sample_f(s32 *, int, void *, void *, int, float) __asm__("FUN_00214e58"); /* Ported from rac1-decomp src/overlays/l14_oltanis/vendor_002E0538.c (func_L14_002F19C0) */ -void FUN_L14_002f0538(struct Moby *moby) { +void taxi_update(struct Moby *moby) __asm__("FUN_L14_002f0538"); +void taxi_update(struct Moby *moby) { L14TaxiVars *d = (L14TaxiVars *)moby->pvars; float v00[4], v10[4], v20[4], v30[4], v40[4], v50[4], v60[4], v70[4]; float m80[16]; @@ -2244,7 +2247,7 @@ void FUN_L14_002f0538(struct Moby *moby) { transpose_rotation_matrix(v30, &moby->rot_row0); taxi_sub(v70, &g->motion.pos, &moby->pos); v70[3] = 0; - FUN_001f9d20(v70, v70, v30); + transform_vector(v70, v70, v30); if (taxi_fabs(v70[1]) < 1.2f) { FUN_L14_002f1140(moby); FUN_L14_002f13f8(moby); @@ -2339,7 +2342,7 @@ void FUN_L14_002f0538(struct Moby *moby) { qcopy(v30, d->save_pos); qcopy(v50, d->save_rot); taxi_sample_f(d->path, wrap, v40, v60, flags, 0.0f); - f = FUN_L00_00257e20(1.0f, 0.0f, 1.0f, 0.0f, d->t); + f = cubic_hermite_scalar(1.0f, 0.0f, 1.0f, 0.0f, d->t); lerp_vector(d->pos, v30, v40, f); d->rot[1] = taxi_add_rot(taxi_sub_rot(v60[1], v50[1]) * f, v50[1]); d->rot[2] = taxi_add_rot(taxi_sub_rot(v60[2], v50[2]) * f, v50[2]); @@ -2382,7 +2385,7 @@ void FUN_L14_002f0538(struct Moby *moby) { transpose_rotation_matrix(m80, &moby->rot_row0); taxi_sub(v70, &g->motion.pos, &moby->pos); v70[3] = 0; - FUN_001f9d20(v70, v70, m80); + transform_vector(v70, v70, m80); if (taxi_fabs(v70[1]) < 1.2f) { FUN_L14_002f13f8(moby); if (*(int *)D_0013CAE4 & button) { @@ -2430,10 +2433,10 @@ void FUN_L14_002f0538(struct Moby *moby) { g->unk1F4 = 2; FUN_L05_003198e8((char *)moby); } - if (FUN_L00_0028d8c0(moby, d->sound) == 0) { + if (voice_is_playing(moby, d->sound) == 0) { d->sound = taxi_sound(0, 4, moby); } - } else if (FUN_L00_0028d8c0(moby, d->sound) != 0) { + } else if (voice_is_playing(moby, d->sound) != 0) { int h = d->sound; if (h != -1) { char *e = D_0013E550 + h * 0x70; @@ -2444,7 +2447,7 @@ void FUN_L14_002f0538(struct Moby *moby) { d->sound = -1; } taxi_sub(v20, &moby->pos, v00); - FUN_L00_00260738(d->spring, v20, v10, &moby->rot); + update_entity_matrix(d->spring, v20, v10, &moby->rot); } extern float FUN_001f9b48_2f1040(void *, void *) __asm__("FUN_001f9b48"); struct L14PathPoint { @@ -2645,19 +2648,19 @@ typedef struct { } L14Player; extern unsigned char D_0015EDB0_b __asm__("D_0015EDB0"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); -extern float FUN_001fa5c8(float, float); +extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); -extern int FUN_001f9740(int *); +extern int fast_dec_timer(int *) __asm__("FUN_001f9740"); extern int FUN_001fa6d0(float); extern int FUN_00214720_c(void *, int) __asm__("FUN_00214720"); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void build_spherical_offset(void *, float, float, float) __asm__("FUN_00214db0"); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_002628d8(float, float, void *, void *, int); +extern void update_joint_animation(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); typedef struct { u8 pad0[0x454]; @@ -2672,11 +2675,11 @@ extern char *D_L14_001600EC; extern unsigned char *D_L14_0015FFD8; extern int D_L14_0015F5C4; extern void FUN_L02_002e0cd8(void *); -extern void FUN_L00_002668a0(void *, void *); -extern int FUN_L00_00266448(void *, void *); -extern void FUN_L01_002783a8(void *, float); -extern void FUN_L00_002502a0(int); -extern void FUN_L00_00284e50(void *, void *); +extern void initialize_npc_dialogue(void *, void *) __asm__("FUN_L00_002668a0"); +extern int update_npc_dialogue(void *, void *) __asm__("FUN_L00_00266448"); +extern void begin_dialogue_camera_transition(void *, float) __asm__("FUN_L01_002783a8"); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern void FUN_L14_002ef578_c(void *) __asm__("FUN_L14_002ef578"); void FUN_L14_002ef5a8(Level14VendorMoby *m); extern void FUN_L00_00263d40(int, int); @@ -2684,7 +2687,8 @@ extern void FUN_L00_00260860(int, int); extern void memcard_save_data(int, int) __asm__("FUN_0020b178"); /* Watcher moby update: gated by its collectable and trigger, then turns its head toward the hero or a random target. */ -void FUN_L14_002fba20(L14WatchMoby *m) { +void qwark_oltanis_update(L14WatchMoby *m) __asm__("FUN_L14_002fba20"); +void qwark_oltanis_update(L14WatchMoby *m) { L14WatchScratch scratch; L14WatchData *d = (L14WatchData *)m->data; float rate; @@ -2710,7 +2714,7 @@ void FUN_L14_002fba20(L14WatchMoby *m) { return; } d->p20 = (void *)D_L14_00161F20; - FUN_L00_002668a0(m, d); + initialize_npc_dialogue(m, d); d->b8 = 1; m->state = 1; break; @@ -2719,17 +2723,17 @@ void FUN_L14_002fba20(L14WatchMoby *m) { if (d->b8 == 1 && FUN_00214720_c(&hero.motion.pos, d->i40)) { if (visited52[m->bB0 + current_level_index * 16] != 0xFF) { char *t; - FUN_L00_002502a0(m->bB0); + jet_clear_persistent(m->bB0); t = D_L14_001600EC + d->i48 * 128; - FUN_L00_00284e50(t + 0x30, t + 0x70); + jet_reset_camera(t + 0x30, t + 0x70); } FUN_L14_002ef578_c(D_L14_0015FFD8 + d->i44 * 256); d->fC = 255.0f; } else { d->fC = 1.7f; } - if (FUN_L00_00266448(m, d)) { - FUN_L01_002783a8(m, 3.0f); + if (update_npc_dialogue(m, d)) { + begin_dialogue_camera_transition(m, 3.0f); m->state = 2; } break; @@ -2762,20 +2766,20 @@ void FUN_L14_002fba20(L14WatchMoby *m) { char *g = (char *)&hero.motion.pos; L14Player *q; tracking = 1; - if (FUN_001f9b80(m->position, g) < 8.0f && + if (vector_distance(m->position, g) < 8.0f && (q = (L14Player *)(g - 0x80), fast_difference_between_rotations( - m->yaw, FUN_001f9e90(q->aim[0] - m->position[0], q->aim[1] - m->position[1]))) < + m->yaw, fast_arc_tan(q->aim[0] - m->position[0], q->aim[1] - m->position[1]))) < 1.5707964f) { if (fast_vec_length(g + 0x80) > 0.01f) d->moving_timer = scale_game_frames(120); else - FUN_001f9740(&d->moving_timer); + fast_dec_timer(&d->moving_timer); } else if (d->moving_timer) { d->moving_timer = 0; qcopy(d->target, hero.motion.unkD0.f); } - if (FUN_001f9740(&d->target_timer)) { + if (fast_dec_timer(&d->target_timer)) { float heading; d->target_timer = FUN_001fa6d0(multiply_global_factor_ed64(random_float_between(180.0f, 300.0f))); heading = @@ -2797,9 +2801,9 @@ void FUN_L14_002fba20(L14WatchMoby *m) { float pitch; qcopy(scratch.eye, m->position); scratch.eye[2] += 1.0f; - FUN_001f9a28(scratch.delta, scratch.target, scratch.eye); - yaw = FUN_001fa5c8(FUN_001f9e90(scratch.delta[0], scratch.delta[1]), m->yaw); - pitch = -FUN_001f9e90(FUN_001f9b20(scratch.delta), scratch.delta[2]); + fast_vec_sub(scratch.delta, scratch.target, scratch.eye); + yaw = fast_subtract_rotations(fast_arc_tan(scratch.delta[0], scratch.delta[1]), m->yaw); + pitch = -fast_arc_tan(vector_length_xy(scratch.delta), scratch.delta[2]); if (yaw > 1.5707964f) yaw = 1.5707964f; else if (yaw < -1.5707964f) @@ -2814,8 +2818,8 @@ void FUN_L14_002fba20(L14WatchMoby *m) { } if (D_0015EDB0_b) d->height = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); } extern int cart_hit(struct Moby *, int, int) __asm__("FUN_L00_0025a420"); extern void cart_burst(float, float, struct Moby *, void *, int) __asm__("FUN_L00_0025f090"); @@ -3068,7 +3072,7 @@ void FUN_L14_002fc890(struct Moby *moby) { *(int *)(data + 0x60) = 0; *(int *)(data + 0x64) = 0; qcopy(&moby->pos, path + 4); - moby->rot.z = FUN_001f9e90(path[8] - path[4], path[9] - path[5]); + moby->rot.z = fast_arc_tan(path[8] - path[4], path[9] - path[5]); *(float *)(data + 0x80) = *(float *)(data + 0x84) = *(float *)(data + 0x88) = *(float *)(data + 0x70) = *(float *)(data + 0x74) = *(float *)(data + 0x78) = 0.0f; } @@ -3100,10 +3104,10 @@ void FUN_L14_002fc9a0(struct Moby *moby) { subtract_vector_xyz_c(t, v, &moby->pos); if (absolute_float(t[0]) > 0.01f) { if (absolute_float(t[1]) > 0.01f) { - a = FUN_001f9e90(t[0], t[1]); + a = fast_arc_tan(t[0], t[1]); b = fast_subtract_rotations(moby->rot.z, a); FUN_L00_00258278(moby, (float *)(d + 0x88), a, (*(float *)&D_L14_00161F4C), (*(float *)&D_L14_00161F50), 0.0f); - c = FUN_001f9e90(vector_length_xy_c(t), t[2]); + c = fast_arc_tan(vector_length_xy_c(t), t[2]); FUN_L00_0025b8c0(&moby->rot.y, (float *)(d + 0x84), -c, (*(float *)&D_L14_00161F4C), (*(float *)&D_L14_00161F50), 0.0f); b = b / (*(float *)&D_L14_00161F58); if (b > 1.0f) b = 1.0f; @@ -3133,7 +3137,7 @@ extern int tram_frames(int) __asm__("FUN_001f96f8"); extern void tram_release(s32) __asm__("FUN_0022d798"); extern int tram_inside(void *, int) __asm__("FUN_00214720"); extern int tram_sound(int, int, void *) __asm__("FUN_0022da68"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int D_L14_001BABD0[]; extern unsigned char D_0013D408_t[] __asm__("D_0013D408"); extern char D_L14_001FCE98[]; @@ -3324,7 +3328,7 @@ void FUN_L14_002fcbb0(struct Moby *m) { break; } FUN_L14_002fd310(m); - if (m->state != 0 && m->state != 3 && m->state != 1 && FUN_L00_0028d8c0(m, d->sound) == 0) + if (m->state != 0 && m->state != 3 && m->state != 1 && voice_is_playing(m, d->sound) == 0) d->sound = tram_sound(0, 4, m); } extern f32 D_L14_00161F60 __attribute__((sda)); @@ -3450,10 +3454,10 @@ extern u8 *D_L14_00167500 __attribute__((section(".data"))); extern char D_0013E550[]; extern f32 fast_subtract_rotations(f32, f32) __asm__("func_001FA5C8"); extern float D_0015ED6C_f2 __asm__("D_0015ED6C"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float FUN_L00_0025b8c0(float *p, float *v, float t, float u1, float u2, float eps); extern float vector_length_xy(void *); -extern int FUN_L00_0025d808() __asm__("FUN_L00_0025d808"); +extern int sample_path() __asm__("FUN_L00_0025d808"); extern float D_L14_00161F7C __attribute__((sda)); extern float D_L14_00161F80 __attribute__((sda)); extern float D_L14_00161F84 __attribute__((sda)); @@ -3500,10 +3504,10 @@ int FUN_L14_002fd918(struct Moby *m) { subtract_vector_xyz(w, v, &m->pos); if (0.01f < absolute_float(w[0])) { if (0.01f < absolute_float(w[1])) { - yaw = FUN_001f9e90(w[0], w[1]); + yaw = fast_arc_tan(w[0], w[1]); t = fast_subtract_rotations(m->rot.z, yaw); FUN_L00_00258278(m, (float *)(d + 0x88), yaw, D_L14_00161F7C, D_L14_00161F80, 0.0f); - yaw = FUN_001f9e90(vector_length_xy(w), w[2]); + yaw = fast_arc_tan(vector_length_xy(w), w[2]); FUN_L00_0025b8c0(&m->rot.y, (float *)(d + 0x84), -yaw, D_L14_00161F7C, D_L14_00161F80, 0.0f); t = t / D_L14_00161F88; @@ -3518,7 +3522,7 @@ int FUN_L14_002fd918(struct Moby *m) { return 0; } #include "rnc/overlay/quad.h" -/* pvars of the flyer FUN_L14_002fdbb8 moves to a path point */ +/* pvars of the flyer rocket_update moves to a path point */ typedef struct { s32 point; /* 0x0: path point index into D_L14_001600EC (0x80 each, position at 0x30) */ s32 target; /* 0x4: moby index removed on arrival */ @@ -3530,13 +3534,14 @@ extern s32 D_L14_00161FB0 __attribute__((sda)); extern f32 D_L14_00161FA8 __attribute__((sda)); extern f32 D_L14_00161FAC __attribute__((sda)); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, int, float, float, int, int, int, int); -extern int FUN_L00_0028d8c0(void *, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern void FUN_L14_002fded0(struct Moby *); extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); -void FUN_L14_002fdbb8(struct Moby *moby) { +void rocket_update(struct Moby *moby) __asm__("FUN_L14_002fdbb8"); +void rocket_update(struct Moby *moby) { FlyerVars *vars = (FlyerVars *)moby->pvars; Vec4f diff; OvlVec4 step; @@ -3560,9 +3565,9 @@ void FUN_L14_002fdbb8(struct Moby *moby) { case 1: return; case 2: - FUN_001f9a28(&diff, D_L14_001600EC + vars->point * 0x80 + 0x30, &moby->pos); + fast_vec_sub(&diff, D_L14_001600EC + vars->point * 0x80 + 0x30, &moby->pos); dist = fast_vec_length(&diff); - FUN_001f9740(&vars->timer); + fast_dec_timer(&vars->timer); speed = D_L14_00161FA8 * frame_time; if (dist < speed || dist <= 0.0f) { if (vars->sound != -1) { @@ -3579,20 +3584,21 @@ void FUN_L14_002fdbb8(struct Moby *moby) { qcopy(&moby->pos, D_L14_001600EC + vars->point * 0x80 + 0x30); qcopy(&step, &moby->rot_row0); step.f[2] = 1.0f; - FUN_L00_0025e450(moby, &step, &moby->pos, 0.0f, 0.0f, 0x14, 0xA, 0xC, 10.0f, 6.0f, + spawn_explosion(moby, &step, &moby->pos, 0.0f, 0.0f, 0x14, 0xA, 0xC, 10.0f, 6.0f, 9.0f, 0, 1.0f, 30.0f, 1, 0xA, -1, 0); mark_moby_for_removal(moby); return; } moby->rot.x = fast_add_rotations(moby->rot.x, 2.0f * DEG_TO_RAD); - moby->rot.y = FUN_L00_0025b750(moby->rot.y, -FUN_001f9e90(FUN_001f9b20(&diff), diff.z), D_L14_00161FAC); - moby->rot.z = FUN_L00_0025b750(moby->rot.z, FUN_001f9e90(diff.x, diff.y), D_L14_00161FAC); + moby->rot.y = FUN_L00_0025b750(moby->rot.y, -fast_arc_tan(vector_length_xy(&diff), diff.z), D_L14_00161FAC); + moby->rot.z = FUN_L00_0025b750(moby->rot.z, fast_arc_tan(diff.x, diff.y), D_L14_00161FAC); fast_vec_scale(&step, &moby->rot_row0, speed); add_vector_xyz((u8 *)&moby->pos, (u8 *)&moby->pos, (u8 *)&step); FUN_L14_002fded0(moby); - if (FUN_L00_0028d8c0(moby, vars->sound) == 0) { + if (voice_is_playing(moby, vars->sound) == 0) { vars->sound = allocate_voice_for_target_entry(1, 4, (int)moby); } return; } } + diff --git a/src/overlays/l14/gameplay/entities/morphoray.c b/src/overlays/l14/gameplay/entities/morphoray.c index 93a62a117d..9dad002d37 100644 --- a/src/overlays/l14/gameplay/entities/morphoray.c +++ b/src/overlays/l14/gameplay/entities/morphoray.c @@ -340,8 +340,8 @@ extern char *D_L14_0015FFD8; extern L14LevelState D_L14_001BB930; extern int D_L14_001BABD0[]; extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); -extern int FUN_001f96f8(int); -extern float FUN_001fa6c0(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); +extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); extern int fast_dec_timer(int *) __asm__("FUN_001f9740"); extern void FUN_L10_002f5a50(int); extern void FUN_L14_00305600(struct Moby *); @@ -378,8 +378,8 @@ void FUN_L14_00305408(unsigned char *moby) { D_0014C190_257218[current_level_index][*(short *)(moby + 0xB2) >> 5] |= 1 << (*(unsigned short *)(moby + 0xB2) & 0x1F); D_L14_001BABD0[*(short *)(moby + 0xB2) >> 5] |= 1 << (*(unsigned short *)(moby + 0xB2) & 0x1F); moby[0x20] = 2; - d[1] = FUN_001f96f8(0x78); - ((float *)d)[2] = 1.0f / FUN_001fa6c0(d[1]); + d[1] = scale_game_frames(0x78); + ((float *)d)[2] = 1.0f / convert_integer_to_float(d[1]); FUN_L10_002f5a50(d[4]); break; case 2: @@ -412,8 +412,8 @@ void FUN_L14_00305600(struct Moby *moby) { } while (*(short *)p++ >= 0); } } -extern float FUN_001fa6c0(int); -extern float FUN_L00_00257e20(float, float, float, float, float); +extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); +extern float cubic_hermite_scalar(float, float, float, float, float) __asm__("FUN_L00_00257e20"); /* Per-frame update: slides each listed part toward a rest height by a factor from the moby's animation value. */ void FUN_L14_00305680(struct Moby *moby) { @@ -426,8 +426,8 @@ void FUN_L14_00305680(struct Moby *moby) { if (p == 0) { return; } - x = FUN_001fa6c0(d[1]) * ((float *)d)[2]; - t = FUN_L00_00257e20(-1.0f, 0.0f, 1.0f, 0.0f, 1.0f - x); + x = convert_integer_to_float(d[1]) * ((float *)d)[2]; + t = cubic_hermite_scalar(-1.0f, 0.0f, 1.0f, 0.0f, 1.0f - x); base = D_L14_0015FFD8; h = D_L14_001EE5E0; do { @@ -453,14 +453,15 @@ extern void scale_vector_xyz(void *, void *, f32) __asm__("FUN_001f9a68"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern f32 vector_distance_xy(void *, void *) __asm__("FUN_001f9b80"); extern void FUN_L00_00260860(s32, s32); -extern void FUN_L00_00298840(s32); -extern void FUN_L00_002502a0(s32); +extern void start_scene(s32) __asm__("FUN_L00_00298840"); +extern void jet_clear_persistent(s32) __asm__("FUN_L00_002502a0"); extern int memcard_save_data(s32, s32) __asm__("FUN_0020b178"); extern void queue_dialogue_message(s32, s32) __asm__("FUN_L00_00263d40"); extern void help_request(s32, s32) __asm__("FUN_L00_00203908"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); -void FUN_L14_00305758(struct Moby *moby) { +void morphoray_update(struct Moby *moby) __asm__("FUN_L14_00305758"); +void morphoray_update(struct Moby *moby) { u8 *o = (u8 *)moby; u8 *d = (u8 *)moby->pvars; f32 v[4]; @@ -497,13 +498,13 @@ void FUN_L14_00305758(struct Moby *moby) { else *(s32 *)(d + 0x18) = 0; FUN_L00_00260860(0x15, 1); - FUN_L00_00298840(6); + start_scene(6); moby->state = 2; break; case 2: if (D_L14_0015F5C4 != state) { if (D_0014C050[moby->mission + current_level_index * 16] != 0xFF) { - FUN_L00_002502a0(moby->mission); + jet_clear_persistent(moby->mission); memcard_save_data(0, -1); } if (*(s32 *)(d + 0x18) != 0) @@ -646,8 +647,8 @@ extern s32 allocate_voice_for_target_entry() __asm__("func_0022DA68"); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); extern void scale_vector_xyz(void *, void *, float) __asm__("FUN_001f9a68"); f32 FUN_L00_0025b6a8(f32 a, f32 b, f32 t); -int FUN_L00_0028d8c0(int a, int i); -int FUN_L00_0028dc90(int i, int a1, int v, int k); +int voice_is_playing(int a, int i) __asm__("FUN_L00_0028d8c0"); +int trooper_play_sound(int i, int a1, int v, int k) __asm__("FUN_L00_0028dc90"); u8 *FUN_L14_00306158_c(u8 *self) __asm__("FUN_L14_00306158"); extern Moby_3071B0 *func_L14_003075E0_3071B0(Moby_3071B0 *owner) __asm__("FUN_L14_00306158"); extern void func_001F9C30_3071B0(void *, void *, float) __asm__("FUN_001f9a68"); @@ -776,7 +777,8 @@ extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern s32 allocate_voice_for_target_entry(s32, s32, struct Moby *) __asm__("FUN_0022da68"); -void FUN_L14_00306b78(struct Moby *moby) { +void button_update(struct Moby *moby) __asm__("FUN_L14_00306b78"); +void button_update(struct Moby *moby) { s32 *d = (s32 *)moby->pvars; s16 id; s32 i; @@ -927,6 +929,7 @@ extern char D_0013E550_6ee0[] __asm__("D_0013E550"); extern f32 frame_time_macro __asm__("D_0015ED6C") __attribute__((section(".sdata"))); /* Ported from rac1-decomp src/overlays/l14_oltanis/vendor_002FF358.c (func_L14_00308368) */ +void FUN_L14_00306ee0(struct Moby *m); void FUN_L14_00306ee0(struct Moby *m) { Data_6ee0 *d = (Data_6ee0 *)m->pvars; Vec4f vec __attribute__((aligned(16))); @@ -1116,9 +1119,9 @@ extern float D_L14_00162280 __attribute__((sda)); extern float D_L14_00162288 __attribute__((sda)); extern float D_L14_0016228C __attribute__((sda)); extern int path_step_7620(char *path, float *out, void *pos, void *t, int dir, float step) __asm__("FUN_L00_0025d808"); -extern void FUN_L00_0025f090(void *, void *, f32, f32, s32); +extern void cart_burst(void *, void *, f32, f32, s32) __asm__("FUN_L00_0025f090"); extern void FUN_L00_00258278(struct Moby *, f32, f32 *, f32, f32, f32); -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); extern void release_voice_slot(s32 idx) __asm__("FUN_0022d798"); extern void subtract_vector_xyz(void *out, void *a, void *b) __asm__("FUN_001f9a28"); extern float AbsoluteFloat(float input) __asm__("FUN_001f99c0"); @@ -1139,7 +1142,7 @@ int FUN_L14_00307620(struct Moby *moby) { end = path_step_7620(D_L14_001B0BB0_7620[*(int *)(d + 0x78)], pos, d + 0x70, d + 0x74, *(short *)(d + 0x8E), *(float *)(d + 0xC8) * frame_time); if ((*(short *)(d + 0x8E) == 0 && end != 0) || moby->pos.z <= D_L14_0016228C) { - FUN_L00_0025f090(moby, &moby->pos, 5.0f, 13.0f, -1); + cart_burst(moby, &moby->pos, 5.0f, 13.0f, -1); moby->state = 3; moby->flags |= 0x41; moby->collision = 0; @@ -1180,22 +1183,22 @@ int FUN_L14_00307620(struct Moby *moby) { pos[2] -= *(float *)(d + 0xB0); if (pos[2] < 10.0f) pos[2] = 10.0f; - FUN_L00_0025b8c0(&moby->pos.x, (f32 *)(d + 0x80), pos[0], D_L14_0016226C, D_L14_00162270, 0.0f); - FUN_L00_0025b8c0(&moby->pos.y, (f32 *)(d + 0x84), pos[1], D_L14_0016226C, D_L14_00162270, 0.0f); - FUN_L00_0025b8c0(&moby->pos.z, (f32 *)(d + 0x88), pos[2], D_L14_0016226C, D_L14_00162270, 0.0f); + vendor_spring(&moby->pos.x, (f32 *)(d + 0x80), pos[0], D_L14_0016226C, D_L14_00162270, 0.0f); + vendor_spring(&moby->pos.y, (f32 *)(d + 0x84), pos[1], D_L14_0016226C, D_L14_00162270, 0.0f); + vendor_spring(&moby->pos.z, (f32 *)(d + 0x88), pos[2], D_L14_0016226C, D_L14_00162270, 0.0f); subtract_vector_xyz(delta, pos, &moby->pos); if (0.01f < AbsoluteFloat(delta[0]) && 0.01f < AbsoluteFloat(delta[1])) { yaw = atan2_7620(delta[0], delta[1]); bank = fast_subtract_rotations(moby->rot.z, yaw); FUN_L00_00258278(moby, yaw, (f32 *)(d + 0x98), D_L14_0016226C, D_L14_00162270, 0.0f); pitch = -atan2_7620(vector_length_xy(delta), delta[2]); - FUN_L00_0025b8c0(&moby->rot.y, (f32 *)(d + 0x94), pitch, D_L14_0016226C, D_L14_00162270, 0.0f); + vendor_spring(&moby->rot.y, (f32 *)(d + 0x94), pitch, D_L14_0016226C, D_L14_00162270, 0.0f); bank /= D_L14_00162278; if (1.0f < bank) bank = 1.0f; if (bank < -1.0f) bank = -1.0f; - FUN_L00_0025b8c0(&moby->rot.x, (f32 *)(d + 0x90), bank * D_L14_00162274, 0.003f, D_L14_00162270, 0.0f); + vendor_spring(&moby->rot.x, (f32 *)(d + 0x90), bank * D_L14_00162274, 0.003f, D_L14_00162270, 0.0f); } return 1; } @@ -1232,7 +1235,7 @@ extern Level14State D_L14_0016CF60; extern int D_L14_0015F5C4; extern int FUN_L01_0026e008(int, int); extern unsigned char D_0013D408[]; -extern void FUN_L00_002637f8(int); +extern void cutscene_set_camera_target(int) __asm__("FUN_L00_002637f8"); extern void queue_dialogue_message(int arg0, int arg1) __asm__("FUN_L00_00263d40"); s32 allocate_voice_for_bank_entry(s32 arg1, s32 arg0, s32 arg2) __asm__("FUN_0022db10"); @@ -1261,7 +1264,7 @@ void FUN_L14_003087c0(struct Moby *moby) { i = 0; if (v <= D_L14_0015F5C4) i = moby->state; - FUN_L00_002637f8(D_L14_0016CF60.v178[i]); + cutscene_set_camera_target(D_L14_0016CF60.v178[i]); } } break; @@ -1773,7 +1776,7 @@ extern CamKey5d48 D_L14_001F6488[]; extern char D_L14_0017AD80[]; extern int scale_ticks_5d48(int) __asm__("FUN_001f96f8"); extern int random_integer_below(int) __asm__("FUN_00213260"); -extern float lerp_angle_5d48(float, float, float) __asm__("FUN_L00_0025b750"); +extern float FUN_L00_0025b750(float, float, float); extern float cam_interp_angle_5d48(void *, float, float, float, float, float) __asm__("FUN_L00_001eb328"); extern float cam_interp_5d48(void *, float, float, float, float, float) __asm__("FUN_001ebd78"); extern float atan2_5d48(float, float) __asm__("FUN_001f9e90"); @@ -1943,17 +1946,17 @@ void FUN_L14_00315d48(char *cam) { t = num / den; } k = D_L14_00162490; - x = lerp_angle_5d48(D_L14_001F6488[st->idx].a0 * 0.017453292f, D_L14_001F6488[st->idx + 1].a0 * 0.017453292f, t); + x = FUN_L00_0025b750(D_L14_001F6488[st->idx].a0 * 0.017453292f, D_L14_001F6488[st->idx + 1].a0 * 0.017453292f, t); cur->f0 = cam_interp_angle_5d48(vel, cur->f0, x, k, 0.2f, 0.0f); k = D_L14_00162494; - x = lerp_angle_5d48(D_L14_001F6488[st->idx].a4 * 0.017453292f, D_L14_001F6488[st->idx + 1].a4 * 0.017453292f, t); + x = FUN_L00_0025b750(D_L14_001F6488[st->idx].a4 * 0.017453292f, D_L14_001F6488[st->idx + 1].a4 * 0.017453292f, t); cur->f4 = cam_interp_angle_5d48(vel + 1, cur->f4, x, k, 0.2f, 0.0f); cur->f8 = cam_interp_5d48(vel + 2, cur->f8, D_L14_001F6488[st->idx].a8 + (D_L14_001F6488[st->idx + 1].a8 - D_L14_001F6488[st->idx].a8) * t, D_L14_00162498, 0.2f, 0.0f); k = D_L14_0016249C; - x = lerp_angle_5d48(D_L14_001F6488[st->idx].aC * 0.017453292f, D_L14_001F6488[st->idx + 1].aC * 0.017453292f, t); + x = FUN_L00_0025b750(D_L14_001F6488[st->idx].aC * 0.017453292f, D_L14_001F6488[st->idx + 1].aC * 0.017453292f, t); cur->fC = cam_interp_angle_5d48(vel + 3, cur->fC, x, k, 0.2f, 0.0f); k = D_L14_001624A0; - x = lerp_angle_5d48(D_L14_001F6488[st->idx].a10 * 0.017453292f, D_L14_001F6488[st->idx + 1].a10 * 0.017453292f, t); + x = FUN_L00_0025b750(D_L14_001F6488[st->idx].a10 * 0.017453292f, D_L14_001F6488[st->idx + 1].a10 * 0.017453292f, t); cur->f10 = cam_interp_angle_5d48(vel + 4, cur->f10, x, k, 0.2f, 0.0f); ang = add_rots_5d48(atan2_5d48(hero.moby->rot_row1.x, hero.moby->rot_row1.y), cur->f0); D_L14_001624BC = ang; @@ -1970,16 +1973,16 @@ void FUN_L14_00315d48(char *cam) { if (b == 0.0f && a == 0.0f) { b = (st->fC != 0.0f) ? st->fC : st->f8; st->f10 += (0.0f - st->f10) * D_L14_001624A4; - ang = lerp_angle_5d48(ang, b, ease_5d48(1.0f, 0.0f, 1.0f, 0.0f, st->f10)); + ang = FUN_L00_0025b750(ang, b, ease_5d48(1.0f, 0.0f, 1.0f, 0.0f, st->f10)); } else { if (b != 0.0f) { st->f10 += (1.0f - st->f10) * D_L14_001624A4; - ang = lerp_angle_5d48(ang, b, ease_5d48(1.0f, 0.0f, 1.0f, 0.0f, st->f10)); + ang = FUN_L00_0025b750(ang, b, ease_5d48(1.0f, 0.0f, 1.0f, 0.0f, st->f10)); st->f8 = a; st->fC = b; } else { st->f10 += (0.0f - st->f10) * D_L14_001624A4; - ang = lerp_angle_5d48(ang, a, ease_5d48(1.0f, 0.0f, 1.0f, 0.0f, st->f10)); + ang = FUN_L00_0025b750(ang, a, ease_5d48(1.0f, 0.0f, 1.0f, 0.0f, st->f10)); st->f8 = a; st->fC = b; } diff --git a/src/overlays/l14/gameplay/entities/platform.c b/src/overlays/l14/gameplay/entities/platform.c index f556044eff..6de75a2fe0 100644 --- a/src/overlays/l14/gameplay/entities/platform.c +++ b/src/overlays/l14/gameplay/entities/platform.c @@ -94,14 +94,14 @@ typedef struct { int f564; float f568; } G_6570; -extern int near_6570(void *, void *, void *, int *, float *, int, float, float, float) __asm__("FUN_L00_0025df68"); +extern int FUN_L00_0025df68_c(void *, void *, void *, int *, float *, int, float, float, float) __asm__("FUN_L00_0025df68"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern float angle_atan2(float, float) __asm__("FUN_001f9e90"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern void place_6570(void *, void *, int, int) __asm__("FUN_L00_00216f90"); extern void FUN_L00_0025d808_6570(void *, void *, void *, void *, int, float) __asm__("FUN_L00_0025d808"); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); -extern void stop_n(int) __asm__("FUN_L00_0023e838"); +extern void FUN_L00_0023e838(int); void FUN_L14_002d6570(struct Moby *m) { char *list[4]; @@ -125,7 +125,7 @@ void FUN_L14_002d6570(struct Moby *m) { if (path == *(char **)(D_L14_0015F70C_6570 + *(int *)(od + 0x60) * 32 + 0x10)) { char *tp = D_L14_001B0BB0_6570[*(int *)(od + 0x88)]; t = 0.0f; - near_6570(path, tp + 0x10, near, &idx, &t, 0, 20.0f, 5.0f, 0.0f); + FUN_L00_0025df68_c(path, tp + 0x10, near, &idx, &t, 0, 20.0f, 5.0f, 0.0f); subtract_vector_xyz(v, path + (idx * 16 + 0x40), path + (idx * 16 + 0x10)); rot[0] = 0.0f; rot[1] = 0.0f; @@ -151,7 +151,7 @@ void FUN_L14_002d6570(struct Moby *m) { *(int *)(od + 0xF8) = i * 2; *(int *)(od + 0xFC) = i * 2 + 1; if (*(int *)(od + 0xF0) != -1) { - stop_n(*(int *)(od + 0xF0)); + FUN_L00_0023e838(*(int *)(od + 0xF0)); *(int *)(od + 0xF0) = -1; } } @@ -205,12 +205,12 @@ extern void invert_67e8(void *, void *) __asm__("FUN_001fa2d8"); extern void matmul_67e8(void *, void *, void *) __asm__("FUN_001fa378"); extern void to_quat_67e8(void *, void *) __asm__("FUN_00214260"); extern void slerp_67e8(void *, void *, void *, float) __asm__("FUN_001fa400"); -extern void set_joint_67e8(void *, int, float) __asm__("FUN_L00_001fff28"); -extern void anim_67e8(struct Moby *, int, int) __asm__("FUN_L00_002e1f28"); -extern int aim_ok_67e8(struct Moby *, void *, void *) __asm__("FUN_L00_002e2190"); +extern void FUN_L00_001fff28(void *, int, float); +extern void FUN_L00_002e1f28(struct Moby *, int, int); +extern int FUN_L00_002e2190(struct Moby *, void *, void *); extern int ray_67e8(void *, void *, int, struct Moby *, void *) __asm__("FUN_001efa68"); -extern char *flash_67e8(void *, void *, int, struct Moby *) __asm__("FUN_L00_00274948"); -extern int light_67e8(void *, float, float, float, float, float) __asm__("FUN_L00_0023e738"); +extern char *FUN_L00_00274948_c(void *, void *, int, struct Moby *) __asm__("FUN_L00_00274948"); +extern int FUN_L00_0023e738_c(void *, float, float, float, float, float) __asm__("FUN_L00_0023e738"); extern void light_off_67e8(int) __asm__("FUN_L00_0023e838"); extern float cos_67e8(float) __asm__("FUN_001f9dc8"); extern float sin_67e8(float) __asm__("FUN_001f9de0"); @@ -307,7 +307,7 @@ void FUN_L14_002d67e8(struct Moby *m) { m->command = 0; } else { unsigned char s = 3; - anim_67e8(m, s, 1); + FUN_L00_002e1f28(m, s, 1); m->command = s; } *(int *)(d + 0x1C4) = frames_67e8(30); @@ -319,7 +319,7 @@ void FUN_L14_002d67e8(struct Moby *m) { } turn = (turn - 0.0f) * blend + 0.0f; } - set_joint_67e8(d + 0x150, 2, turn); + FUN_L00_001fff28(d + 0x150, 2, turn); joint_pos_67e8(m, 4, &v[2]); *(u128_67e8 *)&v[3] = 0; v[3].z = 1.0f; @@ -361,8 +361,8 @@ void FUN_L14_002d67e8(struct Moby *m) { *(int *)(d + 0x1C4) = 0; } if (m->command == 3) { - if (aim_ok_67e8(m, d + 0xA0, d + 0x1E0) == 0) { - anim_67e8(m, 3, 1); + if (FUN_L00_002e2190(m, d + 0xA0, d + 0x1E0) == 0) { + FUN_L00_002e1f28(m, 3, 1); } ray.flags = 0x10001; ray.self = m; @@ -382,7 +382,7 @@ void FUN_L14_002d67e8(struct Moby *m) { char *muzzle = d + 0xD0; scale_67e8(&ray, d + 0xA0, D_L14_00161A44); add_67e8(&ray, &ray, muzzle); - p = flash_67e8(&ray, D_L14_0015F580_67e8, 0x7F, m); + p = FUN_L00_00274948_c(&ray, D_L14_0015F580_67e8, 0x7F, m); if (p != 0) { char *q = p + 0x20; int n; @@ -398,7 +398,7 @@ void FUN_L14_002d67e8(struct Moby *m) { ((float *)&ray.self)[2] -= 0.5f; r = (D_L14_00161A4C - 0.1f) * blend + 0.1f; if (*(int *)(d + 0xF0) == -1) { - *(int *)(d + 0xF0) = light_67e8(&ray.self, r, 0.0f, D_L14_00161A50, D_L14_00161A54, D_L14_00161A58); + *(int *)(d + 0xF0) = FUN_L00_0023e738_c(&ray.self, r, 0.0f, D_L14_00161A50, D_L14_00161A54, D_L14_00161A58); } if (*(int *)(d + 0xF0) >= 0) { float *l = (float *)(D_L14_001809C0 + (*(int *)(d + 0xF0) << 5)); @@ -423,18 +423,18 @@ void FUN_L14_002d67e8(struct Moby *m) { } else if (a < -1.2217305f) { a = -1.2217305f; } - set_joint_67e8(d + 0x110, 2, a); + FUN_L00_001fff28(d + 0x110, 2, a); } /* Ported from rac1-decomp (src/overlays/l14_oltanis/vendor_002ACCC0.c: func_L14_002D84A8), where it is exact; names translated to the US level program. */ extern int D_L14_0015F70C; -extern void FUN_L00_0025d808(int a, char *pos, char *b, char *c, int d, float f); +extern void sample_path(int a, char *pos, char *b, char *c, int d, float f) __asm__("FUN_L00_0025d808"); extern float D_L14_00161A30 __attribute__((sda)); void FUN_L14_002d7198(struct Moby *moby) { char *data = (char *)moby->pvars; int idx = *(int *)(data + 0x60); - FUN_L00_0025d808(*(int *)((idx << 5) + D_L14_0015F70C + 0x10), &moby->pos, data + 0x64, + sample_path(*(int *)((idx << 5) + D_L14_0015F70C + 0x10), &moby->pos, data + 0x64, data + 0x68, 0, D_L14_00161A30 * frame_time); } /* Draws the racer's two glow quads, at its lamp (0xE0) and its tail (0x200), turned to face the camera. */ @@ -587,9 +587,10 @@ void FUN_L14_002d7490(struct Moby *m) { } #include "qzero.h" extern void FUN_L14_002de2b8_call(struct Moby *, f32, f32) __asm__("FUN_L14_002de2b8"); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern float D_L14_00161AFC __attribute__((sda)); +void FUN_L14_002de1f8(struct Moby *moby); void FUN_L14_002de1f8(struct Moby *moby) { char *data = (char *)moby->pvars; void *rotation; @@ -610,7 +611,7 @@ void FUN_L14_002de1f8(struct Moby *moby) { rotation = &moby->rot; } FUN_L14_002de2b8_call(moby, D_L14_00161AFC, 8.0f); - FUN_L00_00260738(data + 0x20, D_L14_0015F580, &old_rotation, rotation); + update_entity_matrix(data + 0x20, D_L14_0015F580, &old_rotation, rotation); } /* Ported from rac1-decomp src/overlays/l14_oltanis/vendor_002ACCC0.c (func_L14_002DF6B8) */ #include "eetypes.h" @@ -621,7 +622,7 @@ typedef int u128_s07 __attribute__((mode(TI))); extern f32 fast_arc_sin(f32) __asm__("func_001F9DF8"); extern f32 dot_vectors_xyz(void *, void *) __asm__("func_001F9AB0"); extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); -extern float FUN_L00_0025b8c0(float *p, float *v, float t, float u1, float u2, float eps); +extern float vendor_spring(float *p, float *v, float t, float u1, float u2, float eps) __asm__("FUN_L00_0025b8c0"); extern int allocate_voice_slot(void *, int, int, int, int) __asm__("FUN_0022d7f0"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); @@ -691,9 +692,9 @@ void FUN_L14_002de2b8(char *moby, f32 unused_arg1, f32 unused_arg2) { } } - FUN_L00_0025b8c0((float *)(moby + 0xE0), (float *)(data + 0x60), v[0], 0.005f, 0.2f, 0.0f); - FUN_L00_0025b8c0((float *)(moby + 0xE4), (float *)(data + 0x64), v[1], 0.005f, 0.2f, 0.0f); - FUN_L00_0025b8c0((float *)(moby + 0xE8), (float *)(data + 0x68), v[2], 0.005f, 0.2f, 0.0f); + vendor_spring((float *)(moby + 0xE0), (float *)(data + 0x60), v[0], 0.005f, 0.2f, 0.0f); + vendor_spring((float *)(moby + 0xE4), (float *)(data + 0x64), v[1], 0.005f, 0.2f, 0.0f); + vendor_spring((float *)(moby + 0xE8), (float *)(data + 0x68), v[2], 0.005f, 0.2f, 0.0f); normalize_vector_xyz(moby + 0xE0, moby + 0xE0, 1.0f); *(u128_s07 *)d = 0; @@ -734,8 +735,8 @@ extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_sin(float) __asm__("FUN_001f9de0"); extern int D_L14_0015F7EC __asm__("D_L14_0015F70C"); extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); -extern int FUN_L00_0028d8c0(void *, int); -extern int FUN_L00_0028dc90(int i, int a1, int v, int k); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); +extern int trooper_play_sound(int i, int a1, int v, int k) __asm__("FUN_L00_0028dc90"); extern void FUN_L14_002df080(char *); extern void FUN_L14_002df138(char *); extern void FUN_L14_002dfc58(char *); @@ -773,8 +774,8 @@ void FUN_L14_002dee28(struct Moby *moby) { if (16.0f < absolute_float(x->motion.pos.f[1] - moby->pos.y)) goto end; } - if (FUN_L00_0028d8c0(moby, *(int *)(data + 0x204)) == 0) { - *(int *)(data + 0x204) = FUN_L00_0028dc90(6, 4, (int)moby, 0xD3); + if (voice_is_playing(moby, *(int *)(data + 0x204)) == 0) { + *(int *)(data + 0x204) = trooper_play_sound(6, 4, (int)moby, 0xD3); } FUN_L14_002dfc58(moby); v[0] = fast_cos(moby->rot.z) * 3.125f; diff --git a/src/overlays/l14/gameplay/hero/0021dd30.c b/src/overlays/l14/gameplay/hero/0021dd30.c index a0e25fb984..109de5cdbf 100644 --- a/src/overlays/l14/gameplay/hero/0021dd30.c +++ b/src/overlays/l14/gameplay/hero/0021dd30.c @@ -19,7 +19,7 @@ /* Resolve the hero's surface reaction for the frame from the previous state and flags. */ /* Ported from rac1-decomp (src/overlays/l14_oltanis/help_0021E3A8.c: func_L14_0021E3A8), where it is exact; names translated to the US level program. */ -extern int FUN_001f0b58(void); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern void fast_mem_zero16(void *, int) __asm__("FUN_001f9810"); extern void FUN_L00_0020b930(void); @@ -53,7 +53,7 @@ void FUN_L14_0021dd30(void) { struct Hero *q = &hero; if (q->state.current != 0x7B) { if (coll_sphere(q->unk234 + 0.03f, &q->motion.unkD0, 2, 0)) { - if (FUN_001f0b58() == 0xB) { + if (collision_hit_material() == 0xB) { hero_set_state(0x7B, 1); return; } @@ -393,7 +393,7 @@ extern void FUN_L00_00217118(f32, f32); extern void stick_target(f32, s32) __asm__("FUN_L00_002118c8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void turn_to(s32, f32, f32, f32) __asm__("FUN_L00_00211e30"); -extern s32 FUN_001f9740(void *); +extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 FUN_L00_00229a98(void); extern void FUN_L00_00211e98(void); @@ -432,7 +432,7 @@ extern void release_voice_slot(s32) __asm__("FUN_0022d798"); extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); extern void FUN_L00_00209a40(s32, s32); extern void FUN_L00_00209ca8(s32, s32, s32); -extern void FUN_L00_002a3ec8(s32, s32, s32, f32, f32, f32, f32); +extern void pool_splash(s32, s32, s32, f32, f32, f32, f32) __asm__("FUN_L00_002a3ec8"); extern f32 FUN_L00_0025bc98(f32 *, f32, f32 *, s32, f32, f32, f32); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); @@ -446,7 +446,7 @@ extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 FUN_L00_00209018(void *, s32); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern void FUN_L00_0020a1e0(f32, f32); @@ -470,21 +470,21 @@ extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern s32 FUN_L00_002595a0(f32 *, f32 *, f32, f32, f32); extern void FUN_L00_0025bc00(f32 *, s32, f32, f32); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern f32 square_root(f32) __asm__("FUN_001f9988"); -extern f32 FUN_L00_00233a78(void *); -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); -extern f32 FUN_L00_00213350(void *); +extern f32 gravity_z(void *) __asm__("FUN_L00_00233a78"); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); +extern f32 forward_component(void *) __asm__("FUN_L00_00213350"); extern struct HeroTableRow2C D_L14_0017C328[]; extern struct LevelTable_QS D_L14_00167380; #define Q D_L14_00167380 extern void FUN_L00_00233ba0(void *, void *, f32); -extern void FUN_L00_00233b20(void *, void *, f32); +extern void gravity_set_z(void *, void *, f32) __asm__("FUN_L00_00233b20"); extern void FUN_L00_002336e8(void *, void *, f32); extern void make_hit_descriptor(void *, struct MobyView *, s32, f32, void *) __asm__("FUN_L00_00259888"); extern s32 collect_mobies_in_sphere(f32, void *, s32, struct MobyView *, void *) __asm__("FUN_L00_001f2868"); @@ -495,8 +495,8 @@ extern void FUN_L00_001ff290(void *, void *, void *); extern void FUN_L00_002a9b80(struct MobyView *, void *); extern s32 FUN_L00_002a96f8(struct MobyView *, void *, f32, f32, s32, f32, f32, f32); extern void FUN_L00_002335c8(void *, f32, f32, f32); -extern s32 FUN_L00_002598b0(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32); -extern f32 FUN_001f9ab0(void *, void *); +extern s32 play_entity_sound(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32) __asm__("FUN_L00_002598b0"); +extern f32 fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); struct PlayerSpeedTuning { u8 pad0[8]; f32 x08; @@ -508,14 +508,14 @@ extern struct PlayerSpeedTuning D_L14_0017C4B8; extern s32 FUN_L00_00216de8(s32, s32); extern void FUN_L00_00233708(void *, void *, f32); extern void FUN_L00_00233810(void *, void *, f32); -extern s32 FUN_001efa68(void *, void *, s32, struct MobyView *, s32); +extern s32 collision_line(void *, void *, s32, struct MobyView *, s32) __asm__("FUN_001efa68"); extern void FUN_L00_00215340(void); extern void FUN_L00_00233660(void *, f32, f32, f32); extern s32 FUN_L00_0025e3b8(s32); -extern void FUN_L00_00259bc8(s32, struct MobyView *, s32, void *, void *, f32); +extern void spawn_nearby_effect(s32, struct MobyView *, s32, void *, void *, f32) __asm__("FUN_L00_00259bc8"); extern s32 D_L14_00178600[]; extern void FUN_L00_00209ec8(void); -extern void FUN_L00_002338d0(void *, void *); +extern void gravity_flatten(void *, void *) __asm__("FUN_L00_002338d0"); extern s32 hero_slot_item_id(s32) __asm__("FUN_L00_0020d498"); extern void FUN_L00_0020b5b8(void); extern void FUN_L01_0022d090(void); @@ -528,7 +528,7 @@ extern void FUN_L00_0020d2f8(void *); extern f32 randf_sym(f32, f32) __asm__("FUN_L00_00257c48"); extern void FUN_L00_0026d598(void *, void *, s32); extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); -extern s32 FUN_L00_0025d808(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); +extern s32 sample_path(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); extern s32 FUN_L00_0025d7a0(void *, s32, s32, s32); extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); extern void hero_integrate_velocity(void) __asm__("FUN_L00_00214108"); @@ -590,7 +590,7 @@ void FUN_L14_00228cd0(void) { transform_vector_by_basis(&hero.motion.unk170, &v0, &D_L14_001674D8[0x1F8]); hero.motion.move_yaw = *(f32 *)D_L14_001674D8; turn_to(0, frame_scale_sq, frame_scale_sq * 0.0f, frame_time * 174.53293f); - if (D_L14_0015F688 > 0 && FUN_001f9740(&D_L14_0015F688) != 0) { + if (D_L14_0015F688 > 0 && fast_dec_timer(&D_L14_0015F688) != 0) { s32 t; if (usage_stats.stat[18].count < 0xFFFF) { usage_stats.stat[18].count++; @@ -809,7 +809,7 @@ void FUN_L14_00228cd0(void) { FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, 0.0f, frame_time * 3.8397243f); } else { f32 an = fast_add_rotations( - -fast_arc_tan(FUN_001f9b80(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); + -fast_arc_tan(vector_distance(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, an, frame_time * 6.4577184f); } v20.f[0] = fast_cos(fast_add_rotations(hero.motion.rot.f[2], -1.5707964f)) * -0.57f; @@ -893,14 +893,14 @@ void FUN_L14_00228cd0(void) { } if (hero.unk99C != 0) { f32 s; - if (FUN_001f9b80(&hero.motion.pos, &MV(hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { + if (vector_distance(&hero.motion.pos, &MV(hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.displacement, frame_time_sq * 40.0f); - if (hero.unk9BE != 0 && FUN_L00_00233a78(&hero.motion.velocity) > 0.0f) { + if (hero.unk9BE != 0 && gravity_z(&hero.motion.velocity) > 0.0f) { subtract_vector_xyz(&v30, &hero.motion.pos, &MV(hero.unk994)->u10.v10); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 57.0f); } } - s = FUN_001f9af0(&hero.motion.velocity) * (frame_time * 0.015f); + s = fast_vec_length(&hero.motion.velocity) * (frame_time * 0.015f); fast_vec_scale(&v30, &hero.motion.velocity, -1.0f); fast_vec_normalize(&v30, &v30, s); add_vector_xyz(&hero.motion.velocity, &hero.motion.velocity, &v30); @@ -908,7 +908,7 @@ void FUN_L14_00228cd0(void) { { struct MobyView *r; if (MV(hero.unk994) != NULL && (r = MV(hero.unk994)->pm78) != NULL) { - f32 len = FUN_001f9af0(&hero.motion.velocity); + f32 len = fast_vec_length(&hero.motion.velocity); if (r->fC < len) { approach_value(&len, r->fC, frame_time_sq * 15.0f); fast_vec_normalize(&hero.motion.velocity, &hero.motion.velocity, len); @@ -929,9 +929,9 @@ void FUN_L14_00228cd0(void) { add_vector_xyz(&v30, &MV(hero.unk994)->u10.v10, &vC0); subtract_vector_xyz(&hero.motion.velocity, &v30, &vD0); old = hero.unk9A4; - FUN_L00_0025b8c0(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); + vendor_spring(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); d = hero.unk9A4 - old; - if (FUN_001f9af0(&vC0) > hero.unk9A4) { + if (fast_vec_length(&vC0) > hero.unk9A4) { fast_vec_normalize(&vC0, &vC0, d); add_vector_xyz(&hero.motion.pos, &hero.motion.pos, &vC0); } @@ -940,7 +940,7 @@ void FUN_L14_00228cd0(void) { f32 mx = frame_time * 14.0f; f32 sp = vector_length_xy(&hero.motion.velocity); if (sp < mx) { - FUN_L00_0025b8c0(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); + vendor_spring(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); v30.f[0] = fast_cos(hero.unk9AC) * hero.unk9B4; v30.f[1] = fast_sin(hero.unk9AC) * hero.unk9B4; v30.f[2] = 0.0f; @@ -957,7 +957,7 @@ void FUN_L14_00228cd0(void) { up = hero.unk9BC == 1; } else { v30.q = hero.motion.displacement.q; - up = FUN_L00_00213350(&v30) > 0.0f; + up = forward_component(&v30) > 0.0f; } if (up) { if (moby->b53 != 0x35) { @@ -993,12 +993,12 @@ void FUN_L14_00228cd0(void) { mx = frame_time_sq * 70.0f; t2 = scale_game_frames(33); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk4B0); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unk4B8 = 1.0f; } } @@ -1031,7 +1031,7 @@ void FUN_L14_00228cd0(void) { hero.target_speed = 0.0f; if (hero.unk12E2 != 0) { if (MV(hero.unkA54) != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &MV(hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &MV(hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = frame_time * 4.5f; } @@ -1044,7 +1044,7 @@ void FUN_L14_00228cd0(void) { } } else { if (MV(hero.unkA54) != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &MV(hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &MV(hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = frame_time * 4.5f; } @@ -1086,16 +1086,16 @@ void FUN_L14_00228cd0(void) { } FUN_L00_00211870(27.0f); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 130.0f); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unkA70 = 1.0f; } - if (FUN_L00_00233a78(&hero.motion.velocity) < frame_time * -37.0f) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); + if (gravity_z(&hero.motion.velocity) < frame_time * -37.0f) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); } } break; @@ -1183,7 +1183,7 @@ void FUN_L14_00228cd0(void) { tb = &D_L14_0017C328[hero.attack_record]; hero.target_speed = 0.0f; if (MV(hero.unkA54) != NULL && scale_game_frames(4) > hero.state_timer) { - f32 d = FUN_001f9b80(&MV(hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; + f32 d = vector_distance(&MV(hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; f32 off; f32 tol; f32 mx; @@ -1438,7 +1438,7 @@ void FUN_L14_00228cd0(void) { Vec4 *p = &hero.move_impulse; FUN_L00_002132b8(0.7f, 0.0f); v0.q = hero.move_impulse.q; - hero.target_speed += FUN_L00_00213350(&v0); + hero.target_speed += forward_component(&v0); if (hero.target_speed < frame_time * 0.7f) { hero.target_speed = frame_time * 0.7f; } @@ -1618,9 +1618,9 @@ void FUN_L14_00228cd0(void) { if (hero.state.current == 0x42) { r = hero.unk5CC * (f32)hero.unk578; } - FUN_L00_0025d808((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); + sample_path((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); if (hero.unk590 != 0) { - FUN_L00_0025d808((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); + sample_path((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); } if (scale_game_frames(90) < hero.unk19C) { s32 h; @@ -1630,11 +1630,11 @@ void FUN_L14_00228cd0(void) { qcopy(&v20, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - h = FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); + h = sample_path((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); qcopy(&v30, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - if ((h | FUN_L00_0025d808((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || + if ((h | sample_path((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || hero.unk584 != 0) { f32 a = fast_subtract_rotations( hero.unk57C, fast_arc_tan(v30.f[0] - v20.f[0], v30.f[1] - v20.f[1])) * @@ -1691,7 +1691,7 @@ void FUN_L14_00228cd0(void) { } idx = FUN_L00_0025d7a0((void *)hero.unk560, hero.unk564, hero.unk578, hero.unk584); subtract_vector_xyz(&v20, (Vec4 *)hero.unk560 + (idx + 1), &v0); - if (FUN_001f9af0(&v20) < 0.001f) { + if (fast_vec_length(&v20) < 0.001f) { if (hero.unk564 == idx) { hero.unk570 = scale_game_frames(1); break; @@ -1738,7 +1738,7 @@ void FUN_L14_00228cd0(void) { hero.motion.pos.f[2] += v20.f[2]; subtract_vector_xyz(&v30, &hero.unk500, &hero.motion.pos); v30.f[2] = 0.0f; - if (FUN_001f9af0(&v30) > frame_time) { + if (fast_vec_length(&v30) > frame_time) { fast_vec_normalize(&v30, &v30, frame_time); } hero.motion.pos.f[0] += v30.f[0]; @@ -1784,8 +1784,8 @@ void FUN_L14_00228cd0(void) { si = hero.unk564; sf = hero.unk568; qcopy(&v20, &hero.motion.pos); - FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); - e = fast_arc_tan(FUN_001f9b80(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); + sample_path((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); + e = fast_arc_tan(vector_distance(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); if (e > 0.0f) { sp = e * 1.9098593f * (frame_time * -2.5f); if (e > 0.2617994f && hero.unk5A8 != 2 && hero.unk5A8 != 3) { @@ -1822,9 +1822,9 @@ void FUN_L14_00228cd0(void) { f32 mx = frame_time * 7.0f; f32 fl; f32 len; - fl = -FUN_001f9af0(&v20); - FUN_L00_0025b8c0(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); - len = FUN_001f9af0(&v20); + fl = -fast_vec_length(&v20); + vendor_spring(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); + len = fast_vec_length(&v20); if (len < hero.unk5DC) { hero.unk5DC = len; } @@ -1936,8 +1936,8 @@ void FUN_L14_00228cd0(void) { FUN_L00_00215340(); FUN_L00_002132b8(0.7f, frame_time * 0.0f); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; case 0x77: { @@ -1949,8 +1949,8 @@ void FUN_L14_00228cd0(void) { len = vector_length_xy(&hero.motion.velocity); FUN_L00_001ff600(frame_scale * -0.100000024f * len + len, &hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; } @@ -1995,11 +1995,11 @@ void FUN_L14_00228cd0(void) { FUN_L00_00215340(); FUN_L01_00232978(1); if (big) { - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); hero.unk304 = hero.motion.velocity.f[2]; } else { - FUN_L00_0025b8c0(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, + vendor_spring(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, frame_scale_sq * 0.35f, frame_time * 2.5f); } break; @@ -2034,7 +2034,7 @@ void FUN_L14_00228cd0(void) { speed_step(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); FUN_L00_00215340(); - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); if (hero.motion.pos.f[2] < hero.unk410) { approach_value(&hero.unk410, hero.motion.pos.f[2], frame_time * 4.0f); @@ -2126,7 +2126,7 @@ void FUN_L14_00228cd0(void) { qcopy(&v10, &v0); v10.f[0] += fast_cos(hero.motion.rot.f[2]) * 0.85f; v10.f[1] += fast_sin(hero.motion.rot.f[2]) * 0.85f; - if (FUN_001efa68(&v0, &v10, 4, MV(hero.moby), 0) != 0) { + if (collision_line(&v0, &v10, 4, MV(hero.moby), 0) != 0) { hero.unk4A4 = 1; } } @@ -2143,7 +2143,7 @@ void FUN_L14_00228cd0(void) { if (hero.motion.pos.f[2] < hero.unk410) { hero.unk410 = hero.motion.pos.f[2]; } - if (hero.state_timer > hero.unk420 && FUN_L00_00233a78(&hero.motion.velocity) < 0.001f && + if (hero.state_timer > hero.unk420 && gravity_z(&hero.motion.velocity) < 0.001f && (hero.unk41C == 0 || hero.state_timer > hero.unk3D4)) { hero.unk41E = 1; if (hero.unk3F8 != 0.0f) { @@ -2166,7 +2166,7 @@ void FUN_L14_00228cd0(void) { fast_vec_scale(&v10, &hero.motion.displacement, 7.0f); for (i = 0; i < n; i++) { if (FUN_L00_0025e3b8(D_L14_00178600[i]) != 0) { - FUN_L00_00259bc8(D_L14_00178600[i], MV(hero.moby), 0x10000, &hero.motion.pos, &v10, + spawn_nearby_effect(D_L14_00178600[i], MV(hero.moby), 0x10000, &hero.motion.pos, &v10, 1.0f); } } @@ -2249,7 +2249,7 @@ void FUN_L14_00228cd0(void) { } case 0x66: subtract_vector_xyz(&v0, &hero.unk1640, &hero.motion.pos); - if (FUN_001f9ab0(&v0, &hero.motion.unk150) < 0.0f) { + if (fast_vec_dot(&v0, &hero.motion.unk150) < 0.0f) { clear_u64_value(&hero.motion.unk150); } clear_u64_value(&hero.motion.velocity); @@ -2359,3 +2359,5 @@ void FUN_L14_00228cd0(void) { hero.unk1A4 = 0; } } + +f32 D_L14_0017AFF0[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/l14/gameplay/hero/00235600.c b/src/overlays/l14/gameplay/hero/00235600.c index 76b7669744..89e7ee3c82 100644 --- a/src/overlays/l14/gameplay/hero/00235600.c +++ b/src/overlays/l14/gameplay/hero/00235600.c @@ -43,12 +43,12 @@ extern float D_L14_0015F638; extern float D_L14_001674D8 __attribute__((section(".data"))); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_00208f20(float a, float b, float c, float d); extern float FUN_L00_00232b90(float a, float b, float c); -extern float FUN_L00_00233a78(float *v); +extern float gravity_z(float *v) __asm__("FUN_L00_00233a78"); extern float FUN_L00_00233c30(float *pos, float *vel, int *steps, float step); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float FUN_L00_00259468(float *a, float *b, int *out, float f); @@ -66,7 +66,7 @@ int r1_repeat_timer __asm__("D_L14_0015F678") = 0; extern int D_L14_0015F6DC_d __asm__("D_L14_0015F6DC"); extern int D_L14_0015F594 __attribute__((sda)); extern int D_L14_0016CE80 __attribute__((section(".data"))); -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_002050b8(int); #include "rnc/overlay/path.h" @@ -81,7 +81,7 @@ extern int hero_handle_jump_press(void) __asm__("FUN_L00_00229660"); extern int FUN_L00_00229910(void); extern int FUN_L00_00229a98(void); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int FUN_L00_0025d808(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); +extern int sample_path(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); extern int FUN_L00_0025df68(void *, void *, void *, int *, float *, int, float, float, float); extern int pad_pressed_within(int, int, int *) __asm__("FUN_L00_00266d60"); extern int FUN_L00_00266e00(int, int, int, int); @@ -110,7 +110,7 @@ extern void FUN_L00_00232628(void); extern void FUN_L00_00232640(int id); extern void FUN_L00_00233288(float a, float b, short c, unsigned char d, unsigned char e, unsigned char f); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void hud_keep_visible(int, int) __asm__("FUN_L00_00235e18"); extern void FUN_L00_00237ae8(void); extern void FUN_L00_00237ba0(void); @@ -778,7 +778,7 @@ void FUN_L14_00235600(void) { } break; case 101: - if (FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { + if (vector_distance(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { if (frame_time * 2.7f > hero.motion.speed_xy) { if (fast_difference_between_rotations( hero.motion.rot.f[2], hero.unk1640.f[3]) < 0.034906585f) { @@ -802,7 +802,7 @@ void FUN_L14_00235600(void) { if ((hero.unkA98 & 2) || hero.unk1650 != 0) { hero_set_state(HERO_STATE_IDLE, 1); } - if (0.2f < FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f)) { + if (0.2f < vector_distance(hero.motion.pos.f, hero.unk1640.f)) { hero_set_state(0x65, 1); } break; @@ -1065,7 +1065,7 @@ void FUN_L14_00235600(void) { v1[1] = fast_sin(hero.unk57C) * 5.0f; v1[2] = 0.0f; add_vector_xyz(v1, v1, v0); - if (FUN_001efa68(v0, v1, 2, 0, 0)) { + if (collision_line(v0, v1, 2, 0, 0)) { ok = 0; } } @@ -1226,7 +1226,7 @@ void FUN_L14_00235600(void) { path_seg = hero.unk564; path_t = hero.unk568; /* Step a copy of the hero position along its current path. */ - if (FUN_L00_0025d808((int *)hero.unk560, v0, &path_seg, + if (sample_path((int *)hero.unk560, v0, &path_seg, &path_t, hero.unk584, t)) { scale_vector_xyz(v1, hero.motion.displacement.f, scale_game_frames(0x30)); @@ -1257,7 +1257,7 @@ void FUN_L14_00235600(void) { } } if (hero.state_timer > hero.unk420) { - if (FUN_L00_00233a78(hero.motion.velocity.f) < 0.001f) { + if (gravity_z(hero.motion.velocity.f) < 0.001f) { hero.unk41E = 1; } } @@ -1493,7 +1493,7 @@ void FUN_L14_00235600(void) { if (hero_set_state(HERO_STATE_IDLE, 0)) { set_hero_animation(0xC, 9, -1.0f); } - FUN_L00_00233b20(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); + gravity_set_z(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); FUN_L00_0025f730(hero.motion.unk150.f, frame_time * 7.0f); hero.unk1C4 = scale_game_frames(7); if (hero.state.prev == 0x2D) { @@ -2002,7 +2002,7 @@ void FUN_L14_00235600(void) { scale_game_frames(0xE) < hero.state_timer && (hero.unk41E == 0 || (hero.ground_distance > 0.7f && - absolute_float(FUN_L00_00233a78(hero.motion.velocity.f)) < + absolute_float(gravity_z(hero.motion.velocity.f)) < frame_time * 5.8f))) { hero_set_state(0xE, 1); } else if (D_0013D4DC[-0x1A] != 0 && hero_slot_item_id(3) != 4 && diff --git a/src/overlays/l14/gameplay/hero/hero_set_state.c b/src/overlays/l14/gameplay/hero/hero_set_state.c index cfc553c8e3..0dc2237283 100644 --- a/src/overlays/l14/gameplay/hero/hero_set_state.c +++ b/src/overlays/l14/gameplay/hero/hero_set_state.c @@ -27,10 +27,10 @@ extern T2C_2306C8 D_L14_0017C328[]; extern char *hero_slot_moby(int) __asm__("FUN_L00_0020d460"); extern float D_L14_0017C4F0[][25]; extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_0020d658(int back); -extern float FUN_L00_002339d0(float *v); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float dot_vectors_xyz(void *a, void *b); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); @@ -44,7 +44,7 @@ extern int FUN_L00_00216de8(int, int); extern int stick_direction_vs_facing(void) __asm__("FUN_L00_00221df8"); extern int FUN_L00_00229a98(void); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int FUN_L00_0025d808(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); +extern int sample_path(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); extern int FUN_L12_00227f10(int a); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); @@ -416,7 +416,7 @@ int hero_set_state(int a, int b) { char *v = (char *)&p->motion.unk110; p->state.control_mode = 1; p->unk2284 = 0; - p->ground_speed = FUN_L00_002339d0((float *)v); + p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.unk150, v); if (b) { int id = 6; @@ -472,7 +472,7 @@ int hero_set_state(int a, int b) { *(unsigned int *)(h + 0x64) | (1 << current_level_index) | 0x80000000; } p->motion.move_yaw = - FUN_001f9e90(*(float *)(((char *)p->unk964) + 0x10) - p->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)p->unk964) + 0x10) - p->motion.pos.f[0], *(float *)(((char *)p->unk964) + 0x14) - p->motion.pos.f[1]); if (b) { set_hero_animation(0x2F, 2, (float)scale_game_frames(5)); @@ -548,7 +548,7 @@ int hero_set_state(int a, int b) { if (*(float *)(d + 0x2C) != 0.0f) q->unk9CC = *(float *)(d + 0x2C); q->unk9AC = - FUN_001f9e90(*(float *)(((char *)q->unk994) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unk994) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unk994) + 0x14) - q->motion.pos.f[1]); q->unk9A4 = FUN_001f9b48(&q->motion.pos, ((char *)q->unk994) + 0x10); q->unk9B0 = frame_time_sq * 27.0f; @@ -612,7 +612,7 @@ int hero_set_state(int a, int b) { p->unk5C0 = 0; seg = p->unk564; t = p->unk568; - FUN_L00_0025d808(*(int **)&p->unk560, pos, &seg, &t, p->unk584, 1.0f); + sample_path(*(int **)&p->unk560, pos, &seg, &t, p->unk584, 1.0f); subtract_vector_xyz(vec, pos, &p->motion.pos); if (0.001f < vector_length_xyz(vec)) { normalize_vector_xyz(vec, vec, 1.0f); @@ -624,11 +624,11 @@ int hero_set_state(int a, int b) { struct Hero *q = &hero; if (((char *)q->unk5D8) != 0) { float ang = - FUN_001f9e90(*(float *)(((char *)q->unk5D8) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unk5D8) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unk5D8) + 0x14) - q->motion.pos.f[1]); if (1.5707964f < fast_difference_between_rotations( ang, fast_add_rotations(q->unk588, - FUN_001f9e90(vec[0], vec[1])))) { + fast_arc_tan(vec[0], vec[1])))) { q->unk588 = 1.5707964f; q->unk58C = 1; } @@ -1091,7 +1091,7 @@ int hero_set_state(int a, int b) { if (1.5707964f < fast_difference_between_rotations( q->motion.rot.f[2], - FUN_001f9e90(q->unk500.f[0] - q->unk540.f[0], + fast_arc_tan(q->unk500.f[0] - q->unk540.f[0], q->unk500.f[1] - q->unk540.f[1]))) id = 0x1F; set_hero_animation(id, 0, (float)scale_game_frames(5)); @@ -1302,7 +1302,7 @@ int hero_set_state(int a, int b) { if (q->items[0].item_id == 0xA && ((char *)q->unkA50) != 0) { q->unkA58 = 1; q->unkA5C = - FUN_001f9e90(*(float *)(((char *)q->unkA50) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unkA50) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unkA50) + 0x14) - q->motion.pos.f[1]); } break; diff --git a/src/overlays/l15/gameplay/entities/conveyor_belt.c b/src/overlays/l15/gameplay/entities/conveyor_belt.c index de78baf196..63216ed36d 100644 --- a/src/overlays/l15/gameplay/entities/conveyor_belt.c +++ b/src/overlays/l15/gameplay/entities/conveyor_belt.c @@ -13,13 +13,14 @@ /* Updates a moby: initialises its vector, then applies an angle-based offset. */ /* Ported from rac1-decomp (src/overlays/l15_quartu/vendor_0029C1D0.c: func_L15_002E87B0), where it is exact; names translated to the US level program. */ -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); -extern float FUN_001fa580(float, float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); -extern void FUN_L00_00260738(char *a, void *b, void *c, void *d); +extern void update_entity_matrix(char *a, void *b, void *c, void *d) __asm__("FUN_L00_00260738"); -void FUN_L15_002e73c0(struct Moby *moby) { +void conveyor_belt_update(struct Moby *moby) __asm__("FUN_L15_002e73c0"); +void conveyor_belt_update(struct Moby *moby) { char *data = (char *)moby->pvars; if (data != 0) { unsigned char state = moby->state; @@ -34,15 +35,15 @@ void FUN_L15_002e73c0(struct Moby *moby) { case 3: moby->anim_speed = 1.3888889f; *(float *)(data + 0x40) = - FUN_001f9dc8(FUN_001fa580(moby->rot.z, 1.5707964f)) * + fast_cos(fast_add_rotations(moby->rot.z, 1.5707964f)) * (frame_time * 2.5f); *(float *)(data + 0x44) = - FUN_001f9de0(FUN_001fa580(moby->rot.z, 1.5707964f)) * + fast_sin(fast_add_rotations(moby->rot.z, 1.5707964f)) * (frame_time * 2.5f); *(int *)(data + 0x48) = 0; break; } - FUN_L00_00260738(data + 0x60, data + 0x40, &moby->rot, &moby->rot); + update_entity_matrix(data + 0x60, data + 0x40, &moby->rot, &moby->rot); } } #include "qcopy.h" @@ -125,7 +126,7 @@ struct Moby_A4D88 { u16 flags; u16 unk36; /* set to 0x7F80 by spawners */ u64 spawn_frame; /* frame count at which it may respawn */ - Vec4f_A4D88 rot; /* z: yaw (FUN_L00_00266448 compares it with atan2 to the hero) */ + Vec4f_A4D88 rot; /* z: yaw (update_npc_dialogue compares it with atan2 to the hero) */ u8 frame; /* animation frame */ u8 prev_frame; /* frame index in prev_seq */ u8 seq; /* animation sequence id */ @@ -145,11 +146,11 @@ struct Moby_A4D88 { u8 unk7C; u8 pad7D; u8 unk7E; - u8 unk7F; /* set to 0x17 by FUN_L09_002c5990 near D_L09_00166F40 */ + u8 unk7F; /* set to 0x17 by seeker_update near D_L09_00166F40 */ u8 pad80[0x10]; s32 unk90; u32 unk94; /* set from the class header's word 0x10 */ - s32 unk98; /* set to 1 while a carrier holds the moby (FUN_L00_002c7a58) */ + s32 unk98; /* set to 1 while a carrier holds the moby (glove_of_doom_update) */ u8 pad9C[8]; u8 unkA4; u8 padA5; @@ -221,8 +222,8 @@ extern float D_L15_00161FBC __attribute__((sda)); extern int coll_line_fix(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); extern int FUN_L00_001f0d60(); extern int FUN_L00_001ff660(); -extern int FUN_L00_0025e450(); -extern void *FUN_002141f8(struct Moby_A4D88 *); +extern int spawn_explosion() __asm__("FUN_L00_0025e450"); +extern void *suck_get_aim_height(struct Moby_A4D88 *) __asm__("FUN_002141f8"); extern void collect_mobies_in_sphere(void *, int, void *, void *, float) __asm__("FUN_L00_001f2868"); extern void FUN_L00_001ff290(void *, void *, void *); extern void mark_moby_for_removal(void *) __asm__("func_0020C828"); @@ -237,7 +238,7 @@ extern int D_001414D0_2E9358 __asm__("D_001413D0") __attribute__((section(".data extern s32 D_L15_00178500[] __asm__("D_L15_00178500"); extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern Res_2E9358 *trooper_find_hit(void *, int, int) __asm__("FUN_L00_0025a420"); -extern char *c338_p(int) __asm__("FUN_L00_002603d0"); +extern char *FUN_L00_002603d0(int); extern void func_L00_001FF240_2E9358(void *, void *, void *) __asm__("FUN_L00_001ff290"); extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); extern void func_L00_001FF610_2E9358(void *, void *, void *) __asm__("FUN_L00_001ff660"); @@ -248,7 +249,8 @@ extern int trooper_play_sound(int, int, void *, int) __asm__("FUN_L00_0028dc90") extern int probe_world_sphere(void *, int, void *, void *, float) __asm__("FUN_L00_001f2868"); extern void mine_blast_mobys(void *, void *, void *, int, int, int, int, int, float, float, float) __asm__("FUN_L00_0025a9f8"); -void FUN_L15_002e7f68(Moby_2E9358 *moby) { +void poison_vessel_update(Moby_2E9358 *moby) __asm__("FUN_L15_002e7f68"); +void poison_vessel_update(Moby_2E9358 *moby) { Vec_2E9358 s20; Vec_2E9358 s30; Vec_2E9358 s40; @@ -261,7 +263,7 @@ void FUN_L15_002e7f68(Moby_2E9358 *moby) { s20.q = moby->pos; clear_u64_value(&s30); if (coll_sphere(0.5f, &moby->pos, 1, moby)) { - if (D_L15_001744D8_2E9358 == 0 || c338_p(D_L15_001744D8_2E9358) == 0) { + if (D_L15_001744D8_2E9358 == 0 || FUN_L00_002603d0(D_L15_001744D8_2E9358) == 0) { moby->bBC = 1; } } @@ -277,7 +279,7 @@ void FUN_L15_002e7f68(Moby_2E9358 *moby) { data->f8 = data->f8 - D_L15_00161FBC * frame_time_sq; func_L00_001FF240_2E9358(&s40, &moby->pos, data); if (collision_line(&s20, &moby->pos, 0x10, moby, 0)) { - if (((Tb_2E9358 *)D_L15_001744C0_2E9358)->f18 != 0 && c338_p(((Tb_2E9358 *)D_L15_001744C0_2E9358)->f18) != 0) { + if (((Tb_2E9358 *)D_L15_001744C0_2E9358)->f18 != 0 && FUN_L00_002603d0(((Tb_2E9358 *)D_L15_001744C0_2E9358)->f18) != 0) { data->target = (Moby_2E9358 *)((Tb_2E9358 *)D_L15_001744C0_2E9358)->f18; moby->state = 1; data->f8 = 0.0f; @@ -299,7 +301,7 @@ void FUN_L15_002e7f68(Moby_2E9358 *moby) { moby->bBC = state; data->target = 0; } else if (D_L15_001744D8_2E9358 != 0) { - p20 = c338_p(D_L15_001744D8_2E9358); + p20 = FUN_L00_002603d0(D_L15_001744D8_2E9358); if (p20 != 0) { func_L00_00261478_2E9358(moby, data->target, &moby->pos, &moby->v40, &moby->pos, &moby->v40); subtract_vector_xyz(&s40, &moby->pos, &s20); @@ -333,20 +335,21 @@ void FUN_L15_002e7f68(Moby_2E9358 *moby) { /* Ported from rac1-decomp (src/overlays/l15_quartu/vendor_0029C1D0.c: func_L15_002EBB38), where it is exact; names translated to the US level program. */ extern f32 fast_add_rotations(f32 a, f32 b) __asm__("FUN_001fa580"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern int D_L15_0015F5C4; extern int D_L15_0015F640; extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern unsigned char D_0013D4FD[]; extern void FUN_L00_00260860(int, int); extern void queue_dialogue_message(int, int) __asm__("FUN_L00_00263d40"); -extern void FUN_L00_00298840(int); +extern void start_scene(int) __asm__("FUN_L00_00298840"); extern void FUN_L00_002d6bf0(char *); extern void FUN_L10_00298940(char *); int memcard_save_data(int slot, int flags) __asm__("FUN_0020b178"); extern short D_L15_00162078 __attribute__((sda)); -void FUN_L15_002ea748(struct Moby *m) { +void bolt_grabber_update(struct Moby *m) __asm__("FUN_L15_002ea748"); +void bolt_grabber_update(struct Moby *m) { m->rot.z = fast_add_rotations(m->rot.z, frame_time * 1.5707964f); m->scale = m->pclass->scale * *(float *)&D_L15_00162078; switch (m->state) { @@ -361,9 +364,9 @@ void FUN_L15_002ea748(struct Moby *m) { break; case 1: FUN_L10_00298940((char *)m); - if (FUN_001f9b80(&m->pos, &hero.motion.pos) < 3.0f) { + if (vector_distance(&m->pos, &hero.motion.pos) < 3.0f) { m->flags |= 0x41; - FUN_L00_00298840(5); + start_scene(5); m->state = 2; } break; @@ -386,7 +389,7 @@ void FUN_L15_002ea748(struct Moby *m) { extern char *FUN_L15_002e7ed8_c(void *, void *) __asm__("FUN_L15_002e7ed8"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern int FUN_001f9740(int *); +extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern short D_L15_0016207C; extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); @@ -400,7 +403,7 @@ void FUN_L15_002eabd8(struct Moby *moby) { moby->update_dist = 0xFF; break; case 1: - if (FUN_001f9740(data)) { + if (fast_dec_timer(data)) { data[0] = func_001FA898_r(multiply_global_factor_ed64(*(float *)&D_L15_0016207C * 60.0f)); FUN_L15_002e7ed8_c(moby, &moby->pos); } @@ -443,7 +446,7 @@ extern float D_L15_00162100 __attribute__((sda)); extern s64 get_effect_texture(s32) __asm__("func_001F44B8"); extern float D_L15_00162104 __attribute__((sda)); extern void FUN_L00_001fde98(int, int, int, void *, int); -extern void FUN_L00_00250320(void *, void *, void *, void *); +extern void get_moby_color(void *, void *, void *, void *) __asm__("FUN_L00_00250320"); extern void vu1_add_gs_register(s32, unsigned long) __asm__("func_00233980"); void font_queue_vu_state(void) __asm__("FUN_001f76a0"); @@ -479,7 +482,7 @@ void FUN_L15_002eac90(struct Moby *moby) { d->f0 = d->f4; d->f4 = fast_add_rotations(d->f4, 360.0f / multiply_global_factor_ed64(D_L15_001620FC) * DEG_TO_RAD * frame_time); - FUN_L00_00250320(moby, &r, &g, &b); + get_moby_color(moby, &r, &g, &b); color = (D_L15_001620F4 << 24) | (b << 16) | (g << 8) | r; for (i = 0; i < 3; i++) { for (j = 0; j < D_L15_00162080[i]; j++) { @@ -533,10 +536,79 @@ typedef struct { Quad4 D_L15_00162170 = {{1.0f, -0.62831855f, 1.0f, 0.62831855f}}; extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); extern float D_L15_0016216C __attribute__((sda)); -extern float D_L15_001DDBA0[]; -extern float D_L15_001DDED0[][2]; -extern float D_L15_001DE200[]; -extern float D_L15_001DE530[][2]; +float D_L15_001DDBA0[204] = {3.485078f, 4.343359f, 0.0f, 5.279609f, 3.600078f, 0.0f, 2.980781f, 2.623281f, 0.0f, 4.615703f, 1.997344f, 0.0f, 2.298828f, 0.976816f, 0.0f, 3.933828f, 0.351152f, 0.0f, 1.616797f, -0.669707f, 0.0f, 3.237344f, -1.330234f, 0.0f, 0.850156f, -2.520547f, 0.0f, 2.454375f, -3.220508f, 0.0f, -0.025f, -4.63334f, 0.0f, 1.594062f, -5.297578f, 0.0f, -0.025f, -4.63334f, 0.0f, 0.733984f, -7.373926f, -5e-06f, -0.025f, -4.63334f, 0.0f, -1.060508f, -6.630625f, 0.0f, -1.641797f, -3.963652f, 0.0f, -2.49957f, -6.034551f, 0.0f, -3.258633f, -3.293945f, 0.0f, -3.938672f, -5.438457f, 0.0f, -3.258633f, -3.293945f, 0.0f, -5.733164f, -4.695137f, 0.0f, -3.258633f, -3.293945f, 0.0f, -4.873164f, -2.618789f, 0.0f, -2.383437f, -1.181152f, 0.0f, -4.012774f, -0.541719f, 0.0f, -1.616797f, 0.669688f, 0.0f, -3.229805f, 1.348555f, 0.0f, -0.934805f, 2.316172f, 0.0f, -2.53332f, 3.029922f, 0.0f, -0.252813f, 3.962656f, 0.0f, -1.851445f, 4.676094f, 0.0f, -0.252813f, 3.962656f, 0.0f, -1.187617f, 6.278828f, 0.0f, -0.252813f, 3.962656f, 0.0f, 0.606953f, 5.535547f, 0.0f, 1.363984f, 3.292969f, 0.0f, 2.046016f, 4.939453f, 0.0f, 1.363984f, 3.292969f, 0.0f, 3.485078f, 4.343359f, 0.0f, 1.363984f, 3.292969f, 0.0f, 2.980781f, 2.623281f, 0.0f, 1.363984f, 3.292969f, 0.0f, 2.298828f, 0.976816f, 0.0f, 1.363984f, 3.292969f, 0.0f, 0.681953f, 1.646484f, 0.0f, -0.252813f, 3.962656f, 0.0f, 0.681953f, 1.646484f, 0.0f, -0.934805f, 2.316172f, 0.0f, 0.681953f, 1.646484f, 0.0f, -1.616797f, 0.669688f, 0.0f, 0.681953f, 1.646484f, 0.0f, 0.0f, 0.0f, 0.0f, 2.298828f, 0.976816f, 0.0f, 0.0f, 0.0f, 0.0f, 1.616797f, -0.669707f, 0.0f, -0.766641f, -1.85084f, 0.0f, 0.850156f, -2.520547f, 0.0f, -0.766641f, -1.85084f, 0.0f, -0.025f, -4.63334f, 0.0f, -0.766641f, -1.85084f, 0.0f, -1.641797f, -3.963652f, 0.0f, -0.766641f, -1.85084f, 0.0f, -3.258633f, -3.293945f, 0.0f, -0.766641f, -1.85084f, 0.0f, -2.383437f, -1.181152f, 0.0f, 0.0f, 0.0f, 0.0f, -1.616797f, 0.669688f, 0.0f}; +float D_L15_001DDED0[68][2] = { + {2.945454f, -1.355928f}, + {2.573813f, -2.253193f}, + {2.085415f, -1.103779f}, + {1.772446f, -1.92124f}, + {1.262183f, -0.762803f}, + {0.949351f, -1.580303f}, + {0.438921f, -0.421787f}, + {0.108657f, -1.23206f}, + {-0.486499f, -0.038467f}, + {-0.836479f, -0.840576f}, + {-1.542895f, 0.399111f}, + {-1.875015f, -0.41042f}, + {-1.542895f, 0.399111f}, + {-2.913188f, 0.019619f}, + {-1.542895f, 0.399111f}, + {-2.541538f, 0.916865f}, + {-1.208052f, 1.20751f}, + {-2.243501f, 1.636396f}, + {-0.873198f, 2.015928f}, + {-1.945454f, 2.355947f}, + {-0.873198f, 2.015928f}, + {-1.573794f, 3.253193f}, + {-0.873198f, 2.015928f}, + {-0.53562f, 2.823193f}, + {0.183198f, 1.57833f}, + {0.502915f, 2.392998f}, + {1.108618f, 1.19501f}, + {1.448052f, 2.001514f}, + {1.93186f, 0.854014f}, + {2.288735f, 1.653272f}, + {2.755102f, 0.513018f}, + {3.111821f, 1.312334f}, + {2.755102f, 0.513018f}, + {3.913188f, 0.98042f}, + {2.755102f, 0.513018f}, + {3.541548f, 0.083135f}, + {2.420259f, -0.295381f}, + {3.243501f, -0.636396f}, + {2.420259f, -0.295381f}, + {2.945454f, -1.355928f}, + {2.420259f, -0.295381f}, + {2.085415f, -1.103779f}, + {2.420259f, -0.295381f}, + {1.262183f, -0.762803f}, + {2.420259f, -0.295381f}, + {1.597017f, 0.045635f}, + {2.755102f, 0.513018f}, + {1.597017f, 0.045635f}, + {1.93186f, 0.854014f}, + {1.597017f, 0.045635f}, + {1.108618f, 1.19501f}, + {1.597017f, 0.045635f}, + {0.773774f, 0.386611f}, + {1.262183f, -0.762803f}, + {0.773774f, 0.386611f}, + {0.438921f, -0.421787f}, + {-0.151646f, 0.769932f}, + {-0.486499f, -0.038467f}, + {-0.151646f, 0.769932f}, + {-1.542895f, 0.399111f}, + {-0.151646f, 0.769932f}, + {-1.208052f, 1.20751f}, + {-0.151646f, 0.769932f}, + {-0.873198f, 2.015928f}, + {-0.151646f, 0.769932f}, + {0.183198f, 1.57833f}, + {0.773774f, 0.386611f}, + {1.108618f, 1.19501f}, +}; +float D_L15_001DE200[204] = {0}; +float D_L15_001DE530[68][2] = {0}; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float square_root(float) __asm__("FUN_001f9988"); extern float FUN_L00_00200260(float, float); @@ -546,7 +618,7 @@ extern int D_L15_0015F5CC; int D_L15_00162120[2] = {0x44, 0}; int D_L15_00162140[2] = {(int)D_L15_001DE200, 0}; int D_L15_00162148[2] = {(int)D_L15_001DE530, 0}; -extern int D_L15_001DE750[]; +int D_L15_001DE750[68] = {0}; int D_L15_00162150[1] = {(int)D_L15_001DE750}; int D_L15_00162154 = 128; int D_L15_00162158 = 45; @@ -555,7 +627,7 @@ extern float D_L15_00162160 __attribute__((sda)); extern float D_L15_00162164 __attribute__((sda)); extern float D_L15_00162168 __attribute__((sda)); extern void FUN_L00_001fde98(int, int, int, void *, int); -extern void FUN_L00_00250320(void *, void *, void *, void *); +extern void get_moby_color(void *, void *, void *, void *) __asm__("FUN_L00_00250320"); void font_queue_vu_state(void) __asm__("FUN_001f76a0"); void FUN_L15_002eb108(struct Moby *moby) { @@ -581,7 +653,7 @@ void FUN_L15_002eb108(struct Moby *moby) { data->prev = data->angle; data->angle = fast_add_rotations(data->angle, 360.0f / multiply_global_factor_ed64(D_L15_00162164) * DEG_TO_RAD * frame_time); - FUN_L00_00250320(moby, &r, &g, &b); + get_moby_color(moby, &r, &g, &b); /* The second float of each pair in t: p->f[0] is t.f[1], p->f[2] is t.f[3]. */ p = (Quad4 *)&t.f[1]; color = (D_L15_0016215C << 24) | (b << 16) | (g << 8) | r; @@ -705,7 +777,7 @@ extern int sprintf(char *str, const char *fmt, ...) __asm__("FUN_00116248"); extern int strlen_alt(char *) __asm__("FUN_001166cc"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); void font_print_large(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) __asm__("FUN_001f6530"); -extern void font_print_large_001fb470(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) __asm__("FUN_L00_001fb470"); +extern void FUN_L00_001fb470(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4); int D_L15_00162180 = 150; int D_L15_00162184 = 150; @@ -761,10 +833,10 @@ void FUN_L15_002eb6b8(void) { if ((n - val) & 4) n = n - 1; } - font_print_large_001fb470((void *)(D_L15_00162180 + 1), + FUN_L00_001fb470((void *)(D_L15_00162180 + 1), (void *)(D_L15_00162184 + 1), (void *)D_L15_0016218C, buf, (void *)n); - font_print_large_001fb470((void *)D_L15_00162180, (void *)D_L15_00162184, + FUN_L00_001fb470((void *)D_L15_00162180, (void *)D_L15_00162184, (void *)D_L15_00162188, buf, (void *)n); } /* Per-frame update: when the counter check is zero, builds a vector and calls the movement helper. */ @@ -887,7 +959,8 @@ extern float scale_time(float) __asm__("FUN_L15_001f8648"); #include "rnc/gameplay/state/item_state.h" -void FUN_L15_002ec030(struct Moby *moby) { +void codebot_slot_update(struct Moby *moby) __asm__("FUN_L15_002ec030"); +void codebot_slot_update(struct Moby *moby) { int *data = (int *)moby->pvars; float vec[4] __attribute__((aligned(16))); float tmp[4] __attribute__((aligned(16))); @@ -1021,15 +1094,13 @@ extern void FUN_00255e88(void *, void *) __asm__("FUN_L00_002668a0"); extern int FUN_00255a30(void *, void *) __asm__("FUN_L00_00266448"); extern int FUN_002489f0(int, int) __asm__("FUN_L01_0026e008"); extern int FUN_001f8658(int) __asm__("FUN_001f96f8"); -extern int FUN_001f86a0(void *) __asm__("FUN_001f9740"); extern void FUN_00246e30(void *, int, int) __asm__("FUN_00212ed8"); extern void FUN_00254c50(int, int) __asm__("FUN_L01_0027a248"); extern void FUN_0023ca30(int, int) __asm__("FUN_0020b178"); extern float FUN_001f8c00(void *, void *) __asm__("FUN_001f9b80"); -extern float FUN_001f9028(float, float) __asm__("FUN_001f9e90"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float FUN_001f9968(float, float) __asm__("FUN_001fa688"); -extern float FUN_001f8b50(void *) __asm__("FUN_001f9af0"); -extern int FUN_001f99c8(float) __asm__("FUN_001fa6d0"); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern float FUN_001f9860(float, float) __asm__("FUN_001fa580"); extern void FUN_00252348(float, float, float, void *) __asm__("FUN_00214db0"); extern void FUN_001f89f0(void *, void *, void *) __asm__("FUN_001f9a10"); @@ -1038,7 +1109,8 @@ extern float FUN_001f98a8(float, float) __asm__("FUN_001fa5c8"); extern float FUN_001f8b80(void *) __asm__("FUN_001f9b20"); extern void FUN_00251fd0(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); -void FUN_L15_002ec760(struct Moby *moby) { +void ultramech_scientist_update(struct Moby *moby) __asm__("FUN_L15_002ec760"); +void ultramech_scientist_update(struct Moby *moby) { char *data = (char *)moby->pvars; char *other; int index; @@ -1144,7 +1216,7 @@ void FUN_L15_002ec760(struct Moby *moby) { } case 4: { char *other; - if (FUN_001f86a0(data + 0x15c)) { + if (fast_dec_timer(data + 0x15c)) { FUN_L15_00208ca8(); FUN_00246e30((char *)D_L15_0015FFD8 + (*(int *)(data + 0x14c) << 8), 0, 0); *(short *)(data + 0x36) = 1; @@ -1186,11 +1258,11 @@ void FUN_L15_002ec760(struct Moby *moby) { near_distance = FUN_001f8c00(pos, &hero.motion.pos); if (near_distance < 8.0f) { yaw = D_0013F424 - *(float *)((char *)moby + 0x14); - yaw = FUN_001f9028(D_0013F420 - *(float *)(pos), yaw); + yaw = fast_arc_tan(D_0013F420 - *(float *)(pos), yaw); if (FUN_001f9968(moby->rot.z, yaw) < 1.5707964f) { - if (FUN_001f8b50((void *)0x13f450) > 0.01f) + if (fast_vec_length((void *)0x13f450) > 0.01f) *(int *)(data + 0x274) = FUN_001f8658(0x78); - else FUN_001f86a0(data + 0x274); + else fast_dec_timer(data + 0x274); goto ready; } } @@ -1199,9 +1271,9 @@ void FUN_L15_002ec760(struct Moby *moby) { *(OvlQuad *)(data + 0x260) = *(OvlQuad *)0x13f420; } ready: - if (FUN_001f86a0(data + 0x278)) { + if (fast_dec_timer(data + 0x278)) { float angle = 0.017453292f; - *(int *)(data + 0x278) = FUN_001f99c8(scale_time(random_float_between(180.0f, 300.0f))); + *(int *)(data + 0x278) = truncate_float_to_s32(scale_time(random_float_between(180.0f, 300.0f))); turn = FUN_001f9860(moby->rot.z, random_float_between(-90.0f, 90.0f) * angle); FUN_00252348(6.0f, turn, random_float_between(0.0f, 30.0f) * angle, data + 0x260); FUN_001f89f0(data + 0x260, data + 0x260, pos); @@ -1215,8 +1287,8 @@ void FUN_L15_002ec760(struct Moby *moby) { vecs.pos = *(OvlQuad *)(pos); ((float *)&vecs.pos)[2] += 1.0f; FUN_001f8a20(&vecs.diff, &vecs.target, &vecs.pos); - yaw = FUN_001f98a8(FUN_001f9028(((float *)&vecs.diff)[0], ((float *)&vecs.diff)[1]), moby->rot.z); - pitch = -FUN_001f9028(FUN_001f8b80(&vecs.diff), ((float *)&vecs.diff)[2]); + yaw = FUN_001f98a8(fast_arc_tan(((float *)&vecs.diff)[0], ((float *)&vecs.diff)[1]), moby->rot.z); + pitch = -fast_arc_tan(FUN_001f8b80(&vecs.diff), ((float *)&vecs.diff)[2]); if (yaw < -1.5707964f) yaw = -1.5707964f; else if (yaw > 1.5707964f) yaw = 1.5707964f; if (pitch < -0.5235988f) pitch = -0.5235988f; @@ -1432,7 +1504,7 @@ void FUN_L15_002ed398(struct Moby *m) { break; } } -/* Waits for state 1, then passes the slot for the level's current mode to FUN_L00_002637f8. */ +/* Waits for state 1, then passes the slot for the level's current mode to cutscene_set_camera_target. */ struct L15MissionState { char pad0[0x30]; int mode; @@ -1442,7 +1514,7 @@ struct L15MissionState { extern int D_L15_0015F5C4; extern struct L15MissionState mission_2edb20 __asm__("D_L15_0016CE60"); -extern void FUN_L00_002637f8(int); +extern void cutscene_set_camera_target(int) __asm__("FUN_L00_002637f8"); void FUN_L15_002edb20(struct Moby *m) { switch (m->state) { @@ -1463,7 +1535,7 @@ void FUN_L15_002edb20(struct Moby *m) { i = 2; else if (v == 6) i = 1; - FUN_L00_002637f8(mission_2edb20.slot[i]); + cutscene_set_camera_target(mission_2edb20.slot[i]); } } break; @@ -1489,11 +1561,105 @@ typedef struct { float angle; } RingVars_2edbe0; -extern float D_L15_001DECB0[][3]; -extern float D_L15_001DE860[][3]; -extern int D_L15_001DF048[]; -extern float D_L15_001DEA88[][2]; -extern float D_L15_001DEED8[][2]; +float D_L15_001DECB0[46][3] = {0}; +float D_L15_001DE860[46][3] = { + {11.779387f, 28.437962f, 0.0f}, + {21.76547f, 21.76547f, 0.0f}, + {15.0f, 15.0f, 0.0f}, + {28.437956f, 11.779387f, 0.0f}, + {15.0f, 0.0f, 0.0f}, + {3e+01f, 0.0f, 0.0f}, + {15.0f, -15.0f, 0.0f}, + {28.437956f, -11.779387f, 0.0f}, + {15.0f, -15.0f, 0.0f}, + {21.76547f, -21.76547f, 0.0f}, + {15.0f, -15.0f, 0.0f}, + {11.779387f, -28.437956f, 0.0f}, + {0.0f, -15.0f, 0.0f}, + {0.0f, -3e+01f, 0.0f}, + {-15.0f, -15.0f, 0.0f}, + {-11.779387f, -28.437962f, 0.0f}, + {-15.0f, -15.0f, 0.0f}, + {-21.76547f, -21.76547f, 0.0f}, + {-15.0f, -15.0f, 0.0f}, + {-28.437956f, -11.779387f, 0.0f}, + {-15.0f, 0.0f, 0.0f}, + {-3e+01f, 0.0f, 0.0f}, + {-15.0f, 15.0f, 0.0f}, + {-28.437962f, 11.779387f, 0.0f}, + {-15.0f, 15.0f, 0.0f}, + {-21.765469f, 21.765469f, 0.0f}, + {-15.0f, 15.0f, 0.0f}, + {-11.779387f, 28.437962f, 0.0f}, + {0.0f, 15.0f, 0.0f}, + {0.0f, 3e+01f, 0.0f}, + {0.0f, 15.0f, 0.0f}, + {11.779387f, 28.437962f, 0.0f}, + {0.0f, 15.0f, 0.0f}, + {15.0f, 15.0f, 0.0f}, + {0.0f, 0.0f, 0.0f}, + {15.0f, 0.0f, 0.0f}, + {0.0f, 0.0f, 0.0f}, + {15.0f, -15.0f, 0.0f}, + {0.0f, 0.0f, 0.0f}, + {0.0f, -15.0f, 0.0f}, + {0.0f, 0.0f, 0.0f}, + {-15.0f, -15.0f, 0.0f}, + {0.0f, 0.0f, 0.0f}, + {-15.0f, 0.0f, 0.0f}, + {0.0f, 15.0f, 0.0f}, + {-15.0f, 15.0f, 0.0f}, +}; +int D_L15_001DF048[46] = {0}; +float D_L15_001DEA88[46][2] = { + {2.949836f, -0.514755f}, + {2.375023f, -1.375023f}, + {1.7922f, -0.7922f}, + {1.514755f, -1.949835f}, + {0.5f, -0.7922f}, + {0.5f, -2.0844f}, + {-0.7922f, -0.7922f}, + {-0.514755f, -1.949835f}, + {-0.7922f, -0.7922f}, + {-1.375023f, -1.375023f}, + {-0.7922f, -0.7922f}, + {-1.949835f, -0.514755f}, + {-0.7922f, 0.5f}, + {-2.0844f, 0.5f}, + {-0.7922f, 1.7922f}, + {-1.949835f, 1.514755f}, + {-0.7922f, 1.7922f}, + {-1.375023f, 2.375022f}, + {-0.7922f, 1.7922f}, + {-0.514755f, 2.949835f}, + {0.5f, 1.7922f}, + {0.5f, 3.0844f}, + {1.7922f, 1.7922f}, + {1.514755f, 2.949835f}, + {1.7922f, 1.7922f}, + {2.375023f, 2.375022f}, + {1.7922f, 1.7922f}, + {2.949835f, 1.514755f}, + {1.7922f, 0.5f}, + {3.0844f, 0.5f}, + {1.7922f, 0.5f}, + {2.949836f, -0.514755f}, + {1.7922f, 0.5f}, + {1.7922f, -0.7922f}, + {0.5f, 0.5f}, + {0.5f, -0.7922f}, + {0.5f, 0.5f}, + {-0.7922f, -0.7922f}, + {0.5f, 0.5f}, + {-0.7922f, 0.5f}, + {0.5f, 0.5f}, + {-0.7922f, 1.7922f}, + {0.5f, 0.5f}, + {0.5f, 1.7922f}, + {1.7922f, 0.5f}, + {1.7922f, 1.7922f}, +}; +float D_L15_001DEED8[46][2] = {0}; extern Quad4_2edbe0 D_L15_00162208; int D_L15_001621B0[1] = {0x2e}; int D_L15_001621D0[1] = {(int)D_L15_001DECB0}; @@ -1573,11 +1739,189 @@ typedef struct { float angle; } RingVars_2edfc0; -extern float D_L15_001DF940[][3]; -extern float D_L15_001DF100[][3]; -extern int D_L15_001E0020[]; -extern float D_L15_001DF520[][2]; -extern float D_L15_001DFD60[][2]; +float D_L15_001DF940[88][3] = {0}; +float D_L15_001DF100[88][3] = { + {0.0f, -4.4e-05f, -8.4e-05f}, + {-0.545705f, -0.418775f, -7.9e-05f}, + {-1.422783f, 1.854165f, -0.000104f}, + {-1.968488f, 1.435435f, -9.9e-05f}, + {-2.845565f, 3.708374f, -0.000121f}, + {-3.391273f, 3.289643f, -0.000116f}, + {-4.268348f, 5.562582f, -0.000138f}, + {-4.814055f, 5.143852f, -0.000135f}, + {-5.691131f, 7.416792f, -0.000157f}, + {-4.814055f, 5.143852f, -0.000135f}, + {-6.23684f, 6.998059f, -0.000155f}, + {-5.359763f, 4.725121f, -0.000133f}, + {-6.782547f, 6.579327f, -0.000152f}, + {-5.90547f, 4.30639f, -0.000128f}, + {-7.328256f, 6.160594f, -0.00015f}, + {-6.451175f, 3.887654f, -0.000128f}, + {-7.873965f, 5.741859f, -0.000147f}, + {-6.954219f, 3.501659f, -0.000125f}, + {-8.377006f, 5.355859f, -0.000147f}, + {-7.457261f, 3.115659f, -0.000123f}, + {-8.88005f, 4.969857f, -0.000145f}, + {-7.960301f, 2.729661f, -0.000121f}, + {-9.383094f, 4.583856f, -0.000143f}, + {-7.960301f, 2.729661f, -0.000121f}, + {-9.886135f, 4.197855f, -0.000143f}, + {-7.960301f, 2.729661f, -0.000121f}, + {-8.463342f, 2.343659f, -0.000118f}, + {-6.537511f, 0.875461f, -9.9e-05f}, + {-7.040548f, 0.489462f, -9.6e-05f}, + {-5.114717f, -0.978736f, -7.7e-05f}, + {-5.617753f, -1.364733f, -7.4e-05f}, + {-5.114717f, -0.978736f, -7.7e-05f}, + {-4.194959f, -3.218929f, -5e-05f}, + {-5.114717f, -0.978736f, -7.7e-05f}, + {-3.691922f, -2.832938f, -5.5e-05f}, + {-4.611681f, -0.592744f, -7.9e-05f}, + {-3.188887f, -2.446948f, -5.7e-05f}, + {-4.108642f, -0.20675f, -8.2e-05f}, + {-2.685849f, -2.060957f, -6e-05f}, + {-3.605601f, 0.17924f, -8.4e-05f}, + {-2.182811f, -1.674966f, -6.4e-05f}, + {-3.059897f, 0.597974f, -9.1e-05f}, + {-1.637109f, -1.256235f, -6.9e-05f}, + {-2.514193f, 1.016704f, -9.4e-05f}, + {-1.091407f, -0.837505f, -7.4e-05f}, + {-2.514193f, 1.016704f, -9.4e-05f}, + {-0.545705f, -0.418775f, -7.9e-05f}, + {-2.514193f, 1.016704f, -9.4e-05f}, + {-1.968488f, 1.435435f, -9.9e-05f}, + {-3.936981f, 2.870914f, -0.000111f}, + {-3.391273f, 3.289643f, -0.000116f}, + {-3.936981f, 2.870914f, -0.000111f}, + {-4.814055f, 5.143852f, -0.000135f}, + {-3.936981f, 2.870914f, -0.000111f}, + {-5.359763f, 4.725121f, -0.000133f}, + {-3.936981f, 2.870914f, -0.000111f}, + {-5.90547f, 4.30639f, -0.000128f}, + {-3.936981f, 2.870914f, -0.000111f}, + {-4.482684f, 2.45218f, -0.000108f}, + {-2.514193f, 1.016704f, -9.4e-05f}, + {-4.482684f, 2.45218f, -0.000108f}, + {-3.059897f, 0.597974f, -9.1e-05f}, + {-4.482684f, 2.45218f, -0.000108f}, + {-3.605601f, 0.17924f, -8.4e-05f}, + {-4.482684f, 2.45218f, -0.000108f}, + {-5.028388f, 2.033447f, -0.000106f}, + {-5.90547f, 4.30639f, -0.000128f}, + {-5.028388f, 2.033447f, -0.000106f}, + {-6.451175f, 3.887654f, -0.000128f}, + {-5.028388f, 2.033447f, -0.000106f}, + {-6.954219f, 3.501659f, -0.000125f}, + {-5.028388f, 2.033447f, -0.000106f}, + {-5.53143f, 1.647454f, -0.000104f}, + {-3.605601f, 0.17924f, -8.4e-05f}, + {-5.53143f, 1.647454f, -0.000104f}, + {-4.108642f, -0.20675f, -8.2e-05f}, + {-6.034472f, 1.261461f, -0.000104f}, + {-4.611681f, -0.592744f, -7.9e-05f}, + {-6.034472f, 1.261461f, -0.000104f}, + {-5.114717f, -0.978736f, -7.7e-05f}, + {-6.034472f, 1.261461f, -0.000104f}, + {-6.537511f, 0.875461f, -9.9e-05f}, + {-6.034472f, 1.261461f, -0.000104f}, + {-7.960301f, 2.729661f, -0.000121f}, + {-6.034472f, 1.261461f, -0.000104f}, + {-7.457261f, 3.115659f, -0.000123f}, + {-5.53143f, 1.647454f, -0.000104f}, + {-6.954219f, 3.501659f, -0.000125f}, +}; +int D_L15_001E0020[88] = {0}; +float D_L15_001DF520[88][2] = { + {1.549487f, 2.971533f}, + {1.758852f, 2.698682f}, + {0.622383f, 2.260142f}, + {0.831748f, 1.987289f}, + {-0.304721f, 1.54875f}, + {-0.095357f, 1.275897f}, + {-1.231826f, 0.837359f}, + {-1.022461f, 0.564505f}, + {-2.15893f, 0.125968f}, + {-1.022461f, 0.564505f}, + {-1.949564f, -0.146887f}, + {-0.813094f, 0.291651f}, + {-1.740197f, -0.419741f}, + {-0.603729f, 0.018797f}, + {-1.530831f, -0.692595f}, + {-0.394361f, -0.254055f}, + {-1.321465f, -0.965449f}, + {-0.201364f, -0.505576f}, + {-1.128464f, -1.21697f}, + {-0.008365f, -0.757097f}, + {-0.935464f, -1.468491f}, + {0.184635f, -1.008617f}, + {-0.742463f, -1.720012f}, + {0.184635f, -1.008617f}, + {-0.549463f, -1.971533f}, + {0.184635f, -1.008617f}, + {0.377635f, -1.260136f}, + {1.111734f, -0.297221f}, + {1.304734f, -0.54874f}, + {2.038833f, 0.414175f}, + {2.231832f, 0.162657f}, + {2.038833f, 0.414175f}, + {3.15893f, 0.874054f}, + {2.038833f, 0.414175f}, + {2.965935f, 1.125572f}, + {1.845837f, 0.665694f}, + {2.772939f, 1.377091f}, + {1.65284f, 0.917213f}, + {2.579944f, 1.628609f}, + {1.459845f, 1.168733f}, + {2.386948f, 1.880127f}, + {1.250479f, 1.441585f}, + {2.177583f, 2.152979f}, + {1.041113f, 1.714437f}, + {1.968218f, 2.42583f}, + {1.041113f, 1.714437f}, + {1.758852f, 2.698682f}, + {1.041113f, 1.714437f}, + {0.831748f, 1.987289f}, + {0.114008f, 1.003043f}, + {-0.095357f, 1.275897f}, + {0.114008f, 1.003043f}, + {-1.022461f, 0.564505f}, + {0.114008f, 1.003043f}, + {-0.813094f, 0.291651f}, + {0.114008f, 1.003043f}, + {-0.603729f, 0.018797f}, + {0.114008f, 1.003043f}, + {0.323375f, 0.730191f}, + {1.041113f, 1.714437f}, + {0.323375f, 0.730191f}, + {1.250479f, 1.441585f}, + {0.323375f, 0.730191f}, + {1.459845f, 1.168733f}, + {0.323375f, 0.730191f}, + {0.532742f, 0.457339f}, + {-0.603729f, 0.018797f}, + {0.532742f, 0.457339f}, + {-0.394361f, -0.254055f}, + {0.532742f, 0.457339f}, + {-0.201364f, -0.505576f}, + {0.532742f, 0.457339f}, + {0.725738f, 0.205818f}, + {1.459845f, 1.168733f}, + {0.725738f, 0.205818f}, + {1.65284f, 0.917213f}, + {0.918734f, -0.045703f}, + {1.845837f, 0.665694f}, + {0.918734f, -0.045703f}, + {2.038833f, 0.414175f}, + {0.918734f, -0.045703f}, + {1.111734f, -0.297221f}, + {0.918734f, -0.045703f}, + {0.184635f, -1.008617f}, + {0.918734f, -0.045703f}, + {-0.008365f, -0.757097f}, + {0.725738f, 0.205818f}, + {-0.201364f, -0.505576f}, +}; +float D_L15_001DFD60[88][2] = {0}; extern Quad4_2edfc0 D_L15_00162278; int D_L15_00162220[1] = {0x58}; int D_L15_00162240[1] = {(int)D_L15_001DF940}; @@ -1698,10 +2042,10 @@ extern char D_L15_00167410[]; extern char D_L15_00167280[]; extern float fast_vec_dot(void *a, void *b) __asm__("FUN_001f9ab0"); extern float fast_vec_length(void *a) __asm__("FUN_001f9af0"); -extern float FUN_001f9df8(float); +extern float fast_arc_sin(float) __asm__("FUN_001f9df8"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern void FUN_001f9a28(void *dst, void *a, void *b); +extern void fast_vec_sub(void *dst, void *a, void *b) __asm__("FUN_001f9a28"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern float FUN_001f99c0(float); @@ -1728,14 +2072,14 @@ int FUN_L15_002f8698(char *moby, float a, float b) { return 1; } g = D_L15_00167280; - FUN_001f9a28(d, src + 0x30, *(char **)(g + 0x180) + 0x30); + fast_vec_sub(d, src + 0x30, *(char **)(g + 0x180) + 0x30); dot1 = fast_vec_dot(d, (vec + 0x30)); fast_vec_scale(p, (vec + 0x30), dot1); - FUN_001f9a28(q, d, p); + fast_vec_sub(q, d, p); lenq = fast_vec_length(q); dot2 = fast_vec_dot(*(char **)(g + 0x180), (vec + 0x30)); fast_vec_scale(p, (vec + 0x30), dot2); - FUN_001f9a28(r, *(char **)(g + 0x180), p); + fast_vec_sub(r, *(char **)(g + 0x180), p); lenr = fast_vec_length(r); if (b != 0.0f) { float t1 = fast_arc_tan(lenq, dot1); @@ -1753,7 +2097,7 @@ int FUN_L15_002f8698(char *moby, float a, float b) { if (den == 0.0f) { return 0; } - if (FUN_001f99c0(1.5707964f - FUN_001f9df8(dot3 / den)) < a * DEG_TO_RAD) { + if (FUN_001f99c0(1.5707964f - fast_arc_sin(dot3 / den)) < a * DEG_TO_RAD) { return 1; } return 0; @@ -1761,14 +2105,14 @@ int FUN_L15_002f8698(char *moby, float a, float b) { extern char *D_L15_00167400_lui __asm__("D_L15_00167400") __attribute__((section(".data"))); typedef struct { char pad[0x100]; float x; float y; } G_88e8; extern G_88e8 D_0013C940_s __asm__("D_0013C940") __attribute__((section(".data"))); -extern int ready_s(char *) __asm__("FUN_L00_002e83c0"); -extern void release_s(char *) __asm__("FUN_L00_002e8388"); +extern int FUN_L00_002e83c0(char *); +extern void FUN_L00_002e8388(char *); extern int frames_s(int) __asm__("FUN_001f96f8"); -extern void cam_s(float, float, float) __asm__("FUN_L02_002f6598"); +extern void FUN_L02_002f6598(float, float, float); extern float itof_s(int) __asm__("FUN_001fa6c0"); -extern void spin_s(void *, float, float) __asm__("FUN_L00_002e8970"); +extern void FUN_L00_002e8970(void *, float, float); extern void pitch_s(int, float, float) __asm__("FUN_L00_002e8450"); -extern void pitch2_s(void) __asm__("FUN_L00_002e8620"); +extern void FUN_L00_002e8620(void); extern void yaw_s(float, float) __asm__("FUN_L00_002e84b8"); extern void zoom_s(int, float, float) __asm__("FUN_L00_002e84f0"); @@ -1783,13 +2127,13 @@ void FUN_L15_002f88e8(char *m) { int t4; float r; float a; - if (ready_s(m) <= 0) { + if (FUN_L00_002e83c0(m) <= 0) { *(short *)(s + 0x20) = 0; return; } if (FUN_L15_002f85a8(m) == 0) { *(short *)(s + 0x20) = 0; - release_s(m); + FUN_L00_002e8388(m); return; } *(int *)(*(char **)(D_L15_00167400_lui + 0x70) + 0x230) = 2; @@ -1799,7 +2143,7 @@ void FUN_L15_002f88e8(char *m) { t2 = frames_s(400); t3 = frames_s(560); t4 = frames_s(200); - cam_s(1.0f, 12.0f, 0.11f); + FUN_L02_002f6598(1.0f, 12.0f, 0.11f); if (D_0013C940_s.x != 0.0f) *(short *)(s + 0x20) = t1; else if (D_0013C940_s.y != 0.0f) @@ -1822,10 +2166,10 @@ void FUN_L15_002f88e8(char *m) { r = itof_s(*(short *)(s + 0x20)) / itof_s(t4); a = *(float *)s * DEG_TO_RAD * r; if (done) - spin_s(o + 0x30, a, 0.0f); + FUN_L00_002e8970(o + 0x30, a, 0.0f); if (*(float *)(s + 0x34) != 0.0f) { pitch_s(0, *(float *)(s + 0x34), 0.003f); - pitch2_s(); + FUN_L00_002e8620(); } if (*(float *)(s + 0x38) != 0.0f) yaw_s(*(float *)(s + 0x38), 0.003f); diff --git a/src/overlays/l15/gameplay/entities/gate.c b/src/overlays/l15/gameplay/entities/gate.c index e13694723c..d4364d7422 100644 --- a/src/overlays/l15/gameplay/entities/gate.c +++ b/src/overlays/l15/gameplay/entities/gate.c @@ -385,7 +385,7 @@ typedef struct { } DoorVars; extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); -extern void *FUN_002141f8(struct Moby *); +extern void *suck_get_aim_height(struct Moby *) __asm__("FUN_002141f8"); extern char D_L15_001673C0[]; extern char *D_L15_0015FFE4; extern struct Moby *D_L15_0015FFD8; @@ -411,7 +411,7 @@ void FUN_L15_002a3ba8(struct Moby *moby) { close = 1; } for (m = (struct Moby *)D_L15_0015FFE4; m != 0; m = m->next) { - if (FUN_002141f8(m) == 0) { + if (suck_get_aim_height(m) == 0) { continue; } if (is_point_inside_clip_volume(&m->pos, vars->open_volume)) { @@ -692,9 +692,9 @@ extern int blend_color(float t, int from, int to) __asm__("FUN_L15_00249ce8"); extern s32 scale_game_frames_2aa280(s32) __asm__("FUN_001f96f8"); extern void mark_moby_for_removal(struct Moby *) __asm__("FUN_0020c828"); extern void FUN_L00_00257470(void *, int, int); -extern void FUN_L00_0025e450(void *m, void *unused, void *pos, float fA, float fB, int n, int k8, int k9, +extern void spawn_explosion(void *m, void *unused, void *pos, float fA, float fB, int n, int k8, int k9, float fC, float fD, float fE, float fF, int k10, float fG, int k11, - int s16, int s18, unsigned char flag); + int s16, int s18, unsigned char flag) __asm__("FUN_L00_0025e450"); extern void *spawn_debris_chunk(void *pos, void *vel, int color, float a, int life, float size, float b, float c, int d) __asm__("FUN_L01_002f8530"); extern void *mine_debris(void *pos, void *vel, int color, int color2, float size, int life, int tint) @@ -768,7 +768,7 @@ void FUN_L15_002aa280(struct Moby *moby) spawn_debris_chunk(&offset, &velocity, *color, radius, life, size, 0.15f, 2.0f, 1); } clear_vector_2aa280(&velocity); - FUN_L00_0025e450(moby, &velocity, ¢er, 0.0f, 0.0f, 20, 3, 4, 10.0f, 5.0f, 100000.0f, 3.0f, 0, + spawn_explosion(moby, &velocity, ¢er, 0.0f, 0.0f, 20, 3, 4, 10.0f, 5.0f, 100000.0f, 3.0f, 0, 15.0f, 1, 1, -1, 0); for (puff = 0; puff < 20; puff++) { @@ -840,8 +840,8 @@ extern unsigned short *D_L15_001ABE40[]; extern float D_L15_0015F580[] __attribute__((section(".sdata"))); extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern void FUN_00251fd0(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); -extern float FUN_001f96b0(float) __asm__("FUN_L15_001f8648"); -extern int FUN_001f9770(void *); +extern float FUN_L15_001f8648(float); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern float FUN_001f9b48(void *, void *); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); @@ -855,12 +855,13 @@ extern float spring_turn(float *, float, float, float, float, float) __asm__("FU extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); extern void FUN_L00_001ff290(void *, void *, void *); -extern void FUN_L00_0025f090(float, float, void *, void *, long long); +extern void cart_burst(float, float, void *, void *, long long) __asm__("FUN_L00_0025f090"); extern void FUN_L01_002787a0(void *); extern void *FUN_L00_00263fd8(void *, int, void *, void *, int, int, float, void *, void *, void *); extern void FUN_0025c2f0(float, void *, void *, int, int, int, int) __asm__("FUN_L00_0026cbb0"); -void FUN_L15_002c2938(struct Moby *moby) +void construction_arm_update(struct Moby *moby) __asm__("FUN_L15_002c2938"); +void construction_arm_update(struct Moby *moby) { UpdateVars_2938 *d = (UpdateVars_2938 *)moby->pvars; int hit = 0; @@ -886,13 +887,13 @@ void FUN_L15_002c2938(struct Moby *moby) switch (moby->state) { case 0: d->timer = truncate_float_to_s32(random_float_between( - FUN_001f96b0(D_L15_00161A00 * 60.0f), FUN_001f96b0(D_L15_00161A04 * 60.0f))); + FUN_L15_001f8648(D_L15_00161A00 * 60.0f), FUN_L15_001f8648(D_L15_00161A04 * 60.0f))); *(int *)&d->yaw_velocity = d->side = *(int *)&d->yaw = 0; moby->update_dist = 0xff; moby->state = 1; break; case 1: - if (FUN_001f9770(&d->timer) && FUN_001f9b48(D_L15_001673C0, &moby->pos) < 42.0f) { + if (fast_dec_timer_s16(&d->timer) && FUN_001f9b48(D_L15_001673C0, &moby->pos) < 42.0f) { ready = 1; if (moby->group != 0xff) { slot = (char *)D_L15_001ABE40[moby->group]; @@ -957,7 +958,7 @@ void FUN_L15_002c2938(struct Moby *moby) duration = FUN_L00_00257b90(first, duration); FUN_0025c2f0(40000.0f, &origin, &velocity, D_L15_001619EC, D_L15_001619EC, duration, 1); } - if (FUN_001f9770(&d->timer)) { + if (fast_dec_timer_s16(&d->timer)) { animation = d->side; animation *= 2; blend_moby_animation(moby, animation + 3, 0, scale_game_frames(6)); @@ -966,8 +967,8 @@ void FUN_L15_002c2938(struct Moby *moby) break; case 5: if (moby->prev_seq == d->side * 2 + 3 && (moby->anim_flags & 2)) { - minimum = FUN_001f96b0(D_L15_00161A00 * 60.0f); - maximum = FUN_001f96b0(D_L15_00161A04 * 60.0f); + minimum = FUN_L15_001f8648(D_L15_00161A00 * 60.0f); + maximum = FUN_L15_001f8648(D_L15_00161A04 * 60.0f); d->timer = truncate_float_to_s32(random_float_between(minimum, maximum)); duration = scale_game_frames(6); blend_moby_animation(moby, 0, 0, duration); @@ -976,7 +977,7 @@ void FUN_L15_002c2938(struct Moby *moby) break; case 6: allocate_voice_for_target_entry(0, 0, (int)moby); - FUN_L00_0025f090(1.5f, 13.0f, moby, &moby->pos, -1); + cart_burst(1.5f, 13.0f, moby, &moby->pos, -1); FUN_L01_002787a0(moby); FUN_L00_00263fd8(moby, 0x74b, &moby->pos, &moby->rot, 0, 0, 0.0f, D_L15_0015F580, D_L15_0015F580, D_L15_0015F580); @@ -1007,7 +1008,7 @@ extern void FUN_001f9bf8_4f88(float, void *, void *) __asm__("FUN_001f9bf8"); extern void FUN_001f9a68_4f88(float, void *, void *) __asm__("FUN_001f9a68"); extern void FUN_L00_001ff290(void *, void *, void *); extern void FUN_L15_00247e90(float, float, struct Moby *, void *, int); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_sin(float) __asm__("FUN_001f9de0"); @@ -1080,12 +1081,12 @@ void FUN_L15_002c4f88(struct Moby *moby, SteeringVec_4f88 *goal, SteeringVec_4f8 dx = *(volatile float *)&look_at->f[0]; dy = dy - pos_y; dx = dx - pos_x; - facing = FUN_001f9e90(dx, dy); + facing = fast_arc_tan(dx, dy); moby->rot.z = spring_turn(&vars->facing_velocity, moby->rot.z, facing, 0.01f, 0.3f, 0.1f); subtract_vector_xyz(&delta, &moby->pos, &origin); vars->delta.q = delta.q; - angle = FUN_001f9e90(vars->delta.f[0], vars->delta.f[1]); + angle = fast_arc_tan(vars->delta.f[0], vars->delta.f[1]); angle = fast_subtract_rotations(angle, moby->rot.z); c = fast_cos(angle); yaw_target = (vars->speed * 0.34906584f * c) / (frame_time * 10.0f); @@ -1215,12 +1216,12 @@ extern int FUN_L01_0026e008(int, int); extern int FUN_L00_00259740(void *, void *, int); extern void FUN_L00_0025a120(void *); extern void FUN_L00_0025df68(void *, void *, void *, int *, float *, int, float, float, float); -extern float FUN_001fa6c0(int); +extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); extern float vector_length_xyz_7880(void *) __asm__("FUN_001f9af0"); extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void set_vector_length_xy(void *, void *, float) __asm__("FUN_001f9c48"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern void attach_manipulator(void *, int, void *) __asm__("FUN_0020cb10"); extern void detach_manipulator(void *, void *) __asm__("FUN_0020cb88"); extern void advance_moby_animation(void *) __asm__("FUN_0020d580"); @@ -1232,7 +1233,8 @@ extern void FUN_L15_002c52b8_goal(void *, void *, void *) __asm__("FUN_L15_002c5 extern float absolute_float(float) __asm__("FUN_001f99c0"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9d20"); -void FUN_L15_002c5630(struct Moby *moby) +void helicopter_update(struct Moby *moby) __asm__("FUN_L15_002c5630"); +void helicopter_update(struct Moby *moby) { SteeringVec_4f88 origin; TargetGoal_5630 goal; @@ -1400,7 +1402,7 @@ activate: { SteeringPath_5630 *path; path = D_L15_001B0AB0_5630[*(int *)(vars + 0x1ac)]; FUN_L00_0025df68(path, &moby->pos, &point, &index, &fraction, 0, 999.0f, 5.0f, 0.0f); - position = FUN_001fa6c0(index) * path->pt[0].f[3] + fraction + 2.0f; + position = convert_integer_to_float(index) * path->pt[0].f[3] + fraction + 2.0f; distance = FUN_001f9b48(&moby->pos, (SteeringVec_4f88 *)path + path->n); speed = *(float *)(vars + 0x170); step = 10.0f; @@ -1413,7 +1415,7 @@ activate: { if (frame_time * 10.0f < speed + step) *(float *)(vars + 0x170) = frame_time * 10.0f; } index = truncate_float_to_s32(position / path->pt[0].f[3]); - fraction = (position - FUN_001fa6c0(index) * path->pt[0].f[3]) / path->pt[0].f[3]; + fraction = (position - convert_integer_to_float(index) * path->pt[0].f[3]) / path->pt[0].f[3]; if (index >= path->n - 1) { index = path->n - 2; fraction = 1.0f; } subtract_vector_xyz(&point, &path->pt[index + 1], &path->pt[index]); FUN_001f9a68_4f88(fraction, &point, &point); @@ -1431,7 +1433,7 @@ activate: { position = goal.pos.f[0] - moby->pos.x; fraction = goal.pos.f[1] - moby->pos.y; } - facing = FUN_001f9e90(position, fraction); + facing = fast_arc_tan(position, fraction); moby->rot.z = spring_turn((float *)(vars + 0x17c), moby->rot.z, facing, 0.01f, 0.3f, 0.1f); subtract_vector_xyz(&delta, &point, &moby->pos); distance = vector_length_xyz_7880(&delta); @@ -1484,7 +1486,7 @@ activate: { FUN_L15_002c52b8_goal(moby, &delta, &goal); first.q = *(u128 *)&target->pos; FUN_L15_002c4f88(moby, &delta, &first); - if (FUN_001f9770(vars + 0x168) && *(int *)(vars + 0x164) == 0) { + if (fast_dec_timer_s16(vars + 0x168) && *(int *)(vars + 0x164) == 0) { *(short *)(vars + 0x168) = scale_game_frames(60); second.q = goal.pos.q; subtract_vector_xyz(&first, &second, &point); @@ -1502,7 +1504,7 @@ activate: { } break; case 6: - if (FUN_001f9770(vars + 0x16a)) { moby->state = moby->command; break; } + if (fast_dec_timer_s16(vars + 0x16a)) { moby->state = moby->command; break; } speed = *(float *)(vars + 0x170) - frame_time_sq * 4.0f; *(float *)(vars + 0x170) = speed; if (speed < 0.0f) *(float *)(vars + 0x170) = 0.0f; @@ -1513,7 +1515,7 @@ activate: { max_turn = 1.0471976f; apply_delta: add_vector_xyz(&moby->pos, &moby->pos, &delta); - angle = FUN_001f9e90(delta.f[0], delta.f[1]); + angle = fast_arc_tan(delta.f[0], delta.f[1]); angle = fast_subtract_rotations(angle, moby->rot.z); c = fast_cos(angle); yaw_target = (*(float *)(vars + 0x170) * 0.34906584f * c) / (frame_time * 10.0f); @@ -1580,7 +1582,7 @@ activate: { } } moby->pos.z -= D_L15_00161A0C * fast_cos(*(float *)(vars + 0x16c)); - *(float *)(vars + 0x16c) = fast_add_rotations(*(float *)(vars + 0x16c), 6.2831855f / FUN_001f96b0(D_L15_00161A08 * 60.0f)); + *(float *)(vars + 0x16c) = fast_add_rotations(*(float *)(vars + 0x16c), 6.2831855f / FUN_L15_001f8648(D_L15_00161A08 * 60.0f)); moby->pos.z += D_L15_00161A0C * fast_cos(*(float *)(vars + 0x16c)); if (*(struct Moby **)(vars + 0x160) != 0) { *(u128 *)&(*(struct Moby **)(vars + 0x160))->pos = *(u128 *)&moby->pos; @@ -1598,9 +1600,9 @@ activate: { local.q = difference.q; transpose_rotation_matrix(&delta, &moby->rot_row0); transform_vector_by_basis(&local, &local, &delta); - facing = FUN_001f9e90(local.f[0], local.f[1]); + facing = fast_arc_tan(local.f[0], local.f[1]); *(float *)(vars + 0x180) = spring_turn((float *)(vars + 0x184), *(float *)(vars + 0x180), facing, frame_time_sq * 6.2831855f, frame_time_sq * 12.566371f, frame_time * 6.2831855f); - facing = -FUN_001f9e90(vector_length_xy(&local), local.f[2]); + facing = -fast_arc_tan(vector_length_xy(&local), local.f[2]); *(float *)(vars + 0x188) = spring_turn((float *)(vars + 0x18c), *(float *)(vars + 0x188), facing, frame_time_sq * 3.1415927f, frame_time_sq * 6.2831855f, frame_time * 1.5707964f); FUN_L00_001fff28(*(float *)(vars + 0x180), vars + 0xe0, 2); FUN_L00_001fff28(*(float *)(vars + 0x188), vars + 0x120, 2); @@ -1611,9 +1613,9 @@ activate: { local.q = difference.q; transpose_rotation_matrix(&delta, &moby->rot_row0); transform_vector_by_basis(&local, &local, &delta); - facing = FUN_001f9e90(local.f[0], local.f[1]); + facing = fast_arc_tan(local.f[0], local.f[1]); *(float *)(vars + 0x180) = spring_turn((float *)(vars + 0x184), *(float *)(vars + 0x180), facing, frame_time_sq * 6.2831855f, frame_time_sq * 12.566371f, frame_time * 6.2831855f); - facing = -FUN_001f9e90(vector_length_xy(&local), local.f[2]); + facing = -fast_arc_tan(vector_length_xy(&local), local.f[2]); *(float *)(vars + 0x188) = spring_turn((float *)(vars + 0x18c), *(float *)(vars + 0x188), facing, frame_time_sq * 3.1415927f, frame_time_sq * 6.2831855f, frame_time * 1.5707964f); FUN_L00_001fff28(*(float *)(vars + 0x180), vars + 0xe0, 2); FUN_L00_001fff28(*(float *)(vars + 0x188), vars + 0x120, 2); @@ -1627,13 +1629,13 @@ activate: { extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern f32 fast_subtract_rotations(f32, f32) __asm__("func_001FA5C8"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_cos(float) __asm__("func_001F9DC8"); extern float fast_sin(float) __asm__("func_001F9DE0"); extern int hit_reaction(void *, void *, void *, int, void *, void *, int, int) __asm__("FUN_L00_0025a478"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); float absolute_float(float input) __asm__("func_001F99C0"); void FUN_L15_002c6900(struct Moby *m) { @@ -1654,9 +1656,9 @@ void FUN_L15_002c6900(struct Moby *m) { m->state = 7; } else if (res != 0xB) { *(unsigned char *)(d + 0x67) = 0xB4; - FUN_L00_0025d458(m, (short *)(d + 0x60)); + trooper_anim_update(m, (short *)(d + 0x60)); if (*(float *)(r + 0x1C) == 5627.925f && m->state != 6) { - a = FUN_001f9e90(m->pos.x - *(float *)(r + 0), + a = fast_arc_tan(m->pos.x - *(float *)(r + 0), m->pos.y - *(float *)(r + 4)); b = fast_subtract_rotations(a, m->rot.z); p = fast_cos(b) * 0.08726646f; @@ -1677,7 +1679,7 @@ void FUN_L15_002c6900(struct Moby *m) { } } m->hit_slot = 0xFF; - FUN_L00_0025d538(m, d + 0x60); + trooper_anim_finish(m, d + 0x60); } #include "qcopy.h" @@ -1686,7 +1688,7 @@ void FUN_L15_002c6900(struct Moby *m) { /* Ported from rac1-decomp (src/overlays/l15_quartu/vendor_0029C1D0.c: func_L15_002D0500), where it is exact; names translated to the US level program. */ extern char *D_L15_0015FFE4; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void add_vector_xyz(void *, void *, void *); extern void clear_vector(void *); extern void normalize_vector_xyz(void *, void *, float); @@ -1706,20 +1708,20 @@ float FUN_L15_002cf110(void *m_, void *out, float r) { float k; char *o; func_L00_00260D30_t(m, tgt, r); - dist = FUN_001f9b80(m + 0x10, tgt); + dist = vector_distance(m + 0x10, tgt); clear_u64_value(out); for (o = D_L15_0015FFE4; o != 0; o = *(char **)(o + 0x28)) { if (o == m) continue; if (*(short *)(o + 0xA6) != *(short *)(m + 0xA6)) continue; - if (FUN_001f9b80(o + 0x10, m + 0x10) < 3.0f) { + if (vector_distance(o + 0x10, m + 0x10) < 3.0f) { wsum += 6.0f; subtract_vector_xyz(tmp, m + 0x10, o + 0x10); scale_vector_xyz(tmp, tmp, 6.0f); add_vector_xyz(out, out, tmp); } - if (FUN_001f9b80(o + 0x10, tgt) < dist) + if (vector_distance(o + 0x10, tgt) < dist) clear = 0; } if (clear == 0) { @@ -1739,11 +1741,11 @@ float FUN_L15_002cf110(void *m_, void *out, float r) { } else { qcopy(out, tgt); } - if (FUN_001f9b80(m + 0x10, out) < 1.0f) { + if (vector_distance(m + 0x10, out) < 1.0f) { qcopy(out, m + 0x10); - return FUN_001f9e90(tgt[0] - *(float *)(m + 0x10), tgt[1] - *(float *)(m + 0x14)); + return fast_arc_tan(tgt[0] - *(float *)(m + 0x10), tgt[1] - *(float *)(m + 0x14)); } - return FUN_001f9e90(((float *)out)[0] - *(float *)(m + 0x10), + return fast_arc_tan(((float *)out)[0] - *(float *)(m + 0x10), ((float *)out)[1] - *(float *)(m + 0x14)); } @@ -1861,13 +1863,13 @@ extern ULevelState D_L15_001BABD0; extern ULevelState D_L15_001BB830; extern UPath *D_L15_001B0AB0[]; extern float convert_integer_to_float(int) __asm__("func_001FA6C0"); -extern float FUN_001f96b0(float); +extern float FUN_L04_001f1978(float); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9e90(float, float); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float spring_turn(float *vel, float cur, float target, float k, float d, float max) __asm__("FUN_L00_00258110"); extern float FUN_L00_0025abf0(void *a, void *b, void *out, float speed, float g); -extern float FUN_L00_0025be00(void *, float, void *, float, float, float); +extern float approach_angle(void *, float, void *, float, float, float) __asm__("FUN_L00_0025be00"); extern float FUN_L15_002cf110_u(void *, void *, float) __asm__("FUN_L15_002cf110"); extern float compute_interpolated_record_value(void *) __asm__("FUN_0020c9e0"); extern float fast_cos(float); @@ -1881,8 +1883,8 @@ extern int FUN_L00_00257b90(int, int); extern int FUN_L00_00258490(void *, void *, void *, int, float, float, float, float); extern int point_in_path_xy(void *, void *, int) __asm__("FUN_L00_00259740"); extern int sweep_hit_segment(void *a, void *b, void *c, void *d, void *e, void *f, int n) __asm__("FUN_L00_00259d08"); -extern int FUN_L00_0025c698(void *, void *); -extern int FUN_L00_0028d8c0(void *, int); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L01_0026e008(int, int); extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); extern int is_value_within_interpolated_window(char *, float) __asm__("FUN_00214cc8"); @@ -1908,7 +1910,7 @@ extern void FUN_L00_001ff290(void *, void *, void *); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); extern void FUN_L00_00258278(char *moby, float *vel, float target, float k, float d, float max); extern void make_hit_descriptor(void *, void *, int, void *, float) __asm__("FUN_L00_00259888"); -extern void FUN_L00_002598b0(int, float, void *, int, float, float, int, int, int); +extern void play_entity_sound(int, float, void *, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); extern void FUN_L00_0025df68(void *, void *, void *, int *, float *, int, float, float, float); extern void FUN_L00_00263ac8(float, int, int, unsigned char *); extern void FUN_L00_00263e30(void *, int, int, int, int, int, int); @@ -1928,7 +1930,8 @@ extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); extern char *func_L10_002CD578_v(void *vel, float scale, void *pos, int a, int b, int c) __asm__("FUN_L10_002cc1b8"); -void FUN_L15_002cf3a8(UMoby *m) { +void ultramech_unlimited_update(UMoby *m) __asm__("FUN_L15_002cf3a8"); +void ultramech_unlimited_update(UMoby *m) { UVec v10; UVec v20; UVec v30; @@ -2050,14 +2053,14 @@ void FUN_L15_002cf3a8(UMoby *m) { break; } dist = FUN_001f9b48(&m->pos, (UVec *)path + path->n); - if (dist < speed / FUN_001f96b0(26.0f) && m->anim != 5) { + if (dist < speed / FUN_L04_001f1978(26.0f) && m->anim != 5) { blend_moby_animation(m, 5, 0, scale_game_frames(6)); } subtract_vector_xyz(&v20, (UVec *)path + (seg + 2), (UVec *)path + (seg + 1)); scale_vector_xyz(&v20, &v20, frac); add_vector_xyz(&v20, &v20, (UVec *)path + (seg + 1)); if (seg + 1 < path->n - 8) { - float ang = FUN_001f9e90(path->pt[seg + 1].f[0] - m->pos.f[0], + float ang = fast_arc_tan(path->pt[seg + 1].f[0] - m->pos.f[0], path->pt[seg + 1].f[1] - m->pos.f[1]); m->rot.f[2] = spring_turn(&d->turnVel, m->rot.f[2], ang, 0.01f, 0.3f, 0.1f); } @@ -2080,9 +2083,9 @@ void FUN_L15_002cf3a8(UMoby *m) { qcopy(&v10, &m->pos); v10.f[2] += 1.0f; z = probe_ground_height(&v10, 0, 0.5f); - if (m->pos.f[2] - z < d->vel.f[2] * FUN_001f96b0(26.0f) + + if (m->pos.f[2] - z < d->vel.f[2] * FUN_L04_001f1978(26.0f) + *(float *)&D_L15_00161B18 * frame_time_sq * 0.5f * - FUN_001f96b0(26.0f) * FUN_001f96b0(26.0f) && + FUN_L04_001f1978(26.0f) * FUN_L04_001f1978(26.0f) && m->anim != 5) { blend_moby_animation(m, 5, 0, scale_game_frames(6)); } @@ -2098,17 +2101,17 @@ void FUN_L15_002cf3a8(UMoby *m) { if (m->anim != 0 && (m->animFlags & 2)) blend_moby_animation(m, 0, 0, scale_game_frames(0x14)); if (d->w164 != 2) { - FUN_L00_0025be00(&m->rot.f[2], - FUN_001f9e90(tgt->pos.f[0] - m->pos.f[0], tgt->pos.f[1] - m->pos.f[1]), + approach_angle(&m->rot.f[2], + fast_arc_tan(tgt->pos.f[0] - m->pos.f[0], tgt->pos.f[1] - m->pos.f[1]), &d->turnVel, frame_time_sq * 8.726646f, frame_time_sq * 8.726646f, frame_time * 12.566371f); if (tick_countdown_32(&d->timer)) { - if (d->w1D8 == 0 && FUN_001f9b80(&m->pos, &tgt->pos) < *(float *)&D_L15_00161B24) { + if (d->w1D8 == 0 && vector_distance(&m->pos, &tgt->pos) < *(float *)&D_L15_00161B24) { m->state = 7; if (m->anim != 1) blend_moby_animation(m, 1, 0, scale_game_frames(0xA)); } else if (d->w1D8 == 0 && - FUN_001f9b80(&m->pos, &tgt->pos) < *(float *)&D_L15_00161B28) { + vector_distance(&m->pos, &tgt->pos) < *(float *)&D_L15_00161B28) { m->state = 8; if (m->anim != 2) blend_moby_animation(m, 2, 0, scale_game_frames(0xA)); @@ -2128,8 +2131,8 @@ void FUN_L15_002cf3a8(UMoby *m) { } if (d->w164 != 2) { int fire = -1; - FUN_L00_0025be00(&m->rot.f[2], - FUN_001f9e90(tgt->pos.f[0] - m->pos.f[0], tgt->pos.f[1] - m->pos.f[1]), + approach_angle(&m->rot.f[2], + fast_arc_tan(tgt->pos.f[0] - m->pos.f[0], tgt->pos.f[1] - m->pos.f[1]), &d->turnVel, frame_time_sq * 8.726646f, frame_time_sq * 8.726646f, frame_time * 12.566371f); if (m->anim == 7) { @@ -2155,18 +2158,18 @@ void FUN_L15_002cf3a8(UMoby *m) { m->state = 6; if (m->anim != 0) blend_moby_animation(m, 0, 0, scale_game_frames(0xA)); - d->timer = func_001FA898_r(FUN_001f96b0(d->f188 * 60.0f)); + d->timer = func_001FA898_r(FUN_L04_001f1978(d->f188 * 60.0f)); } else if (d->w1D8 == 0 && - FUN_001f9b80(&m->pos, &tgt->pos) < *(float *)&D_L15_00161B24) { + vector_distance(&m->pos, &tgt->pos) < *(float *)&D_L15_00161B24) { m->state = 7; if (m->anim != 1) blend_moby_animation(m, 1, 0, scale_game_frames(0xA)); } else if (d->w1D8 == 0 && - FUN_001f9b80(&m->pos, &tgt->pos) < *(float *)&D_L15_00161B28) { + vector_distance(&m->pos, &tgt->pos) < *(float *)&D_L15_00161B28) { m->state = 8; if (m->anim != 2) blend_moby_animation(m, 2, 0, scale_game_frames(0xA)); - } else if (d->w1D8 == 0 && FUN_001f9b80(&m->pos, &tgt->pos) > 10.0f && d->w1C8 != 0 && + } else if (d->w1D8 == 0 && vector_distance(&m->pos, &tgt->pos) > 10.0f && d->w1C8 != 0 && d->w1D4 == 0) { m->state = 3; d->timer = 0; @@ -2194,11 +2197,11 @@ void FUN_L15_002cf3a8(UMoby *m) { break; case 6: if (d->w164 != 2) { - FUN_L00_0025be00(&m->rot.f[2], - FUN_001f9e90(tgt->pos.f[0] - m->pos.f[0], tgt->pos.f[1] - m->pos.f[1]), + approach_angle(&m->rot.f[2], + fast_arc_tan(tgt->pos.f[0] - m->pos.f[0], tgt->pos.f[1] - m->pos.f[1]), &d->turnVel, frame_time_sq * 8.726646f, frame_time_sq * 8.726646f, frame_time * 12.566371f); - if (d->w1D8 == 0 && FUN_001f9b80(&m->pos, &tgt->pos) < 8.0f && d->w1D4 == 0 && + if (d->w1D8 == 0 && vector_distance(&m->pos, &tgt->pos) < 8.0f && d->w1D4 == 0 && d->point < D_L15_001B0AB0[((UPaths *)((char *)d + 0x180))->idx[d->side]]->n - 1) { m->state = 3; d->timer = 0; @@ -2230,10 +2233,10 @@ void FUN_L15_002cf3a8(UMoby *m) { } break; case 7: { - float ang = FUN_001f9e90(tgt->pos.f[0] - m->pos.f[0], tgt->pos.f[1] - m->pos.f[1]); + float ang = fast_arc_tan(tgt->pos.f[0] - m->pos.f[0], tgt->pos.f[1] - m->pos.f[1]); if (d->w164 != 2) { ang = FUN_L15_002cf110_u(m, &v20, d->f1B8); - if (FUN_001f9b80(&m->pos, &tgt->pos) < *(float *)&D_L15_00161B28) { + if (vector_distance(&m->pos, &tgt->pos) < *(float *)&D_L15_00161B28) { m->state = 8; if (m->anim != 2) blend_moby_animation(m, 2, 0, scale_game_frames(0xA)); @@ -2262,11 +2265,11 @@ void FUN_L15_002cf3a8(UMoby *m) { break; } case 8: - FUN_L00_0025be00( - &m->rot.f[2], FUN_001f9e90(tgt->pos.f[0] - m->pos.f[0], tgt->pos.f[1] - m->pos.f[1]), + approach_angle( + &m->rot.f[2], fast_arc_tan(tgt->pos.f[0] - m->pos.f[0], tgt->pos.f[1] - m->pos.f[1]), &d->turnVel, frame_time_sq * 8.726646f, frame_time_sq * 8.726646f, frame_time * 12.566371f); if (m->animFlags & 2) { - if (FUN_001f9b80(&m->pos, &tgt->pos) < *(float *)&D_L15_00161B28 && d->w1D4 == 0 && + if (vector_distance(&m->pos, &tgt->pos) < *(float *)&D_L15_00161B28 && d->w1D4 == 0 && d->point < D_L15_001B0AB0[((UPaths *)((char *)d + 0x180))->idx[d->side]]->n - 1) { m->state = 3; d->timer = 0; @@ -2285,7 +2288,7 @@ void FUN_L15_002cf3a8(UMoby *m) { (d->point + 1), 0, *(float *)&D_L15_00161B14 * frame_time, -(*(float *)&D_L15_00161B18 * frame_time_sq)); - } else if (*(float *)&D_L15_00161B28 < FUN_001f9b80(&m->pos, &tgt->pos)) { + } else if (*(float *)&D_L15_00161B28 < vector_distance(&m->pos, &tgt->pos)) { m->state = 4; if (m->anim != 0) blend_moby_animation(m, 0, 0, scale_game_frames(0x14)); @@ -2311,7 +2314,7 @@ void FUN_L15_002cf3a8(UMoby *m) { case 9: { int r = 0; if (d->w1D8 == 0) { - r = FUN_L00_0025c698(m, d->hit); + r = mine_fall(m, d->hit); } else { m->animSpeed = 1.0f; } @@ -2368,7 +2371,7 @@ void FUN_L15_002cf3a8(UMoby *m) { break; } if (moving) { - if (FUN_L00_0028d8c0(m, d->snd)) + if (voice_is_playing(m, d->snd)) goto spawn; d->snd = allocate_voice_for_target_entry(7, 4, (int)m); } else { @@ -2415,7 +2418,7 @@ void FUN_L15_002cf3a8(UMoby *m) { m->pos.f[2] = z; d->fE8 = 0.0f; } - FUN_L00_002598b0((int)m, 2.5f, &m->pos, 0x10000, 40.0f, 1.0f, 0, 1, 0); + play_entity_sound((int)m, 2.5f, &m->pos, 0x10000, 40.0f, 1.0f, 0, 1, 0); } } extern float D_L15_00161B00 __attribute__((sda)); @@ -2432,7 +2435,7 @@ extern void FUN_0023ee30(void *, int, void *) __asm__("FUN_L00_0024f7c8"); extern void FUN_0024dcf8(void *, void *, void *, float, float, int, int, int, float, float, float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern int FUN_0027bb68(int, int, void *, int) __asm__("FUN_L00_0028dc90"); extern void FUN_00246ad8(void *, int, long long) __asm__("FUN_L00_00257470"); -extern float FUN_001f9028(float, float) __asm__("FUN_001f9e90"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern void FUN_0024a430(void *, void *, void *, void *) __asm__("FUN_L00_0025ab48"); extern void FUN_0024be00(float, void *, void *, int, int, int) __asm__("FUN_L00_0025c558"); extern void FUN_00251c90(void *, float, float) __asm__("FUN_L03_00250a78"); @@ -2522,7 +2525,7 @@ void FUN_L15_002d0fa8(void *arg) { FUN_00251c90((char *)d + 0x70, 4.0f, 1.0f); *(float *)((char *)d + 0xC0) = 12.0f; *(float *)((char *)d + 0xC4) = 16.0f; - angle = FUN_001f9028(m->pos.f[0] - *(float *)(*(char **)(slot + 0x20) + 0x10), + angle = fast_arc_tan(m->pos.f[0] - *(float *)(*(char **)(slot + 0x20) + 0x10), m->pos.f[1] - *(float *)(*(char **)(slot + 0x20) + 0x14)); origin.q = *(u128 *)(slot + 0x10); direction = angle; diff --git a/src/overlays/l15/gameplay/hero/002044c8.c b/src/overlays/l15/gameplay/hero/002044c8.c index a60d3254fe..41997fd633 100644 --- a/src/overlays/l15/gameplay/hero/002044c8.c +++ b/src/overlays/l15/gameplay/hero/002044c8.c @@ -10,7 +10,7 @@ /* Same source as the exact FUN_L16_002097a0, with a state 3 flag (0x12E6) and its own landing checks. */ extern int D_0015ED84_d __asm__("D_0015ED84"); -extern int FUN_001f0b58(void); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern void fast_mem_zero16(void *, int) __asm__("FUN_001f9810"); extern void FUN_L00_0020b930(void); @@ -68,7 +68,7 @@ void FUN_L15_002044c8(void) { struct Hero *q = &hero; if (q->state.current != 0x7B) { if (coll_sphere(q->unk234 + 0.03f, &q->motion.unkD0, 2, 0)) { - if (FUN_001f0b58() == 0xB) { + if (collision_hit_material() == 0xB) { hero_set_state(0x7B, 1); return; } @@ -455,7 +455,7 @@ extern void FUN_L00_00217118(f32, f32); extern void stick_target(f32, s32) __asm__("FUN_L00_002118c8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void turn_to(s32, f32, f32, f32) __asm__("FUN_L00_00211e30"); -extern s32 FUN_001f9740(void *); +extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 FUN_L00_00229a98(void); extern void FUN_L00_00211e98(void); @@ -495,10 +495,10 @@ extern u8 D_L15_0017C5C0[]; extern void FUN_L00_00216e48(s32, struct MobyView *, s32); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); -extern s32 FUN_001f9770(s16 *); +extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); extern void FUN_L00_00209a40(s32, s32); extern void FUN_L00_00209ca8(s32, s32, s32); -extern void FUN_L00_002a3ec8(s32, s32, s32, f32, f32, f32, f32); +extern void pool_splash(s32, s32, s32, f32, f32, f32, f32) __asm__("FUN_L00_002a3ec8"); extern f32 FUN_L00_0025bc98(f32 *, f32, f32 *, s32, f32, f32, f32); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); @@ -512,7 +512,7 @@ extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 FUN_L00_00209018(void *, s32); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern void FUN_L00_0020a1e0(f32, f32); @@ -536,21 +536,21 @@ extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern s32 FUN_L00_002595a0(f32 *, f32 *, f32, f32, f32); extern void FUN_L00_0025bc00(f32 *, s32, f32, f32); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern f32 square_root(f32) __asm__("FUN_001f9988"); -extern f32 FUN_L00_00233a78(void *); -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); -extern f32 FUN_L00_00213350(void *); +extern f32 gravity_z(void *) __asm__("FUN_L00_00233a78"); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); +extern f32 forward_component(void *) __asm__("FUN_L00_00213350"); extern struct HeroTableRow2C D_L15_0017C228[]; extern struct LevelTable_QS D_L15_00167280; #define Q D_L15_00167280 extern void FUN_L00_00233ba0(void *, void *, f32); -extern void FUN_L00_00233b20(void *, void *, f32); +extern void gravity_set_z(void *, void *, f32) __asm__("FUN_L00_00233b20"); extern void FUN_L00_002336e8(void *, void *, f32); extern void make_hit_descriptor(void *, struct MobyView *, s32, f32, void *) __asm__("FUN_L00_00259888"); extern s32 collect_mobies_in_sphere(f32, void *, s32, struct MobyView *, void *) __asm__("FUN_L00_001f2868"); @@ -561,8 +561,8 @@ extern void FUN_L00_001ff290(void *, void *, void *); extern void FUN_L00_002a9b80(struct MobyView *, void *); extern s32 FUN_L00_002a96f8(struct MobyView *, void *, f32, f32, s32, f32, f32, f32); extern void FUN_L00_002335c8(void *, f32, f32, f32); -extern s32 FUN_L00_002598b0(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32); -extern f32 FUN_001f9ab0(void *, void *); +extern s32 play_entity_sound(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32) __asm__("FUN_L00_002598b0"); +extern f32 fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); struct PlayerSpeedTuning { u8 pad0[8]; f32 x08; @@ -574,14 +574,14 @@ extern struct PlayerSpeedTuning D_L15_0017C3B8; extern s32 FUN_L00_00216de8(s32, s32); extern void FUN_L00_00233708(void *, void *, f32); extern void FUN_L00_00233810(void *, void *, f32); -extern s32 FUN_001efa68(void *, void *, s32, struct MobyView *, s32); +extern s32 collision_line(void *, void *, s32, struct MobyView *, s32) __asm__("FUN_001efa68"); extern void FUN_L00_00215340(void); extern void FUN_L00_00233660(void *, f32, f32, f32); extern s32 FUN_L00_0025e3b8(s32); -extern void FUN_L00_00259bc8(s32, struct MobyView *, s32, void *, void *, f32); +extern void spawn_nearby_effect(s32, struct MobyView *, s32, void *, void *, f32) __asm__("FUN_L00_00259bc8"); extern s32 D_L15_00178500[]; extern void FUN_L00_00209ec8(void); -extern void FUN_L00_002338d0(void *, void *); +extern void gravity_flatten(void *, void *) __asm__("FUN_L00_002338d0"); extern s32 hero_slot_item_id(s32) __asm__("FUN_L00_0020d498"); extern void FUN_L00_0020b5b8(void); extern void FUN_L01_0022d090(void); @@ -594,7 +594,7 @@ extern void FUN_L00_0020d2f8(void *); extern f32 randf_sym(f32, f32) __asm__("FUN_L00_00257c48"); extern void FUN_L00_0026d598(void *, void *, s32); extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); -extern s32 FUN_L00_0025d808(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); +extern s32 sample_path(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); extern s32 FUN_L00_0025d7a0(void *, s32, s32, s32); extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); extern void hero_integrate_velocity(void) __asm__("FUN_L00_00214108"); @@ -653,7 +653,7 @@ void FUN_L15_0020ed50(void) { transform_vector_by_basis(&hero.motion.unk170, &v0, &D_L15_001673D8[0x1F8]); hero.motion.move_yaw = *(f32 *)D_L15_001673D8; turn_to(0, frame_scale_sq, frame_scale_sq * 0.0f, frame_time * 174.53293f); - if (D_L15_0015F688 > 0 && FUN_001f9740(&D_L15_0015F688) != 0) { + if (D_L15_0015F688 > 0 && fast_dec_timer(&D_L15_0015F688) != 0) { s32 t; if (usage_stats.stat[18].count < 0xFFFF) { usage_stats.stat[18].count++; @@ -770,7 +770,7 @@ void FUN_L15_0020ed50(void) { } if (hero.unk90A != 0) { s32 n; - FUN_001f9770(&hero.unk90A); + fast_dec_timer_s16(&hero.unk90A); n = (s16)hero.unk90A >> 2; FUN_L00_00209a40(n > 8 ? 8 : n, 0); } @@ -784,7 +784,7 @@ void FUN_L15_0020ed50(void) { if (hero.state_timer == 1) { FUN_L00_00209ca8(3, 0x10, 0); if (D_L15_001612D0 != 0) { - FUN_L00_002a3ec8(D_L15_001612D0, D_L15_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L15_001612D0, D_L15_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, -0.3f); } hero.unk90A = scale_game_frames(70); @@ -895,7 +895,7 @@ void FUN_L15_0020ed50(void) { stick_target(1.0f, 0); turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); hero.unk8EC = hero.motion.unk184; - FUN_001f9740(&hero.unk8F4); + fast_dec_timer(&hero.unk8F4); if (hero.state.step == 1) { hero.target_speed = frame_time * 6.0f; } else if (hero.state.current == 0x35) { @@ -925,7 +925,7 @@ void FUN_L15_0020ed50(void) { if (hero.state.current != 0x35 || !(PD.u1A0.i1A0 & 0xA)) { hero.target_speed *= k; }; - if (FUN_001f9740(&hero.unk8F0) != 0) { + if (fast_dec_timer(&hero.unk8F0) != 0) { s32 lo2; s32 hi2; pl = &hero; @@ -948,7 +948,7 @@ void FUN_L15_0020ed50(void) { } pl->unk8F0 = random_int_between(lo2, scale_game_frames(hi2)); } - if (hero.state.current == 0x35 && FUN_001f9770(&hero.unk8F8) != 0) { + if (hero.state.current == 0x35 && fast_dec_timer_s16(&hero.unk8F8) != 0) { struct MobyView *gm = (struct MobyView *)hero.items[3].moby; if (gm != NULL && gm->hA6 == 0x261) { s32 i; @@ -986,7 +986,7 @@ void FUN_L15_0020ed50(void) { } build_spherical_offset(&hero.motion.velocity, sp, hero.motion.rot.f[2], yaw); } else if (hero.state.current == 0x34) { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); if (hero.state.prev == 0x35) { approach_value(&len, 0.0f, frame_time_sq * 8.0f); } else { @@ -1034,11 +1034,11 @@ void FUN_L15_0020ed50(void) { break; case 0x6A: case 0x82: { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); approach_value(&len, 0.0f, frame_time_sq * 4.0f); fast_vec_normalize(&hero.motion.unk150, &hero.motion.unk150, len); qcopy(&hero.motion.velocity, &hero.motion.unk150); - if (FUN_001f9740(&hero.unk8F0) == 2) { + if (fast_dec_timer(&hero.unk8F0) == 2) { moby_point_position((struct MobyView *)hero.moby, 4, &v0); v20.q = 0; v20.f[0] = 0.4f; @@ -1085,7 +1085,7 @@ void FUN_L15_0020ed50(void) { } } turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); - FUN_001f9740(&hero.unk698); + fast_dec_timer(&hero.unk698); if (hero.state.current == 0x36) { if (PD.i1D4 != 0 && hero.unk698 != 0) { hero.target_speed = frame_time * 3.0f; @@ -1189,7 +1189,7 @@ void FUN_L15_0020ed50(void) { FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, 0.0f, frame_time * 3.8397243f); } else { f32 an = fast_add_rotations( - -fast_arc_tan(FUN_001f9b80(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); + -fast_arc_tan(vector_distance(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, an, frame_time * 6.4577184f); } v20.f[0] = fast_cos(fast_add_rotations(hero.motion.rot.f[2], -1.5707964f)) * -0.57f; @@ -1273,14 +1273,14 @@ void FUN_L15_0020ed50(void) { } if (hero.unk99C != 0) { f32 s; - if (FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { + if (vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.displacement, frame_time_sq * 40.0f); - if (hero.unk9BE != 0 && FUN_L00_00233a78(&hero.motion.velocity) > 0.0f) { + if (hero.unk9BE != 0 && gravity_z(&hero.motion.velocity) > 0.0f) { subtract_vector_xyz(&v30, &hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 57.0f); } } - s = FUN_001f9af0(&hero.motion.velocity) * (frame_time * 0.015f); + s = fast_vec_length(&hero.motion.velocity) * (frame_time * 0.015f); fast_vec_scale(&v30, &hero.motion.velocity, -1.0f); fast_vec_normalize(&v30, &v30, s); add_vector_xyz(&hero.motion.velocity, &hero.motion.velocity, &v30); @@ -1288,7 +1288,7 @@ void FUN_L15_0020ed50(void) { { struct MobyView *r; if ((struct MobyView *)hero.unk994 != NULL && (r = ((struct MobyView *)hero.unk994)->pm78) != NULL) { - f32 len = FUN_001f9af0(&hero.motion.velocity); + f32 len = fast_vec_length(&hero.motion.velocity); if (r->fC < len) { approach_value(&len, r->fC, frame_time_sq * 15.0f); fast_vec_normalize(&hero.motion.velocity, &hero.motion.velocity, len); @@ -1309,9 +1309,9 @@ void FUN_L15_0020ed50(void) { add_vector_xyz(&v30, &((struct MobyView *)hero.unk994)->u10.v10, &vC0); subtract_vector_xyz(&hero.motion.velocity, &v30, &vD0); old = hero.unk9A4; - FUN_L00_0025b8c0(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); + vendor_spring(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); d = hero.unk9A4 - old; - if (FUN_001f9af0(&vC0) > hero.unk9A4) { + if (fast_vec_length(&vC0) > hero.unk9A4) { fast_vec_normalize(&vC0, &vC0, d); add_vector_xyz(&hero.motion.pos, &hero.motion.pos, &vC0); } @@ -1320,7 +1320,7 @@ void FUN_L15_0020ed50(void) { f32 mx = frame_time * 14.0f; f32 sp = vector_length_xy(&hero.motion.velocity); if (sp < mx) { - FUN_L00_0025b8c0(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); + vendor_spring(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); v30.f[0] = fast_cos(hero.unk9AC) * hero.unk9B4; v30.f[1] = fast_sin(hero.unk9AC) * hero.unk9B4; v30.f[2] = 0.0f; @@ -1337,7 +1337,7 @@ void FUN_L15_0020ed50(void) { up = hero.unk9BC == 1; } else { v30.q = hero.motion.displacement.q; - up = FUN_L00_00213350(&v30) > 0.0f; + up = forward_component(&v30) > 0.0f; } if (up) { if (moby->b53 != 0x35) { @@ -1373,12 +1373,12 @@ void FUN_L15_0020ed50(void) { mx = frame_time_sq * 70.0f; t2 = scale_game_frames(33); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk4B0); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unk4B8 = 1.0f; } } @@ -1410,7 +1410,7 @@ void FUN_L15_0020ed50(void) { } hero.target_speed = 0.0f; if ((struct MobyView *)hero.unkA54 != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = frame_time * 4.5f; } @@ -1451,16 +1451,16 @@ void FUN_L15_0020ed50(void) { } FUN_L00_00211870(27.0f); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 130.0f); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unkA70 = 1.0f; } - if (FUN_L00_00233a78(&hero.motion.velocity) < frame_time * -37.0f) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); + if (gravity_z(&hero.motion.velocity) < frame_time * -37.0f) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); } } break; @@ -1530,7 +1530,7 @@ void FUN_L15_0020ed50(void) { tb = &D_L15_0017C228[hero.attack_record]; hero.target_speed = 0.0f; if ((struct MobyView *)hero.unkA54 != NULL && scale_game_frames(4) > hero.state_timer) { - f32 d = FUN_001f9b80(&((struct MobyView *)hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; + f32 d = vector_distance(&((struct MobyView *)hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; f32 off; f32 tol; f32 mx; @@ -1749,7 +1749,7 @@ void FUN_L15_0020ed50(void) { Vec4 *p = &hero.move_impulse; FUN_L00_002132b8(0.7f, 0.0f); v0.q = hero.move_impulse.q; - hero.target_speed += FUN_L00_00213350(&v0); + hero.target_speed += forward_component(&v0); if (hero.target_speed < frame_time * 0.7f) { hero.target_speed = frame_time * 0.7f; } @@ -1832,7 +1832,7 @@ void FUN_L15_0020ed50(void) { v10.f[2] += random_float_between(frame_time, frame_time * 2.0f); FUN_L00_00271b18(&v0, &v10, random_float_between(37800.0f, 75600.0f)); } - f = FUN_001f9af0(&hero.motion.platform_delta); + f = fast_vec_length(&hero.motion.platform_delta); if (f > frame_time * 0.5f) { hero.motion.move_yaw = fast_arc_tan(hero.motion.platform_delta.f[0], hero.motion.platform_delta.f[1]); } else { @@ -1952,8 +1952,8 @@ void FUN_L15_0020ed50(void) { FUN_L00_00215340(); FUN_L00_002132b8(0.7f, frame_time * 0.0f); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; case 0x77: { @@ -1965,8 +1965,8 @@ void FUN_L15_0020ed50(void) { len = vector_length_xy(&hero.motion.velocity); FUN_L00_001ff600(frame_scale * -0.100000024f * len + len, &hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; } @@ -2005,11 +2005,11 @@ void FUN_L15_0020ed50(void) { FUN_L00_00215340(); FUN_L15_0020a328(1); if (big) { - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); hero.unk304 = hero.motion.velocity.f[2]; } else { - FUN_L00_0025b8c0(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, + vendor_spring(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, frame_scale_sq * 0.35f, frame_time * 2.5f); } break; @@ -2044,7 +2044,7 @@ void FUN_L15_0020ed50(void) { speed_step(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); FUN_L00_00215340(); - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); if (hero.motion.pos.f[2] < hero.unk410) { approach_value(&hero.unk410, hero.motion.pos.f[2], frame_time * 4.0f); @@ -2088,7 +2088,7 @@ void FUN_L15_0020ed50(void) { if (hero.state_timer == scale_game_frames(20)) { FUN_L00_00209ca8(3, 0x10, 1); if (D_L15_001612D0 != 0) { - FUN_L00_002a3ec8(D_L15_001612D0, D_L15_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L15_001612D0, D_L15_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, 0.35f); } } @@ -2138,7 +2138,7 @@ void FUN_L15_0020ed50(void) { qcopy(&v10, &v0); v10.f[0] += fast_cos(hero.motion.rot.f[2]) * 0.85f; v10.f[1] += fast_sin(hero.motion.rot.f[2]) * 0.85f; - if (FUN_001efa68(&v0, &v10, 4, (struct MobyView *)hero.moby, 0) != 0) { + if (collision_line(&v0, &v10, 4, (struct MobyView *)hero.moby, 0) != 0) { hero.unk4A4 = 1; } } @@ -2161,7 +2161,7 @@ void FUN_L15_0020ed50(void) { if (hero.motion.pos.f[2] < hero.unk410) { hero.unk410 = hero.motion.pos.f[2]; } - if (hero.state_timer > hero.unk420 && FUN_L00_00233a78(&hero.motion.velocity) < 0.001f && + if (hero.state_timer > hero.unk420 && gravity_z(&hero.motion.velocity) < 0.001f && (hero.unk41C == 0 || hero.state_timer > hero.unk3D4)) { hero.unk41E = 1; if (hero.unk3F8 != 0.0f) { @@ -2184,7 +2184,7 @@ void FUN_L15_0020ed50(void) { fast_vec_scale(&v10, &hero.motion.displacement, 7.0f); for (i = 0; i < n; i++) { if (FUN_L00_0025e3b8(D_L15_00178500[i]) != 0) { - FUN_L00_00259bc8(D_L15_00178500[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, + spawn_nearby_effect(D_L15_00178500[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, 1.0f); } } @@ -2267,7 +2267,7 @@ void FUN_L15_0020ed50(void) { } case 0x66: subtract_vector_xyz(&v0, &hero.unk1640, &hero.motion.pos); - if (FUN_001f9ab0(&v0, &hero.motion.unk150) < 0.0f) { + if (fast_vec_dot(&v0, &hero.motion.unk150) < 0.0f) { clear_u64_value(&hero.motion.unk150); } clear_u64_value(&hero.motion.velocity); @@ -2357,7 +2357,7 @@ void FUN_L15_0020ed50(void) { for (i = 0; i < 3; i++) { FUN_L00_002335c8(&m40[1], 1.8f, fast_add_rotations(-0.7853982f, (f32)i * 0.7853982f), 1.4f); - FUN_L00_002598b0((struct MobyView *)hero.moby, 2.2f, &m40[1], 0x30000, 40.0f, 1.0f, 0, 1, 0); + play_entity_sound((struct MobyView *)hero.moby, 2.2f, &m40[1], 0x30000, 40.0f, 1.0f, 0, 1, 0); } } switch (hero.attack_record) { @@ -2440,7 +2440,7 @@ void FUN_L15_0020ed50(void) { stick_target(frame_time * 6.0f, 0); qcopy(&v0, &hero.motion.pos); v0.f[2] -= 1.0f; - FUN_L00_002598b0((struct MobyView *)hero.moby, 3.5f, &v0, 0x30000, 40.0f, 1.0f, 0, 1, 0); + play_entity_sound((struct MobyView *)hero.moby, 3.5f, &v0, 0x30000, 40.0f, 1.0f, 0, 1, 0); if (hero.unk1C4 == 0) { FUN_L02_00223450(); } @@ -2458,7 +2458,7 @@ void FUN_L15_0020ed50(void) { d = fast_difference_between_rotations(hero.motion.rot.f[2], hero.motion.move_yaw); for (i = 0; i < 3; i++) { FUN_L00_002335c8(&v0, 1.8f, fast_add_rotations(-0.7853982f, (f32)i * 0.7853982f), 1.4f); - FUN_L00_002598b0((struct MobyView *)hero.moby, 2.7f, &v0, 0x30000, 40.0f, 1.0f, 0, 1, 0); + play_entity_sound((struct MobyView *)hero.moby, 2.7f, &v0, 0x30000, 40.0f, 1.0f, 0, 1, 0); } if (FUN_L00_00211870(30.0f) != 0 || FUN_L00_00211870(0.0f) != 0) { Q.f160 = 0.1f; diff --git a/src/overlays/l15/gameplay/hero/0021d040.c b/src/overlays/l15/gameplay/hero/0021d040.c index 9e8baa8532..c6cc3c629c 100644 --- a/src/overlays/l15/gameplay/hero/0021d040.c +++ b/src/overlays/l15/gameplay/hero/0021d040.c @@ -56,11 +56,11 @@ extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L15_0015F638; extern float D_L15_001673D8 __attribute__((section(".data"))); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_00208f20(float a, float b, float c, float d); extern float FUN_L00_00232b90(float a, float b, float c); -extern float FUN_L00_00233a78(float *v); +extern float gravity_z(float *v) __asm__("FUN_L00_00233a78"); extern float FUN_L00_00233c30(float *pos, float *vel, int *steps, float step); extern float FUN_L00_00266e80(int); extern float approach_value(float *p, float target, float maxstep) __asm__("FUN_00213ed8"); @@ -116,7 +116,7 @@ extern void FUN_L00_00232628(void); extern void FUN_L00_00232640(int id); extern void FUN_L00_00233288(float a, float b, short c, unsigned char d, unsigned char e, unsigned char f); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void hud_keep_visible(int, int) __asm__("FUN_L00_00235e18"); extern void FUN_L00_00237ae8(void); extern void FUN_L00_00237ba0(void); @@ -124,7 +124,7 @@ extern void FUN_L00_002382a0(void); extern void FUN_L00_00239cc8(void); extern void FUN_L00_00239d00(void); extern void FUN_L00_00239df8(void); -extern void FUN_L00_002598b0(int, float, void *, int, float, float, int, int, int); +extern void play_entity_sound(int, float, void *, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L01_00227e48(int a0, int a1, int a2); extern void FUN_L01_00232290(void); @@ -868,7 +868,7 @@ void FUN_L15_0021d040(void) { } break; case 101: - if (FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { + if (vector_distance(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { if (frame_time * 2.7f > hero.motion.speed_xy) { if (fast_difference_between_rotations( hero.motion.rot.f[2], hero.unk1640.f[3]) < 0.034906585f) { @@ -892,7 +892,7 @@ void FUN_L15_0021d040(void) { if ((hero.unkA98 & 2) || hero.unk1650 != 0) { hero_set_state(HERO_STATE_IDLE, 1); } - if (0.2f < FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f)) { + if (0.2f < vector_distance(hero.motion.pos.f, hero.unk1640.f)) { hero_set_state(0x65, 1); } break; @@ -1268,7 +1268,7 @@ void FUN_L15_0021d040(void) { if (hero_set_state(HERO_STATE_IDLE, 0)) { set_hero_animation(0xC, 9, -1.0f); } - FUN_L00_00233b20(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); + gravity_set_z(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); FUN_L00_0025f730(hero.motion.unk150.f, frame_time * 7.0f); hero.unk1C4 = scale_game_frames(7); if (hero.state.prev == 0x2D) { @@ -1769,7 +1769,7 @@ void FUN_L15_0021d040(void) { scale_game_frames(0xE) < hero.state_timer && (hero.unk41E == 0 || (hero.ground_distance > 0.7f && - absolute_float(FUN_L00_00233a78(hero.motion.velocity.f)) < + absolute_float(gravity_z(hero.motion.velocity.f)) < frame_time * 5.8f))) { hero_set_state(0xE, 1); } else if (D_0013D4C0[2] != 0 && hero_slot_item_id(3) != 4 && @@ -1857,7 +1857,7 @@ void FUN_L15_0021d040(void) { if (hero.unk41E != 0) { qcopy(v0, hero.motion.pos.f); v0[2] -= 1.0f; - FUN_L00_002598b0((int)((unsigned char *)hero.moby), 3.5f, v0, 0x30000, 40.0f, 1.0f, 0, + play_entity_sound((int)((unsigned char *)hero.moby), 3.5f, v0, 0x30000, 40.0f, 1.0f, 0, 1, 0); } if (!(hero.state_timer > hero.unk420)) { @@ -1941,7 +1941,7 @@ void FUN_L15_0021d040(void) { if (hero.unk41E != 0) { qcopy(v0, hero.motion.pos.f); v0[2] -= 1.0f; - FUN_L00_002598b0((int)((unsigned char *)hero.moby), 3.5f, v0, 0x30000, 1.0f, 1.0f, 0, 1, + play_entity_sound((int)((unsigned char *)hero.moby), 3.5f, v0, 0x30000, 1.0f, 1.0f, 0, 1, 0); } if (hero.air_frames.s != 0) { diff --git a/src/overlays/l15/gameplay/hero/hero_set_state.c b/src/overlays/l15/gameplay/hero/hero_set_state.c index 3fe9f33a24..26028eb806 100644 --- a/src/overlays/l15/gameplay/hero/hero_set_state.c +++ b/src/overlays/l15/gameplay/hero/hero_set_state.c @@ -31,7 +31,7 @@ extern float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_0020d658(int back); -extern float FUN_L00_002339d0(float *v); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float vector_length_xy(void *); @@ -67,12 +67,12 @@ extern void FUN_L00_00216ec0(int, int, int); extern void FUN_L00_00217450(void); extern void set_hero_animation(int, int, float) __asm__("FUN_L00_002323b8"); extern void FUN_L00_002325e0(int bank, int seq); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L00_00262500(int a, char *b); extern void FUN_L00_00262528(char *o, int a, int b); extern void FUN_L00_00262840(char *o); -extern void FUN_L00_002a3ec8(void *, int, int, float, float, float, float); +extern void pool_splash(void *, int, int, float, float, float, float) __asm__("FUN_L00_002a3ec8"); extern void FUN_L15_0021ab60(void); extern void fill_transfer_words(void *, int, int) __asm__("func_001F97E8"); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); @@ -268,7 +268,7 @@ int hero_set_state(int a, int b) { if (p->state.prev_control_mode == 0x11) { FUN_L00_00209ca8(3, 0xA, 0); if (D_L15_001612D0 != 0) { - FUN_L00_002a3ec8(D_L15_001612D0, D_L15_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L15_001612D0, D_L15_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.4f, 0.3f); } } else if (p->motion.displacement.f[2] < frame_time * -0.5f) { @@ -278,7 +278,7 @@ int hero_set_state(int a, int b) { v = 0x28; FUN_L00_00209ca8(3, v, 1); if (D_L15_001612D0 != 0) { - FUN_L00_002a3ec8(D_L15_001612D0, D_L15_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L15_001612D0, D_L15_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.5f, -0.4f); } p->unk90A = scale_game_frames(0x4B); @@ -592,7 +592,7 @@ int hero_set_state(int a, int b) { char *v = (char *)&p->motion.unk110; p->state.control_mode = 1; p->unk2284 = 0; - p->ground_speed = FUN_L00_002339d0((float *)v); + p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.unk150, v); if (b) { int id = 6; @@ -991,7 +991,7 @@ int hero_set_state(int a, int b) { u->unk48C = 1.98f; u->unk430 = 1.95f; } else { - FUN_L00_00233b20((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); + gravity_set_z((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); u->unk41C = 1; u->unk3D0 = scale_game_frames(2); u->unk3D4 = scale_game_frames(0x23) + u->unk3D0; diff --git a/src/overlays/l15/math/interpolation/00247e90.c b/src/overlays/l15/math/interpolation/00247e90.c index 3c972dfd66..d561eb948c 100644 --- a/src/overlays/l15/math/interpolation/00247e90.c +++ b/src/overlays/l15/math/interpolation/00247e90.c @@ -12,8 +12,8 @@ extern CollisionHit coll_hit __asm__("D_L15_00174440") __attribute__((section(". extern int coll_sphere(void *, float, int, void *) __asm__("FUN_L00_001f0d60"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); -extern f32 FUN_001f9b20(void *); -extern f32 FUN_001f9e90(f32, f32); +extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); +extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); int FUN_L15_00247e90(struct Moby *obj, u128 *delta, int flags, float step, float radius) { Vec4 start; @@ -32,7 +32,7 @@ int FUN_L15_00247e90(struct Moby *obj, u128 *delta, int flags, float step, float if (coll_sphere(&probe, radius, mask | 4, obj) == 0) { break; } - if (FUN_001f9e90(coll_hit.normal_z, FUN_001f9b20(&coll_hit.normal_x)) > 0.5235988f) { + if (fast_arc_tan(coll_hit.normal_z, vector_length_xy(&coll_hit.normal_x)) > 0.5235988f) { qcopy(&obj->pos, coll_hit.pad30); obj->pos.z -= step; pushed |= 1; diff --git a/src/overlays/l16/gameplay/entities/grindrail_gate.c b/src/overlays/l16/gameplay/entities/grindrail_gate.c index c6307dabf4..5fc672efe2 100644 --- a/src/overlays/l16/gameplay/entities/grindrail_gate.c +++ b/src/overlays/l16/gameplay/entities/grindrail_gate.c @@ -70,7 +70,7 @@ typedef struct { extern char D_0013E633[], D_0014171B[], D_0013D24D[], D_L16_00167240[]; float D_L16_001D96C0[8] = {300.73f, 206.04f, 123.22f, 0.0f, 0.0f, 0.11f, 0.0f, 0.0f}; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float FUN_001f9e90_cf(float, float) __asm__("FUN_001fa688"); extern float FUN_001fa688_cf(float, float) __asm__("FUN_001f9e90"); extern float fast_add_rotations(float, float); @@ -79,8 +79,8 @@ extern float truncate_float_to_s32_cf(float, float) __asm__("FUN_002132a8"); extern float vector_length_xy(void *); extern float vector_length_xyz(void *); extern int help_request(int, int) __asm__("FUN_L00_00203908"); -extern int FUN_L00_00266448(void *, void *); -extern int FUN_L00_002668a0(void *, void *); +extern int update_npc_dialogue(void *, void *) __asm__("FUN_L00_00266448"); +extern int initialize_npc_dialogue(void *, void *) __asm__("FUN_L00_002668a0"); extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); extern int memcard_save_data(int, int) __asm__("FUN_0020b178"); extern int random_float_between_cf(float) __asm__("FUN_001fa6d0"); @@ -89,10 +89,10 @@ extern int tick_countdown_32(int *); extern s32 D_L16_0015F5C4 ; extern unsigned char D_0015EDB0_b __asm__("D_0015EDB0"); extern void FUN_L00_00216f90(void *, void *, int, int); -extern void FUN_L00_002502a0(int); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); extern void FUN_L00_00260860(int, int); -extern void FUN_L00_002628d8(float, float, void *, void *, int); -extern void FUN_L00_00284e50(void *, void *); +extern void update_joint_animation(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern void FUN_L12_002e6b60(char *); extern void add_vector_xyz(void *, void *, void *); extern void build_spherical_offset(void *, float, float, float) __asm__("FUN_00214db0"); @@ -100,7 +100,8 @@ extern void subtract_vector_xyz(void *, void *, void *); extern L16WatchPlayer D_0013E633_watch __asm__("D_0013E533"); extern L16WatchFlags D_0013D355_watch __asm__("D_0013D24D"); -void FUN_L16_002e3190(L16WatchMoby *m) { +void help_desk_lady_update(L16WatchMoby *m) __asm__("FUN_L16_002e3190"); +void help_desk_lady_update(L16WatchMoby *m) { L16WatchScratch scratch; L16WatchData *d = m->data; L16WatchFlags *flags; @@ -112,7 +113,7 @@ void FUN_L16_002e3190(L16WatchMoby *m) { activation = &d->activation; switch (m->state) { case 0: - FUN_L00_002668a0(m, activation); + initialize_npc_dialogue(m, activation); m->state = 1; d->activation.radius = 20.0f; m->opacity = 0xFF; @@ -121,7 +122,7 @@ void FUN_L16_002e3190(L16WatchMoby *m) { L16WatchPlayer *player = (L16WatchPlayer *)((char *)&D_0013E633_watch + 0xE1D); if (player->disabled == 0 && player->mode != 15 && player->mode != 22) { if (is_point_inside_clip_volume((char *)player + 0x80, d->activation_region) && - FUN_L00_00266448(m, activation)) + update_npc_dialogue(m, activation)) m->state = 2; } break; @@ -133,9 +134,9 @@ void FUN_L16_002e3190(L16WatchMoby *m) { FUN_L00_00216f90(D_L16_001D96C0, D_L16_001D96C0 + 4, 0, 1); help_request(0x3E82, 0x84); FUN_L00_00260860(0x21, 1); - FUN_L00_002502a0(m->widget); + jet_clear_persistent(m->widget); player = (char *)&D_0013E633_watch + 0xE9D; - FUN_L00_00284e50(player, player + 0x10); + jet_reset_camera(player, player + 0x10); memcard_save_data(0, -1); m->state = 3; } @@ -154,7 +155,7 @@ void FUN_L16_002e3190(L16WatchMoby *m) { if (m->animation == 0) { char *player = (char *)&D_0013E633_watch + 0xE9D; tracking = 1; - if (FUN_001f9b80(m->position, player) < 8.0f && + if (vector_distance(m->position, player) < 8.0f && FUN_001f9e90_cf( m->yaw, FUN_001fa688_cf(((L16WatchPlayer *)((char *)&D_0013E633_watch + 0xE1D))->aim[0] - @@ -209,8 +210,8 @@ void FUN_L16_002e3190(L16WatchMoby *m) { } if (D_0015EDB0_b) d->height = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 2); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 2); } #define NOT_SDA @@ -336,18 +337,18 @@ extern char D_L16_001E89A0[], D_L16_001E89D8[], D_L16_001E8A20[], D_L16_001E8758 extern char D_L16_001E89A0[], D_L16_001E89D8[], D_L16_001E8A20[], D_L16_001E8A58[], D_L16_001E87A0[]; extern float frame_time ,D_0015EE70; extern float fast_arc_tan(float,float) __asm__("FUN_001f9e90"); -extern float FUN_L00_0025b8c0(float *p, float *v, float t, float u1, float u2, float eps); +extern float vendor_spring(float *p, float *v, float t, float u1, float u2, float eps) __asm__("FUN_L00_0025b8c0"); extern int debug_print_alt() __asm__("FUN_001e93b0"); -extern int FUN_L00_0025c698(void *,void *); +extern int mine_fall(void *,void *) __asm__("FUN_L00_0025c698"); extern int FUN_L16_002e3fa0(struct Moby *moby); extern int is_point_inside_clip_volume(void *arg0, int arg1) __asm__("func_00214720"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern f32 D_L16_00161D94; extern f32 D_L16_00161D98_gp __asm__("D_L16_00161D98") __attribute__((sda)); extern void FUN_L00_00257470(void *, int, int); -extern void FUN_L00_0025c558(void *, void *, int, int, int, float); -extern void FUN_L00_0025d538(void *, void *); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void trooper_start_knockback(void *, void *, int, int, int, float) __asm__("FUN_L00_0025c558"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L03_002c6c90(void *); extern void FUN_L14_002fe900(void *); extern void FUN_L14_002fec28(void *); @@ -358,7 +359,8 @@ extern void set_moby_animation_alt(void *, int, int) __asm__("FUN_00212ed8"); void FUN_L00_00258278(unsigned char *m, float *ptr, float t, float b, float c, float limit); extern void func_L00_002592B0_path54(char*,float,float*,float,float,float) __asm__("FUN_L00_00258278"); -void FUN_L16_002e37a0(L16CrateMoby *moby) { +void bolt_thief_update(L16CrateMoby *moby) __asm__("FUN_L16_002e37a0"); +void bolt_thief_update(L16CrateMoby *moby) { L16CrateData *d = moby->data; char *hit; @@ -378,7 +380,7 @@ void FUN_L16_002e37a0(L16CrateMoby *moby) { d->knock_rise = frame_time * 12.0f; d->knock_flags = 1; d->knock_bAD = 0; - FUN_L00_0025c558(moby, d->knock, 1, 1, 0, + trooper_start_knockback(moby, d->knock, 1, 1, 0, fast_arc_tan(moby->position[0] - player->motion.pos.f[0], moby->position[1] - player->motion.pos.f[1])); d->ticks = 0x78; FUN_L00_00257470(moby, 0, -1); @@ -469,9 +471,9 @@ void FUN_L16_002e37a0(L16CrateMoby *moby) { FUN_L14_002fec28(moby); qcopy(target, path + *(int *)path * 16); zero = 0.0f; - FUN_L00_0025b8c0(moby->position, &a->vx, target[0], *(float *)&D_L16_00161D94, *(float *)&D_L16_00161D98_gp, zero); - FUN_L00_0025b8c0(moby->position + 1, &a->vy, target[1], *(float *)&D_L16_00161D94, *(float *)&D_L16_00161D98_gp, zero); - FUN_L00_0025b8c0(moby->position + 2, &a->vz, target[2], *(float *)&D_L16_00161D94, *(float *)&D_L16_00161D98_gp, zero); + vendor_spring(moby->position, &a->vx, target[0], *(float *)&D_L16_00161D94, *(float *)&D_L16_00161D98_gp, zero); + vendor_spring(moby->position + 1, &a->vy, target[1], *(float *)&D_L16_00161D94, *(float *)&D_L16_00161D98_gp, zero); + vendor_spring(moby->position + 2, &a->vz, target[2], *(float *)&D_L16_00161D94, *(float *)&D_L16_00161D98_gp, zero); if ((moby->status & 2) && moby->frame == moby->animation) { if (a->mode == 1) { moby->state = 1; @@ -510,8 +512,8 @@ void FUN_L16_002e37a0(L16CrateMoby *moby) { } break; case 6: - if (FUN_L00_0025c698(moby, d->knock) & 3) { - FUN_L00_0025f090(moby, moby->position, -1, 1.0f, 13.0f); + if (mine_fall(moby, d->knock) & 3) { + cart_burst(moby, moby->position, -1, 1.0f, 13.0f); mark_moby_for_removal(moby); return; } @@ -521,7 +523,7 @@ void FUN_L16_002e37a0(L16CrateMoby *moby) { } break; } - FUN_L00_0025d538(moby, d->effect); + trooper_anim_finish(moby, d->effect); } /* Ported from rac1-decomp (src/overlays/l16_kalebo3/vendor_002A50F0.c: func_L16_002E5408), where it is exact; names translated to the US level program. */ @@ -530,8 +532,8 @@ extern char *D_L16_001B0930[]; extern float absolute_float(float) __asm__("func_001F99C0"); extern float frame_time, D_0015EE70; extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_L00_0025b8c0(float *p, float *v, float t, float u1, float u2, float eps); -extern int FUN_L00_0025d808() __asm__("FUN_L00_0025d808"); +extern float vendor_spring(float *p, float *v, float t, float u1, float u2, float eps) __asm__("FUN_L00_0025b8c0"); +extern int sample_path() __asm__("FUN_L00_0025d808"); extern float D_L16_00161D90 __attribute__((sda)); extern float D_L16_00161D94_gp __asm__("D_L16_00161D94") __attribute__((sda)); extern float D_L16_00161D98_gp __asm__("D_L16_00161D98") __attribute__((sda)); @@ -555,11 +557,11 @@ int FUN_L16_002e3fa0(struct Moby *moby) { else path = D_L16_001B0930[*(int *)(data + 0xD8)]; r = FUN_L00_0025d808_path54(path, pos, (float *)(data + 0xD0), (float *)(data + 0xD4), 0, t); - FUN_L00_0025b8c0(&moby->pos.x, (float *)(data + 0xE4), pos[0], D_L16_00161D94_gp, + vendor_spring(&moby->pos.x, (float *)(data + 0xE4), pos[0], D_L16_00161D94_gp, D_L16_00161D98_gp, 0.0f); - FUN_L00_0025b8c0(&moby->pos.y, (float *)(data + 0xE8), pos[1], D_L16_00161D94_gp, + vendor_spring(&moby->pos.y, (float *)(data + 0xE8), pos[1], D_L16_00161D94_gp, D_L16_00161D98_gp, 0.0f); - FUN_L00_0025b8c0(&moby->pos.z, (float *)(data + 0xEC), pos[2], D_L16_00161D94_gp, + vendor_spring(&moby->pos.z, (float *)(data + 0xEC), pos[2], D_L16_00161D94_gp, D_L16_00161D98_gp, 0.0f); subtract_vector_xyz(delta, pos, &moby->pos); if (absolute_float(delta[0]) > 0.01f) { @@ -596,15 +598,15 @@ extern float frame_time, D_0015EE70_c __asm__("D_0015EE70"); extern float D_0015EE6C_u, D_0015ED70_c2 __asm__("D_0015ED70"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L05_003195f8(char *); extern s32 D_L16_0015F594; extern unsigned char D_0013D4E1 __attribute__((section(".data"))); extern void lerp_vector(void *, void *, void *, float) __asm__("FUN_001f9a40"); -extern void FUN_001f9d20(void *, void *, void *); +extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void allocate_voice_for_target_entry(int, int, void *) __asm__("FUN_0022da68"); -extern void FUN_L00_00260738(char *a, void *b, void *c, void *d); +extern void update_entity_matrix(char *a, void *b, void *c, void *d) __asm__("FUN_L00_00260738"); extern void FUN_L00_00266858(void *, int); extern void FUN_L05_00319510(void *); extern void FUN_L05_00319690(char *); @@ -619,7 +621,8 @@ float absolute_float(float input) __asm__("func_001F99C0"); extern int func_0022ED80_i(int, int, void *) __asm__("FUN_0022da68"); extern void func_00215CA8_f5848(float, int *, int, void *, float *, int) __asm__("FUN_00214e58"); -void FUN_L16_002e43e0(struct Moby *moby) { +void taxi_update(struct Moby *moby) __asm__("FUN_L16_002e43e0"); +void taxi_update(struct Moby *moby) { char *d = (char *)moby->pvars; float v00[4], v10[4], v20[4], v30[4], v40[4], v50[4], v60[4], v70[4]; struct Hero *g; @@ -645,7 +648,7 @@ void FUN_L16_002e43e0(struct Moby *moby) { transpose_rotation_matrix(v30, &moby->rot_row0); subtract_vector_xyz(v70, &g->motion.pos, &moby->pos); v70[3] = 0; - FUN_001f9d20(v70, v70, v30); + transform_vector(v70, v70, v30); if (absolute_float(v70[1]) < 1.2f) { FUN_L16_002e4a58_c(moby); FUN_L05_00319690(moby); @@ -729,10 +732,10 @@ void FUN_L16_002e43e0(struct Moby *moby) { g2->unk1F2 = 2; g2->unk1F4 = 2; FUN_L05_003198e8(moby); - if (FUN_L00_0028d8c0(moby, *(short *)(d + 0xAA)) == 0) { + if (voice_is_playing(moby, *(short *)(d + 0xAA)) == 0) { *(short *)(d + 0xAA) = func_0022ED80_i(0, 4, moby); } - } else if (FUN_L00_0028d8c0(moby, *(short *)(d + 0xAA)) != 0) { + } else if (voice_is_playing(moby, *(short *)(d + 0xAA)) != 0) { h = *(short *)(d + 0xAA); if (h != -1) { e = D_0013E550 + h * 0x70; @@ -743,7 +746,7 @@ void FUN_L16_002e43e0(struct Moby *moby) { *(short *)(d + 0xAA) = -1; } subtract_vector_xyz(v20, &moby->pos, v00); - FUN_L00_00260738(d + 0x20, v20, v10, &moby->rot); + update_entity_matrix(d + 0x20, v20, v10, &moby->rot); } #include "sda.h" #include "qcopy.h" @@ -830,7 +833,7 @@ extern float fast_sin(float) __asm__("func_001F9DE0"); extern int D_L16_0015F5CC; extern int FUN_001fa6e0_u(float, int, int) __asm__("FUN_001fa6e0"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); -extern void FUN_001f9d20(void *, void *, void *); +extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void allocate_voice_for_target_entry(int, int, void *) __asm__("FUN_0022da68"); extern void subtract_vector_xyz(void *out, void *a, void *b) __asm__("FUN_001f9a28"); @@ -860,7 +863,7 @@ void FUN_L16_002e5010(struct Moby *m) { if (FUN_001f9b48(&m->pos, g) < 16.0f) { transpose_rotation_matrix(pos, &m->rot_row0); subtract_vector_xyz(mat, g, &m->pos); - FUN_001f9d20(mat, mat, pos); + transform_vector(mat, mat, pos); if (D_L16_001D9750[0] < mat[0] && mat[0] < D_L16_001D9750[1] && D_L16_001D9750[2] < mat[1] && mat[1] < D_L16_001D9750[3] && D_L16_001D9750[4] < mat[2] && mat[2] < D_L16_001D9750[5]) { @@ -956,23 +959,24 @@ typedef struct { } Level16VendorTurnMoby; extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9de0(float); -extern float FUN_001fa580(float, float); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float random_angle_radians_alt(void) __asm__("FUN_00213308"); -extern int FUN_001f9740(int *); +extern int tick_countdown_32(int *) __asm__("FUN_001f9740"); extern int FUN_001fa6e0_u(float, int, int) __asm__("FUN_001fa6e0"); float D_L16_00161DF0[4] __attribute__((section(".sdata"))) = {0.0f, -1.0f, 1.0f, 0.0f}; -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); -extern void FUN_001f9cf8(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); +extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void allocate_voice_for_target_entry(int, int, void *) __asm__("FUN_0022da68"); float absolute_float(float input) __asm__("func_001F99C0"); void FUN_L16_002e56e0_c(Level16VendorTurnMoby *moby) __asm__("FUN_L16_002e56e0"); extern void func_L16_002E6B48_6908(void *) __asm__("FUN_L16_002e56e0"); extern int func_0022ED80_6908(int, int, void *) __asm__("FUN_0022da68"); -void FUN_L16_002e54a0(struct Moby *m) { +void grindrail_button_update(struct Moby *m) __asm__("FUN_L16_002e54a0"); +void grindrail_button_update(struct Moby *m) { char *d = (char *)m->pvars; char *g; char *base; @@ -984,15 +988,15 @@ void FUN_L16_002e54a0(struct Moby *m) { *(float *)d = random_angle_radians_alt(); break; case 1: - if (FUN_001f9740((int *)(d + 4))) { + if (tick_countdown_32((int *)(d + 4))) { g = (char *)&hero.motion.pos; - if (FUN_001f9b80(&m->pos, g) < 4.0f) { + if (vector_distance(&m->pos, g) < 4.0f) { base = g - 0x80; if (*(int *)(base + 0x2084) == 0x28 && *(int *)(base + 0x5A8) != -1) { - FUN_001f9cf8(v, &D_L16_00161DF0, &m->rot_row0); - FUN_001f9a10(v, v, &m->pos); - FUN_001f9a28(v, v, g); - FUN_001f9cf8(v, v, g - 0x40); + transform_vector_by_basis(v, &D_L16_00161DF0, &m->rot_row0); + fast_vec_add(v, v, &m->pos); + fast_vec_sub(v, v, g); + transform_vector_by_basis(v, v, g - 0x40); if (absolute_float(v[1]) < 0.1f) { if ((v[0] > 0.0f && *(int *)(base + 0x5A8) == 3) || (v[0] < 0.0f && *(int *)(base + 0x5A8) == 2)) { @@ -1010,8 +1014,8 @@ void FUN_L16_002e54a0(struct Moby *m) { } break; } - *(float *)d = FUN_001fa580(*(float *)d, frame_time * 12.566371f); - f = (FUN_001f9de0(*(float *)d) + 1.0f) * 0.5f; + *(float *)d = fast_add_rotations(*(float *)d, frame_time * 12.566371f); + f = (fast_sin(*(float *)d) + 1.0f) * 0.5f; if (m->command) { m->glow_color = FUN_001fa6e0_u(f, 0x80208020, 0x80202020); } else { @@ -1055,9 +1059,9 @@ typedef struct { extern char D_L16_001671C0[]; extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_L00_0025be00(float *, float *, float, float, float, float); +extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); extern float FUN_L16_002e6428_u(void *, void *) __asm__("FUN_L16_002e6428"); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int FUN_L00_002dc9f0(void *, void *); extern s32 rand(); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); @@ -1065,7 +1069,7 @@ extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern void FUN_L00_00257470(void *, int, int); extern void FUN_L00_002599e8(void *, int, int, float, float, float, int, int, int); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L00_00263ac8(float, int, int, unsigned char *); void FUN_L16_002e6208(void *arg); s32 is_value_within_interpolated_window(struct InterpolatedStateEntry *arg0, f32 fparg0) __asm__("FUN_00214cc8"); @@ -1074,7 +1078,8 @@ void mark_moby_for_removal_u(struct Obj *obj) __asm__("FUN_0020c828"); extern int func_001FA898_caa18(float) __asm__("FUN_001fa6d0"); short D_L16_00161E48 = 0; -void FUN_L16_002e5e08(struct Moby *m) { +void chomper_update(struct Moby *m) __asm__("FUN_L16_002e5e08"); +void chomper_update(struct Moby *m) { char *d = (char *)m->pvars; FUN_L16_002e6208(m); FUN_L00_00263ac8(2.1f, (int)m, 1, (unsigned char *)(d + 0x220)); @@ -1123,7 +1128,7 @@ void FUN_L16_002e5e08(struct Moby *m) { float *yaw = &m->rot.z; float angle = fast_arc_tan(*(float *)(d + 0x180) - m->pos.x, *(float *)(d + 0x184) - m->pos.y); - FUN_L00_0025be00(yaw, (float *)(d + 0x1F4), angle, frame_time_sq * 12.566371f, + approach_angle(yaw, (float *)(d + 0x1F4), angle, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, frame_time * 12.566371f); if (is_value_within_interpolated_window(m, 13.0f)) { FUN_L00_002599e8(m, 0, 1, 0.333f, 1.0f, 1.0f, 0, 1, 0); @@ -1149,8 +1154,8 @@ void FUN_L16_002e5e08(struct Moby *m) { } break; case 8: - if (FUN_L00_0025c698(m, d + 0x120) & 0x140) { - FUN_L00_0025f090(m, &m->pos, 6, 0.5f, 13.0f); + if (mine_fall(m, d + 0x120) & 0x140) { + cart_burst(m, &m->pos, 6, 0.5f, 13.0f); FUN_L00_00257470(m, 0, -1); mark_moby_for_removal_u(m); } @@ -1218,15 +1223,15 @@ extern char *D_L16_001B0930[]; extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern float D_L16_00161E58 __attribute__((sda)); extern float D_0015EE70; -extern float FUN_001f9b80(void*,void*); +extern float vector_distance(void*,void*) __asm__("FUN_001f9b80"); extern float D_L16_00161E54 __attribute__((sda)); extern float D_L16_00161E5C __attribute__((sda)); extern float D_L16_00161E60 __attribute__((sda)); extern int FUN_L00_0025ff38(void *, void *, float, int, int, void *, int); -extern void FUN_L00_0025ab48(void *, float *, void *, void *); -extern void FUN_L00_0025c558(void *, void *, int, int, int, float); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(void *, void *, int, int, int, float) __asm__("FUN_L00_0025c558"); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); float absolute_float(float input) __asm__("func_001F99C0"); void FUN_L16_002e6208(void *arg) { @@ -1255,21 +1260,21 @@ void FUN_L16_002e6208(void *arg) { d->timer = frame_time * 2.0f; m->flags &= ~0x1000; *(OvlQuad *)scratch = *(OvlQuad *)(hit + 0x10); - FUN_L00_0025ab48(scratch, scratch + 4, &d->jump_speed, &d->turn_speed); - FUN_L00_0025c558(m, d->knock, 5, 1, 0, scratch[4]); + trooper_knockback_arc(scratch, scratch + 4, &d->jump_speed, &d->turn_speed); + trooper_start_knockback(m, d->knock, 5, 1, 0, scratch[4]); d->f170 = 8.0f; d->f174 = 16.0f; m->state = 8; m->i94 = 0; d->reaction_time = 0x78; - FUN_L00_0025d458(m, d->reaction); + trooper_anim_update(m, d->reaction); } m->bA4 = 0xFF; - FUN_L00_0025d538(m, d->reaction); + trooper_anim_finish(m, d->reaction); b = (int)&D_L16_001B0930[d->path]; a = *(int *)b; if (FUN_L00_0025ff38(m, d->target, 16.0f, 0, 0, (void *)(a + 0x10), *(int *)a) != 2) { - if (FUN_001f9b80(d->home, d->target) > 16.0f || + if (vector_distance(d->home, d->target) > 16.0f || absolute_float(m->position[2] - d->target[2]) > 3.0f) { d->i1C4 = 2; } @@ -1399,7 +1404,7 @@ extern char D_L16_001671C0[]; extern char D_L16_001D9860[]; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_add_rotations(float, float); extern float fast_subtract_rotations(float, float); extern float vector_length_xy(void *); @@ -1410,8 +1415,8 @@ extern int D_L16_0015F5CC; extern float D_L16_0015F638; extern int D_0015EEA4; extern int help_request(int, int) __asm__("FUN_L00_00203908"); -extern int FUN_L00_00266448(void *, void *); -extern int FUN_L00_002668a0(void *, void *); +extern int update_npc_dialogue(void *, void *) __asm__("FUN_L00_00266448"); +extern int initialize_npc_dialogue(void *, void *) __asm__("FUN_L00_002668a0"); extern int allocate_voice_for_bank_entry(int, int, int) __asm__("FUN_0022db10"); extern int memcard_save_data(int, int) __asm__("FUN_0020b178"); extern int scale_game_frames(int); @@ -1422,11 +1427,11 @@ extern unsigned char D_0013D408[]; extern void FUN_L00_00216f90(void *, void *, int, int); extern void FUN_L00_0025a120(void *); extern void FUN_L00_00260860(int, int); -extern void FUN_L00_002628d8(float, float, void *, void *, int); +extern void update_joint_animation(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); extern void FUN_L00_00263d40(int, int); extern void FUN_L00_00299460(int); extern void FUN_L16_002923d0(int); -extern void FUN_L01_002783a8(float, void *); +extern void begin_dialogue_camera_transition(float, void *) __asm__("FUN_L01_002783a8"); extern void FUN_L02_002e0cd8(void *); extern void FUN_L16_002e70c0(struct Moby *); extern void FUN_L16_002e7168(struct Moby *); @@ -1436,7 +1441,8 @@ extern void subtract_vector_xyz(void *, void *, void *); extern char D_00141968[]; extern L16ChallengePlayer D_0013E633_challenge __asm__("D_0013E533"); -void FUN_L16_002e6808(L16ChallengeMoby *m) { +void gadgetron_ceo_update(L16ChallengeMoby *m) __asm__("FUN_L16_002e6808"); +void gadgetron_ceo_update(L16ChallengeMoby *m) { L16ChallengeScratch scratch; L16ChallengeData *d = m->data; L16ChallengeActivation *activation = (L16ChallengeActivation *)d->activation; @@ -1451,7 +1457,7 @@ void FUN_L16_002e6808(L16ChallengeMoby *m) { case 0: m->opacity = 255; m->state = 1; - FUN_L00_002668a0(m, activation); + initialize_npc_dialogue(m, activation); *(float *)((char *)d + 0x2C) = 3.7f; d->initial_yaw = m->yaw; if (*(int *)(D_0013D408 + 0x814) == 0) @@ -1463,12 +1469,12 @@ void FUN_L16_002e6808(L16ChallengeMoby *m) { D_L16_0015F638 = 115.0f; else D_L16_0015F638 = 100.0f; - if (FUN_L00_00266448(m, (char *)d + 0x20)) { + if (update_npc_dialogue(m, (char *)d + 0x20)) { m->yaw = d->initial_yaw; - FUN_L01_002783a8(3.5f, m); + begin_dialogue_camera_transition(3.5f, m); m->state = 2; } - if (!D_0013D4DE && FUN_001f9b80(&hero.motion.pos, m->position) < 3.5f) { + if (!D_0013D4DE && vector_distance(&hero.motion.pos, m->position) < 3.5f) { int elapsed, period; char *statistics; elapsed = scale_game_frames(freeze_stats_score_ref_b[14]); @@ -1583,7 +1589,7 @@ void FUN_L16_002e6808(L16ChallengeMoby *m) { if (m->animation == 0) { char *player = (char *)&D_0013E633_challenge + 0xE9D; tracking = 1; - if (FUN_001f9b80(m->position, player) < 8.0f && + if (vector_distance(m->position, player) < 8.0f && FUN_001f9e90_cf( m->yaw, FUN_001fa688_cf( @@ -1639,14 +1645,14 @@ void FUN_L16_002e6808(L16ChallengeMoby *m) { } if (D_0015EDB0_b) *(float *)((char *)d + 0x150) = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); } /* Ported from rac1-decomp (src/overlays/l16_kalebo3/vendor_002E7C70.c: func_L16_002E8538), where it is exact; names translated to the US level program. */ extern f32 D_L16_0015F638 ; -extern void FUN_L01_0027a248(int, int); -extern void FUN_L13_002650a8(int, int, int, int); +extern void jet_game_state(int, int) __asm__("FUN_L01_0027a248"); +extern void jet_group_state(int, int, int, int) __asm__("FUN_L13_002650a8"); extern void FUN_L16_002de3b8(float f); void FUN_L16_002e70c0(struct Moby *moby) { @@ -1654,17 +1660,17 @@ void FUN_L16_002e70c0(struct Moby *moby) { int *p = (int *)(data + 0x60); int i; for (i = 15; i >= 0; i--) { - FUN_L13_002650a8(*p, 1, 1, 1); + jet_group_state(*p, 1, 1, 1); p++; } p = (int *)(data + 0xA0); for (i = 7; i >= 0; i--) { - FUN_L13_002650a8(*p, 0, 0, 0); + jet_group_state(*p, 0, 0, 0); p++; } *(float *)&D_L16_0015F638 = 74.0f; FUN_L16_002de3b8(76.0f); - FUN_L01_0027a248(2, 6); + jet_game_state(2, 6); } /* Ported from rac1-decomp (src/overlays/l16_kalebo3/vendor_002E7C70.c: func_L16_002E85E0), where it is exact; names translated to the US level program. */ @@ -1674,16 +1680,16 @@ void FUN_L16_002e7168(struct Moby *moby) { int i; p = (int *)(data + 0x60); for (i = 15; i >= 0; i--) { - FUN_L13_002650a8(p[0], 0, 0, 0); + jet_group_state(p[0], 0, 0, 0); p++; } p = (int *)(data + 0xA0); for (i = 7; i >= 0; i--) { - FUN_L13_002650a8(p[0], 1, 1, 0); + jet_group_state(p[0], 1, 1, 0); p++; } FUN_L16_002de3b8(100.0f); - FUN_L01_0027a248(0, 8); + jet_game_state(0, 8); } #ifndef NOT_SDA #define NOT_SDA __attribute__((section(".data"))) @@ -1757,8 +1763,8 @@ extern float D_L16_00161E7C __attribute__((sda)); extern float D_L16_00161E80 __attribute__((sda)); extern float D_L16_00161E8C __attribute__((sda)); extern int D_L16_00161E90 __attribute__((sda)); -extern int FUN_001fa728(char *, float); -extern int FUN_L00_0028d8c0(void *, int); +extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int allocate_voice_for_target_entry_alt(int, int, int) __asm__("FUN_0022da68"); extern void FUN_L16_002e7a30(unsigned char *, void *); extern void FUN_L16_002e7ba0(struct Moby *); @@ -1774,7 +1780,7 @@ void FUN_L16_002e76b8(unsigned char *m) { d = *(L16WalkerData_c **)(m + 0x78); path = D_L16_001B0930[d->path_index]; if (((*(unsigned short *)(m + 0xA6) ^ 1) & 1) != 0) { - if (FUN_L00_0028d8c0(m, d->sound) == 0) { + if (voice_is_playing(m, d->sound) == 0) { d->sound = allocate_voice_for_target_entry_alt(0, 4, (int)m); } else { playing = 1; @@ -1836,7 +1842,7 @@ void FUN_L16_002e76b8(unsigned char *m) { sample_camera_path(path, next, 0, trial, rotation, 1); trial[2] += height; trial[3] = 2.0f; - if (FUN_001fa728((char *)trial, (float)D_L16_00161E90) == -1) { + if (fast_bsphere_check((char *)trial, (float)D_L16_00161E90) == -1) { float random = random_float_between(D_L16_00161E70, D_L16_00161E74); d->parameter = next; @@ -2001,7 +2007,7 @@ typedef float W[4] __attribute__((aligned(16))); extern char D_L16_0016CC60[]; extern int D_L16_0015F5C4; extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void FUN_L00_00263b70(void *, void *, void *, float, float); +extern void draw_trail(void *, void *, void *, float, float) __asm__("FUN_L00_00263b70"); extern void normalize_vector_xyz(void *, void *, float); extern void subtract_vector_xyz(void *dst, void *a, void *b); @@ -2023,12 +2029,12 @@ void FUN_L16_002e7e00(struct Moby *moby) { moby_point_position(p, 4, c); subtract_vector_xyz(e, a, c); normalize_vector_xyz(e, e, k1); - FUN_L00_00263b70(a, a, e, k2, k3); + draw_trail(a, a, e, k2, k3); moby_point_position(p, 7, b); moby_point_position(p, 5, d); subtract_vector_xyz(f, b, d); normalize_vector_xyz(f, f, j1); - FUN_L00_00263b70(b, b, f, j2, j3); + draw_trail(b, b, f, j2, j3); } } break; @@ -2084,13 +2090,13 @@ typedef struct { extern char *D_L16_001600FC; extern f32 advance_accelerated_scalar(f32 *, f32 *, f32, f32, f32, f32) __asm__("func_00213F38"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float D_L16_00161EAC __attribute__((sda)); /* no foreign declaration */ extern float D_L16_00161EBC __attribute__((sda)); /* no foreign declaration */ -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int allocate_voice_for_target_entry_alt(int, int, int) __asm__("FUN_0022da68"); extern f32 D_L16_00161EB8_gp __asm__("D_L16_00161EB8") __attribute__((sda)); -extern void FUN_L00_00260738(char *, void *, void *, void *); +extern void update_entity_matrix(char *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void FUN_L16_002e84e8(struct Moby *); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void clear_u64_value(void *) __asm__("func_001F99F8"); @@ -2101,7 +2107,8 @@ extern void transform_vector(void *, void *, void *) __asm__("func_001F9D20"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("func_001F9CF8"); float absolute_float(float input) __asm__("func_001F99C0"); -void FUN_L16_002e7f80(L16PlatformMoby *moby) { +void elevator_update(L16PlatformMoby *moby) __asm__("FUN_L16_002e7f80"); +void elevator_update(L16PlatformMoby *moby) { L16PlatformVector delta, old_rotation, motion; L16PlatformData *d = moby->data; float *position = moby->position; @@ -2122,11 +2129,11 @@ void FUN_L16_002e7f80(L16PlatformMoby *moby) { moby->state = 2; break; case 2: - if (FUN_L00_0028d8c0(moby, d->particle)) { + if (voice_is_playing(moby, d->particle)) { release_voice_slot(d->particle); d->particle = -1; } - if (FUN_001f9b80(position, hero.motion.pos.f) < 20.0f) { + if (vector_distance(position, hero.motion.pos.f) < 20.0f) { clear_u64_value(motion.v); if (moby->reverse) { motion.v[2] = -1.0f; @@ -2161,7 +2168,7 @@ void FUN_L16_002e7f80(L16PlatformMoby *moby) { float *hero_position = hero.motion.pos.f; float speed; - if (FUN_001f9b80(hero_position, D_L16_001600FC + (d->joint << 7) + 0x30) > 2.25f + if (vector_distance(hero_position, D_L16_001600FC + (d->joint << 7) + 0x30) > 2.25f || absolute_float(moby->position[2] - hero_position[2] - 2.0f) > 1.0f || moby->position[2] < d->goal) { speed = advance_accelerated_scalar(&moby->position[2], &d->speed, d->goal, @@ -2174,12 +2181,12 @@ void FUN_L16_002e7f80(L16PlatformMoby *moby) { } clear_u64_value(motion.v); motion.v[2] = speed; - FUN_L00_00260738((char *)d->basis, motion.v, moby->rotation, moby->rotation); + update_entity_matrix((char *)d->basis, motion.v, moby->rotation, moby->rotation); if (motion.v[2] != 0.0f) { - if (!FUN_L00_0028d8c0(moby, d->particle)) { + if (!voice_is_playing(moby, d->particle)) { d->particle = allocate_voice_for_target_entry_alt(0, 4, (int)moby); } - } else if (FUN_L00_0028d8c0(moby, d->particle)) { + } else if (voice_is_playing(moby, d->particle)) { release_voice_slot(d->particle); d->particle = -1; } @@ -2195,7 +2202,7 @@ void FUN_L16_002e7f80(L16PlatformMoby *moby) { } } add_vector_xyz(delta.v, delta.v, moby->position); - FUN_L00_00260738((char *)d->basis, delta.v, old_rotation.v, moby->rotation); + update_entity_matrix((char *)d->basis, delta.v, old_rotation.v, moby->rotation); } } @@ -2326,7 +2333,8 @@ void FUN_L16_002e84e8(struct Moby *m) { } /* Ported from rac1-decomp (src/overlays/l16_kalebo3/vendor_002E7C70.c: func_L16_002E9D48), where it is exact; names translated to the US level program. */ -void FUN_L16_002e88d0(struct Moby *moby) { +void gadgetron_sign_update(struct Moby *moby) __asm__("FUN_L16_002e88d0"); +void gadgetron_sign_update(struct Moby *moby) { switch (moby->state) { case 0: { float size = moby->scale * 4.0f; @@ -2340,7 +2348,7 @@ void FUN_L16_002e88d0(struct Moby *moby) { } break; case 1: moby->rot.z = - FUN_001fa580(moby->rot.z, frame_time * -0.2617993950843811f); + fast_add_rotations(moby->rot.z, frame_time * -0.2617993950843811f); break; } } @@ -2350,7 +2358,7 @@ void FUN_L16_002e88d0(struct Moby *moby) { extern char *D_L16_0015FFD8; char *FUN_L16_002e8b08(int idx); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int FUN_001f9740_c(void *) __asm__("FUN_001f9740"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int FUN_L16_002e0e28(void *); @@ -2371,15 +2379,15 @@ void FUN_L16_002e8970(struct Moby *moby) { switch (moby->state) { case 0: moby->state = 1; - *(int *)(data + 0xC) = FUN_001f96f8(random_int_between(0xB4, 0x168)); + *(int *)(data + 0xC) = scale_game_frames(random_int_between(0xB4, 0x168)); break; case 1: - if (FUN_001f9b80(g, target + 0x10) > 3.0f) { + if (vector_distance(g, target + 0x10) > 3.0f) { if (FUN_L16_002e8b08(*(int *)data) != 0) { if (FUN_001f9740_c(data + 0xC)) { moby->state = 2; FUN_L16_002e0de0(target); - *(int *)(data + 0xC) = FUN_001f96f8(random_int_between(0xB4, 0x168)); + *(int *)(data + 0xC) = scale_game_frames(random_int_between(0xB4, 0x168)); } } } @@ -2440,7 +2448,7 @@ typedef struct { extern char D_L16_001671C0[]; extern float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); @@ -2459,7 +2467,7 @@ void FUN_L16_002e8b98(int n, Vec3f *p1, Vec3f *p2, int unused, float *out) { v[0] = p2[i].x; v[1] = p2[i].y; v[2] = p2[i].z; - FUN_001f9a28(a, v, D_L16_001671C0); + fast_vec_sub(a, v, D_L16_001671C0); fast_vec_normalize(a, a, 1.0f); w[3] = 1.0f; w[0] = p1[i].x; @@ -2468,7 +2476,7 @@ void FUN_L16_002e8b98(int n, Vec3f *p1, Vec3f *p2, int unused, float *out) { fast_vec_normalize(w, w, 1.0f); d = fast_vec_dot(w, a); fast_vec_scale(t, w, d + d); - FUN_001f9a28(t, a, t); + fast_vec_sub(t, a, t); fast_vec_normalize(t, t, 1.0f); t[2] = t[2] + 1.0f; len = fast_vec_length(t); @@ -2482,7 +2490,7 @@ void FUN_L16_002e8b98(int n, Vec3f *p1, Vec3f *p2, int unused, float *out) { extern char D_L16_001DC600[][16] __attribute__((section(".data"))); extern char D_L16_001DC630[] __attribute__((section(".data"))); -extern int FUN_001fa728(char *, float); +extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern int get_effect_texture_l16(int) __asm__("FUN_001f44b8"); int D_L16_00161EF0_gp[4] __asm__("D_L16_00161EF0") __attribute__((section(".sdata"))) = {148, 148, 25, 0}; extern float D_L16_001D98D0[]; @@ -2520,7 +2528,7 @@ void FUN_L16_002e8d40(void) { vu1_add_g_sregister_l16(0x14, 0xFF9000000260); font_queue_vu_state(); for (i = 0; i < 3; i++) { - if (FUN_001fa728(D_L16_001DC600[i], 512.0f) != -1) { + if (fast_bsphere_check(D_L16_001DC600[i], 512.0f) != -1) { FUN_L16_002e8b98_i(a[i], d[i], b[i], c[i], D_L16_001DC630); FUN_L00_001fde98(a[i], b[i], e[i], D_L16_001DC630, 1); } @@ -2631,7 +2639,7 @@ void FUN_L16_002e9270(void) { vu1_add_g_sregister_2e9270(0x14, 0xFF9000000260); font_queue_vu_state(); for (i = 0; i < 1; i++) { - if (FUN_001fa728(D_L16_00161F80_t[i], 512.0f) != -1) { + if (fast_bsphere_check(D_L16_00161F80_t[i], 512.0f) != -1) { FUN_L16_002e8b98_t(a[i], d[i], b[i], c[i], D_L16_001DDC80); FUN_L00_001fde98(a[i], b[i], e[i], D_L16_001DDC80, 1); } @@ -2900,3 +2908,5 @@ void FUN_L16_002ea128(unsigned char *m) { break; } } + +s32 D_L16_0016CDE4[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/l16/gameplay/entities/rocket.c b/src/overlays/l16/gameplay/entities/rocket.c index 61bd514f1a..8001a2d556 100644 --- a/src/overlays/l16/gameplay/entities/rocket.c +++ b/src/overlays/l16/gameplay/entities/rocket.c @@ -27,9 +27,9 @@ int FUN_L16_002c4710(Level16VendorMoby *moby) { /* Ported from rac1-decomp (src/overlays/l16_kalebo3/vendor_002A50F0.c: func_L16_002C75D0), where it is exact; names translated to the US level program. */ extern char *func_0020D348_m(int); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void FUN_L00_00250df8(void *); extern char *func_0020D348_m(int) __asm__("FUN_0020c4f8"); @@ -44,12 +44,12 @@ unsigned char *FUN_L16_002c6268(int a, void *pos, float *dir, int c, float f) { *(int *)(data + 0x20) = a; *(float *)(data + 0x24) = f; *(int *)(data + 0x28) = c; - *(short *)(data + 0xC) = FUN_001f96f8(5); - *(short *)(data + 0xE) = FUN_001f96f8(0xF); + *(short *)(data + 0xC) = scale_game_frames(5); + *(short *)(data + 0xE) = scale_game_frames(0xF); qcopy(moby + 0x10, pos); qcopy(data + 0x10, dir); *(float *)(moby + 0x40) = random_float_between_alt(-180.0f, 180.0f) * DEG_TO_RAD; - *(float *)(moby + 0x48) = FUN_001f9e90(dir[0], dir[1]) + 1.5707964f; + *(float *)(moby + 0x48) = fast_arc_tan(dir[0], dir[1]) + 1.5707964f; FUN_L00_00250df8(moby); } return moby; @@ -58,7 +58,7 @@ unsigned char *FUN_L16_002c6268(int a, void *pos, float *dir, int c, float f) { /* Ported from rac1-decomp (src/overlays/l16_kalebo3/vendor_002A50F0.c: func_L16_002CA848), where it is exact; names translated to the US level program. */ extern float D_0015ED6C; -extern float FUN_001fa580(float, float); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern void FUN_L16_002c9568(struct Moby *); extern void FUN_L16_002c9650_u(char *) __asm__("FUN_L16_002c9650"); f32 probe_ground_height(void *arg0, s32 arg1, f32 arg2) __asm__("FUN_00213508"); @@ -80,7 +80,7 @@ void FUN_L16_002c9480(struct Moby *m) { break; } case 1: - m->rot.z = FUN_001fa580(m->rot.z, D_0015ED6C * 4.1887903f); + m->rot.z = fast_add_rotations(m->rot.z, D_0015ED6C * 4.1887903f); FUN_L16_002c9650_u((char *)m); break; } @@ -105,7 +105,7 @@ void FUN_L16_002c9568(struct Moby *moby) { *(float *)(data + 0x1C) = 2.5f; arg = 0x3F; for (i = 3; i >= 0; i--, p++) { - *p = FUN_001f96f8(arg); + *p = scale_game_frames(arg); arg += 0x40; } *(float *)(data + 0x30) = 3.5f; @@ -117,7 +117,7 @@ void FUN_L16_002c9568(struct Moby *moby) { extern char *D_L16_0015FFD8; extern int *D_L16_001ABCC0_c[] __asm__("D_L16_001ABCC0"); -extern void FUN_L00_00260738(char *a, void *b, void *c, void *d); +extern void update_entity_matrix(char *a, void *b, void *c, void *d) __asm__("FUN_L00_00260738"); extern short *D_L16_001ABFC0_2CB000[] __asm__("D_L16_001ABCC0"); void FUN_L16_002c9c38(int index, void *arg) { @@ -126,7 +126,7 @@ void FUN_L16_002c9c38(int index, void *arg) { do { char *moby = D_L16_0015FFD8 + ((*(unsigned short *)p & 0x7FFF) << 8); if (*(short *)(moby + 0xA6) == 0x1D7) { - FUN_L00_00260738(*(char **)(moby + 0x78) + 0x20, arg, moby + 0x40, moby + 0x40); + update_entity_matrix(*(char **)(moby + 0x78) + 0x20, arg, moby + 0x40, moby + 0x40); } } while (*p++ >= 0); } @@ -162,7 +162,7 @@ void FUN_L16_002ceca8(int idx) { /* Ported from rac1-decomp (src/overlays/l16_kalebo3/vendor_002A50F0.c: func_L16_002D0870), where it is exact; names translated to the US level program. */ extern char D_0013E533[]; -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L16_002cf5c8_u() __asm__("FUN_L16_002cf5c8"); int FUN_L16_002cf738(void *mv); extern void allocate_voice_for_target_entry(int, int, void *) __asm__("FUN_0022da68"); @@ -187,7 +187,7 @@ void FUN_L16_002cf4a8(struct Moby *moby) { if (FUN_L16_002cf738(moby) != 0) { data[2] = state; enqueue_callback_list_1_alt(FUN_L16_002cf7a8_u, moby); - if (FUN_L00_0028d8c0(moby, data[3]) == 0) { + if (voice_is_playing(moby, data[3]) == 0) { data[3] = func_0022ED80_i(0, 4, moby); } } else if (data[2] != 0) { @@ -280,7 +280,8 @@ extern s32 SubtractIntegerWithClamp(s32); extern float D_L16_00161A84 __attribute__((sda)); extern int D_L16_00161A88 __attribute__((sda)); -void FUN_L16_002d5cb8(struct Moby *moby) { +void test_dummy_door_update(struct Moby *moby) __asm__("FUN_L16_002d5cb8"); +void test_dummy_door_update(struct Moby *moby) { char *data = (char *)moby->pvars; switch (moby->state) { case 0: @@ -399,7 +400,7 @@ extern float random_angle_radians(void) __asm__("FUN_00213308"); extern float random_float_between_alt_c(float, float) __asm__("FUN_002132a8"); extern int D_L16_0015F580_spark __asm__("D_L16_0015F580"); /* no foreign declaration */ extern int coll_line_fix() __asm__("FUN_001efa68"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern s32 scale_game_frames_c(s32) __asm__("FUN_001f96f8"); extern void set_vector_length_xy(void *, void *, float) __asm__("FUN_001f9c48"); extern void FUN_L00_0026cbb0(void *, void *, int, int, int, int, float); @@ -509,7 +510,7 @@ void FUN_L16_002a3f38(unsigned char *m) { break; qcopy(position, result->position); m[0x20] = impact_state; - } else if (FUN_001f9770(d + 4) || FUN_001f9b80_c(position, &player->motion.pos) > 60.0f) { + } else if (fast_dec_timer_s16(d + 4) || FUN_001f9b80_c(position, &player->motion.pos) > 60.0f) { remove: mark_moby_for_removal_a3f38(m); } @@ -547,7 +548,7 @@ extern char *D_L16_001B0930[]; extern float D_0015ED6C, D_0015EE70; extern float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern float FUN_001f9b80_c2(void *, void *) __asm__("FUN_001f9b80"); -extern int FUN_001fa728(char *, float); +extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern s32 allocate_voice_for_target_entry_u(s32, s32, void *) __asm__("func_0022DA68"); extern void sample_camera_path(void *, s32, void *, void *, s32, f32) __asm__("func_00214E58"); s32 is_point_inside_clip_volume(s32 arg0, s32 arg1) __asm__("FUN_00214720"); @@ -589,7 +590,7 @@ void FUN_L16_002c3d38(struct Moby *moby) { } if (moby->command) moby->collision = 0; - if (!FUN_L00_0028d8c0(moby, *(short *)(data + 0x14))) { + if (!voice_is_playing(moby, *(short *)(data + 0x14))) { *(short *)(data + 0x14) = func_0022ED80_i(0, 4, moby); } if (*(short *)(data + 0x16) == 0 && @@ -608,7 +609,7 @@ void FUN_L16_002c3d38(struct Moby *moby) { float pos[4]; qcopy(pos, path + 0x10); pos[3] = 3.0f; - if (FUN_001fa728((char *)pos, 64.0f) == -1) { + if (fast_bsphere_check((char *)pos, 64.0f) == -1) { moby->command = 0; *(int *)(data + 0x10) = 0; sample_camera_path((int *)path, 0, &moby->pos, &moby->rot.x, 0, @@ -728,14 +729,14 @@ extern f32 dot_vectors_xyz(void *, void *) __asm__("func_001F9AB0"); extern f32 vector_length_xyz_c(void *) __asm__("FUN_001f9af0"); extern char D_L16_0015F580n[] __asm__("D_L16_0015F580") __attribute__((section(".sdata"))); -extern int FUN_L00_001f0d60(float, void *, int, void *); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern int tick_countdown_32_alt(int *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern void FUN_L00_001ff660(void *, void *, void *); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, int, float, float, int, int, int, int); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void allocate_voice_for_target_entry_alt(int, int, void *) __asm__("FUN_0022da68"); extern void normalize_vector_xyz_c(void *, void *, f32) __asm__("FUN_001f9bf8"); extern void scale_vector_xyz_c(void *, void *, float) __asm__("FUN_001f9a68"); @@ -761,7 +762,7 @@ void FUN_L16_002c5eb0(L16FallingMoby *m) { scale_vector_xyz_c(d->velocity, d->velocity, 0.25f); } } - if (FUN_L00_001f0d60(0.333f, m->position, 2, 0)) { + if (coll_sphere(0.333f, m->position, 2, 0)) { normalize_vector_xyz_c(normal, D_L16_hitN.normal, 0.333f); if (dot_vectors_xyz(normal, d->velocity) < 0.0f) { FUN_L00_001ff660(d->velocity, d->velocity, normal); @@ -778,7 +779,7 @@ void FUN_L16_002c5eb0(L16FallingMoby *m) { m->state = 3; } else if (d->timer < scale_game_frames(45) && d->timer % scale_game_frames(10) == 0) { d->reaction = 250; - FUN_L00_0025d458(m, (short *)d); + trooper_anim_update(m, (short *)d); } d->velocity[2] -= d->gravity; break; @@ -787,17 +788,17 @@ void FUN_L16_002c5eb0(L16FallingMoby *m) { m->state = 3; } else if (d->timer < scale_game_frames(61) && d->timer % scale_game_frames(20) == 0) { d->reaction = 250; - FUN_L00_0025d458(m, (short *)d); + trooper_anim_update(m, (short *)d); } break; case 3: func_0022ED80_n(0, 0, m); - FUN_L00_0025e450(m, (int)D_L16_0015F580n, 0, 1.5f, 1.0f, 7, 10, 20, 3.0f, 1.7f, 4.0f, -1, + spawn_explosion(m, (int)D_L16_0015F580n, 0, 1.5f, 1.0f, 7, 10, 20, 3.0f, 1.7f, 4.0f, -1, 1.0f, 7.0f, 0, 7, -1, 0); mark_moby_for_removal(m); return; } - FUN_L00_0025d538(m, d); + trooper_anim_finish(m, d); } /* Ported from rac1-decomp (src/overlays/l16_kalebo3/vendor_002A50F0.c: func_L16_002CAA18), where it is exact; names translated to the US level program. */ @@ -814,8 +815,8 @@ extern int FUN_001f9740_c(int *) __asm__("FUN_001f9740"); extern int FUN_001fa6e0(float, int, int); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern unsigned char *FUN_L00_00272f68(void *, int, unsigned char, int, int, int, int, float); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); float absolute_float(float input) __asm__("func_001F99C0"); extern int func_001FA8A8_caa18(int, int, float) __asm__("FUN_001fa6e0"); @@ -829,10 +830,10 @@ void FUN_L16_002c9650(struct Moby *m) { float f; m->pos.z += 0.1f; - FUN_001f9a28(d, D_L16_001671C0, &m->pos); + fast_vec_sub(d, D_L16_001671C0, &m->pos); fast_vec_normalize(d, d, -0.3f); fast_vec_normalize(e, d, 0.1f); - FUN_001f9a10(d, d, &m->pos); + fast_vec_add(d, d, &m->pos); m->pos.z -= 0.1f; for (i = 0; i < 4; i++) { float h = p->a[i] + p->b[i]; @@ -843,13 +844,13 @@ void FUN_L16_002c9650(struct Moby *m) { p->a[i] = h + 255.0f; } if (FUN_001f9740_c(&p->c[i])) { - p->c[i] = FUN_001f96f8(0xFF); + p->c[i] = scale_game_frames(0xFF); } - f = convert_integer_to_float(FUN_001f96f8(0xFF) - p->c[i]); - f = f / (float)FUN_001f96f8(0xFF); + f = convert_integer_to_float(scale_game_frames(0xFF) - p->c[i]); + f = f / (float)scale_game_frames(0xFF); col = func_001FA8A8_caa18(0x4040FFFF, 0x1040FFFF, absolute_float(0.5f - f)); FUN_L00_00272f68(d, col, func_001FA898_caa18(p->a[i]) & 0xFF, 0x35, 1, 2, 0, p->d[i]); - FUN_001f9a10(d, d, e); + fast_vec_add(d, d, e); } } /* Updates a linked moby's movement and follows it while its state is active. */ @@ -865,7 +866,8 @@ extern void normalize_vector_xyz(void *out, void *a, f32 len) __asm__("FUN_001f9 s32 is_point_inside_clip_volume(s32 arg0, s32 arg1) __asm__("FUN_00214720"); extern float D_L16_0016198C __attribute__((sda)); -void FUN_L16_002c9878(struct Moby *m) { +void conveyor_belt_update(struct Moby *m) __asm__("FUN_L16_002c9878"); +void conveyor_belt_update(struct Moby *m) { char *d = (char *)m->pvars; float vec[4]; float target; @@ -1141,9 +1143,9 @@ extern f32 fast_cos(f32) __asm__("func_001F9DC8"); extern f32 fast_sin(f32) __asm__("func_001F9DE0"); extern float D_0015ED6C, D_0015EE70; extern float freeze_stats_score_ref_b __asm__("D_0015EE6C"), frame_time_sq; -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float FUN_L00_0025abf0(void *, void *, void *, float, float); -extern float FUN_L00_0025be00(float *, float *, float, float, float, float); +extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); extern float compute_interpolated_record_value(void *) __asm__("FUN_0020c9e0"); extern float probe_ground_height(void *, int, float); extern float random_angle_radians(void) __asm__("FUN_00213308"); @@ -1165,8 +1167,8 @@ void *FUN_L16_002d5db0(int index, void *position); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); extern void FUN_L00_00257470(void *, int, int); extern void make_hit_descriptor(void *, void *, int, float, void *) __asm__("FUN_L00_00259888"); -extern void FUN_L00_002598b0(int, float, void *, int, float, float, int, int, int); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void play_entity_sound(int, float, void *, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L00_0025f730(void *, float); extern void FUN_L00_00263ac8(float, int, int, unsigned char *); extern void FUN_L02_00264e40(char *); @@ -1188,7 +1190,8 @@ extern unsigned char *func_L16_002C75D0_2cf180(int, void *, float *, float, extern int func_L00_0025A8E8_2cf180(void *, float, void *, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); -void FUN_L16_002cddb8(unsigned char *m) { +void test_dummy_update(unsigned char *m) __asm__("FUN_L16_002cddb8"); +void test_dummy_update(unsigned char *m) { L16SparkVector v0, v1, v2; L16SparkQuery fx; L16DummyData *d = *(L16DummyData **)(m + 0x78); @@ -1260,7 +1263,7 @@ void FUN_L16_002cddb8(unsigned char *m) { v0.quad = *(u128 *)(path + d->node * 16 + 16); if (FUN_L16_002ced20( m, v0.f, - FUN_001f9e90(((float *)(path + (d->node << 4)))[4] - *(float *)(m + 16), + fast_arc_tan(((float *)(path + (d->node << 4)))[4] - *(float *)(m + 16), ((float *)(path + (d->node << 4)))[5] - *(float *)(m + 20)))) { d->timer = scale_game_frames(30); m[0x20] = 4; @@ -1302,12 +1305,12 @@ void FUN_L16_002cddb8(unsigned char *m) { if (compute_interpolated_record_value(m) < 15.0f) { v1.quad = *(u128 *)(m + 16); FUN_L16_002ced20( - m, v1.f, FUN_001f9e90(v0.f[0] - *(float *)(m + 16), v0.f[1] - *(float *)(m + 20))); + m, v1.f, fast_arc_tan(v0.f[0] - *(float *)(m + 16), v0.f[1] - *(float *)(m + 20))); } else { int node = (d->node + 1) & 1; v1.quad = *(u128 *)(m + 16); FUN_L16_002ced20(m, v1.f, - FUN_001f9e90(((float *)(path + (node << 4)))[4] - *(float *)(m + 16), + fast_arc_tan(((float *)(path + (node << 4)))[4] - *(float *)(m + 16), ((float *)(path + (node << 4)))[5] - *(float *)(m + 20))); } break; @@ -1345,9 +1348,9 @@ void FUN_L16_002cddb8(unsigned char *m) { case 6: { /* slider: turn toward the next node while the timer runs */ float *yaw = (float *)(m + 0x48); int next = d->node + d->step; - float angle = FUN_001f9e90(((float *)(path + (next << 4)))[4] - *(float *)(m + 16), + float angle = fast_arc_tan(((float *)(path + (next << 4)))[4] - *(float *)(m + 16), ((float *)(path + (next << 4)))[5] - *(float *)(m + 20)); - FUN_L00_0025be00(yaw, &d->turn, angle, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, + approach_angle(yaw, &d->turn, angle, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, D_0015ED6C * 25.132742f); if (tick_countdown_32_alt(&d->timer)) { d->node = next; @@ -1381,16 +1384,16 @@ void FUN_L16_002cddb8(unsigned char *m) { v0.quad = *(u128 *)(m + 16); FUN_L16_002ced20( m, v0.f, - FUN_001f9e90(d->target[0] - *(float *)(m + 16), d->target[1] - *(float *)(m + 20))); + fast_arc_tan(d->target[0] - *(float *)(m + 16), d->target[1] - *(float *)(m + 20))); } if (d->child) { char *slots; moby_point_position(d->child, 0, v0.f); slots = d->slots; v1.f[0] = - fast_cos(FUN_001f9e90(v0.f[0] - *(float *)(m + 16), v0.f[1] - *(float *)(m + 20))); + fast_cos(fast_arc_tan(v0.f[0] - *(float *)(m + 16), v0.f[1] - *(float *)(m + 20))); v1.f[1] = - fast_sin(FUN_001f9e90(v0.f[0] - *(float *)(m + 16), v0.f[1] - *(float *)(m + 20))); + fast_sin(fast_arc_tan(v0.f[0] - *(float *)(m + 16), v0.f[1] - *(float *)(m + 20))); v1.f[2] = 0.0f; FUN_L02_00264e70(slots, v0.f, v1.f, D_L16_001619D4); v1.f[3] = 5627.925f; @@ -1434,7 +1437,7 @@ void FUN_L16_002cddb8(unsigned char *m) { &D_L16_0015F580_c); qcopy(v0.f, position); v0.f[2] += 1.2f; - FUN_L00_0025f090(m, v0.f, -1, 0.5f, 10.0f); + cart_burst(m, v0.f, -1, 0.5f, 10.0f); FUN_L00_00257470(m, 0, -1); func_0022ED80_i(7, 0, m); d->lives--; @@ -1586,11 +1589,11 @@ void FUN_L16_002ce9f0(void *moby) { record = 0; } d->reaction_time = 120; - FUN_L00_0025d458(m, d->reaction); + trooper_anim_update(m, d->reaction); } } m->opacity = 255; - FUN_L00_0025d538(m, d->reaction); + trooper_anim_finish(m, d->reaction); if (d->child) { moby_point_position(m, D_L16_001619C8_gp, d->child->position); build_moby_bone_transform((char *)m, D_L16_001619C8_gp, (char *)matrix); @@ -1600,7 +1603,7 @@ void FUN_L16_002ce9f0(void *moby) { normalize_vector_xyz_c2(d->child->matrix[2], d->child->matrix[2], 1.0f); FUN_L00_00250df8(d->child); } - FUN_L00_0025d538(m, d->reaction); + trooper_anim_finish(m, d->reaction); } #include "sda.h" @@ -1612,7 +1615,7 @@ extern float advance_accelerated_scalar(float, float, float, float, float *, extern f32 vector_length_xyz(void *a) __asm__("FUN_001f9af0"); extern float D_0015ED6C, D_0015EE70; extern float freeze_stats_score_ref_b __asm__("D_0015EE6C"), frame_time_sq; -extern float FUN_L00_0025be00(float *, float *, float, float, float, float); +extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void subtract_vector_xyz(void *out, void *a, void *b) __asm__("FUN_001f9a28"); @@ -1623,7 +1626,7 @@ int FUN_L16_002ced20(char *moby, void *vec, float angle) { float dist; char *data = *(char **)(moby + 0x78); *(OvlQuad *)a = *(OvlQuad *)vec; - FUN_L00_0025be00((float *)(moby + 0x48), (float *)(data + 0x100), angle, + approach_angle((float *)(moby + 0x48), (float *)(data + 0x100), angle, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, D_0015ED6C * 25.132742f); speed = 0.0f; subtract_vector_xyz(b, a, moby + 0x10); @@ -1766,7 +1769,8 @@ extern void allocate_voice_for_target_entry(int, int, void *) __asm__("FUN_0022d extern int func_0022ED80_i(int, int, void *) __asm__("FUN_0022da68"); extern int func_001FA898_caa18(float) __asm__("FUN_001fa6d0"); -void FUN_L16_002cf198(struct Moby *m) { +void wall_button_update(struct Moby *m) __asm__("FUN_L16_002cf198"); +void wall_button_update(struct Moby *m) { char *d = (char *)m->pvars; switch ((*(unsigned char *)((char *)(m) + (0x20)))) { case 0: @@ -2012,7 +2016,7 @@ typedef struct { extern char *D_L16_001B0930[]; extern float vector_distance_xy(void*,void*) __asm__("FUN_001f9b80"); -extern float FUN_001f9e90(float,float); +extern float fast_arc_tan(float,float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("func_001FA688"); extern int FUN_L00_0025d7a0(char *, int, int, int); extern int FUN_L01_0028b510(void *, void *, float); @@ -2029,7 +2033,7 @@ void FUN_L16_002cf9f8(char *obj) { float heading, distance; FUN_L16_002cf9d0((Level16VendorVectorMoby_c *)moby, d->node, target); - heading = FUN_001f9e90(target[0] - moby->position[0], target[1] - moby->position[1]); + heading = fast_arc_tan(target[0] - moby->position[0], target[1] - moby->position[1]); for (;;) { L16PatrolPath *path; L16PatrolPath *base; @@ -2058,7 +2062,7 @@ void FUN_L16_002cf9f8(char *obj) { } /* The same two statements as before the loop, written out again: the compiler merges the copies. */ FUN_L16_002cf9d0((Level16VendorVectorMoby_c *)moby, d->node, target); - heading = FUN_001f9e90(target[0] - moby->position[0], target[1] - moby->position[1]); + heading = fast_arc_tan(target[0] - moby->position[0], target[1] - moby->position[1]); } } /* Adjust animation and pitch to the remaining time in a jump. */ @@ -2107,7 +2111,7 @@ extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int FUN_L00_002595a0(float *, float *, float, float, float); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); f32 compute_interpolated_record_value_u(struct InterpolatedStateEntry *arg0) __asm__("FUN_0020c9e0"); -void FUN_L00_002371e0(void); +void mine_blend_color(void) __asm__("FUN_L00_002371e0"); extern void func_L00_00237B70_anim(void *, int, int, int) __asm__("FUN_L00_002371e0"); void FUN_L16_002d0058(L16LeapMoby_u *m) { @@ -2120,7 +2124,7 @@ void FUN_L16_002d0058(L16LeapMoby_u *m) { float distance; next = FUN_L00_0025d7a0(d->path, d->node, 1, 1) * 16; distance = vector_distance_xy(d->path + (d->node * 16 + 0x10), d->path + (next + 0x10)); - pitch = FUN_001f9e90(distance, *(float *)(d->path + next + 0x18) - + pitch = fast_arc_tan(distance, *(float *)(d->path + next + 0x18) - ((L16LeapPath *)d->path)->points[d->node][2]); } FUN_L00_0025bc98(&m->pitch, &d->pitch_speed, 0, pitch, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f, @@ -2254,7 +2258,7 @@ extern f32 fast_sin(f32) __asm__("func_001F9DE0"); extern float D_0015ED6C, D_0015EE70; extern float freeze_stats_score_ref_b __asm__("D_0015EE6C"), frame_time_sq; extern float vector_distance_xy(void *, void *) __asm__("FUN_001f9b80"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_0025bc98(void *, void *, int, float, float, float, float); extern float approach_value(float *p, float target, float maxstep); @@ -2265,7 +2269,7 @@ extern int D_00159F4C; /* no foreign declaration */ extern int D_L16_00161A0C __attribute__((sda)); extern int D_0015EE3C_gp __asm__("D_0015EE3C") __attribute__((sda)); extern char *D_L16_001B0930[]; -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int collect_mobies_in_sphere(float, void *, int, void *, void *) __asm__("FUN_L00_001f2868"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int FUN_L00_0025d7a0(char *, int, int, int); @@ -2274,10 +2278,10 @@ extern int FUN_L05_00307010(); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern unsigned char D_0013D4DF __attribute__((section(".data"))); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void FUN_L00_00259bc8(void *, int, int, void *, void *, float); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, int, float, float, int, int, int, int); -extern void FUN_L00_002628d8(float, float, void *, void *, int); +extern void spawn_nearby_effect(void *, int, int, void *, void *, float) __asm__("FUN_L00_00259bc8"); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); +extern void update_joint_animation(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); extern void FUN_L00_00263b38(void *, float); extern void FUN_L00_00263e30(void *, int, int, int, int, int, int); extern void FUN_L00_00269958(void *, void *, int, int, int, int, int, int); @@ -2294,7 +2298,8 @@ void FUN_L16_002cff48(struct Moby *moby); void FUN_L16_002d0058_c(L16LeapMoby *m) __asm__("FUN_L16_002d0058"); extern int D_L16_00161A08 __attribute__((sda)); -void FUN_L16_002d04a0(unsigned char *m) { +void test_dummy_on_hoverboard_update(unsigned char *m) __asm__("FUN_L16_002d04a0"); +void test_dummy_on_hoverboard_update(unsigned char *m) { float pos[4], delta[4], ahead[4], impact[4], spray[4], lateral[4], dust[4]; char *d = *(char **)(m + 0x78); char *g; @@ -2322,7 +2327,7 @@ void FUN_L16_002d04a0(unsigned char *m) { qcopy(d + 0x260, m + 0x10); *(int *)(m + 0x40) = 0; *(int *)(m + 0x44) = 0; - *(float *)(m + 0x48) = FUN_001f9e90(*(float *)(path + 0x20) - *(float *)(path + 0x10), + *(float *)(m + 0x48) = fast_arc_tan(*(float *)(path + 0x20) - *(float *)(path + 0x10), *(float *)(path + 0x24) - *(float *)(path + 0x14)); *(unsigned char *)(d + 0x2B) = 1; time = D_0015ED6C; @@ -2377,7 +2382,7 @@ void FUN_L16_002d04a0(unsigned char *m) { L16RacePlayer *player = &D_L16_00167080; if (fast_difference_between_rotations( - FUN_001f9e90(*(float *)(m + 0x10) - player->position[0], + fast_arc_tan(*(float *)(m + 0x10) - player->position[0], *(float *)(m + 0x14) - player->position[1]), player->yaw) > 1.5707964f) { *(int *)(m + 0x94) = *(int *)(*(char **)(m + 0x24) + 0x10); @@ -2397,7 +2402,7 @@ void FUN_L16_002d04a0(unsigned char *m) { if (find_moby_hit(m, mask, 0)) { qcopy(pos, m + 0x10); pos[2] += 0.5f; - FUN_L00_0025e450(m, &D_L16_0015F580, pos, 0.0f, 0.0f, 5, 15, 25, 2.5f, 1.5f, 4.0f, -1, + spawn_explosion(m, &D_L16_0015F580, pos, 0.0f, 0.0f, 5, 15, 25, 2.5f, 1.5f, 4.0f, -1, 1.0f, 7.0f, 0, 9, -1, 0); FUN_L00_00263e30(m, 0x655, 1, 0x656, 2, 2, 0); FUN_L00_00263e30(m, 0x6FA, 1, 0x6FB, 1, 1, 0); @@ -2443,7 +2448,7 @@ void FUN_L16_002d04a0(unsigned char *m) { } FUN_L16_002d0058_c((L16LeapMoby *)m); FUN_L16_002cf9d0_c((Level16VendorVectorMoby *)m, *(short *)(d + 0x2F4), pos); - angle = FUN_001f9e90(pos[0] - *(float *)(m + 0x10), pos[1] - *(float *)(m + 0x14)); + angle = fast_arc_tan(pos[0] - *(float *)(m + 0x10), pos[1] - *(float *)(m + 0x14)); FUN_L00_0025bc98(m + 0x48, d + 0x2C4, 0, angle, frame_scale_sq * 0.035f, frame_scale_sq * 0.3f, D_0015ED6C * 6.981317f); if (*(float *)(d + 0x268) < pos[2] - 5.0f) { @@ -2461,7 +2466,7 @@ void FUN_L16_002d04a0(unsigned char *m) { scale_vector_xyz(impact, delta, 7.0f); for (i = 0; i < n; i++) { if (FUN_L00_0025e3b8((int)D_L16_00178300[i])) { - FUN_L00_00259bc8(D_L16_00178300[i], (int)m, mask, d + 0x260, impact, 1.0f); + spawn_nearby_effect(D_L16_00178300[i], (int)m, mask, d + 0x260, impact, 1.0f); } } } @@ -2475,7 +2480,7 @@ void FUN_L16_002d04a0(unsigned char *m) { *(int *)(d + 0x2E4) = 0; } *(float *)(d + 0x268) += *(float *)(d + 0x2C8); - if (FUN_001f9770(d + 0x2F6)) { + if (fast_dec_timer_s16(d + 0x2F6)) { speed = *(float *)(d + 0x2B4); if (z < *(float *)(d + 0x268)) { speed = D_0015ED6C * 19.0f; @@ -2518,11 +2523,11 @@ void FUN_L16_002d04a0(unsigned char *m) { *(float *)(d + 0xC8) = rate * 20.0f; *(float *)(d + 0x1C8) = rate * 50.0f; *(float *)(d + 0x144) = rate * 40.0f; - FUN_L00_002628d8(coefficient * 0.02f, coefficient * 0.3f, m, d + 0x1E0, 3); + update_joint_animation(coefficient * 0.02f, coefficient * 0.3f, m, d + 0x1E0, 3); } - FUN_L00_002628d8(frame_scale_sq * 0.02f, frame_scale_sq * 0.3f, m, d + 0x60, 0); - FUN_L00_002628d8(frame_scale_sq * 0.02f, frame_scale_sq * 0.3f, m, d + 0x160, 1); - FUN_L00_002628d8(frame_scale_sq * 0.015f, frame_scale_sq * 0.3f, m, d + 0xE0, 2); + update_joint_animation(frame_scale_sq * 0.02f, frame_scale_sq * 0.3f, m, d + 0x60, 0); + update_joint_animation(frame_scale_sq * 0.02f, frame_scale_sq * 0.3f, m, d + 0x160, 1); + update_joint_animation(frame_scale_sq * 0.015f, frame_scale_sq * 0.3f, m, d + 0xE0, 2); qcopy(m + 0x10, d + 0x260); { float bob_time = D_0015ED6C; @@ -2576,7 +2581,8 @@ extern float advance_accelerated_scalar(float, float, float, float, float *, extern void add_vector_xyz(void *, void *, void *); extern void normalize_vector_xyz(void *, void *, float); -void FUN_L16_002d59e0(unsigned char *moby) { +void door_update(unsigned char *moby) __asm__("FUN_L16_002d59e0"); +void door_update(unsigned char *moby) { char *d = *(char **)(moby + 0x78); char *pos; char buf[16]; @@ -2852,7 +2858,7 @@ extern char *D_L16_001B0930[]; extern int D_L16_001600EC; /* no foreign declaration */ extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); extern void lerp_vector(void *, void *, void *, float) __asm__("FUN_001f9a40"); -extern void FUN_001f9cf8(void *, void *, void *); +extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern float D_L16_00161A8C __attribute__((sda)); void FUN_L16_002d6260(struct Moby *moby, void *out1, float *out2) { @@ -2860,9 +2866,9 @@ void FUN_L16_002d6260(struct Moby *moby, void *out1, float *out2) { float v[4]; char *entry = D_L16_001600EC + (*(int *)data << 7); char *tbl = D_L16_001B0930[*(int *)(data + 0xC)]; - FUN_001f9a28(v, &hero.motion.pos, entry + 0x30); + fast_vec_sub(v, &hero.motion.pos, entry + 0x30); v[3] = 0; - FUN_001f9cf8(v, v, entry + 0x40); + transform_vector_by_basis(v, v, entry + 0x40); advance_accelerated_scalar((v[1] + 1.0f) * 0.5f, frame_time_sq, frame_time_sq, D_0015ED6C + D_0015ED6C, (float *)(data + 0x1C), (float *)(data + 0x20)); @@ -2885,3 +2891,4 @@ int FUN_L16_002e0e28(char *m) { } return 0; } + diff --git a/src/overlays/l16/gameplay/hero/002097a0.c b/src/overlays/l16/gameplay/hero/002097a0.c index 1552348fc0..c61c66a009 100644 --- a/src/overlays/l16/gameplay/hero/002097a0.c +++ b/src/overlays/l16/gameplay/hero/002097a0.c @@ -14,8 +14,8 @@ /* Per-frame update of the pickup/hit state flags from the state code. */ /* Ported from rac1-decomp (src/overlays/l16_kalebo3/help_00209D98.c: func_L16_00209D98), where it is exact; names translated to the US level program. */ -extern int FUN_001f0b58(void); -extern int FUN_L00_001f0d60(float, void *, int, void *); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern void fast_mem_zero16(void *, int) __asm__("FUN_001f9810"); extern void FUN_L00_0020b930(void); extern int hero_set_state(int, int) __asm__("FUN_L16_0021e398"); @@ -66,8 +66,8 @@ void FUN_L16_002097a0(void) { if (v == 0xD) { struct Hero *q = &hero; if (q->state.current != 0x7B) { - if (FUN_L00_001f0d60(q->unk234 + 0.03f, &q->motion.unkD0, 2, 0)) { - if (FUN_001f0b58() == 0xB) { + if (coll_sphere(q->unk234 + 0.03f, &q->motion.unkD0, 2, 0)) { + if (collision_hit_material() == 0xB) { hero_set_state(0x7B, 1); return; } @@ -142,7 +142,7 @@ void FUN_L16_002097a0(void) { /* Ported from rac1-decomp (src/overlays/l16_kalebo3/help_00209D98.c: func_L16_0020FEC8), where it is exact; names translated to the US level program. */ -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void FUN_L00_0025f730(void *a, float x); @@ -153,7 +153,7 @@ void FUN_L16_0020f8b0(void) { qcopy(p, p - 0x670); q = p - 0x770; fast_vec_normalize(tmp, q, *(float *)(q + 0x194)); - FUN_001f9a10(p, p, tmp); + fast_vec_add(p, p, tmp); qcopy(p - 0x690, p); FUN_L00_0025f730(p - 0x690, *(float *)(q + 0x85C) + *(float *)(q + 0x868)); } @@ -166,17 +166,17 @@ extern u8 D_L16_00174260[] __attribute__((section(".data"))); void FUN_001f99f8_c(void *) __asm__("FUN_001f99f8"); void hero_get_collision_ray_endpoints(void *, void *, s32, f32, f32) __asm__("FUN_L00_002126b8"); -s32 FUN_001efa68(void *, void *, s32, s32, s32); +s32 collision_line(void *, void *, s32, s32, s32) __asm__("FUN_001efa68"); s32 coll_sound_class(void) __asm__("FUN_L00_001f3608"); s32 FUN_001f0b58_c(void) __asm__("FUN_001f0b58"); f32 resolve_camera_surface_height(void *, void *) __asm__("FUN_002135f0"); s32 FUN_L00_0025e3b8(s32); -u8 *FUN_002141f8(s32); +u8 *suck_get_aim_height(s32) __asm__("FUN_002141f8"); f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); void sceVu0Normalize(void *, void *) __asm__("FUN_00125180"); f32 FUN_L00_00233d30(void *); f32 FUN_001f9e90_c(f32, f32) __asm__("FUN_001f9e90"); -void FUN_001f9a28(void *, void *, void *); +void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); f32 FUN_001f9ab0_c(void *, void *) __asm__("FUN_001f9ab0"); void FUN_001f9a68_c(void *, void *, f32) __asm__("FUN_001f9a68"); void FUN_001f9bf8_c(void *, void *, f32) __asm__("FUN_001f9bf8"); @@ -222,7 +222,7 @@ void FUN_L16_0020ffb0(void) { g = hero.unk234 * 2.9f; } hero_get_collision_ray_endpoints(&v10, &v0, k, g, -48.0f); - if (FUN_001efa68(&v10, &v0, 2, (s32)hero.moby, 0) == 0) { + if (collision_line(&v10, &v0, 2, (s32)hero.moby, 0) == 0) { goto tail; } r = coll_sound_class(); @@ -236,7 +236,7 @@ void FUN_L16_0020ffb0(void) { if (hero.motion.pos.f[2] < hero.water_surface_z && hero.unk2F8 <= 0) { hero.unk2F8 = 1; } - if (FUN_001efa68(&v10, &v0, 0x24, (s32)hero.moby, 0) == 0) { + if (collision_line(&v10, &v0, 0x24, (s32)hero.moby, 0) == 0) { goto d1; } r = coll_sound_class(); @@ -248,7 +248,7 @@ void FUN_L16_0020ffb0(void) { if (hero.ground_type == 0xD) { hero.water_surface_z = HH.point.f[2]; v10.f[2] = HH.point.f[2] - 0.01f; - if (FUN_001efa68(&v10, &v0, 4, (s32)hero.moby, 0) == 0) { + if (collision_line(&v10, &v0, 4, (s32)hero.moby, 0) == 0) { goto d1; } } @@ -263,7 +263,7 @@ void FUN_L16_0020ffb0(void) { FUN_L00_002334d0((u8 *)&HH.point, (u8 *)&HH.point, 1.0f); } } - p = FUN_002141f8(HH.moby); + p = suck_get_aim_height(HH.moby); if (p != 0 && (*(u16 *)(p + 0x1E) & 8)) { hero.unk30A = 1; } @@ -276,7 +276,7 @@ void FUN_L16_0020ffb0(void) { sceVu0Normalize((u8 *)&hero.unk270, (u8 *)&HH.normal_x); hero.ground_slope.f = FUN_L00_00233d30((u8 *)&HH.normal_x); hero.downhill_yaw = FUN_001f9e90_c(HH.normal_x, HH.normal_y); - FUN_001f9a28(&v20, (u8 *)&hero.ground_point, (u8 *)&hero.motion.pos); + fast_vec_sub(&v20, (u8 *)&hero.ground_point, (u8 *)&hero.motion.pos); if (0.0f < FUN_001f9ab0_c(&v20, (u8 *)&hero.unk270)) { hero.ground_distance = -hero.ground_distance; } @@ -309,7 +309,7 @@ void FUN_L16_0020ffb0(void) { FUN_001f9a68_c((u8 *)&hero.gravity_dir, (u8 *)&hero.gravity_dir, -1.0f); break; case 2: - FUN_001f9a28((u8 *)&hero.gravity_dir, (u8 *)&hero.motion.unkB0, (u8 *)&hero.motion.pos); + fast_vec_sub((u8 *)&hero.gravity_dir, (u8 *)&hero.motion.unkB0, (u8 *)&hero.motion.pos); FUN_001f9bf8_c((u8 *)&hero.gravity_dir, (u8 *)&hero.gravity_dir, 1.0f); break; } @@ -342,7 +342,7 @@ void FUN_L16_0020ffb0(void) { } FUN_L00_002335c8(&v30, 0.2f, a, 0.45f); FUN_L00_002335c8(&v40, 0.2f, a, -0.45f); - if (FUN_001efa68(&v30, &v0, 0x22, (s32)hero.moby, 0)) { + if (collision_line(&v30, &v0, 0x22, (s32)hero.moby, 0)) { f = HH.point.f[2] - hero.ground_z.f; hero.unk2C0.f[i] = f; if (0.4f < FUN_001f99c0(f)) { @@ -371,16 +371,16 @@ typedef union { f32 f[4]; } V_2133a8; extern void vzero_2133a8(void *) __asm__("FUN_001f99f8"); -extern void f2347c0_2133a8(void) __asm__("FUN_L00_002347c0"); -extern void f233660_2133a8(void *, f32, f32, f32) __asm__("FUN_L00_00233660"); -extern void f233810_2133a8(void *, void *, f32) __asm__("FUN_L00_00233810"); -extern void f2334d0_2133a8(void *, void *, f32) __asm__("FUN_L00_002334d0"); +extern void FUN_L00_002347c0(void); +extern void FUN_L00_00233660(void *, f32, f32, f32); +extern void FUN_L00_00233810(void *, void *, f32); +extern void FUN_L00_002334d0(void *, void *, f32); extern void vadd_2133a8(void *, void *, void *) __asm__("FUN_001f9a10"); extern void vsub_2133a8(void *, void *, void *) __asm__("FUN_001f9a28"); extern f32 vlen_2133a8(void *) __asm__("FUN_001f9af0"); extern s32 coll1_2133a8(void *, s32, s32, f32) __asm__("FUN_L00_001f0d60"); extern s32 coll2_2133a8(void *, s32, f32, s32, f32) __asm__("FUN_L00_001f19a0"); -extern s32 coll3_2133a8(void *, f32) __asm__("FUN_L00_001f3170"); +extern s32 FUN_L00_001f3170(void *, f32); extern void vscl_2133a8(void *, void *, f32) __asm__("FUN_001f9bf8"); extern u128_2133a8 D_L16_00174270[] __attribute__((section(".data"))); s32 FUN_L16_00210b60(s32 mode) { @@ -397,19 +397,19 @@ s32 FUN_L16_00210b60(s32 mode) { qcopy(&old, &hero.motion.pos.q); vzero_2133a8(&v); if (hero.unk22DA != 0) { - f2347c0_2133a8(); + FUN_L00_002347c0(); hero.unk22DA = 0; } if (hero.state.control_mode != 0x11) { if (hero.state.control_mode == 0x16) { - f233660_2133a8(&v, 0.0f, 0.0f, 0.7f); + FUN_L00_00233660(&v, 0.0f, 0.0f, 0.7f); vsub_2133a8(&v, &v, &hero.motion.pos.q); } else if (hero.unk20B3 != 0 || hero.unk1F8 != 0) { if (hero.unk20B3 == 1 || hero.unk1F8 != 0 || (unsigned)(hero.state.control_mode - 0x15) < 2) { - f233810_2133a8(&v, &v, 0.6f); + FUN_L00_00233810(&v, &v, 0.6f); } else { - f2334d0_2133a8(&v, &v, -hero.unk224); + FUN_L00_002334d0(&v, &v, -hero.unk224); } } else { v.f[2] = hero.unk224; @@ -440,7 +440,7 @@ s32 FUN_L16_00210b60(s32 mode) { h = 0.05f; } a = coll2_2133a8(&hero.motion.pos.q, mask, hero.unk234, ((s32)hero.moby), h); - if (!(a | coll3_2133a8(&hero.motion.pos.q, hero.unk234))) + if (!(a | FUN_L00_001f3170(&hero.motion.pos.q, hero.unk234))) break; } c = D_L16_00174270; @@ -528,14 +528,14 @@ extern char *D_L16_00174258[]; extern f32 dot_vectors_xyz(void *, void *) __asm__("func_001F9AB0"); extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); -extern float FUN_L00_00213350(void *); -extern float FUN_L00_002339d0(float *v); -extern float FUN_L00_00233a78(float *); +extern float forward_component(void *) __asm__("FUN_L00_00213350"); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); +extern float gravity_z(float *) __asm__("FUN_L00_00233a78"); extern void set_vector_length_xy(void *, void *, float) __asm__("FUN_001f9c48"); extern void FUN_L00_00212ff0(void); extern void FUN_L00_002137a8(void); -extern void FUN_L00_002338d0(float *, float *); -extern void FUN_L00_00233b20(float *, float *, float); +extern void gravity_flatten(float *, float *) __asm__("FUN_L00_002338d0"); +extern void gravity_set_z(float *, float *, float) __asm__("FUN_L00_00233b20"); extern void FUN_L00_00233ba0(float *, float *, float); extern void FUN_L00_00233f80(int, void *, void *); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); @@ -543,7 +543,7 @@ extern void clear_u64_value(void *) __asm__("func_001F99F8"); extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); extern void scale_vector_xyz(void *, void *, float) __asm__("FUN_001f9a68"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); -s32 FUN_001efa68(void *, void *, s32, s32, s32); +s32 collision_line(void *, void *, s32, s32, s32) __asm__("FUN_001efa68"); void FUN_L16_0020ffb0(void); extern char D_0013F430[] __attribute__((section(".sdata"))); @@ -578,16 +578,16 @@ void FUN_L16_00211098(void) { float length; position = (float *)((char *)position + 0x60); - length = FUN_L00_002339d0(position); + length = gravity_length_xy(position); limit = player->speed_limit - 0.02f; if (limit < length) normalize_vector_xyz(position, position, limit); } limited_velocity = (float *)(&hero.motion.velocity); - magnitude = FUN_L00_00233a78(limited_velocity); + magnitude = gravity_z(limited_velocity); limit = -*(float *)((char *)limited_velocity + 0x1FC); /* the player's gravity_limit */ if (magnitude < limit) { if (limit > 0.0f) limit = 0.0f; - FUN_L00_00233b20(limited_velocity, limited_velocity, limit); + gravity_set_z(limited_velocity, limited_velocity, limit); } } else if (player->mode == 15) { /* The same vertical clamp as in mode 22 below, written out in both places: the compiler merges the two. */ @@ -612,7 +612,7 @@ void FUN_L16_00211098(void) { qcopy(work.f, position); work.f[2] += 0.5f; add_vector_xyz(plane.f, work.f, (char *)position + 0x60); - if (FUN_001efa68(position, plane.f, 2, 0, 0)) { + if (collision_line(position, plane.f, 2, 0, 0)) { char *hit = D_L16_00174258[0]; if (!hit || *(short *)(hit + 0xA6) == 0x1F6 || *(short *)(hit + 0xA6) == 0x59F) { @@ -670,8 +670,8 @@ void FUN_L16_00211098(void) { if (magnitude < 0.0f) magnitude = 0.0f; normalize_vector_xyz(delta, velocity, magnitude); qcopy(work.f, velocity); - FUN_L00_002338d0(work.f, work.f); - FUN_L00_002338d0(horizontal, horizontal); + gravity_flatten(work.f, work.f); + gravity_flatten(horizontal, horizontal); normalize_vector_xyz(horizontal, horizontal, 1.0f); magnitude = dot_vectors_xyz(horizontal, work.f); if (magnitude < 0.0f) magnitude = 0.0f; @@ -687,7 +687,7 @@ void FUN_L16_00211098(void) { motion_player->speed = vector_length_xyz(delta); motion_player->horizontal_speed = vector_length_xy(delta); work.q = *(OvlQuad *)delta; - motion_player->vertical_speed = FUN_L00_00213350(work.f); + motion_player->vertical_speed = forward_component(work.f); if (motion_player->vertical_speed < 0.0f) motion_player->vertical_speed = 0.0f; qcopy(work.f, new_position); contact = (float *)((char *)delta - 0x20); diff --git a/src/overlays/l16/gameplay/hero/00214598.c b/src/overlays/l16/gameplay/hero/00214598.c index 11508b1ff8..ac69fd323d 100644 --- a/src/overlays/l16/gameplay/hero/00214598.c +++ b/src/overlays/l16/gameplay/hero/00214598.c @@ -145,10 +145,10 @@ extern void FUN_L00_002132b8(f32, f32); extern void FUN_L00_00217118(f32, f32); extern void stick_target(f32, s32) __asm__("FUN_L00_002118c8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); -extern void FUN_L00_00211e30(s32, f32, f32, f32); +extern void turn_to(s32, f32, f32, f32) __asm__("FUN_L00_00211e30"); /* Same callee with the int argument last: one call site loads it after the floats. */ extern void FUN_L00_00211e30_b(f32, f32, f32, s32) __asm__("FUN_L00_00211e30"); -extern s32 FUN_001f9740(void *); +extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 FUN_L00_00229a98(void); extern void FUN_L00_00211e98(void); @@ -196,10 +196,10 @@ extern u8 D_L16_0017C420[]; extern void FUN_L00_00216e48(s32, struct MobyView *, s32); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); -extern s32 FUN_001f9770(s16 *); +extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); extern void FUN_L00_00209a40(s32, s32); extern void FUN_L00_00209ca8(s32, s32, s32); -extern void FUN_L00_002a3ec8(s32, s32, s32, f32, f32, f32, f32); +extern void pool_splash(s32, s32, s32, f32, f32, f32, f32) __asm__("FUN_L00_002a3ec8"); extern f32 FUN_L00_0025bc98(f32 *, f32, f32 *, s32, f32, f32, f32); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); @@ -213,7 +213,7 @@ extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 FUN_L00_00209018(void *, s32); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern void FUN_L00_0020a1e0(f32, f32); @@ -237,21 +237,21 @@ extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern s32 FUN_L00_002595a0(f32 *, f32 *, f32, f32, f32); extern f32 FUN_L00_0025bc00(f32 *, f32, s32, f32); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern f32 square_root(f32) __asm__("FUN_001f9988"); -extern f32 FUN_L00_00233a78(void *); -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); -extern f32 FUN_L00_00213350(void *); +extern f32 gravity_z(void *) __asm__("FUN_L00_00233a78"); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); +extern f32 forward_component(void *) __asm__("FUN_L00_00213350"); extern struct HeroTableRow2C D_L16_0017C088[]; extern struct LevelTable_QS D_L16_00167080; #define Q D_L16_00167080 extern void FUN_L00_00233ba0(void *, void *, f32); -extern void FUN_L00_00233b20(void *, void *, f32); +extern void gravity_set_z(void *, void *, f32) __asm__("FUN_L00_00233b20"); extern void FUN_L00_002336e8(void *, void *, f32); extern void make_hit_descriptor(void *, struct MobyView *, s32, f32, void *) __asm__("FUN_L00_00259888"); extern s32 collect_mobies_in_sphere(f32, void *, s32, struct MobyView *, void *) __asm__("FUN_L00_001f2868"); @@ -262,8 +262,8 @@ extern void FUN_L00_001ff290(void *, void *, void *); extern void FUN_L00_002a9b80(struct MobyView *, void *); extern s32 FUN_L00_002a96f8(struct MobyView *, void *, f32, f32, s32, f32, f32, f32); extern void FUN_L00_002335c8(void *, f32, f32, f32); -extern s32 FUN_L00_002598b0(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32); -extern f32 FUN_001f9ab0(void *, void *); +extern s32 play_entity_sound(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32) __asm__("FUN_L00_002598b0"); +extern f32 fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); struct PlayerSpeedTuning { u8 pad0[8]; f32 x08; @@ -275,13 +275,13 @@ extern struct PlayerSpeedTuning D_L16_0017C218; extern s32 FUN_L00_00216de8(s32, s32); extern void FUN_L00_00233708(void *, void *, f32); extern void FUN_L00_00233810(void *, void *, f32); -extern s32 FUN_001efa68(void *, void *, s32, struct MobyView *, s32); +extern s32 collision_line(void *, void *, s32, struct MobyView *, s32) __asm__("FUN_001efa68"); extern void FUN_L00_00215340(void); extern void FUN_L00_00233660(void *, f32, f32, f32); extern s32 FUN_L00_0025e3b8(s32); -extern void FUN_L00_00259bc8(s32, struct MobyView *, s32, void *, void *, f32); +extern void spawn_nearby_effect(s32, struct MobyView *, s32, void *, void *, f32) __asm__("FUN_L00_00259bc8"); extern void FUN_L00_00209ec8(void); -extern void FUN_L00_002338d0(void *, void *); +extern void gravity_flatten(void *, void *) __asm__("FUN_L00_002338d0"); extern s32 hero_slot_item_id(s32) __asm__("FUN_L00_0020d498"); extern void FUN_L00_0020b5b8(void); extern void FUN_L01_0022d090(void); @@ -294,7 +294,7 @@ extern void FUN_L00_0020d2f8(void *); extern f32 randf_sym(f32, f32) __asm__("FUN_L00_00257c48"); extern void FUN_L00_0026d598(void *, void *, s32); extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); -extern s32 FUN_L00_0025d808(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); +extern s32 sample_path(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); extern s32 FUN_L00_0025d7a0(void *, s32, s32, s32); extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); extern void hero_integrate_velocity(void) __asm__("FUN_L00_00214108"); @@ -355,8 +355,8 @@ void FUN_L16_00214598(void) { v0.f[0] = 1.0f; transform_vector_by_basis(&hero.motion.unk170, &v0, &D_L16_001671D8[0x1F8]); hero.motion.move_yaw = *(f32 *)D_L16_001671D8; - FUN_L00_00211e30(0, frame_scale_sq, frame_scale_sq * 0.0f, frame_time * 174.53293f); - if (D_L16_0015F688 > 0 && FUN_001f9740(&D_L16_0015F688) != 0) { + turn_to(0, frame_scale_sq, frame_scale_sq * 0.0f, frame_time * 174.53293f); + if (D_L16_0015F688 > 0 && fast_dec_timer(&D_L16_0015F688) != 0) { s32 t; if (usage_stats.stat[18].count < 0xFFFF) { usage_stats.stat[18].count++; @@ -379,7 +379,7 @@ void FUN_L16_00214598(void) { if (hero.state.current == HERO_STATE_CROUCH || hero.state.current == 0x17) { if (hero.unk229C > 0.2f || ((struct MobyView *)hero.moby)->b53 == 0xE || ((struct MobyView *)hero.moby)->b53 == 0xF) { if (hero.state.current == HERO_STATE_CROUCH) { - FUN_L00_00211e30(0, frame_scale_sq * 0.002f, frame_scale_sq * 0.07f, + turn_to(0, frame_scale_sq * 0.002f, frame_scale_sq * 0.07f, frame_time * 6.981317f); } else if (hero.state.current == 0x17) { FUN_L00_00211e98(); @@ -512,7 +512,7 @@ void FUN_L16_00214598(void) { } if (hero.unk90A != 0) { s32 n; - FUN_001f9770(&hero.unk90A); + fast_dec_timer_s16(&hero.unk90A); n = (s16)hero.unk90A >> 2; FUN_L00_00209a40(n > 8 ? 8 : n, 0); } @@ -526,7 +526,7 @@ void FUN_L16_00214598(void) { if (hero.state_timer == 1) { FUN_L00_00209ca8(3, 0x10, 0); if (D_L16_001612D0 != 0) { - FUN_L00_002a3ec8(D_L16_001612D0, D_L16_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L16_001612D0, D_L16_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, -0.3f); } hero.unk90A = scale_game_frames(70); @@ -635,9 +635,9 @@ void FUN_L16_00214598(void) { FUN_L00_0025bc98(&hero.motion.rot.f[1], steer, &hero.unk8E8, 0, accel, rate, lo); diff = fast_subtract_rotations(hero.motion.rot.f[1], old); stick_target(1.0f, 0); - FUN_L00_00211e30(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); + turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); hero.unk8EC = hero.motion.unk184; - FUN_001f9740(&hero.unk8F4); + fast_dec_timer(&hero.unk8F4); if (hero.state.step == 1) { hero.target_speed = frame_time * 6.0f; } else if (hero.state.current == 0x35) { @@ -667,7 +667,7 @@ void FUN_L16_00214598(void) { if (hero.state.current != 0x35 || !(PD.u1A0.i1A0 & 0xA)) { hero.target_speed *= k; }; - if (FUN_001f9740(&hero_b.unk8F0) != 0) { + if (fast_dec_timer(&hero_b.unk8F0) != 0) { s32 lo2; s32 hi2; pl = &hero_b; @@ -690,7 +690,7 @@ void FUN_L16_00214598(void) { } pl->unk8F0 = random_int_between(lo2, scale_game_frames(hi2)); } - if (hero.state.current == 0x35 && FUN_001f9770(&hero.unk8F8) != 0) { + if (hero.state.current == 0x35 && fast_dec_timer_s16(&hero.unk8F8) != 0) { struct MobyView *gm = (struct MobyView *)hero.items[3].moby; if (gm != NULL && gm->hA6 == 0x261) { s32 i; @@ -728,7 +728,7 @@ void FUN_L16_00214598(void) { } build_spherical_offset(&hero.motion.velocity, sp, hero.motion.rot.f[2], yaw); } else if (hero.state.current == 0x34) { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); if (hero.state.prev == 0x35) { approach_value(&len, 0.0f, frame_time_sq * 8.0f); } else { @@ -776,11 +776,11 @@ void FUN_L16_00214598(void) { break; case 0x6A: case 0x82: { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); approach_value(&len, 0.0f, frame_time_sq * 4.0f); fast_vec_normalize(&hero.motion.unk150, &hero.motion.unk150, len); qcopy(&hero.motion.velocity, &hero.motion.unk150); - if (FUN_001f9740(&hero.unk8F0) == 2) { + if (fast_dec_timer(&hero.unk8F0) == 2) { moby_point_position((struct MobyView *)hero.moby, 4, &v0); v20.q = 0; v20.f[0] = 0.4f; @@ -826,8 +826,8 @@ void FUN_L16_00214598(void) { hero.target_speed = frame_time * 3.0f * 0.5f; } } - FUN_L00_00211e30(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); - FUN_001f9740(&hero.unk698); + turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); + fast_dec_timer(&hero.unk698); if (hero.state.current == 0x36) { if (PD.i1D4 != 0 && hero.unk698 != 0) { hero.target_speed = frame_time * 3.0f; @@ -862,7 +862,7 @@ void FUN_L16_00214598(void) { s32 h; fast_vec_normalize(&v0, &hero.motion.displacement, 1.0f); a = 0; - d = FUN_001f9ab0(&hero.gravity_dir, &v0); + d = fast_vec_dot(&hero.gravity_dir, &v0); b = 0; if (d < -0.8f) { a = 1; @@ -870,7 +870,7 @@ void FUN_L16_00214598(void) { if (d < -0.5f) { b = 1; } - d = FUN_001f9ab0(&hero.unk270, &hero.unk770); + d = fast_vec_dot(&hero.unk270, &hero.unk770); fast_vec_normalize(&v10, &hero.unk270, d); subtract_vector_xyz(&hero.unk770, &hero.unk770, &v10); fast_vec_normalize(&hero.unk770, &hero.unk770, 1.0f); @@ -892,14 +892,14 @@ void FUN_L16_00214598(void) { f32 lim; qcopy(&hero.motion.velocity, &hero.motion.displacement); subtract_vector_xyz(&v10, &hero.unk760, &hero.motion.pos); - FUN_L00_002338d0(&v10, &v10); + gravity_flatten(&v10, &v10); lim = frame_time * 0.4f; - if (lim < FUN_001f9af0(&v10)) { + if (lim < fast_vec_length(&v10)) { fast_vec_normalize(&v10, &v10, lim); add_vector_xyz(&hero.motion.pos, &hero.motion.pos, &v10); } } - if (hero.air_frames.s != 0 && hero.unk88A == 0 && FUN_001f9ab0(&hero.gravity_dir, &hero.motion.displacement) < 0.0f) { + if (hero.air_frames.s != 0 && hero.unk88A == 0 && fast_vec_dot(&hero.gravity_dir, &hero.motion.displacement) < 0.0f) { if (a != 0 || (b != 0 && hero.unk88C != 0)) { f32 r; hero.unk88E = 1; @@ -914,7 +914,7 @@ void FUN_L16_00214598(void) { qcopy(&hero.motion.displacement, &hero.motion.velocity); } hero.unk88C = 0; - hero.unk854 = -FUN_001f9ab0(&hero.gravity_dir, &hero.motion.displacement); + hero.unk854 = -fast_vec_dot(&hero.gravity_dir, &hero.motion.displacement); } hero.unk88A = hero.air_frames.s; if (hero.air_frames.s == 0) { @@ -943,12 +943,12 @@ void FUN_L16_00214598(void) { if (a != 0 || b != 0) { hero.unk88C = 1; } else { - f32 t = -FUN_001f9ab0(&hero.gravity_dir, &hero.motion.displacement); + f32 t = -fast_vec_dot(&hero.gravity_dir, &hero.motion.displacement); hero.unk854 = frame_time * 5.0f; if (t > 0.0f) { hero.unk854 += t; } - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_00233810(&hero.motion.velocity, &hero.motion.velocity, hero.unk854); hero.air_frames.s = 1; } @@ -957,21 +957,21 @@ void FUN_L16_00214598(void) { FUN_L05_00237488(&v10, &hero.unk8D0, frame_scale_sq * 0.1f); if (hero.unk88E != 0) { FUN_L00_00211cf8(0.0f, 0.0f, v10.f[0] * (frame_time * 6.2831855f)); - } else if (FUN_001f9770(&hero.unk886) == 0) { + } else if (fast_dec_timer_s16(&hero.unk886) == 0) { qcopy(&hero.motion.unk170, &hero.unk750); - FUN_L00_00211e30(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f, frame_time * 6.981317f); + turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f, frame_time * 6.981317f); } else if (hero.unk229C > 0.2f) { f32 k = frame_time * 1.3962634f * hero.unk229C; hero.motion.move_yaw = fast_arc_tan(-v10.f[1], -v10.f[0]); stick_target(1.0f, 0); - FUN_L00_00211e30(0, frame_scale_sq * 0.004f, frame_scale_sq * 0.2f, k); + turn_to(0, frame_scale_sq * 0.004f, frame_scale_sq * 0.2f, k); } else { hero.motion.unk184 = 0.0f; } h = hero.air_frames.s; if (h == 0) { f32 lim = frame_time * 20.0f; - f32 t = -FUN_001f9ab0(&hero.motion.displacement, &hero.gravity_dir); + f32 t = -fast_vec_dot(&hero.motion.displacement, &hero.gravity_dir); f32 dd; pl0 = &hero; if (FUN_001f99c0(t) > frame_time * 0.5f) { @@ -1000,7 +1000,7 @@ void FUN_L16_00214598(void) { } } if (hero.air_frames.s != 0) { - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); hero.unk854 = hero.unk854 - hero.unk860; FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, -hero.unk854); } else { @@ -1066,25 +1066,25 @@ void FUN_L16_00214598(void) { } hero.unk88D = hero.unk89C && (PD.u1A0.i1A0 & 0xF); if ((((PD.u1A0.i1A0 & 0x80) || hero.unk8CC != 0) && hero.unk864 != 0) || hero.unk8C4 != 0) { - FUN_001f9770(&hero.unk8CC); + fast_dec_timer_s16(&hero.unk8CC); if (hero.unk884 == 0) { hero.unk8CC = scale_game_frames(20); } hero.unk884 = 1; - FUN_L00_0025b8c0(&hero.unk87C, &hero.unk858, 1.2217305f, frame_scale_sq * 0.01f, frame_scale_sq * 0.3f, + vendor_spring(&hero.unk87C, &hero.unk858, 1.2217305f, frame_scale_sq * 0.01f, frame_scale_sq * 0.3f, frame_time * 0.6981317f); approach_value(&hero.unk868, frame_time * 11.0f, frame_time_sq * 20.0f); if (hero.unk8C4 != 0) { - FUN_001f9740(&hero.unk8C4); + fast_dec_timer(&hero.unk8C4); } else { - FUN_001f9740(&hero.unk864); + fast_dec_timer(&hero.unk864); } if ((struct MobyView *)hero.unk86C != NULL) { ((struct MobyView *)hero.unk86C)->bBC = 1; } } else { hero.unk884 = 0; - FUN_L00_0025b8c0(&hero.unk87C, &hero.unk858, 1.2217305f, frame_scale_sq * 0.007f, frame_scale_sq * 0.3f, + vendor_spring(&hero.unk87C, &hero.unk858, 1.2217305f, frame_scale_sq * 0.007f, frame_scale_sq * 0.3f, frame_time * 0.5235988f); approach_value(&hero.unk868, 0.0f, frame_time_sq * 10.0f); } @@ -1205,7 +1205,7 @@ void FUN_L16_00214598(void) { for (i = 0; i < n; i++) { if (FUN_L00_0025e3b8(D_L16_00178300[i]) != 0 || ((struct MobyView *)D_L16_00178300[i])->hA6 == 0x85) { - FUN_L00_00259bc8(D_L16_00178300[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, 1.0f); + spawn_nearby_effect(D_L16_00178300[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, 1.0f); } } } @@ -1306,7 +1306,7 @@ void FUN_L16_00214598(void) { if ((struct MobyView *)hero.unk964 != NULL) { hero.motion.move_yaw = fast_arc_tan(((struct MobyView *)hero.unk964)->u10.f10 - moby->u10.f10, ((struct MobyView *)hero.unk964)->u10.f14.v - moby->u10.f14.v); - FUN_L00_00211e30(0, frame_scale_sq * 0.02f, frame_scale_sq * 0.15f, frame_time * 6.2831855f); + turn_to(0, frame_scale_sq * 0.02f, frame_scale_sq * 0.15f, frame_time * 6.2831855f); } break; case 0x25: { @@ -1322,7 +1322,7 @@ void FUN_L16_00214598(void) { approach_value(&hero.unk960, frame_time * 27.0f, frame_time_sq * 80.0f); hero.motion.move_yaw = fast_arc_tan(((struct MobyView *)hero.unk964)->u10.f10 - moby->u10.f10, ((struct MobyView *)hero.unk964)->u10.f14.v - moby->u10.f14.v); - FUN_L00_00211e30(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.15f, frame_time * 7.330383f); + turn_to(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.15f, frame_time * 7.330383f); } else if (hero.state.step == 1) { approach_value(&hero.unk960, 0.0f, frame_time_sq * 42.0f); } @@ -1339,7 +1339,7 @@ void FUN_L16_00214598(void) { FUN_L00_0025bc00(&hero.motion.rot.f[1], 0.0f, 0, frame_time * 3.8397243f); } else { f32 an = fast_add_rotations( - -fast_arc_tan(FUN_001f9b80(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); + -fast_arc_tan(vector_distance(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); FUN_L00_0025bc00(&hero.motion.rot.f[1], an, 0, frame_time * 6.4577184f); } v20.f[0] = fast_cos(fast_add_rotations(hero.motion.rot.f[2], -1.5707964f)) * -0.57f; @@ -1384,7 +1384,7 @@ void FUN_L16_00214598(void) { FUN_L00_0025bc98(&hero.unk9AC, a, &hero.unk9B8, 0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f, 0.0f); } hero.motion.move_yaw = hero.unk9AC; - FUN_L00_00211e30(0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f, frame_time * 4.712389f); + turn_to(0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f, frame_time * 4.712389f); subtract_vector_xyz(&v0, &((struct MobyView *)hero.unk994)->u10.v10, &hero.motion.pos); fast_vec_normalize(&v0, &v0, 1.0f); if (v0.f[2] < 0.23f) { @@ -1423,14 +1423,14 @@ void FUN_L16_00214598(void) { } if (hero.unk99C != 0) { f32 s; - if (FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { + if (vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.displacement, frame_time_sq * 40.0f); - if (hero.unk9BE != 0 && FUN_L00_00233a78(&hero.motion.velocity) > 0.0f) { + if (hero.unk9BE != 0 && gravity_z(&hero.motion.velocity) > 0.0f) { subtract_vector_xyz(&m80[3], &hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 57.0f); } } - s = FUN_001f9af0(&hero.motion.velocity) * (frame_time * 0.015f); + s = fast_vec_length(&hero.motion.velocity) * (frame_time * 0.015f); fast_vec_scale(&m80[3], &hero.motion.velocity, -1.0f); fast_vec_normalize(&m80[3], &m80[3], s); add_vector_xyz(&hero.motion.velocity, &hero.motion.velocity, &m80[3]); @@ -1438,7 +1438,7 @@ void FUN_L16_00214598(void) { { struct MobyView *r; if ((struct MobyView *)hero.unk994 != NULL && (r = ((struct MobyView *)hero.unk994)->pm78) != NULL) { - f32 len = FUN_001f9af0(&hero.motion.velocity); + f32 len = fast_vec_length(&hero.motion.velocity); if (r->fC < len) { approach_value(&len, r->fC, frame_time_sq * 15.0f); fast_vec_normalize(&hero.motion.velocity, &hero.motion.velocity, len); @@ -1459,9 +1459,9 @@ void FUN_L16_00214598(void) { add_vector_xyz(&m80[3], &((struct MobyView *)hero.unk994)->u10.v10, &vC0); subtract_vector_xyz(&hero.motion.velocity, &m80[3], &vD0); old = hero.unk9A4; - FUN_L00_0025b8c0(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); + vendor_spring(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); d = hero.unk9A4 - old; - if (FUN_001f9af0(&vC0) > hero.unk9A4) { + if (fast_vec_length(&vC0) > hero.unk9A4) { fast_vec_normalize(&vC0, &vC0, d); add_vector_xyz(&hero.motion.pos, &hero.motion.pos, &vC0); } @@ -1470,7 +1470,7 @@ void FUN_L16_00214598(void) { f32 mx = frame_time * 14.0f; f32 sp = vector_length_xy(&hero.motion.velocity); if (sp < mx) { - FUN_L00_0025b8c0(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); + vendor_spring(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); m80[3].f[0] = fast_cos(hero.unk9AC) * hero.unk9B4; m80[3].f[1] = fast_sin(hero.unk9AC) * hero.unk9B4; m80[3].f[2] = 0.0f; @@ -1487,7 +1487,7 @@ void FUN_L16_00214598(void) { up = hero.unk9BC == 1; } else { m80[3].q = hero.motion.displacement.q; - up = FUN_L00_00213350(&m80[3]) > 0.0f; + up = forward_component(&m80[3]) > 0.0f; } if (up) { if (moby->b53 != 0x35) { @@ -1523,12 +1523,12 @@ void FUN_L16_00214598(void) { mx = frame_time_sq * 70.0f; t2 = scale_game_frames(33); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk4B0); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unk4B8 = 1.0f; } } @@ -1560,7 +1560,7 @@ void FUN_L16_00214598(void) { } hero.target_speed = 0.0f; if ((struct MobyView *)hero.unkA54 != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = frame_time * 4.5f; } @@ -1573,7 +1573,7 @@ void FUN_L16_00214598(void) { } if (hero.unkA58 != 0 || (struct MobyView *)hero.unkA54 != NULL) { hero.motion.move_yaw = hero.unkA5C; - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); } else if (hero.anim_frame < 25.0f) { FUN_L00_00214ed8(8.0f, 1.0471976f, 1.0471976f); } @@ -1601,16 +1601,16 @@ void FUN_L16_00214598(void) { } FUN_L00_00211870(27.0f); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 130.0f); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unkA70 = 1.0f; } - if (FUN_L00_00233a78(&hero.motion.velocity) < frame_time * -37.0f) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); + if (gravity_z(&hero.motion.velocity) < frame_time * -37.0f) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); } } break; @@ -1639,10 +1639,10 @@ void FUN_L16_00214598(void) { } hero.motion.move_yaw = hero.unkA5C; if (ok) { - FUN_L00_00211e30(1, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, + turn_to(1, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); } else { - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); } } else { @@ -1680,7 +1680,7 @@ void FUN_L16_00214598(void) { tb = &D_L16_0017C088[hero.attack_record]; hero.target_speed = 0.0f; if ((struct MobyView *)hero.unkA54 != NULL && scale_game_frames(4) > hero.state_timer) { - f32 d = FUN_001f9b80(&((struct MobyView *)hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; + f32 d = vector_distance(&((struct MobyView *)hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; f32 off; f32 tol; f32 mx; @@ -1741,7 +1741,7 @@ void FUN_L16_00214598(void) { hero.anim_speed = 1.0f / (fast_difference_between_rotations(hero.unkA5C, hero.motion.rot.f[2]) + 1.0f); } hero.motion.move_yaw = hero.unkA5C; - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); } else { s32 ok = 1; if (tb->kind == 1 && hero.unkA9C == 0 && hero.anim_frame > 7.0f) { @@ -1776,14 +1776,14 @@ void FUN_L16_00214598(void) { hero.motion.velocity.f[2] = 0.0f; } hero.motion.move_yaw = fast_add_rotations(hero.unkA68, 3.1415927f); - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); break; case 0x20: { s32 t1; s32 t2; if (hero.unkA58 != 0 || (struct MobyView *)hero.unkA54 != NULL) { hero.motion.move_yaw = hero.unkA5C; - FUN_L00_00211e30(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); + turn_to(0, frame_scale_sq * 0.05f, frame_scale_sq * 0.2f, frame_time * 15.009831f); } else if (hero.state_timer < scale_game_frames(4)) { FUN_L00_00214ed8(11.0f, 0.87266463f, -1.0f); } @@ -1856,7 +1856,7 @@ void FUN_L16_00214598(void) { hero.target_speed = 0.0f; if (hero.unkA58 != 0) { hero.motion.move_yaw = hero.unkA5C; - FUN_L00_00211e30(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 15.009831f); + turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 15.009831f); } else { FUN_L00_00214ed8(11.0f, 0.87266463f, -1.0f); } @@ -1892,7 +1892,7 @@ void FUN_L16_00214598(void) { } { f32 g = hero.unk229C + 0.35f; - FUN_L00_00211e30(0, frame_scale_sq * 0.025f * g, frame_scale_sq * 0.3f, + turn_to(0, frame_scale_sq * 0.025f * g, frame_scale_sq * 0.3f, frame_time * 5.2359877f * g); } speed_step(frame_time_sq * 7.5f, frame_time_sq * 8.5f); @@ -1939,7 +1939,7 @@ void FUN_L16_00214598(void) { Vec4 *p = &hero.move_impulse; FUN_L00_002132b8(0.7f, 0.0f); v0.q = hero.move_impulse.q; - hero.target_speed += FUN_L00_00213350(&v0); + hero.target_speed += forward_component(&v0); if (hero.target_speed < frame_time * 0.7f) { hero.target_speed = frame_time * 0.7f; } @@ -1947,7 +1947,7 @@ void FUN_L16_00214598(void) { } k = 1.0f; if (hero.state.step == 1 && hero.unk3BE == 0) { - FUN_L00_00211e30(0, frame_scale_sq * 0.008f, frame_scale_sq * 0.15f, frame_time * 9.948377f); + turn_to(0, frame_scale_sq * 0.008f, frame_scale_sq * 0.15f, frame_time * 9.948377f); } else { f32 c = hero.unk229C; f32 r = hero.motion.unk188; @@ -1963,7 +1963,7 @@ void FUN_L16_00214598(void) { FUN_L00_00211f38(); } else { f32 f = hero.unk229C + 0.35f; - FUN_L00_00211e30(0, frame_scale_sq * 0.005f * f, frame_scale_sq * 0.1f, + turn_to(0, frame_scale_sq * 0.005f * f, frame_scale_sq * 0.1f, frame_time * 4.712389f * f); } } @@ -2022,14 +2022,14 @@ void FUN_L16_00214598(void) { v10.f[2] += random_float_between(frame_time, frame_time * 2.0f); FUN_L00_00271b18(&v0, &v10, random_float_between(37800.0f, 75600.0f)); } - f = FUN_001f9af0(&hero.motion.platform_delta); + f = fast_vec_length(&hero.motion.platform_delta); if (f > frame_time * 0.5f) { hero.motion.move_yaw = fast_arc_tan(hero.motion.platform_delta.f[0], hero.motion.platform_delta.f[1]); } else { hero.motion.move_yaw = hero.motion.rot.f[2]; } old = hero.motion.rot.f[2]; - FUN_L00_00211e30(0, f * 0.125f * frame_scale_sq, frame_scale_sq * 0.2f, frame_time * 4.1887903f); + turn_to(0, f * 0.125f * frame_scale_sq, frame_scale_sq * 0.2f, frame_time * 4.1887903f); d = fast_difference_between_rotations(hero.motion.rot.f[2], old); clear_u64_value(&hero.motion.velocity); FUN_L00_00216710(frame_time_sq * 5.0f); @@ -2129,9 +2129,9 @@ void FUN_L16_00214598(void) { if (hero.state.current == 0x42) { r = hero.unk5CC * (f32)hero.unk578; } - FUN_L00_0025d808((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); + sample_path((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); if (hero.unk590 != 0) { - FUN_L00_0025d808((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); + sample_path((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); } if (scale_game_frames(90) < hero.unk19C) { s32 h; @@ -2141,11 +2141,11 @@ void FUN_L16_00214598(void) { qcopy(&v20, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - h = FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); + h = sample_path((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); qcopy(&v30, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - if ((h | FUN_L00_0025d808((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || + if ((h | sample_path((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || hero.unk584 != 0) { f32 a = fast_subtract_rotations( hero.unk57C, fast_arc_tan(v30.f[0] - v20.f[0], v30.f[1] - v20.f[1])) * @@ -2202,7 +2202,7 @@ void FUN_L16_00214598(void) { } idx = FUN_L00_0025d7a0((void *)hero.unk560, hero.unk564, hero.unk578, hero.unk584); subtract_vector_xyz(&v20, (Vec4 *)hero.unk560 + (idx + 1), &v0); - if (FUN_001f9af0(&v20) < 0.001f) { + if (fast_vec_length(&v20) < 0.001f) { if (hero.unk564 == idx) { hero.unk570 = scale_game_frames(1); break; @@ -2212,13 +2212,13 @@ void FUN_L16_00214598(void) { hero.unk580 = fast_arc_tan(vector_length_xy(&v20), v20.f[2]); } hero.motion.move_yaw = fast_add_rotations(hero.unk57C, hero.unk588); - FUN_L00_00211e30(0, frame_scale_sq * 0.015f, frame_scale_sq * 0.15f, frame_time * 6.2831855f); + turn_to(0, frame_scale_sq * 0.015f, frame_scale_sq * 0.15f, frame_time * 6.2831855f); if (((hero.state.current == 0x29 || hero.state.current == 0x2A) && hero.unk418 == 0) || hero.state.current == 0x42) { if (hero.unk5C4 != 0) { f32 a = fast_arc_tan(hero.unk550.f[0] - hero.motion.pos.f[0], hero.unk550.f[1] - hero.motion.pos.f[1]); if (fast_difference_between_rotations(hero.motion.rot.f[2], a) < 1.5707964f) { hero.motion.move_yaw = a; - FUN_L00_00211e30(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, + turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 6.2831855f); } } @@ -2249,7 +2249,7 @@ void FUN_L16_00214598(void) { hero.motion.pos.f[2] += v20.f[2]; subtract_vector_xyz(&v30, &hero.unk500, &hero.motion.pos); v30.f[2] = 0.0f; - if (FUN_001f9af0(&v30) > frame_time) { + if (fast_vec_length(&v30) > frame_time) { fast_vec_normalize(&v30, &v30, frame_time); } hero.motion.pos.f[0] += v30.f[0]; @@ -2295,8 +2295,8 @@ void FUN_L16_00214598(void) { si = hero.unk564; sf = hero.unk568; qcopy(&v20, &hero.motion.pos); - FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); - e = fast_arc_tan(FUN_001f9b80(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); + sample_path((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); + e = fast_arc_tan(vector_distance(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); if (e > 0.0f) { sp = e * 1.9098593f * (frame_time * -2.5f); if (e > 0.2617994f && hero.unk5A8 != 2 && hero.unk5A8 != 3) { @@ -2333,9 +2333,9 @@ void FUN_L16_00214598(void) { f32 mx = frame_time * 7.0f; f32 fl; f32 len; - fl = -FUN_001f9af0(&v20); - FUN_L00_0025b8c0(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); - len = FUN_001f9af0(&v20); + fl = -fast_vec_length(&v20); + vendor_spring(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); + len = fast_vec_length(&v20); if (len < hero.unk5DC) { hero.unk5DC = len; } @@ -2363,7 +2363,7 @@ void FUN_L16_00214598(void) { case 0x18: case 0x19: hero.motion.move_yaw = fast_add_rotations(hero.unk4E4, 3.1415927f); - FUN_L00_00211e30(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 6.2831855f); + turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 6.2831855f); FUN_L00_0025bc00(&hero.motion.rot.f[1], 0.0f, 0, frame_time * 4.712389f); subtract_vector_xyz(&hero.motion.velocity, &hero.unk4D0, &hero.motion.pos); FUN_L00_0025f730(&hero.motion.velocity, frame_time * 4.0f); @@ -2410,7 +2410,7 @@ void FUN_L16_00214598(void) { add_vector_xyz(&m40[1], &v0, &v10); fast_vec_scale(&m40[1], &m40[1], 0.5f); hero.motion.move_yaw = a; - FUN_L00_00211e30(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 6.2831855f); + turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 6.2831855f); fl = hero.motion.unk164; approach_value(&fl, hero.target_speed * frame_time, frame_time_sq * 5.0f); subtract_vector_xyz(&hero.motion.velocity, &m40[1], &hero.motion.pos); @@ -2447,8 +2447,8 @@ void FUN_L16_00214598(void) { FUN_L00_00215340(); FUN_L00_002132b8(0.7f, frame_time * 0.0f); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; case 0x77: { @@ -2460,8 +2460,8 @@ void FUN_L16_00214598(void) { len = vector_length_xy(&hero.motion.velocity); FUN_L00_001ff600(frame_scale * -0.100000024f * len + len, &hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; } @@ -2481,13 +2481,13 @@ void FUN_L16_00214598(void) { } stick_target(hero.unk229C * m, 0); if (hero.unk229C > 0.2f && !(PD.u1A0.i1A0 & 3)) { - FUN_L00_00211e30(0, frame_scale_sq * 0.027f, frame_scale_sq * 0.3f, + turn_to(0, frame_scale_sq * 0.027f, frame_scale_sq * 0.3f, frame_time * 5.934119f * hero.unk229C); } if (PD.u1A0.i1A0 & 3) { f32 o = hero.motion.move_yaw; hero.motion.move_yaw = *(f32 *)D_L16_001671D8; - FUN_L00_00211e30(0, frame_scale_sq * 0.017f, frame_scale_sq * 0.3f, frame_time * 4.712389f); + turn_to(0, frame_scale_sq * 0.017f, frame_scale_sq * 0.3f, frame_time * 4.712389f); hero.motion.move_yaw = o; } { @@ -2500,11 +2500,11 @@ void FUN_L16_00214598(void) { FUN_L00_00215340(); FUN_L01_00232978(1); if (big) { - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); hero.unk304 = hero.motion.velocity.f[2]; } else { - FUN_L00_0025b8c0(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, + vendor_spring(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, frame_scale_sq * 0.35f, frame_time * 2.5f); } break; @@ -2535,11 +2535,11 @@ void FUN_L16_00214598(void) { sp = frame_time * 5.0f; } stick_target(sp, 0); - FUN_L00_00211e30(0, frame_scale_sq * 0.025f, frame_scale_sq * 0.3f, frame_time * 12.566371f); + turn_to(0, frame_scale_sq * 0.025f, frame_scale_sq * 0.3f, frame_time * 12.566371f); speed_step(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); FUN_L00_00215340(); - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); if (hero.motion.pos.f[2] < hero.unk410) { approach_value(&hero.unk410, hero.motion.pos.f[2], frame_time * 4.0f); @@ -2583,7 +2583,7 @@ void FUN_L16_00214598(void) { if (hero.state_timer == scale_game_frames(20)) { FUN_L00_00209ca8(3, 0x10, 1); if (D_L16_001612D0 != 0) { - FUN_L00_002a3ec8(D_L16_001612D0, D_L16_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L16_001612D0, D_L16_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, 0.35f); } } @@ -2599,7 +2599,7 @@ void FUN_L16_00214598(void) { if (hero.unk418 != 0 || (t198 < t420 && hero.state.current != HERO_STATE_HIGH_JUMP && hero.state.current != HERO_STATE_PACK_LONG_JUMP && hero.state.current != 0xC && hero.state.current != 0x11 && hero.state.current != 0x1C && hero.state.current != 0x4C)) { f32 sv; - FUN_L00_00211e30(0, frame_scale_sq * 0.015f, frame_scale_sq * 0.2f, frame_time * 15.009831f); + turn_to(0, frame_scale_sq * 0.015f, frame_scale_sq * 0.2f, frame_time * 15.009831f); sv = hero.ground_speed; if (hero.unk418 >= 2) { hero.ground_speed = sv * 0.4f; @@ -2633,7 +2633,7 @@ void FUN_L16_00214598(void) { qcopy(&v10, &v0); v10.f[0] += fast_cos(hero.motion.rot.f[2]) * 0.85f; v10.f[1] += fast_sin(hero.motion.rot.f[2]) * 0.85f; - if (FUN_001efa68(&v0, &v10, 4, (struct MobyView *)hero.moby, 0) != 0) { + if (collision_line(&v0, &v10, 4, (struct MobyView *)hero.moby, 0) != 0) { hero.unk4A4 = 1; } } @@ -2656,7 +2656,7 @@ void FUN_L16_00214598(void) { if (hero.motion.pos.f[2] < hero.unk410) { hero.unk410 = hero.motion.pos.f[2]; } - if (hero.state_timer > hero.unk420 && FUN_L00_00233a78(&hero.motion.velocity) < 0.001f && + if (hero.state_timer > hero.unk420 && gravity_z(&hero.motion.velocity) < 0.001f && (hero.unk41C == 0 || hero.state_timer > hero.unk3D4)) { hero.unk41E = 1; if (hero.unk3F8 != 0.0f) { @@ -2679,7 +2679,7 @@ void FUN_L16_00214598(void) { fast_vec_scale(&v10, &hero.motion.displacement, 7.0f); for (i = 0; i < n; i++) { if (FUN_L00_0025e3b8(D_L16_00178300[i]) != 0) { - FUN_L00_00259bc8(D_L16_00178300[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, + spawn_nearby_effect(D_L16_00178300[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, 1.0f); } } @@ -2733,12 +2733,12 @@ void FUN_L16_00214598(void) { } k = 1.0f; if (hero.vehicle_mode == 3) { - FUN_L00_00211e30(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, frame_time * 5.5850534f); + turn_to(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, frame_time * 5.5850534f); } else if (hero.vehicle_mode == 1) { - FUN_L00_00211e30(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, frame_time * 7.8539815f); + turn_to(0, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, frame_time * 7.8539815f); } else if (hero.vehicle_mode == 0) { if (hero.state.step == 1) { - FUN_L00_00211e30(0, frame_scale_sq * 0.016f, frame_scale_sq * 0.15f, + turn_to(0, frame_scale_sq * 0.016f, frame_scale_sq * 0.15f, frame_time * 9.948377f); } else { FUN_L00_00211f38(); @@ -2762,7 +2762,7 @@ void FUN_L16_00214598(void) { } case 0x66: subtract_vector_xyz(&v0, &hero.unk1640, &hero.motion.pos); - if (FUN_001f9ab0(&v0, &hero.motion.unk150) < 0.0f) { + if (fast_vec_dot(&v0, &hero.motion.unk150) < 0.0f) { clear_u64_value(&hero.motion.unk150); } clear_u64_value(&hero.motion.velocity); @@ -2827,7 +2827,7 @@ void FUN_L16_00214598(void) { if (k < 0.0f) { k = 0.0f; } - FUN_L00_00211e30(0, frame_scale_sq * 0.035f * g, frame_scale_sq * 0.1f, frame_time * 2.268928f * g); + turn_to(0, frame_scale_sq * 0.035f * g, frame_scale_sq * 0.1f, frame_time * 2.268928f * g); speed_step(frame_time_sq * 7.5f * k, frame_time_sq * 8.5f); if (hero.unk3B8 != 0 && hero.unk308 == 0) { set_planar_vel(hero.motion.move_yaw); @@ -2872,3 +2872,5 @@ void FUN_L16_00214598(void) { hero.unk1A4 = 0; } } + +f32 D_L16_0017AD50[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/l16/gameplay/hero/002270c8.c b/src/overlays/l16/gameplay/hero/002270c8.c index 8195a34f79..261b47ac4c 100644 --- a/src/overlays/l16/gameplay/hero/002270c8.c +++ b/src/overlays/l16/gameplay/hero/002270c8.c @@ -51,12 +51,12 @@ extern float D_L16_0015F638; extern float D_L16_001671D8 __attribute__((section(".data"))); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_00208f20(float a, float b, float c, float d); extern float FUN_L00_00232b90(float a, float b, float c); -extern float FUN_L00_00233a78(float *v); +extern float gravity_z(float *v) __asm__("FUN_L00_00233a78"); extern float FUN_L00_00233c30(float *pos, float *vel, int *steps, float step); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float FUN_L00_00259468(float *a, float *b, int *out, float f); @@ -73,7 +73,7 @@ extern int D_00141660 __attribute__((section(".data"))); int r1_repeat_timer __asm__("D_L16_0015F678") = 0; extern int D_L16_0015F594 __attribute__((sda)); extern int D_L16_0016CB80 __attribute__((section(".data"))); -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_002050b8(int); #include "rnc/overlay/path.h" @@ -89,7 +89,7 @@ extern int hero_handle_jump_press(void) __asm__("FUN_L00_00229660"); extern int FUN_L00_00229910(void); extern int FUN_L00_00229a98(void); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int FUN_L00_0025d808(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); +extern int sample_path(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); extern int FUN_L00_0025df68(void *, void *, void *, int *, float *, int, float, float, float); extern int pad_pressed_within(int, int, int *) __asm__("FUN_L00_00266d60"); extern int FUN_L00_00266e00(int, int, int, int); @@ -123,7 +123,7 @@ extern void FUN_L00_00232628(void); extern void FUN_L00_00232640(int id); extern void FUN_L00_00233288(float a, float b, short c, unsigned char d, unsigned char e, unsigned char f); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void hud_keep_visible(int, int) __asm__("FUN_L00_00235e18"); extern void FUN_L00_00237ae8(void); extern void FUN_L00_00237ba0(void); @@ -904,7 +904,7 @@ void FUN_L16_002270c8(void) { } break; case 101: - if (FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { + if (vector_distance(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { if (frame_time * 2.7f > hero.motion.speed_xy) { if (fast_difference_between_rotations( hero.motion.rot.f[2], hero.unk1640.f[3]) < 0.034906585f) { @@ -928,7 +928,7 @@ void FUN_L16_002270c8(void) { if ((hero.unkA98 & 2) || hero.unk1650 != 0) { hero_set_state(HERO_STATE_IDLE, 1); } - if (0.2f < FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f)) { + if (0.2f < vector_distance(hero.motion.pos.f, hero.unk1640.f)) { hero_set_state(0x65, 1); } break; @@ -1207,7 +1207,7 @@ void FUN_L16_002270c8(void) { v1[1] = fast_sin(hero.unk57C) * 5.0f; v1[2] = 0.0f; add_vector_xyz(v1, v1, v0); - if (FUN_001efa68(v0, v1, 2, 0, 0)) { + if (collision_line(v0, v1, 2, 0, 0)) { ok = 0; } } @@ -1373,7 +1373,7 @@ void FUN_L16_002270c8(void) { path_seg = hero.unk564; path_t = hero.unk568; /* Step a copy of the hero position along its current path. */ - if (FUN_L00_0025d808((int *)hero.unk560, v0, &path_seg, + if (sample_path((int *)hero.unk560, v0, &path_seg, &path_t, hero.unk584, d)) { scale_vector_xyz(v1, hero.motion.displacement.f, scale_game_frames(0x30)); @@ -1404,7 +1404,7 @@ void FUN_L16_002270c8(void) { } } if (hero.state_timer > hero.unk420) { - if (FUN_L00_00233a78(hero.motion.velocity.f) < 0.001f) { + if (gravity_z(hero.motion.velocity.f) < 0.001f) { hero.unk41E = 1; } } @@ -1639,7 +1639,7 @@ void FUN_L16_002270c8(void) { if (hero_set_state(HERO_STATE_IDLE, 0)) { set_hero_animation(0xC, 9, -1.0f); } - FUN_L00_00233b20(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); + gravity_set_z(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); FUN_L00_0025f730(hero.motion.unk150.f, frame_time * 7.0f); hero.unk1C4 = scale_game_frames(7); if (hero.state.prev == 0x2D) { @@ -2148,7 +2148,7 @@ void FUN_L16_002270c8(void) { scale_game_frames(0xE) < hero.state_timer && (hero.unk41E == 0 || (hero.ground_distance > 0.7f && - absolute_float(FUN_L00_00233a78(hero.motion.velocity.f)) < + absolute_float(gravity_z(hero.motion.velocity.f)) < frame_time * 5.8f))) { hero_set_state(0xE, 1); } else if (D_0013D4C0[2] != 0 && hero_slot_item_id(3) != 4 && diff --git a/src/overlays/l16/gameplay/hero/hero_set_state.c b/src/overlays/l16/gameplay/hero/hero_set_state.c index 005c71df65..4e1c101aab 100644 --- a/src/overlays/l16/gameplay/hero/hero_set_state.c +++ b/src/overlays/l16/gameplay/hero/hero_set_state.c @@ -30,10 +30,10 @@ extern char *hero_slot_moby(int) __asm__("FUN_L00_0020d460"); extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L16_0017C250[][25]; extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_0020d658(int back); -extern float FUN_L00_002339d0(float *v); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float dot_vectors_xyz(void *a, void *b); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); @@ -48,7 +48,7 @@ extern int FUN_L00_00216de8(int, int); extern int stick_direction_vs_facing(void) __asm__("FUN_L00_00221df8"); extern int FUN_L00_00229a98(void); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int FUN_L00_0025d808(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); +extern int sample_path(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); extern int FUN_L01_00226f10(int a); extern int FUN_L01_0028b510(void *, void *, float); extern int FUN_L05_002551b8(void); @@ -75,13 +75,13 @@ extern void FUN_L00_00214ed8(float a, float b, float c); extern void FUN_L00_00216ec0(int, int, int); extern void set_hero_animation(int, int, float) __asm__("FUN_L00_002323b8"); extern void FUN_L00_002325e0(int bank, int seq); -extern void FUN_L00_002338d0(float *dst, float *src); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_flatten(float *dst, float *src) __asm__("FUN_L00_002338d0"); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L00_00262500(int a, char *b); extern void FUN_L00_00262528(char *o, int a, int b); extern void FUN_L00_00262840(char *o); -extern void FUN_L00_002a3ec8(void *, int, int, float, float, float, float); +extern void pool_splash(void *, int, int, float, float, float, float) __asm__("FUN_L00_002a3ec8"); extern void FUN_L01_002405a0(void); extern void FUN_L05_00262ae8(void); extern void FUN_L05_00262b58(void); @@ -316,7 +316,7 @@ int hero_set_state(int a, int b) { if (p->state.prev_control_mode == 0x11) { FUN_L00_00209ca8(3, 0xA, 0); if (D_L16_001612D0 != 0) { - FUN_L00_002a3ec8(D_L16_001612D0, D_L16_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L16_001612D0, D_L16_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.4f, 0.3f); } } else if (p->motion.displacement.f[2] < frame_time * -0.5f) { @@ -326,7 +326,7 @@ int hero_set_state(int a, int b) { v = 0x28; FUN_L00_00209ca8(3, v, 1); if (D_L16_001612D0 != 0) { - FUN_L00_002a3ec8(D_L16_001612D0, D_L16_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L16_001612D0, D_L16_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.5f, -0.4f); } p->unk90A = scale_game_frames(0x4B); @@ -606,7 +606,7 @@ int hero_set_state(int a, int b) { clear_vector(v2); w = v2 + 0x70; qcopy(w, v2 + 0x30); - FUN_L00_002338d0((float *)w, (float *)w); + gravity_flatten((float *)w, (float *)w); FUN_L00_0025f730(w, frame_time * 9.5f); *(int *)(v2 + 0xF18) = 0x68; if (b) @@ -811,7 +811,7 @@ int hero_set_state(int a, int b) { char *v = (char *)&p->motion.unk110; p->state.control_mode = 1; p->unk2284 = 0; - p->ground_speed = FUN_L00_002339d0((float *)v); + p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.unk150, v); if (b) { int id = 6; @@ -867,7 +867,7 @@ int hero_set_state(int a, int b) { *(unsigned int *)(h + 0x64) | (1 << current_level_index) | 0x80000000; } p->motion.move_yaw = - FUN_001f9e90(*(float *)(((char *)p->unk964) + 0x10) - p->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)p->unk964) + 0x10) - p->motion.pos.f[0], *(float *)(((char *)p->unk964) + 0x14) - p->motion.pos.f[1]); if (b) { set_hero_animation(0x2F, 2, (float)scale_game_frames(5)); @@ -943,7 +943,7 @@ int hero_set_state(int a, int b) { if (*(float *)(d + 0x2C) != 0.0f) q->unk9CC = *(float *)(d + 0x2C); q->unk9AC = - FUN_001f9e90(*(float *)(((char *)q->unk994) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unk994) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unk994) + 0x14) - q->motion.pos.f[1]); q->unk9A4 = FUN_001f9b48(&q->motion.pos, ((char *)q->unk994) + 0x10); q->unk9B0 = frame_time_sq * 27.0f; @@ -1007,7 +1007,7 @@ int hero_set_state(int a, int b) { p->unk5C0 = 0; seg = p->unk564; t = p->unk568; - FUN_L00_0025d808(*(int **)&p->unk560, pos, &seg, &t, p->unk584, 1.0f); + sample_path(*(int **)&p->unk560, pos, &seg, &t, p->unk584, 1.0f); subtract_vector_xyz(vec, pos, &p->motion.pos); if (0.001f < vector_length_xyz(vec)) { normalize_vector_xyz(vec, vec, 1.0f); @@ -1019,11 +1019,11 @@ int hero_set_state(int a, int b) { struct Hero *q = &hero; if (((char *)q->unk5D8) != 0) { float ang = - FUN_001f9e90(*(float *)(((char *)q->unk5D8) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unk5D8) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unk5D8) + 0x14) - q->motion.pos.f[1]); if (1.5707964f < fast_difference_between_rotations( ang, fast_add_rotations(q->unk588, - FUN_001f9e90(vec[0], vec[1])))) { + fast_arc_tan(vec[0], vec[1])))) { q->unk588 = 1.5707964f; q->unk58C = 1; } @@ -1259,7 +1259,7 @@ int hero_set_state(int a, int b) { u->unk48C = 1.98f; u->unk430 = 1.95f; } else { - FUN_L00_00233b20((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); + gravity_set_z((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); u->unk41C = 1; u->unk3D0 = scale_game_frames(2); u->unk3D4 = scale_game_frames(0x23) + u->unk3D0; @@ -1517,7 +1517,7 @@ int hero_set_state(int a, int b) { if (1.5707964f < fast_difference_between_rotations( q->motion.rot.f[2], - FUN_001f9e90(q->unk500.f[0] - q->unk540.f[0], + fast_arc_tan(q->unk500.f[0] - q->unk540.f[0], q->unk500.f[1] - q->unk540.f[1]))) id = 0x1F; set_hero_animation(id, 0, (float)scale_game_frames(5)); @@ -1728,7 +1728,7 @@ int hero_set_state(int a, int b) { if (q->items[0].item_id == 0xA && ((char *)q->unkA50) != 0) { q->unkA58 = 1; q->unkA5C = - FUN_001f9e90(*(float *)(((char *)q->unkA50) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unkA50) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unkA50) + 0x14) - q->motion.pos.f[1]); } break; diff --git a/src/overlays/l16/gameplay/vendor/002e4b58.c b/src/overlays/l16/gameplay/vendor/002e4b58.c index 7ae406a316..d99e6019fc 100644 --- a/src/overlays/l16/gameplay/vendor/002e4b58.c +++ b/src/overlays/l16/gameplay/vendor/002e4b58.c @@ -164,7 +164,7 @@ void FUN_L16_002e4f30(struct Moby *a) { /* Sets up the draw state, then draws the three entries of the level's table. */ extern char D_L16_001DF2D0[] __attribute__((section(".data"))); -extern int FUN_001fa728(char *, float); +extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern int get_effect_texture_l16(int) __asm__("FUN_001f44b8"); extern float D_L16_001DE720[]; extern float D_L16_001DEA90[]; @@ -194,7 +194,7 @@ void FUN_L16_002e97a0(void) { vu1_add_g_sregister_l16(0x14, 0xFF9000000260); font_queue_vu_state(); for (i = 0; i < 0x2; i++) { - if (FUN_001fa728(D_L16_001DF2B0[i], 512.0f) != -1) { + if (fast_bsphere_check(D_L16_001DF2B0[i], 512.0f) != -1) { FUN_L16_002e8b98_i(a[i], d[i], b[i], c[i], D_L16_001DF2D0); FUN_L00_001fde98(a[i], b[i], e[i], D_L16_001DF2D0, 1); } diff --git a/src/overlays/l17/gameplay/entities/blarg_ship.c b/src/overlays/l17/gameplay/entities/blarg_ship.c index 1e69672ba4..d3c94f69a4 100644 --- a/src/overlays/l17/gameplay/entities/blarg_ship.c +++ b/src/overlays/l17/gameplay/entities/blarg_ship.c @@ -523,17 +523,17 @@ extern f32 vector_length_xyz(void *a) __asm__("FUN_001f9af0"); extern float FUN_001f9b48(void *, void *); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); -extern float FUN_L00_0025be00(float *p, float *v, float a, float b, float c, float d); +extern float approach_angle(float *p, float *v, float a, float b, float c, float d) __asm__("FUN_L00_0025be00"); extern float fast_cos(float) __asm__("func_001F9DC8"); extern float fast_sin(float) __asm__("func_001F9DE0"); extern float random_angle_radians(void) __asm__("FUN_00213308"); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); -extern int FUN_001fa728(char *, float); +extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern int FUN_0022da68(int, int, int); extern int random_integer_below_c(int) __asm__("FUN_00213260"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern unsigned char *FUN_L13_002e1c50(char *position, int moby_class); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L11_00319670(void *); extern void FUN_L11_0031a1c0(void *); @@ -546,7 +546,8 @@ extern void vu_euler_rotation_basis(void *, void *) __asm__("func_001FA030"); void blend_moby_animation(MobyAnim *arg0, int arg1, int arg2, int arg3) __asm__("FUN_00212f90"); extern float D_L17_001623E8 __attribute__((sda)); -void FUN_L17_002f40d8(struct Moby *moby) { +void blarg_ship_update(struct Moby *moby) __asm__("FUN_L17_002f40d8"); +void blarg_ship_update(struct Moby *moby) { float s0[4]; float s10[4]; float s20[4]; @@ -599,7 +600,7 @@ void FUN_L17_002f40d8(struct Moby *moby) { fast_add_rotations(*(float *)(d + 0x70), *(float *)(d + 0x74)); FUN_L11_0031a438(moby); if (moby->state == 2) { - FUN_L00_0025f090(moby, &moby->pos, -1, 2.0f, 13.0f); + cart_burst(moby, &moby->pos, -1, 2.0f, 13.0f); if (random_integer_below_c(2)) { FUN_L13_002e1c50((char *)&moby->pos, 0xE0); } else { @@ -620,7 +621,7 @@ void FUN_L17_002f40d8(struct Moby *moby) { case 3: qcopy(s0, &moby->pos); s0[3] = 3.0f; - if (FUN_001fa728((char *)&moby->pos, 512.0f) == -1) { + if (fast_bsphere_check((char *)&moby->pos, 512.0f) == -1) { if (FUN_001f9b48(&moby->pos, &hero.motion.pos) > 32.0f) { *(int *)(d + 0x84) += 1; if (scale_game_frames(60) < *(int *)(d + 0x84)) { @@ -690,10 +691,10 @@ void FUN_L17_002f40d8(struct Moby *moby) { float ang; subtract_vector_xyz(s70, tgt, &moby->pos.x); ang = fast_arc_tan(s70[0], s70[1]); - FUN_L00_0025be00(yaw, (float *)(d + 0x8C), ang, frame_time_sq * 12.566371f, + approach_angle(yaw, (float *)(d + 0x8C), ang, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, frame_time * 12.566371f); ang = -fast_arc_tan(vector_length_xy(s70), s70[2]); - FUN_L00_0025be00(pitch, (float *)(d + 0x90), ang, frame_time_sq * 12.566371f, + approach_angle(pitch, (float *)(d + 0x90), ang, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, frame_time * 12.566371f); if (D_L17_0015F5CC % 10 == 0) { FUN_0022da68(2, 0, (int)moby); @@ -727,7 +728,7 @@ void FUN_L17_002f40d8(struct Moby *moby) { subtract_vector_xyz(s0, &hero.motion.pos, d + 0xB0); qcopy(d + 0xB0, &hero.motion.pos); add_vector_xyz(&moby->pos, &moby->pos, s0); - FUN_L00_0025f090(moby, &moby->pos, -1, 2.0f, 13.0f); + cart_burst(moby, &moby->pos, -1, 2.0f, 13.0f); if (random_integer_below_c(2)) { FUN_L13_002e1c50((char *)&moby->pos, 0xE0); } else { @@ -751,11 +752,11 @@ void FUN_L17_002f40d8(struct Moby *moby) { extern char D_0013E533[]; extern char D_L17_001676C0[]; -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); -extern float FUN_001fa580(float, float); -extern int FUN_001f96f8(int); -extern void FUN_001f9a10(void *, void *, void *); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void euler_rotation_basis(void *, void *) __asm__("FUN_001fa030"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); s32 random_integer_below(s32 arg0) __asm__("FUN_00213260"); @@ -785,14 +786,14 @@ char *FUN_L17_002f4fb8(int list) { C[1] = -0.17453292f; euler_rotation_basis(D, C); { - float f = FUN_001fa580(0.7853982f, (float)*(int *)(d + 0x88) * 1.5707964f); - fast_vec_normalize(A, E, FUN_001f9de0(f) * 12.0f); - FUN_001f9a10(B, D_L17_001676C0, A); - fast_vec_normalize(A, F, FUN_001f9dc8(f) * 12.0f); + float f = fast_add_rotations(0.7853982f, (float)*(int *)(d + 0x88) * 1.5707964f); + fast_vec_normalize(A, E, fast_sin(f) * 12.0f); + fast_vec_add(B, D_L17_001676C0, A); + fast_vec_normalize(A, F, fast_cos(f) * 12.0f); } - FUN_001f9a10(B, B, A); + fast_vec_add(B, B, A); fast_vec_normalize(A, D, 6.0f); - FUN_001f9a10(B, B, A); + fast_vec_add(B, B, A); qcopy(d + 0xB0, D_0013E533 + 0xE9D); qcopy(m + 0x10, B); m[0x20] = 5; @@ -800,7 +801,7 @@ char *FUN_L17_002f4fb8(int list) { *(float *)(d + 0x6C) = frame_time * 20.0f; *(float *)(d + 0x94) = 5.0f; if (*(unsigned char *)(m + 0x53)) - blend_moby_animation(m, 0, 0, FUN_001f96f8(10)); + blend_moby_animation(m, 0, 0, scale_game_frames(10)); *(unsigned short *)(m + 0x34) &= 0xFFFE; *(int *)(m + 0x94) = *(int *)(*(char **)(m + 0x24) + 0x10); return m; @@ -897,7 +898,7 @@ typedef struct { extern char D_L17_001676C0[]; extern float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); @@ -914,7 +915,7 @@ void FUN_L17_002f54d8(int n, V3 *b, V3 *a, int unused, float *out) { p.v.x = a[i].x; p.v.y = a[i].y; p.v.z = a[i].z; - FUN_001f9a28(&v0, &p, D_L17_001676C0); + fast_vec_sub(&v0, &p, D_L17_001676C0); fast_vec_normalize(&v0, &v0, 1.0f); q.w = 1.0f; q.v.x = b[i].x; @@ -923,7 +924,7 @@ void FUN_L17_002f54d8(int n, V3 *b, V3 *a, int unused, float *out) { fast_vec_normalize(&q, &q, 1.0f); d = fast_vec_dot(&q, &v0); fast_vec_scale(&r, &q, d + d); - FUN_001f9a28(&r, &v0, &r); + fast_vec_sub(&r, &v0, &r); fast_vec_normalize(&r, &r, 1.0f); r.v.z = r.v.z + 1.0f; len = fast_vec_length(&r); @@ -1018,7 +1019,7 @@ void FUN_L17_002f6138(int n, char *nrm, char *pos, int unused, float *out) { t[0] = p[0]; t[1] = p[1]; t[2] = p[2]; - FUN_001f9a28(a, D_L17_001676C0, t); + fast_vec_sub(a, D_L17_001676C0, t); fast_vec_normalize(a, a, 1.0f); c[3] = 1.0f; q = (float *)(i * 12 + (int)nrm); @@ -1027,7 +1028,7 @@ void FUN_L17_002f6138(int n, char *nrm, char *pos, int unused, float *out) { c[2] = q[2]; fast_vec_normalize(c, c, 1.0f); fast_vec_scale(r, c, fast_vec_dot(c, a) * 2.0f); - FUN_001f9a28(r, a, r); + fast_vec_sub(r, a, r); fast_vec_normalize(r, r, 1.0f); r[2] += 1.0f; len = fast_vec_length(r) * 2.0f; diff --git a/src/overlays/l17/gameplay/entities/door.c b/src/overlays/l17/gameplay/entities/door.c index 3f11845e33..ed75de88ba 100644 --- a/src/overlays/l17/gameplay/entities/door.c +++ b/src/overlays/l17/gameplay/entities/door.c @@ -21,7 +21,7 @@ extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_sin(float) __asm__("FUN_001f9de0"); extern int D_L17_0015F5C4; extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern unsigned char D_0013E633[] __asm__("D_0013F3D0"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); @@ -29,7 +29,8 @@ float absolute_float_c(float input) __asm__("FUN_001f99c0"); s32 is_point_inside_clip_volume(s32 arg0, s32 arg1) __asm__("FUN_00214720"); void mark_moby_for_removal(struct Obj *obj) __asm__("FUN_0020c828"); -void FUN_L17_002e87d8(struct Moby *m) { +void door_update(struct Moby *m) __asm__("FUN_L17_002e87d8"); +void door_update(struct Moby *m) { char *d = (char *)m->pvars; float v[4]; float tmp[4]; @@ -57,7 +58,7 @@ void FUN_L17_002e87d8(struct Moby *m) { break; case 2: if (m->pclass->sound_defs != 0 && - FUN_L00_0028d8c0(m, (*(int *)(d + ((0x20))))) == 0) { + voice_is_playing(m, (*(int *)(d + ((0x20))))) == 0) { (*(int *)(d + ((0x20)))) = allocate_voice_for_target_entry(0, 4, (int)m); } k = frame_time * 3.0f; @@ -113,7 +114,7 @@ void FUN_L17_002e87d8(struct Moby *m) { break; } if (m->pclass->sound_defs != 0 && - FUN_L00_0028d8c0(m, (*(int *)(d + ((0x20))))) == 0) { + voice_is_playing(m, (*(int *)(d + ((0x20))))) == 0) { (*(int *)(d + ((0x20)))) = allocate_voice_for_target_entry(0, 4, (int)m); } m->state = 2; @@ -140,14 +141,14 @@ void FUN_L17_002e87d8(struct Moby *m) { (*(int *)(d + ((0x18)))))) break; if (m->pclass->sound_defs != 0 && - FUN_L00_0028d8c0(m, (*(int *)(d + ((0x20))))) == 0) { + voice_is_playing(m, (*(int *)(d + ((0x20))))) == 0) { (*(int *)(d + ((0x20)))) = allocate_voice_for_target_entry(0, 4, (int)m); } m->state = 5; break; case 5: if (m->pclass->sound_defs != 0 && - FUN_L00_0028d8c0(m, (*(int *)(d + ((0x20))))) == 0) { + voice_is_playing(m, (*(int *)(d + ((0x20))))) == 0) { (*(int *)(d + ((0x20)))) = allocate_voice_for_target_entry(0, 4, (int)m); } if (is_point_inside_clip_volume(&hero.motion.pos, (*(int *)(d + ((0x18))))) || @@ -378,10 +379,10 @@ void FUN_L17_002e8e08(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/l17_fleet/vendor_002AA068.c: func_L17_002EAFC8), where it is exact; names translated to the US level program. */ extern char *func_0020D348_m(int); -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9e90(float, float); -extern int FUN_001f96f8(int); -extern void FUN_001f9a28(void *, void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); char *FUN_L17_002e94d8(struct Moby *src, char *pos, float *v, float f) { @@ -399,13 +400,13 @@ char *FUN_L17_002e94d8(struct Moby *src, char *pos, float *v, float f) { d = *(char **)(r + 0x78); *(float *)(d + 0x40) = f; qcopy(d + 0x10, v); - *(int *)(d + 0x38) = FUN_001f96f8(0x258); + *(int *)(d + 0x38) = scale_game_frames(0x258); *(char **)(d + 0x3C) = src; - FUN_001f9a28(tmp, d + 0x10, p); + fast_vec_sub(tmp, d + 0x10, p); fast_vec_normalize(d, tmp, *(float *)(d + 0x40)); *(float *)(r + 0x48) = - FUN_001f9e90(v[0] - *(float *)(r + 0x10), v[1] - *(float *)(r + 0x14)); - *(float *)(r + 0x44) = -FUN_001f9e90(FUN_001f9b80(p, v), v[2] - *(float *)(r + 0x18)); + fast_arc_tan(v[0] - *(float *)(r + 0x10), v[1] - *(float *)(r + 0x14)); + *(float *)(r + 0x44) = -fast_arc_tan(vector_distance(p, v), v[2] - *(float *)(r + 0x18)); } return r; } @@ -497,15 +498,15 @@ extern f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); extern float D_L17_001678E0[]; extern float square_root(float) __asm__("FUN_001f9988"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9de0(float); -extern float FUN_001fa580(float, float); -extern float FUN_001fa5c8(float, float); -extern float FUN_L00_0025e310(float); +extern float fast_sin(float) __asm__("FUN_001f9de0"); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); +extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern unsigned char D_0013E500[]; -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); -extern void FUN_001f9d20(void *, void *, void *); +extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void FUN_L11_00311210(void *, void *, void *, int); extern void FUN_L13_002b7d50(void *, int, int, long, float, float, float, float); @@ -552,7 +553,7 @@ int FUN_L17_002eace8(int a, char *p, char *a2, char *a3, float f0, float f1, flo dy = -dy; qcopy(v, D_L17_001678E0); fast_vec_scale(v, D_L17_001678E0, *(float *)(m + 0xC) / 1280.0f); - FUN_001f9a10(v, v, m + 0x10); + fast_vec_add(v, v, m + 0x10); FUN_L11_00311210(v, &tx, &ty, 0); tx -= sx; ty -= sy; @@ -597,14 +598,14 @@ int FUN_L17_002eace8(int a, char *p, char *a2, char *a3, float f0, float f1, flo { float x = (v[0] - scr[4]) * 0.0625f; float y = (v[1] - scr[5]) * 0.0625f; - float ang = FUN_L00_0025e310(convert_integer_to_float(D_L17_0015F5CC) / 20.0f); + float ang = normalize_angle(convert_integer_to_float(D_L17_0015F5CC) / 20.0f); FUN_L13_002b7d50(D_L17_001D9AC0, 0x1E, 0xFFFFF3, 0x500000FF, x, y, 1.0f, ang); } { float x = (v[0] - scr[4]) * 0.0625f; float y = (v[1] - scr[5]) * 0.0625f; - float ang = FUN_L00_0025e310(convert_integer_to_float(D_L17_0015F5CC) / 20.0f); + float ang = normalize_angle(convert_integer_to_float(D_L17_0015F5CC) / 20.0f); FUN_L13_002b7d50(D_L17_001D9AC0, 0x1E, 0xFFFFF3, 0x500000FF, x, y, 1.3f, -ang); } @@ -624,13 +625,13 @@ int FUN_L17_002eace8(int a, char *p, char *a2, char *a3, float f0, float f1, flo { float x = (v[0] - scr[4]) * 0.0625f; float y = (v[1] - scr[5]) * 0.0625f; - float ang = FUN_L00_0025e310(convert_integer_to_float(D_L17_0015F5CC) / 20.0f); + float ang = normalize_angle(convert_integer_to_float(D_L17_0015F5CC) / 20.0f); FUN_L13_002b7d50(D_L17_001D9AC0, 0x1E, 0xFFFFF3, 0x400000FF, x, y, 2.0f, ang); } { float x = (v[0] - scr[4]) * 0.0625f; float y = (v[1] - scr[5]) * 0.0625f; - float ang = FUN_L00_0025e310(convert_integer_to_float(D_L17_0015F5CC) / 20.0f); + float ang = normalize_angle(convert_integer_to_float(D_L17_0015F5CC) / 20.0f); FUN_L13_002b7d50(D_L17_001D9AC0, 0x1E, 0xFFFFF3, 0x400000FF, x, y, 2.5f, -ang); } } @@ -650,7 +651,7 @@ int FUN_L17_002eace8(int a, char *p, char *a2, char *a3, float f0, float f1, flo { float x = (v[0] - scr[4]) * 0.0625f; float y = (v[1] - scr[5]) * 0.0625f; - float ang = FUN_L00_0025e310(convert_integer_to_float(D_L17_0015F5CC) / 20.0f); + float ang = normalize_angle(convert_integer_to_float(D_L17_0015F5CC) / 20.0f); FUN_L13_002b7d50(D_L17_001D9AC0, 0x1E, 0xFFFFF3, 0xFF00FF00, x, y, 1.0f, -ang); } @@ -665,7 +666,7 @@ int FUN_L17_002eace8(int a, char *p, char *a2, char *a3, float f0, float f1, flo { float x = (v[0] - scr[4]) * 0.0625f; float y = (v[1] - scr[5]) * 0.0625f; - float ang = FUN_L00_0025e310(convert_integer_to_float(D_L17_0015F5CC) / 20.0f); + float ang = normalize_angle(convert_integer_to_float(D_L17_0015F5CC) / 20.0f); FUN_L13_002b7d50(D_L17_001D9AC0, 0x1E, 0xFFFFF3, 0xFF00FF00, x, y, 1.0f, -ang); } @@ -709,29 +710,29 @@ int FUN_L17_002eace8(int a, char *p, char *a2, char *a3, float f0, float f1, flo ap = (char *)a + 0x10; project_to_screen(w, u); transpose_rotation_matrix(mat, D_L17_001678D0); - FUN_001f9a28(v, np, (&hero.motion.pos)); - FUN_001f9d20(v, v, mat); + fast_vec_sub(v, np, (&hero.motion.pos)); + transform_vector(v, v, mat); v[0] = -v[1]; v[1] = -v[2]; v[2] = 0.0f; fast_vec_normalize(v, v, 160.0f); - ang = FUN_001fa580(FUN_001f9e90(v[0], v[1]), 1.5707964f); + ang = fast_add_rotations(fast_arc_tan(v[0], v[1]), 1.5707964f); v[0] += 256.0f; v[1] += 208.0f; dist = FUN_001f9b48(ap, np); h = absolute_float( - FUN_001fa5c8(FUN_001f9e90(*(float *)(near + 0x10) - *(float *)((char *)a + 0x10), + fast_subtract_rotations(fast_arc_tan(*(float *)(near + 0x10) - *(float *)((char *)a + 0x10), *(float *)(near + 0x14) - *(float *)((char *)a + 0x14)), *(float *)(p + 0x38))); k = absolute_float( - FUN_001fa5c8(-FUN_001f9e90(FUN_001f9b80(ap, np), + fast_subtract_rotations(-fast_arc_tan(vector_distance(ap, np), *(float *)(near + 0x18) - *(float *)((char *)a + 0x18)), *(float *)(p + 0x34))); s = square_root(h * h + k * k); - t = FUN_001fa580(*(float *)(p + 0x114), 0.1f / (s / 3.1415927f)); + t = fast_add_rotations(*(float *)(p + 0x114), 0.1f / (s / 3.1415927f)); *(float *)(p + 0x114) = t; FUN_L13_002b7d50(&D_L17_00162188, 3, 0xFFFFF3, - (func_001FA898_r((FUN_001f9de0(t) + 1.4f) * 53.0f) << 24) | 0x8000, v[0], + (func_001FA898_r((fast_sin(t) + 1.4f) * 53.0f) << 24) | 0x8000, v[0], v[1], 240.0f / dist + 1.5f, ang); } return (int)ret; @@ -744,8 +745,8 @@ int FUN_L17_002eace8(int a, char *p, char *a2, char *a3, float f0, float f1, flo extern unsigned char D_0013C940_u[] __asm__("D_0013C940"); extern int D_L17_0015F5C4; int D_L17_0016216C = 600; -extern int FUN_001f9740(void *); -extern int FUN_001f96f8(int); +extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int FUN_L17_002eace8_u(int, char *, char *, char *, float, float, float, char *, char *) __asm__("FUN_L17_002eace8"); #define W(p, o) (*(int *)((char *)(p) + (o))) @@ -763,7 +764,7 @@ void FUN_L17_002eb768(int a, char *p) { float v[4]; int h; if (!(D_L17_0015F5C4 >= 3 && D_L17_0015F5C4 <= 4)) { - FUN_001f9740((int *)(p + 0x8C)); + fast_dec_timer((int *)(p + 0x8C)); } if (W(p, 0x8C) != 0 && P(p, 0x88) != 0 && H(P(p, 0x88), 0xA6) == W(p, 0x128) && B(P(p, 0x88), 0x20) != 0xFE && B(P(p, 0x88), 0x20) != 0xFD) { @@ -803,7 +804,7 @@ void FUN_L17_002eb768(int a, char *p) { } if (r != P(p, 0x88)) { W(p, 0x118) = W(p, 0x118) + 1; - if (FUN_001f96f8(0x3C) < W(p, 0x118)) { + if (scale_game_frames(0x3C) < W(p, 0x118)) { W(p, 0xEC) = 0; W(p, 0x128) = -1; W(p, 0x88) = 0; @@ -826,7 +827,7 @@ void FUN_L17_002eb768(int a, char *p) { extern char *get_help_message_text(s32) __asm__("func_001FDD10"); extern char D_L17_001D99E0[]; extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); -extern float FUN_L00_0025e310(float); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern int D_L17_001D9B68[]; extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); @@ -900,7 +901,7 @@ void FUN_L17_002eb9a8(struct Moby *moby) { m = 1.0f; c = func_001FA898_r(m * 96.0f); func_L17_002EBF08_f(convert_integer_to_float(sp10), convert_integer_to_float(sp14), k, - FUN_L00_0025e310(convert_integer_to_float(D_L17_0015F5CC) / 30.0f), 0, + normalize_angle(convert_integer_to_float(D_L17_0015F5CC) / 30.0f), 0, 0xFF, 0, c); *(int *)(d + 0xEC) = 0; } else { @@ -972,12 +973,12 @@ void FUN_L17_002eb9a8(struct Moby *moby) { /* Builds a rotated offset vector from the moby, flips a facing flag on a pad press, and updates the aim. */ /* Ported from rac1-decomp (src/overlays/l17_fleet/vendor_002AA068.c: func_L17_002EDAF0), where it is exact; names translated to the US level program. */ -extern int FUN_001f9740(void *); +extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); extern int FUN_L11_00308848(void *, void *, void *, float, float); extern f32 D_L17_001620A0_gp __asm__("D_L17_001620A0") __attribute__((sda)); extern unsigned char D_0013A4E0_u[] __asm__("D_0013A4E0"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); extern void FUN_L11_00311210(void *, void *, void *, int); @@ -991,18 +992,18 @@ void FUN_L17_002ec000(char *moby, char *obj, float p2, float p3) { char c[16]; char d[16]; build_spherical_offset(a, *(float *)&D_L17_0016206C * *(float *)&D_L17_001620A0_gp, p2, p3); - FUN_001f9a10(a, a, obj); - if (FUN_001f9740(obj + 0x80) && (*(int *)(D_0013A4E0_u + 0x2610) & 0x84)) { + fast_vec_add(a, a, obj); + if (fast_dec_timer(obj + 0x80) && (*(int *)(D_0013A4E0_u + 0x2610) & 0x84)) { allocate_voice_for_target_entry(3, 0, (int)moby); fast_vec_normalize(c, a, 2.2f); moby_point_position(moby, 3 + (obj[0x61] & 1), b); - FUN_001f9a10(b, b, c); + fast_vec_add(b, b, c); FUN_L11_00308848(moby, a, b, 200.0f, -1.0f); *(int *)(obj + 0x80) = D_L17_00162070; obj[0x61] ^= 1; } fast_vec_normalize(a, a, 23.0f); - FUN_001f9a10(d, a, moby + 0x10); + fast_vec_add(d, a, moby + 0x10); FUN_L11_00311210(d, obj + 0xE0, obj + 0xE4, 0); } /* Fires a projectile from the moby when the trigger is ready and the player presses a button. */ @@ -1016,7 +1017,7 @@ int D_L17_00162078 = 30; void FUN_L17_002ec150(char *moby, char *obj) { char a[16]; char b[16]; - if (FUN_001f9740(obj + 0x84) && (*(int *)(D_0013A4E0_u + 0x2610) & 0x28)) { + if (fast_dec_timer(obj + 0x84) && (*(int *)(D_0013A4E0_u + 0x2610) & 0x28)) { if (hero.ship_ammo != 0) { char *pos = moby + 0x40; float s; @@ -1025,9 +1026,9 @@ void FUN_L17_002ec150(char *moby, char *obj) { *(unsigned short *)(obj + 0x6A) = t; moby_point_position(moby, t + 7, a); fast_vec_normalize(b, obj, 0.3f); - FUN_001f9a10(a, a, b); + fast_vec_add(a, a, b); s = *(float *)&D_L17_00162074 * *(float *)&D_L17_001620A0_gp; - n = FUN_001f96f8(300); + n = scale_game_frames(300); if (FUN_L13_002e6a58(moby, a, *(int *)(obj + 0xEC), pos, s, n)) { allocate_voice_for_target_entry(2, 0, (int)moby); hero.ship_ammo -= 1; @@ -1098,9 +1099,9 @@ extern f32 fast_cos(f32) __asm__("func_001F9DC8"); extern f32 fast_sin(f32) __asm__("func_001F9DE0"); extern f32 fast_subtract_rotations(f32, f32) __asm__("func_001FA5C8"); extern float D_L17_0016D3F0 __attribute__((section(".data"))); -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9e90(float, float); -extern float FUN_L00_0025b8c0(float *p, float *v, float t, float u1, float u2, float eps); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); +extern float vendor_spring(float *p, float *v, float t, float u1, float u2, float eps) __asm__("FUN_L00_0025b8c0"); extern float FUN_L00_0025bc98(char *, char *, int, float, float, float, float); extern float FUN_L13_002ba088(int, int, float, float, float, float, float); extern float fast_add_rotations(float, float); @@ -1173,7 +1174,7 @@ extern float D_L17_00162154 __attribute__((sda)); extern float D_L17_00162160 __attribute__((sda)); extern float D_L17_00162164 __attribute__((sda)); extern float D_L17_00162168 __attribute__((sda)); -extern int FUN_L00_001f0d60(float, void *, int, void *); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern s32 allocate_voice_for_target_entry_c4(s32, s32, void *) __asm__("func_0022DA68"); int D_L17_0016215C = 10; float D_L17_001621F0[2] = {512.0f, 512.0f}; @@ -1181,8 +1182,8 @@ extern unsigned short D_L17_0016217C __attribute__((sda)); extern unsigned char D_0013A4E0_c4[] __asm__("D_0013A4E0"); extern unsigned char D_0013E533_c4[] __asm__("D_0013E533"); extern void FUN_L00_001ff660(void *, void *, void *); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, int, float, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_002ea9d8(void *); extern void FUN_L00_002eaa30(void *); extern void FUN_L17_002eb9a8(); @@ -1307,8 +1308,8 @@ void FUN_L17_002ec360(Moby *m, Obj *o) { kb = D_L17_001620C8; } FUN_L17_002edf10((char *)m, &a, &b); - FUN_L00_0025b8c0(&o->f6C, &o->f90, a, D_L17_001620AC, D_L17_001620B0, ka); - FUN_L00_0025b8c0(&o->f70, &o->f94, b, D_L17_001620BC, D_L17_001620C0, kb); + vendor_spring(&o->f6C, &o->f90, a, D_L17_001620AC, D_L17_001620B0, ka); + vendor_spring(&o->f70, &o->f94, b, D_L17_001620BC, D_L17_001620C0, kb); FUN_L00_0025bc98((char *)&o->f30, (char *)&o->f98, 0, o->f6C * D_L17_0016208C, D_L17_001620CC, D_L17_001620D0, D_L17_001620D4); o->f34 = fast_subtract_rotations(o->f34, o->f70 * D_L17_00162024); @@ -1339,18 +1340,18 @@ void FUN_L17_002ec360(Moby *m, Obj *o) { qcopy(target, D_L17_001621F0); } - d = FUN_001f9b80(m->pos, D_L17_001621F0); + d = vector_distance(m->pos, D_L17_001621F0); o->f38 = FUN_L13_002ba088( - 1, 5, d, o->f38, FUN_001f9e90(target[0] - m->pos[0], target[1] - m->pos[1]), 50.0f, lenB); + 1, 5, d, o->f38, fast_arc_tan(target[0] - m->pos[0], target[1] - m->pos[1]), 50.0f, lenB); m->r48 = FUN_L13_002ba088( - 1, 5, d, m->r48, FUN_001f9e90(target[0] - m->pos[0], target[1] - m->pos[1]), 50.0f, lenB); + 1, 5, d, m->r48, fast_arc_tan(target[0] - m->pos[0], target[1] - m->pos[1]), 50.0f, lenB); e1 = absolute_float(target[2] - m->pos[2]); o->f34 = FUN_L13_002ba088(1, 5, e1, o->f34, - -FUN_001f9e90(FUN_001f9b80(m->pos, target), target[2] - m->pos[2]), + -fast_arc_tan(vector_distance(m->pos, target), target[2] - m->pos[2]), 50.0f, lenA); e2 = absolute_float(target[2] - m->pos[2]); m->r44 = FUN_L13_002ba088(1, 5, e2, m->r44, - -FUN_001f9e90(FUN_001f9b80(m->pos, target), target[2] - m->pos[2]), + -fast_arc_tan(vector_distance(m->pos, target), target[2] - m->pos[2]), 50.0f, lenA); build_spherical_offset(dir.v, o->speed, o->f38, -o->f34); normalize_vector_xyz(o->v10, dir.v, 1.0f); @@ -1383,11 +1384,11 @@ void FUN_L17_002ec360(Moby *m, Obj *o) { wr.e[1].v[2] = D_L17_00162040 * D_L17_0016209C; tbl.e[0].q = wr.e[0].q; tbl.e[1].q = wr.e[1].q; - FUN_L00_0025b8c0(&o->fB4, &o->fC8, tbl.e[o->sel].v[0], D_L17_00162114, D_L17_00162118, + vendor_spring(&o->fB4, &o->fC8, tbl.e[o->sel].v[0], D_L17_00162114, D_L17_00162118, D_L17_0016211C); - FUN_L00_0025b8c0(&o->fB8, &o->fCC, tbl.e[o->sel].v[1], D_L17_00162120, D_L17_00162124, + vendor_spring(&o->fB8, &o->fCC, tbl.e[o->sel].v[1], D_L17_00162120, D_L17_00162124, D_L17_00162128); - FUN_L00_0025b8c0(&o->fBC, &o->fD0, tbl.e[o->sel].v[2], D_L17_0016212C, D_L17_00162130, + vendor_spring(&o->fBC, &o->fD0, tbl.e[o->sel].v[2], D_L17_0016212C, D_L17_00162130, D_L17_00162134); diff[0] = o->fB4; diff[1] = o->fB8; @@ -1412,7 +1413,7 @@ void FUN_L17_002ec360(Moby *m, Obj *o) { ang[2] = o->f28; ang[1] = o->f24; FUN_L00_002eaa30(ang); - FUN_L00_0025b8c0(&o->fB0, &o->fC0, D_L17_00162144 + (D_L17_00162148 - D_L17_00162144) * ratio, + vendor_spring(&o->fB0, &o->fC0, D_L17_00162144 + (D_L17_00162148 - D_L17_00162144) * ratio, D_L17_0016214C, D_L17_00162150, D_L17_00162154); h = o->fB0 * 0.5f; tn = fast_sin(h) / fast_cos(h); @@ -1421,7 +1422,7 @@ void FUN_L17_002ec360(Moby *m, Obj *o) { m->r40 = fast_add_rotations(o->f30, o->f6C * D_L17_00162160); m->r44 = fast_add_rotations(o->f34, -o->f70 * D_L17_00162164); m->r48 = fast_add_rotations(o->f38, -o->f6C * D_L17_00162168); - if (FUN_L00_001f0d60(1.2f, m->pos, 0, m)) { + if (coll_sphere(1.2f, m->pos, 0, m)) { p = D_L17_00174740; if (*(char **)(p + 0x18) == 0 || (hc = *(short *)(*(char **)(p + 0x18) + 0xA6), @@ -1430,10 +1431,10 @@ void FUN_L17_002ec360(Moby *m, Obj *o) { FUN_L00_001ff660(dir.v, dir.v, p + 0x40); o->f38 = fast_add_rotations( o->f38, - fast_subtract_rotations(FUN_001f9e90(dir.v[0], dir.v[1]), o->f38) * D_L17_00162018); + fast_subtract_rotations(fast_arc_tan(dir.v[0], dir.v[1]), o->f38) * D_L17_00162018); t = fast_add_rotations( o->f34, - fast_subtract_rotations(-FUN_001f9e90(vector_length_xy(dir.v), dir.v[2]), o->f34) * + fast_subtract_rotations(-fast_arc_tan(vector_length_xy(dir.v), dir.v[2]), o->f34) * D_L17_0016201C); k = o->speed * D_L17_0016205C; o->f34 = t; @@ -1585,35 +1586,35 @@ typedef struct { char b[0x400]; } ShipBlock400; -extern int FUN_001f9740(void *); -extern int FUN_001f9770(void *); +extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern void clamp_vector_length(void *, void *, float) __asm__("FUN_001f9c90"); -extern float FUN_001f9e90(float, float); -extern float FUN_001f9b20(void *); -extern float FUN_001fa580(float, float); -extern float FUN_001fa5c8(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); +extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); +extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float FUN_00213ed8(float *, float, float); extern int FUN_00215130(int, int); extern int force_help_message(int, int) __asm__("FUN_002151d8"); extern void refresh_moby_spatial_bounds_from_basis(void *) __asm__("FUN_0020e098"); extern void set_animation_parameter(int, int) __asm__("FUN_001ff570"); extern void debug_print(char *) __asm__("FUN_001e93b0"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); -extern float FUN_L00_00250430(void *, void *); -extern void FUN_L00_00259fe8(void *, float); +extern float jet_distance(void *, void *) __asm__("FUN_L00_00250430"); +extern void jet_animate(void *, float) __asm__("FUN_L00_00259fe8"); extern int FUN_L00_002644e0(int); extern void FUN_L00_00216f90(void *, void *, int, int); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void FUN_L00_002eac18(int); -extern void FUN_L00_00203b18(void); +extern void jet_camera_mode(void) __asm__("FUN_L00_00203b18"); extern void FUN_L00_00203b78(void); extern void hero_respawn(void) __asm__("FUN_L00_00211250"); -extern void FUN_L00_002502a0(int); -extern void FUN_L00_00284e50(void *, void *); -extern void FUN_L01_0027a248(int, int); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); +extern void jet_game_state(int, int) __asm__("FUN_L01_0027a248"); extern void FUN_L11_003112b8(void *, void *); -extern void FUN_L13_002650a8(int, int, int, int); +extern void jet_group_state(int, int, int, int) __asm__("FUN_L13_002650a8"); extern void FUN_L17_0021e530(int, int); extern void FUN_L17_00253a90(int, int, int, int); extern int allocate_voice_ed(int, int, void *) __asm__("FUN_0022da68"); @@ -1626,7 +1627,8 @@ extern int D_L17_0015F608; extern char *D_L17_0015F420; extern ShipLevelEntry D_L17_0016DA80[]; extern ShipShake D_L17_00167580; -void FUN_L17_002ed018(ShipMoby *moby) { +void fighter_jet_update(ShipMoby *moby) __asm__("FUN_L17_002ed018"); +void fighter_jet_update(ShipMoby *moby) { ShipVars *v; ShipHit *hit; W4 dir; @@ -1638,7 +1640,7 @@ void FUN_L17_002ed018(ShipMoby *moby) { if (moby != 0) { v = (ShipVars *)moby->vars; - FUN_001f9740(&v->timerDC); + fast_dec_timer(&v->timerDC); if (moby->state != 7 && moby->state != 1 && moby->state != 2) { hit = (ShipHit *)find_moby_hit(moby, 0x30001, 0); if (hit != 0 && moby->state == 4) { @@ -1648,18 +1650,18 @@ void FUN_L17_002ed018(ShipMoby *moby) { if (hit->flags & 1) { ShipShake *s = &D_L17_00167580; s->f160 = 1.0f; - s->i168 = FUN_001f96f8(4); + s->i168 = scale_game_frames(4); k = hit->damage * D_L17_00162088; spherical_offset_ed(dir, v->speed, v->rot[2], -v->rot[1]); clamp_vector_length((char *)hit + 0x10, (char *)hit + 0x10, frame_time * 3.0f); add_vector_ed(moby->pos, moby->pos, (char *)hit + 0x10); FUN_L00_001ff660(dir, dir, (char *)hit + 0x10); - v->rot[2] = FUN_001fa580( + v->rot[2] = fast_add_rotations( v->rot[2], - FUN_001fa5c8(FUN_001f9e90(dir[0], dir[1]), v->rot[2]) * D_L17_00162018 * k); - v->rot[1] = FUN_001fa580( + fast_subtract_rotations(fast_arc_tan(dir[0], dir[1]), v->rot[2]) * D_L17_00162018 * k); + v->rot[1] = fast_add_rotations( v->rot[1], - FUN_001fa5c8(FUN_001f9e90(FUN_001f9b20(dir), dir[2]), v->rot[1]) * + fast_subtract_rotations(fast_arc_tan(vector_length_xy(dir), dir[2]), v->rot[1]) * D_L17_0016201C * k); } } else { @@ -1667,17 +1669,17 @@ void FUN_L17_002ed018(ShipMoby *moby) { { ShipShake *s = &D_L17_00167580; s->f160 = 0.2f; - s->i168 = FUN_001f96f8(5); + s->i168 = scale_game_frames(5); } g->ship_hp = 0.0f; moby->state = 7; - v->hit_timer = FUN_001f96f8(30); + v->hit_timer = scale_game_frames(30); g->motion.pos.f[2] += 0.2f; ((ShipCamera *)g->moby)->unk98 = 0; FUN_L17_0021e530(0, 1); g->ship_moby = 0; g->ship_oclass = -1; - FUN_L00_0025e450(moby, dir, 0, 0.0f, 0.0f, 10, 3, 16, 4.0f, 2.0f, 9.0f, -1, 1.0f, + spawn_explosion(moby, dir, 0, 0.0f, 0.0f, 10, 3, 16, 4.0f, 2.0f, 9.0f, -1, 1.0f, 15.0f, 1, 1, -1, 0); moby->flags |= 0x41; } @@ -1698,7 +1700,7 @@ void FUN_L17_002ed018(ShipMoby *moby) { moby->scale = *(float *)(moby->pclass + 0x24); v->f20 = v->rot[0]; v->f24 = v->rot[1]; - fov = FUN_001f9e90(1.0f, D_L17_0016D3F0_a[0]) * 2.0f; + fov = fast_arc_tan(1.0f, D_L17_0016D3F0_a[0]) * 2.0f; v->fC0 = 0.0f; v->fAC = fov; v->fB0 = fov; @@ -1719,14 +1721,14 @@ void FUN_L17_002ed018(ShipMoby *moby) { moby->state = 9; } if (v->i11C > 0) { - FUN_L13_002650a8(v->i11C, 0, 0, 0); + jet_group_state(v->i11C, 0, 0, 0); } FUN_L17_00253a90(0x325, 1, 1, -1); v->i124 = -1; break; case 1: { struct Hero *g = &hero; - board = FUN_L00_00250430(moby, (ShipCamera *)g->moby) < D_L17_00161FE0 && + board = jet_distance(moby, (ShipCamera *)g->moby) < D_L17_00161FE0 && FUN_00215130(7, 0x53E4) != 0 && (*(int *)D_0013CAE4_ed & 0x10); if (board) { FUN_L00_002644e0(7); @@ -1736,7 +1738,7 @@ void FUN_L17_002ed018(ShipMoby *moby) { FUN_00213ed8(&v->fade, 0.0f, frame_time * 4.0f); D_L17_0015F3FC = v->fade; } - FUN_L00_00259fe8(moby, D_L17_00162054 * D_L17_0016209C); + jet_animate(moby, D_L17_00162054 * D_L17_0016209C); break; } case 2: @@ -1759,7 +1761,7 @@ void FUN_L17_002ed018(ShipMoby *moby) { g->unk15FA = 3; g->unk15FB = 3; g->ship_flags = 0; - FUN_L01_0027a248(2, 4); + jet_game_state(2, 4); if (v->enter_path != -1) { char *p = D_L17_001600EC + (v->enter_path << 7); FUN_L00_00216f90(p + 0x30, p + 0x70, 50, 1); @@ -1768,7 +1770,7 @@ void FUN_L17_002ed018(ShipMoby *moby) { } force_help_message(6, 0); FUN_L17_0021e530(50, 1); - FUN_L00_002eaaa0(moby->pos, moby->rot, 1, 0, 0); + jet_mount(moby->pos, moby->rot, 1, 0, 0); v->s68 = 0; v->speed = D_L17_00161FE4; v->f6C = 0.0f; @@ -1784,7 +1786,7 @@ void FUN_L17_002ed018(ShipMoby *moby) { ((ShipCamera *)g->moby)->unk98 = -1; spherical_offset_ed(v->dir, D_L17_00161FE4, v->rot[2], -v->rot[1]); if (v->i11C > 0) { - FUN_L13_002650a8(v->i11C, 1, 1, 1); + jet_group_state(v->i11C, 1, 1, 1); } FUN_L17_00253a90(0x325, 0, 0, -1); moby->pos[2] += 3.0f; @@ -1793,7 +1795,7 @@ void FUN_L17_002ed018(ShipMoby *moby) { if (v->voice == -1) { v->voice = allocate_voice_ed(0, 4, moby); } - FUN_L00_00203b18(); + jet_camera_mode(); D_L17_0015F608 = 2; FUN_L17_002ec360((Moby *)moby, (Obj *)v); moby->state = 4; @@ -1837,7 +1839,7 @@ void FUN_L17_002ed018(ShipMoby *moby) { refresh_moby_spatial_bounds_from_basis(moby); p = D_L17_001600EC + (v->exit_path << 7); FUN_L00_00216f90(p + 0x30, p + 0x70, 0, 1); - FUN_L01_0027a248(0, 5); + jet_game_state(0, 5); idx = v->voice; if (idx != -1) { char *e = D_0013E550_ed + idx * 0x70; @@ -1862,13 +1864,13 @@ void FUN_L17_002ed018(ShipMoby *moby) { case 7: force_help_message(6, 0); D_L17_0015F608 = 2; - if (FUN_001f9770(&v->hit_timer)) { + if (fast_dec_timer_s16(&v->hit_timer)) { struct Hero *g = &hero; FUN_L00_00203b78(); ((ShipCamera *)g->moby)->unk98 = 0; hero_respawn(); FUN_L00_002eac18(0); - FUN_L01_0027a248(0, 5); + jet_game_state(0, 5); qcopy_nc(moby->pos, v->home_pos); qcopy_nc(moby->rot, v->home_rot); refresh_moby_spatial_bounds_from_basis(moby); @@ -1895,7 +1897,7 @@ void FUN_L17_002ed018(ShipMoby *moby) { force_help_message(6, 0); D_L17_0015F608 = 2; FUN_L17_002ec360((Moby *)moby, (Obj *)v); - if (FUN_001f9740(&v->timerF8)) { + if (fast_dec_timer(&v->timerF8)) { FUN_00213ed8(&v->fade, 1.0f, frame_time * 4.0f); D_L17_0015F3FC = v->fade; } @@ -1906,7 +1908,7 @@ void FUN_L17_002ed018(ShipMoby *moby) { ((ShipCamera *)g->moby)->unk98 = 0; FUN_L17_0021e530(0, 1); FUN_L00_002eac18(0); - FUN_L01_0027a248(0, 5); + jet_game_state(0, 5); if (v->exit_path2 == -1) { debug_print(D_L17_001E6E00); qcopy_nc(moby->pos, v->home_pos); @@ -1922,14 +1924,14 @@ void FUN_L17_002ed018(ShipMoby *moby) { debug_print(D_L17_001E6E38); } else { if (v->i11C > 0) { - FUN_L13_002650a8(v->i11C, 0, 0, 0); + jet_group_state(v->i11C, 0, 0, 0); } FUN_L17_00253a90(0x325, 1, 1, -1); p = D_L17_001600EC + (v->exit_path << 7); FUN_L00_00216f90(p + 0x30, p + 0x70, 0, 1); } if (moby->bB0 != 0xFF) { - FUN_L00_002502a0(moby->bB0); + jet_clear_persistent(moby->bB0); } idx = v->voice; if (idx != -1) { @@ -1947,7 +1949,7 @@ void FUN_L17_002ed018(ShipMoby *moby) { } } v->voice2 = -1; - FUN_L00_00284e50((&hero.motion.pos), &hero.motion.rot); + jet_reset_camera((&hero.motion.pos), &hero.motion.rot); moby->state = 9; } break; @@ -2013,7 +2015,7 @@ void FUN_L17_002edf10(char *moby, float *a, float *b) { lo = *(float *)(D_L17_001600EC_t[*(int *)(d + 0x12C)] + 0x38); t = hi + lo; k = -hi + lo; - f = fast_add_rotations(FUN_001f9e90(v[0], v[1]), 3.141590118408203f); + f = fast_add_rotations(fast_arc_tan(v[0], v[1]), 3.141590118408203f); if (tmp - 10.0f < dist) { r = (dist - tmp + 10.0f) / 10.0f; s = fast_subtract_rotations(f, *(float *)(d + 0x38)); @@ -2068,7 +2070,7 @@ extern float fast_sin_c2(float) __asm__("func_001F9DE0"); extern float random_angle_radians(void) __asm__("FUN_00213308"); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern s32 allocate_voice_for_target_entry_u(s32, s32, void *) __asm__("func_0022DA68"); -extern void FUN_L00_00260738(char *, void *, void *, void *); +extern void update_entity_matrix(char *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void FUN_L00_002ea9d8(void *); extern int hero_set_state(int, int) __asm__("FUN_L17_0021e530"); extern void FUN_L17_002ee9c0_c(char *, char *, char *) __asm__("FUN_L17_002ee9c0"); @@ -2077,7 +2079,8 @@ float absolute_float(float input) __asm__("func_001F99C0"); void mark_moby_for_removal_c2(void *obj) __asm__("FUN_0020c828"); extern char D_0013F350_c2[] __asm__("D_0013F350"); -void FUN_L17_002ee2b0(struct Moby *moby) { +void magnet_elevator_update(struct Moby *moby) __asm__("FUN_L17_002ee2b0"); +void magnet_elevator_update(struct Moby *moby) { char *state = P(moby, 0x78); float delta[4]; float rot[4]; @@ -2098,7 +2101,7 @@ void FUN_L17_002ee2b0(struct Moby *moby) { f = 0.0f; } (*(float *)((char *)(moby) + (0x44))) = f * 3.1415927f; - (*(float *)((char *)(moby) + (0x44))) = FUN_L00_0025e310(f * 3.1415927f); + (*(float *)((char *)(moby) + (0x44))) = normalize_angle(f * 3.1415927f); } switch (B(moby, 0x20)) { case 0: @@ -2149,7 +2152,7 @@ void FUN_L17_002ee2b0(struct Moby *moby) { if (B(moby, 0x20) == 3 && P(D_0013E533_u, 0x1119) != moby) { B(moby, 0x20) = 5; } - if (!FUN_L00_0028d8c0(moby, W(state, 0x6C))) { + if (!voice_is_playing(moby, W(state, 0x6C))) { W(state, 0x6C) = allocate_voice_for_target_entry_u(0, 4, (int)moby); } if (B(moby, 0x20) == 2 || B(moby, 0x20) == 4) { @@ -2173,7 +2176,7 @@ void FUN_L17_002ee2b0(struct Moby *moby) { if (B(moby, 0xBC) != 0) { hero_set_state(HERO_STATE_IDLE, 0); } - if (FUN_L00_0028d8c0(moby, W(state, 0x6C))) { + if (voice_is_playing(moby, W(state, 0x6C))) { release_voice_slot(W(state, 0x6C)); W(state, 0x6C) = -1; } @@ -2182,7 +2185,7 @@ void FUN_L17_002ee2b0(struct Moby *moby) { } case 8: case 9: - if (FUN_L00_0028d8c0(moby, W(state, 0x6C))) { + if (voice_is_playing(moby, W(state, 0x6C))) { release_voice_slot(W(state, 0x6C)); W(state, 0x6C) = -1; } @@ -2214,7 +2217,7 @@ void FUN_L17_002ee2b0(struct Moby *moby) { g = (char *)((char *)&D_0013F350_c2); if (H(g, 0x308) != 0 || W(state, 0x7C) == 0) { if (P(g, 0x2FC) == moby && H(g, 0x30E) == 0 && - FUN_001f9b80(g + 0x80, &moby->pos) < 0.5f) { + vector_distance(g + 0x80, &moby->pos) < 0.5f) { allocate_voice_for_target_entry_u(1, 0, (int)moby); if (B(moby, 0x20) == 7) { B(moby, 0x20) = 2; @@ -2223,7 +2226,7 @@ void FUN_L17_002ee2b0(struct Moby *moby) { } } else if (B(moby, 0x20) == 6) { char *p = (char *)(&hero.motion.pos); - float d = FUN_001f9b80(&moby->pos, p); + float d = vector_distance(&moby->pos, p); float e = absolute_float((*(float *)((char *)(p) + (0x258))) - (*(float *)((char *)(state) + (0x64)))); if (e < absolute_float((*(float *)((char *)(state) + (0x60))) - @@ -2236,7 +2239,7 @@ void FUN_L17_002ee2b0(struct Moby *moby) { } } else if (B(moby, 0x20) == 7) { char *p = (char *)(&hero.motion.pos); - float d = FUN_001f9b80(&moby->pos, p); + float d = vector_distance(&moby->pos, p); float e = absolute_float((*(float *)((char *)(p) + (0x258))) - (*(float *)((char *)(state) + (0x60)))); if (e < absolute_float((*(float *)((char *)(state) + (0x60))) - @@ -2253,7 +2256,7 @@ void FUN_L17_002ee2b0(struct Moby *moby) { } } add_vector_xyz(delta, delta, &moby->pos); - FUN_L00_00260738(state + 0x20, delta, rot, &moby->rot); + update_entity_matrix(state + 0x20, delta, rot, &moby->rot); } extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); @@ -2267,7 +2270,7 @@ extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern char D_L17_001676C0[]; -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern void set_vector_length_xy(void *, void *, float) __asm__("FUN_001f9c48"); void FUN_L17_002ee9c0(struct Moby *moby, char *temp, char *state) { @@ -2277,14 +2280,14 @@ void FUN_L17_002ee9c0(struct Moby *moby, char *temp, char *state) { add_vector_xyz(temp, temp, &moby->pos); clear_u64_value(state); *(float *)(state + 8) = - FUN_001f9e90(hero.motion.unkD0.f[0] - *(float *)temp, hero.motion.unkD0.f[1] - *(float *)(temp + 4)); + fast_arc_tan(hero.motion.unkD0.f[0] - *(float *)temp, hero.motion.unkD0.f[1] - *(float *)(temp + 4)); *(int *)(state + 4) = 0; } /* Ported from rac1-decomp (src/overlays/l17_fleet/vendor_002AA068.c: func_L17_002F0580), where it is exact; names translated to the US level program. */ extern char D_L17_001B0DB0[]; extern char D_L17_001D9F70[]; -extern void FUN_001f9cf8(void *, void *, void *); +extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); void FUN_L17_002eea70(struct Moby *moby) { char *state = (char *)moby->pvars; @@ -2293,7 +2296,7 @@ void FUN_L17_002eea70(struct Moby *moby) { char *point = &moby->rot_row0; int i; for (i = 10; i >= 0; i--) { - FUN_001f9cf8(vec, D_L17_001D9F70 + (10 - i) * 0x10, point); + transform_vector_by_basis(vec, D_L17_001D9F70 + (10 - i) * 0x10, point); add_vector_xyz(vec, vec, &moby->pos); *(float *)(vec + 0xC) = 1.0f; vec += 0x10; @@ -2347,13 +2350,13 @@ typedef struct { extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); -extern float FUN_L00_0025be00(float *p, float *v, float a, float b, float c, float d); +extern float approach_angle(float *p, float *v, float a, float b, float c, float d) __asm__("FUN_L00_0025be00"); extern float fast_cos_c(float) __asm__("func_001F9DC8"); extern float fast_sin_c(float) __asm__("func_001F9DE0"); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int point_in_path_xy(void *, void *, int) __asm__("FUN_L00_00259740"); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int FUN_L00_002dc9f0(void *, void *); extern int FUN_L17_002efd48_c(char *moby, float *target, float speed) __asm__("FUN_L17_002efd48"); extern int random_integer_below(int) __asm__("FUN_00213260"); @@ -2362,9 +2365,9 @@ extern void *FUN_L00_00263fd8(char *src, int cls, float *pos, void *mat, int a8, float scale, float *v10, float *v11, float *v12); extern void FUN_L00_00257470(void *, int, int); extern void FUN_L00_00258278(char *moby, float *vel, float target, float k, float d, float max); -extern void FUN_L00_00259bc8(int, int, int, void *, void *, float); +extern void spawn_nearby_effect(int, int, int, void *, void *, float) __asm__("FUN_L00_00259bc8"); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L00_00263b38(void *, float); extern void FUN_L00_00263e30(void *, int, int, int, int, int, int); void FUN_L17_002efa48(void *moby_v, int arg); @@ -2378,7 +2381,8 @@ void blend_moby_animation_c(void *arg0, int arg1, int arg2, int arg3) __asm__("F void mark_moby_for_removal_c(void *obj) __asm__("FUN_0020c828"); extern float D_L17_0015F580_macro[] __asm__("D_L17_0015F580") __attribute__((section(".sdata"))); -void FUN_L17_002eeb68(unsigned char *m) { +void robot_dog_update(unsigned char *m) __asm__("FUN_L17_002eeb68"); +void robot_dog_update(unsigned char *m) { Vars1382 *d; unsigned char *tgt; int r; @@ -2491,10 +2495,10 @@ void FUN_L17_002eeb68(unsigned char *m) { float ang; float *yaw = (float *)(m + 0x48); int mode; - ang = FUN_001f9e90(*(float *)(tgt + 0x10) - *(float *)(m + 0x10), + ang = fast_arc_tan(*(float *)(tgt + 0x10) - *(float *)(m + 0x10), *(float *)(tgt + 0x14) - *(float *)(m + 0x14)); turn = frame_time_sq * 4.712389f; - FUN_L00_0025be00(yaw, &d->yawvel, ang, turn, turn, frame_time * 3.4906585f); + approach_angle(yaw, &d->yawvel, ang, turn, turn, frame_time * 3.4906585f); if (absolute_float(d->yawvel) > frame_time * 0.08726646f) { if (d->yawvel < 0.0f) { if (m[0x53] != 4) { @@ -2512,7 +2516,7 @@ void FUN_L17_002eeb68(unsigned char *m) { } *(float *)(m + 0x58) = 1.7f; mode = d->mode; - if (mode == 2 && (FUN_001f9770(&d->t1E2) || D_0013E533_u[0x2EC1] != 3)) { + if (mode == 2 && (fast_dec_timer_s16(&d->t1E2) || D_0013E533_u[0x2EC1] != 3)) { if (random_integer_below(3) == 0) { if (m[0x53] != mode) { blend_moby_animation_c(m, 2, 0, scale_game_frames(10)); @@ -2597,7 +2601,7 @@ void FUN_L17_002eeb68(unsigned char *m) { } case 8: { float ang; - ang = FUN_001f9e90(d->v180[0] - *(float *)(m + 0x10), d->v180[1] - *(float *)(m + 0x14)); + ang = fast_arc_tan(d->v180[0] - *(float *)(m + 0x10), d->v180[1] - *(float *)(m + 0x14)); FUN_L00_00258278((char *)m, &d->yawvel, ang, 0.03f, 0.3f, frame_time * 7.8539815f); if (m[0x70] & 2) { if (d->f1D4 == 0.0f) { @@ -2624,7 +2628,7 @@ void FUN_L17_002eeb68(unsigned char *m) { ((int **)D_L17_001B0DB0)[d->path][0]) == 0 && d->f1D4 == 0.0f) { m[0x20] = 11; - } else if (FUN_001f9b80(m + 0x10, d->v180) < 1.8f) { + } else if (vector_distance(m + 0x10, d->v180) < 1.8f) { m[0x20] = 10; if (m[0x53] != 10) { blend_moby_animation_c(m, 10, 5, scale_game_frames(10)); @@ -2643,16 +2647,16 @@ void FUN_L17_002eeb68(unsigned char *m) { } else if (absolute_float(compute_interpolated_record_value(m) - 17.5f) <= 0.25f && absolute_float(d->v180[2] - *(float *)(m + 0x18)) < 1.0f && fast_difference_between_rotations( - FUN_001f9e90(d->v180[0] - *(float *)(m + 0x10), + fast_arc_tan(d->v180[0] - *(float *)(m + 0x10), d->v180[1] - *(float *)(m + 0x14)), *(float *)(m + 0x48)) < 0.2617994f && - d->target != 0 && FUN_001f9b80(m + 0x10, d->v180) < 2.75f) { + d->target != 0 && vector_distance(m + 0x10, d->v180) < 2.75f) { tmp[0] = fast_cos_c(*(float *)(m + 0x48)) * 0.2f; tmp[1] = fast_sin_c(*(float *)(m + 0x48)) * 0.2f; tmp[2] = 0.0f; qcopy(pos, d->v180); pos[2] += 0.75f; - FUN_L00_00259bc8((int)d->target, (int)m, 1, pos, tmp, 1.0f); + spawn_nearby_effect((int)d->target, (int)m, 1, pos, tmp, 1.0f); } break; case 11: { @@ -2663,7 +2667,7 @@ void FUN_L17_002eeb68(unsigned char *m) { float v; FUN_L17_002efd48_c((char *)m, (float *)&d->home, frame_time * 5.0f); *(float *)(m + 0x58) = 1.35f; - dist = FUN_001f9b80(m + 0x10, &d->home); + dist = vector_distance(m + 0x10, &d->home); if ((dist < 1.4f && (m[0x70] & 2)) || dist < 0.3f) { m[0x20] = 5; if (m[0x53] != 3) { @@ -2672,7 +2676,7 @@ void FUN_L17_002eeb68(unsigned char *m) { d->t1E2 = scale_game_frames(120); d->t1E0 = scale_game_frames(120); } else if (m[0x70] & 2) { - far = FUN_001f9b80(m + 0x10, d->v180); + far = vector_distance(m + 0x10, d->v180); k1 = multiply_global_factor_ed64(40.0f); k2 = multiply_global_factor_ed64(10.0f); v = d->speed * frame_time; @@ -2689,7 +2693,7 @@ void FUN_L17_002eeb68(unsigned char *m) { break; } case 4: - if (FUN_L00_0025c698(m, d->a120) & 0x60) { + if (mine_fall(m, d->a120) & 0x60) { clear_vector(tmp); m[0x20] = 5; if (m[0x53] != 3) { @@ -2704,11 +2708,11 @@ void FUN_L17_002eeb68(unsigned char *m) { break; case 15: *(unsigned short *)(m + 0x34) &= 0xEFFF; - if (FUN_L00_0025c698(m, d->a120) & 0x60) { + if (mine_fall(m, d->a120) & 0x60) { float *zero; clear_vector(tmp); zero = D_L17_0015F580_macro; - FUN_L00_0025f090(m, m + 0x10, -1, 0.5f, 13.0f); + cart_burst(m, m + 0x10, -1, 0.5f, 13.0f); FUN_L00_00263fd8((char *)m, 0x6CE, (float *)(m + 0x10), m + 0x40, 0, 0, 0.0f, zero, zero, zero); FUN_L00_00263fd8((char *)m, 0x6CF, (float *)(m + 0x10), m + 0x40, 0, 0, 0.0f, zero, @@ -2792,17 +2796,17 @@ typedef struct { extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float random_float_between(float a, float b) __asm__("FUN_002132a8"); extern int coll_line_fix(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int hit_reaction(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_L00_0025a478"); extern int FUN_L00_0025ff38(float, char *, void *, int, int, void *, int); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); -extern void FUN_L00_0025ab48(void *, float *, void *, void *); -extern void FUN_L00_0025c558(float, void *, void *, int, int, int); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L08_00211b08(float *); +extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(float, void *, void *, int, int, int) __asm__("FUN_L00_0025c558"); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void update_float_countdown(float *) __asm__("FUN_L08_00211b08"); extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); void FUN_L17_002efa48(void *moby_v, int arg) { @@ -2825,7 +2829,7 @@ void FUN_L17_002efa48(void *moby_v, int arg) { d->f1D4 = func_001FA898_r(multiply_global_factor_ed64(random_float_between(180.0f, 240.0f))); d->i38 = 0; } - FUN_L08_00211b08(&d->f1D4); + update_float_countdown(&d->f1D4); y = 0; q = (Hit_2F1558 *)find_moby_hit(moby, 0x330000, 0); hit_reaction(moby, q, &d->f20, 0, &x, &y, 0, 4); @@ -2840,14 +2844,14 @@ void FUN_L17_002efa48(void *moby_v, int arg) { d->f170 = -1.0f; d->f174 = -1.0f; *(OvlQuad *)tmp = *(OvlQuad *)q->pos; - FUN_L00_0025ab48(tmp, &ang, &d->f138, &d->f13C); + trooper_knockback_arc(tmp, &ang, &d->f138, &d->f13C); if (q != 0 && q->moby != 0 && q->moby->hA6 == 0x63) { - ang = FUN_001f9e90(d->f1F0 - moby->pos[0], d->f1F4 - moby->pos[1]); + ang = fast_arc_tan(d->f1F0 - moby->pos[0], d->f1F4 - moby->pos[1]); } - FUN_L00_0025c558(ang, moby, d->v120, 0xB, 1, 0); + trooper_start_knockback(ang, moby, d->v120, 0xB, 1, 0); moby->state = 15; d->b117 = 0xF0; - FUN_L00_0025d458(moby, d->h110); + trooper_anim_update(moby, d->h110); } moby->bA4 = 0xFF; if (arg != 0) { @@ -2857,7 +2861,7 @@ void FUN_L17_002efa48(void *moby_v, int arg) { return; } if (FUN_001f9b48(moby->pos, d->v1B0) < 64.0f) { - ang2 = FUN_001f9e90(d->v180[0] - moby->pos[0], d->v180[1] - moby->pos[1]); + ang2 = fast_arc_tan(d->v180[0] - moby->pos[0], d->v180[1] - moby->pos[1]); yaw = fast_difference_between_rotations(moby->f48, ang2); qcopy(tmp, moby->pos); tmp[2] += 1.0f; @@ -2871,9 +2875,9 @@ void FUN_L17_002efa48(void *moby_v, int arg) { /* Ported from rac1-decomp (src/overlays/l17_fleet/vendor_002F1558.c: func_L17_002F1858), where it is exact; names translated to the US level program. */ extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); -extern float FUN_L00_0025be00(float *p, float *v, float a, float b, float c, float d); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); +extern float approach_angle(float *p, float *v, float a, float b, float c, float d) __asm__("FUN_L00_0025be00"); extern void FUN_L00_00258830(int, int, float, float, float, int); int FUN_L17_002efd48(struct Moby *moby, float *target, float speed) { @@ -2883,15 +2887,15 @@ int FUN_L17_002efd48(struct Moby *moby, float *target, float speed) { float turn; float tmp[3]; data = (char *)moby->pvars; - ang = FUN_001f9e90(target[0] - moby->pos.x, target[1] - moby->pos.y); + ang = fast_arc_tan(target[0] - moby->pos.x, target[1] - moby->pos.y); turn = frame_time_sq * 12.566371f; - FUN_L00_0025be00(yaw, (float *)(data + 0x1DC), ang, turn, turn, frame_time * 7.3303828f); + approach_angle(yaw, (float *)(data + 0x1DC), ang, turn, turn, frame_time * 7.3303828f); approach_value((float *)(data + 0x1D8), speed, frame_time_sq * 13.0f); - tmp[0] = FUN_001f9dc8(moby->rot.z) * *(float *)(data + 0x1D8); - tmp[1] = FUN_001f9de0(moby->rot.z) * *(float *)(data + 0x1D8); + tmp[0] = fast_cos(moby->rot.z) * *(float *)(data + 0x1D8); + tmp[1] = fast_sin(moby->rot.z) * *(float *)(data + 0x1D8); tmp[2] = -(frame_time * 0.5f); FUN_L00_00258830((int)moby, (int)tmp, 0.5f, 0.5f, 0.0f, 0); - return FUN_001f9b80(&moby->pos, target) < 0.2f; + return vector_distance(&moby->pos, target) < 0.2f; } extern int scale_ticks(int) __asm__("FUN_001f96f8"); @@ -2935,9 +2939,9 @@ typedef struct { } AimData_1BB0; extern f32 fast_subtract_rotations(f32, f32) __asm__("func_001FA5C8"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float vector_length_xy(void *); -extern void FUN_L00_002628d8(char *, char *, int, float, float); +extern void update_joint_animation(char *, char *, int, float, float) __asm__("FUN_L00_002628d8"); extern void subtract_vector_xyz(void *dst, void *a, void *b); void FUN_L17_002f00a0(struct Moby *moby) { @@ -2951,8 +2955,8 @@ void FUN_L17_002f00a0(struct Moby *moby) { qcopy(tmp, &moby->pos); tmp[2] += 0.5f; subtract_vector_xyz(v, (&hero.motion.unkD0), tmp); - yaw = fast_subtract_rotations(FUN_001f9e90(v[0], v[1]), moby->rot.z); - pitch = -FUN_001f9e90(vector_length_xy(v), v[2]); + yaw = fast_subtract_rotations(fast_arc_tan(v[0], v[1]), moby->rot.z); + pitch = -fast_arc_tan(vector_length_xy(v), v[2]); if (yaw > 1.0471976f) { yaw = 1.0471976f; } else if (yaw < -1.0471976f) { @@ -2965,7 +2969,7 @@ void FUN_L17_002f00a0(struct Moby *moby) { } d->part.pitch = pitch; d->part.yaw = yaw; - FUN_L00_002628d8(moby, (char *)&d->part, 0, accel * frame_scale_sq, speed * frame_scale_sq); + update_joint_animation(moby, (char *)&d->part, 0, accel * frame_scale_sq, speed * frame_scale_sq); } #define NOT_SDA @@ -3100,7 +3104,7 @@ extern float D_L17_0016225C __attribute__((sda)); extern s64 get_effect_texture(s32) __asm__("func_001F44B8"); extern float D_L17_00162260 __attribute__((sda)); extern void FUN_L00_001fde98(int, int, int, void *, int); -extern void FUN_L00_00250320(void *, void *, void *, void *); +extern void get_moby_color(void *, void *, void *, void *) __asm__("FUN_L00_00250320"); extern void vu1_add_g_sregister(s32, unsigned long) __asm__("func_00233980"); void font_queue_vu_state(void) __asm__("FUN_001f76a0"); @@ -3136,7 +3140,7 @@ void FUN_L17_002f04d0(struct Moby *moby) { d->f0 = d->f4; d->f4 = fast_add_rotations(d->f4, 360.0f / multiply_global_factor_ed64(D_L17_00162258) * DEG_TO_RAD * frame_time); - FUN_L00_00250320(moby, &r, &g, &b); + get_moby_color(moby, &r, &g, &b); color = (D_L17_00162250 << 24) | (b << 16) | (g << 8) | r; for (i = 0; i < 2; i++) { for (j = 0; j < D_L17_00162210[i]; j++) { @@ -3222,7 +3226,7 @@ extern float D_L17_001622C4 __attribute__((sda)); extern float D_L17_001622C8 __attribute__((sda)); extern s64 get_effect_texture(s32) __asm__("func_001F44B8"); extern void FUN_L00_001fde98(int, int, int, void *, int); -extern void FUN_L00_00250320(void *, void *, void *, void *); +extern void get_moby_color(void *, void *, void *, void *) __asm__("FUN_L00_00250320"); extern void vu1_add_g_sregister(s32, unsigned long) __asm__("func_00233980"); void font_queue_vu_state(void) __asm__("FUN_001f76a0"); @@ -3242,7 +3246,7 @@ void FUN_L17_002f0948(struct Moby *moby) { d->f0 = d->f4; d->f4 = fast_add_rotations(d->f4, 360.0f / multiply_global_factor_ed64(D_L17_001622C4) * DEG_TO_RAD * frame_time); - FUN_L00_00250320(moby, &r, &g, &b); + get_moby_color(moby, &r, &g, &b); color = (D_L17_001622BC << 24) | (b << 16) | (g << 8) | r; for (i = 0; i < D_L17_00162280[0]; i++) { RingPt *p = &D_L17_001DBE20[i]; @@ -3289,10 +3293,56 @@ Quad4 D_L17_00162390 = {{1.0f, -0.62831855f, 1.0f, 0.62831855f}}; extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); extern f32 fast_sin(f32) __asm__("func_001F9DE0"); extern float D_L17_0016238C __attribute__((sda)); -extern float D_L17_001DD760[]; -extern float D_L17_001DD980[][2]; -extern float D_L17_001DDBA0[]; -extern float D_L17_001DDDC0[][2]; +float D_L17_001DD760[135] = {-7.788906f, -7.788906f, 0.005259f, -7.788906f, -3.894453f, 0.005259f, -3.894453f, -7.788906f, 0.005259f, -3.894453f, -3.894453f, 0.005259f, 0.0f, -7.788906f, 0.005259f, 0.0f, -3.894453f, 0.005259f, 3.894453f, -7.788906f, 0.005259f, 3.894453f, -3.894453f, 0.005259f, 7.788906f, -7.788906f, 0.005259f, 3.894453f, -3.894453f, 0.005259f, 7.788906f, -3.894453f, 0.005259f, 3.894453f, 0.0f, 0.005259f, 7.788906f, 0.0f, 0.005259f, 3.894453f, 3.894453f, 0.005259f, 7.788906f, 3.894453f, 0.005259f, 3.894453f, 3.894453f, 0.005259f, 7.788906f, 7.788906f, 0.005259f, 3.894453f, 3.894453f, 0.005259f, 3.894453f, 7.788906f, 0.005259f, 0.0f, 3.894453f, 0.005259f, 0.0f, 7.788906f, 0.005259f, -3.894453f, 3.894453f, 0.005259f, -3.894453f, 7.788906f, 0.005259f, -3.894453f, 3.894453f, 0.005259f, -7.788906f, 7.788906f, 0.005259f, -3.894453f, 3.894453f, 0.005259f, -7.788906f, 3.894453f, 0.005259f, -3.894453f, 0.0f, 0.005259f, -7.788906f, 0.0f, 0.005259f, -3.894453f, 0.0f, 0.005259f, -7.788906f, -3.894453f, 0.005259f, -3.894453f, 0.0f, 0.005259f, -3.894453f, -3.894453f, 0.005259f, 0.0f, 0.0f, 0.005259f, 0.0f, -3.894453f, 0.005259f, 0.0f, 0.0f, 0.005259f, 3.894453f, -3.894453f, 0.005259f, 0.0f, 0.0f, 0.005259f, 3.894453f, 0.0f, 0.005259f, 0.0f, 0.0f, 0.005259f, 3.894453f, 3.894453f, 0.005259f, 0.0f, 0.0f, 0.005259f, 0.0f, 3.894453f, 0.005259f, -3.894453f, 0.0f, 0.005259f, -3.894453f, 3.894453f, 0.005259f}; +float D_L17_001DD980[45][2] = { + {0.0f, 0.0f}, + {0.0f, 0.25f}, + {0.25f, 0.0f}, + {0.25f, 0.25f}, + {0.5f, 0.0f}, + {0.5f, 0.25f}, + {0.75f, 0.0f}, + {0.75f, 0.25f}, + {1.0f, 0.0f}, + {0.75f, 0.25f}, + {1.0f, 0.25f}, + {0.75f, 0.5f}, + {1.0f, 0.5f}, + {0.75f, 0.75f}, + {1.0f, 0.75f}, + {0.75f, 0.75f}, + {1.0f, 1.0f}, + {0.75f, 0.75f}, + {0.75f, 1.0f}, + {0.5f, 0.75f}, + {0.5f, 1.0f}, + {0.25f, 0.75f}, + {0.25f, 1.0f}, + {0.25f, 0.75f}, + {0.0f, 1.0f}, + {0.25f, 0.75f}, + {0.0f, 0.75f}, + {0.25f, 0.5f}, + {0.0f, 0.5f}, + {0.25f, 0.5f}, + {0.0f, 0.25f}, + {0.25f, 0.5f}, + {0.25f, 0.25f}, + {0.5f, 0.5f}, + {0.5f, 0.25f}, + {0.5f, 0.5f}, + {0.75f, 0.25f}, + {0.5f, 0.5f}, + {0.75f, 0.5f}, + {0.5f, 0.5f}, + {0.75f, 0.75f}, + {0.5f, 0.5f}, + {0.5f, 0.75f}, + {0.25f, 0.5f}, + {0.25f, 0.75f}, +}; +float D_L17_001DDBA0[135] = {0}; +float D_L17_001DDDC0[45][2] = {0}; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float square_root(float) __asm__("FUN_001f9988"); extern float FUN_L00_00200260(float, float); @@ -3301,7 +3351,7 @@ extern float wrap_angle(float); int D_L17_00162340[2] = {0x2d, 0}; int D_L17_00162360[2] = {(int)D_L17_001DDBA0, 0}; int D_L17_00162368[2] = {(int)D_L17_001DDDC0, 0}; -extern int D_L17_001DDF28[]; +int D_L17_001DDF28[45] = {0}; int D_L17_00162370[1] = {(int)D_L17_001DDF28}; int D_L17_00162374 = 128; int D_L17_00162378 = 45; @@ -3311,7 +3361,7 @@ extern float D_L17_00162384 __attribute__((sda)); extern float D_L17_00162388 __attribute__((sda)); extern s64 get_effect_texture(s32) __asm__("func_001F44B8"); extern void FUN_L00_001fde98(int, int, int, void *, int); -extern void FUN_L00_00250320(void *, void *, void *, void *); +extern void get_moby_color(void *, void *, void *, void *) __asm__("FUN_L00_00250320"); extern void vu1_add_g_sregister(s32, unsigned long) __asm__("func_00233980"); void font_queue_vu_state(void) __asm__("FUN_001f76a0"); @@ -3338,7 +3388,7 @@ void FUN_L17_002f10c8(struct Moby *moby) { data->prev = data->angle; data->angle = fast_add_rotations(data->angle, 360.0f / multiply_global_factor_ed64(D_L17_00162384) * DEG_TO_RAD * frame_time); - FUN_L00_00250320(moby, &r, &g, &b); + get_moby_color(moby, &r, &g, &b); /* The second float of each pair in t: p->f[0] is t.f[1], p->f[2] is t.f[3]. */ p = (Quad4 *)&t.f[1]; color = (D_L17_0016237C << 24) | (b << 16) | (g << 8) | r; @@ -3412,8 +3462,8 @@ extern char *D_L17_001600EC; extern char D_0013A4E0[]; extern char D_0013E533[]; extern char D_L17_001B0DB0[]; -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9e90(float, float); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_add_rotations(float, float); extern int D_L17_001BADD0[]; extern int FUN_L00_002644e0(int); @@ -3422,9 +3472,9 @@ extern int scale_game_frames(int); extern short D_L17_001623A8 __attribute__((sda)); extern short D_L17_001623AC __attribute__((sda)); extern void FUN_L00_00216f90(void *, void *, int, int); -extern void FUN_L00_00260738(char *, void *, void *, void *); +extern void update_entity_matrix(char *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void FUN_L00_002ea9d8(void *); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void FUN_L00_002eac18(int); extern void FUN_L02_002f8aa0(float, float, float, float, float, float); extern void add_vector_xyz(void *, void *, void *); @@ -3439,7 +3489,8 @@ void FUN_L17_002f20d8(struct Moby *moby); extern char D_0014C190[]; extern char D_0013CAE4[]; -void FUN_L17_002f1940(struct Moby *m) { +void shuttle_update(struct Moby *m) __asm__("FUN_L17_002f1940"); +void shuttle_update(struct Moby *m) { Vars1448 *v = (Vars1448 *)m->pvars; float old_pos[4]; float old_rot[4]; @@ -3531,9 +3582,9 @@ void FUN_L17_002f1940(struct Moby *m) { qcopy(a, ((char **)D_L17_001B0DB0)[v->a[idx]] + 0x10); qcopy(b, ((char **)D_L17_001B0DB0)[v->b[idx]] + 0x10); clear_vector(rot); - rot[2] = FUN_001f9e90(b[0] - a[0], b[1] - a[1]); - rot[1] = -FUN_001f9e90(FUN_001f9b80(a, b), b[2] - a[2]); - FUN_L00_002eaaa0(a, rot, 2, scale_game_frames(300), 0); + rot[2] = fast_arc_tan(b[0] - a[0], b[1] - a[1]); + rot[1] = -fast_arc_tan(vector_distance(a, b), b[2] - a[2]); + jet_mount(a, rot, 2, scale_game_frames(300), 0); FUN_L02_002f8aa0(0.001f, 1.0f, 1.0f, 0.001f, 1.0f, 1.0f); FUN_L00_002ea9d8(a); FUN_L00_002eaa30(rot); @@ -3546,8 +3597,8 @@ void FUN_L17_002f1940(struct Moby *m) { (m->save_id & 0x1F)) & 1) { float d = - FUN_001f9b80((&hero.motion.pos), D_L17_001600EC + (v->cam[v->sel] << 7) + 0x30); - if (FUN_001f9b80((&hero.motion.pos), + vector_distance((&hero.motion.pos), D_L17_001600EC + (v->cam[v->sel] << 7) + 0x30); + if (vector_distance((&hero.motion.pos), D_L17_001600EC + (v->cam[v->sel ^ 1] << 7) + 0x30) < d) { int base; int ofs; @@ -3601,7 +3652,7 @@ void FUN_L17_002f1940(struct Moby *m) { break; } subtract_vector_xyz(delta, &m->pos, old_pos); - FUN_L00_00260738(v->area, delta, old_rot, &m->rot); + update_entity_matrix(v->area, delta, old_rot, &m->rot); } /* Ported from rac1-decomp (src/overlays/l17_fleet/vendor_002F1558.c: func_L17_002F3C18), where it is exact; names translated to the US level program. */ @@ -3755,3 +3806,9 @@ int FUN_L17_002f2180(char *moby, int idx) { } return d->fA4 == 1.0f; } + +f32 D_L17_001DD100[1] __attribute__((section(".data"))) = {0}; +f32 D_L17_001DD104[1] __attribute__((section(".data"))) = {0}; +f32 D_L17_001DD320[1] __attribute__((section(".data"))) = {0}; +f32 D_L17_001DD328[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001DD6A8[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/l17/gameplay/entities/dreks_fleet_turret.c b/src/overlays/l17/gameplay/entities/dreks_fleet_turret.c index de93c020f1..109687b8fe 100644 --- a/src/overlays/l17/gameplay/entities/dreks_fleet_turret.c +++ b/src/overlays/l17/gameplay/entities/dreks_fleet_turret.c @@ -18,8 +18,8 @@ extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern int hit_reaction(void *, void *, void *, int, void *, void *, int, int) __asm__("FUN_L00_0025a478"); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); void FUN_L17_002cbc10(char *m) { char *d; @@ -54,10 +54,10 @@ void FUN_L17_002cbc10(char *m) { *(short *)(m + 0x34) &= 0xEFFF; } *(unsigned char *)(d + 0x67) = 0xF0; - FUN_L00_0025d458(m, (short *)e); + trooper_anim_update(m, (short *)e); } *(unsigned char *)(m + 0xA4) = 0xFF; - FUN_L00_0025d538(m, e); + trooper_anim_finish(m, e); } } @@ -70,8 +70,8 @@ void FUN_L17_002cbc10(char *m) { extern char *D_L17_0015FFD8; extern float FUN_001f9b48(void *, void *); -extern float FUN_L04_002418b0(int a, unsigned int b); -extern float FUN_L04_00241910(int a, unsigned int b); +extern float animation_start(int a, unsigned int b) __asm__("FUN_L04_002418b0"); +extern float animation_end(int a, unsigned int b) __asm__("FUN_L04_00241910"); extern float compute_interpolated_record_value(void *) __asm__("FUN_0020c9e0"); extern float dot_vectors_xyz(void *, void *); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); @@ -79,8 +79,8 @@ extern float fast_cos(float); extern float random_float_between(float, float) __asm__("FUN_002132a8"); extern float vector_length_xyz(void *); extern int D_L17_0015FFD8_t; /* no foreign declaration */ -extern int FUN_001efa68(void *, void *, int, void *, void *); -extern int FUN_001fa728(char *, float); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); +extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); extern short D_L17_00161498 __attribute__((sda)); extern unsigned char *FUN_L17_0026fb60(char *parent, void *pos, float *vec); @@ -120,9 +120,9 @@ void FUN_L17_002a8da0(struct Moby *m) { d = (char *)m->pvars; switch (m->state) { case 0: - *(float *)(d + 0x58) = FUN_L04_002418b0(m->class_slot, 0); + *(float *)(d + 0x58) = animation_start(m->class_slot, 0); *(float *)(d + 0x5C) = - (FUN_L04_00241910(m->class_slot, 0) - *(float *)(d + 0x58)) / 6.2831855f; + (animation_end(m->class_slot, 0) - *(float *)(d + 0x58)) / 6.2831855f; k = *(int *)(d + 0x44); if (k != -1) { qcopy(d, &m->pos); @@ -144,7 +144,7 @@ void FUN_L17_002a8da0(struct Moby *m) { transform_vector_by_basis(a, a, &m->rot_row0); add_vector_xyz(b, &m->pos, a); *(OvlQuad *)c = *(OvlQuad *)b; - if (FUN_001efa68(&m->pos, c, 2, 0, 0)) { + if (collision_line(&m->pos, c, 2, 0, 0)) { *(OvlQuad *)c = *(OvlQuad *)D_L17_00174760; } subtract_vector_xyz(b, c, &m->pos); @@ -179,7 +179,7 @@ void FUN_L17_002a8da0(struct Moby *m) { transform_vector_by_basis(a, a, &m->rot_row0); add_vector_xyz(b, &m->pos, a); *(OvlQuad *)c = *(OvlQuad *)b; - if (FUN_001efa68(&m->pos, c, 2, 0, 0)) { + if (collision_line(&m->pos, c, 2, 0, 0)) { *(OvlQuad *)c = *(OvlQuad *)D_L17_00174760; } flag = 1; @@ -217,12 +217,12 @@ void FUN_L17_002a8da0(struct Moby *m) { len = vector_length_xyz(d + 0x30); lerp_vector(b, d + 0x10, d + 0x20, 0.5f); b[3] = len * 0.5f; - if (FUN_001fa728((char *)b, 32.0f) != -1) { + if (fast_bsphere_check((char *)b, 32.0f) != -1) { subtract_vector_xyz(v30, &hero.motion.pos, &m->pos); normalize_vector_xyz(v40, &m->rot_row0, dot_vectors_xyz(&m->rot_row0, v30)); subtract_vector_xyz(v30, v30, v40); func_L00_0025A8C0_alt((char *)v60, (int)m, 0x10001, 1.0f, v30); - FUN_001efa68(&m->pos, d + 0x20, 9, m, v60); + collision_line(&m->pos, d + 0x20, 9, m, v60); len = vector_length_xyz(d + 0x30); *(OvlQuad *)e50 = *(OvlQuad *)(d + 0x10); for (i = 0; i < 7; i++) { @@ -353,13 +353,13 @@ typedef struct { extern char *FUN_L00_0026dd20(char *pos, char *vel, int c, int d, float f); extern char *FUN_L17_002e94d8(char *src, char *pos, float *v, float f); extern char *FUN_L17_002f4fb8(int list); -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9e90(float, float); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); -extern float FUN_L00_0025be00(float *p, float *v, float a, float b, float c, float d); +extern float approach_angle(float *p, float *v, float a, float b, float c, float d) __asm__("FUN_L00_0025be00"); extern float random_float_between(float a, float b) __asm__("FUN_002132a8"); extern float vector_length_xy(void *); -extern int FUN_001efa68(void *, void *, int, void *, void *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); extern int tick_countdown_32_alt(void *) __asm__("FUN_001f9740"); extern s32 allocate_voice_for_target_entry(s32, s32, void *) __asm__("func_0022DA68"); extern s32 random_integer_below(s32) __asm__("func_00213260"); @@ -368,9 +368,9 @@ extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); extern char D_L17_00161980[4] __attribute__((sda)); extern void *FUN_L00_00263fd8(char *src, int cls, float *pos, void *mat, int a8, int a9, float scale, float *v10, float *v11, float *v12); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L00_0025fcb8(void *, void *, float); -extern void FUN_L00_002628d8(char *, char *, int, float, float); +extern void update_joint_animation(char *, char *, int, float, float) __asm__("FUN_L00_002628d8"); extern void FUN_L17_002cbc10(char *m); extern void FUN_L17_002cbd38(char *m); extern void add_vector_xyz(void *, void *, void *); @@ -382,7 +382,8 @@ extern void transform_scaled_vertex_batch(char *arg0, int arg1, void *arg2, void mark_moby_for_removal(void *obj) __asm__("FUN_0020c828"); extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); -void FUN_L17_002cb310(struct Moby *m) { +void dreks_fleet_turret_update(struct Moby *m) __asm__("FUN_L17_002cb310"); +void dreks_fleet_turret_update(struct Moby *m) { float dir[4]; float from[4]; Vars347 *d = (Vars347 *)m->pvars; @@ -407,13 +408,13 @@ void FUN_L17_002cb310(struct Moby *m) { scale_vector_xyz(from, from, 0.9f); add_vector_xyz(from, from, dir); from[2] += 0.5f; - if (FUN_001efa68(dir, from, 2, m, 0) == 0) { + if (collision_line(dir, from, 2, m, 0) == 0) { m->state = 2; } } else if (g->state.current == 0x32) { char *v = ((char *)g->ship_moby); if (v != 0 && *(short *)(v + 0xA6) == 0x563) { - if (FUN_001f9b80(&m->pos, &g->motion.pos) < 254.0f) { + if (vector_distance(&m->pos, &g->motion.pos) < 254.0f) { m->state = 3; } } @@ -447,17 +448,17 @@ void FUN_L17_002cb310(struct Moby *m) { subtract_vector_xyz(dir, acc, j); qcopy(from, j + 4); yaw = &m->rot.z; - ang = FUN_001f9e90(dir[0], dir[1]); + ang = fast_arc_tan(dir[0], dir[1]); turn = frame_time_sq * 0.5235988f; - FUN_L00_0025be00(yaw, &d->yawvel, ang, turn, turn, frame_time * 1.0471976f); - d->fF4 = -FUN_001f9e90(vector_length_xy(dir), dir[2]); - FUN_L00_002628d8(m, d->a90, 0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f); + approach_angle(yaw, &d->yawvel, ang, turn, turn, frame_time * 1.0471976f); + d->fF4 = -fast_arc_tan(vector_length_xy(dir), dir[2]); + update_joint_animation(m, d->a90, 0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f); off = fast_difference_between_rotations(d->fD4, - -FUN_001f9e90(vector_length_xy(dir), dir[2])); + -fast_arc_tan(vector_length_xy(dir), dir[2])); if (D_L17_0015F5CC % scale_game_frames(0x5A) == d->timer && off < 0.034906585f) { if (fast_difference_between_rotations( m->rot.z, - FUN_001f9e90(*(float *)(D_L17_001600EC + d->zone * 0x80 + 0x30) - + fast_arc_tan(*(float *)(D_L17_001600EC + d->zone * 0x80 + 0x30) - m->pos.x, *(float *)(D_L17_001600EC + d->zone * 0x80 + 0x34) - m->pos.y)) < 0.034906585f) { @@ -498,19 +499,19 @@ void FUN_L17_002cb310(struct Moby *m) { subtract_vector_xyz(dir, aim.pos, j); qcopy(from, j + 4); yaw = &m->rot.z; - ang = FUN_001f9e90(dir[0], dir[1]); + ang = fast_arc_tan(dir[0], dir[1]); turn = frame_time_sq * 0.5235988f; - FUN_L00_0025be00(yaw, &d->yawvel, ang, turn, turn, frame_time * 1.0471976f); - d->fF4 = -FUN_001f9e90(vector_length_xy(dir), dir[2]); - FUN_L00_002628d8(m, d->a90, 0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f); + approach_angle(yaw, &d->yawvel, ang, turn, turn, frame_time * 1.0471976f); + d->fF4 = -fast_arc_tan(vector_length_xy(dir), dir[2]); + update_joint_animation(m, d->a90, 0, frame_scale_sq * 0.02f, frame_scale_sq * 0.3f); off = fast_difference_between_rotations(d->fD4, - -FUN_001f9e90(vector_length_xy(dir), dir[2])); + -fast_arc_tan(vector_length_xy(dir), dir[2])); if (tick_countdown_32_alt(&d->timer) && off < 0.034906585f) { if (fast_difference_between_rotations( - m->rot.z, FUN_001f9e90(aim.pos[0] - m->pos.x, + m->rot.z, fast_arc_tan(aim.pos[0] - m->pos.x, aim.pos[1] - m->pos.y)) < 0.034906585f) { - if (FUN_001efa68(from, aim.pos, 2, ((char *)g->ship_moby), 0) == 0) { + if (collision_line(from, aim.pos, 2, ((char *)g->ship_moby), 0) == 0) { char *p; qzero(zero); subtract_vector_xyz(tmp, j + 4, j); @@ -538,7 +539,7 @@ void FUN_L17_002cb310(struct Moby *m) { D_L17_0015F580, D_L17_0015F580); FUN_L00_00263fd8(m, 0x63B, &m->pos.x, &m->rot, 0, 0, 0.0f, D_L17_0015F580, D_L17_0015F580, D_L17_0015F580); - FUN_L00_0025f090(m, &m->pos, -1, 10.0f, 13.0f); + cart_burst(m, &m->pos, -1, 10.0f, 13.0f); mark_moby_for_removal(m); break; } @@ -621,8 +622,8 @@ extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); extern float vector_length_xyz(void *); extern float wrap_angle(float); -extern int FUN_001efa68(void *, void *, int, void *, void *); -extern int FUN_001fa728(char *, float); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); +extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern int FUN_L00_0020d568(void); extern int rand(void); extern int random_integer_below(int); @@ -722,11 +723,11 @@ void FUN_L17_002d77f0(char *m) { transform_vector(spC0, spC0, mat2); FUN_L00_001ff290(spD0, spC0, (m + 0x10)); if (FUN_001f9b48((m + 0x10), &hero.motion.pos) < 30.0f) { - FUN_001efa68((m + 0x10), spC0, 9, m, &blk); + collision_line((m + 0x10), spC0, 9, m, &blk); } spD0[0] = *(OvlQuad *)(m + 0x10); *(float *)((char *)spD0 + 0xC) = *(float *)&D_L17_00161B84; - if (FUN_001fa728((char *)spD0, 20.0f) != -1 && (j == 0 || j == 4)) { + if (fast_bsphere_check((char *)spD0, 20.0f) != -1 && (j == 0 || j == 4)) { spF0[0] = 0; *(float *)((char *)spF0 + 8) = 12.0f; transform_vector_by_basis(spF0, spF0, (m + 0xC0)); diff --git a/src/overlays/l17/gameplay/hero/00214760.c b/src/overlays/l17/gameplay/hero/00214760.c index 8553677b07..216343414f 100644 --- a/src/overlays/l17/gameplay/hero/00214760.c +++ b/src/overlays/l17/gameplay/hero/00214760.c @@ -144,7 +144,7 @@ extern void FUN_L00_00217118(f32, f32); extern void stick_target(f32, s32) __asm__("FUN_L00_002118c8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void turn_to(s32, f32, f32, f32) __asm__("FUN_L00_00211e30"); -extern s32 FUN_001f9740(void *); +extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 FUN_L00_00229a98(void); extern void FUN_L00_00211e98(void); @@ -181,10 +181,10 @@ extern u8 D_L17_0017C8C0[]; extern void FUN_L00_00216e48(s32, struct MobyView *, s32); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); -extern s32 FUN_001f9770(s16 *); +extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); extern void FUN_L00_00209a40(s32, s32); extern void FUN_L00_00209ca8(s32, s32, s32); -extern void FUN_L00_002a3ec8(s32, s32, s32, f32, f32, f32, f32); +extern void pool_splash(s32, s32, s32, f32, f32, f32, f32) __asm__("FUN_L00_002a3ec8"); extern f32 FUN_L00_0025bc98(f32 *, f32, f32 *, s32, f32, f32, f32); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); @@ -198,7 +198,7 @@ extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 FUN_L00_00209018(void *, s32); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern void FUN_L00_0020a1e0(f32, f32); @@ -222,21 +222,21 @@ extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern s32 FUN_L00_002595a0(f32 *, f32 *, f32, f32, f32); extern void FUN_L00_0025bc00(f32 *, s32, f32, f32); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern f32 square_root(f32) __asm__("FUN_001f9988"); -extern f32 FUN_L00_00233a78(void *); -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); -extern f32 FUN_L00_00213350(void *); +extern f32 gravity_z(void *) __asm__("FUN_L00_00233a78"); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); +extern f32 forward_component(void *) __asm__("FUN_L00_00213350"); extern struct HeroTableRow2C D_L17_0017C528[]; extern struct LevelTable_QS D_L17_00167580; #define Q D_L17_00167580 extern void FUN_L00_00233ba0(void *, void *, f32); -extern void FUN_L00_00233b20(void *, void *, f32); +extern void gravity_set_z(void *, void *, f32) __asm__("FUN_L00_00233b20"); extern void FUN_L00_002336e8(void *, void *, f32); extern void make_hit_descriptor(void *, struct MobyView *, s32, f32, void *) __asm__("FUN_L00_00259888"); extern s32 collect_mobies_in_sphere(f32, void *, s32, struct MobyView *, void *) __asm__("FUN_L00_001f2868"); @@ -248,8 +248,8 @@ extern void FUN_L00_002a9b80(struct MobyView *, void *); extern s32 FUN_L00_002a96f8(struct MobyView *, void *, f32, f32, s32, f32, f32, f32); extern void FUN_L00_002335c8(void *, f32, f32, f32); extern f32 D_L17_001C45F0[]; -extern s32 FUN_L00_002598b0(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32); -extern f32 FUN_001f9ab0(void *, void *); +extern s32 play_entity_sound(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32) __asm__("FUN_L00_002598b0"); +extern f32 fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); struct PlayerSpeedTuning { u8 pad0[8]; f32 x08; @@ -261,14 +261,14 @@ extern struct PlayerSpeedTuning D_L17_0017C6B8; extern s32 FUN_L00_00216de8(s32, s32); extern void FUN_L00_00233708(void *, void *, f32); extern void FUN_L00_00233810(void *, void *, f32); -extern s32 FUN_001efa68(void *, void *, s32, struct MobyView *, s32); +extern s32 collision_line(void *, void *, s32, struct MobyView *, s32) __asm__("FUN_001efa68"); extern void FUN_L00_00215b68(void); extern void FUN_L00_00233660(void *, f32, f32, f32); extern s32 FUN_L00_0025e3b8(s32); -extern void FUN_L00_00259bc8(s32, struct MobyView *, s32, void *, void *, f32); +extern void spawn_nearby_effect(s32, struct MobyView *, s32, void *, void *, f32) __asm__("FUN_L00_00259bc8"); extern s32 D_L17_00178800[]; extern void FUN_L00_00209ec8(void); -extern void FUN_L00_002338d0(void *, void *); +extern void gravity_flatten(void *, void *) __asm__("FUN_L00_002338d0"); extern s32 hero_slot_item_id(s32) __asm__("FUN_L00_0020d498"); extern void FUN_L00_0020b5b8(void); extern void FUN_L00_0020bed0(void); @@ -281,7 +281,7 @@ extern void FUN_L00_0020d2f8(void *); extern f32 randf_sym(f32, f32) __asm__("FUN_L00_00257c48"); extern void FUN_L00_0026d598(void *, void *, s32); extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); -extern s32 FUN_L00_0025d808(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); +extern s32 sample_path(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); extern s32 FUN_L00_0025d7a0(void *, s32, s32, s32); extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); extern void hero_integrate_velocity(void) __asm__("FUN_L00_00214108"); @@ -346,7 +346,7 @@ void FUN_L17_00214760(void) { transform_vector_by_basis(&hero.motion.unk170, &v0, &D_L17_001676D8[0x1F8]); hero.motion.move_yaw = *(f32 *)D_L17_001676D8; turn_to(0, frame_scale_sq, frame_scale_sq * 0.0f, frame_time * 174.53293f); - if (D_L17_0015F688 > 0 && FUN_001f9740(&D_L17_0015F688) != 0) { + if (D_L17_0015F688 > 0 && fast_dec_timer(&D_L17_0015F688) != 0) { s32 t; if (usage_stats.stat[18].count < 0xFFFF) { usage_stats.stat[18].count++; @@ -509,7 +509,7 @@ void FUN_L17_00214760(void) { } if (hero.unk90A != 0) { s32 n; - FUN_001f9770(&hero.unk90A); + fast_dec_timer_s16(&hero.unk90A); n = (s16)hero.unk90A >> 2; FUN_L00_00209a40(n > 8 ? 8 : n, 0); } @@ -523,7 +523,7 @@ void FUN_L17_00214760(void) { if (hero.state_timer == 1) { FUN_L00_00209ca8(3, 0x10, 0); if (D_L17_001612D0 != 0) { - FUN_L00_002a3ec8(D_L17_001612D0, D_L17_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L17_001612D0, D_L17_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, -0.3f); } hero.unk90A = scale_game_frames(70); @@ -634,7 +634,7 @@ void FUN_L17_00214760(void) { stick_target(1.0f, 0); turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); hero.unk8EC = hero.motion.unk184; - FUN_001f9740(&hero.unk8F4); + fast_dec_timer(&hero.unk8F4); if (hero.state.step == 1) { hero.target_speed = frame_time * 6.0f; } else if (hero.state.current == 0x35) { @@ -664,7 +664,7 @@ void FUN_L17_00214760(void) { if (hero.state.current != 0x35 || !(PD.u1A0.i1A0 & 0xA)) { hero.target_speed *= k; }; - if (FUN_001f9740(&hero_b.unk8F0) != 0) { + if (fast_dec_timer(&hero_b.unk8F0) != 0) { s32 lo2; s32 hi2; pl = &hero_b; @@ -687,7 +687,7 @@ void FUN_L17_00214760(void) { } pl->unk8F0 = random_int_between(lo2, scale_game_frames(hi2)); } - if (hero.state.current == 0x35 && FUN_001f9770(&hero.unk8F8) != 0) { + if (hero.state.current == 0x35 && fast_dec_timer_s16(&hero.unk8F8) != 0) { struct MobyView *gm = (struct MobyView *)hero.items[3].moby; if (gm != NULL && gm->hA6 == 0x261) { s32 i; @@ -725,7 +725,7 @@ void FUN_L17_00214760(void) { } build_spherical_offset(&hero.motion.velocity, sp, hero.motion.rot.f[2], yaw); } else if (hero.state.current == 0x34) { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); if (hero.state.prev == 0x35) { approach_value(&len, 0.0f, frame_time_sq * 8.0f); } else { @@ -773,11 +773,11 @@ void FUN_L17_00214760(void) { break; case 0x6A: case 0x82: { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); approach_value(&len, 0.0f, frame_time_sq * 4.0f); fast_vec_normalize(&hero.motion.unk150, &hero.motion.unk150, len); qcopy(&hero.motion.velocity, &hero.motion.unk150); - if (FUN_001f9740(&hero.unk8F0) == 2) { + if (fast_dec_timer(&hero.unk8F0) == 2) { moby_point_position((struct MobyView *)hero.moby, 4, &v0); v20.q = 0; v20.f[0] = 0.4f; @@ -824,7 +824,7 @@ void FUN_L17_00214760(void) { } } turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); - FUN_001f9740(&hero.unk698); + fast_dec_timer(&hero.unk698); if (hero.state.current == 0x36) { if (PD.i1D4 != 0 && hero.unk698 != 0) { hero.target_speed = frame_time * 3.0f; @@ -948,7 +948,7 @@ void FUN_L17_00214760(void) { FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, 0.0f, frame_time * 3.8397243f); } else { f32 an = fast_add_rotations( - -fast_arc_tan(FUN_001f9b80(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); + -fast_arc_tan(vector_distance(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, an, frame_time * 6.4577184f); } v20.f[0] = fast_cos(fast_add_rotations(hero.motion.rot.f[2], -1.5707964f)) * -0.57f; @@ -1032,14 +1032,14 @@ void FUN_L17_00214760(void) { } if (hero.unk99C != 0) { f32 s; - if (FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { + if (vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.displacement, frame_time_sq * 40.0f); - if (hero.unk9BE != 0 && FUN_L00_00233a78(&hero.motion.velocity) > 0.0f) { + if (hero.unk9BE != 0 && gravity_z(&hero.motion.velocity) > 0.0f) { subtract_vector_xyz(&v30, &hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 57.0f); } } - s = FUN_001f9af0(&hero.motion.velocity) * (frame_time * 0.015f); + s = fast_vec_length(&hero.motion.velocity) * (frame_time * 0.015f); fast_vec_scale(&v30, &hero.motion.velocity, -1.0f); fast_vec_normalize(&v30, &v30, s); add_vector_xyz(&hero.motion.velocity, &hero.motion.velocity, &v30); @@ -1047,7 +1047,7 @@ void FUN_L17_00214760(void) { { struct MobyView *r; if ((struct MobyView *)hero.unk994 != NULL && (r = ((struct MobyView *)hero.unk994)->pm78) != NULL) { - f32 len = FUN_001f9af0(&hero.motion.velocity); + f32 len = fast_vec_length(&hero.motion.velocity); if (r->fC < len) { approach_value(&len, r->fC, frame_time_sq * 15.0f); fast_vec_normalize(&hero.motion.velocity, &hero.motion.velocity, len); @@ -1068,9 +1068,9 @@ void FUN_L17_00214760(void) { add_vector_xyz(&v30, &((struct MobyView *)hero.unk994)->u10.v10, &vC0); subtract_vector_xyz(&hero.motion.velocity, &v30, &vD0); old = hero.unk9A4; - FUN_L00_0025b8c0(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); + vendor_spring(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); d = hero.unk9A4 - old; - if (FUN_001f9af0(&vC0) > hero.unk9A4) { + if (fast_vec_length(&vC0) > hero.unk9A4) { fast_vec_normalize(&vC0, &vC0, d); add_vector_xyz(&hero.motion.pos, &hero.motion.pos, &vC0); } @@ -1079,7 +1079,7 @@ void FUN_L17_00214760(void) { f32 mx = frame_time * 14.0f; f32 sp = vector_length_xy(&hero.motion.velocity); if (sp < mx) { - FUN_L00_0025b8c0(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); + vendor_spring(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); v30.f[0] = fast_cos(hero.unk9AC) * hero.unk9B4; v30.f[1] = fast_sin(hero.unk9AC) * hero.unk9B4; v30.f[2] = 0.0f; @@ -1096,7 +1096,7 @@ void FUN_L17_00214760(void) { up = hero.unk9BC == 1; } else { v30.q = hero.motion.displacement.q; - up = FUN_L00_00213350(&v30) > 0.0f; + up = forward_component(&v30) > 0.0f; } if (up) { if (moby->b53 != 0x35) { @@ -1132,12 +1132,12 @@ void FUN_L17_00214760(void) { mx = frame_time_sq * 70.0f; t2 = scale_game_frames(33); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk4B0); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unk4B8 = 1.0f; } } @@ -1170,7 +1170,7 @@ void FUN_L17_00214760(void) { hero.target_speed = 0.0f; if (hero.unk12E2 != 0) { if ((struct MobyView *)hero.unkA54 != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = frame_time * 4.5f; } @@ -1183,7 +1183,7 @@ void FUN_L17_00214760(void) { } } else { if ((struct MobyView *)hero.unkA54 != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = frame_time * 4.5f; } @@ -1225,16 +1225,16 @@ void FUN_L17_00214760(void) { } FUN_L00_00211870(27.0f); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 130.0f); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unkA70 = 1.0f; } - if (FUN_L00_00233a78(&hero.motion.velocity) < frame_time * -37.0f) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); + if (gravity_z(&hero.motion.velocity) < frame_time * -37.0f) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); } } break; @@ -1322,7 +1322,7 @@ void FUN_L17_00214760(void) { tb = &D_L17_0017C528[hero.attack_record]; hero.target_speed = 0.0f; if ((struct MobyView *)hero.unkA54 != NULL && scale_game_frames(4) > hero.state_timer) { - f32 d = FUN_001f9b80(&((struct MobyView *)hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; + f32 d = vector_distance(&((struct MobyView *)hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; f32 off; f32 tol; f32 mx; @@ -1590,7 +1590,7 @@ void FUN_L17_00214760(void) { Vec4 *p = &hero.move_impulse; FUN_L00_002132b8(0.7f, 0.0f); v0.q = hero.move_impulse.q; - hero.target_speed += FUN_L00_00213350(&v0); + hero.target_speed += forward_component(&v0); if (hero.target_speed < frame_time * 0.7f) { hero.target_speed = frame_time * 0.7f; } @@ -1716,7 +1716,7 @@ void FUN_L17_00214760(void) { v10.f[2] += random_float_between(frame_time, frame_time * 2.0f); FUN_L00_00271b18(&v0, &v10, random_float_between(37800.0f, 75600.0f)); } - f = FUN_001f9af0(&hero.motion.platform_delta); + f = fast_vec_length(&hero.motion.platform_delta); if (f > frame_time * 0.5f) { hero.motion.move_yaw = fast_arc_tan(hero.motion.platform_delta.f[0], hero.motion.platform_delta.f[1]); } else { @@ -1823,9 +1823,9 @@ void FUN_L17_00214760(void) { if (hero.state.current == 0x42) { r = hero.unk5CC * (f32)hero.unk578; } - FUN_L00_0025d808((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); + sample_path((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); if (hero.unk590 != 0) { - FUN_L00_0025d808((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); + sample_path((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); } if (scale_game_frames(90) < hero.unk19C) { s32 h; @@ -1835,11 +1835,11 @@ void FUN_L17_00214760(void) { qcopy(&v20, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - h = FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); + h = sample_path((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); qcopy(&v30, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - if ((h | FUN_L00_0025d808((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || + if ((h | sample_path((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || hero.unk584 != 0) { f32 a = fast_subtract_rotations( hero.unk57C, fast_arc_tan(v30.f[0] - v20.f[0], v30.f[1] - v20.f[1])) * @@ -1896,7 +1896,7 @@ void FUN_L17_00214760(void) { } idx = FUN_L00_0025d7a0((void *)hero.unk560, hero.unk564, hero.unk578, hero.unk584); subtract_vector_xyz(&v20, (Vec4 *)hero.unk560 + (idx + 1), &v0); - if (FUN_001f9af0(&v20) < 0.001f) { + if (fast_vec_length(&v20) < 0.001f) { if (hero.unk564 == idx) { hero.unk570 = scale_game_frames(1); break; @@ -1943,7 +1943,7 @@ void FUN_L17_00214760(void) { hero.motion.pos.f[2] += v20.f[2]; subtract_vector_xyz(&v30, &hero.unk500, &hero.motion.pos); v30.f[2] = 0.0f; - if (FUN_001f9af0(&v30) > frame_time) { + if (fast_vec_length(&v30) > frame_time) { fast_vec_normalize(&v30, &v30, frame_time); } hero.motion.pos.f[0] += v30.f[0]; @@ -1989,8 +1989,8 @@ void FUN_L17_00214760(void) { si = hero.unk564; sf = hero.unk568; qcopy(&v20, &hero.motion.pos); - FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); - e = fast_arc_tan(FUN_001f9b80(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); + sample_path((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); + e = fast_arc_tan(vector_distance(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); if (e > 0.0f) { sp = e * 1.9098593f * (frame_time * -2.5f); if (e > 0.2617994f && hero.unk5A8 != 2 && hero.unk5A8 != 3) { @@ -2027,9 +2027,9 @@ void FUN_L17_00214760(void) { f32 mx = frame_time * 7.0f; f32 fl; f32 len; - fl = -FUN_001f9af0(&v20); - FUN_L00_0025b8c0(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); - len = FUN_001f9af0(&v20); + fl = -fast_vec_length(&v20); + vendor_spring(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); + len = fast_vec_length(&v20); if (len < hero.unk5DC) { hero.unk5DC = len; } @@ -2082,10 +2082,10 @@ void FUN_L17_00214760(void) { hero.motion.velocity.f[2] = hero.motion.velocity.f[2] - frame_time_sq * 24.0f; break; } - FUN_L00_0025d808(hero.unk5F0, &v10, &hero.unk5F4, &hero.unk5F8, hero.unk604, hero.unk60C); + sample_path(hero.unk5F0, &v10, &hero.unk5F4, &hero.unk5F8, hero.unk604, hero.unk60C); idx = FUN_L00_0025d7a0(hero.unk5F0, hero.unk5F4, 1, hero.unk60C); subtract_vector_xyz(&v20, (Vec4 *)hero.unk5F0 + (idx + 1), &v10); - if (FUN_001f9af0(&v20) < 0.001f) { + if (fast_vec_length(&v20) < 0.001f) { if (hero.unk5F4 == idx) { hero.unk600 = scale_game_frames(1); break; @@ -2102,10 +2102,10 @@ void FUN_L17_00214760(void) { { f32 fl; f32 len; - fl = -FUN_001f9af0(&v20); - FUN_L00_0025b8c0(&fl, &hero.unk618.f, 0.0f, frame_scale_sq * 0.05f, frame_scale_sq * 0.3f, + fl = -fast_vec_length(&v20); + vendor_spring(&fl, &hero.unk618.f, 0.0f, frame_scale_sq * 0.05f, frame_scale_sq * 0.3f, frame_time * 10.0f); - len = FUN_001f9af0(&v20); + len = fast_vec_length(&v20); if (len < hero.unk618.f) { hero.unk618.f = len; } @@ -2211,8 +2211,8 @@ void FUN_L17_00214760(void) { FUN_L00_00215340(); FUN_L00_002132b8(0.7f, frame_time * 0.0f); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; case 0x77: { @@ -2224,8 +2224,8 @@ void FUN_L17_00214760(void) { len = vector_length_xy(&hero.motion.velocity); FUN_L00_001ff600(frame_scale * -0.100000024f * len + len, &hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; } @@ -2270,11 +2270,11 @@ void FUN_L17_00214760(void) { FUN_L00_00215340(); FUN_L06_002291d0(1); if (big) { - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); hero.unk304 = hero.motion.velocity.f[2]; } else { - FUN_L00_0025b8c0(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, + vendor_spring(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, frame_scale_sq * 0.35f, frame_time * 2.5f); } break; @@ -2309,7 +2309,7 @@ void FUN_L17_00214760(void) { speed_step(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); FUN_L00_00215340(); - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); if (hero.motion.pos.f[2] < hero.unk410) { approach_value(&hero.unk410, hero.motion.pos.f[2], frame_time * 4.0f); @@ -2353,7 +2353,7 @@ void FUN_L17_00214760(void) { if (hero.state_timer == scale_game_frames(20)) { FUN_L00_00209ca8(3, 0x10, 1); if (D_L17_001612D0 != 0) { - FUN_L00_002a3ec8(D_L17_001612D0, D_L17_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L17_001612D0, D_L17_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, 0.35f); } } @@ -2413,7 +2413,7 @@ void FUN_L17_00214760(void) { qcopy(&v10, &v0); v10.f[0] += fast_cos(hero.motion.rot.f[2]) * 0.85f; v10.f[1] += fast_sin(hero.motion.rot.f[2]) * 0.85f; - if (FUN_001efa68(&v0, &v10, 4, (struct MobyView *)hero.moby, 0) != 0) { + if (collision_line(&v0, &v10, 4, (struct MobyView *)hero.moby, 0) != 0) { hero.unk4A4 = 1; } } @@ -2437,7 +2437,7 @@ void FUN_L17_00214760(void) { if (hero.motion.pos.f[2] < hero.unk410) { hero.unk410 = hero.motion.pos.f[2]; } - if (hero.state_timer > hero.unk420 && FUN_L00_00233a78(&hero.motion.velocity) < 0.001f && + if (hero.state_timer > hero.unk420 && gravity_z(&hero.motion.velocity) < 0.001f && (hero.unk41C == 0 || hero.state_timer > hero.unk3D4)) { hero.unk41E = 1; if (hero.unk3F8 != 0.0f) { @@ -2463,7 +2463,7 @@ void FUN_L17_00214760(void) { fast_vec_scale(&v10, &hero.motion.displacement, 7.0f); for (i = 0; i < n; i++) { if (FUN_L00_0025e3b8(D_L17_00178800[i]) != 0) { - FUN_L00_00259bc8(D_L17_00178800[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, + spawn_nearby_effect(D_L17_00178800[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, 1.0f); } } @@ -2549,7 +2549,7 @@ void FUN_L17_00214760(void) { } case 0x66: subtract_vector_xyz(&v0, &hero.unk1640, &hero.motion.pos); - if (FUN_001f9ab0(&v0, &hero.motion.unk150) < 0.0f) { + if (fast_vec_dot(&v0, &hero.motion.unk150) < 0.0f) { clear_u64_value(&hero.motion.unk150); } clear_u64_value(&hero.motion.velocity); @@ -2617,7 +2617,7 @@ void FUN_L17_00214760(void) { moby_point_position((struct MobyView *)hero.moby, k | 1, &v20); add_vector_xyz(&v0, &v10, &v20); fast_vec_scale(&v0, &v0, 0.5f); - FUN_L00_002598b0((struct MobyView *)hero.moby, 0.25f, &v0, 0x10000, 1.0f, 1.0f, 0, 1, 0); + play_entity_sound((struct MobyView *)hero.moby, 0.25f, &v0, 0x10000, 1.0f, 1.0f, 0, 1, 0); } approach_value(&hero.anim_speed, 1.0f, 0.2f); if (hero.unkA58 != 0 || (struct MobyView *)hero.unkA54 != NULL) { @@ -2656,7 +2656,7 @@ void FUN_L17_00214760(void) { turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 8.726646f); speed_step(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); break; } @@ -2869,3 +2869,5 @@ void FUN_L17_00214760(void) { hero.unk1A4 = 0; } } + +f32 D_L17_0017B1F0[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/l17/gameplay/hero/002258a8.c b/src/overlays/l17/gameplay/hero/002258a8.c index d2f01dd6f3..d9e88a844a 100644 --- a/src/overlays/l17/gameplay/hero/002258a8.c +++ b/src/overlays/l17/gameplay/hero/002258a8.c @@ -51,12 +51,12 @@ extern float D_L17_0015F638; extern float D_L17_001676D8 __attribute__((section(".data"))); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_00208f20(float a, float b, float c, float d); extern float FUN_L00_00232b90(float a, float b, float c); -extern float FUN_L00_00233a78(float *v); +extern float gravity_z(float *v) __asm__("FUN_L00_00233a78"); extern float FUN_L00_00233c30(float *pos, float *vel, int *steps, float step); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float FUN_L00_00259468(float *a, float *b, int *out, float f); @@ -74,7 +74,7 @@ int r1_repeat_timer __asm__("D_L17_0015F678") = 0; extern int D_L17_0015F6DC_d __asm__("D_L17_0015F6DC"); extern int D_L17_0015F594 __attribute__((sda)); extern int D_L17_0016D080 __attribute__((section(".data"))); -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_002050b8(int); extern int FUN_L00_0020c758(float *, float *); @@ -94,7 +94,7 @@ extern int hero_handle_jump_press(void) __asm__("FUN_L00_00229660"); extern int FUN_L00_00229910(void); extern int FUN_L00_00229a98(void); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int FUN_L00_0025d808(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); +extern int sample_path(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); extern int FUN_L00_0025df68(void *, void *, void *, int *, float *, int, float, float, float); extern int pad_pressed_within(int, int, int *) __asm__("FUN_L00_00266d60"); extern int FUN_L00_00266e00(int, int, int, int); @@ -123,7 +123,7 @@ extern void FUN_L00_00232628(void); extern void FUN_L00_00232640(int id); extern void FUN_L00_00233288(float a, float b, short c, unsigned char d, unsigned char e, unsigned char f); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void hud_keep_visible(int, int) __asm__("FUN_L00_00235e18"); extern void FUN_L00_00237ae8(void); extern void FUN_L00_00237ba0(void); @@ -985,7 +985,7 @@ void FUN_L17_002258a8(void) { } break; case 101: - if (FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { + if (vector_distance(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { if (frame_time * 2.7f > hero.motion.speed_xy) { if (fast_difference_between_rotations( hero.motion.rot.f[2], hero.unk1640.f[3]) < 0.034906585f) { @@ -1009,7 +1009,7 @@ void FUN_L17_002258a8(void) { if ((hero.unkA98 & 2) || hero.unk1650 != 0) { hero_set_state(HERO_STATE_IDLE, 1); } - if (0.2f < FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f)) { + if (0.2f < vector_distance(hero.motion.pos.f, hero.unk1640.f)) { hero_set_state(0x65, 1); } break; @@ -1328,7 +1328,7 @@ void FUN_L17_002258a8(void) { v1[1] = fast_sin(hero.unk57C) * 5.0f; v1[2] = 0.0f; add_vector_xyz(v1, v1, v0); - if (FUN_001efa68(v0, v1, 2, 0, 0)) { + if (collision_line(v0, v1, 2, 0, 0)) { ok = 0; } } @@ -1489,7 +1489,7 @@ void FUN_L17_002258a8(void) { path_seg = hero.unk564; path_t = hero.unk568; /* Step a copy of the hero position along its current path. */ - if (FUN_L00_0025d808((int *)hero.unk560, v0, &path_seg, + if (sample_path((int *)hero.unk560, v0, &path_seg, &path_t, hero.unk584, t)) { scale_vector_xyz(v1, hero.motion.displacement.f, scale_game_frames(0x30)); @@ -1520,7 +1520,7 @@ void FUN_L17_002258a8(void) { } } if (hero.state_timer > hero.unk420) { - if (FUN_L00_00233a78(hero.motion.velocity.f) < 0.001f) { + if (gravity_z(hero.motion.velocity.f) < 0.001f) { hero.unk41E = 1; } } @@ -1771,7 +1771,7 @@ void FUN_L17_002258a8(void) { if (hero_set_state(HERO_STATE_IDLE, 0)) { set_hero_animation(0xC, 9, -1.0f); } - FUN_L00_00233b20(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); + gravity_set_z(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); FUN_L00_0025f730(hero.motion.unk150.f, frame_time * 7.0f); hero.unk1C4 = scale_game_frames(7); if (hero.state.prev == 0x2D) { @@ -2289,7 +2289,7 @@ void FUN_L17_002258a8(void) { scale_game_frames(0xE) < hero.state_timer && (hero.unk41E == 0 || (hero.ground_distance > 0.7f && - absolute_float(FUN_L00_00233a78(hero.motion.velocity.f)) < + absolute_float(gravity_z(hero.motion.velocity.f)) < frame_time * 5.8f))) { hero_set_state(0xE, 1); } else if (D_0013D4C0[2] != 0 && hero_slot_item_id(3) != 4 && diff --git a/src/overlays/l17/gameplay/hero/hero_set_state.c b/src/overlays/l17/gameplay/hero/hero_set_state.c index d56486daf7..7177c08306 100644 --- a/src/overlays/l17/gameplay/hero/hero_set_state.c +++ b/src/overlays/l17/gameplay/hero/hero_set_state.c @@ -42,10 +42,10 @@ extern char *hero_slot_moby(int) __asm__("FUN_L00_0020d460"); extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L17_0017C6F0[][25]; extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_0020d658(int back); -extern float FUN_L00_002339d0(float *v); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float dot_vectors_xyz(void *a, void *b); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); @@ -84,14 +84,14 @@ extern void FUN_L00_00216ec0(int, int, int); extern void FUN_L00_00217450(void); extern void set_hero_animation(int, int, float) __asm__("FUN_L00_002323b8"); extern void FUN_L00_002325e0(int bank, int seq); -extern void FUN_L00_00233b20(float *dst, float *src, float z); -extern void FUN_L00_00250320(void *, void *, void *, void *); -extern void FUN_L00_0025d808(int a, char *pos, char *b, char *c, int d, float f) __asm__("FUN_L00_0025d808"); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); +extern void get_moby_color(void *, void *, void *, void *) __asm__("FUN_L00_00250320"); +extern void sample_path(int a, char *pos, char *b, char *c, int d, float f) __asm__("FUN_L00_0025d808"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L00_00262500(int a, char *b); extern void FUN_L00_00262528(char *o, int a, int b); extern void FUN_L00_00262840(char *o); -extern void FUN_L00_002a3ec8(int, int, int, float, float, float, float); +extern void pool_splash(int, int, int, float, float, float, float) __asm__("FUN_L00_002a3ec8"); extern void FUN_L06_00239528(void); extern void fill_transfer_words(void *, int, int) __asm__("func_001F97E8"); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); @@ -327,14 +327,14 @@ int hero_set_state(int a, int b) { if (p->state.prev_control_mode == 0x11) { FUN_L00_00209ca8(3, 0xA, 0); if (D_L17_001612D0 != 0) { - FUN_L00_002a3ec8(D_L17_001612D0, D_L17_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L17_001612D0, D_L17_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.4f, 0.3f); } } else if (p->motion.displacement.f[2] < frame_time * -0.5f) { int n = truncate_float_to_s32(absolute_float(p->motion.displacement.f[2]) * 300.0f); FUN_L00_00209ca8(3, n < 0x28 ? n : 0x28, 1); if (D_L17_001612D0 != 0) { - FUN_L00_002a3ec8(D_L17_001612D0, D_L17_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L17_001612D0, D_L17_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.5f, -0.4f); } p->unk90A = scale_game_frames(0x4B); @@ -701,7 +701,7 @@ int hero_set_state(int a, int b) { char *v = &p->motion.unk110; p->state.control_mode = 1; p->unk2284 = 0; - p->ground_speed = FUN_L00_002339d0((float *)v); + p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.unk150, v); if (b) { int id = 6; @@ -757,7 +757,7 @@ int hero_set_state(int a, int b) { *(unsigned int *)(h + 0x64) | (1 << current_level_index) | 0x80000000; } p->motion.move_yaw = - FUN_001f9e90(*(float *)(((char *)p->unk964) + 0x10) - p->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)p->unk964) + 0x10) - p->motion.pos.f[0], *(float *)(((char *)p->unk964) + 0x14) - p->motion.pos.f[1]); if (b) { set_hero_animation(0x2F, 2, (float)scale_game_frames(5)); @@ -833,7 +833,7 @@ int hero_set_state(int a, int b) { if (*(float *)(d + 0x2C) != 0.0f) q->unk9CC = *(float *)(d + 0x2C); q->unk9AC = - FUN_001f9e90(*(float *)(((char *)q->unk994) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unk994) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unk994) + 0x14) - q->motion.pos.f[1]); q->unk9A4 = FUN_001f9b48(&q->motion.pos, ((char *)q->unk994) + 0x10); q->unk9B0 = frame_time_sq * 27.0f; @@ -898,7 +898,7 @@ int hero_set_state(int a, int b) { p->unk5B8 = 0; p->unk5BC = 0; p->unk5C0 = 0; - FUN_L00_0025d808(p->unk560, (char *)&out, (char *)&i, (char *)&f, + sample_path(p->unk560, (char *)&out, (char *)&i, (char *)&f, p->unk584, 1.0f); subtract_vector_xyz(&d.v, &out, &p->motion.pos); if (0.001f < vector_length_xyz(&d.v)) { @@ -912,10 +912,10 @@ int hero_set_state(int a, int b) { if (((char *)q->unk5D8) != 0) { if (1.5707964f < fast_difference_between_rotations( - FUN_001f9e90( + fast_arc_tan( *(float *)(((char *)q->unk5D8) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unk5D8) + 0x14) - q->motion.pos.f[1]), - fast_add_rotations(q->unk588, FUN_001f9e90(d.v.x, d.v.y)))) { + fast_add_rotations(q->unk588, fast_arc_tan(d.v.x, d.v.y)))) { q->unk588 = 1.5707964f; q->unk58C = 1; } @@ -941,7 +941,7 @@ int hero_set_state(int a, int b) { t = p->unk5F8; i = p->unk5F4; f = t; - FUN_L00_0025d808(((int)p->unk5F0), (char *)&out, (char *)&i, (char *)&f, + sample_path(((int)p->unk5F0), (char *)&out, (char *)&i, (char *)&f, p->unk60C, 1.0f); subtract_vector_xyz(&d.v, &out, &p->motion.pos); if (0.001f < vector_length_xyz(&d.v)) { @@ -1184,7 +1184,7 @@ int hero_set_state(int a, int b) { u->unk48C = 1.98f; u->unk430 = 1.95f; } else { - FUN_L00_00233b20((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); + gravity_set_z((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); u->unk41C = 1; u->unk3D0 = scale_game_frames(2); u->unk3D4 = scale_game_frames(0x23) + u->unk3D0; @@ -1527,7 +1527,7 @@ int hero_set_state(int a, int b) { if (1.5707964f < fast_difference_between_rotations( q->motion.rot.f[2], - FUN_001f9e90(q->unk500.f[0] - q->unk540.f[0], + fast_arc_tan(q->unk500.f[0] - q->unk540.f[0], q->unk500.f[1] - q->unk540.f[1]))) id = 0x1F; set_hero_animation(id, 0, (float)scale_game_frames(5)); @@ -1768,7 +1768,7 @@ int hero_set_state(int a, int b) { if (q->items[0].item_id == 0xA && ((char *)q->unkA50) != 0) { q->unkA58 = 1; q->unkA5C = - FUN_001f9e90(*(float *)(((char *)q->unkA50) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unkA50) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unkA50) + 0x14) - q->motion.pos.f[1]); } break; @@ -1924,7 +1924,7 @@ int hero_set_state(int a, int b) { { struct Hero *q = &hero; q->unk22F4 = 1; - FUN_L00_00250320(((void *)q->moby), &c0, &c1, &c2); + get_moby_color(((void *)q->moby), &c0, &c1, &c2); q->unk22F8 = (c2 << 16) | ((c1 << 8) | 0x80000000) | c0; } return 0; diff --git a/src/overlays/l18/gameplay/entities/deplanetizer_gun.c b/src/overlays/l18/gameplay/entities/deplanetizer_gun.c index 93efce3833..c373a3f2c8 100644 --- a/src/overlays/l18/gameplay/entities/deplanetizer_gun.c +++ b/src/overlays/l18/gameplay/entities/deplanetizer_gun.c @@ -18,7 +18,7 @@ extern void add_9780(void *, void *, void *) __asm__("FUN_001f9a10"); extern void norm_9780(void *, void *, float) __asm__("FUN_001f9bf8"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void FUN_L00_00263b70(void *, void *, void *, float, float); +extern void draw_trail(void *, void *, void *, float, float) __asm__("FUN_L00_00263b70"); extern void enqueue_callback_list_1_overlay(void *, void *) __asm__("FUN_L18_002020c8"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern void FUN_L18_002fa250(void *, void *, void *, float, float); @@ -125,7 +125,7 @@ void FUN_L18_002f88e8(struct Moby *moby) { if (i == 5 && frames_9780(645) <= D_L18_0016D260_update.n && D_L18_0016D260_update.n <= frames_9780(730)) radius = 300000.0f; - FUN_L00_00263b70(&direction, &direction, D_L18_0015F580, radius, radius * 0.4f); + draw_trail(&direction, &direction, D_L18_0015F580, radius, radius * 0.4f); } } } @@ -687,7 +687,7 @@ void FUN_L18_002f9eb8(struct Moby *m) { /* Ported from rac1-decomp (src/overlays/l18_veldin2/vendor_002F9D48.c: func_L18_002FB6B0), where it is exact; names translated to the US level program. */ -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern s32 random_integer_below(s32) __asm__("FUN_00213260"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); unsigned char *FUN_L00_0026d000(void *pos, int n, void *vel, int color, float r, float lo, float hi, @@ -712,7 +712,7 @@ void FUN_L18_002fa250(void *a, void *b, void *c, float f0, float f1) { f0, 0x7F204080); p = m + 0x20; if (m) { - *(short *)(m + 0xA) = FUN_001f96f8(15); + *(short *)(m + 0xA) = scale_game_frames(15); m[9] = func_001FA898_r(4.0f) + 0x40; *(int *)(p + 4) = 2; p[0xA] = 0x7F; @@ -730,7 +730,7 @@ void FUN_L18_002fa250(void *a, void *b, void *c, float f0, float f1) { p = m + 0x20; if (m) { m[9] = func_001FA898_r(4.0f) + 0x40; - *(short *)(m + 0xA) = FUN_001f96f8(4); + *(short *)(m + 0xA) = scale_game_frames(4); m[8] = random_integer_below(0xFF); *(int *)(p + 4) = k2; p[0xA] = k7f; @@ -747,6 +747,7 @@ extern f32 fast_add_rotations(f32 a, f32 b) __asm__("FUN_001fa580"); extern int D_L18_0015F5C4; extern int D_L18_0016D290_lui __asm__("D_L18_0016D290") __attribute__((section(".data"))); +void FUN_L18_002fa640(struct Moby *moby); void FUN_L18_002fa640(struct Moby *moby) { switch (moby->state) { case 0: @@ -781,9 +782,9 @@ void FUN_L18_002fa640(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/l18_veldin2/vendor_002F9D48.c: func_L18_002FBB88), where it is exact; names translated to the US level program. */ extern char *func_0020D348_m(int); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void FUN_L00_00250df8(void *); -extern void FUN_L00_00260738(char *a, void *b, void *c, void *d); +extern void update_entity_matrix(char *a, void *b, void *c, void *d) __asm__("FUN_L00_00260738"); extern char *func_0020D348_m(int) __asm__("FUN_0020c4f8"); void FUN_L18_002fa728(char *moby) { @@ -795,8 +796,8 @@ void FUN_L18_002fa728(char *moby) { moby[0x20] = 1; break; case 1: - FUN_001f9a28(tmp, moby + 0x10, data + 0x60); - FUN_L00_00260738(data + 0x20, tmp, data + 0x70, moby + 0x40); + fast_vec_sub(tmp, moby + 0x10, data + 0x60); + update_entity_matrix(data + 0x20, tmp, data + 0x70, moby + 0x40); break; } if (*(unsigned char *)(moby + 0xBC) != 0 && *(int *)(data + 0x80) != 0 && @@ -891,7 +892,7 @@ extern ML D_L18_0016D260; extern int D_L18_0015F5C4; extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void FUN_L00_00263b70(void *, void *, void *, float, float); +extern void draw_trail(void *, void *, void *, float, float) __asm__("FUN_L00_00263b70"); extern short D_L18_00162578 __attribute__((sda)); extern short D_L18_0016257C __attribute__((sda)); @@ -919,9 +920,9 @@ void FUN_L18_002fad28(M2 *m) { p = D_L18_0016D260.arr[idx]; moby_point_position(p, 8, buf); moby_point_position(p, 9, buf2); - FUN_001f9a28(buf3, buf, buf2); + fast_vec_sub(buf3, buf, buf2); fast_vec_normalize(buf3, buf3, *(float *)&D_L18_00162578); - FUN_L00_00263b70(buf, buf, buf3, *(float *)&D_L18_0016257C, + draw_trail(buf, buf, buf3, *(float *)&D_L18_0016257C, *(float *)&D_L18_00162580); } } @@ -943,12 +944,12 @@ extern char D_L18_001625F0[4] __attribute__((sda)); extern char D_L18_00162608 __attribute__((sda)); extern float vector_distance_xy(float *, float *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_L00_0025be00(float *, float *, float, float, float, float); +extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); extern float approach_value(float *p, float target, float maxstep) __asm__("FUN_00213ed8"); extern float probe_ground_height(void *, int, float) __asm__("FUN_00213508"); extern float random_angle_radians(void) __asm__("FUN_00213308"); -extern int FUN_L00_0025c698(void *, void *); -extern int FUN_L00_0025e450(); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); +extern int spawn_explosion() __asm__("FUN_L00_0025e450"); extern int FUN_L00_002dc9f0(void *, void *); extern int is_value_within_interpolated_window(char *, float) __asm__("FUN_00214cc8"); extern int random_integer_below(int); @@ -963,13 +964,14 @@ extern void enqueue_callback_list_1(void *, void *) __asm__("FUN_001f4600"); extern void scale_vector_xyz(void *, void *, float); extern void vu_euler_rotation_basis(void *, void *); float FUN_L18_002fc4e0(char *self, float *src); -extern float fd9a0_c(void *, void *) __asm__("FUN_L18_002fc4e0"); +extern float FUN_L18_002fc4e0_c(void *, void *) __asm__("FUN_L18_002fc4e0"); extern float f9d48_i(void *, void *) __asm__("FUN_001f9b80"); extern void func_L00_0025F4A8_alt(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); -void FUN_L18_002fbb98(unsigned char *m) { +void gadgebot_update(unsigned char *m) __asm__("FUN_L18_002fbb98"); +void gadgebot_update(unsigned char *m) { char tmp[16]; unsigned char *e = *(unsigned char **)(m + 0x78); unsigned char *s0; @@ -1038,7 +1040,7 @@ void FUN_L18_002fbb98(unsigned char *m) { case 3: { float f; *(QVd058 *)tmp = *(QVd058 *)(e + 0x180); - f = fd9a0_c(m, tmp); + f = FUN_L18_002fc4e0_c(m, tmp); if (*(int *)(e + 0x1C4) == 2 && f < 5.0f) { m[0x20] = 2; if (m[0x53]) @@ -1062,7 +1064,7 @@ void FUN_L18_002fbb98(unsigned char *m) { k = 6.2831855f; b = frame_time_sq * k; d = frame_time * k; - FUN_L00_0025be00((float *)s0, (float *)(e + 0x1E8), r, b, b, d); + approach_angle((float *)s0, (float *)(e + 0x1E8), r, b, b, d); if (is_value_within_interpolated_window((char *)m, 14.0f)) FUN_L00_002599e8(m, 0.5f, 1.0f, 1.0f, 1, 1, 0, 1, 0); if (m[0x70] & 2) { @@ -1082,7 +1084,7 @@ void FUN_L18_002fbb98(unsigned char *m) { break; } case 5: - if (!(FUN_L00_0025c698(m, e + 0x70) & 0x140)) + if (!(mine_fall(m, e + 0x70) & 0x140)) break; case 6: qcopy(tmp, m + 0x10); @@ -1272,7 +1274,7 @@ typedef struct { extern f32 advance_accelerated_scalar(f32 *, f32 *, f32, f32, f32, f32) __asm__("func_00213F38"); extern float vector_distance_xy(float *, float *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_L00_0025be00(float *, float *, float, float, float, float); +extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); extern float fast_cos(float) __asm__("func_001F9DC8"); extern void FUN_L00_00258830(int, int, float, float, float, int); extern void FUN_L00_00261d78(float, void *, void *, void *); @@ -1290,7 +1292,7 @@ float FUN_L18_002fc4e0(char *self, float *src) { float d = fast_add_rotations( fast_arc_tan(a.v[0] - *(float *)(self + 0x10), a.v[1] - *(float *)(self + 0x14)), *(float *)(o + 0x1EC)); - FUN_L00_0025be00((float *)(self + 0x48), (float *)(o + 0x1E8), d, frame_time_sq * 6.2831855f, + approach_angle((float *)(self + 0x48), (float *)(o + 0x1E8), d, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 6.2831855f); } b[0] = z; @@ -1318,7 +1320,7 @@ typedef struct { u8 pad1F0[4]; f32 unk1F4; /* 0x1F4: set to 1.0 on launch */ } LaunchedMobyVars; -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern float FUN_L00_0025abf0(void *, void *, float, float, int); extern float randf_sym(float, float) __asm__("FUN_L00_00257c48"); @@ -1344,7 +1346,7 @@ int FUN_L18_002fc668(int group, void *from, void *to, float speed) { qcopy(&moby->pos, from); moby->state = 1; v->unk1F4 = 1.0f; - FUN_001f9a28(v->velocity, to, from); + fast_vec_sub(v->velocity, to, from); v->velocity[2] = 0.0f; fast_vec_normalize(v->velocity, v->velocity, speed); v->velocity[2] = FUN_L00_0025abf0(from, to, speed, -(frame_time_sq * 10.0f), 0); diff --git a/src/overlays/l18/gameplay/entities/drek_fight_missile.c b/src/overlays/l18/gameplay/entities/drek_fight_missile.c index d5e2565364..2397c9d87e 100644 --- a/src/overlays/l18/gameplay/entities/drek_fight_missile.c +++ b/src/overlays/l18/gameplay/entities/drek_fight_missile.c @@ -43,7 +43,7 @@ extern short D_L18_00162214_gp __asm__("D_L18_00162214") __attribute__((sda)); extern short D_L18_00162218 __attribute__((sda)); extern short D_L18_00162234 __attribute__((sda)); extern void lerp_vector(void *, void *, void *, float) __asm__("FUN_001f9a40"); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L18_002f02e8(char *moby, void *out); extern void FUN_L18_002f0848(struct Moby *moby); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); @@ -53,7 +53,8 @@ extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern int func_0022ED80_2F0F78(int, int, int) __asm__("FUN_0022da68"); -void FUN_L18_002efb88(struct Moby *moby) { +void drek_fight_missile_update(struct Moby *moby) __asm__("FUN_L18_002efb88"); +void drek_fight_missile_update(struct Moby *moby) { char *d = (char *)moby->pvars; if (moby->state != 4) { moby->rot.x = fast_add_rotations(moby->rot.x, @@ -135,7 +136,7 @@ void FUN_L18_002efb88(struct Moby *moby) { char *pos = &moby->pos; moby->state = 2; *(short *)(d + 0x164) = 0; - FUN_L00_0025e450(*(void **)(d + 0x16C), D_L18_0015F580, pos, 1.0f, 1.0f, 10, 3, 16, 1.5f, 0.5f, 9.0f, 1.0f, 2, 5.0f, 0, 0, -1, 0); + spawn_explosion(*(void **)(d + 0x16C), D_L18_0015F580, pos, 1.0f, 1.0f, 10, 3, 16, 1.5f, 0.5f, 9.0f, 1.0f, 2, 5.0f, 0, 0, -1, 0); qcopy(pos, D_L18_001677C0); moby->pos.z += 20.0f; for (i = 0; (float)i < 4.0f; i++) { @@ -187,19 +188,19 @@ int FUN_L18_002f0030(char *moby, int group, float *pos) { /* Ported from rac1-decomp (src/overlays/l18_veldin2/vendor_002A8400.c: func_L18_002F1510), where it is exact; names translated to the US level program. */ -extern float FUN_001f9af0(void *); -extern float FUN_001f9b20(void *); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); +extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_001fa580(float, float); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float FUN_00213f38_c(float *, float *, float, float, float, float) __asm__("FUN_00213f38"); -extern float FUN_L00_0025be00(float *, float *, float, float, float, float); +extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); -extern int FUN_001f9740(int *); +extern int tick_countdown_32(int *) __asm__("FUN_001f9740"); extern short D_L18_00162214_gp __asm__("D_L18_00162214") __attribute__((sda)); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void set_vector_length_xy(void *, void *, float) __asm__("FUN_001f9c48"); extern short D_L18_0016222C __attribute__((sda)); @@ -210,31 +211,31 @@ int FUN_L18_002f0120(char *moby, float *vec) { char *p; float yaw; - FUN_001f9a28(buf, vec, moby + 0x10); - yaw = FUN_001fa580(fast_arc_tan(buf[0], buf[1]), *(float *)(d + 0x148)); - FUN_L00_0025be00((float *)(moby + 0x48), (float *)(d + 0x140), yaw, *(float *)(d + 0x150), + fast_vec_sub(buf, vec, moby + 0x10); + yaw = fast_add_rotations(fast_arc_tan(buf[0], buf[1]), *(float *)(d + 0x148)); + approach_angle((float *)(moby + 0x48), (float *)(d + 0x140), yaw, *(float *)(d + 0x150), *(float *)(d + 0x150), *(float *)(d + 0x154)); *(float *)(moby + 0x10) += - FUN_001f9dc8(*(float *)(moby + 0x48)) * (*(float *)&D_L18_00162214_gp * frame_time); + fast_cos(*(float *)(moby + 0x48)) * (*(float *)&D_L18_00162214_gp * frame_time); *(float *)(moby + 0x14) += - FUN_001f9de0(*(float *)(moby + 0x48)) * (*(float *)&D_L18_00162214_gp * frame_time); + fast_sin(*(float *)(moby + 0x48)) * (*(float *)&D_L18_00162214_gp * frame_time); FUN_00213f38_c((float *)(moby + 0x18), (float *)(d + 0x144), vec[2], *(float *)(d + 0x158), *(float *)(d + 0x158), *(float *)(d + 0x15C)); *(float *)(moby + 0x44) = *(float *)&D_L18_0016222C * *(float *)(d + 0x144); - if (FUN_001f9af0(buf) < 2.0f) { + if (fast_vec_length(buf) < 2.0f) { return 1; } - if (FUN_001f9740((int *)(d + 0x160))) { + if (tick_countdown_32((int *)(d + 0x160))) { return 1; } p = *(char **)(d + 0x16C); if (p) { - FUN_001f9a28(v, moby + 0x10, p + 0x10); - if (!(FUN_001f9b20(v) < 4.5f)) { + fast_vec_sub(v, moby + 0x10, p + 0x10); + if (!(vector_length_xy(v) < 4.5f)) { return 0; } set_vector_length_xy(v, v, random_float_between_alt(15.0f, 20.0f)); - FUN_001f9a10(v, v, *(char **)(d + 0x16C) + 0x10); + fast_vec_add(v, v, *(char **)(d + 0x16C) + 0x10); v[2] = vec[2]; qcopy(vec, v); } @@ -246,12 +247,12 @@ int FUN_L18_002f0120(char *moby, float *vec) { /* Ported from rac1-decomp (src/overlays/l18_veldin2/vendor_002A8400.c: func_L18_002F16D8), where it is exact; names translated to the US level program. */ -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float random_angle_radians(void) __asm__("FUN_00213308"); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); -extern int FUN_001f96f8(int); -extern void FUN_001f9a10(void *, void *, void *); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern short D_L18_0016221C __attribute__((sda)); extern short D_L18_00162220 __attribute__((sda)); @@ -262,12 +263,12 @@ void FUN_L18_002f02e8(char *moby, void *out) { float v[3]; float r = random_float_between_alt(*(float *)&D_L18_00162224, *(float *)&D_L18_00162228); float ang = random_angle_radians(); - v[0] = FUN_001f9dc8(ang) * r; - v[1] = FUN_001f9de0(ang) * r; + v[0] = fast_cos(ang) * r; + v[1] = fast_sin(ang) * r; v[2] = 0.0f; v[2] = random_float_between_alt(*(float *)&D_L18_0016221C, *(float *)&D_L18_00162220); - FUN_001f9a10(out, v, data + 0x120); - *(int *)(data + 0x160) = FUN_001f96f8(180); + fast_vec_add(out, v, data + 0x120); + *(int *)(data + 0x160) = scale_game_frames(180); } extern int D_L18_00162238_gp __asm__("D_L18_00162238") __attribute__((sda)); extern int D_L18_0016223C __attribute__((sda)); @@ -521,7 +522,7 @@ extern float D_L18_001622B8 __attribute__((sda)); extern int D_L18_001622BC __attribute__((sda)); extern unsigned char *D_L18_0015FFD8; extern void lerp_vector(void *, void *, void *, float) __asm__("FUN_001f9a40"); -extern void FUN_L01_002f8530(void *, void *, unsigned int, int, float, float, float, float, int); +extern void spawn_debris_chunk(void *, void *, unsigned int, int, float, float, float, float, int) __asm__("FUN_L01_002f8530"); extern void FUN_L12_0027b268(char *, void *, int); extern void FUN_L12_0027b370(Level18VendorMoby *, void *, int); extern void FUN_L18_002fa8e0(void *); @@ -640,7 +641,7 @@ void FUN_L18_002f16f0(struct Moby *moby) { v[2] = 15.0f; add_vector_xyz(v, v, &hero.motion.pos); n = scale_game_frames(240); - FUN_L01_002f8530(v, D_L18_0015F580_c, 0x2B8, n, D_L18_001622C0, 2.0f, 1.0f, + spawn_debris_chunk(v, D_L18_0015F580_c, 0x2B8, n, D_L18_001622C0, 2.0f, 1.0f, 0.75f, 0); } } @@ -726,7 +727,7 @@ typedef struct { extern char *D_L18_001600EC; extern char *D_L18_001C6200[]; extern unsigned char D_L18_001C6500[]; -extern void FUN_001f9cf8(void *, void *, void *); +extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); float absolute_float(float input) __asm__("func_001F99C0"); void FUN_L18_002f1d08(int a, int b) { @@ -735,9 +736,9 @@ void FUN_L18_002f1d08(int a, int b) { if (((Blk *)D_L18_001C6200[D_L18_001C6500[a]])->n > i) do { float v[4]; - FUN_001f9a28(v, ((Blk *)D_L18_001C6200[D_L18_001C6500[a]])->e + i, + fast_vec_sub(v, ((Blk *)D_L18_001C6200[D_L18_001C6500[a]])->e + i, D_L18_001600EC + (b << 7) + 0x30); - FUN_001f9cf8(v, v, D_L18_001600EC + (b << 7) + 0x40); + transform_vector_by_basis(v, v, D_L18_001600EC + (b << 7) + 0x40); k = i; if (absolute_float(v[0]) < 1.0f && absolute_float(v[1]) < 1.0f) { ((Blk *)D_L18_001C6200[D_L18_001C6500[a]])->e[k].w0c = 0; @@ -750,7 +751,7 @@ void FUN_L18_002f1d08(int a, int b) { extern char D_0013E550[]; extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern int FUN_0022da68(int, int, int); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern unsigned char *D_L18_0015FFD8; extern void FUN_L18_002f1fd8(struct Moby *); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); @@ -764,7 +765,7 @@ void FUN_L18_002f1e68(struct Moby *m) { break; case 1: enqueue_callback_list_1_alt((void (*)(void))FUN_L18_002f1fd8, m); - if (FUN_L00_0028d8c0(m, d[1]) == 0) { + if (voice_is_playing(m, d[1]) == 0) { d[1] = FUN_0022da68(0, 4, (int)m); } if (d[0] != -1) { @@ -772,7 +773,7 @@ void FUN_L18_002f1e68(struct Moby *m) { if (*(short *)(o + 0xA6) == 0x267 && o[0x20] >= 3) { m->collision = 0; m->state = 2; - if (FUN_L00_0028d8c0(m, d[1]) != 0) { + if (voice_is_playing(m, d[1]) != 0) { int i = d[1]; if (i != -1) { char *e = D_0013E550 + i * 0x70; @@ -1393,11 +1394,11 @@ extern float D_L18_0015F580[] __attribute__((section(".sdata"))); extern float D_L18_001677C0[]; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); -extern float FUN_L00_0025be00(float *, float *, float, float, float, float); +extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); extern float FUN_L18_002dfb90(void *moby); extern float fast_cos(float) __asm__("func_001F9DC8"); extern float fast_sin(float) __asm__("func_001F9DE0"); @@ -1408,7 +1409,7 @@ extern int D_L18_0015F5C4; extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern int point_in_path_xy(void *, void *, int) __asm__("FUN_L00_00259740"); extern int FUN_L00_0025e450_u() __asm__("FUN_L00_0025e450"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L18_002dfba0(void *moby); extern int FUN_L18_002f0030(char *moby, int idx, float *pos); extern int FUN_L18_002f6878(char *moby, float arg, void *x); @@ -1434,15 +1435,15 @@ extern void set_vector_length_xy(void *, void *, float) __asm__("FUN_001f9c48"); extern void hero_respawn(void) __asm__("FUN_L00_00211250"); extern void FUN_L00_00216f90(void *, void *, int, int); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void FUN_L00_002502a0(int); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_002628d8(char *, char *, int, float, float); +extern void update_joint_animation(char *, char *, int, float, float) __asm__("FUN_L00_002628d8"); extern void FUN_L00_00263ac8(float, int, int, unsigned char *); -extern void FUN_L00_00263b70(void *, void *, void *, float, float); -extern void FUN_L00_00284e50(void *, void *); +extern void draw_trail(void *, void *, void *, float, float) __asm__("FUN_L00_00263b70"); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern void FUN_L00_00299560(int i); extern void FUN_L00_00299a68(void); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void FUN_L15_00208ca8(void); extern void FUN_L18_002d6d50(int idx); extern void FUN_L18_002d6dc0(void *moby); @@ -1466,7 +1467,7 @@ extern void FUN_L18_002f7880(struct Moby *moby); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void clear_vector(void *) __asm__("func_001F99F8"); extern void enqueue_callback_list_1_alt(void (*)(void), void *) __asm__("FUN_001f4600"); -extern void FUN_L00_00298840(int); +extern void start_scene(int) __asm__("FUN_L00_00298840"); extern void normalize_vector_xyz(void *out, void *a, f32 len) __asm__("FUN_001f9bf8"); extern void pause_all_sounds(s32) __asm__("FUN_00218d78"); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); @@ -1484,7 +1485,8 @@ extern void func_L00_0025F4A8_alt(void *, void *, void *, float, float, int, int float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); -void FUN_L18_002f2bf0(BossMoby *moby) { +void drek_final_boss_robot_update(BossMoby *moby) __asm__("FUN_L18_002f2bf0"); +void drek_final_boss_robot_update(BossMoby *moby) { BossData *d = (BossData *)moby->f78; BossMoby *tgt; float v0[4]; @@ -1564,7 +1566,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { } if (*(int *)&D_L18_001623A0 == 0) { char *b = D_L18_001600EC + d->f294 * 0x80; - FUN_L00_00284e50(b + 0x30, b + 0x70); + jet_reset_camera(b + 0x30, b + 0x70); *(int *)&D_L18_001623A0 = 1; } } @@ -1574,7 +1576,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { hero.vehicle_mode == 2) { moby->f20 = 7; moby->f34 |= 0x41; - FUN_L00_00298840(0); + start_scene(0); d->f39C = 2; d->f358 = scale_game_frames(600); d->f344 = d->f250[3]; @@ -1625,7 +1627,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { 50.0f) { if (*(int *)&D_L18_001623A0 != 0) { FUN_L18_002d6d50(d->f200); - if (FUN_L00_0028d8c0(moby, d->f3B0) != 0) { + if (voice_is_playing(moby, d->f3B0) != 0) { int i = d->f3B0; if (i != -1) { char *e = D_0013E550 + i * 0x70; @@ -1660,7 +1662,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { case 2: aim = &moby->f40[2]; ang = fast_arc_tan(hero.motion.pos.f[0] - moby->f10[0], hero.motion.pos.f[1] - moby->f10[1]); - FUN_L00_0025be00(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, + approach_angle(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, D_0015ED6C_e[1] * 6.2831855f, frame_time * 6.2831855f); FUN_L18_002f6aa0((struct Moby *)moby); if (d->f38C <= 301.0f) { @@ -1673,10 +1675,10 @@ void FUN_L18_002f2bf0(BossMoby *moby) { char *b = D_L18_001600EC + d->f2A0 * 0x80; FUN_L00_00216f90(b + 0x30, b + 0x70, 0, 1); } - FUN_L00_002502a0(d->f2B0); - FUN_L00_00284e50(hero.motion.pos.f, hero.motion.rot.f); + jet_clear_persistent(d->f2B0); + jet_reset_camera(hero.motion.pos.f, hero.motion.rot.f); FUN_L18_002f7028((int)moby, d->f204[0]); - FUN_L00_00298840(1); + start_scene(1); moby->f20 = 7; moby->f34 |= 0x41; if (moby->f53 != 10) { @@ -1708,7 +1710,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { { float a = randf_sym(0.08726646f, 0.5235988f); float c = -random_float_between_alt(0.08726646f, 0.17453292f); - float e = FUN_001f9b80(moby->f10, hero.motion.pos.f) * 3.0f; + float e = vector_distance(moby->f10, hero.motion.pos.f) * 3.0f; if (e > 120.0f) { e = 120.0f; } else if (e < 60.0f) { @@ -1728,7 +1730,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { aim = &moby->f40[2]; ang = fast_arc_tan(hero.motion.pos.f[0] - moby->f10[0], hero.motion.pos.f[1] - moby->f10[1]); - FUN_L00_0025be00(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, + approach_angle(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, D_0015ED6C_e[1] * 6.2831855f, frame_time * 6.2831855f); qcopy(v0, d->f340 + 4); hit = FUN_L18_002f6878((char *)moby, 20.0f, v0); @@ -1787,7 +1789,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { aim = &moby->f40[2]; ang = fast_arc_tan(hero.motion.pos.f[0] - moby->f10[0], hero.motion.pos.f[1] - moby->f10[1]); - FUN_L00_0025be00(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, + approach_angle(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, D_0015ED6C_e[1] * 6.2831855f, frame_time * 6.2831855f); approach_value(&d->f374, frame_time * 12.0f, D_0015ED6C_e[1] * 20.0f); if (d->f374 != 0.0f) { @@ -1833,7 +1835,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { add_vector_xyz(d->f3C0, d->f3C0, v0); break; } - if (FUN_001f9b80(moby->f10, hero.motion.pos.f) < 50.0f && hero.air_frames.s == 0 && + if (vector_distance(moby->f10, hero.motion.pos.f) < 50.0f && hero.air_frames.s == 0 && (((BossMoby *)hero.ground_moby) == 0 || ((BossMoby *)hero.ground_moby)->fA6 != 0x24B)) { int *p = d->f340; @@ -1861,7 +1863,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { d->f39C = 5; d->f330 = (BossMoby *)FUN_L18_002d6c80(hero.motion.pos.f, d->f200); moby->f34 |= 0x41; - FUN_L00_00298840(2); + start_scene(2); for (i = 0; i < 3; i++) { FUN_L18_002f6fa8((int)moby, d->f204[i]); } @@ -1940,7 +1942,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { case 0xC: aim = &moby->f40[2]; ang = fast_arc_tan(tgt->f10[0] - moby->f10[0], tgt->f10[1] - moby->f10[1]); - FUN_L00_0025be00(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, + approach_angle(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, D_0015ED6C_e[1] * 6.2831855f, frame_time * 6.2831855f); FUN_L18_002f6aa0((struct Moby *)moby); if ((moby->f70 & 2) == 0) { @@ -2013,7 +2015,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { if (moby->f53 != 1) { blend_moby_animation(moby, 1, 0, scale_game_frames(0x14)); } - if (FUN_001f9b80(moby->f10, hero.motion.pos.f) < 16.0f) { + if (vector_distance(moby->f10, hero.motion.pos.f) < 16.0f) { d->f354 = scale_game_frames(0x5A); } else { d->f354 = 0; @@ -2027,7 +2029,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { case 0xE: aim = &moby->f40[2]; ang = fast_arc_tan(d->f320[0] - moby->f10[0], d->f320[1] - moby->f10[1]); - FUN_L00_0025be00(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, + approach_angle(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, D_0015ED6C_e[1] * 6.2831855f, frame_time * 6.2831855f); moby_point_position(moby, 0x13, v0); *(BossTI *)v1 = *(BossTI *)d->f320; @@ -2077,7 +2079,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { case 0xF: aim = &moby->f40[2]; ang = fast_arc_tan(tgt->f10[0] - moby->f10[0], tgt->f10[1] - moby->f10[1]); - FUN_L00_0025be00(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, + approach_angle(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, D_0015ED6C_e[1] * 6.2831855f, frame_time * 6.2831855f); FUN_L18_002f6aa0((struct Moby *)moby); if (is_value_within_interpolated_window((char *)moby, 1.0f) != 0 || @@ -2122,7 +2124,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { normalize_vector_xyz(v2, moby->fC0, frame_time * 20.0f); a = randf_sym(0.08726646f, 0.5235988f); c = -random_float_between_alt(0.08726646f, 0.17453292f); - e = FUN_001f9b80(moby->f10, hero.motion.pos.f) * 3.0f; + e = vector_distance(moby->f10, hero.motion.pos.f) * 3.0f; if (e > 120.0f) { e = 120.0f; } else if (e < 60.0f) { @@ -2140,7 +2142,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { case 0xD: aim = &moby->f40[2]; ang = fast_arc_tan(tgt->f10[0] - moby->f10[0], tgt->f10[1] - moby->f10[1]); - FUN_L00_0025be00(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, + approach_angle(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, D_0015ED6C_e[1] * 6.2831855f, frame_time * 6.2831855f); FUN_L18_002f6aa0((struct Moby *)moby); if (d->f354 < d->f358 + d->f35C) { @@ -2163,7 +2165,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { qcopy(v1, moby->fC0); normalize_vector_xyz(v2, moby->fD0, d->f3BC); add_vector_xyz(v1, v1, v2); - f = FUN_001f9b80(v0, tgt->f10) * 0.5f; + f = vector_distance(v0, tgt->f10) * 0.5f; if (f > 30.0f) { f = 30.0f; } else if (f < 0.0f) { @@ -2188,7 +2190,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { case 0x10: aim = &moby->f40[2]; ang = fast_arc_tan(hero.motion.pos.f[0] - moby->f10[0], hero.motion.pos.f[1] - moby->f10[1]); - FUN_L00_0025be00(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, + approach_angle(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, D_0015ED6C_e[1] * 6.2831855f, frame_time * 6.2831855f); FUN_L18_002f6aa0((struct Moby *)moby); if (tick_countdown_32_alt(&d->f354) != 0) { @@ -2208,7 +2210,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { v2[2] = v2[2] + 5.0f; v2[2] = probe_ground_height(v2, 0, 0.5f); if (absolute_float(v2[2] - d->f3C0[2]) < 5.0f) { - float speed = FUN_001f9b80(v2, v1) / (float)scale_game_frames(0x3C); + float speed = vector_distance(v2, v1) / (float)scale_game_frames(0x3C); float w = random_float_between_alt(18.0f, 20.0f); FUN_L18_002d5cf8((int)moby, d->f29C, v1, v2, speed, @@ -2226,7 +2228,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { aim = &moby->f40[2]; ang = fast_arc_tan(hero.motion.pos.f[0] - moby->f10[0], hero.motion.pos.f[1] - moby->f10[1]); - FUN_L00_0025be00(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, + approach_angle(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, D_0015ED6C_e[1] * 6.2831855f, frame_time * 6.2831855f); FUN_L18_002f6aa0((struct Moby *)moby); if ((moby->f70 & 2) != 0 && moby->f53 != 12) { @@ -2241,7 +2243,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { v0[2] = probe_ground_height(v0, 0, 0.5f); if (absolute_float(v0[2] - d->f3C0[2]) < 1.0f) { /* v1 is not written in this state; retail passes it all the same. */ - float speed = FUN_001f9b80(v0, v1) / (float)scale_game_frames(0x3C); + float speed = vector_distance(v0, v1) / (float)scale_game_frames(0x3C); if (FUN_L18_002fc668(d->f210, v0, v0, speed) != 0 && d->f354 == 0) { d->f354 = scale_game_frames(0x3C); @@ -2268,13 +2270,13 @@ void FUN_L18_002f2bf0(BossMoby *moby) { aim = &moby->f40[2]; ang = fast_arc_tan(hero.motion.pos.f[0] - moby->f10[0], hero.motion.pos.f[1] - moby->f10[1]); - FUN_L00_0025be00(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, + approach_angle(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, D_0015ED6C_e[1] * 6.2831855f, frame_time * 6.2831855f); if (tick_countdown_32_alt(&d->f354) != 0) { FUN_L18_002f6960((char *)moby); } FUN_L18_002dc458(d->f338, d->f3C0, 5.8f); - if (FUN_L00_0028d8c0(moby, d->f3B0) == 0) { + if (voice_is_playing(moby, d->f3B0) == 0) { d->f3B0 = allocate_voice_for_target_entry(0xE, 4, (int)moby); } fire = 0; @@ -2285,14 +2287,14 @@ void FUN_L18_002f2bf0(BossMoby *moby) { if (hero.state.control_mode == 0xF) { int *list = ((int *)hero.unk560); - if (FUN_001f9b80(hero.motion.pos.f, (char *)list + *list * 16) < 3.0f) { + if (vector_distance(hero.motion.pos.f, (char *)list + *list * 16) < 3.0f) { fire = 1; } } - if (hero.state.current == HERO_STATE_HURT && FUN_001f9b80(moby->f10, hero.motion.pos.f) < 12.0f) { + if (hero.state.current == HERO_STATE_HURT && vector_distance(moby->f10, hero.motion.pos.f) < 12.0f) { fire = 1; } - if (FUN_001f9b80(hero.motion.pos.f, D_L18_001600EC + d->f250[2] * 0x80 + 0x30) > + if (vector_distance(hero.motion.pos.f, D_L18_001600EC + d->f250[2] * 0x80 + 0x30) > *(float *)&D_L18_00162378_gp + 5.8f) { fire = 1; } @@ -2317,7 +2319,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { case 0x12: aim = &moby->f40[2]; ang = fast_arc_tan(d->f70[0] - moby->f10[0], d->f70[1] - moby->f10[1]); - FUN_L00_0025be00(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, + approach_angle(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, D_0015ED6C_e[1] * 6.2831855f, frame_time * 6.2831855f); { /* Retail scales the index before it sets up the call. */ @@ -2336,7 +2338,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { case 0x15: aim = &moby->f40[2]; ang = fast_arc_tan(d->f330->f10[0] - moby->f10[0], d->f330->f10[1] - moby->f10[1]); - FUN_L00_0025be00(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, + approach_angle(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, D_0015ED6C_e[1] * 6.2831855f, frame_time * 6.2831855f); FUN_L18_002d6dc0(d->f330); if (FUN_L18_002f6878((char *)moby, frame_time * 12.0f, d->f330->f10) != 0) { @@ -2382,7 +2384,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { aim = &moby->f40[2]; ang = fast_arc_tan(hero.motion.pos.f[0] - moby->f10[0], hero.motion.pos.f[1] - moby->f10[1]); - FUN_L00_0025be00(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, + approach_angle(aim, &d->f370, ang, D_0015ED6C_e[1] * 6.2831855f, D_0015ED6C_e[1] * 6.2831855f, frame_time * 6.2831855f); FUN_L18_002f6aa0((struct Moby *)moby); d->f358 = d->f358 + 1; @@ -2422,7 +2424,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { moby->f34 |= 0x41; moby->f34 &= 0xEFFF; if (d->f34C < 7) { - FUN_L00_00298840(3); + start_scene(3); d->f34C = 7; ((BossShared *)&D_L18_0016D260_c)->f46 = 1; { @@ -2448,7 +2450,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { int n = d->f3AC++; if (scale_game_frames(0x28) < n) { - FUN_L00_00298840(4); + start_scene(4); d->f34C = 8; moby->f20 = 7; d->f39C = 0x1B; @@ -2462,8 +2464,8 @@ void FUN_L18_002f2bf0(BossMoby *moby) { v0[2] = 112.6f; v1[1] = -0.12f; v1[2] = -2.76f; - FUN_L00_002eaaa0(v0, v1, 1, 0, 0); - FUN_L00_00298840(5); + jet_mount(v0, v1, 1, 0, 0); + start_scene(5); d->f34C = 9; } else if (d->f34C == 9 && D_L18_0015F5C4 == 0) { FUN_L00_00299a68(); @@ -2494,7 +2496,7 @@ void FUN_L18_002f2bf0(BossMoby *moby) { moby_point_position(moby, 9, v1); subtract_vector_xyz(v2, v0, v1); normalize_vector_xyz(v2, v2, 0.1f); - FUN_L00_00263b70(v0, v0, v2, 600000.0f, 0.0f); + draw_trail(v0, v0, v2, 600000.0f, 0.0f); } if (d->f34C > 1) { hero.unk5D8 = (struct Moby *)moby; @@ -2507,8 +2509,8 @@ void FUN_L18_002f2bf0(BossMoby *moby) { frame_time * 4.0f, &d->f3DC, &d->f3E0); moby->f10[2] = moby->f10[2] + d->f3DC; d->f3D8 = 0.0f; - FUN_L00_002628d8((char *)moby, d->fC0, 7, frame_scale_sq * fast, frame_scale_sq * slow); - FUN_L00_002628d8((char *)moby, d->f140, 0x13, frame_scale_sq * fast, frame_scale_sq * slow); + update_joint_animation((char *)moby, d->fC0, 7, frame_scale_sq * fast, frame_scale_sq * slow); + update_joint_animation((char *)moby, d->f140, 0x13, frame_scale_sq * fast, frame_scale_sq * slow); d->f3B4 = fast_add_rotations(d->f3B4, frame_time * 3.4906585f); { int c = fast_tween_color(0x30C8C8C8, 0x1C393939, fast_sin(d->f3B4) * 0.5f + 0.5f); @@ -2841,10 +2843,10 @@ void FUN_L18_002f5e80(char *moby) { /* steps a moby's offset vector toward a target, returns whether both settled */ /* Ported from rac1-decomp (src/overlays/l18_veldin2/vendor_002F2AE0.c: func_L18_002F7CD8), where it is exact; names translated to the US level program. */ -extern float FUN_001f9af0(void *); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern float advance_accelerated_scalar(float, float, float, float, float *, float *) __asm__("FUN_00213f38"); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); int FUN_L18_002f6878(char *moby, float arg, void *x) { @@ -2856,13 +2858,13 @@ int FUN_L18_002f6878(char *moby, float arg, void *x) { float len; float s; b[0] = v; - FUN_001f9a28(a, x, p); + fast_vec_sub(a, x, p); a[2] = v; - len = FUN_001f9af0(a); + len = fast_vec_length(a); s = D_0015ED6C_e[1] * 10.0f; advance_accelerated_scalar(len, s, s, arg, b, (float *)(data + 0x374)); fast_vec_normalize(a, a, *(float *)(data + 0x374)); - FUN_001f9a10(p, p, a); + fast_vec_add(p, p, a); if (len < 0.1f) { if (*(float *)(data + 0x374) < 0.1f) { return 1; @@ -2878,7 +2880,7 @@ int FUN_L18_002f6878(char *moby, float arg, void *x) { extern char *D_L18_001600EC; extern float freeze_stats_score_ref_b __asm__("D_0015ED6C"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern short D_L18_001623DC __asm__("D_L18_0016234C") __attribute__((sda)); extern short D_L18_00162378_gp __asm__("D_L18_00162378") __attribute__((sda)); extern void FUN_L00_0025f730(void *a, float x); @@ -2902,7 +2904,7 @@ void FUN_L18_002f6960(struct Moby *m) { } add_vector_xyz(v, v, D_L18_001600EC + (*(int *)(d + 0x344) << 7) + 0x30); t = hero.motion.speed_xy; - t += (FUN_001f9b80(&m->pos, v) - *(float *)&D_L18_001623DC) / *(float *)&D_L18_001623DC * + t += (vector_distance(&m->pos, v) - *(float *)&D_L18_001623DC) / *(float *)&D_L18_001623DC * (freeze_stats_score_ref_b * 4.75f); hi = freeze_stats_score_ref_b * 20.0f; lo = freeze_stats_score_ref_b * 4.75f; @@ -3034,7 +3036,7 @@ unsigned char *FUN_L18_002f6e10(struct Moby *self) { unsigned char *q; FUN_L18_002d8858(m); q = D_L18_0015FFD8 + off; - if (FUN_001f9b80(q + 0x10, c) < *(float *)&D_L18_00162338) { + if (vector_distance(q + 0x10, c) < *(float *)&D_L18_00162338) { unsigned char *r; int a, b; float dot; @@ -3106,7 +3108,7 @@ void FUN_L18_002f7028(int a0, int idx) { /* Ported from rac1-decomp (src/overlays/l18_veldin2/vendor_002F2AE0.c: func_L18_002F8518), where it is exact; names translated to the US level program. */ extern char *D_L18_001600EC; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern short D_L18_00162378_gp __asm__("D_L18_00162378") __attribute__((sda)); extern short D_L18_001DFB40[]; s32 random_integer_below(s32 arg0) __asm__("FUN_00213260"); @@ -3146,7 +3148,7 @@ int FUN_L18_002f70b8(struct Moby *moby) { if (*(int *)(data + 0x364) != 0) { ok = 0; } else { - float d = FUN_001f9b80(D_0013E533 + 0xE9D, + float d = vector_distance(D_0013E533 + 0xE9D, D_L18_001600EC + *(int *)(data + 0x25C) * 128 + 0x30); if (*(float *)&D_L18_00162378_gp + 2.0f < d) ok = 0; @@ -3226,7 +3228,7 @@ void FUN_L18_002f7288(char *moby) { unsigned char st; fast_dec_timer((int *)(d + 0x360)); - f = FUN_001f9b80(hero.motion.pos.f, d + 0x3c0); + f = vector_distance(hero.motion.pos.f, d + 0x3c0); if (f > D_L18_001623BC) { f = D_L18_001623BC; } else if (f < D_L18_001623B8) { @@ -3253,7 +3255,7 @@ void FUN_L18_002f7288(char *moby) { p1 = (float *)(t + 0x38); p3 = (float *)(d + 0x37c); p2 = (float *)(d + 0x378); - if (FUN_001f9b80(hero.motion.pos.f, + if (vector_distance(hero.motion.pos.f, D_L18_001600EC + (*(int *)(d + 0x344) << 7) + 0x30) < 28.0f) { x = D_L18_001623D8; y = D_L18_001623DC_target; @@ -3438,25 +3440,25 @@ void FUN_L18_002f7880(struct Moby *moby) { char a[16]; char b[16]; L18Q *q = (L18Q *)moby->pvars; - int n = FUN_001f96f8(*(int *)&D_L18_00162460_gp); + int n = scale_game_frames(*(int *)&D_L18_00162460_gp); float f = convert_integer_to_float(game_frame % n); int h; int i; f = f / convert_integer_to_float(n); f = f * 6.18318f; - f = FUN_001f9de0(f - 3.14159f); + f = fast_sin(f - 3.14159f); h = fast_tween_color(*(int *)&D_L18_00162458_gp, *(int *)&D_L18_0016245C_gp, f * 0.5f + 0.5f); moby_point_position(q->p3A0, 1, a); FUN_L00_00263618(a, h, *(float *)&D_L18_00162450_gp, *(float *)&D_L18_00162454_gp); moby_point_position(q->p3A0, 2, a); FUN_L00_00263618(a, h, *(float *)&D_L18_00162450_gp, *(float *)&D_L18_00162454_gp); if ((unsigned)(moby->prev_seq - 11) < 3) { - int n2 = FUN_001f96f8(*(int *)&D_L18_00162474); + int n2 = scale_game_frames(*(int *)&D_L18_00162474); float g = convert_integer_to_float(game_frame % n2); int h2; g = g / convert_integer_to_float(n2); g = g * 6.18318f; - g = FUN_001f9de0(g - 3.14159f); + g = fast_sin(g - 3.14159f); h2 = fast_tween_color(*(int *)&D_L18_0016246C, *(int *)&D_L18_00162470, g * 0.5f + 0.5f); moby_point_position(moby, 5, b); FUN_L00_00263618(b, h2, *(float *)&D_L18_00162464, *(float *)&D_L18_00162468); @@ -3515,6 +3517,7 @@ extern int D_L18_001623A0_gp __asm__("D_L18_001623A0") __attribute__((sda)); extern int D_L18_00162384_w[] __asm__("D_L18_00162384") __attribute__((section(".sdata"))); extern int D_L18_0016D290_lui __asm__("D_L18_0016D290") __attribute__((section(".data"))); +void FUN_L18_002f7ad8(M *moby); void FUN_L18_002f7ad8(M *moby) { switch (moby->state) { case 0: @@ -3585,7 +3588,8 @@ extern short D_L18_0016247C __asm__("D_L18_0016247C"); extern char *func_0020D348_m(int) __asm__("FUN_0020c4f8"); extern void func_L18_002F9AB8_v(void *) __asm__("FUN_L18_002f8658"); -void FUN_L18_002f7c40(M1454 *m) { +void rocket_tank_update(M1454 *m) __asm__("FUN_L18_002f7c40"); +void rocket_tank_update(M1454 *m) { D1454 *d = m->data; FUN_L18_002f8050(m); switch (m->state) { @@ -3675,7 +3679,7 @@ void FUN_L18_002f7c40(M1454 *m) { v[2] = -fast_sin(d->f118) * s; allocate_voice_for_target_entry(0, 0, (int)m); FUN_L03_00250ae8(m, w, 0); - if (FUN_001f9b80((char *)m + 0x10, &hero.motion.pos) > 10.0f) { + if (vector_distance((char *)m + 0x10, &hero.motion.pos) > 10.0f) { FUN_L18_002a75f0((char *)m, w, v, 0); } else { FUN_L18_002a75f0((char *)m, w, v, 1); @@ -3701,9 +3705,9 @@ void FUN_L18_002f7c40(M1454 *m) { extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern float D_L18_0015F580[]; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_L00_0025be00(float *, float *, float, float, float, float); +extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); extern float fast_add_rotations(float, float); extern float fast_sin(float); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); @@ -3718,7 +3722,7 @@ extern void set_vector_length_xy(void *, void *, float) __asm__("FUN_001f9c48"); extern void multiply_quaternions(void *, void *, void *) __asm__("FUN_001fa3c0"); extern void FUN_L00_001fff28(void *, int, float); extern void FUN_L00_0025d458_cf(void *) __asm__("FUN_0020c828"); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern void FUN_L00_0025e450_cf(void *, short *) __asm__("FUN_L00_0025d458"); extern void mark_moby_for_removal_cf(void *, int, int) __asm__("FUN_L00_00257470"); extern void subtract_vector_xyz(void *, void *, void *); @@ -3773,12 +3777,12 @@ void FUN_L18_002f8050(void *mv) { if (FUN_L00_0025fcb8(m, d + 0x70, 30.0f) != 2) { float *pa = (float *)(m + 0x10); char *pl = (char *)&hero.motion.pos; - if (FUN_001f9b80(pa, pl) < 10.0f) { + if (vector_distance(pa, pl) < 10.0f) { char *q = pl - 0x80; *(char **)(d + 0xB0) = *(char **)(q + 0x2080); qcopy(d + 0x70, *(char **)(q + 0x2080) + 0x10); } else if (*(char **)(d + 0xB0)) { - if (30.0f < FUN_001f9b80(pa, *(char **)(d + 0xB0) + 0x10)) { + if (30.0f < vector_distance(pa, *(char **)(d + 0xB0) + 0x10)) { *(int *)(d + 0xB4) = 2; } } @@ -3798,17 +3802,17 @@ void FUN_L18_002f8050(void *mv) { } else if (b < -0.7853982f) { b = -0.7853982f; } - FUN_L00_0025be00((float *)(d + 0x110), (float *)(d + 0x114), a, + approach_angle((float *)(d + 0x110), (float *)(d + 0x114), a, D_0015ED6C_e[1] * 12.566371f, D_0015ED6C_e[1] * 12.566371f, frame_time * 9.424778f); - FUN_L00_0025be00((float *)(d + 0x118), (float *)(d + 0x11C), b, + approach_angle((float *)(d + 0x118), (float *)(d + 0x11C), b, D_0015ED6C_e[1] * 12.566371f, D_0015ED6C_e[1] * 12.566371f, frame_time * 9.424778f); } else { - FUN_L00_0025be00((float *)(d + 0x110), (float *)(d + 0x114), *(float *)(m + 0x48), + approach_angle((float *)(d + 0x110), (float *)(d + 0x114), *(float *)(m + 0x48), D_0015ED6C_e[1] * 12.566371f, D_0015ED6C_e[1] * 12.566371f, frame_time * 9.424778f); - FUN_L00_0025be00((float *)(d + 0x118), (float *)(d + 0x11C), 0.0f, + approach_angle((float *)(d + 0x118), (float *)(d + 0x11C), 0.0f, D_0015ED6C_e[1] * 12.566371f, D_0015ED6C_e[1] * 12.566371f, frame_time * 9.424778f); } @@ -3816,7 +3820,7 @@ void FUN_L18_002f8050(void *mv) { FUN_L00_001fff28(d + 0xD0, 2, fast_subtract_rotations(*(float *)(d + 0x110), *(float *)(m + 0x48))); multiply_quaternions(d + 0xD0, v, d + 0xD0); - FUN_L00_0025d538(m, d + 0x60); + trooper_anim_finish(m, d + 0x60); } /* Steers the moby along its path toward the next node, slowing on sharp turns. */ extern float FUN_001f9b48(void *, void *); @@ -3837,7 +3841,7 @@ void FUN_L18_002f8658(struct Moby *m) { char *p; qcopy(t, (char *)D_L18_001B0EB0[*(int *)(d + 0x100)] + *(int *)(d + 0x120) * 16 + 0x10); ang = fast_arc_tan(t[0] - m->pos.x, t[1] - m->pos.y); - FUN_L00_0025be00(&m->rot.z, (float *)(d + 0x128), ang, D_0015ED6C_e[1] * 3.1415927f, + approach_angle(&m->rot.z, (float *)(d + 0x128), ang, D_0015ED6C_e[1] * 3.1415927f, D_0015ED6C_e[1] * 3.1415927f, frame_time * 6.2831855f); f = *(float *)&D_L18_00162478 * frame_time; if (fast_difference_between_rotations(ang, m->rot.z) > 0.2617994f) { diff --git a/src/overlays/l18/gameplay/entities/rocket.c b/src/overlays/l18/gameplay/entities/rocket.c index f755c906a4..e75e3e5594 100644 --- a/src/overlays/l18/gameplay/entities/rocket.c +++ b/src/overlays/l18/gameplay/entities/rocket.c @@ -93,7 +93,7 @@ void FUN_L18_002d6dc0(Level18VendorActionMoby *moby) { } /* Ported from rac1-decomp (src/overlays/l18_veldin2/vendor_002A8400.c: func_L18_002D9358), where it is exact; names translated to the US level program. */ -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); s32 allocate_voice_for_group_entry(s32 arg0, s32 arg1, s32 arg2) __asm__("FUN_0022dba0"); void FUN_L18_002d7f68(struct Moby *arg, int value) { @@ -102,21 +102,21 @@ void FUN_L18_002d7f68(struct Moby *arg, int value) { arg->state = 2; *(int *)(data + 0x6C) = value; } - if (!FUN_L00_0028d8c0(arg, *(int *)(data + 0x70))) { + if (!voice_is_playing(arg, *(int *)(data + 0x70))) { *(int *)(data + 0x70) = allocate_voice_for_group_entry(0x12, 0, arg); } } /* turns the moby's heading toward a target, clamped per state, and updates its hover offset */ /* Ported from rac1-decomp (src/overlays/l18_veldin2/vendor_002A8400.c: func_L18_002D9B00), where it is exact; names translated to the US level program. */ -extern float FUN_001f9de0(float); -extern float FUN_001fa580(float, float); +extern float fast_sin(float) __asm__("FUN_001f9de0"); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float D_L18_00161A48 __attribute__((sda)); extern float D_L18_00161A4C __attribute__((sda)); void FUN_L18_002d8710(struct Moby *moby) { char *data = (char *)moby->pvars; - float v = FUN_001fa580(moby->rot.y, *(float *)(data + 0x6C)); + float v = fast_add_rotations(moby->rot.y, *(float *)(data + 0x6C)); moby->rot.y = v; if (moby->state == 5) { if (v > 0.5235988f) { @@ -137,10 +137,10 @@ void FUN_L18_002d8710(struct Moby *moby) { moby->rot.y = -0.034906585f; } } - *(float *)(data + 0x74) = FUN_001fa580(*(float *)(data + 0x74), + *(float *)(data + 0x74) = fast_add_rotations(*(float *)(data + 0x74), D_L18_00161A4C * DEG_TO_RAD * frame_time); moby->pos.z = *(float *)(data + 0x64) + - D_L18_00161A48 * FUN_001f9de0(*(float *)(data + 0x74)); + D_L18_00161A48 * fast_sin(*(float *)(data + 0x74)); } #define NOT_SDA @@ -166,13 +166,13 @@ int FUN_L18_002d8858(Level18State *obj) { /* Ported from rac1-decomp (src/overlays/l18_veldin2/vendor_002A8400.c: func_L18_002DD650), where it is exact; names translated to the US level program. */ extern char D_0013E533[]; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern int game_frame __asm__("D_L18_0015F5CC"); -extern int FUN_001f9740(int *); -extern void FUN_001f9a28(void *, void *, void *); +extern int tick_countdown_32(int *) __asm__("FUN_001f9740"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void make_hit_descriptor(char *arg, int a, int b, void *src, float scale) __asm__("FUN_L00_00259888"); -extern void FUN_L00_002598b0(int, float, void *, int, float, float, int, int, int); +extern void play_entity_sound(int, float, void *, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); extern void FUN_L00_00259a88(int, void *); extern void FUN_L18_002dc4b8(); extern void enqueue_callback_list_1(void (*)(void), void *) __asm__("FUN_001f4600"); @@ -187,14 +187,14 @@ void FUN_L18_002dc260(struct Moby *moby) { char *pos; int flag; - if (FUN_001f9740((int *)(d + 2))) { + if (tick_countdown_32((int *)(d + 2))) { mark_moby_for_removal(moby); return; } pos = &moby->pos; tgt = D_0013E533 + 0xE9D; - if (FUN_001f9b80(pos, tgt) < d[0] + 0.5f) { - FUN_001f9a28(v, tgt, pos); + if (vector_distance(pos, tgt) < d[0] + 0.5f) { + fast_vec_sub(v, tgt, pos); v[2] = 0.0f; fast_vec_normalize(v, v, frame_time * 4.0f); v[2] = frame_time * 4.0f; @@ -204,7 +204,7 @@ void FUN_L18_002dc260(struct Moby *moby) { flag = game_frame & 4; d[1] = d[1] + D_L18_00161CA0 * frame_time; if (flag == 0) { - FUN_L00_002598b0(*(int *)(d + 3), d[0], pos, 0x10000, 1.0f, 1.0f, 0, 1, 0); + play_entity_sound(*(int *)(d + 3), d[0], pos, 0x10000, 1.0f, 1.0f, 0, 1, 0); } enqueue_callback_list_1(FUN_L18_002dc4b8, moby); } @@ -331,8 +331,8 @@ extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); extern f32 vector_length_xyz(void *a) __asm__("FUN_001f9af0"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); -extern int FUN_001efa68(void *, void *, int, void *, void *); -extern int FUN_001f9770(void *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern void func_L00_0025F4A8_alt(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); @@ -388,8 +388,8 @@ void FUN_L18_002a7220(char *moby) { } make_hit_descriptor(c, (int)moby, 1, b, 2.0f); *(short *)(c + 0x1A) = *(unsigned short *)(moby + 0xA6); - if (FUN_001efa68(moby + 0x10, a, 0, *(void **)(data + 0x14), c) != 0 || - FUN_001f9770(data + 0x10) != 0) { + if (collision_line(moby + 0x10, a, 0, *(void **)(data + 0x14), c) != 0 || + fast_dec_timer_s16(data + 0x10) != 0) { func_L00_0025F4A8_alt(moby, data, moby + 0x10, 1.5f, 1.0f, 10, 6, 4, 1.0f, 0.5f, 9.0f, 0.5f, 0, 0.0f, 0, 0, -1, 0); mark_moby_for_removal_a7220(moby); @@ -414,9 +414,9 @@ void FUN_L18_002a7220(char *moby) { /* Ported from rac1-decomp (src/overlays/l18_veldin2/vendor_002A8400.c: func_L18_002A87D0), where it is exact; names translated to the US level program. */ extern char *func_0020D348_m(int); -extern float FUN_001f9b20(void *); +extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); char *FUN_L18_002a75f0(struct Moby *owner, float *pos, float *vec, int arg3) { char *moby = func_0020D348_m(0x29); @@ -431,11 +431,11 @@ char *FUN_L18_002a75f0(struct Moby *owner, float *pos, float *vec, int arg3) { qcopy(moby + 0x10, pos); data = *(char **)(moby + 0x78); qcopy(data, vec); - *(short *)(data + 0x10) = FUN_001f96f8(0xF0); + *(short *)(data + 0x10) = scale_game_frames(0xF0); *(short *)(data + 0x12) = arg3; *(char **)(data + 0x14) = owner; *(float *)(moby + 0x48) = fast_arc_tan(vec[0], vec[1]); - *(float *)(moby + 0x44) = -fast_arc_tan(FUN_001f9b20(vec), vec[2]); + *(float *)(moby + 0x44) = -fast_arc_tan(vector_length_xy(vec), vec[2]); } return moby; } @@ -453,14 +453,14 @@ typedef struct { extern char *D_L18_00174858; extern f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); -extern float FUN_001f96b0(float); +extern float FUN_L04_001f1978(float); extern int D_L18_0015F5C4; -extern int FUN_001efa68(void *, void *, int, void *, void *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); extern float D_L18_00161964; -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a40(void *, void *, void *, float); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void lerp_vector(void *, void *, void *, float) __asm__("FUN_001f9a40"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); -extern void FUN_001f9cf8(void *, void *, void *); +extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void euler_rotation_basis(void *, void *) __asm__("FUN_001fa030"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); void FUN_L18_002d5488(void *mobyp, void *vec); @@ -487,7 +487,7 @@ void FUN_L18_002d5050(struct Moby *moby) { if (1.0f < s) { s = 1.0f; } - FUN_001f9a28(v0, (char *)d + 0x10, &moby->pos); + fast_vec_sub(v0, (char *)d + 0x10, &moby->pos); fast_vec_scale(v0, v0, 1.0f / convert_integer_to_float(d->end - d->c)); clear_u64_value(a20); a20[2] = fast_arc_tan(v0[0], v0[1]); @@ -497,19 +497,19 @@ void FUN_L18_002d5050(struct Moby *moby) { a20[2] = d->f24; a20[1] = d->f28; euler_rotation_basis(a70, a20); - FUN_001f9cf8(v0, v0, aA0); - FUN_001f9cf8(v0, v0, a70); - FUN_001f9cf8(v0, v0, a40); - FUN_001f9a40(v10, d, v0, s); + transform_vector_by_basis(v0, v0, aA0); + transform_vector_by_basis(v0, v0, a70); + transform_vector_by_basis(v0, v0, a40); + lerp_vector(v10, d, v0, s); FUN_L18_002d5488(moby, v10); - FUN_001f9a10(&moby->pos, &moby->pos, v10); + fast_vec_add(&moby->pos, &moby->pos, v10); moby->rot.z = fast_arc_tan(v10[0], v10[1]); - f = fast_arc_tan(FUN_001f9b20(v10), v10[2]); + f = fast_arc_tan(vector_length_xy(v10), v10[2]); k = frame_time; moby->rot.y = -f; - moby->rot.x = FUN_001fa580(moby->rot.x, k * 18.849556f); + moby->rot.x = fast_add_rotations(moby->rot.x, k * 18.849556f); d->c = d->c + 1; - r = FUN_001efa68(a30, &moby->pos, 0, moby, 0); + r = collision_line(a30, &moby->pos, 0, moby, 0); if (r) { char *p = D_L18_00174858; if (p != 0) { @@ -526,7 +526,7 @@ void FUN_L18_002d5050(struct Moby *moby) { mark_moby_for_removal(moby); } else if (d->flags & 2) { f = (float)(d->end - d->c); - if (f <= FUN_001f96b0(D_L18_00161964)) { + if (f <= FUN_L04_001f1978(D_L18_00161964)) { enqueue_callback_list_1(FUN_L18_002d5768, moby); } } @@ -534,7 +534,7 @@ void FUN_L18_002d5050(struct Moby *moby) { } /* Spawns a moby that travels along a path, with its heading set from the direction vector. */ extern float D_L18_00161960 __attribute__((sda)); -extern void FUN_L00_002502f0(void *, int, int, int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); extern void allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); char *FUN_L18_002d5348(float *pos, float *dir, float *target, float a, float b, int frames, int kind) { @@ -545,7 +545,7 @@ char *FUN_L18_002d5348(float *pos, float *dir, float *target, float a, float b, *(short *)(moby + 0x32) = 0xFF; moby[0x31] = 1; moby[0x20] = 0; - FUN_L00_002502f0(moby, 0xC0, 0xC0, 0xC0); + set_moby_color(moby, 0xC0, 0xC0, 0xC0); *(float *)(moby + 0x2C) = *(float *)(moby + 0x2C) * D_L18_00161960; qcopy(moby + 0x10, pos); data = *(char **)(moby + 0x78); @@ -558,7 +558,7 @@ char *FUN_L18_002d5348(float *pos, float *dir, float *target, float a, float b, *(int *)(data + 0x30) = frames >> 1; *(int *)(data + 0x38) = kind; *(float *)(moby + 0x48) = fast_arc_tan(dir[0], dir[1]); - *(float *)(moby + 0x44) = -fast_arc_tan(FUN_001f9b20(dir), dir[2]); + *(float *)(moby + 0x44) = -fast_arc_tan(vector_length_xy(dir), dir[2]); allocate_voice_for_target_entry(0, 0, (int)moby); } return moby; @@ -628,7 +628,7 @@ void FUN_L18_002d5610(void *m, void *src) { 0, -1, 0); if (d != 0.0f) { if (hero.vehicle_mode == 2) { - FUN_L00_002598b0((int)moby, 2.0f, moby + 0x10, 2, D_L18_0016196C, 1.0f, 0, 1, + play_entity_sound((int)moby, 2.0f, moby + 0x10, 2, D_L18_0016196C, 1.0f, 0, 1, 0); } } @@ -753,7 +753,7 @@ void FUN_L18_002d5918(struct Moby *moby) { hit = *(char **)(buf + 0x40); if (hit == 0) return; - if (FUN_001f9b80(&moby->pos, hit + 0x10) < 6.0f) { + if (vector_distance(&moby->pos, hit + 0x10) < 6.0f) { float lim2 = *(float *)&D_L18_00161A6C * 3.0f; float lim = frame_time_sq * 6.0f; qcopy(b, &moby->pos); @@ -1042,8 +1042,8 @@ void FUN_L18_002d62e8(struct Moby *moby) { (hero.unk560 == (s32)vars->pair[k].first->path || hero.unk560 == (s32)vars->pair[k].second->path)) { continue; } - near_first = FUN_001f9b80(&hero.motion.pos, &vars->pair[k].first->path->points[0]); - if (near_first < FUN_001f9b80(&hero.motion.pos, &vars->pair[k].second->path->points[0])) { + near_first = vector_distance(&hero.motion.pos, &vars->pair[k].first->path->points[0]); + if (near_first < vector_distance(&hero.motion.pos, &vars->pair[k].second->path->points[0])) { vars->pair[k].first->weight = vars->weight[k].first; vars->pair[k].second->weight = 0.0f; } else { @@ -1123,7 +1123,8 @@ void mmr_q(void *obj) __asm__("FUN_0020c828"); extern float D_L18_00161998 __attribute__((sda)); extern float D_L18_0016199C __attribute__((sda)); extern float D_L18_001619A0 __attribute__((sda)); -void FUN_L18_002d6600(char *moby) { +void thruster_pack_lock_green_update(char *moby) __asm__("FUN_L18_002d6600"); +void thruster_pack_lock_green_update(char *moby) { L18E_q *d = *(L18E_q **)(moby + 0x78); *(float *)(moby + 0x2C) = (*(L18Cls_q **)(moby + 0x24))->f24 * D_L18_00161998; switch (((unsigned char *)moby)[0x20]) { @@ -1335,7 +1336,8 @@ extern int trigger_help_message(int, int) __asm__("FUN_L00_00203908"); extern int allocate_voice_int_7b20(int, int, int) __asm__("FUN_0022da68"); -void FUN_L18_002d7b20(struct Moby *moby) { +void thruster_pack_lock_red_update(struct Moby *moby) __asm__("FUN_L18_002d7b20"); +void thruster_pack_lock_red_update(struct Moby *moby) { char *data = (char *)moby->pvars; int index; @@ -1374,7 +1376,7 @@ void FUN_L18_002d7b20(struct Moby *moby) { *(int *)(data + 0x70) = -1; } else if (hero.state.current != 0x72) { enqueue_callback_list_1_l18(FUN_L18_002d8098, moby); - if (FUN_001f9740((int *)(data + 0x6C)) != 0) + if (tick_countdown_32((int *)(data + 0x6C)) != 0) D_L18_00162390 = 1; } break; @@ -1458,14 +1460,15 @@ extern float D_L18_00161A64 __attribute__((sda)); extern int D_L18_001623A8 __attribute__((sda)); extern void FUN_L18_002d88b8(struct Moby *); extern void FUN_L18_00227dd0(int, int); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern float random_angle_radians(void) __asm__("FUN_00213308"); extern int allocate_voice_82c0(int, int, struct Moby *) __asm__("FUN_0022da68"); /* Ported from rac1-decomp nonmatching/l18_veldin2/func_L18_002D96B0.c (func_L18_002D96B0) */ /* Sinking platform update: arms its tilt, then sinks it under the hero until it is removed. */ -void FUN_L18_002d82c0(struct Moby *moby) { +void floating_platform_update(struct Moby *moby) __asm__("FUN_L18_002d82c0"); +void floating_platform_update(struct Moby *moby) { char *data; float delta[4] __attribute__((aligned(16))); float old_rot[4] __attribute__((aligned(16))); @@ -1494,7 +1497,7 @@ void FUN_L18_002d82c0(struct Moby *moby) { } break; case 3: - if (FUN_001f9740((int *)(data + 0x7C)) == 0) { + if (tick_countdown_32((int *)(data + 0x7C)) == 0) { break; } t = (convert_integer_to_float(D_L18_001623A8) - D_L18_00161A60) / (D_L18_00161A64 - D_L18_00161A60); @@ -1513,7 +1516,7 @@ void FUN_L18_002d82c0(struct Moby *moby) { moby->state = 4; break; case 4: - if (moby->visible != 0 && FUN_001f9740((int *)(data + 0x8C)) != 0) { + if (moby->visible != 0 && tick_countdown_32((int *)(data + 0x8C)) != 0) { FUN_L18_002d88b8(moby); *(int *)(data + 0x8C) = scale_ticks(random_int_between(0x5A, 0x78)); } @@ -1525,13 +1528,13 @@ void FUN_L18_002d82c0(struct Moby *moby) { if (*(int *)(data + 0x80) == 0) { break; } - if (FUN_001f9b80(&moby->pos, &hero.motion.pos) < D_L18_00161A5C) { + if (vector_distance(&moby->pos, &hero.motion.pos) < D_L18_00161A5C) { moby->state = 5; *(short *)(data + 0x92) = allocate_voice_82c0(1, 0, moby); } break; case 5: - if (moby->visible != 0 && FUN_001f9740((int *)(data + 0x8C)) != 0) { + if (moby->visible != 0 && tick_countdown_32((int *)(data + 0x8C)) != 0) { FUN_L18_002d88b8(moby); *(int *)(data + 0x8C) = scale_ticks(random_int_between(0xF, 0x1E)); } @@ -1572,7 +1575,7 @@ void FUN_L18_002d82c0(struct Moby *moby) { } FUN_L18_002d8710(moby); add_vector_xyz(delta, delta, &moby->pos); - FUN_L00_00260738(data + 0x20, delta, old_rot, &moby->rot); + update_entity_matrix(data + 0x20, delta, old_rot, &moby->rot); } /* Starts the moby's next phase with the given pair if it is waiting. */ int FUN_L18_002d8888(struct Moby *arg, int a, int b) { @@ -1659,13 +1662,13 @@ void FUN_L18_002d88b8(struct Moby *moby) { random_float_between(0.0f, 1.0f)); i1 = FUN_001fa6e0((*(int *)&(D_L18_00161AA4)), (*(int *)&(D_L18_00161AA8)), random_float_between(0.0f, 1.0f)); - i2 = func_001FA898_r(FUN_001f96b0( + i2 = func_001FA898_r(FUN_L04_001f1978( (float)(*(int *)&(D_L18_00161A7C)) * random_float_between(0.0f, 1.0f) + 1.0f)); - i3 = func_001FA898_r(FUN_001f96b0((float)(*(int *)&(D_L18_00161A80)) * + i3 = func_001FA898_r(FUN_L04_001f1978((float)(*(int *)&(D_L18_00161A80)) * (random_float_between(-(*(float *)&(D_L18_00161A88)), (*(float *)&(D_L18_00161A88))) + 1.0f))); - i4 = func_001FA898_r(FUN_001f96b0((float)(*(int *)&(D_L18_00161A84)) * + i4 = func_001FA898_r(FUN_L04_001f1978((float)(*(int *)&(D_L18_00161A84)) * (random_float_between(-(*(float *)&(D_L18_00161A88)), (*(float *)&(D_L18_00161A88))) + 1.0f))); @@ -1677,7 +1680,7 @@ void FUN_L18_002d88b8(struct Moby *moby) { extern float fast_add_rotations(float, float); extern float fast_sin(float); extern float probe_ground_height(void *, int, float); -extern int FUN_L00_0028dc90(int i, int a1, int v, int k); +extern int trooper_play_sound(int i, int a1, int v, int k) __asm__("FUN_L00_0028dc90"); extern int scale_game_frames(int); extern int tick_countdown_32(int *); extern int truncate_float_to_s32_p() __asm__("FUN_001fa6d0"); @@ -1700,7 +1703,7 @@ extern int D_L18_00161C38 __attribute__((sda)); extern int D_L18_00161C3C __attribute__((sda)); extern int D_L18_00161C40 __attribute__((sda)); extern int D_L18_00161C44 __attribute__((sda)); -extern void FUN_L00_00259fe8(unsigned char *m, float s); +extern void jet_animate(unsigned char *m, float s) __asm__("FUN_L00_00259fe8"); extern void FUN_L18_002dba20(); extern void FUN_L18_002dbe80_c(char *moby) __asm__("FUN_L18_002dbe80"); extern void add_vector_xyz(void *, void *, void *); @@ -1739,13 +1742,13 @@ void FUN_L18_002db460(struct Moby *moby) { random_float_between(0.0f, 1.0f)); i1 = FUN_001fa6e0(D_L18_00161C38, D_L18_00161C3C, random_float_between(0.0f, 1.0f)); - i2 = func_001FA898_r(FUN_001f96b0( + i2 = func_001FA898_r(FUN_L04_001f1978( (float)D_L18_00161C10 * random_float_between(0.0f, 1.0f) + 1.0f)); - i3 = func_001FA898_r(FUN_001f96b0( + i3 = func_001FA898_r(FUN_L04_001f1978( (float)D_L18_00161C14 * (random_float_between(-D_L18_00161C1C, D_L18_00161C1C) + 1.0f))); - i4 = func_001FA898_r(FUN_001f96b0( + i4 = func_001FA898_r(FUN_L04_001f1978( (float)D_L18_00161C18 * (random_float_between(-D_L18_00161C1C, D_L18_00161C1C) + 1.0f))); @@ -1774,7 +1777,7 @@ void FUN_L18_002db460(struct Moby *moby) { if (moby->pos.z < 10.0f) { mark_moby_for_removal_p(moby); } else { - FUN_L00_00259fe8((unsigned char *)moby, 1.0f); + jet_animate((unsigned char *)moby, 1.0f); } break; } @@ -1783,7 +1786,7 @@ void FUN_L18_002db460(struct Moby *moby) { moby->glow_color = FUN_001fa6e0(*(int *)&D_L18_00161BFC, D_L18_00161C00, (fast_sin(d[12]) + 1.0f) * 0.5f); if (tick_countdown_32((int *)(d + 11))) { - FUN_L00_0028dc90(0xF, 0, (int)moby, 0x58E); + trooper_play_sound(0xF, 0, (int)moby, 0x58E); moby->state = 2; d[9] = 0.5f; moby->collision = 0; @@ -1946,7 +1949,7 @@ void FUN_L18_002dba20(M_dba20 *moby) { } /* Ported from rac1-decomp (src/overlays/l18_veldin2/vendor_002A8400.c: func_L18_002DD270), where it is exact; names translated to the US level program. */ -extern float FUN_001f9dc8(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern void FUN_L18_002dc0c8_u(char *moby, void *a1, void *a2) __asm__("FUN_L18_002dc0c8"); void FUN_L18_002dbe80(struct Moby *moby) { @@ -1958,38 +1961,38 @@ void FUN_L18_002dbe80(struct Moby *moby) { float p, q, step; int i; - FUN_001f9a28(v, &hero.motion.pos, &moby->pos); + fast_vec_sub(v, &hero.motion.pos, &moby->pos); v[2] = 0.0f; fast_vec_normalize(v, v, frame_time * 4.0f); v[2] = frame_time * 4.0f; make_hit_descriptor(hit, (int)moby, 0x10001, v, 3.0f); step = 1.0f / convert_integer_to_float(0x40) * 6.28318f; p = -3.14159f; - q = FUN_001fa580(p, step); + q = fast_add_rotations(p, step); for (i = 0x3F; i >= 0; i--) { - a[0] = FUN_001f9dc8(p) * *(float *)(d + 0x24); - a[1] = FUN_001f9de0(p) * *(float *)(d + 0x24); + a[0] = fast_cos(p) * *(float *)(d + 0x24); + a[1] = fast_sin(p) * *(float *)(d + 0x24); a[2] = 0.0f; - b[0] = FUN_001f9dc8(q) * *(float *)(d + 0x24); - b[1] = FUN_001f9de0(q) * *(float *)(d + 0x24); + b[0] = fast_cos(q) * *(float *)(d + 0x24); + b[1] = fast_sin(q) * *(float *)(d + 0x24); b[2] = 0.0f; - FUN_001f9a10(a, a, &moby->pos); + fast_vec_add(a, a, &moby->pos); a[2] += 0.5f; - FUN_001f9a10(b, b, &moby->pos); + fast_vec_add(b, b, &moby->pos); b[2] += 0.5f; - FUN_001efa68(a, b, 1, *(void **)(d + 0x34), hit); + collision_line(a, b, 1, *(void **)(d + 0x34), hit); if (*(float *)(d + 0x24) < 3.0f) { FUN_L18_002dc0c8_u(moby, a, b); } - p = FUN_001fa580(p, step); - q = FUN_001fa580(q, step); + p = fast_add_rotations(p, step); + q = fast_add_rotations(q, step); } } /* Ported from rac1-decomp (src/overlays/l18_veldin2/vendor_002A8400.c: func_L18_002DD4B8), where it is exact; names translated to the US level program. */ extern float FUN_001f9b48(void *, void *); extern int FUN_001fa6e0(int, int, float); -extern int FUN_001fa728(char *, float); +extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern s32 random_integer_below(s32) __asm__("FUN_00213260"); extern void FUN_L00_002730e0(void *, void *, int, int, int, int, float); @@ -2007,21 +2010,21 @@ void FUN_L18_002dc0c8(struct Moby *moby, void *a1, void *a2) { char *d = (char *)moby->pvars; int col; - FUN_001f9a40(buf, a1, a2, 0.5f); + lerp_vector(buf, a1, a2, 0.5f); buf[3] = FUN_001f9b48(a1, a2) * 0.5f; - if (FUN_001fa728((char *)buf, D_L18_00161BF4) == -1) { + if (fast_bsphere_check((char *)buf, D_L18_00161BF4) == -1) { return; } if (random_float_between(0.0f, 1.0f) < D_L18_00161C98) { - FUN_001f9a40(v, a1, a2, random_float_between(0.0f, 1.0f)); - FUN_001f9a28(w, v, &moby->pos); + lerp_vector(v, a1, a2, random_float_between(0.0f, 1.0f)); + fast_vec_sub(w, v, &moby->pos); fast_vec_normalize(w, w, *(float *)(d + 0x20)); col = FUN_001fa6e0(D_L18_00161C80, D_L18_00161C84, random_float_between(0.0f, 1.0f)); - FUN_L00_002730e0(v, w, col, FUN_001f96f8(D_L18_00161C8C) & 0xFF, + FUN_L00_002730e0(v, w, col, scale_game_frames(D_L18_00161C8C) & 0xFF, random_integer_below(0xFF) & 0xFF, 0, D_L18_00161C88); w[2] = 0.0f; - FUN_L00_002730e0(v, w, col, FUN_001f96f8(D_L18_00161C90) & 0xFF, + FUN_L00_002730e0(v, w, col, scale_game_frames(D_L18_00161C90) & 0xFF, random_integer_below(0xFF) & 0xFF, 0, D_L18_00161C88); } } @@ -2036,8 +2039,8 @@ void FUN_L18_002dc458(struct Moby *moby, void *pos, float f) { lim = *(int *)&D_L18_00161C9C_d; d[2] += 2; *(float *)d = f; - if (FUN_001f96f8(lim) < d[2]) { - d[2] = FUN_001f96f8(*(int *)&D_L18_00161C9C_d); + if (scale_game_frames(lim) < d[2]) { + d[2] = scale_game_frames(*(int *)&D_L18_00161C9C_d); } } /* Ported from rac1-decomp nonmatching/l18_veldin2/func_L18_002DD8A8.c (func_L18_002DD8A8) */ @@ -2313,7 +2316,7 @@ s32 FUN_L18_002dfba0(const u8 *moby) { } extern int FUN_L00_0025a420(void *, int, int); extern void FUN_L18_002e9e50(int); -extern void FUN_L00_0025f090(float, float, void *, void *, int); +extern void cart_burst(float, float, void *, void *, int) __asm__("FUN_L00_0025f090"); extern void FUN_L00_00257d78(float *, float, float); extern float FUN_L00_00257c48(float, float); extern float random_float_between_9768(float, float) __asm__("FUN_002132a8"); @@ -2356,7 +2359,7 @@ void FUN_L18_002e9768(struct Moby *moby) { case 1: if (FUN_L00_0025a420(moby, 0x80000, 0)) { FUN_L18_002e9e50(moby->group); - FUN_L00_0028dc90(0, 0, (int)moby, 0x375); + trooper_play_sound(0, 0, (int)moby, 0x375); } moby->hit_slot = 0xff; return; @@ -2452,7 +2455,7 @@ void FUN_L18_002e9768(struct Moby *moby) { add_vector_9768(pos, pos, data + 4); if (data[7] - 16.0f > moby->pos.z || hit_test_9768(1.0f, pos, 2, moby)) { - FUN_L00_0025f090(1.5f, 0.0f, moby, pos, -1); + cart_burst(1.5f, 0.0f, moby, pos, -1); remove_moby_9768(moby); } return; @@ -2651,7 +2654,7 @@ void FUN_L18_002ea598(struct Moby *moby) { int i; int c1, c2, a, b, c; float k1, k2, k3, k4; - FUN_001f9a28(v40, (void *)moby->pvars, &moby->pos); + fast_vec_sub(v40, (void *)moby->pvars, &moby->pos); fast_vec_normalize(v40, v40, frame_time * 60.0f); k1 = (*(float *)&(D_L18_00161F54)) * frame_time; k2 = (*(float *)&(D_L18_00161F58)) * frame_time; @@ -2661,18 +2664,18 @@ void FUN_L18_002ea598(struct Moby *moby) { FUN_L00_00257d78(v20, k1, k2); fast_vec_scale(v30, v20, (*(float *)&(D_L18_00161F5C))); v30[2] -= random_float_between(k3, k4); - a = func_001FA898_r(FUN_001f96b0(random_float_between( + a = func_001FA898_r(FUN_L04_001f1978(random_float_between( (*(float *)&(D_L18_00161F3C)), (*(float *)&(D_L18_00161F40))))); - b = func_001FA898_r(FUN_001f96b0(random_float_between( + b = func_001FA898_r(FUN_L04_001f1978(random_float_between( (*(float *)&(D_L18_00161F44)), (*(float *)&(D_L18_00161F48))))); - c = func_001FA898_r(FUN_001f96b0(random_float_between( + c = func_001FA898_r(FUN_L04_001f1978(random_float_between( (*(float *)&(D_L18_00161F4C)), (*(float *)&(D_L18_00161F50))))); v20[3] = random_float_between((*(float *)&(D_L18_00161F2C)), (*(float *)&(D_L18_00161F30))); v30[3] = random_float_between((*(float *)&(D_L18_00161F34)), (*(float *)&(D_L18_00161F38))); fast_vec_scale(v10, v40, random_float_between(0.0f, 1.0f)); - FUN_001f9a10(v10, v10, &moby->pos); + fast_vec_add(v10, v10, &moby->pos); c1 = FUN_001fa6e0((*(int *)&(D_L18_00161F1C)), (*(int *)&(D_L18_00161F20)), random_float_between(0.0f, 1.0f)); c2 = FUN_001fa6e0((*(int *)&(D_L18_00161F24)), (*(int *)&(D_L18_00161F28)), @@ -2741,7 +2744,7 @@ void FUN_L18_002ea800(void *arg) { char *effect; *(Q128 *)v10 = *(Q128 *)&moby->pos; FUN_L06_0030bef8(v10, scale_ticks(30), 0x80806060, 0x801010); - FUN_L00_0028dc90(0x10, 0, (int)arg, 0x58E); + trooper_play_sound(0x10, 0, (int)arg, 0x58E); if (D_L18_00161F6C > 0) { int a, b, c; float angle, elevation, scale, speed; @@ -2774,7 +2777,7 @@ void FUN_L18_002ea800(void *arg) { angle = random_angle_radians(); FUN_00214db0(v10, speed, angle, elevation); angle = random_angle_radians(); - value_x = FUN_001f9dc8(angle); + value_x = fast_cos(angle); v20[0] = random_float_between(0.0f, D_L18_00161FBC); value_x *= v20[0]; v20[0] = value_x; @@ -2910,7 +2913,7 @@ extern float D_L18_001677C0_c[] __asm__("D_L18_001677C0"); extern float D_L18_001D9F80[]; extern float D_L18_001DA110[]; extern float FUN_L00_00257c48(float lo, float hi); -extern float FUN_L00_0025e310(float); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern int D_L18_0015F580; /* no foreign declaration */ extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); @@ -2979,7 +2982,7 @@ void FUN_L18_002eaea0(void *moby) { float b; f21 = *(float *)&D_L18_00162000 + (*(float *)&D_L18_00162004 - *(float *)&D_L18_00162000) * (convert_integer_to_float(i) * 0.05f); - f21 = f21 * fast_sin_c(FUN_L00_0025e310(*(float *)&D_L18_00162008 + (float)i * *(float *)&D_L18_00161FFC)); + f21 = f21 * fast_sin_c(normalize_angle(*(float *)&D_L18_00162008 + (float)i * *(float *)&D_L18_00161FFC)); f21 = f21 + FUN_L00_00257c48(*(float *)&D_L18_00162040, *(float *)&D_L18_00162044); D_L18_001D9D00[0][i].f[2] = D_L18_001D9D00[0][i].f[2] - D_L18_001D9F80[i]; D_L18_001D9F80[i] = f21; @@ -2987,7 +2990,7 @@ void FUN_L18_002eaea0(void *moby) { b = random_angle_radians_c(); build_spherical_offset(&s[1], scale, a, b); s[1].f[2] = s[1].f[2] * 0.5f; - FUN_001f9a40(&s[2], &s[3], &s[1], *(float *)&D_L18_0016208C); + lerp_vector(&s[2], &s[3], &s[1], *(float *)&D_L18_0016208C); len0 = vector_length_xyz(&s[2]); if (len0 == 0.0f) { qcopy(&D_L18_001D9D00[0][i], &D_L18_001D9D00[0][i - 1]); @@ -3012,16 +3015,16 @@ void FUN_L18_002eaea0(void *moby) { w = 0.1f; } scale_vector_xyz_c(&s[5], &s[5], scale / len); - FUN_001f9a40(&s[3], &s[3], &s[5], w); + lerp_vector(&s[3], &s[3], &s[5], w); } if (i < 10) { float g; float h; float ang; float m; - g = FUN_L00_0025e310(*(float *)&D_L18_00162010 + (float)i * *(float *)&D_L18_00162018); + g = normalize_angle(*(float *)&D_L18_00162010 + (float)i * *(float *)&D_L18_00162018); h = *(float *)&D_L18_0016201C - * fast_sin_c(FUN_L00_0025e310(*(float *)&D_L18_00162024 + (float)i * *(float *)&D_L18_0016202C)); + * fast_sin_c(normalize_angle(*(float *)&D_L18_00162024 + (float)i * *(float *)&D_L18_0016202C)); qcopy(&D_L18_001D9D00[1][i], &D_L18_001D9D00[0][i]); h = h * fast_sin_c(g) + FUN_L00_00257c48(0.0f, 0.1f); D_L18_001D9D00[1][i].f[2] = D_L18_001D9D00[1][i].f[2] + h; @@ -3053,7 +3056,7 @@ void FUN_L18_002eaea0(void *moby) { qcopy(&s[8], data + 0x10); t = 0.5f; } - if (FUN_001f9770(D_L18_001620B8 + k)) { + if (fast_dec_timer_s16(D_L18_001620B8 + k)) { int j; D_L18_001620B8[k] = scale_game_frames_alt(D_L18_001620C8[k]); D_L18_001620C0[k] = 0; diff --git a/src/overlays/l18/gameplay/hero/00213b40.c b/src/overlays/l18/gameplay/hero/00213b40.c index 8e9fc311e6..474e877f74 100644 --- a/src/overlays/l18/gameplay/hero/00213b40.c +++ b/src/overlays/l18/gameplay/hero/00213b40.c @@ -8,7 +8,7 @@ /* Same source as the exact FUN_L16_002097a0, with a state 3 flag (0x12E6) and its own landing checks (as FUN_L15_002044c8). */ extern int D_0015ED84_d __asm__("D_0015ED84"); -extern int FUN_001f0b58(void); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern void fast_mem_zero16(void *, int) __asm__("FUN_001f9810"); extern void FUN_L00_0020b930(void); @@ -66,7 +66,7 @@ void FUN_L18_00213b40(void) { struct Hero *q = &hero; if (q->state.current != 0x7B) { if (coll_sphere(q->unk234 + 0.03f, &q->motion.unkD0, 2, 0)) { - if (FUN_001f0b58() == 0xB) { + if (collision_hit_material() == 0xB) { hero_set_state(0x7B, 1); return; } diff --git a/src/overlays/l18/gameplay/hero/0021eac8.c b/src/overlays/l18/gameplay/hero/0021eac8.c index b6f6bd2479..7d736aa0c7 100644 --- a/src/overlays/l18/gameplay/hero/0021eac8.c +++ b/src/overlays/l18/gameplay/hero/0021eac8.c @@ -142,7 +142,7 @@ extern void FUN_L00_00217118(f32, f32); extern void stick_target(f32, s32) __asm__("FUN_L00_002118c8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void turn_to(s32, f32, f32, f32) __asm__("FUN_L00_00211e30"); -extern s32 FUN_001f9740(void *); +extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 FUN_L00_00229a98(void); extern void FUN_L00_00211e98(void); @@ -179,10 +179,10 @@ extern u8 D_L18_0017C9C0[]; extern void FUN_L00_00216e48(s32, struct MobyView *, s32); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); -extern s32 FUN_001f9770(s16 *); +extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); extern void FUN_L00_00209a40(s32, s32); extern void FUN_L00_00209ca8(s32, s32, s32); -extern void FUN_L00_002a3ec8(s32, s32, s32, f32, f32, f32, f32); +extern void pool_splash(s32, s32, s32, f32, f32, f32, f32) __asm__("FUN_L00_002a3ec8"); extern f32 FUN_L00_0025bc98(f32 *, f32, f32 *, s32, f32, f32, f32); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); @@ -196,7 +196,7 @@ extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 FUN_L00_00209018(void *, s32); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern void FUN_L00_0020a1e0(f32, f32); @@ -220,21 +220,21 @@ extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern s32 FUN_L00_002595a0(f32 *, f32 *, f32, f32, f32); extern void FUN_L00_0025bc00(f32 *, s32, f32, f32); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern f32 square_root(f32) __asm__("FUN_001f9988"); -extern f32 FUN_L00_00233a78(void *); -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); -extern f32 FUN_L00_00213350(void *); +extern f32 gravity_z(void *) __asm__("FUN_L00_00233a78"); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); +extern f32 forward_component(void *) __asm__("FUN_L00_00213350"); extern struct HeroTableRow2C D_L18_0017C628[]; extern struct LevelTable_QS D_L18_00167680; #define Q D_L18_00167680 extern void FUN_L00_00233ba0(void *, void *, f32); -extern void FUN_L00_00233b20(void *, void *, f32); +extern void gravity_set_z(void *, void *, f32) __asm__("FUN_L00_00233b20"); extern void FUN_L00_002336e8(void *, void *, f32); extern void make_hit_descriptor(void *, struct MobyView *, s32, f32, void *) __asm__("FUN_L00_00259888"); extern s32 collect_mobies_in_sphere(f32, void *, s32, struct MobyView *, void *) __asm__("FUN_L00_001f2868"); @@ -245,8 +245,8 @@ extern void FUN_L00_001ff290(void *, void *, void *); extern void FUN_L00_002a9b80(struct MobyView *, void *); extern s32 FUN_L00_002a96f8(struct MobyView *, void *, f32, f32, s32, f32, f32, f32); extern void FUN_L00_002335c8(void *, f32, f32, f32); -extern s32 FUN_L00_002598b0(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32); -extern f32 FUN_001f9ab0(void *, void *); +extern s32 play_entity_sound(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32) __asm__("FUN_L00_002598b0"); +extern f32 fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); struct PlayerSpeedTuning { u8 pad0[8]; f32 x08; @@ -258,14 +258,14 @@ extern struct PlayerSpeedTuning D_L18_0017C7B8; extern s32 FUN_L00_00216de8(s32, s32); extern void FUN_L00_00233708(void *, void *, f32); extern void FUN_L00_00233810(void *, void *, f32); -extern s32 FUN_001efa68(void *, void *, s32, struct MobyView *, s32); +extern s32 collision_line(void *, void *, s32, struct MobyView *, s32) __asm__("FUN_001efa68"); extern void FUN_L00_00215340(void); extern void FUN_L00_00233660(void *, f32, f32, f32); extern s32 FUN_L00_0025e3b8(s32); -extern void FUN_L00_00259bc8(s32, struct MobyView *, s32, void *, void *, f32); +extern void spawn_nearby_effect(s32, struct MobyView *, s32, void *, void *, f32) __asm__("FUN_L00_00259bc8"); extern s32 D_L18_00178900[]; extern void FUN_L00_00209ec8(void); -extern void FUN_L00_002338d0(void *, void *); +extern void gravity_flatten(void *, void *) __asm__("FUN_L00_002338d0"); extern s32 hero_slot_item_id(s32) __asm__("FUN_L00_0020d498"); extern void FUN_L00_0020b5b8(void); extern void FUN_L01_0022d090(void); @@ -278,7 +278,7 @@ extern void FUN_L00_0020d2f8(void *); extern f32 randf_sym(f32, f32) __asm__("FUN_L00_00257c48"); extern void FUN_L00_0026d598(void *, void *, s32); extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); -extern s32 FUN_L00_0025d808(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); +extern s32 sample_path(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); extern s32 FUN_L00_0025d7a0(void *, s32, s32, s32); extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); extern void hero_integrate_velocity(void) __asm__("FUN_L00_00214108"); @@ -339,7 +339,7 @@ void FUN_L18_0021eac8(void) { transform_vector_by_basis(&hero.motion.unk170, &v0, &D_L18_001677D8[0x1F8]); hero.motion.move_yaw = *(f32 *)D_L18_001677D8; turn_to(0, frame_scale_sq, frame_scale_sq * 0.0f, frame_time * 174.53293f); - if (D_L18_0015F688 > 0 && FUN_001f9740(&D_L18_0015F688) != 0) { + if (D_L18_0015F688 > 0 && fast_dec_timer(&D_L18_0015F688) != 0) { s32 t; if (usage_stats.stat[18].count < 0xFFFF) { usage_stats.stat[18].count++; @@ -456,7 +456,7 @@ void FUN_L18_0021eac8(void) { } if (hero.unk90A != 0) { s32 n; - FUN_001f9770(&hero.unk90A); + fast_dec_timer_s16(&hero.unk90A); n = (s16)hero.unk90A >> 2; FUN_L00_00209a40(n > 8 ? 8 : n, 0); } @@ -470,7 +470,7 @@ void FUN_L18_0021eac8(void) { if (hero.state_timer == 1) { FUN_L00_00209ca8(3, 0x10, 0); if (D_L18_001612D0 != 0) { - FUN_L00_002a3ec8(D_L18_001612D0, D_L18_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L18_001612D0, D_L18_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, -0.3f); } hero.unk90A = scale_game_frames(70); @@ -581,7 +581,7 @@ void FUN_L18_0021eac8(void) { stick_target(1.0f, 0); turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); hero.unk8EC = hero.motion.unk184; - FUN_001f9740(&hero.unk8F4); + fast_dec_timer(&hero.unk8F4); if (hero.state.step == 1) { hero.target_speed = frame_time * 6.0f; } else if (hero.state.current == 0x35) { @@ -611,7 +611,7 @@ void FUN_L18_0021eac8(void) { if (hero.state.current != 0x35 || !(PD.u1A0.i1A0 & 0xA)) { hero.target_speed *= k; }; - if (FUN_001f9740(&hero_b.unk8F0) != 0) { + if (fast_dec_timer(&hero_b.unk8F0) != 0) { s32 lo2; s32 hi2; pl = &hero_b; @@ -634,7 +634,7 @@ void FUN_L18_0021eac8(void) { } pl->unk8F0 = random_int_between(lo2, scale_game_frames(hi2)); } - if (hero.state.current == 0x35 && FUN_001f9770(&hero.unk8F8) != 0) { + if (hero.state.current == 0x35 && fast_dec_timer_s16(&hero.unk8F8) != 0) { struct MobyView *gm = (struct MobyView *)hero.items[3].moby; if (gm != NULL && gm->hA6 == 0x261) { s32 i; @@ -672,7 +672,7 @@ void FUN_L18_0021eac8(void) { } build_spherical_offset(&hero.motion.velocity, sp, hero.motion.rot.f[2], yaw); } else if (hero.state.current == 0x34) { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); if (hero.state.prev == 0x35) { approach_value(&len, 0.0f, frame_time_sq * 8.0f); } else { @@ -720,11 +720,11 @@ void FUN_L18_0021eac8(void) { break; case 0x6A: case 0x82: { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); approach_value(&len, 0.0f, frame_time_sq * 4.0f); fast_vec_normalize(&hero.motion.unk150, &hero.motion.unk150, len); qcopy(&hero.motion.velocity, &hero.motion.unk150); - if (FUN_001f9740(&hero.unk8F0) == 2) { + if (fast_dec_timer(&hero.unk8F0) == 2) { moby_point_position((struct MobyView *)hero.moby, 4, &v0); v20.q = 0; v20.f[0] = 0.4f; @@ -771,7 +771,7 @@ void FUN_L18_0021eac8(void) { } } turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); - FUN_001f9740(&hero.unk698); + fast_dec_timer(&hero.unk698); if (hero.state.current == 0x36) { if (PD.i1D4 != 0 && hero.unk698 != 0) { hero.target_speed = frame_time * 3.0f; @@ -895,7 +895,7 @@ void FUN_L18_0021eac8(void) { FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, 0.0f, frame_time * 3.8397243f); } else { f32 an = fast_add_rotations( - -fast_arc_tan(FUN_001f9b80(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); + -fast_arc_tan(vector_distance(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, an, frame_time * 6.4577184f); } v20.f[0] = fast_cos(fast_add_rotations(hero.motion.rot.f[2], -1.5707964f)) * -0.57f; @@ -979,14 +979,14 @@ void FUN_L18_0021eac8(void) { } if (hero.unk99C != 0) { f32 s; - if (FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { + if (vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.displacement, frame_time_sq * 40.0f); - if (hero.unk9BE != 0 && FUN_L00_00233a78(&hero.motion.velocity) > 0.0f) { + if (hero.unk9BE != 0 && gravity_z(&hero.motion.velocity) > 0.0f) { subtract_vector_xyz(&v30, &hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 57.0f); } } - s = FUN_001f9af0(&hero.motion.velocity) * (frame_time * 0.015f); + s = fast_vec_length(&hero.motion.velocity) * (frame_time * 0.015f); fast_vec_scale(&v30, &hero.motion.velocity, -1.0f); fast_vec_normalize(&v30, &v30, s); add_vector_xyz(&hero.motion.velocity, &hero.motion.velocity, &v30); @@ -994,7 +994,7 @@ void FUN_L18_0021eac8(void) { { struct MobyView *r; if ((struct MobyView *)hero.unk994 != NULL && (r = ((struct MobyView *)hero.unk994)->pm78) != NULL) { - f32 len = FUN_001f9af0(&hero.motion.velocity); + f32 len = fast_vec_length(&hero.motion.velocity); if (r->fC < len) { approach_value(&len, r->fC, frame_time_sq * 15.0f); fast_vec_normalize(&hero.motion.velocity, &hero.motion.velocity, len); @@ -1015,9 +1015,9 @@ void FUN_L18_0021eac8(void) { add_vector_xyz(&v30, &((struct MobyView *)hero.unk994)->u10.v10, &vC0); subtract_vector_xyz(&hero.motion.velocity, &v30, &vD0); old = hero.unk9A4; - FUN_L00_0025b8c0(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); + vendor_spring(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); d = hero.unk9A4 - old; - if (FUN_001f9af0(&vC0) > hero.unk9A4) { + if (fast_vec_length(&vC0) > hero.unk9A4) { fast_vec_normalize(&vC0, &vC0, d); add_vector_xyz(&hero.motion.pos, &hero.motion.pos, &vC0); } @@ -1026,7 +1026,7 @@ void FUN_L18_0021eac8(void) { f32 mx = frame_time * 14.0f; f32 sp = vector_length_xy(&hero.motion.velocity); if (sp < mx) { - FUN_L00_0025b8c0(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); + vendor_spring(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); v30.f[0] = fast_cos(hero.unk9AC) * hero.unk9B4; v30.f[1] = fast_sin(hero.unk9AC) * hero.unk9B4; v30.f[2] = 0.0f; @@ -1043,7 +1043,7 @@ void FUN_L18_0021eac8(void) { up = hero.unk9BC == 1; } else { v30.q = hero.motion.displacement.q; - up = FUN_L00_00213350(&v30) > 0.0f; + up = forward_component(&v30) > 0.0f; } if (up) { if (moby->b53 != 0x35) { @@ -1079,12 +1079,12 @@ void FUN_L18_0021eac8(void) { mx = frame_time_sq * 70.0f; t2 = scale_game_frames(33); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk4B0); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unk4B8 = 1.0f; } } @@ -1116,7 +1116,7 @@ void FUN_L18_0021eac8(void) { } hero.target_speed = 0.0f; if ((struct MobyView *)hero.unkA54 != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = frame_time * 4.5f; } @@ -1157,16 +1157,16 @@ void FUN_L18_0021eac8(void) { } FUN_L00_00211870(27.0f); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 130.0f); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unkA70 = 1.0f; } - if (FUN_L00_00233a78(&hero.motion.velocity) < frame_time * -37.0f) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); + if (gravity_z(&hero.motion.velocity) < frame_time * -37.0f) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); } } break; @@ -1236,7 +1236,7 @@ void FUN_L18_0021eac8(void) { tb = &D_L18_0017C628[hero.attack_record]; hero.target_speed = 0.0f; if ((struct MobyView *)hero.unkA54 != NULL && scale_game_frames(4) > hero.state_timer) { - f32 d = FUN_001f9b80(&((struct MobyView *)hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; + f32 d = vector_distance(&((struct MobyView *)hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; f32 off; f32 tol; f32 mx; @@ -1495,7 +1495,7 @@ void FUN_L18_0021eac8(void) { Vec4 *p = &hero.move_impulse; FUN_L00_002132b8(0.7f, 0.0f); v0.q = hero.move_impulse.q; - hero.target_speed += FUN_L00_00213350(&v0); + hero.target_speed += forward_component(&v0); if (hero.target_speed < frame_time * 0.7f) { hero.target_speed = frame_time * 0.7f; } @@ -1578,7 +1578,7 @@ void FUN_L18_0021eac8(void) { v10.f[2] += random_float_between(frame_time, frame_time * 2.0f); FUN_L00_00271b18(&v0, &v10, random_float_between(37800.0f, 75600.0f)); } - f = FUN_001f9af0(&hero.motion.platform_delta); + f = fast_vec_length(&hero.motion.platform_delta); if (f > frame_time * 0.5f) { hero.motion.move_yaw = fast_arc_tan(hero.motion.platform_delta.f[0], hero.motion.platform_delta.f[1]); } else { @@ -1685,9 +1685,9 @@ void FUN_L18_0021eac8(void) { if (hero.state.current == 0x42) { r = hero.unk5CC * (f32)hero.unk578; } - FUN_L00_0025d808((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); + sample_path((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); if (hero.unk590 != 0) { - FUN_L00_0025d808((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); + sample_path((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); } if (scale_game_frames(90) < hero.unk19C) { s32 h; @@ -1697,11 +1697,11 @@ void FUN_L18_0021eac8(void) { qcopy(&v20, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - h = FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); + h = sample_path((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); qcopy(&v30, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - if ((h | FUN_L00_0025d808((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || + if ((h | sample_path((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || hero.unk584 != 0) { f32 a = fast_subtract_rotations( hero.unk57C, fast_arc_tan(v30.f[0] - v20.f[0], v30.f[1] - v20.f[1])) * @@ -1758,7 +1758,7 @@ void FUN_L18_0021eac8(void) { } idx = FUN_L00_0025d7a0((void *)hero.unk560, hero.unk564, hero.unk578, hero.unk584); subtract_vector_xyz(&v20, (Vec4 *)hero.unk560 + (idx + 1), &v0); - if (FUN_001f9af0(&v20) < 0.001f) { + if (fast_vec_length(&v20) < 0.001f) { if (hero.unk564 == idx) { hero.unk570 = scale_game_frames(1); break; @@ -1805,7 +1805,7 @@ void FUN_L18_0021eac8(void) { hero.motion.pos.f[2] += v20.f[2]; subtract_vector_xyz(&v30, &hero.unk500, &hero.motion.pos); v30.f[2] = 0.0f; - if (FUN_001f9af0(&v30) > frame_time) { + if (fast_vec_length(&v30) > frame_time) { fast_vec_normalize(&v30, &v30, frame_time); } hero.motion.pos.f[0] += v30.f[0]; @@ -1851,8 +1851,8 @@ void FUN_L18_0021eac8(void) { si = hero.unk564; sf = hero.unk568; qcopy(&v20, &hero.motion.pos); - FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); - e = fast_arc_tan(FUN_001f9b80(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); + sample_path((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); + e = fast_arc_tan(vector_distance(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); if (e > 0.0f) { sp = e * 1.9098593f * (frame_time * -2.5f); if (e > 0.2617994f && hero.unk5A8 != 2 && hero.unk5A8 != 3) { @@ -1889,9 +1889,9 @@ void FUN_L18_0021eac8(void) { f32 mx = frame_time * 7.0f; f32 fl; f32 len; - fl = -FUN_001f9af0(&v20); - FUN_L00_0025b8c0(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); - len = FUN_001f9af0(&v20); + fl = -fast_vec_length(&v20); + vendor_spring(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); + len = fast_vec_length(&v20); if (len < hero.unk5DC) { hero.unk5DC = len; } @@ -2003,8 +2003,8 @@ void FUN_L18_0021eac8(void) { FUN_L00_00215340(); FUN_L00_002132b8(0.7f, frame_time * 0.0f); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; case 0x77: { @@ -2016,8 +2016,8 @@ void FUN_L18_0021eac8(void) { len = vector_length_xy(&hero.motion.velocity); FUN_L00_001ff600(frame_scale * -0.100000024f * len + len, &hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; } @@ -2056,11 +2056,11 @@ void FUN_L18_0021eac8(void) { FUN_L00_00215340(); FUN_L15_0020a328(1); if (big) { - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); hero.unk304 = hero.motion.velocity.f[2]; } else { - FUN_L00_0025b8c0(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, + vendor_spring(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, frame_scale_sq * 0.35f, frame_time * 2.5f); } break; @@ -2095,7 +2095,7 @@ void FUN_L18_0021eac8(void) { speed_step(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); FUN_L00_00215340(); - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); if (hero.motion.pos.f[2] < hero.unk410) { approach_value(&hero.unk410, hero.motion.pos.f[2], frame_time * 4.0f); @@ -2139,7 +2139,7 @@ void FUN_L18_0021eac8(void) { if (hero.state_timer == scale_game_frames(20)) { FUN_L00_00209ca8(3, 0x10, 1); if (D_L18_001612D0 != 0) { - FUN_L00_002a3ec8(D_L18_001612D0, D_L18_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L18_001612D0, D_L18_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, 0.35f); } } @@ -2189,7 +2189,7 @@ void FUN_L18_0021eac8(void) { qcopy(&v10, &v0); v10.f[0] += fast_cos(hero.motion.rot.f[2]) * 0.85f; v10.f[1] += fast_sin(hero.motion.rot.f[2]) * 0.85f; - if (FUN_001efa68(&v0, &v10, 4, (struct MobyView *)hero.moby, 0) != 0) { + if (collision_line(&v0, &v10, 4, (struct MobyView *)hero.moby, 0) != 0) { hero.unk4A4 = 1; } } @@ -2212,7 +2212,7 @@ void FUN_L18_0021eac8(void) { if (hero.motion.pos.f[2] < hero.unk410) { hero.unk410 = hero.motion.pos.f[2]; } - if (hero.state_timer > hero.unk420 && FUN_L00_00233a78(&hero.motion.velocity) < 0.001f && + if (hero.state_timer > hero.unk420 && gravity_z(&hero.motion.velocity) < 0.001f && (hero.unk41C == 0 || hero.state_timer > hero.unk3D4)) { hero.unk41E = 1; if (hero.unk3F8 != 0.0f) { @@ -2235,7 +2235,7 @@ void FUN_L18_0021eac8(void) { fast_vec_scale(&v10, &hero.motion.displacement, 7.0f); for (i = 0; i < n; i++) { if (FUN_L00_0025e3b8(D_L18_00178900[i]) != 0) { - FUN_L00_00259bc8(D_L18_00178900[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, + spawn_nearby_effect(D_L18_00178900[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, 1.0f); } } @@ -2318,7 +2318,7 @@ void FUN_L18_0021eac8(void) { } case 0x66: subtract_vector_xyz(&v0, &hero.unk1640, &hero.motion.pos); - if (FUN_001f9ab0(&v0, &hero.motion.unk150) < 0.0f) { + if (fast_vec_dot(&v0, &hero.motion.unk150) < 0.0f) { clear_u64_value(&hero.motion.unk150); } clear_u64_value(&hero.motion.velocity); @@ -2408,7 +2408,7 @@ void FUN_L18_0021eac8(void) { for (i = 0; i < 3; i++) { FUN_L00_002335c8(&m40[1], 1.8f, fast_add_rotations(-0.7853982f, (f32)i * 0.7853982f), 1.4f); - FUN_L00_002598b0((struct MobyView *)hero.moby, 2.2f, &m40[1], 0x30000, 40.0f, 1.0f, 0, 1, 0); + play_entity_sound((struct MobyView *)hero.moby, 2.2f, &m40[1], 0x30000, 40.0f, 1.0f, 0, 1, 0); } } switch (hero.attack_record) { @@ -2491,7 +2491,7 @@ void FUN_L18_0021eac8(void) { stick_target(frame_time * 6.0f, 0); qcopy(&v0, &hero.motion.pos); v0.f[2] -= 1.0f; - FUN_L00_002598b0((struct MobyView *)hero.moby, 3.5f, &v0, 0x30000, 40.0f, 1.0f, 0, 1, 0); + play_entity_sound((struct MobyView *)hero.moby, 3.5f, &v0, 0x30000, 40.0f, 1.0f, 0, 1, 0); if (hero.unk1C4 == 0) { FUN_L02_00223450(); } @@ -2509,7 +2509,7 @@ void FUN_L18_0021eac8(void) { d = fast_difference_between_rotations(hero.motion.rot.f[2], hero.motion.move_yaw); for (i = 0; i < 3; i++) { FUN_L00_002335c8(&v0, 1.8f, fast_add_rotations(-0.7853982f, (f32)i * 0.7853982f), 1.4f); - FUN_L00_002598b0((struct MobyView *)hero.moby, 2.7f, &v0, 0x30000, 40.0f, 1.0f, 0, 1, 0); + play_entity_sound((struct MobyView *)hero.moby, 2.7f, &v0, 0x30000, 40.0f, 1.0f, 0, 1, 0); } if (FUN_L00_00211870(30.0f) != 0 || FUN_L00_00211870(0.0f) != 0) { Q.f160 = 0.1f; diff --git a/src/overlays/l18/gameplay/hero/0022e8f8.c b/src/overlays/l18/gameplay/hero/0022e8f8.c index 2e2e98635b..000fd4eb41 100644 --- a/src/overlays/l18/gameplay/hero/0022e8f8.c +++ b/src/overlays/l18/gameplay/hero/0022e8f8.c @@ -59,12 +59,12 @@ extern float D_L18_0015F638; extern float D_L18_001677D8 __attribute__((section(".data"))); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_00208f20(float a, float b, float c, float d); extern float FUN_L00_00232b90(float a, float b, float c); -extern float FUN_L00_00233a78(float *v); +extern float gravity_z(float *v) __asm__("FUN_L00_00233a78"); extern float FUN_L00_00233c30(float *pos, float *vel, int *steps, float step); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float FUN_L00_00259468(float *a, float *b, int *out, float f); @@ -82,7 +82,7 @@ int r1_repeat_timer __asm__("D_L18_0015F678") = 0; extern int D_L18_0015F6DC_d __asm__("D_L18_0015F6DC"); extern int D_L18_0015F594 __attribute__((sda)); extern int D_L18_0016D180 __attribute__((section(".data"))); -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_002050b8(int); #include "rnc/overlay/path.h" @@ -99,7 +99,7 @@ extern int hero_handle_jump_press(void) __asm__("FUN_L00_00229660"); extern int FUN_L00_00229910(void); extern int FUN_L00_00229a98(void); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int FUN_L00_0025d808(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); +extern int sample_path(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); extern int FUN_L00_0025df68(void *, void *, void *, int *, float *, int, float, float, float); extern int pad_pressed_within(int, int, int *) __asm__("FUN_L00_00266d60"); extern int FUN_L00_00266e00(int, int, int, int); @@ -129,7 +129,7 @@ extern void FUN_L00_00232628(void); extern void FUN_L00_00232640(int id); extern void FUN_L00_00233288(float a, float b, short c, unsigned char d, unsigned char e, unsigned char f); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void hud_keep_visible(int, int) __asm__("FUN_L00_00235e18"); extern void FUN_L00_00237ae8(void); extern void FUN_L00_00237ba0(void); @@ -137,7 +137,7 @@ extern void FUN_L00_002382a0(void); extern void FUN_L00_00239cc8(void); extern void FUN_L00_00239d00(void); extern void FUN_L00_00239df8(void); -extern void FUN_L00_002598b0(int, float, void *, int, float, float, int, int, int); +extern void play_entity_sound(int, float, void *, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L01_00227e48(int a0, int a1, int a2); extern void FUN_L01_00242198(void); @@ -912,7 +912,7 @@ void FUN_L18_0022e8f8(void) { } break; case 101: - if (FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { + if (vector_distance(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { if (frame_time * 2.7f > hero.motion.speed_xy) { if (fast_difference_between_rotations( hero.motion.rot.f[2], hero.unk1640.f[3]) < 0.034906585f) { @@ -936,7 +936,7 @@ void FUN_L18_0022e8f8(void) { if ((hero.unkA98 & 2) || hero.unk1650 != 0) { hero_set_state(HERO_STATE_IDLE, 1); } - if (0.2f < FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f)) { + if (0.2f < vector_distance(hero.motion.pos.f, hero.unk1640.f)) { hero_set_state(0x65, 1); } break; @@ -1237,7 +1237,7 @@ void FUN_L18_0022e8f8(void) { v1[1] = fast_sin(hero.unk57C) * 5.0f; v1[2] = 0.0f; add_vector_xyz(v1, v1, v0); - if (FUN_001efa68(v0, v1, 2, 0, 0)) { + if (collision_line(v0, v1, 2, 0, 0)) { ok = 0; } } @@ -1403,7 +1403,7 @@ void FUN_L18_0022e8f8(void) { path_seg = hero.unk564; path_t = hero.unk568; /* Step a copy of the hero position along its current path. */ - if (FUN_L00_0025d808((int *)hero.unk560, v0, &path_seg, + if (sample_path((int *)hero.unk560, v0, &path_seg, &path_t, hero.unk584, d)) { scale_vector_xyz(v1, hero.motion.displacement.f, scale_game_frames(0x30)); @@ -1434,7 +1434,7 @@ void FUN_L18_0022e8f8(void) { } } if (hero.state_timer > hero.unk420) { - if (FUN_L00_00233a78(hero.motion.velocity.f) < 0.001f) { + if (gravity_z(hero.motion.velocity.f) < 0.001f) { hero.unk41E = 1; } } @@ -1669,7 +1669,7 @@ void FUN_L18_0022e8f8(void) { if (hero_set_state(HERO_STATE_IDLE, 0)) { set_hero_animation(0xC, 9, -1.0f); } - FUN_L00_00233b20(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); + gravity_set_z(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); FUN_L00_0025f730(hero.motion.unk150.f, frame_time * 7.0f); hero.unk1C4 = scale_game_frames(7); if (hero.state.prev == 0x2D) { @@ -2178,7 +2178,7 @@ void FUN_L18_0022e8f8(void) { scale_game_frames(0xE) < hero.state_timer && (hero.unk41E == 0 || (hero.ground_distance > 0.7f && - absolute_float(FUN_L00_00233a78(hero.motion.velocity.f)) < + absolute_float(gravity_z(hero.motion.velocity.f)) < frame_time * 5.8f))) { hero_set_state(0xE, 1); } else if (D_0013D4C0[2] != 0 && hero_slot_item_id(3) != 4 && @@ -2271,7 +2271,7 @@ void FUN_L18_0022e8f8(void) { if (hero.unk41E != 0) { qcopy(v0, hero.motion.pos.f); v0[2] -= 1.0f; - FUN_L00_002598b0((int)((unsigned char *)hero.moby), 3.5f, v0, 0x30000, 40.0f, 1.0f, 0, + play_entity_sound((int)((unsigned char *)hero.moby), 3.5f, v0, 0x30000, 40.0f, 1.0f, 0, 1, 0); } if (!(hero.state_timer > hero.unk420)) { @@ -2355,7 +2355,7 @@ void FUN_L18_0022e8f8(void) { if (hero.unk41E != 0) { qcopy(v0, hero.motion.pos.f); v0[2] -= 1.0f; - FUN_L00_002598b0((int)((unsigned char *)hero.moby), 3.5f, v0, 0x30000, 1.0f, 1.0f, 0, 1, + play_entity_sound((int)((unsigned char *)hero.moby), 3.5f, v0, 0x30000, 1.0f, 1.0f, 0, 1, 0); } if (hero.air_frames.s != 0) { diff --git a/src/overlays/l18/gameplay/hero/hero_set_state.c b/src/overlays/l18/gameplay/hero/hero_set_state.c index ce054c1e11..beb2e52f0d 100644 --- a/src/overlays/l18/gameplay/hero/hero_set_state.c +++ b/src/overlays/l18/gameplay/hero/hero_set_state.c @@ -28,10 +28,10 @@ extern char *hero_slot_moby(int) __asm__("FUN_L00_0020d460"); extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L18_0017C7F0[][25]; extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_0020d658(int back); -extern float FUN_L00_002339d0(float *v); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float dot_vectors_xyz(void *a, void *b); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); @@ -46,7 +46,7 @@ extern int FUN_L00_00216de8(int, int); extern int stick_direction_vs_facing(void) __asm__("FUN_L00_00221df8"); extern int FUN_L00_00229a98(void); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int FUN_L00_0025d808(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); +extern int sample_path(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); extern int FUN_L06_0021d0a0(int a); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); @@ -70,12 +70,12 @@ extern void FUN_L00_00216ec0(int, int, int); extern void FUN_L00_00217450(void); extern void set_hero_animation(int, int, float) __asm__("FUN_L00_002323b8"); extern void FUN_L00_002325e0(int bank, int seq); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L00_00262500(int a, char *b); extern void FUN_L00_00262528(char *o, int a, int b); extern void FUN_L00_00262840(char *o); -extern void FUN_L00_002a3ec8(void *, int, int, float, float, float, float); +extern void pool_splash(void *, int, int, float, float, float, float) __asm__("FUN_L00_002a3ec8"); extern void FUN_L15_0021ab60(void); extern void fill_transfer_words(void *, int, int) __asm__("func_001F97E8"); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); @@ -274,7 +274,7 @@ int hero_set_state(int a, int b) { if (p->state.prev_control_mode == 0x11) { FUN_L00_00209ca8(3, 0xA, 0); if (D_L18_001612D0 != 0) { - FUN_L00_002a3ec8(D_L18_001612D0, D_L18_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L18_001612D0, D_L18_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.4f, 0.3f); } } else if (p->motion.displacement.f[2] < frame_time * -0.5f) { @@ -284,7 +284,7 @@ int hero_set_state(int a, int b) { v = 0x28; FUN_L00_00209ca8(3, v, 1); if (D_L18_001612D0 != 0) { - FUN_L00_002a3ec8(D_L18_001612D0, D_L18_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L18_001612D0, D_L18_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.5f, -0.4f); } p->unk90A = scale_game_frames(0x4B); @@ -638,7 +638,7 @@ int hero_set_state(int a, int b) { char *v = (char *)&p->motion.unk110; p->state.control_mode = 1; p->unk2284 = 0; - p->ground_speed = FUN_L00_002339d0((float *)v); + p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.unk150, v); if (b) { int id = 6; @@ -694,7 +694,7 @@ int hero_set_state(int a, int b) { *(unsigned int *)(h + 0x64) | (1 << current_level_index) | 0x80000000; } p->motion.move_yaw = - FUN_001f9e90(*(float *)(((char *)p->unk964) + 0x10) - p->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)p->unk964) + 0x10) - p->motion.pos.f[0], *(float *)(((char *)p->unk964) + 0x14) - p->motion.pos.f[1]); if (b) { set_hero_animation(0x2F, 2, (float)scale_game_frames(5)); @@ -770,7 +770,7 @@ int hero_set_state(int a, int b) { if (*(float *)(d + 0x2C) != 0.0f) q->unk9CC = *(float *)(d + 0x2C); q->unk9AC = - FUN_001f9e90(*(float *)(((char *)q->unk994) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unk994) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unk994) + 0x14) - q->motion.pos.f[1]); q->unk9A4 = FUN_001f9b48(&q->motion.pos, ((char *)q->unk994) + 0x10); q->unk9B0 = frame_time_sq * 27.0f; @@ -834,7 +834,7 @@ int hero_set_state(int a, int b) { p->unk5C0 = 0; seg = p->unk564; t = p->unk568; - FUN_L00_0025d808(*(int **)&p->unk560, pos, &seg, &t, p->unk584, 1.0f); + sample_path(*(int **)&p->unk560, pos, &seg, &t, p->unk584, 1.0f); subtract_vector_xyz(vec, pos, &p->motion.pos); if (0.001f < vector_length_xyz(vec)) { normalize_vector_xyz(vec, vec, 1.0f); @@ -846,11 +846,11 @@ int hero_set_state(int a, int b) { struct Hero *q = &hero; if (((char *)q->unk5D8) != 0) { float ang = - FUN_001f9e90(*(float *)(((char *)q->unk5D8) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unk5D8) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unk5D8) + 0x14) - q->motion.pos.f[1]); if (1.5707964f < fast_difference_between_rotations( ang, fast_add_rotations(q->unk588, - FUN_001f9e90(vec[0], vec[1])))) { + fast_arc_tan(vec[0], vec[1])))) { q->unk588 = 1.5707964f; q->unk58C = 1; } @@ -1088,7 +1088,7 @@ int hero_set_state(int a, int b) { u->unk48C = 1.98f; u->unk430 = 1.95f; } else { - FUN_L00_00233b20((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); + gravity_set_z((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); u->unk41C = 1; u->unk3D0 = scale_game_frames(2); u->unk3D4 = scale_game_frames(0x23) + u->unk3D0; @@ -1383,7 +1383,7 @@ int hero_set_state(int a, int b) { if (1.5707964f < fast_difference_between_rotations( q->motion.rot.f[2], - FUN_001f9e90(q->unk500.f[0] - q->unk540.f[0], + fast_arc_tan(q->unk500.f[0] - q->unk540.f[0], q->unk500.f[1] - q->unk540.f[1]))) id = 0x1F; set_hero_animation(id, 0, (float)scale_game_frames(5)); @@ -1596,7 +1596,7 @@ int hero_set_state(int a, int b) { if (q->items[0].item_id == 0xA && ((char *)q->unkA50) != 0) { q->unkA58 = 1; q->unkA5C = - FUN_001f9e90(*(float *)(((char *)q->unkA50) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unkA50) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unkA50) + 0x14) - q->motion.pos.f[1]); } break; diff --git a/src/overlays/l18/world/loaders/002463f8.c b/src/overlays/l18/world/loaders/002463f8.c index da848d38d7..478b54d2f8 100644 --- a/src/overlays/l18/world/loaders/002463f8.c +++ b/src/overlays/l18/world/loaders/002463f8.c @@ -488,3 +488,4 @@ extern void FUN_L02_002a4058_u(char *arg, int val) __asm__("FUN_L01_0026e0e0"); void FUN_L18_002e9e50(char *arg) { FUN_L02_002a4058_u(arg, 0x2); } + diff --git a/src/overlays/shared/audio/music/0027a248.c b/src/overlays/shared/audio/music/0027a248.c index 74856680f8..47170f2f4c 100644 --- a/src/overlays/shared/audio/music/0027a248.c +++ b/src/overlays/shared/audio/music/0027a248.c @@ -5,7 +5,8 @@ #include "rnc/audio/music/music_stream_state.h" /* requests a music track: plays it now when nothing is streaming, else queues it */ -void FUN_L01_0027a248(s32 track, s32 transition) { +void jet_game_state(s32 track, s32 transition) __asm__("FUN_L01_0027a248"); +void jet_game_state(s32 track, s32 transition) { if (music_stream_state.primary.track == track && music_stream_state.requested_track == -1) return; if (music_stream_state.primary.state == 0 && music_stream_state.transition.state == 0) { diff --git a/src/overlays/shared/audio/sound/0028dc90.c b/src/overlays/shared/audio/sound/0028dc90.c index 13ea2e11ae..7fa134ff50 100644 --- a/src/overlays/shared/audio/sound/0028dc90.c +++ b/src/overlays/shared/audio/sound/0028dc90.c @@ -12,7 +12,8 @@ extern int allocate_voice_slot(void *, int, int, int, int) __asm__("FUN_0022d7f0"); -int FUN_L00_0028dc90(int i, int a1, int v, int k) { +int trooper_play_sound(int i, int a1, int v, int k) __asm__("FUN_L00_0028dc90"); +int trooper_play_sound(int i, int a1, int v, int k) { char *t = D_L00_00197300[class_slot[k]]; char *e; int r; diff --git a/src/overlays/shared/audio/sound/0028e180.c b/src/overlays/shared/audio/sound/0028e180.c index dabd056fb5..8c493485cd 100644 --- a/src/overlays/shared/audio/sound/0028e180.c +++ b/src/overlays/shared/audio/sound/0028e180.c @@ -10,7 +10,7 @@ extern char D_L00_00166DC0[]; extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_cos(float) __asm__("func_001F9DC8"); extern int D_L00_0015F5C4; extern char D_L00_001BD880[]; @@ -20,7 +20,7 @@ extern unsigned char D_0013CAE4[]; extern unsigned char D_0013D388[]; extern unsigned char D_0013DD4B[]; extern void render_environment_mapped_object(void) __asm__("FUN_002327a0"); -extern void FUN_L00_00298840(int); +extern void start_scene(int) __asm__("FUN_L00_00298840"); extern void FUN_L00_00299460(int); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void draw_light_flare() __asm__("func_0022DF40"); @@ -49,7 +49,7 @@ void FUN_L00_0028e180(unsigned char *m) { *(int *)(m + 0x90) = v | (v << 8) | (v << 16); } enqueue_callback_list_1_alt(render_environment_mapped_object, m); - if (FUN_001f9b80(m + 0x10, D_L00_00166DC0) < 32.0f) { + if (vector_distance(m + 0x10, D_L00_00166DC0) < 32.0f) { enqueue_callback_list_1_alt(draw_light_flare, m); } } @@ -62,7 +62,7 @@ void FUN_L00_0028e180(unsigned char *m) { } } else { q = (unsigned char *)(&hero.motion.pos); - if (FUN_001f9b80(p, q) < 6.0f) { + if (vector_distance(p, q) < 6.0f) { transform_vector_by_basis(tmp, D_L00_001BD880 + ship_index[0] * 16, m + 0xC0); add_vector_xyz(tmp, tmp, p); if (FUN_001f9b48(tmp, q) < 4.0f) { @@ -79,7 +79,7 @@ void FUN_L00_0028e180(unsigned char *m) { if (current_level_index == 10 && hero.vehicle_mode == 1) { m[0x20] = 0x2A; *(unsigned short *)(m + 0x34) |= 0x41; - FUN_L00_00298840(9); + start_scene(9); } else { FUN_L00_002644e0(2); D_L00_0015F630 = 1; @@ -91,16 +91,16 @@ void FUN_L00_0028e180(unsigned char *m) { if (D_L00_0015F5C4 != 2) { q = D_0013D388; if (q[0x48] == 0 && D_0013D4DC[0] != 0) { - FUN_L00_00298840(4); + start_scene(4); q[0x48] = 1; } else if ((q = D_0013D388)[0x49] == 0 && D_0013DD4B[0] != 0) { - FUN_L00_00298840(5); + start_scene(5); q[0x49] = 1; } else if ((q = D_0013D388)[0x4A] == 0 && D_0013DD4B[0] != 0) { FUN_L00_00299460(0xB); q[0x4A] = 1; } else if ((q = D_0013D388)[0x4B] == 0 && D_0013DD4B[0] != 0) { - FUN_L00_00298840(6); + start_scene(6); q[0x4B] = 1; } else { m[0x20] = 0; diff --git a/src/overlays/shared/audio/streaming/00266298.c b/src/overlays/shared/audio/streaming/00266298.c index cd1ecd771c..9235bc74ff 100644 --- a/src/overlays/shared/audio/streaming/00266298.c +++ b/src/overlays/shared/audio/streaming/00266298.c @@ -72,14 +72,15 @@ extern void start_scene(s32) __asm__("FUN_L00_00298840"); extern s32 hud_keep_visible(s32, s32) __asm__("FUN_L00_00235e18"); extern s32 queue_animation_update(s32, s32, void *, void *, void *, void *, s32) __asm__("FUN_001ff308"); extern void FUN_L00_00237190(void); -extern void FUN_L00_002371e0(void); +extern void mine_blend_color(void) __asm__("FUN_L00_002371e0"); extern void FUN_L00_00237200(void); extern void FUN_L00_00239cc8(void); extern void FUN_L00_00239d00(void); extern void FUN_L00_00239df8(void); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); -s32 FUN_L00_00266448(struct Moby *moby, struct SceneTrigger *trigger) +s32 update_npc_dialogue(struct Moby *moby, struct SceneTrigger *trigger) __asm__("FUN_L00_00266448"); +s32 update_npc_dialogue(struct Moby *moby, struct SceneTrigger *trigger) { struct Hero *h = &hero; struct SceneEntry *entry; @@ -154,7 +155,7 @@ s32 FUN_L00_00266448(struct Moby *moby, struct SceneTrigger *trigger) } if (hud_keep_visible(bolt_hud_item, 10)) { - bolt_hud_item = queue_animation_update(12, 0, FUN_L00_00237190, FUN_L00_002371e0, + bolt_hud_item = queue_animation_update(12, 0, FUN_L00_00237190, mine_blend_color, FUN_L00_00237200, 0, 0); } { @@ -172,7 +173,8 @@ s32 FUN_L00_00266448(struct Moby *moby, struct SceneTrigger *trigger) extern s32 D_0015ED84[]; extern s32 D_L00_001791B8[] __attribute__((section(".data"))); extern s32 D_L00_001C44B8[] __attribute__((section(".data"))); -s32 FUN_L00_002667d0(void *p) { +s32 get_dialogue_entry(void *p) __asm__("FUN_L00_002667d0"); +s32 get_dialogue_entry(void *p) { s32 n = D_0015ED84[0]; s32 lo; s32 hi; @@ -194,7 +196,7 @@ typedef struct { } E00266858; extern E00266858 D_0013D5B0[]; s32 FUN_L00_002667d0_u(s32, s32) __asm__("FUN_L00_002667d0"); -/* Stores b in the entry FUN_L00_002667d0 finds, if it finds one. */ +/* Stores b in the entry get_dialogue_entry finds, if it finds one. */ void FUN_L00_00266858(s32 a, s32 b) { s32 i = FUN_L00_002667d0_u(a, b); if (i != -1) @@ -229,7 +231,8 @@ extern E002668a0 D_0013D5B0_c[] __asm__("D_0013D5B0"); extern P002668a0 *D_L00_001B1678[]; extern s32 D_L00_0015F5CC; extern s32 FUN_L00_002667d0_c(void *) __asm__("FUN_L00_002667d0"); -s32 FUN_L00_002668a0(void *p, u8 *out_p) { +s32 initialize_npc_dialogue(void *p, u8 *out_p) __asm__("FUN_L00_002668a0"); +s32 initialize_npc_dialogue(void *p, u8 *out_p) { Out002668a0 *out; s32 i; unsigned long long k; @@ -255,3 +258,13 @@ s32 FUN_L00_002668a0(void *p, u8 *out_p) { out->f08 = ((u8 *)out->f3C)[out->f36 * 0x1C + (k = 0x10)] & 1; return i; } + +s32 D_L01_00179590[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_00179710[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_00179510[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_00179910[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_00179B10[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_00179590[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_00179810[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_00179710[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_00179510[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/audio/voices/00276368.c b/src/overlays/shared/audio/voices/00276368.c index 858f9c0e6b..97650cf537 100644 --- a/src/overlays/shared/audio/voices/00276368.c +++ b/src/overlays/shared/audio/voices/00276368.c @@ -440,7 +440,7 @@ extern void FUN_L00_00276368(void); extern void FUN_L00_00276908(void); extern void FUN_L00_002831c0(void); extern void FUN_L00_0028ed58(s32); -extern void FUN_L00_00298840(void *); +extern void start_scene(void *) __asm__("FUN_L00_00298840"); extern void FUN_L00_00299460(void *); extern void FUN_L00_002994f8(void *); extern void FUN_L00_00299560(void *); @@ -524,7 +524,7 @@ void FUN_L00_00276bd0(void) { D_L00_001B9CF0.unk130 = tmp; fade_to_black(scale_game_frames(0x10)); D_L00_0015F5C4 = 0; - FUN_L00_00298840(D_L00_001B9CF0.unkE4); + start_scene(D_L00_001B9CF0.unkE4); } else if (D_L00_001B9CF0.unkC == 7) { tmp = decode_mode; D_L00_001B9CF0.unk130 = tmp; @@ -874,3 +874,50 @@ int FUN_L00_002779c8(int x) { return 0; } +s32 D_L01_001BA248[1] __attribute__((section(".data"))) = {0}; +f32 D_L01_001BA258[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001BA310[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001BA3C8[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_001BA3D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001BA490[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B9EC8[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_001B9ED8[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B9F90[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B9F48[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_001B9F58[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001BA010[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001BA248[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_001BA258[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001BA310[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001BA548[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_001BA558[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001BA610[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B9E48[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_001B9E58[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B9F10[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001BA5C8[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_001BA5D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001BA690[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B9F48[1] __attribute__((section(".data"))) = {0}; +f32 D_L09_001B9F58[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001BA010[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001BA248[1] __attribute__((section(".data"))) = {0}; +f32 D_L10_001BA258[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001BA310[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001BA248[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_001BA258[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001BA310[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001BA0C8[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_001BA0D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001BA190[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001BA4C8[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_001BA4D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001BA590[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001BA3C8[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_001BA3D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001BA490[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001BA248[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_001BA258[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001BA310[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001BA6C8[1] __attribute__((section(".data"))) = {0}; +f32 D_L17_001BA6D8[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/audio/voices/0028d8c0.c b/src/overlays/shared/audio/voices/0028d8c0.c index f54349f71e..478cde107a 100644 --- a/src/overlays/shared/audio/voices/0028d8c0.c +++ b/src/overlays/shared/audio/voices/0028d8c0.c @@ -10,7 +10,8 @@ /* Ported from rac1-decomp (src/overlays/shared/sound_0028EB98.c: func_L00_0028EB98), where it is exact; names translated to the US level program. */ /* True when entry i (0x70 bytes) holds a at 0x88 and its byte at 0x74 is 1 or 2. */ -int FUN_L00_0028d8c0(int a, int i) { +int voice_is_playing(int a, int i) __asm__("FUN_L00_0028d8c0"); +int voice_is_playing(int a, int i) { if (i >= 0) { char *p = D_0013E533 + 0x1D + i * 0x70; if (*(int *)(p + 0x88) == a) { diff --git a/src/overlays/shared/audio/voices/0028ddd8.c b/src/overlays/shared/audio/voices/0028ddd8.c index 146f64dee5..a51bb004c6 100644 --- a/src/overlays/shared/audio/voices/0028ddd8.c +++ b/src/overlays/shared/audio/voices/0028ddd8.c @@ -13,7 +13,8 @@ extern int allocate_voice_slot(void *, int, int, int, int) __asm__("FUN_0022d7f0"); -int FUN_L00_0028ddd8(int a, int b, int c, int d) { +int play_voice(int a, int b, int c, int d) __asm__("FUN_L00_0028ddd8"); +int play_voice(int a, int b, int c, int d) { int r; if (a >= D_L00_0015F5F0) return -1; @@ -58,7 +59,8 @@ typedef struct { } E0028df38; extern E0028df38 D_0013E550[]; /* Sets word 0x21 of voice entry i to v; returns 1. */ -s32 FUN_L00_0028df38(s32 i, s32 v) { +s32 engine_voice_set_pitch(s32 i, s32 v) __asm__("FUN_L00_0028df38"); +s32 engine_voice_set_pitch(s32 i, s32 v) { E0028df38 *p = &D_0013E550[i]; p->w[0x21] = v; return 1; diff --git a/src/overlays/shared/audio/voices/002a1968.c b/src/overlays/shared/audio/voices/002a1968.c index 35ea0280a7..bf5a060f6e 100644 --- a/src/overlays/shared/audio/voices/002a1968.c +++ b/src/overlays/shared/audio/voices/002a1968.c @@ -7,7 +7,8 @@ typedef struct { } E002a1968; extern E002a1968 D_0013E550[]; /* Sets word 0x20 of voice entry i to v; returns 1. */ -s32 FUN_L01_002a1968(s32 i, s32 v) { +s32 vendor_volume(s32 i, s32 v) __asm__("FUN_L01_002a1968"); +s32 vendor_volume(s32 i, s32 v) { E002a1968 *p = &D_0013E550[i]; p->w[0x20] = v; return 1; diff --git a/src/overlays/shared/gameplay/camera/00262cf0.c b/src/overlays/shared/gameplay/camera/00262cf0.c index 95c3d8d350..a3e0c80afe 100644 --- a/src/overlays/shared/gameplay/camera/00262cf0.c +++ b/src/overlays/shared/gameplay/camera/00262cf0.c @@ -4,6 +4,7 @@ void build_spherical_offset(void *) __asm__("FUN_00214db0"); void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); +void FUN_L00_00262cf0(void *a, void *b); void FUN_L00_00262cf0(void *a, void *b) { char buf[16]; build_spherical_offset(buf); diff --git a/src/overlays/shared/gameplay/camera/follow_camera_setup.c b/src/overlays/shared/gameplay/camera/follow_camera_setup.c index 8346334c92..97461a927e 100644 --- a/src/overlays/shared/gameplay/camera/follow_camera_setup.c +++ b/src/overlays/shared/gameplay/camera/follow_camera_setup.c @@ -126,10 +126,10 @@ extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern f32 FUN_001f99c0(f32); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); -extern f32 FUN_001fa6c0(s32); -extern s32 FUN_001f96f8(s32); +extern f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); -extern u8 *FUN_002141f8(s32); +extern u8 *suck_get_aim_height(s32) __asm__("FUN_002141f8"); extern s32 collect_mobies_in_sphere(void *, s32, s32, s32, f32) __asm__("FUN_L00_001f2868"); extern void FUN_L00_002e8918(f32 *, f32, f32); extern void FUN_L00_002e8970(void *, f32, f32); @@ -139,7 +139,7 @@ extern void follow_camera_set_height(f32, f32) __asm__("FUN_L00_002e84b8"); extern void follow_camera_set_distance(s32, f32, f32) __asm__("FUN_L00_002e8450"); extern void follow_camera_set_offset_scale(s32, f32, f32) __asm__("FUN_L00_002e84f0"); extern void FUN_L00_002e8568(s32); -extern void FUN_L00_002e8590(f32, f32); +extern void follow_camera_set_lateral_spring(f32, f32) __asm__("FUN_L00_002e8590"); /* Per-frame follow camera adjustments driven by the hero's state: sway, zoom and lookat tweaks, then the shake timers in m->h12/h14/h16. */ void follow_camera_apply_overrides(O_2e6000 *o) __asm__("FUN_L00_002e6000"); @@ -210,7 +210,7 @@ void follow_camera_apply_overrides(O_2e6000 *o) { if (hero.unk20AA != 0 && hero.state.control_mode != 0xF) { FUN_L00_002e8568(0); follow_camera_start_slide(); - FUN_L00_002e8590(0.04f, 0.2f); + follow_camera_set_lateral_spring(0.04f, 0.2f); } x = &player_camera[1]; if (x->fn != 0) x->fn(); @@ -224,8 +224,8 @@ void follow_camera_apply_overrides(O_2e6000 *o) { } x = &player_camera[0]; x->i260++; - if (FUN_001f96f8(400) < x->i260) x->i260 = FUN_001f96f8(400); - f = FUN_001fa6c0(x->i260) / FUN_001fa6c0(FUN_001f96f8(400)); + if (scale_game_frames(400) < x->i260) x->i260 = scale_game_frames(400); + f = convert_integer_to_float(x->i260) / convert_integer_to_float(scale_game_frames(400)); FUN_L00_002e8970(x->p25C + 0x10, f * 0.20943952f, 0.0f); } } @@ -234,7 +234,7 @@ void follow_camera_apply_overrides(O_2e6000 *o) { if (n > 0) { lp = D_L00_00177F00; for (i = 0; i < n; lp++, i++) { - e = FUN_002141f8(*lp); + e = suck_get_aim_height(*lp); if (e != 0 && (f32)e[0xD] != 0.0f) { s->i10 = 1; break; @@ -244,7 +244,7 @@ void follow_camera_apply_overrides(O_2e6000 *o) { if (hero.state.current == 0x81 && (D_0013CAE0[0] & 3)) { FUN_L00_002e8568(0); follow_camera_start_slide(); - FUN_L00_002e8590(0.04f, 0.2f); + follow_camera_set_lateral_spring(0.04f, 0.2f); { M_2e6000 *mm = o->m; mm->h16 = 0; mm->h12 = 0; @@ -271,18 +271,18 @@ void follow_camera_apply_overrides(O_2e6000 *o) { { f32 c = sum * 5.0f; if (1.0f < c) c = 1.0f; c = 1.0f - c; - if (c < D_L00_00161D84) m->h12 = FUN_001f96f8(0x20); } + if (c < D_L00_00161D84) m->h12 = scale_game_frames(0x20); } if (m->h12 != 0) { - if (fast_dec_timer_s16(&m->h12)) m->h14 = FUN_001f96f8(0x2D); + if (fast_dec_timer_s16(&m->h12)) m->h14 = scale_game_frames(0x2D); follow_camera_start_slide(); k = ++m->h16; - if (FUN_001f96f8(0x1E) < k) m->h16 = FUN_001f96f8(0x1E); - f = FUN_001fa6c0(m->h16) / FUN_001fa6c0(FUN_001f96f8(0x1E)); - FUN_L00_002e8590((D_L00_00161D88 - 0.015f) * f + 0.015f, 0.2f); + if (scale_game_frames(0x1E) < k) m->h16 = scale_game_frames(0x1E); + f = convert_integer_to_float(m->h16) / convert_integer_to_float(scale_game_frames(0x1E)); + follow_camera_set_lateral_spring((D_L00_00161D88 - 0.015f) * f + 0.015f, 0.2f); D_L00_0015EF40 = 0.0f; } else if (m->h14 != 0) { fast_dec_timer_s16(&m->h14); - f = FUN_001fa6c0(m->h14) / FUN_001fa6c0(FUN_001f96f8(0x2D)); + f = convert_integer_to_float(m->h14) / convert_integer_to_float(scale_game_frames(0x2D)); f *= -0.75f; f += 0.75f; D_L00_0015EF40 = f; @@ -959,7 +959,7 @@ extern void clear_u64_value_2e7618(void *) __asm__("FUN_001f99f8"); extern void add_vector_xyz_2e7618(void *, void *, void *) __asm__("FUN_001f9a10"); extern void subtract_vector_xyz_2e7618(void *, void *, void *) __asm__("FUN_001f9a28"); extern float distance_xyz(void *, void *) __asm__("FUN_001f9b48"); -extern float resolve_level_path_segment_point_2e7618(V002e7530 *, V002e7530 *, V002e7530 *, V002e7530 *, float) __asm__("FUN_L00_0025dcd8"); +extern float FUN_L00_0025dcd8(V002e7530 *, V002e7530 *, V002e7530 *, V002e7530 *, float); extern int coll_sphere_2e7618(void *, int, int, float) __asm__("FUN_L00_001f0d60"); int FUN_L00_002e7618(O002e7530 *o, V002e7530 *out, int step, float dist, float spd) { @@ -984,7 +984,7 @@ int FUN_L00_002e7618(O002e7530 *o, V002e7530 *out, int step, float dist, float s qcopy(&near, &D_L00_00173E70); path = (V002e7530 *)(m + 0x90); add_vector_xyz_2e7618(&pos, path, orbit); - measure = resolve_level_path_segment_point_2e7618(&temp, &hit, path, &pos, 0.0f); + measure = FUN_L00_0025dcd8(&temp, &hit, path, &pos, 0.0f); radius = distance_xyz(path, &temp) / (*(float *)((u8 *)orbit + 0x2c) - *(float *)(range + 0x30)); radius = (follow_cam_min_distance_gp + (lim - follow_cam_min_distance_gp) * radius) * 0.75f; @@ -995,7 +995,7 @@ int FUN_L00_002e7618(O002e7530 *o, V002e7530 *out, int step, float dist, float s if (coll_sphere_2e7618(out, D_L00_0015EF5C, D_0013F350_2e7618.value, spd)) { subtract_vector_xyz_2e7618(&diff, &start, out); add_vector_xyz_2e7618(&hit, &D_L00_00173E60, &diff); - measure = resolve_level_path_segment_point_2e7618(&temp, &hit, path, &pos, 0.0f); + measure = FUN_L00_0025dcd8(&temp, &hit, path, &pos, 0.0f); radius = distance_xyz(path, &temp) / (*(float *)((u8 *)orbit + 0x2c) - *(float *)(range + 0x30)); radius = (follow_cam_min_distance_gp + (lim - follow_cam_min_distance_gp) * radius) * 0.75f; @@ -1006,7 +1006,7 @@ int FUN_L00_002e7618(O002e7530 *o, V002e7530 *out, int step, float dist, float s if (coll_sphere_2e7618(out, D_L00_0015EF5C, D_0013F350_2e7618.value, spd)) { subtract_vector_xyz_2e7618(&diff, &start, out); add_vector_xyz_2e7618(&hit, &D_L00_00173E60, &diff); - measure = resolve_level_path_segment_point_2e7618(&temp, &hit, path, &pos, 0.0f); + measure = FUN_L00_0025dcd8(&temp, &hit, path, &pos, 0.0f); radius = distance_xyz(path, &temp) / (*(float *)((u8 *)orbit + 0x2c) - *(float *)(range + 0x30)); radius = (follow_cam_min_distance_gp + (lim - follow_cam_min_distance_gp) * radius) * 0.75f; @@ -1030,8 +1030,8 @@ int FUN_L00_002e7618(O002e7530 *o, V002e7530 *out, int step, float dist, float s /* Ported from rac1-decomp (src/overlays/shared/vendor_002E1660.c: func_L00_002E8E78), where it is exact; names translated to the US level program. */ extern V D_L00_00173E60; -extern float FUN_001f9ab0(void *, void *); -extern void FUN_001f9a28(float *, float *, float *); +extern float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); +extern void fast_vec_sub(float *, float *, float *) __asm__("FUN_001f9a28"); /* For arg1 1: true when (D_L00_00173E60 - arg2) points against the object's +0x130 vector. */ int FUN_L00_002e79c8(void *arg0, int arg1, float *arg2) { @@ -1040,8 +1040,8 @@ int FUN_L00_002e79c8(void *arg0, int arg1, float *arg2) { if (arg1 == 1) { ptr2 = *(char **)((char *)arg0 + 0x70) + 0x130; - FUN_001f9a28(diff, D_L00_00173E60, arg2); - if (FUN_001f9ab0(diff, ptr2) < 0.0f) { + fast_vec_sub(diff, D_L00_00173E60, arg2); + if (fast_vec_dot(diff, ptr2) < 0.0f) { return 1; } } diff --git a/src/overlays/shared/gameplay/camera/follow_camera_update.c b/src/overlays/shared/gameplay/camera/follow_camera_update.c index 9bfba3bd99..d090572cb2 100644 --- a/src/overlays/shared/gameplay/camera/follow_camera_update.c +++ b/src/overlays/shared/gameplay/camera/follow_camera_update.c @@ -203,15 +203,15 @@ void follow_camera_pull_back(char *o, float *x, float *y) { /* Ported from rac1-decomp (src/overlays/shared/vendor_002E1660.c: func_L00_002EABD0), where it is exact; names translated to the US level program. */ extern char D_L00_00166E10[]; -extern float FUN_001f9ab0(void *, void *); -extern float FUN_001f9af0(void *); +extern float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern float fast_arc_sin(float) __asm__("FUN_001f9df8"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); -extern float FUN_L00_001eb328(void *, float, float, float, float, float); +extern float rope_spring_turn(void *, float, float, float, float, float) __asm__("FUN_L00_001eb328"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void subtract_vector_xyz(float *, float *, float *) __asm__("FUN_001f9a28"); -extern void FUN_001f9a68(void *, void *, float); -extern void FUN_001f9bf8(void *, void *, float); +extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); +extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void FUN_L00_002e9518_c(char *, float *, float *) __asm__("FUN_L00_002e9518"); extern void build_look_at_matrix(void *dst, void *vec, void *axis, float angle) __asm__("FUN_00214890"); @@ -249,37 +249,37 @@ void follow_camera_orbit(int arg) { add_vector_xyz(d, d + 0x90, p130); x = *(float *)(p130 + 0x2C); x -= *(float *)(p1d0 + 0x30); - bc = FUN_001f9af0(p140); + bc = fast_vec_length(p140); FUN_L00_002e9518_c(m, &tb[0], &tb[1]); bc = cam_interp_values(d + 0x158, bc, x, tb[0], tb[1], 0.0f); - e1 = FUN_001f9ab0(p130, up); + e1 = fast_vec_dot(p130, up); y = fast_arc_sin(e1 / x); - h = FUN_001f9ab0(p140, up); + h = fast_vec_dot(p140, up); r = fast_arc_sin(h / bc); - i = FUN_L00_001eb328(d + 0x154, r, y, *(float *)&D_L00_00161CFC, *(float *)&D_L00_00161D00, + i = rope_spring_turn(d + 0x154, r, y, *(float *)&D_L00_00161CFC, *(float *)&D_L00_00161D00, 0.0f); - FUN_001f9a68(t0, up, e1); + fast_vec_scale(t0, up, e1); subtract_vector_xyz(t1, p130, t0); - FUN_001f9a68(t2, up, h); + fast_vec_scale(t2, up, h); subtract_vector_xyz(t3, p140, t2); - e = FUN_001f9ab0(t1, t3); - x = FUN_001f9af0(t1); - x = x * FUN_001f9af0(t3); + e = fast_vec_dot(t1, t3); + x = fast_vec_length(t1); + x = x * fast_vec_length(t3); r = 1.5707964f - fast_arc_sin(e / x); - x = FUN_L00_001eb328(d + 0x150, 0.0f, r, *(float *)&D_L00_00161CF4, + x = rope_spring_turn(d + 0x150, 0.0f, r, *(float *)&D_L00_00161CF4, *(float *)&D_L00_00161CF8, 0.0f); fast_vec_cross(t4, t3, up); - s = (FUN_001f9ab0(t4, t1) >= 0.0f) ? 1.0f : -1.0f; + s = (fast_vec_dot(t4, t1) >= 0.0f) ? 1.0f : -1.0f; base2 = D_L00_00166E10; fw = base2 + 0x30; build_look_at_matrix(t5, t3, up, x * s); fast_vec_cross(t4, up, t5); build_look_at_matrix(t5, t5, t4, i); - FUN_001f9bf8(p140, t5, bc); - FUN_001f9a68(t6, up, *(float *)(p130 + 0x30)); + fast_vec_normalize(p140, t5, bc); + fast_vec_scale(t6, up, *(float *)(p130 + 0x30)); add_vector_xyz(t7, t6, d + 0xA0); - e = FUN_001f9ab0(p140, fw); - len = FUN_001f9af0(p140); + e = fast_vec_dot(p140, fw); + len = fast_vec_length(p140); if (len != 0.0f) { x = 1.5707964f - fast_arc_sin(e / len); if (absolute_float(x) < 0.2617994f) { @@ -468,15 +468,15 @@ extern float D_L00_00161DCC __attribute__((sda)); extern float D_L00_00161DD0 __attribute__((sda)); void FUN_L00_002e9cc0_c(void *) __asm__("FUN_L00_002e9cc0"); void FUN_001f9bf8_c(void *, void *, float) __asm__("FUN_001f9bf8"); -void FUN_001f9ad8(void *, void *, void *); +void fast_vec_cross(void *, void *, void *) __asm__("FUN_001f9ad8"); void FUN_001f9a10_c(void *, void *, void *) __asm__("FUN_001f9a10"); -float FUN_001fa6c0(int); +float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); float FUN_001f99c0(float); float FUN_001ebd78(float, float, float, float, float, float *); void build_look_at_matrix(void *, void *, void *, float) __asm__("FUN_00214890"); float FUN_001fa580_c(float, float) __asm__("FUN_001fa580"); float FUN_001fa5c8_c(float, float) __asm__("FUN_001fa5c8"); -int FUN_L00_001f0d60(void *, int, void *, float); +int coll_sphere(void *, int, void *, float) __asm__("FUN_L00_001f0d60"); void FUN_L00_002e9f38(u8 *o) { V up; V side; @@ -492,9 +492,9 @@ void FUN_L00_002e9f38(u8 *o) { if (t == 0.0f) t = -D_0013C940.f100; if (t == 0.0f) - t = FUN_001fa6c0((D_0013C940.i1A0 >> 15) & 1); + t = convert_integer_to_float((D_0013C940.i1A0 >> 15) & 1); if (t == 0.0f) - t = -FUN_001fa6c0((D_0013C940.i1A0 >> 13) & 1); + t = -convert_integer_to_float((D_0013C940.i1A0 >> 13) & 1); r = FUN_001f99c0(st->a); k = D_L00_00161DC0 + (D_L00_00161DC4 - D_L00_00161DC0) * r; st->a = r = FUN_001ebd78(st->a, t, D_L00_00161DC8, D_L00_00161DCC, D_L00_00161DD0, &st->va); @@ -506,9 +506,9 @@ void FUN_L00_002e9f38(u8 *o) { if (t == 0.0f) t = -D_0013C940.f104; if (t == 0.0f) - t = FUN_001fa6c0((D_0013C940.i1A0 >> 12) & 1); + t = convert_integer_to_float((D_0013C940.i1A0 >> 12) & 1); if (t == 0.0f) - t = -FUN_001fa6c0((D_0013C940.i1A0 >> 14) & 1); + t = -convert_integer_to_float((D_0013C940.i1A0 >> 14) & 1); if (D_L00_00166C80_c.s270 != 0 && hero.state.prev == 2) t = 0.0f; if (D_0015EDDC == 0) @@ -518,7 +518,7 @@ void FUN_L00_002e9f38(u8 *o) { st->b = FUN_001ebd78(st->b, t, D_L00_00161DC8, D_L00_00161DCC, D_L00_00161DD0, &st->vb); if (st->b != 0.0f) { float a, n, z; - FUN_001f9ad8(&side, o, &up); + fast_vec_cross(&side, o, &up); a = k * st->b; n = FUN_001f99c0(FUN_001fa580_c(st->ang, a)); if (1.1170107f < n && FUN_001f99c0(st->ang) < n) @@ -534,7 +534,7 @@ void FUN_L00_002e9f38(u8 *o) { d.f[2] = z; FUN_001f9bf8_c(&d, &d, st->z); FUN_001f9a10_c(o + 0x30, o + 0x30, &d); - if (FUN_L00_001f0d60(o + 0x30, 0x12, ((u8 *)hero.moby), 0.3f)) + if (coll_sphere(o + 0x30, 0x12, ((u8 *)hero.moby), 0.3f)) st->z = FUN_001ebd78(st->z, z, 0.005f, 0.2f, z, &st->vz); n = FUN_001fa580_c(st->ang, a); if (FUN_001f99c0(n) > 1.4660766f) { @@ -547,9 +547,9 @@ void FUN_L00_002e9f38(u8 *o) { st->ang = FUN_001fa580_c(st->ang, a); } FUN_001f9bf8_c(o, o, 1.0f); - FUN_001f9ad8(o + 0x10, o, &up); + fast_vec_cross(o + 0x10, o, &up); FUN_001f9bf8_c(o + 0x10, o + 0x10, 1.0f); - FUN_001f9ad8(o + 0x20, o + 0x10, o); + fast_vec_cross(o + 0x20, o + 0x10, o); } /* FUN_L00_002ea488 -- camera-state steering: either replays the scripted * look (state 0x51 or the moby's own state) or steers toward the current @@ -804,6 +804,7 @@ extern char *D_L00_00166E00 __attribute__((section(".data"))); extern char *FUN_L00_001eb1f8(int); /* Copies src to +0x80 of the object of entry 5 (from FUN_L00_001eb1f8 if needed). */ +void FUN_L00_002ea9d8(char *src); void FUN_L00_002ea9d8(char *src) { char *g = D_L00_00166E00; char *p; @@ -822,7 +823,8 @@ extern V_2eaaa0 D_0013F3D0_2eaaa0 __asm__("D_0013F3D0") __attribute__((section(" u8 *FUN_L00_001eb1f8_2eaaa0(s32) __asm__("FUN_L00_001eb1f8"); void FUN_001ebf10_2eaaa0(u8 *) __asm__("FUN_001ebf10"); void FUN_L00_001ed630_2eaaa0(void *, V_2eaaa0 *, V_2eaaa0 *) __asm__("FUN_L00_001ed630"); -void FUN_L00_002eaaa0(V_2eaaa0 *pa, V_2eaaa0 *pb, s32 mode, s32 w, s32 x) { +void jet_mount(V_2eaaa0 *pa, V_2eaaa0 *pb, s32 mode, s32 w, s32 x) __asm__("FUN_L00_002eaaa0"); +void jet_mount(V_2eaaa0 *pa, V_2eaaa0 *pb, s32 mode, s32 w, s32 x) { u8 *m = FUN_L00_001eb1f8_2eaaa0(5); V_2eaaa0 a, b, c, d; u8 *n; @@ -864,6 +866,7 @@ void FUN_001fa050_2eac18(void *, void *) __asm__("FUN_001fa050"); void FUN_001fa2b8_2eac18(void *, void *) __asm__("FUN_001fa2b8"); void FUN_001f9bf8_2eac18(void *, void *, float) __asm__("FUN_001f9bf8"); void FUN_001f9a10_2eac18(void *, void *, void *) __asm__("FUN_001f9a10"); +void FUN_L00_002eac18(int mode); void FUN_L00_002eac18(int mode) { char *g = D_L00_00166C80_2eac18; char *o = *(char **)(g + 0x180); @@ -933,11 +936,11 @@ void FUN_L00_002ead60(char *m) { extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); extern float D_L00_00166DD8 __attribute__((section(".data"))); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); -extern float FUN_L00_001eb328(void *, float, float, float, float, float); -extern float FUN_L00_00257e20(float, float, float, float, float); +extern float rope_spring_turn(void *, float, float, float, float, float) __asm__("FUN_L00_001eb328"); +extern float cubic_hermite_scalar(float, float, float, float, float) __asm__("FUN_L00_00257e20"); extern float FUN_L00_00257ef0(float, float, float); extern float cosine_interpolate_alt(float, float, float) __asm__("FUN_002133d0"); -extern int FUN_001f9740(int *); +extern int tick_countdown_32(int *) __asm__("FUN_001f9740"); extern void FUN_L00_001ed580(void *, void *, void *); extern void FUN_L00_001ed630(void *, void *, void *); extern void FUN_L00_00257f70(void *, void *, void *, float); @@ -958,12 +961,12 @@ void FUN_L00_002eae20(void *arg) { qcopy(m + 0x40, d + 0x90); } else if (t == 2) { float u; - FUN_001f9740((int *)c); + tick_countdown_32((int *)c); u = (float)(*(int *)(c + 4) - *(int *)(d + 0xE0)) / convert_integer_to_float(*(int *)(c + 4)); FUN_L00_00257f70(m + 0x30, m + 0x30, b, u); FUN_L00_00258050((float *)(m + 0x40), (float *)(m + 0x40), (float *)(d + 0x90), u); } else if (t == 3) { - if (FUN_001f9740((int *)c) != 0) { + if (tick_countdown_32((int *)c) != 0) { qcopy(m + 0x30, b); qcopy(m + 0x40, d + 0x90); } else { @@ -986,7 +989,7 @@ void FUN_L00_002eae20(void *arg) { F(c, 0x1C) = FUN_L00_00257ef0(F(c, 0x1C), F(c, 8), t); } F(c, 0x24) = F(c, 0x24) + (F(c, 0x10) - F(c, 0x24)) * - FUN_L00_00257e20(F(c, 0x44), 0, 1.0f, F(c, 0x48), t); + cubic_hermite_scalar(F(c, 0x44), 0, 1.0f, F(c, 0x48), t); F(c, 0x20) = FUN_L00_00257ef0(F(c, 0x20), F(c, 0xC), t); FUN_L00_00257f70(c + 0x30, c + 0x30, &hero.motion.pos, t); FUN_L00_001ed580(m + 0x30, c + 0x1C, c + 0x30); @@ -1003,10 +1006,10 @@ void FUN_L00_002eae20(void *arg) { } if (*(short *)(a + 0x2C) == 1) { F(m, 0x40) = - FUN_L00_001eb328(a, F(m, 0x40), F(b, 0x10), F(a, 0x20), F(a, 0x24), F(a, 0x28)); - F(m, 0x44) = FUN_L00_001eb328(d + 0x34, F(m, 0x44), F(b, 0x14), F(a, 0x20), F(a, 0x24), + rope_spring_turn(a, F(m, 0x40), F(b, 0x10), F(a, 0x20), F(a, 0x24), F(a, 0x28)); + F(m, 0x44) = rope_spring_turn(d + 0x34, F(m, 0x44), F(b, 0x14), F(a, 0x20), F(a, 0x24), F(a, 0x28)); - F(m, 0x48) = FUN_L00_001eb328(d + 0x38, F(m, 0x48), F(b, 0x18), F(a, 0x20), F(a, 0x24), + F(m, 0x48) = rope_spring_turn(d + 0x38, F(m, 0x48), F(b, 0x18), F(a, 0x20), F(a, 0x24), F(a, 0x28)); } } @@ -1411,7 +1414,7 @@ void FUN_L00_002ebbd8(void *arg) { #ifndef NON_MATCHING INCLUDE_ASM("config/us/overlays/asm/FUN_L00_002ebe70.s", FUN_L00_002ebe70); #else -extern void FUN_L00_0025b868(float, float, float *) __asm__("FUN_L00_0025b868"); +extern void FUN_L00_0025b868(float, float, float *); extern void FUN_001ff2a8_2ebe70(void *, void *, void *) __asm__("FUN_001f9a28"); extern void FUN_001ff500_2ebe70(float, void *, void *) __asm__("FUN_001f9bf8"); extern float FUN_001ff7e8_2ebe70(float) __asm__("FUN_001f9dc8"); @@ -1497,12 +1500,12 @@ void FUN_L00_002ebe70(char *o) { else target = ((float *)&hero.motion.rot)[2]; } else target = ((float *)&hero.motion.rot)[2]; - *angle = FUN_L00_001eb328(m + 0xbc, *angle, target, 0.00125f, 0.175f, 0.0f); + *angle = rope_spring_turn(m + 0xbc, *angle, target, 0.00125f, 0.175f, 0.0f); } else if (hero.state.current == 0x25) { target = ((float *)&hero.motion.rot)[2]; if (*(int *)(m + 0x80) == 1) target = *(float *)(*(char **)(m + 0x84) + 0x48); - *angle = FUN_L00_001eb328(m + 0xbc, *angle, target, D_L00_00161DD8_2ebe70, 0.175f, 0.0f); + *angle = rope_spring_turn(m + 0xbc, *angle, target, D_L00_00161DD8_2ebe70, 0.175f, 0.0f); } *(float *)(p + 0x30) = FUN_001ff7e8_2ebe70(*angle); *(float *)(p + 0x34) = FUN_001ff800_2ebe70(*angle); diff --git a/src/overlays/shared/gameplay/camera/init_camera_system.c b/src/overlays/shared/gameplay/camera/init_camera_system.c index ef8cc72061..f90cc92d1a 100644 --- a/src/overlays/shared/gameplay/camera/init_camera_system.c +++ b/src/overlays/shared/gameplay/camera/init_camera_system.c @@ -32,7 +32,8 @@ s32 FUN_L00_001eb1f8(s32 id) { float FUN_001fa5c8_001eb328(float, float) __asm__("FUN_001fa5c8"); float FUN_001f99c0_001eb328(float) __asm__("FUN_001f99c0"); float FUN_001fa580_001eb328(float, float) __asm__("FUN_001fa580"); -float FUN_L00_001eb328(float *p, float a, float b, float c, float d, float lim) { +float rope_spring_turn(float *p, float a, float b, float c, float d, float lim) __asm__("FUN_L00_001eb328"); +float rope_spring_turn(float *p, float a, float b, float c, float d, float lim) { float t = FUN_001fa5c8_001eb328(b, a); *p = *p + (c * t - d * *p); if (lim != 0.0f) { diff --git a/src/overlays/shared/gameplay/entities/0024c7f0.c b/src/overlays/shared/gameplay/entities/0024c7f0.c index c68edbd767..df4b362023 100644 --- a/src/overlays/shared/gameplay/entities/0024c7f0.c +++ b/src/overlays/shared/gameplay/entities/0024c7f0.c @@ -3,8 +3,8 @@ #include "asm.h" #include "rnc/overlay/level_labels.h" -extern void FUN_L00_00259bc8(unsigned char *, int, int, void *, void *, float); +extern void spawn_nearby_effect(unsigned char *, int, int, void *, void *, float) __asm__("FUN_L00_00259bc8"); void FUN_L10_0024c7f0(unsigned char *m, int x, int y, void *p, float f) { - FUN_L00_00259bc8(m, x, y, p, D_L10_0015F580, f); + spawn_nearby_effect(m, x, y, p, D_L10_0015F580, f); } diff --git a/src/overlays/shared/gameplay/entities/002500b8.c b/src/overlays/shared/gameplay/entities/002500b8.c index ab9b329ff8..01ad637082 100644 --- a/src/overlays/shared/gameplay/entities/002500b8.c +++ b/src/overlays/shared/gameplay/entities/002500b8.c @@ -77,7 +77,8 @@ void FUN_L00_002500b8(char *o) { /* Ported from rac1-decomp (src/overlays/shared/mobyfunc_0024FD50.c: func_L00_002512D8), where it is exact; names translated to the US level program. */ /* Clears slot idx of this level's 16-entry table to 0xFF. */ -void FUN_L00_002502a0(int idx) { +void jet_clear_persistent(int idx) __asm__("FUN_L00_002502a0"); +void jet_clear_persistent(int idx) { if (idx != 0xFF) { visited52[idx + current_level_index * 16] = 0xFF; } diff --git a/src/overlays/shared/gameplay/entities/0025c758.c b/src/overlays/shared/gameplay/entities/0025c758.c index 83bcee0c4f..a7cc2e0980 100644 --- a/src/overlays/shared/gameplay/entities/0025c758.c +++ b/src/overlays/shared/gameplay/entities/0025c758.c @@ -8,7 +8,8 @@ /* Ported from rac1-decomp (src/overlays/shared/mobyutil_0025D750.c: func_L02_0025D750), where it is exact; names translated to the US level program. */ -void FUN_L02_0025c758(char *moby) { +void initialize_moby_grounding(char *moby) __asm__("FUN_L02_0025c758"); +void initialize_moby_grounding(char *moby) { float delta = 0.2f; float val = *(float *)(moby + 0x18); *(float *)(moby + 0x84) = val - delta; diff --git a/src/overlays/shared/gameplay/entities/0025d1b8.c b/src/overlays/shared/gameplay/entities/0025d1b8.c index b8e8a65b98..5cf4408437 100644 --- a/src/overlays/shared/gameplay/entities/0025d1b8.c +++ b/src/overlays/shared/gameplay/entities/0025d1b8.c @@ -8,6 +8,7 @@ typedef struct { s64 v; } S; /* Copies the 64-bit value from the record D_001413D0[0] points to into p. */ +void FUN_L00_0025d1b8(S *p, s64 v); void FUN_L00_0025d1b8(S *p, s64 v) { v = (((S *)hero.moby))->v; p->v = v; diff --git a/src/overlays/shared/gameplay/entities/002630b8.c b/src/overlays/shared/gameplay/entities/002630b8.c index 61c730b0dc..75fedbd7e6 100644 --- a/src/overlays/shared/gameplay/entities/002630b8.c +++ b/src/overlays/shared/gameplay/entities/002630b8.c @@ -8,7 +8,7 @@ #include "rnc/gameplay/hero.h" #include "rnc/gameplay/entities/moby.h" -/* Record FUN_002141f8 returns for a moby: collision size and aim height. */ +/* Record suck_get_aim_height returns for a moby: collision size and aim height. */ typedef struct MobyBound { u8 pad0[0xA]; u8 size; /* 0x0A: radius in eighths */ @@ -18,18 +18,18 @@ typedef struct MobyBound { extern struct Moby *D_L00_0015FFE4; extern u8 D_L00_00166DC0[]; -float FUN_001f9e90(float, float); +float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); float vector_length_xy(void *) __asm__("FUN_001f9b20"); float vector_distance_xy(void *, void *) __asm__("FUN_001f9b80"); float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); -float FUN_001fa688(float, float); +float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); float FUN_001f99c0(float); float fast_arc_sin(float) __asm__("FUN_001f9df8"); float convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); void build_spherical_offset(Vec4 *, float, float, float) __asm__("FUN_00214db0"); -MobyBound *FUN_002141f8(struct Moby *); -int FUN_001efa68(void *, Vec4 *, int, void *, int); +MobyBound *suck_get_aim_height(struct Moby *) __asm__("FUN_002141f8"); +int collision_line(void *, Vec4 *, int, void *, int) __asm__("FUN_001efa68"); /* Picks the best auto-aim target moby (kind 5) for a shot from pos along dir: writes yaw/pitch toward it and its aim height, returns the moby or 0. */ @@ -43,8 +43,8 @@ struct Moby *FUN_L00_002630c8(void *ignore, Vec4 *pos_in, Vec4 *dir_in, f32 *yaw pos.q = pos_in->q; dir.q = dir_in->q; - *yaw = FUN_001f9e90(dp->f[0], dp->f[1]); - *pitch = -FUN_001f9e90(vector_length_xy(dp), dp->f[2]); + *yaw = fast_arc_tan(dp->f[0], dp->f[1]); + *pitch = -fast_arc_tan(vector_length_xy(dp), dp->f[2]); for (m = D_L00_0015FFE4; m != 0; m = m->next) { MobyBound *b; @@ -52,19 +52,19 @@ struct Moby *FUN_L00_002630c8(void *ignore, Vec4 *pos_in, Vec4 *dir_in, f32 *yaw if ((s8)m->state < 0) continue; qcopy(&target, &m->pos); - b = FUN_002141f8(m); + b = suck_get_aim_height(m); if (b) target.f[2] += b->height; else target.f[2] += 0.5f; if (!(m->flags & 0x1000) || !m || !m->pclass || m->pclass->type != 5) continue; - t_yaw = FUN_001f9e90(target.f[0] - pp->f[0], target.f[1] - pp->f[1]); - t_pitch = FUN_001f9e90(vector_distance_xy(pp, &target), target.f[2] - pp->f[2]); + t_yaw = fast_arc_tan(target.f[0] - pp->f[0], target.f[1] - pp->f[1]); + t_pitch = fast_arc_tan(vector_distance_xy(pp, &target), target.f[2] - pp->f[2]); dist = fast_vec_dist(pp, &target); if (dist < 7.5f && - FUN_001fa688(hero.moby->rot.z, - FUN_001f9e90(m->pos.x - hero.motion.pos.f[0], + fast_difference_between_rotations(hero.moby->rot.z, + fast_arc_tan(m->pos.x - hero.motion.pos.f[0], m->pos.y - hero.motion.pos.f[1])) < 1.0471976f && FUN_001f99c0(t_pitch) < 1.0471976f) { *pitch = -t_pitch; @@ -83,7 +83,7 @@ struct Moby *FUN_L00_002630c8(void *ignore, Vec4 *pos_in, Vec4 *dir_in, f32 *yaw if (radius < dist) ang -= shrink; } - if (ang < max_angle && !FUN_001efa68(D_L00_00166DC0, &target, 6, ignore, 0)) { + if (ang < max_angle && !collision_line(D_L00_00166DC0, &target, 6, ignore, 0)) { best = m; best_dist = dist; *pitch = -t_pitch; @@ -102,7 +102,8 @@ extern int D_L00_0015FC98; extern unsigned char *D_L00_0015FCA8; extern float D_L00_0015FCA0; extern float D_L00_0015FCA4; -float FUN_L00_00263468(Vec4 *v) { +float ground_height_at(Vec4 *v) __asm__("FUN_L00_00263468"); +float ground_height_at(Vec4 *v) { Vec4 t; int iy, ix; t.q = v->q; @@ -234,7 +235,8 @@ extern s32 FUN_001f96f8_2637f8(s32) __asm__("FUN_001f96f8"); extern Effect_2637f8 *FUN_L00_0026d000_2637f8(void *, f32, f32, f32, s32, void *, f32, u32) __asm__("FUN_L00_0026d000"); extern u8 D_L00_0015F580_2637f8[] __asm__("D_L00_0015F580") __attribute__((section(".sdata"))); -void FUN_L00_002637f8(u8 *m) { +void cutscene_set_camera_target(u8 *m) __asm__("FUN_L00_002637f8"); +void cutscene_set_camera_target(u8 *m) { Vec4_2634f8 vectors[4]; Vec4_2634f8 pos; Vec4_2634f8 scaled; @@ -304,6 +306,7 @@ extern unsigned char D_0015EDB7; void attach_manipulator() __asm__("FUN_0020cb10"); void detach_manipulator() __asm__("FUN_0020cb88"); /* While D_0015EDB7 is set attaches the manipulator, sets floats 0x20..0x28 to x; else detaches. */ +void FUN_L00_00263ac8(float x, int a, int b, unsigned char *p); void FUN_L00_00263ac8(float x, int a, int b, unsigned char *p) { if (D_0015EDB7) { if (p[1] == 0) @@ -341,7 +344,8 @@ int FUN_001f96f8_263b70(int) __asm__("FUN_001f96f8"); int FUN_001fa6d0_263b70(float) __asm__("FUN_001fa6d0"); P_263b70 *FUN_L00_0026d000_263b70(void *, int, void *, float, float, float, float, int) __asm__("FUN_L00_0026d000"); -void FUN_L00_00263b70(void *p0, void *p1, void *vel, float a, float b) { +void draw_trail(void *p0, void *p1, void *vel, float a, float b) __asm__("FUN_L00_00263b70"); +void draw_trail(void *p0, void *p1, void *vel, float a, float b) { P_263b70 *part; T_263b70 *tail; int i, j, m; @@ -392,6 +396,7 @@ s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); s32 get_help_message_text() __asm__("FUN_001fdd10"); void sprintf() __asm__("FUN_00116248"); /* Calls sprintf on D_L00_00179118 with help message a and b; c frames (default 0xB4). */ +void FUN_L00_00263db0(s32 a, s32 b, s32 c); void FUN_L00_00263db0(s32 a, s32 b, s32 c) { if (c == -1) c = scale_game_frames(0xB4); @@ -484,7 +489,7 @@ typedef struct { } Moby; extern float D_0015ED6C_s[] __asm__("D_0015ED6C") __attribute__((sda)); -extern float FUN_001f9af0(void *a); +extern float fast_vec_length(void *a) __asm__("FUN_001f9af0"); extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); @@ -498,6 +503,8 @@ extern void random_vector(float *, float, float) __asm__("FUN_L00_00257d78"); extern struct Moby *func_0020D348_m(int) __asm__("FUN_0020c4f8"); extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); +void *FUN_L00_00263fd8(char *src, int cls, float *pos, void *mat, int a8, int a9, float *v10, + float *v11, float scale, float *v12); void *FUN_L00_00263fd8(char *src, int cls, float *pos, void *mat, int a8, int a9, float *v10, float *v11, float scale, float *v12) { char *m = (char *)func_0020D348_m(cls); @@ -528,7 +535,7 @@ void *FUN_L00_00263fd8(char *src, int cls, float *pos, void *mat, int a8, int a9 *(float *)(d + 0x38) = random_float_between_alt(10.0f, 15.0f) * frame_time_sq; else *(float *)(d + 0x38) = scale; - if (FUN_001f9af0(v10) == 0.0f) { + if (fast_vec_length(v10) == 0.0f) { f21 = random_angle_radians(); k = random_float_between_alt(2.0f, 4.0f) * frame_time; t[0] = fast_cos(f21) * k; @@ -539,14 +546,14 @@ void *FUN_L00_00263fd8(char *src, int cls, float *pos, void *mat, int a8, int a9 } else { qcopy(d, v10); } - if (FUN_001f9af0(v11) == 0.0f) { + if (fast_vec_length(v11) == 0.0f) { float g = D_0015ED6C_s[0]; random_vector(t, g * 3.1415927f, g * 6.2831855f); qcopy(d + 0x10, t); } else { qcopy(d + 0x10, v11); } - if (FUN_001f9af0(v12) == 0.0f && v12[3] == 0.0f) { + if (fast_vec_length(v12) == 0.0f && v12[3] == 0.0f) { qcopy(t, *(char **)(m + 0x24) + 0x30); k2 = *(float *)(m + 0x2C); k2 = k2 * 0.0009765625f; @@ -565,7 +572,7 @@ extern s32 D_L00_0015F594; extern s32 D_L00_00161E08; extern s32 D_L00_00161E04; void FUN_L00_00237190(void); -void FUN_L00_002371e0(void); +void mine_blend_color(void) __asm__("FUN_L00_002371e0"); void FUN_L00_00237200(void); s32 queue_animation_update(s32, s32, void *, void *, void *, s32, s32) __asm__("FUN_001ff308"); void hud_keep_visible(s32, s32) __asm__("FUN_L00_00235e18"); @@ -577,7 +584,7 @@ void FUN_L00_00264328(void) { if (D_L00_0015F594 == 0 || D_L00_00161E08 == 0) { D_L00_00161E04 = -1; } else if (D_L00_00161E04 == -1) { - D_L00_00161E04 = queue_animation_update(0xC, 0, FUN_L00_00237190, FUN_L00_002371e0, + D_L00_00161E04 = queue_animation_update(0xC, 0, FUN_L00_00237190, mine_blend_color, FUN_L00_00237200, 0, 0); } else { hud_keep_visible(D_L00_00161E04, 10); diff --git a/src/overlays/shared/gameplay/entities/00264e40.c b/src/overlays/shared/gameplay/entities/00264e40.c index 00b1cc3642..608766a645 100644 --- a/src/overlays/shared/gameplay/entities/00264e40.c +++ b/src/overlays/shared/gameplay/entities/00264e40.c @@ -27,11 +27,11 @@ extern f32 random_float_between(f32, f32) __asm__("func_002132A8"); extern f32 frame_time_macro __asm__("D_0015ED6C") __attribute__((section(".sdata"))); extern f32 frame_time_sq_macro __asm__("D_0015ED70") __attribute__((section(".sdata"))); extern float D_L02_00174460[]; -extern float FUN_001f96b0(float); +extern float FUN_L04_001f1978(float); extern float fast_vec_dist(void *, void *); extern int D_L02_0015F5CC __attribute__((section(".sdata"))); -extern int FUN_001efa68(void *, void *, int, int, int); -extern int FUN_001f9770(void *); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); extern float D_L02_001600D0 __attribute__((sda)); extern int D_L02_001600D4 __attribute__((sda)); @@ -69,7 +69,7 @@ void FUN_L02_00264e70(char *slots, float *position, float *direction, float dist qcopy(origin, position); fast_vec_normalize(adjusted, direction, distance + 0.75f); add_vector_xyz(end, adjusted, origin); - if (FUN_001efa68(origin, end, 2, 0, 0)) { + if (collision_line(origin, end, 2, 0, 0)) { travel = fast_vec_dist(origin, D_L02_00174460) - 0.75f; if (travel < 0.0f) travel = 0.0f; } else { @@ -100,9 +100,9 @@ void FUN_L02_00264e70(char *slots, float *position, float *direction, float dist } } } - if (FUN_001f9770(slots + 0x1c)) { + if (fast_dec_timer_s16(slots + 0x1c)) { float sp2 = random_float_between(10.0f, 30.0f); - sp2 = FUN_001f96b0(sp2); + sp2 = FUN_L04_001f1978(sp2); ((Slots_265E88 *)slots)->timer = truncate_float_to_s32(sp2); FUN_L00_00257d78(offset, 0.0f, frame_time_macro + frame_time_macro); fast_vec_scale(velocity, adjusted, random_float_between(0.5f, 0.1f)); diff --git a/src/overlays/shared/gameplay/entities/00277fb8.c b/src/overlays/shared/gameplay/entities/00277fb8.c index f2d3e3d458..2953f3913e 100644 --- a/src/overlays/shared/gameplay/entities/00277fb8.c +++ b/src/overlays/shared/gameplay/entities/00277fb8.c @@ -44,7 +44,8 @@ extern float fast_cos_q(float) __asm__("FUN_001f9dc8"); extern float fast_sin_q(float) __asm__("FUN_001f9de0"); extern void clear_vector_q(void *) __asm__("FUN_001f99f8"); -void FUN_L01_002783a8(float scale, char *moby) { +void begin_dialogue_camera_transition(float scale, char *moby) __asm__("FUN_L01_002783a8"); +void begin_dialogue_camera_transition(float scale, char *moby) { D_L01_0016CCE0_q.f = 1; qcopy(D_L01_0016CCE0_q.p, moby + 0x10); D_L01_0016CCE0_q.p[0] += fast_cos_q(*(float *)(moby + 0x48)) * scale; @@ -58,12 +59,12 @@ void FUN_L01_002783a8(float scale, char *moby) { /* Ported from rac1-decomp (src/overlays/shared/mobyutil_0026E8E0.c: func_L01_00279790), where it is exact; names translated to the US level program. */ -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void FUN_L00_00260a88(void *, int, int, int, int); void FUN_L01_002787a0(char *moby) { int r = 0; - if (FUN_001f9b80(moby + 0x10, D_0013E533 + 0xE9D) < 7.0f) { + if (vector_distance(moby + 0x10, D_0013E533 + 0xE9D) < 7.0f) { r = 2; } FUN_L00_00260a88(moby, 4, 7, r, -1); @@ -91,3 +92,6 @@ void FUN_L01_00278e20(struct Moby *src, int oClass) { FUN_L00_00250df8(m); } } + +f32 D_L02_0016CE74[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_0016CC74[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/00295100.c b/src/overlays/shared/gameplay/entities/00295100.c index 4b64cda208..c25c1c4b1b 100644 --- a/src/overlays/shared/gameplay/entities/00295100.c +++ b/src/overlays/shared/gameplay/entities/00295100.c @@ -350,8 +350,7 @@ void memset_298840(void *, int, int) __asm__("FUN_001f97e8"); void f2039a0_298840(void) __asm__("FUN_L00_002039a0"); extern int hero_set_state(int, int) __asm__("FUN_L00_002223f8"); void f232fe8_298840(void) __asm__("FUN_L00_00232fe8"); -int f2451b8_298840(int) __asm__("FUN_L00_002451b8"); -int f1f96f8_298840(int) __asm__("FUN_001f96f8"); +int FUN_L00_002451b8_c(int) __asm__("FUN_L00_002451b8"); void f1f4a58_298840(int) __asm__("FUN_001f4a58"); void update_world_object_animation(void) __asm__("FUN_00204790"); void f22ca50_298840(void) __asm__("FUN_0022ca50"); @@ -359,7 +358,8 @@ int f122298_298840(int) __asm__("FUN_00122298"); int f215b10_298840(void) __asm__("FUN_00215b10"); extern char D_L00_0017C440[] __attribute__((section(".data"))); extern float D_L00_0015F59C; -void FUN_L00_00298840(int a) { +void start_scene(int a) __asm__("FUN_L00_00298840"); +void start_scene(int a) { O_298840 *o; int t, i; if (a < 0) @@ -397,8 +397,8 @@ void FUN_L00_00298840(int a) { active_scene_trigger.moby->flags |= 1; if (D_L00_001B9CF0.unkEC) ((struct Moby *)D_L00_001B9CF0.unkEC)->flags |= 1; - f2451b8_298840(0); - f1f4a58_298840(f1f96f8_298840(6)); + FUN_L00_002451b8_c(0); + f1f4a58_298840(scale_game_frames(6)); update_audio_stream_until_idle(1); update_world_object_animation(); for (o = D_L00_0015FFDC_298840; o->st != 0xFF; o++) { @@ -412,7 +412,7 @@ void FUN_L00_00298840(int a) { } D_L00_0016C860_298840.x48 = -3; f215b10_298840(); - f2451b8_298840(1); + FUN_L00_002451b8_c(1); for (i = 0; D_L00_0016C860_298840.x48 < i; i--) f122298_298840(0); } @@ -467,8 +467,7 @@ float absolute_float(float) __asm__("FUN_001f99c0"); void f2330d0_298b18(void) __asm__("FUN_L00_002330d0"); void f216f90_298b18(void *, void *, int, int) __asm__("FUN_L00_00216f90"); void fun_00216c48(F_298b18 *, void *, int) __asm__("FUN_00216c48"); -int f1f96f8_298b18(int) __asm__("FUN_001f96f8"); -void f265880_298b18(int) __asm__("FUN_L00_00265880"); +void FUN_L00_00265880(int); void FUN_L00_00298b18(void) { O_298b18 *o; float f, g; @@ -519,7 +518,7 @@ void FUN_L00_00298b18(void) { active_scene_trigger.trigger = 0; fun_00216c48(a, b, 1); } - f265880_298b18(f1f96f8_298b18(0x1E)); + FUN_L00_00265880(scale_game_frames(0x1E)); } #include "qcopy.h" #include "rnc/overlay/quad.h" @@ -1165,7 +1164,7 @@ void FUN_L00_00299c48(void) { extern char *D_L00_00197300_d[] __asm__("D_L00_00197300") __attribute__((section(".data"))); extern int D_L00_001CA4C0_d[] __asm__("D_L00_001CA4C0") __attribute__((section(".data"))); -extern void FUN_L00_0024d8d0(int, int); +extern void fast_decompress(int, int) __asm__("FUN_L00_0024d8d0"); extern void FlushCache(s32); extern void relocate_asset_entry_pointers_alt(char *arg0, int idx) __asm__("FUN_002032e0"); @@ -1177,7 +1176,7 @@ void FUN_L00_0029a330(void) { int v; v = D_L00_001CA4C0_d[6] + 0x80000; FlushCache(0); - FUN_L00_0024d8d0(v, D_L00_001CA4C0_d[6]); + fast_decompress(v, D_L00_001CA4C0_d[6]); FlushCache(0); p = (int *)D_L00_001CA4C0_d[6]; base = D_L00_00197300_d[D_L00_00197BCC]; @@ -1214,6 +1213,7 @@ extern u8 D_0013D4C0[]; extern u8 D_0015EDD0_257218[] __asm__("D_0015EDD0") __attribute__((section(".sdata"))); /* Builds the vendor list: the stocked items (up to 12, 0xFF-terminated), then every other available item (D_0013D4C0 set, h8 non-zero) not already listed. */ +void FUN_L00_0029a400(s32 skip_unflagged); void FUN_L00_0029a400(s32 skip_unflagged) { s32 count, i, j, value, item, k; @@ -1349,7 +1349,7 @@ extern void update_moby_29a6b0(void *) __asm__("FUN_L00_00250df8"); extern void snd_pause_all_sounds_in_group(s32) __asm__("FUN_0012e3e8"); extern void FUN_00216050_29a6b0(s32) __asm__("FUN_00216050"); extern void FUN_0012dc80_29a6b0(void) __asm__("FUN_0012dc80"); -extern void build_list_29a6b0(s32) __asm__("FUN_L00_0029a400"); +extern void FUN_L00_0029a400(s32); extern void FUN_L00_0023aef8_29a6b0(void) __asm__("FUN_L00_0023aef8"); extern s32 add_text_29a6b0(s32, s32, void *, void *, void *, void *, s32) __asm__("FUN_001ff308"); extern void FUN_L00_00239cc8_29a6b0(void) __asm__("FUN_L00_00239cc8"); @@ -1382,6 +1382,7 @@ extern f32 D_L00_001610E0 __attribute__((sda)); extern s32 game_language_macro __asm__("D_0015ED88") __attribute__((section(".sdata"))); extern f32 frame_scale_macro __asm__("D_0015ED60") __attribute__((section(".sdata"))); /* Opens the vendor: clears its state, spawns the vendor moby when none is given, builds the item list and its texts, then sets up the camera and the four slot offsets. */ +void FUN_L00_0029a6b0(VendorMoby_29a6b0 *m); void FUN_L00_0029a6b0(VendorMoby_29a6b0 *m) { s32 i; Vec4 *v; @@ -1419,7 +1420,7 @@ void FUN_L00_0029a6b0(VendorMoby_29a6b0 *m) { snd_pause_all_sounds_in_group(0x1D); FUN_00216050_29a6b0(0); FUN_0012dc80_29a6b0(); - build_list_29a6b0(vendor_29a6b0.mode != 0); + FUN_L00_0029a400(vendor_29a6b0.mode != 0); half = vendor_29a6b0.count; sel = half / 2; if (half < 3) sel = 1; @@ -1582,7 +1583,7 @@ extern void FUN_L00_002a09d8(s32); extern void sound_update(void) __asm__("FUN_0022ca50"); extern void FUN_L00_0020fca8(s32, s32); extern void parse_space_scene_chunk(s32, s32) __asm__("FUN_002049f0"); -extern void f2454c8_29ad08(s32) __asm__("FUN_L00_002454c8"); +extern void FUN_L00_002454c8(s32); extern void f204a40_29ad08(s32, s32) __asm__("FUN_00204a40"); extern void FUN_L00_002455c0(s32); extern void f215b10_29ad08(void) __asm__("FUN_00215b10"); @@ -1634,7 +1635,7 @@ void FUN_L00_0029ad08(void) { if (hero.pending_item[0] == 0x18) hero.pending_item[0] = 0; f204a40_29ad08(D_L00_00179AC0_29ad08[D_L00_001CA4C0_29ad08.f48].id, -1); - f2454c8_29ad08(item); + FUN_L00_002454c8(item); state = &D_001516D0_29ad08; *(s32 *)&state->pad[0x1C] = 0x2734; FUN_L00_002455c0(0); @@ -1945,7 +1946,7 @@ extern void FUN_0022dc50(void); extern void FUN_L00_002070d0(void); extern void update_parts(void) __asm__("FUN_00217b88"); extern void noop_main_callback(void *, s32) __asm__("FUN_001e93e8"); -extern s32 FUN_001f96f8(s32); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern void FUN_00212f90(void *, s32, s32, s32); extern s32 allocate_voice_for_target_entry(s32, s32, void *) __asm__("FUN_0022da68"); extern void detach_manipulator(void *, void *) __asm__("FUN_0020cb88"); @@ -1962,10 +1963,10 @@ extern void init_moby_instance(void *, s32) __asm__("FUN_0020c5f0"); extern void FUN_L00_00250df8(void *); extern void pack_render_command_fields(void *, s32, s32, s32, s32) __asm__("FUN_0020d4f0"); extern void FUN_L00_0029b4d8(s32); -extern void FUN_0020d580(void *); +extern void advance_moby_animation(void *) __asm__("FUN_0020d580"); extern void update_resident_dialogue_animation_state(void *) __asm__("FUN_00237ed0"); extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); -extern f32 FUN_001fa580(f32, f32); +extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern void euler_rotation_basis(void *, void *) __asm__("FUN_001fa030"); extern s32 FUN_001fdd10(s32); @@ -1999,7 +2000,7 @@ extern void FUN_0022ca50(void); #include "eetypes.h" /* FUN_L00_0029ba78 - Level-00 shared: per-frame state machine (states 0..4) that - * drives FUN_0020d580/FUN_L00_00250df8 on g->f20+0x400 and updates the + * drives advance_moby_animation/FUN_L00_00250df8 on g->f20+0x400 and updates the * progress tables D_L00_001C40B0 / weapon_ammo_counts / D_0013DD70 / D_0015ED98. */ @@ -2295,7 +2296,7 @@ void FUN_L00_0029c648(void) { fade_level = 0.0f; } vendor_menu.f4++; - if (vendor_menu.f4 >= FUN_001f96f8(40) || vendor_menu.f40 != 0) { + if (vendor_menu.f4 >= scale_game_frames(40) || vendor_menu.f40 != 0) { fade_level = 0.0f; vendor_menu.fC = 1; vendor_menu.state = 1; @@ -2312,7 +2313,7 @@ void FUN_L00_0029c648(void) { if (D_L00_001CA020[vendor_menu.f48] >= 0) { ok = 1; } } vendor_menu.f4++; - if (vendor_menu.f4 >= FUN_001f96f8(40) || vendor_menu.f40 != 0) { + if (vendor_menu.f4 >= scale_game_frames(40) || vendor_menu.f40 != 0) { FUN_00212f90(vendor_menu.f1c, 1, 0, 8); row = D_L00_00165E80; for (k = 0; k < 4; k++) { @@ -2330,7 +2331,7 @@ void FUN_L00_0029c648(void) { } FUN_L00_0023ac78(1); } - if (vendor_menu.f4 <= FUN_001f96f8(36)) { + if (vendor_menu.f4 <= scale_game_frames(36)) { enqueue_callback_list_1(FUN_L00_0029f990, vendor_menu.f1c); } if (vendor_menu.f40 == 0) { @@ -2355,12 +2356,12 @@ void FUN_L00_0029c648(void) { D_L00_0016118C = 0; FUN_L00_0029b4d8(1); } - FUN_0020d580(vendor_menu.f1c); + advance_moby_animation(vendor_menu.f1c); FUN_L00_00250df8(vendor_menu.f1c); if (D_L00_00161188 == 1) { transform_vector_by_basis(&vendor_menu.f24->pos, &D_L00_00161080, vendor_menu.f1c->mtx); add_vector_xyz(&vendor_menu.f24->pos, &vendor_menu.f24->pos, &vendor_menu.f1c->pos); - FUN_0020d580(vendor_menu.f24); + advance_moby_animation(vendor_menu.f24); FUN_L00_00250df8(vendor_menu.f24); update_resident_dialogue_animation_state(vendor_menu.f24); } @@ -2369,18 +2370,18 @@ void FUN_L00_0029c648(void) { transform_vector_by_basis(&vendor_menu.f20[0].pos, &D_L00_001610B0, vendor_menu.f1c->mtx); k3 = 0.05f; add_vector_xyz(&vendor_menu.f20[0].pos, &vendor_menu.f20[0].pos, &vendor_menu.f1c->pos); - vendor_menu.f20[0].rot.f[0] = FUN_001fa580(vendor_menu.f20[0].rot.f[0], multiply_global_factor_ed64(k1)); + vendor_menu.f20[0].rot.f[0] = fast_add_rotations(vendor_menu.f20[0].rot.f[0], multiply_global_factor_ed64(k1)); vendor_menu.f20[0].rot.f[1] = k2; - vendor_menu.f20[0].rot.f[2] = FUN_001fa580(vendor_menu.f20[0].rot.f[2], multiply_global_factor_ed64(k3)); + vendor_menu.f20[0].rot.f[2] = fast_add_rotations(vendor_menu.f20[0].rot.f[2], multiply_global_factor_ed64(k3)); FUN_L00_00250df8(&vendor_menu.f20[0]); transform_vector_by_basis(&vendor_menu.f20[5].pos, &D_L00_001610C0, vendor_menu.f1c->mtx); add_vector_xyz(&vendor_menu.f20[5].pos, &vendor_menu.f20[5].pos, &vendor_menu.f1c->pos); - vendor_menu.f20[5].rot.f[0] = FUN_001fa580(vendor_menu.f20[5].rot.f[0], multiply_global_factor_ed64(k1)); + vendor_menu.f20[5].rot.f[0] = fast_add_rotations(vendor_menu.f20[5].rot.f[0], multiply_global_factor_ed64(k1)); vendor_menu.f20[5].rot.f[1] = k2; - vendor_menu.f20[5].rot.f[2] = FUN_001fa580(vendor_menu.f20[5].rot.f[2], multiply_global_factor_ed64(k3)); + vendor_menu.f20[5].rot.f[2] = fast_add_rotations(vendor_menu.f20[5].rot.f[2], multiply_global_factor_ed64(k3)); FUN_L00_00250df8(&vendor_menu.f20[5]); - D_L00_00161E24 = FUN_001fa580(D_L00_00161E24, multiply_global_factor_ed64(k3)); - FUN_0020d580(&vendor_menu.f20[1]); + D_L00_00161E24 = fast_add_rotations(D_L00_00161E24, multiply_global_factor_ed64(k3)); + advance_moby_animation(&vendor_menu.f20[1]); if (!vendor_menu.f20[1].b53 && (vendor_menu.f20[1].b70 & 2)) { FUN_00212f90(&vendor_menu.f20[1], 1, 0, 8); } @@ -2406,7 +2407,7 @@ void FUN_L00_0029c648(void) { vendor_menu.f20[3].rot.f[0] = D_L00_001C9930[CUR_ITEM.fD0].f10; vendor_menu.f20[3].rot.f[1] = D_L00_001C9930[CUR_ITEM.fD0].f14; vendor_menu.f20[3].rot.f[2] = D_L00_00161E24; - FUN_0020d580(&vendor_menu.f20[3]); + advance_moby_animation(&vendor_menu.f20[3]); if (!vendor_menu.f20[3].b53 && (vendor_menu.f20[3].b70 & 2)) { FUN_00212f90(&vendor_menu.f20[3], 1, 0, 8); } @@ -2599,7 +2600,7 @@ void FUN_L00_0029c648(void) { qcopy(D_L00_00166C80.pos.f, cam); transform_vector_by_basis(D_L00_00166C80.pos.f, D_L00_00166C80.pos.f, vendor_menu.f80); add_vector_xyz(D_L00_00166C80.pos.f, D_L00_00166C80.pos.f, &vendor_menu.fC0); - ang = FUN_001fa580(rot[2], vendor_menu.f80[3].f[2]); + ang = fast_add_rotations(rot[2], vendor_menu.f80[3].f[2]); sce_vu0_unit_matrix(m); sce_vu0_rot_matrix_x(m, m, rot[0]); sce_vu0_rot_matrix_y(m, m, rot[1]); @@ -2645,3 +2646,103 @@ void FUN_L00_0029c648(void) { } FUN_0022ca50(); } + +s32 D_L00_001B9DDC[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001CA514[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_0017E984[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001BA25C[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001CA994[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_0016CE9C[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_0017EB04[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001BA3DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001CAAD8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001CAAE4[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001CAAE8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001CAB14[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_0017E604[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B9EDC[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001CA5D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001CA5E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001CA5E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001CA614[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B9F5C[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001CA658[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001CA664[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001CA668[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001CA694[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_0017E984[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001BA25C[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001CA958[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001CA964[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001CA968[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001CA994[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001BA55C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001CAC58[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001CAC64[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001CAC68[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001CAC94[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B9E5C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001CA558[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001CA564[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001CA568[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001CA594[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_0016D09C[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_0017ED04[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001BA5DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001CACD8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001CACE4[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001CACE8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001CAD14[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B9F5C[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001CA658[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001CA664[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001CA668[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001CA694[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001BA25C[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001CA958[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001CA964[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001CA968[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001CA994[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001CAED8[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001CAEE4[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001CAEE8[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001CAF14[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_0017E984[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001BA25C[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001CA958[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001CA964[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001CA968[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001CA994[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_0016CB9C[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001BA0DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001CA7D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001CA7E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001CA814[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_0016CF9C[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_0017EC04[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001BA4DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001CABD8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001CABE4[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001CABE8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001CAC14[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_0017EB04[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001BA3DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001CAAD8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001CAAE4[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001CAAE8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001CAB14[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_0017E984[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001BA25C[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001CA958[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001CA964[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001CA968[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001CA994[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_0016D19C[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001CADD8[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001CADE4[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001CADE8[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001CAE14[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001CAED8[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001CAEE4[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001CAEE8[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001CAF14[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/0029f990.c b/src/overlays/shared/gameplay/entities/0029f990.c index 19225d1a38..2cbd8073b8 100644 --- a/src/overlays/shared/gameplay/entities/0029f990.c +++ b/src/overlays/shared/gameplay/entities/0029f990.c @@ -429,3 +429,39 @@ void FUN_L00_002a02b0(void) { FUN_L00_002a09d8(0x10); patch_moby_gifs(); } + +s32 D_L01_001CA900[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001CAA80[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001CAAC8[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001CA580[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001CA5C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001CA600[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001CA648[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001CA900[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001CA948[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001CAC00[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001CAC48[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001CA500[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001CA548[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001CAC80[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001CACC8[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001CA600[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001CA648[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001CA900[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001CA948[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001CAE80[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001CAEC8[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001CA900[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001CA948[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001CA780[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001CA7C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001CAB80[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001CABC8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001CAA80[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001CAAC8[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001CA900[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001CA948[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001CAD80[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001CADC8[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001CAE80[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001CAEC8[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/002aee30.c b/src/overlays/shared/gameplay/entities/002aee30.c index 6194f4db92..4ea6d8db4e 100644 --- a/src/overlays/shared/gameplay/entities/002aee30.c +++ b/src/overlays/shared/gameplay/entities/002aee30.c @@ -158,10 +158,10 @@ typedef struct { extern f32 D_L04_00166F40[]; /* arena centre */ extern u128 D_L04_00173FE0; /* hit position of the last collision_line */ extern u8 D_L04_00174000[]; -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern s32 allocate_voice_for_target_entry(s32, s32, struct Moby *) __asm__("FUN_0022da68"); extern void set_vector_length_xy(void *, void *, f32) __asm__("FUN_001f9c48"); -extern s32 FUN_001f9770(s16 *); /* counts a s16 down, nonzero at 0 */ +extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); /* counts a s16 down, nonzero at 0 */ extern void mark_moby_for_removal(struct Moby *) __asm__("FUN_0020c828"); extern s32 collision_line(void *, void *, s32, struct Moby *, CollisionProbe *) __asm__("FUN_001efa68"); extern void FUN_L00_001ff660(void *, void *, void *); @@ -205,7 +205,7 @@ void FUN_L04_002af058(struct Moby *m) v->unk24 = 1; v->hero_dist = d; if (m->pos.x < 0.0f || m->pos.y < 0.0f || m->pos.z < 0.0f - || range < FUN_001f9b80(&m->pos, D_L04_00166F40)) { + || range < vector_distance(&m->pos, D_L04_00166F40)) { mark_moby_for_removal(m); return; } @@ -229,7 +229,7 @@ void FUN_L04_002af058(struct Moby *m) pr.unk19 = pr.unk18 = 1; pr.oclass = m->oclass; } - if (FUN_001f9770(&v->time) && m->command == 0) { + if (fast_dec_timer_s16(&v->time) && m->command == 0) { m->command = 1; v->time = v->time_max / 4; } else if (v->time <= 0 && m->command != 0) { diff --git a/src/overlays/shared/gameplay/entities/002d6810.c b/src/overlays/shared/gameplay/entities/002d6810.c index 3238afa801..fb0fa6d5b7 100644 --- a/src/overlays/shared/gameplay/entities/002d6810.c +++ b/src/overlays/shared/gameplay/entities/002d6810.c @@ -64,7 +64,7 @@ extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); extern int FUN_L15_002d6770(void); extern float scale_game_frames_float(float) __asm__("FUN_L15_001f8648"); extern int FUN_001fa6d0(float); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int random_integer_below(int) __asm__("FUN_00213260"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); @@ -75,11 +75,11 @@ extern float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern float vector_distance_xy(void *, void *) __asm__("FUN_001f9b80"); extern void set_vector_length_xy(float, void *, void *) __asm__("FUN_001f9c48"); extern void release_voice_slot(int) __asm__("FUN_0022d798"); -extern int FUN_L00_0028d8c0(int, int); -extern int FUN_L00_0028dc90(int, int, int, int); +extern int voice_is_playing(int, int) __asm__("FUN_L00_0028d8c0"); +extern int trooper_play_sound(int, int, int, int) __asm__("FUN_L00_0028dc90"); extern int FUN_L00_0023e738(float, float, float, float, float, void *); extern void FUN_L00_0023e838(int); -extern void FUN_L00_002502f0(void *, int, int, int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); extern int FUN_L11_0030f270(void *); extern int FUN_L00_0020d568(void); extern void FUN_L00_001ff290(void *, void *, void *); @@ -165,7 +165,7 @@ void FUN_L15_002d6810(unsigned char *moby) { int *p; int i; found = 0; active = FUN_L15_002d6770(); - if (FUN_001f9770((char *)data + 0x10)) { + if (fast_dec_timer_s16((char *)data + 0x10)) { DATA_SHORT(0x12) = FUN_001fa6d0(scale_game_frames_float(D_L15_00161BCC * 60.0f)); moby[0x20] = 2; if (DATA_INT(0x84)) { STOP_VOICE(0x80); } @@ -176,9 +176,9 @@ void FUN_L15_002d6810(unsigned char *moby) { } p = (int *)((char *)data + 0x74); if ((unsigned char)moby[0x20] == 2) { - i = 2; do { if (*p != -1) FUN_L00_002502f0(moby_array + *p * 0x100, 0x40, 0x40, 0x40); p++; } while (--i >= 0); + i = 2; do { if (*p != -1) set_moby_color(moby_array + *p * 0x100, 0x40, 0x40, 0x40); p++; } while (--i >= 0); } else { - i = 2; do { color = random_int_between(0x40, 0x7f); if (*p != -1) FUN_L00_002502f0(D_L15_0015FFD8 + *p * 0x100, color, color, color); p++; } while (--i >= 0); + i = 2; do { color = random_int_between(0x40, 0x7f); if (*p != -1) set_moby_color(D_L15_0015FFD8 + *p * 0x100, color, color, color); p++; } while (--i >= 0); } if ((!found || !active) && !random_integer_below(1) && D_L15_00161BD0 == 0.0f) { best = 0; p = (int *)((char *)data + 0x90); i = 16; @@ -217,8 +217,8 @@ next_path: i -= 8; p += 8; if (found && active) { if (DATA_INT(0x84) && DATA_INT(0x84) != (int)hero.moby) { STOP_VOICE(0x14); STOP_VOICE(0x80); } DATA_INT(0x84) = (int)hero.moby; - DATA_INT(0x14) = FUN_L00_0028dc90(0, 4, (int)hero.moby, 0x28f); - DATA_INT(0x80) = FUN_L00_0028dc90(1, 4, (int)hero.moby, 0x28f); + DATA_INT(0x14) = trooper_play_sound(0, 4, (int)hero.moby, 0x28f); + DATA_INT(0x80) = trooper_play_sound(1, 4, (int)hero.moby, 0x28f); if (DATA_INT(0x1c) == 0) { float x = D_L15_0015F448, y = D_L15_0015F44C, z = D_L15_0015F450, w = D_L15_0015F454; DATA_FLOAT(0x50) = x; DATA_FLOAT(0x54) = y; DATA_FLOAT(0x58) = z; DATA_FLOAT(0x5c) = w; @@ -278,9 +278,9 @@ next_target: p++; next_distance = vector_distance_xy(target + 0x10, D_L15_001673C0_6810); if (next_distance < distance) { if (DATA_INT(0x84)) { STOP_VOICE(0x14); STOP_VOICE(0x80); } DATA_INT(0x84) = (int)target; } } - if (!FUN_L00_0028d8c0(DATA_INT(0x84), DATA_INT(0x14))) DATA_INT(0x14) = FUN_L00_0028dc90(0, 5, DATA_INT(0x84), 0x28f); - if ((unsigned char)moby[0x20] == 1 && !FUN_L00_0028d8c0(DATA_INT(0x84), DATA_INT(0x80))) DATA_INT(0x80) = FUN_L00_0028dc90(1, 5, DATA_INT(0x84), 0x28f); - if (FUN_001f9770((char *)data + 0x12) && (unsigned char)moby[0x20] == 2) { RESET_TIMERS(); } + if (!voice_is_playing(DATA_INT(0x84), DATA_INT(0x14))) DATA_INT(0x14) = trooper_play_sound(0, 5, DATA_INT(0x84), 0x28f); + if ((unsigned char)moby[0x20] == 1 && !voice_is_playing(DATA_INT(0x84), DATA_INT(0x80))) DATA_INT(0x80) = trooper_play_sound(1, 5, DATA_INT(0x84), 0x28f); + if (fast_dec_timer_s16((char *)data + 0x12) && (unsigned char)moby[0x20] == 2) { RESET_TIMERS(); } p = (int *)data; i = 3; do { if (*p != -1) { @@ -289,7 +289,7 @@ next_target: p++; if (*p == -1 || !FUN_L11_0030f270(moby_array + *p * 0x100)) goto next_moby; } DATA_SHORT(0x12) = FUN_001fa6d0(scale_game_frames_float(DATA_FLOAT(0x18) * 60.0f)); moby[0x20] = 3; - FUN_L00_0028dc90(2, 0, (int)(D_L15_0015FFD8 + *p * 0x100), 0x28f); DATA_INT(0x8c) = 0; + trooper_play_sound(2, 0, (int)(D_L15_0015FFD8 + *p * 0x100), 0x28f); DATA_INT(0x8c) = 0; } next_moby: p++; } while (--i >= 0); @@ -299,7 +299,7 @@ state_three: { int *p; int i; triggers = (int *)((char *)data + 0x60); p = (int *)((char *)data + 0x74); i = 2; - do { if (*p != -1) FUN_L00_002502f0(moby_array + *p * 0x100, 0x40, 0x40, 0x40); p++; } while (--i >= 0); + do { if (*p != -1) set_moby_color(moby_array + *p * 0x100, 0x40, 0x40, 0x40); p++; } while (--i >= 0); if (DATA_INT(0x120) != -1) { FUN_L00_0023e838(DATA_INT(0x120)); DATA_INT(0x120) = -1; } if (DATA_SHORT(0x12)) enqueue_timer_display(FUN_L15_002d77c0, moby); if (DATA_INT(0x84)) { STOP_VOICE(0x14); STOP_VOICE(0x80); DATA_INT(0x84) = 0; } @@ -313,14 +313,14 @@ state_three: { int interval = scale_game_frames(60); if (timer < limit - interval) { DATA_SHORT(0x12) = FUN_001fa6d0(scale_game_frames_float(DATA_FLOAT(0x18) * 60.0f)); - FUN_L00_0028dc90(2, 0, (int)(D_L15_0015FFD8 + *p * 0x100), 0x28f); ready = 0; + trooper_play_sound(2, 0, (int)(D_L15_0015FFD8 + *p * 0x100), 0x28f); ready = 0; } } } p++; } while (--i >= 0); DATA_INT(0x8c) = ready; - if (!FUN_001f9770((char *)data + 0x12) && !(is_point_inside_clip_volume(&hero.motion.pos, DATA_INT(0x70)) && hero.air_frames.s == 0) && !is_point_inside_clip_volume(&hero.motion.pos, DATA_INT(0x128))) goto finish; + if (!fast_dec_timer_s16((char *)data + 0x12) && !(is_point_inside_clip_volume(&hero.motion.pos, DATA_INT(0x70)) && hero.air_frames.s == 0) && !is_point_inside_clip_volume(&hero.motion.pos, DATA_INT(0x128))) goto finish; p = (int *)data; i = 3; do { if (*p != -1) { other = (char *)(*p * 0x100 + (int)moby_array); if (*(short *)(other + 0xa6) == 0x33e) other[0x20] = 1; else FUN_L15_002d95a0(other); } p++; } while (--i >= 0); RESET_TIMERS(); goto finish; @@ -487,8 +487,8 @@ extern float D_L15_0015F580[] __attribute__((section(".sdata"))); extern float D_L15_001D3B60[]; extern float D_L15_001D39D0[]; extern float FUN_L00_00257c48(float lo, float hi); -extern float FUN_L00_0025e310(float); -extern int FUN_001f9770(void *); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern s32 random_integer_below_c(s32) __asm__("func_00213260"); @@ -564,7 +564,7 @@ void FUN_L15_002d7bb0(Moby *moby) { float pitch; wave = *(float *)&D_L15_00161C0C + (*(float *)&D_L15_00161C10 - *(float *)&D_L15_00161C0C) * (convert_integer_to_float(i) * 0.05f); - wave = wave * fast_sin_c(FUN_L00_0025e310(*(float *)&D_L15_00161C14 + (float)i * *(float *)&D_L15_00161C08)); + wave = wave * fast_sin_c(normalize_angle(*(float *)&D_L15_00161C14 + (float)i * *(float *)&D_L15_00161C08)); wave = wave + FUN_L00_00257c48(*(float *)&D_L15_00161C4C, *(float *)&D_L15_00161C50); D_L15_001D3750[0][i].f[2] = D_L15_001D3750[0][i].f[2] - D_L15_001D39D0[i]; D_L15_001D39D0[i] = wave; @@ -604,9 +604,9 @@ void FUN_L15_002d7bb0(Moby *moby) { float height; float side_angle; float swing; - phase = FUN_L00_0025e310(*(float *)&D_L15_00161C1C + (float)i * *(float *)&D_L15_00161C24); + phase = normalize_angle(*(float *)&D_L15_00161C1C + (float)i * *(float *)&D_L15_00161C24); height = *(float *)&D_L15_00161C28 - * fast_sin_c(FUN_L00_0025e310(*(float *)&D_L15_00161C30 + (float)i * *(float *)&D_L15_00161C38)); + * fast_sin_c(normalize_angle(*(float *)&D_L15_00161C30 + (float)i * *(float *)&D_L15_00161C38)); qcopy(&D_L15_001D3750[1][i], &D_L15_001D3750[0][i]); height = height * fast_sin_c(phase) + FUN_L00_00257c48(0.0f, 0.1f); D_L15_001D3750[1][i].f[2] = D_L15_001D3750[1][i].f[2] + height; @@ -638,7 +638,7 @@ void FUN_L15_002d7bb0(Moby *moby) { qcopy(&vectors[8], &data->b); bend = 0.5f; } - if (FUN_001f9770(D_L15_00161CC0 + k)) { + if (fast_dec_timer_s16(D_L15_00161CC0 + k)) { int j; D_L15_00161CC0[k] = scale_game_frames_alt(D_L15_00161CD0[k]); D_L15_00161CC8[k] = 0; @@ -837,7 +837,7 @@ extern void spark_s(void *, float, void *, int, float, float, int, int, int) __a extern void blast_s(void *, void *, float, float, int) __asm__("FUN_L00_0025f090"); extern void FUN_0022da68_s(int, int, void *) __asm__("FUN_0022da68"); extern void remove_s(void *) __asm__("FUN_0020c828"); -extern void trail_s(void *, float, int, float) __asm__("FUN_L07_0029b8d8"); +extern void FUN_L07_0029b8d8(void *, float, int, float); void FUN_L15_002e4380(unsigned char *m) { char *d = *(char **)(m + 0x78); @@ -867,5 +867,5 @@ void FUN_L15_002e4380(unsigned char *m) { } qcopy(m + 0x10, next); if (D_L15_0015F5CC_s % 3 == 0) - trail_s(m, 30000.0f, 0, 0.1f); + FUN_L07_0029b8d8(m, 30000.0f, 0, 0.1f); } diff --git a/src/overlays/shared/gameplay/entities/ammocrate.c b/src/overlays/shared/gameplay/entities/ammocrate.c index c6d4dd011d..3974fe4fd8 100644 --- a/src/overlays/shared/gameplay/entities/ammocrate.c +++ b/src/overlays/shared/gameplay/entities/ammocrate.c @@ -147,7 +147,8 @@ extern void allocate_voice_for_target_entry_1cc8(int, int, void *) __asm__("FUN_ extern void mark_moby_for_removal_1cc8(void *) __asm__("FUN_0020c828"); extern void FUN_L00_00262b00_1cc8(float, float, void *, void *, void *) __asm__("FUN_L00_00262b00"); -void FUN_L13_002e1cc8(char *moby) { +void ammocrate_update(char *moby) __asm__("FUN_L13_002e1cc8"); +void ammocrate_update(char *moby) { int *vars = *(int **)(moby + 0x78); int hero_moby = ((char *)hero.ship_moby); int hit = 0; @@ -281,7 +282,7 @@ void FUN_L13_002e1cc8(char *moby) { /* Ported from rac1-decomp (src/overlays/shared/vendor_002B8FC0.c: func_L13_002E7E90), where it is exact; names translated to the US level program. */ extern char *FUN_L00_0026daa0(char *, int, int, int, float); -extern void *FUN_002141f8(char *); +extern void *suck_get_aim_height(char *) __asm__("FUN_002141f8"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); void blend_moby_animation(MobyAnim *arg0, int arg1, int arg2, int arg3) __asm__("FUN_00212f90"); void build_spherical_offset_u(f32 *out, f32 scale, f32 a, f32 b) __asm__("FUN_00214db0"); @@ -302,7 +303,7 @@ unsigned char *FUN_L13_002e6a58(char *src, char *pos, char *target, char *vec, i if (target != 0) { char *e; *(int *)(data + 0x3C) = *(short *)(target + 0xA6); - e = FUN_002141f8(target); + e = suck_get_aim_height(target); if (e != 0) { *(unsigned short *)(e + 0x1E) |= 0x80; } @@ -379,7 +380,7 @@ extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); extern void tick_countdown_32(s32 *) __asm__("func_001F9740"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("func_001F9CF8"); float FUN_L00_0025be00(float *cur, float *vel, float target, float lim, float accel, float maxv); -unsigned char *FUN_L00_002712b8(void *pos, float *vec, int s, int a, int col, int n, float x, float y, float z, float w, float pw); +unsigned char *spawn_particle(void *pos, float *vec, int s, int a, int col, int n, float x, float y, float z, float w, float pw) __asm__("FUN_L00_002712b8"); void FUN_L00_0025e450(f32 burst, f32 unused_float, f32 owner_effect, f32 owner_effect2, f32 cutoff, f32 scale, f32 flash, void *owner, s32 unused2, void *pos, s32 puff_count, s32 spark_count, s32 shard_count, s32 sound, s32 shake, s32 spray_count, s32 tint, u8 alternate); extern float func_002140F8_2E8040(float, float) __asm__("FUN_002132a8"); extern void func_L00_001FF4B0_2E8040(void *, void *, float) __asm__("FUN_001f9bf8"); @@ -403,6 +404,7 @@ extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); extern Tex_2E8040 D_L13_001B2680_2E8040 __asm__("D_L13_001B2380"); extern V4_2E8040 D_L13_001741E0_2E8040 __asm__("D_L13_00174160"); +void FUN_L13_002e6c08(Moby *m); void FUN_L13_002e6c08(Moby *m) { Rocket_2E8040 *d = *(void **)&m->pvars; V4_2E8040 old; diff --git a/src/overlays/shared/gameplay/entities/armed_transport.c b/src/overlays/shared/gameplay/entities/armed_transport.c index 6d8344ddbc..475fb67ff0 100644 --- a/src/overlays/shared/gameplay/entities/armed_transport.c +++ b/src/overlays/shared/gameplay/entities/armed_transport.c @@ -44,7 +44,7 @@ extern short D_L16_00161D8C __attribute__((sda)); extern void *FUN_L00_00263fd8(char *, int, float *, void *, int, int, float, float *, float *, float *); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); extern void FUN_L00_00257470(void *, int, int); -extern void FUN_L00_0025e450(void*,void*,void*,float,float,int,int,int,float,float,float,int,float,float,int,int,int,int); +extern void spawn_explosion(void*,void*,void*,float,float,int,int,int,float,float,float,int,float,float,int,int,int,int) __asm__("FUN_L00_0025e450"); extern void FUN_L16_002e2b60(struct Moby *); extern void FUN_L16_002e2fa0(void *); extern void FUN_L16_002e3050(char *); @@ -60,7 +60,8 @@ void FUN_L16_002d3de0(char *moby, int arg); extern int func_0022ED80_update(int, int, void *) __asm__("FUN_0022da68"); extern float func_001F9D10_update(void *, void *) __asm__("FUN_001f9b48"); -void FUN_L16_002e22d8(char *m) { +void armed_transport_update(char *m) __asm__("FUN_L16_002e22d8"); +void armed_transport_update(char *m) { L16TransportVector vector, rotation; char *d = *(char **)(m + 0x78); @@ -222,7 +223,7 @@ void FUN_L16_002e22d8(char *m) { *(float *)(d + 0x194) -= dt + dt; *(float *)(m + 0x40) += dt * 0.2617994f; if (fast_dec_timer((int *)(d + 0x160)) || hero.vehicle_mode == 2) { - FUN_L00_0025e450(m, D_L16_0015F580, m + 0x10, 0.0f, 0.0f, 20, 12, 8, 4.0f, 2.5f, 9.0f, -1, 2.0f, 0.0f, + spawn_explosion(m, D_L16_0015F580, m + 0x10, 0.0f, 0.0f, 20, 12, 8, 4.0f, 2.5f, 9.0f, -1, 2.0f, 0.0f, 0, 0, -1, 0); FUN_L00_00263fd8(m, 0x634, (float *)(m + 0x10), m + 0x40, 0, 0, 0.0f, D_L16_0015F580, D_L16_0015F580, D_L16_0015F580); @@ -255,7 +256,7 @@ typedef struct { char *owner; } L16Slot_e; -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_0022da68_i(int, int, void *) __asm__("FUN_0022da68"); extern void release_voice_slot(int) __asm__("FUN_0022d798"); extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); @@ -263,8 +264,8 @@ extern int hit_reaction(void *, char *, void *, int, int *, float *, int, int) _ extern float randf_sym(float, float) __asm__("FUN_L00_00257c48"); extern void mark_moby_for_removal_u(char *) __asm__("FUN_0020c828"); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); -extern void FUN_L00_0025d458(void *, void *); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *, void *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern void FUN_L00_0025ff38(float, void *, void *, int, int, void *, int); typedef struct { @@ -283,9 +284,9 @@ void FUN_L16_002e2b60(struct Moby *m) { m->scale = m->pclass->scale * D_L16_00161D78_gp; if ((unsigned int)(m->state - 2) < 4) { - if (!FUN_L00_0028d8c0(m, *(int *)(d + 0x190))) + if (!voice_is_playing(m, *(int *)(d + 0x190))) *(int *)(d + 0x190) = FUN_0022da68_i(0, 4, m); - } else if (FUN_L00_0028d8c0(m, *(int *)(d + 0x190))) { + } else if (voice_is_playing(m, *(int *)(d + 0x190))) { int slot = *(int *)(d + 0x190); if (slot != -1) { L16Slot_e *s = (L16Slot_e *)(D_0013E550 + slot * 0x70); @@ -327,10 +328,10 @@ void FUN_L16_002e2b60(struct Moby *m) { *(unsigned char *)(d + 0x67) = 120; } } - FUN_L00_0025d458(m, d + 0x60); + trooper_anim_update(m, d + 0x60); } m->hit_slot = 255; - FUN_L00_0025d538(m, d + 0x60); + trooper_anim_finish(m, d + 0x60); if (*(int *)(d + 0xD0) != -1 && D_001413DC[0] != 22) { char *path = D_L16_001B0930[*(int *)(d + 0xD0)]; FUN_L00_0025ff38(128.0f, m, d + 0x70, 0, 0, path + 0x10, *(int *)path); @@ -416,7 +417,7 @@ void FUN_L16_002e2fa0(void *arg) { /* Ported from rac1-decomp (src/overlays/shared/vendor_002A1B58.c: func_L16_002E44B8), where it is exact; names translated to the US level program. */ -extern void FUN_L00_002628d8(char *, char *, int, float, float); +extern void update_joint_animation(char *, char *, int, float, float) __asm__("FUN_L00_002628d8"); void FUN_L16_002e3050(char *moby) { float ticks = frame_scale_sq; @@ -424,12 +425,12 @@ void FUN_L16_002e3050(char *moby) { float b = ticks * 0.3f; char *data = *(char **)(moby + 0x78); *(float *)(data + 0x144) = *(float *)(data + 0x17C); - FUN_L00_002628d8(moby, data + 0xE0, 2, a, b); + update_joint_animation(moby, data + 0xE0, 2, a, b); } /* Updates a moby effect and advances it when its linked object is ready. */ /* Ported from rac1-decomp (src/overlays/shared/vendor_002A1B58.c: func_L16_002E6B70), where it is exact; names translated to the US level program. */ -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); int FUN_L16_002e5cd0(int idx); extern void FUN_L16_002e58d8_u(void) __asm__("FUN_L16_002e58d8"); extern void FUN_L16_002e5d30_c(int) __asm__("FUN_L16_002e5d30"); @@ -439,7 +440,8 @@ extern int func_0022ED80_6B70(int, int, void *) __asm__("FUN_0022da68"); extern short D_L16_00161E00 __attribute__((sda)); extern short D_L16_00161E04 __attribute__((sda)); extern short D_L16_00161E08 __attribute__((sda)); -void FUN_L16_002e5708(struct Moby *m) { +void grindrail_barrier_update(struct Moby *m) __asm__("FUN_L16_002e5708"); +void grindrail_barrier_update(struct Moby *m) { char *d = (char *)m->pvars; float cycle; int i; @@ -454,7 +456,7 @@ void FUN_L16_002e5708(struct Moby *m) { *(float *)(d + 0xC) = cycle; if (cycle > 1.0f) *(float *)(d + 0xC) = cycle - 1.0f; - if (FUN_L00_0028d8c0(m, *(int *)(d + 0x24)) == 0) { + if (voice_is_playing(m, *(int *)(d + 0x24)) == 0) { *(int *)(d + 0x24) = func_0022ED80_6B70(0, 4, m); } *(float *)(d + 8) = fast_add_rotations(*(float *)(d + 8), *(float *)&D_L16_00161E00 * diff --git a/src/overlays/shared/gameplay/entities/background_ship_1.c b/src/overlays/shared/gameplay/entities/background_ship_1.c index 8d27ad4496..b8b8ff29db 100644 --- a/src/overlays/shared/gameplay/entities/background_ship_1.c +++ b/src/overlays/shared/gameplay/entities/background_ship_1.c @@ -96,8 +96,8 @@ extern float D_L02_00161F80 __attribute__((sda)); extern int D_0015EDF4; extern int D_0015EDFC; extern int stub_printf() __asm__("FUN_001e93b0"); -extern int FUN_001fa6e0(int, int, float); -extern int FUN_L00_0028d8c0(void *, int); +extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern float D_0015ED60; extern float D_L02_0015F580; @@ -118,7 +118,8 @@ void FUN_L02_002ec3f0_c(char *moby) __asm__("FUN_L02_002ec3f0"); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern int func_0022ED80_r(int, int, int) __asm__("FUN_0022da68"); -void FUN_L02_002ec4b8(char *moby) { +void background_ship_1_update(char *moby) __asm__("FUN_L02_002ec4b8"); +void background_ship_1_update(char *moby) { char *d; char *t; int r; @@ -163,7 +164,7 @@ void FUN_L02_002ec4b8(char *moby) { } case 1: qcopy(tv, moby + 0x10); - if (FUN_L00_0028d8c0(moby, *(int *)(d + 0x6C)) == 0) { + if (voice_is_playing(moby, *(int *)(d + 0x6C)) == 0) { *(int *)(d + 0x6C) = func_0022ED80_r(1, 4, (int)moby); } p2 = *(float *)&D_L02_00161F64 * frame_time; @@ -256,7 +257,7 @@ void FUN_L02_002ec4b8(char *moby) { extern char *spawn_spark(void *, void *, void *, int, int, int, int, int, int) __asm__("FUN_00218888"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); -extern int FUN_001fa6e0(int, int, float); +extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern short D_L02_00161F84 __attribute__((sda)); extern short D_L02_00161F88 __attribute__((sda)); @@ -274,7 +275,7 @@ extern short D_L02_00161FB4 __attribute__((sda)); extern short D_L02_00161FB8 __attribute__((sda)); extern short D_L02_00161FBC __attribute__((sda)); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern void random_vector(float *, float, float) __asm__("FUN_L00_00257d78"); extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); @@ -282,7 +283,7 @@ extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); void FUN_L02_002eca30(char *m, void *arg1) { float v10[4], v20[4], v30[4], v40[4], v50[4]; int i; - FUN_001f9a28(v30, m + 0x10, arg1); + fast_vec_sub(v30, m + 0x10, arg1); for (i = 0; i < 3; i++) { int a, b, c, d, e; char *p; @@ -293,9 +294,9 @@ void FUN_L02_002eca30(char *m, void *arg1) { add_vector_xyz(v20, v20, v40); v10[3] = random_float_between(*(float *)&D_L02_00161FA0, *(float *)&D_L02_00161FA4); v20[3] = random_float_between(*(float *)&D_L02_00161FA8, *(float *)&D_L02_00161FAC); - a = FUN_001fa6e0(*(int *)&D_L02_00161FB0, *(int *)&D_L02_00161FB4, + a = fast_tween_color(*(int *)&D_L02_00161FB0, *(int *)&D_L02_00161FB4, random_float_between(0.0f, 1.0f)); - b = FUN_001fa6e0(*(int *)&D_L02_00161FB8, *(int *)&D_L02_00161FBC, + b = fast_tween_color(*(int *)&D_L02_00161FB8, *(int *)&D_L02_00161FBC, random_float_between(0.0f, 1.0f)); c = func_001FA898_r(multiply_global_factor_ed64( (float)*(int *)&D_L02_00161F90 * random_float_between(0.0f, 1.0f) + 1.0f)); @@ -367,7 +368,8 @@ extern void FUN_L02_002ed658_c(char *moby, void *arg) __asm__("FUN_L02_002ed658" s32 allocate_voice_for_bank_entry(s32 entry_index, s32 flags, s32 owner) __asm__("FUN_0022db10"); extern char D_001413F4[]; -void FUN_L02_002ece18(char *moby) { +void background_ship_2_update(char *moby) __asm__("FUN_L02_002ece18"); +void background_ship_2_update(char *moby) { char *d; char *t; int r; @@ -419,7 +421,7 @@ void FUN_L02_002ece18(char *moby) { return; } qcopy(tv, moby + 0x10); - if (FUN_L00_0028d8c0(moby, *(int *)(d + 0x6C)) == 0) { + if (voice_is_playing(moby, *(int *)(d + 0x6C)) == 0) { *(int *)(d + 0x6C) = func_0022ED80_r(1, 4, (int)moby); } p2 = D_L02_00161FC0 * frame_time; @@ -533,7 +535,7 @@ void FUN_L02_002ed420(char *m, void *arg1) { float v10[4], v20[4], v30[4], v40[4], v50[4]; int i; - FUN_001f9a28(v30, m + 0x10, arg1); + fast_vec_sub(v30, m + 0x10, arg1); for (i = 0; i < 2; i++) { int a, b, c, d, e; char *p; @@ -545,9 +547,9 @@ void FUN_L02_002ed420(char *m, void *arg1) { add_vector_xyz(v20, v20, v40); v10[3] = random_float_between(*(float *)&D_L02_00161FF4, *(float *)&D_L02_00161FF8); v20[3] = random_float_between(*(float *)&D_L02_00161FFC, *(float *)&D_L02_00162000); - a = FUN_001fa6e0(*(int *)&D_L02_00162004, *(int *)&D_L02_00162008, + a = fast_tween_color(*(int *)&D_L02_00162004, *(int *)&D_L02_00162008, random_float_between(0.0f, 1.0f)); - b = FUN_001fa6e0(*(int *)&D_L02_0016200C, *(int *)&D_L02_00162010, + b = fast_tween_color(*(int *)&D_L02_0016200C, *(int *)&D_L02_00162010, random_float_between(0.0f, 1.0f)); c = func_001FA898_r(multiply_global_factor_ed64( (float)*(int *)&D_L02_00161FE4 * random_float_between(0.0f, 1.0f) + 1.0f)); @@ -577,7 +579,7 @@ void FUN_L02_002ed658(char *m, void *arg1) { float v10[4], v20[4], v30[4], v40[4], v50[4]; int i; - FUN_001f9a28(v30, m + 0x10, arg1); + fast_vec_sub(v30, m + 0x10, arg1); for (i = 0; i < 2; i++) { int a, b, c, d, e; char *p; @@ -591,9 +593,9 @@ void FUN_L02_002ed658(char *m, void *arg1) { random_float_between(*(float *)&D_L02_00161FF4, *(float *)&D_L02_00161FF8) / 1.5f; v20[3] = random_float_between(*(float *)&D_L02_00161FFC, *(float *)&D_L02_00162000) / 1.5f; - a = FUN_001fa6e0(*(int *)&D_L02_00162020, *(int *)&D_L02_00162024, + a = fast_tween_color(*(int *)&D_L02_00162020, *(int *)&D_L02_00162024, random_float_between(0.0f, 1.0f)); - b = FUN_001fa6e0(*(int *)&D_L02_00162028, *(int *)&D_L02_0016202C, + b = fast_tween_color(*(int *)&D_L02_00162028, *(int *)&D_L02_0016202C, random_float_between(0.0f, 1.0f)); c = func_001FA898_r(multiply_global_factor_ed64( (float)*(int *)&D_L02_00161FE4 * random_float_between(0.0f, 1.0f) + 1.0f)); @@ -620,7 +622,8 @@ extern void FUN_L01_002787a0(void *); extern void FUN_L01_00278e20(void *, int); void mark_moby_for_removal(struct Obj *obj) __asm__("FUN_0020c828"); -void FUN_L02_002f1f60(char *m) { +void white_flower_update(char *m) __asm__("FUN_L02_002f1f60"); +void white_flower_update(char *m) { int hit = 0; char *r = find_moby_hit(m, 0x10000, 0); switch (*(unsigned char *)(m + 0x20)) { @@ -659,6 +662,7 @@ void FUN_L02_002f6570(int value) { extern char *D_L02_00167400_d __asm__("D_L02_00167400") __attribute__((section(".data"))); +void FUN_L02_002f6598(float x, float y, float z); void FUN_L02_002f6598(float x, float y, float z) { char *moby = D_L02_00167400_d; if (*(short *)(moby + 0x86) == 0) { @@ -679,6 +683,7 @@ void FUN_L02_002f6598(float x, float y, float z) { /* stores two coordinate triples in the selected object data */ /* Ported from rac1-decomp (src/overlays/shared/vendor_002A5218.c: func_L02_002F9ED8), where it is exact; names translated to the US level program. */ +void FUN_L02_002f8aa0(float a, float b, float c, float d, float e, float f); void FUN_L02_002f8aa0(float a, float b, float c, float d, float e, float f) { char *moby = D_L02_00167400_d; char *data = *(char **)(moby + 0x70); @@ -870,7 +875,7 @@ extern char D_L02_00167410[] __attribute__((section(".data"))); extern char D_L02_00167280[] __attribute__((section(".data"))); extern float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); -extern float FUN_001f9df8(float); +extern float fast_arc_sin(float) __asm__("FUN_001f9df8"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float FUN_001f99c0(float); @@ -899,14 +904,14 @@ int FUN_L02_002fb788(char *moby, float a, float b) { return 1; } g = D_L02_00167280; - FUN_001f9a28(d, src + 0x10, *(char **)(g + 0x180) + 0x30); + fast_vec_sub(d, src + 0x10, *(char **)(g + 0x180) + 0x30); dot1 = fast_vec_dot(d, (vec + 0x30)); fast_vec_scale(p, (vec + 0x30), dot1); - FUN_001f9a28(q, d, p); + fast_vec_sub(q, d, p); lenq = fast_vec_length(q); dot2 = fast_vec_dot(*(char **)(g + 0x180), (vec + 0x30)); fast_vec_scale(p, (vec + 0x30), dot2); - FUN_001f9a28(r, *(char **)(g + 0x180), p); + fast_vec_sub(r, *(char **)(g + 0x180), p); lenr = fast_vec_length(r); if (b != 0.0f) { float t1 = fast_arc_tan(lenq, dot1); @@ -924,7 +929,7 @@ int FUN_L02_002fb788(char *moby, float a, float b) { if (den == 0.0f) { return 0; } - if (FUN_001f99c0(1.5707964f - FUN_001f9df8(dot3 / den)) < a * DEG_TO_RAD) { + if (FUN_001f99c0(1.5707964f - fast_arc_sin(dot3 / den)) < a * DEG_TO_RAD) { return 1; } return 0; @@ -939,27 +944,27 @@ extern char *D_L02_00167400; extern char *D_L02_0015EF50; extern char *D_0013F64C; extern char D_0013CA44[]; -extern void FUN_L00_002e8388(char *) __asm__("FUN_L00_002e8388"); -extern int FUN_L00_002e83c0(char *) __asm__("FUN_L00_002e83c0"); +extern void FUN_L00_002e8388(char *); +extern int FUN_L00_002e83c0(char *); extern void FUN_L00_002e8450(int, float, float) __asm__("FUN_L00_002e8450"); extern void FUN_L00_002e84b8(float, float) __asm__("FUN_L00_002e84b8"); extern void FUN_L00_002e8568(int) __asm__("FUN_L00_002e8568"); -extern void FUN_L00_002e8590(float, float) __asm__("FUN_L00_002e8590"); -extern void FUN_L00_002e85d8(float, float) __asm__("FUN_L00_002e85d8"); -extern void FUN_L00_002e8620(void) __asm__("FUN_L00_002e8620"); +extern void follow_camera_set_lateral_spring(float, float) __asm__("FUN_L00_002e8590"); +extern void follow_camera_set_up_spring(float, float) __asm__("FUN_L00_002e85d8"); +extern void FUN_L00_002e8620(void); extern void FUN_L00_002e8648(void) __asm__("FUN_L00_002e8648"); extern void FUN_L00_002e8918(float, float, float *) __asm__("FUN_L00_002e8918"); -extern void FUN_L00_002e8970(float, float, void *) __asm__("FUN_L00_002e8970"); +extern void FUN_L00_002e8970(float, float, void *); extern float fast_cos(float) __asm__("FUN_001f9dc8"); -extern float FUN_001f9de0(float); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_001fa580(float, float); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); extern int scale_game_frames(int); extern float absolute_float(float); extern void FUN_L02_002f6570(int); extern void FUN_L02_002f6598(float, float, float); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); int FUN_L02_002fb9c8(char *moby) { char *data = *(char **)(D_L02_0015EF50 + *(short *)(moby + 0x84) * 32 + 0x1c); @@ -1104,7 +1109,7 @@ int FUN_L02_002fb9c8(char *moby) { hit = 1; if ((unsigned short)(*(short *)(data + 0x3c) - 4) < 2) { vec[0] = fast_cos(*(float *)(data + 0x40)); - vec[1] = FUN_001f9de0(*(float *)(data + 0x40)); + vec[1] = fast_sin(*(float *)(data + 0x40)); vec[2] = 0.0f; FUN_L00_002e8918(amount, 0.0f, vec); } else if (*(short *)(data + 0x3c) == 3) { @@ -1129,22 +1134,22 @@ int FUN_L02_002fb9c8(char *moby) { FUN_L00_002e8568(0); FUN_L00_002e8620(); FUN_L00_002e8648(); - FUN_L00_002e85d8(0.01f, 0.2f); + follow_camera_set_up_spring(0.01f, 0.2f); if (*(short *)(data + 0x20) >= scale_game_frames(120)) heading = 0.03f; else heading = ((float)*(short *)(data + 0x20) / convert_integer_to_float(scale_game_frames(120))) * 0.02f + 0.01f; - FUN_L00_002e8590(heading, 0.2f); + follow_camera_set_lateral_spring(heading, 0.2f); } if ((unsigned short)(*(short *)(data + 0x3c) - 4) < 2) { FUN_L00_002e8568(0); FUN_L00_002e8620(); FUN_L00_002e8648(); - FUN_L00_002e85d8(0.02f, 0.2f); + follow_camera_set_up_spring(0.02f, 0.2f); FUN_L00_002e8450(0, 5.84f, 0.003f); if (*(short *)(data + 0x3c) == 4) { float angle; - FUN_001f9a28(vec, target + 0x10, &hero.motion.pos); + fast_vec_sub(vec, target + 0x10, &hero.motion.pos); angle = fast_arc_tan(vec[0], vec[1]); if (hit && fast_difference_between_rotations(angle, *(float *)(data + 0x40)) > 1.9198622f) { if (*(float *)(data + 0x34) != 0.0f) @@ -1182,3 +1187,44 @@ int FUN_L02_002fc298(char *moby) { *(int *)(cam + 0x50) = 0; return 0; } + +s32 D_L02_00167604[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_00167608[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_00167610[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_00167100[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_00167104[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_00167108[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_0016710C[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_00167110[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_00167180[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_00167184[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_00167188[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_0016718C[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_00167190[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_00167400[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_00167404[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_00167408[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_0016740C[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_00167410[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_00167090[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_00167180[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_00167184[1] __attribute__((section(".data"))) = {0}; +f32 D_L09_00167188[1] __attribute__((section(".data"))) = {0}; +f32 D_L09_0016718C[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_00167190[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_00167490[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_00167480[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_00167484[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_00167488[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_0016748C[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_00167490[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_00167600[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_00167604[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_00167608[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0016760C[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_00167610[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_00167400[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_00167404[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_00167408[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_0016740C[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_00167410[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/blarg_commander.c b/src/overlays/shared/gameplay/entities/blarg_commander.c index 02fa23b886..a28f6bd3c5 100644 --- a/src/overlays/shared/gameplay/entities/blarg_commander.c +++ b/src/overlays/shared/gameplay/entities/blarg_commander.c @@ -33,8 +33,8 @@ extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float fast_sqrt(float) __asm__("FUN_001f9988"); -extern void FUN_L00_0025ab48(void *, float *, void *, void *); -extern void FUN_L00_0025c558(float, void *, void *, int, int, int); +extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(float, void *, void *, int, int, int) __asm__("FUN_L00_0025c558"); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); #include "rnc/gameplay/entities/moby.h" @@ -42,7 +42,7 @@ extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); /* Pvars of a lobbed projectile, as set up at launch. */ typedef struct { u8 pad0[0x20]; - Vec4f arc; /* 0x20: filled by FUN_L00_0025c558 */ + Vec4f arc; /* 0x20: filled by trooper_start_knockback */ f32 rise; /* 0x30: D_0015ED70 * 40 */ f32 fall; /* 0x34: D_0015ED70 * 100 */ f32 launch_speed; /* 0x38 */ @@ -89,8 +89,8 @@ void FUN_L12_00308708(void *unused, struct Moby *m) { d->unk3C = fast_sqrt(a * 4.0f); d->unk5D = 0; d->unk44 = 1; - FUN_L00_0025ab48(dir, &ang, &d->launch_speed, &d->unk3C); - FUN_L00_0025c558(ang, m, &d->arc, 1, 5, 2); + trooper_knockback_arc(dir, &ang, &d->launch_speed, &d->unk3C); + trooper_start_knockback(ang, m, &d->arc, 1, 5, 2); d->unk6C = frame_time + frame_time; d->unk70 = -1.0f; d->unk74 = -1.0f; @@ -109,13 +109,14 @@ typedef struct { } MO; extern f32 fast_add_rotations(f32 a, f32 b) __asm__("FUN_001fa580"); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern void func_L00_0025F4A8_alt(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); void mark_moby_for_removal(struct Obj *obj) __asm__("FUN_0020c828"); -void FUN_L12_00308918(char *m) { +void blarg_commander_update(char *m) __asm__("FUN_L12_00308918"); +void blarg_commander_update(char *m) { int st; char *d; char *p; @@ -126,7 +127,7 @@ void FUN_L12_00308918(char *m) { d = *(char **)(m + 0x78); if (st == 1) { p = d + 0x20; - r = FUN_L00_0025c698(m, p); + r = mine_fall(m, p); mo->vx = fast_add_rotations(mo->vx, frame_time * 4.3633232f); mo->vy = fast_add_rotations(mo->vy, frame_time * 4.3633232f); *(unsigned short *)(m + 0x34) &= 0xEFFF; diff --git a/src/overlays/shared/gameplay/entities/blarg_elite_commando.c b/src/overlays/shared/gameplay/entities/blarg_elite_commando.c index 31439e3227..0bc38a23dc 100644 --- a/src/overlays/shared/gameplay/entities/blarg_elite_commando.c +++ b/src/overlays/shared/gameplay/entities/blarg_elite_commando.c @@ -16,9 +16,9 @@ /* Ported from rac1-decomp (src/overlays/shared/vendor_002A1B58.c: func_L16_002A1B58), where it is exact; names translated to the US level program. */ extern char *func_0020D348_m(int); -extern float FUN_001f9b20(void *); +extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); char *FUN_L16_002a09a0(char *owner, float *pos, char *vec) { char *moby = func_0020D348_m(0x31); @@ -35,11 +35,11 @@ char *FUN_L16_002a09a0(char *owner, float *pos, char *vec) { qcopy(moby + 0x10, vec); data = *(char **)(moby + 0x78); qcopy(data, pos); - *(int *)(data + 0x14) = FUN_001f96f8(0xF0); + *(int *)(data + 0x14) = scale_game_frames(0xF0); *(char **)(data + 0x18) = owner; *(int *)(data + 0x10) = 0; *(float *)(moby + 0x48) = fast_arc_tan(pos[0], pos[1]); - a = FUN_001f9b20(pos); + a = vector_length_xy(pos); b = fast_arc_tan(a, pos[2]); *(float *)(moby + 0x44) = -b; moby[0x31] = 0; @@ -57,13 +57,13 @@ extern f32 fast_add_rotations(f32 a, f32 b) __asm__("FUN_001fa580"); extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); extern f32 vector_length_xyz(void *a) __asm__("FUN_001f9af0"); extern float fast_vec_dist(void *) __asm__("FUN_001f9b48"); -extern int FUN_001efa68(void *, void *, int, void *, void *); -extern int FUN_L00_0028dc90(int, int, int, int); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); +extern int trooper_play_sound(int, int, int, int) __asm__("FUN_L00_0028dc90"); extern int tick_countdown_32_alt(int *) __asm__("FUN_001f9740"); extern void lerp_vector(void *, void *, void *, float) __asm__("FUN_001f9a40"); -extern void FUN_L00_002598b0(int, float, void *, int, float, float, int, int, int); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, int, float, float, int, int, int, int); +extern void play_entity_sound(int, float, void *, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L15_0029ae18(char *); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void subtract_vector_xyz(void *out, void *a, void *b) __asm__("FUN_001f9a28"); @@ -71,14 +71,15 @@ void build_spherical_offset(f32 *out, f32 scale, f32 a, f32 b) __asm__("FUN_0021 void mark_moby_for_removal(void *obj) __asm__("FUN_0020c828"); extern float func_001F9D10_2E7198(void *, void *) __asm__("FUN_001f9b48"); -void FUN_L16_002a0a98(char *m) { +void rocket_update(char *m) __asm__("FUN_L16_002a0a98"); +void rocket_update(char *m) { float desired[4], next[4], delta[4], blend[4]; char *d = *(char **)(m + 0x78); void *remaining; float yaw, pitch; if (*(int *)(d + 0x34) == 0 && func_001F9D10_2E7198(m + 0x10, D_L16_001671C0) < 15.0f) { *(int *)(d + 0x34) = 1; - FUN_L00_0028dc90(5, 0, (int)m, 0x54C); + trooper_play_sound(5, 0, (int)m, 0x54C); } if (*(unsigned char *)(m + 0x20) != 0) return; @@ -106,12 +107,12 @@ void FUN_L16_002a0a98(char *m) { *(float *)(m + 0x44) = pitch; } remaining = delta; - if (FUN_001efa68((m + 0x10), next, 0, m, 0) != 0 || + if (collision_line((m + 0x10), next, 0, m, 0) != 0 || vector_length_xyz(remaining) < *(float *)(d + 0x24)) { if (hero.vehicle_mode == 2) - FUN_L00_002598b0((int)m, 2.0f, (m + 0x10), 3, 2.0f, 1.0f, 0, 1, 0); - FUN_L00_0028dc90(4, 0, (int)m, 0x54C); - FUN_L00_0025e450(m, d, (m + 0x10), 4.0f, 4.0f, 10, 3, 16, 4.0f, 2.0f, 9.0f, -1, 1.0f, 15.0f, + play_entity_sound((int)m, 2.0f, (m + 0x10), 3, 2.0f, 1.0f, 0, 1, 0); + trooper_play_sound(4, 0, (int)m, 0x54C); + spawn_explosion(m, d, (m + 0x10), 4.0f, 4.0f, 10, 3, 16, 4.0f, 2.0f, 9.0f, -1, 1.0f, 15.0f, 1, 1, -1, 0); mark_moby_for_removal(m); } else @@ -150,7 +151,7 @@ char *FUN_L16_002a0dc0(char *owner, char *vec, void *pos, void *vel, int c, floa *(float *)(d + 0x2C) = random_float_between_alt(0.0f, y) * DEG_TO_RAD; *(int *)(d + 0x34) = 0; *(float *)(m + 0x48) = fast_arc_tan(*(float *)vec, *(float *)(vec + 4)); - *(float *)(m + 0x44) = -fast_arc_tan(FUN_001f9b20(vec), *(float *)(vec + 8)); + *(float *)(m + 0x44) = -fast_arc_tan(vector_length_xy(vec), *(float *)(vec + 8)); m[0x31] = 0; *(unsigned short *)(m + 0x34) |= 1; } @@ -170,7 +171,7 @@ extern char D_L16_00167240[], D_0013E533[]; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float fast_vec_dist(void *) __asm__("FUN_001f9b48"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_L00_0025be00(float *, float *, float, float, float, float); +extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); extern float approach_value(float *, float, float) __asm__("FUN_00213ed8"); extern float fast_add_rotations(float, float); extern float fast_sin(float); @@ -182,9 +183,9 @@ extern int D_L16_00161A78 __attribute__((sda)); extern int D_L16_00161A7C __attribute__((sda)); extern int D_L16_0015F5C4; extern int D_L16_0016CC90 __attribute__((section(".data"))); -extern int FUN_001f9770(void *); -extern int FUN_L00_0025c698(void *, void *); -extern int FUN_L00_0028d8c0(void *, int); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int is_value_within_interpolated_window(char *, float) __asm__("FUN_00214cc8"); extern int random_integer_below(int) __asm__("FUN_00213260"); extern int scale_game_frames(int); @@ -209,7 +210,8 @@ extern float func_L16_002D5280_update(char *, void *, int) __asm__("FUN_L16_002d extern int func_0022ED80_update(int, int, void *) __asm__("FUN_0022da68"); extern float func_001F9D10_update(void *, void *) __asm__("FUN_001f9b48"); -void FUN_L16_002d2cf0(char *m) { +void blarg_elite_commando_update(char *m) __asm__("FUN_L16_002d2cf0"); +void blarg_elite_commando_update(char *m) { float target[4], temp[4], delta[4]; char *d = *(char **)(m + 0x78); char *source, *owner; @@ -282,7 +284,7 @@ void FUN_L16_002d2cf0(char *m) { } break; case 1: - if (!FUN_001f9770(d + 0x2DC)) { + if (!fast_dec_timer_s16(d + 0x2DC)) { normalize_vector_xyz(temp, m + 0xC0, *(short *)(d + 0x2DC) * 0.1f); add_vector_xyz(temp, temp, m + 0x10); func_L16_002D5280_update(m, temp, 1); @@ -290,7 +292,7 @@ void FUN_L16_002d2cf0(char *m) { heading = (float *)(m + 0x48); angle = fast_arc_tan(*(float *)(d + 0x2B0) - *(float *)(m + 0x10), *(float *)(d + 0x2B4) - *(float *)(m + 0x14)); - FUN_L00_0025be00(heading, (float *)(d + 0x2D8), angle, frame_time_sq * 12.566371f, + approach_angle(heading, (float *)(d + 0x2D8), angle, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, frame_time * 12.566371f); distance = func_L16_002D5280_update(m, d + 0x2B0, 1); if (((unsigned char *)m)[0x53] != 0) @@ -300,7 +302,7 @@ void FUN_L16_002d2cf0(char *m) { } break; case 2: - FUN_001f9770(d + 0x2DC); + fast_dec_timer_s16(d + 0x2DC); if (*(int *)(d + 0x114) != 2) { if (*(short *)(d + 0x2DC) == 0) { if (*(int *)(d + 0x120) >= 0) { @@ -316,7 +318,7 @@ void FUN_L16_002d2cf0(char *m) { } } } - } else if (FUN_001f9770(d + 0x302)) { + } else if (fast_dec_timer_s16(d + 0x302)) { if (*(int *)(d + 0x120) >= 0) { *(short *)(d + 0x300) = (*(short *)(d + 0x300) + 1) % 2; m[0x20] = 3; @@ -334,7 +336,7 @@ void FUN_L16_002d2cf0(char *m) { blend_moby_animation(m, 0, 0, scale_game_frames(10)); *(short *)(d + 0x302) = truncate_float_to_s32(multiply_global_factor_ed64(random_float_between(180.0f, 360.0f))); - } else if (FUN_001f9770(d + 0x302)) { + } else if (fast_dec_timer_s16(d + 0x302)) { m[0x20] = 2; if (((unsigned char *)m)[0x53] != 0) blend_moby_animation(m, 0, 0, scale_game_frames(10)); @@ -352,7 +354,7 @@ void FUN_L16_002d2cf0(char *m) { case 4: heading = (float *)(m + 0x48); angle = fast_arc_tan(target[0] - *(float *)(m + 0x10), target[1] - *(float *)(m + 0x14)); - FUN_L00_0025be00(heading, (float *)(d + 0x2D8), angle, frame_time_sq * 12.566371f, + approach_angle(heading, (float *)(d + 0x2D8), angle, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, frame_time * 12.566371f); if (((unsigned char *)m)[0x70] & 2) { m[0x20] = 5; @@ -364,7 +366,7 @@ void FUN_L16_002d2cf0(char *m) { case 5: heading = (float *)(m + 0x48); angle = fast_arc_tan(target[0] - *(float *)(m + 0x10), target[1] - *(float *)(m + 0x14)); - FUN_L00_0025be00(heading, (float *)(d + 0x2D8), angle, frame_time_sq * 12.566371f, + approach_angle(heading, (float *)(d + 0x2D8), angle, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, frame_time * 12.566371f); if (is_value_within_interpolated_window(m, 2.0f) || is_value_within_interpolated_window(m, 17.0f) || @@ -388,7 +390,7 @@ void FUN_L16_002d2cf0(char *m) { case 7: distance = func_L16_002D5280_update( m, D_L16_001B0930[*(int *)(d + 0x120)] + (*(short *)(d + 0x300) * 16 + 0x10), 1); - FUN_001f9770(d + 0x2DC); + fast_dec_timer_s16(d + 0x2DC); if (distance < 0.01f || *(short *)(d + 0x2DC) == 0) { m[0x20] = 4; if (((unsigned char *)m)[0x53] != 2) @@ -419,7 +421,7 @@ void FUN_L16_002d2cf0(char *m) { movement = temp; position = m + 0x10; qcopy(movement, position); - if (FUN_L00_0025c698(m, d + 0x70) & 0x160) { + if (mine_fall(m, d + 0x70) & 0x160) { FUN_L16_002d41f8_2(m, position); func_0022ED80_update(0, 0, m); mark_moby_for_removal(m); @@ -450,7 +452,7 @@ void FUN_L16_002d2cf0(char *m) { *(float *)(d + 0x2C8) + *(float *)(d + 0x2EC) * fast_sin(*(float *)(d + 0x2E8)); } if (func_001F9D10_update(m + 0x10, D_L16_001671C0) < 32.0f && - !FUN_L00_0028d8c0(m, *(int *)(d + 0x304))) + !voice_is_playing(m, *(int *)(d + 0x304))) *(int *)(d + 0x304) = func_0022ED80_update(7, 4, m); } if (D_L16_00161A78) @@ -535,10 +537,10 @@ extern int FUN_L00_0025fcb8(float, char *, void *); extern int FUN_L00_0025ff38(float, char *, void *, int, int, void *, int); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern void FUN_L00_00257470(void *, int, int); -extern void FUN_L00_0025ab48(void *, float *, void *, void *); -extern void FUN_L00_0025c558(float, void *, void *, int, int, int); -extern void FUN_L00_0025d458(void *, void *); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(float, void *, void *, int, int, int) __asm__("FUN_L00_0025c558"); +extern void trooper_anim_update(void *, void *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern void queue_dialogue_message(int, int) __asm__("FUN_L00_00263d40"); extern void FUN_L16_002d3f78_u(void *, int, int) __asm__("FUN_L16_002d3f78"); extern s32 tick_countdown_32(void *) __asm__("func_001F9740"); @@ -599,9 +601,9 @@ void FUN_L16_002d38b0(struct Moby *m) { scratch.vector = *(OvlQuad *)(hit + 0x10); scratch.angle = heading; } - FUN_L00_0025ab48(&scratch.vector, &scratch.angle, &d->forward_impulse, + trooper_knockback_arc(&scratch.vector, &scratch.angle, &d->forward_impulse, &d->lateral_impulse); - FUN_L00_0025c558(scratch.angle, m, d->knockback, 6, 1, 0); + trooper_start_knockback(scratch.angle, m, d->knockback, 6, 1, 0); m->state = 8; d->animation = 0x78; break; @@ -641,9 +643,9 @@ void FUN_L16_002d38b0(struct Moby *m) { scratch.vector = *(OvlQuad *)(hit + 0x10); scratch.fatal_angle = heading; } - FUN_L00_0025ab48(&scratch.vector, &scratch.fatal_angle, &d->forward_impulse, + trooper_knockback_arc(&scratch.vector, &scratch.fatal_angle, &d->forward_impulse, &d->lateral_impulse); - FUN_L00_0025c558(scratch.fatal_angle, m, d->knockback, 7, 1, 0); + trooper_start_knockback(scratch.fatal_angle, m, d->knockback, 7, 1, 0); m->state = 9; d->animation = 0xF0; FUN_L00_00257470(m, 0, -1); @@ -654,10 +656,10 @@ void FUN_L16_002d38b0(struct Moby *m) { default: break; } - FUN_L00_0025d458(m, d->damage); + trooper_anim_update(m, d->damage); } m->hit_slot = 0xFF; - FUN_L00_0025d538(m, d->damage); + trooper_anim_finish(m, d->damage); tick_countdown_32(&d->pursuit_timer); if (d->reset_timer) { d->pursuit_timer = @@ -697,7 +699,7 @@ void FUN_L16_002d3de0(struct Moby *moby, int arg) { if (moby->state == 10) { moby->state = 1; if (moby->prev_seq != 1) { - blend_moby_animation_u(moby, 1, 0, FUN_001f96f8(0x14)); + blend_moby_animation_u(moby, 1, 0, scale_game_frames(0x14)); } moby->visible = 1; moby->flags &= 0xFFFE; @@ -715,8 +717,8 @@ void FUN_L16_002d3de0(struct Moby *moby, int arg) { extern float fast_vec_dist(void *) __asm__("FUN_001f9b48"); extern float advance_accelerated_scalar(float *, float *, float, float, float, float) __asm__("FUN_00213f38"); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); float FUN_L16_002d3eb8(char *moby, float *target) { @@ -728,9 +730,9 @@ float FUN_L16_002d3eb8(char *moby, float *target) { float vec[4]; zero[0] = 0; advance_accelerated_scalar((float *)zero, (float *)(data + 0x2D4), d, b, b, frame_time * 5.0f); - FUN_001f9a28(vec, target, p); + fast_vec_sub(vec, target, p); fast_vec_normalize(vec, vec, *(float *)(data + 0x2D4)); - FUN_001f9a10(p, p, vec); + fast_vec_add(p, p, vec); return d; } /* Randomize the timers of active mobys in the selected linked group. */ @@ -790,22 +792,22 @@ void FUN_L16_002d4070(char *moby) { float delta = fast_subtract_rotations(angle, *(float *)(moby + 0x48)); if (delta < 0.78539819f && -0.78539819f < delta) { if ((unsigned char)moby[0x53] != 1) { - blend_moby_animation_u(moby, 1, 0, FUN_001f96f8(0x14)); + blend_moby_animation_u(moby, 1, 0, scale_game_frames(0x14)); } } else if (delta < 0.0f) { if (*(unsigned short *)(moby + 0x34) & 0x8000) { if ((unsigned char)moby[0x53] != 4) - blend_moby_animation_u(moby, 4, 0, FUN_001f96f8(0x14)); + blend_moby_animation_u(moby, 4, 0, scale_game_frames(0x14)); } else { if ((unsigned char)moby[0x53] != 5) - blend_moby_animation_u(moby, 5, 0, FUN_001f96f8(0x14)); + blend_moby_animation_u(moby, 5, 0, scale_game_frames(0x14)); } } else if (*(unsigned short *)(moby + 0x34) & 0x8000) { if ((unsigned char)moby[0x53] != 5) - blend_moby_animation_u(moby, 5, 0, FUN_001f96f8(0x14)); + blend_moby_animation_u(moby, 5, 0, scale_game_frames(0x14)); } else { if ((unsigned char)moby[0x53] != 4) - blend_moby_animation_u(moby, 4, 0, FUN_001f96f8(0x14)); + blend_moby_animation_u(moby, 4, 0, scale_game_frames(0x14)); } } /* Spawn randomized hit particles at joint two, with extra bursts for distant hits. */ @@ -889,9 +891,9 @@ void FUN_L16_002d41f8(void *m) { extern char D_L16_00167240[], D_0013F420[]; extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); -extern void FUN_001f9cf8(void *, void *, void *); +extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); -extern void FUN_L00_002628d8(char *, char *, int, float, float); +extern void update_joint_animation(char *, char *, int, float, float) __asm__("FUN_L00_002628d8"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void normalize_vector_xyz(void *out, void *a, f32 len) __asm__("FUN_001f9bf8"); @@ -910,7 +912,7 @@ void FUN_L16_002d4590(char *m) { savedTarget = target; transpose_rotation_matrix(matrix, m + 0xC0); subtract_vector_xyz(delta, savedTarget, position); - FUN_001f9cf8(delta, delta, matrix); + transform_vector_by_basis(delta, delta, matrix); yaw = fast_arc_tan(delta[0], delta[1]); pitch = -fast_arc_tan(vector_length_xy(delta), delta[2]); if (yaw > 0.7853982f) @@ -936,7 +938,7 @@ void FUN_L16_002d4590(char *m) { add_vector_xyz(aim, aim, velocity); subtract_vector_xyz(aimDelta, savedTarget, aim); savedMatrix = matrix; - FUN_001f9cf8(aimDelta, aimDelta, savedMatrix); + transform_vector_by_basis(aimDelta, aimDelta, savedMatrix); pitch2 = -fast_arc_tan(vector_length_xy(aimDelta), aimDelta[2]); yaw2 = -fast_arc_tan(aimDelta[0], aimDelta[1]); bound = 0.7853982f; @@ -950,9 +952,9 @@ void FUN_L16_002d4590(char *m) { *(float *)(d + 0x298) = yaw2; } } - FUN_L00_002628d8(m, d + 0x130, 1, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f); - FUN_L00_002628d8(m, d + 0x1B0, 2, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f); - FUN_L00_002628d8(m, d + 0x230, 3, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f); + update_joint_animation(m, d + 0x130, 1, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f); + update_joint_animation(m, d + 0x1B0, 2, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f); + update_joint_animation(m, d + 0x230, 3, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f); } /* Emit randomized joint particles while the moby is active. */ /* Ported from rac1-decomp (src/overlays/shared/vendor_002A1B58.c: func_L16_002D5CD0), where it is exact; names translated to the US level program. */ diff --git a/src/overlays/shared/gameplay/entities/blarg_helicopter.c b/src/overlays/shared/gameplay/entities/blarg_helicopter.c index 1b480f24a0..46d54eb2f0 100644 --- a/src/overlays/shared/gameplay/entities/blarg_helicopter.c +++ b/src/overlays/shared/gameplay/entities/blarg_helicopter.c @@ -37,10 +37,10 @@ void FUN_L03_00291918(char *moby) { extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); -extern void FUN_L00_002502f0(void *, int, int, int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); extern void FUN_L00_00262cf0(void *, void *, float, float, float); void mark_moby_for_removal(struct Obj *obj) __asm__("FUN_0020c828"); extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); @@ -52,7 +52,7 @@ void FUN_L03_002bae48(char *moby) { int c; int g; int b; - if (FUN_001f9770(p + 0xE)) { + if (fast_dec_timer_s16(p + 0xE)) { mark_moby_for_removal(moby); return; } @@ -70,7 +70,7 @@ void FUN_L03_002bae48(char *moby) { c = fast_tween_color(*(int *)(p + 8), *(int *)(p + 4), ratio); b = (c >> 16) & 0xFF; g = (c >> 8) & 0xFF; - FUN_L00_002502f0(moby, c & 0xFF, g, b); + set_moby_color(moby, c & 0xFF, g, b); moby[0x23] = func_001FA898_r(ratio * 128.0f); *(float *)(moby + 0x2C) = *(float *)(moby + 0x2C) * (frame_scale * 0.019999981f + 1.0f); } @@ -78,7 +78,7 @@ void FUN_L03_002bae48(char *moby) { extern char *D_L03_001600EC; extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); int FUN_L03_002beba0(int idx, float *out) { @@ -89,7 +89,7 @@ int FUN_L03_002beba0(int idx, float *out) { out[1] = random_float_between_alt(-1.0f, 1.0f); out[2] = random_float_between_alt(-1.0f, 1.0f); transform_vector_by_basis(out, out, mat); - FUN_001f9a10(out, out, mat + 0x30); + fast_vec_add(out, out, mat + 0x30); return 0; } return 1; @@ -141,7 +141,7 @@ extern char D_L03_001E2FA0[]; extern void set_moby_animation(struct Moby *, s32, s32) __asm__("FUN_00212ed8"); extern SpawnTarget *FUN_L00_002db890(struct Moby *); extern void FUN_L00_0025d1b8(struct Moby *); -extern SpawnSound *FUN_002141f8(struct Moby *); +extern SpawnSound *suck_get_aim_height(struct Moby *) __asm__("FUN_002141f8"); extern void debug_print() __asm__("FUN_001e93b0"); /* Spawner: revives the first free pooled child (of class oclass, -1 = any) at a copy of at, counts the live children, returns the revived one or NULL. */ @@ -231,7 +231,7 @@ struct Moby *FUN_L03_002bec60(struct Moby *m, Vec4 *at, s32 oclass) FUN_L00_0025d1b8(c); FUN_L00_00250df8(c); spawned = c; - sound = FUN_002141f8(spawned); + sound = suck_get_aim_height(spawned); if (sound != NULL) { sound->unk34 = 0; sound->unk30 = 0; @@ -337,7 +337,8 @@ extern float frame_time_sq_macro __asm__("D_0015ED70") __attribute__((section(". extern f32 frame_scale_macro __asm__("D_0015ED60") __attribute__((section(".sdata"))); /* Update of moby class 455 (spawner): counts its living children, takes hits, runs its state machine and spawns class 0x221 children at a point picked by its mode. */ -void FUN_L03_002bef68(struct Moby *moby) { +void spawner_update(struct Moby *moby) __asm__("FUN_L03_002bef68"); +void spawner_update(struct Moby *moby) { int used[4]; Vec4A_2bef68 v30; Vec4A_2bef68 v40; @@ -663,7 +664,7 @@ void FUN_L03_002bef68(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/shared/vendor_00292AC0.c: func_L03_002C59A0), where it is exact; names translated to the US level program. */ extern char *func_0020D348_m(int); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void FUN_L00_00250df8(void *); extern char *func_0020D348_m_2C59A0(int) __asm__("FUN_0020c4f8"); @@ -679,7 +680,7 @@ char *FUN_L03_002c45d8(char *owner, float *pos, float *dir, short ang, int arg) *(float *)(m + 0x40) = random_float_between_alt(-3.1415927f, 3.1415927f); *(float *)(m + 0x44) = random_float_between_alt(-3.1415927f, 3.1415927f); *(int *)(d + 0x18) = 0; - *(short *)(d + 0x14) = FUN_001f96f8(500); + *(short *)(d + 0x14) = scale_game_frames(500); *(short *)(d + 0x16) = ang; *(unsigned char *)(m + 0x30) = (*(unsigned char **)(d + 0x10))[0x30]; *(unsigned short *)(m + 0x32) = *(unsigned short *)(*(char **)(d + 0x10) + 0x32); @@ -692,24 +693,24 @@ char *FUN_L03_002c45d8(char *owner, float *pos, float *dir, short ang, int arg) } return m; } -extern int FUN_001f9740(int *); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9bf8(void *, void *, float); -extern void FUN_001f9a28(void *, void *, void *); +extern int fast_dec_timer(int *) __asm__("FUN_001f9740"); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void FUN_L00_001ff660(void *, void *, void *); -extern float FUN_001f9b20(void *); -extern float FUN_001f9e90(float, float); -extern int FUN_001f0b58(void); -extern void FUN_001f9a68(void *, void *, float); -extern float FUN_001f9af0(void *); -extern int FUN_001efa68(void *, void *, int, void *, void *); +extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); +extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern int FUN_0022da68(int, int, void *); -extern int FUN_001f9770(void *); -extern float FUN_L00_0025e310(float); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern float probe_ground_height(void *, int, float) __asm__("FUN_00213508"); extern float FUN_002132a8(float, float); -extern void FUN_L00_00259fe8(void *, float); +extern void jet_animate(void *, float) __asm__("FUN_L00_00259fe8"); extern void FUN_0020c828(void *); extern CollisionHit D_L03_00173F40 __attribute__((section(".data"))); @@ -730,14 +731,14 @@ void FUN_L03_002c4718(struct Moby *moby) vars = (float *)moby->pvars; if (vars == NULL) return; pos = (Vec4 *)&moby->pos; - FUN_001f9740(vars + 8); + fast_dec_timer(vars + 8); qcopy(&old_pos, pos); switch (moby->state) { case 0: { moby->scale += (moby->pclass->scale - moby->scale) * (frame_scale * 0.05f); - FUN_001f9a10(pos, pos, vars); - FUN_001f9bf8(&next_pos, vars, 0.2f); - FUN_001f9a10(&next_pos, &next_pos, pos); + fast_vec_add(pos, pos, vars); + fast_vec_normalize(&next_pos, vars, 0.2f); + fast_vec_add(&next_pos, &next_pos, pos); old_disable = moby->collision_disable; old_collision = moby->collision; old_owner_disable = (*(struct Moby **)(vars + 4))->collision_disable; @@ -746,25 +747,25 @@ void FUN_L03_002c4718(struct Moby *moby) (*(struct Moby **)(vars + 4))->collision_disable = -1; moby->collision = 0; (*(struct Moby **)(vars + 4))->collision = 0; - if (FUN_001efa68(&old_pos, &next_pos, 4, moby, 0)) { - FUN_001f9a28(&next_pos, &D_L03_00173F40.point, &next_pos); - FUN_001f9bf8(&next_pos, &next_pos, 0.215f); - FUN_001f9a10(pos, pos, &next_pos); + if (collision_line(&old_pos, &next_pos, 4, moby, 0)) { + fast_vec_sub(&next_pos, &D_L03_00173F40.point, &next_pos); + fast_vec_normalize(&next_pos, &next_pos, 0.215f); + fast_vec_add(pos, pos, &next_pos); if (D_L03_00173F40.moby == 0) { FUN_L00_001ff660(vars, vars, &D_L03_00173F40.normal_x); - angle = FUN_001f9b20(&D_L03_00173F40.normal_x); - if (FUN_001f9e90(D_L03_00173F40.normal_z, angle) < 0.6981317f && FUN_001f0b58() == -1) { - FUN_001f9a68(vars, vars, 0.5f); - if (FUN_001f9af0(vars) < 0.025f) { + angle = vector_length_xy(&D_L03_00173F40.normal_x); + if (fast_arc_tan(D_L03_00173F40.normal_z, angle) < 0.6981317f && collision_hit_material() == -1) { + fast_vec_scale(vars, vars, 0.5f); + if (fast_vec_length(vars) < 0.025f) { moby->state = 1; goto first_collision_timer; } } } else if (((struct Moby *)D_L03_00173F40.moby)->oclass != 0x221) { FUN_L00_001ff660(vars, vars, &D_L03_00173F40.normal_x); - angle = FUN_001f9b20(&D_L03_00173F40.normal_x); - if (FUN_001f9e90(D_L03_00173F40.normal_z, angle) < 0.6981317f && FUN_001f0b58() == -1) - FUN_001f9a68(vars, vars, 1.2f); + angle = vector_length_xy(&D_L03_00173F40.normal_x); + if (fast_arc_tan(D_L03_00173F40.normal_z, angle) < 0.6981317f && collision_hit_material() == -1) + fast_vec_scale(vars, vars, 1.2f); } else { vars[2] *= FUN_002132a8(0.9f, 1.1f); } @@ -775,21 +776,21 @@ void FUN_L03_002c4718(struct Moby *moby) } } if (coll_sphere(0.2f, (Vec4 *)&moby->pos, 4, moby)) { - FUN_001f9a28(&next_pos, &D_L03_00173F40.point, &D_L03_00173F40.pad30); - FUN_001f9bf8(&next_pos, &next_pos, 0.015f); - FUN_001f9a10((Vec4 *)&moby->pos, &D_L03_00173F40.pad30, &next_pos); + fast_vec_sub(&next_pos, &D_L03_00173F40.point, &D_L03_00173F40.pad30); + fast_vec_normalize(&next_pos, &next_pos, 0.015f); + fast_vec_add((Vec4 *)&moby->pos, &D_L03_00173F40.pad30, &next_pos); if (D_L03_00173F40.moby == 0) { FUN_L00_001ff660(vars, vars, &D_L03_00173F40.normal_x); - angle = FUN_001f9b20(&D_L03_00173F40.normal_x); - if (FUN_001f9e90(D_L03_00173F40.normal_z, angle) < 0.6981317f && FUN_001f0b58() == -1) { - FUN_001f9a68(vars, vars, 0.5f); - if (FUN_001f9af0(vars) < 0.025f) moby->state = 1; + angle = vector_length_xy(&D_L03_00173F40.normal_x); + if (fast_arc_tan(D_L03_00173F40.normal_z, angle) < 0.6981317f && collision_hit_material() == -1) { + fast_vec_scale(vars, vars, 0.5f); + if (fast_vec_length(vars) < 0.025f) moby->state = 1; } } else if (((struct Moby *)D_L03_00173F40.moby)->oclass != 0x221) { FUN_L00_001ff660(vars, vars, &D_L03_00173F40.normal_x); - angle = FUN_001f9b20(&D_L03_00173F40.normal_x); - if (FUN_001f9e90(D_L03_00173F40.normal_z, angle) < 0.6981317f && FUN_001f0b58() == -1) - FUN_001f9a68(vars, vars, 1.2f); + angle = vector_length_xy(&D_L03_00173F40.normal_x); + if (fast_arc_tan(D_L03_00173F40.normal_z, angle) < 0.6981317f && collision_hit_material() == -1) + fast_vec_scale(vars, vars, 1.2f); } else { vars[2] *= FUN_002132a8(0.9f, 1.1f); } @@ -800,17 +801,17 @@ void FUN_L03_002c4718(struct Moby *moby) } for (other = D_L03_0015FFE4; other != NULL; other = other->next) { if (other == moby || (int)other == 0 || other->state == 0xfe || other->state == 0xfd) continue; - FUN_001f9a28(&delta, (Vec4 *)&moby->pos, &other->pos); + fast_vec_sub(&delta, (Vec4 *)&moby->pos, &other->pos); delta.f[2] = 0.0f; - distance = FUN_001f9af0(&delta); + distance = fast_vec_length(&delta); if (distance < 1.8f) { - FUN_001f9a68(&delta, &delta, (1.8f - distance) * (frame_scale * -0.5f + 1.0f)); - FUN_001f9a10((Vec4 *)&moby->pos, (Vec4 *)&moby->pos, &delta); + fast_vec_scale(&delta, &delta, (1.8f - distance) * (frame_scale * -0.5f + 1.0f)); + fast_vec_add((Vec4 *)&moby->pos, (Vec4 *)&moby->pos, &delta); } } - if (FUN_001f9770(vars + 5)) moby->state = 2; - moby->rot.x = FUN_L00_0025e310(vars[0]); - moby->rot.y = FUN_L00_0025e310(vars[1]); + if (fast_dec_timer_s16(vars + 5)) moby->state = 2; + moby->rot.x = normalize_angle(vars[0]); + moby->rot.y = normalize_angle(vars[1]); moby->collision_disable = old_disable; (*(struct Moby **)(vars + 4))->collision_disable = old_owner_disable; moby->collision = old_collision; @@ -845,7 +846,7 @@ void FUN_L03_002c4718(struct Moby *moby) } } } - FUN_L00_00259fe8(moby, moby->scale * 0.3f / moby->pclass->scale); + jet_animate(moby, moby->scale * 0.3f / moby->pclass->scale); if (moby->pos.z < 5.0f || moby->pos.z > 500.0f) { remove_moby: FUN_0020c828(moby); @@ -940,8 +941,8 @@ extern float D_0015ED6C; extern float D_0015ED70; extern float D_L03_0015F580_macro[] __asm__("D_L03_0015F580") __attribute__((section(".sdata"))); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9e90(float, float); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern int D_0014C050; /* no foreign declaration */ extern int D_0015ED68_e[] __asm__("D_0015ED68") __attribute__((section(".sdata"))); extern float D_L03_00161994 __attribute__((sda)); /* no foreign declaration */ @@ -959,7 +960,7 @@ extern void FUN_L00_001ff290(void *, void *, void *); extern void FUN_L00_0024f7c8(void *, int, void *); extern void FUN_L00_00257470(void *, int, int); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_002628d8_c(char *, char *, int, float, float) __asm__("FUN_L00_002628d8"); extern void FUN_L00_00263fd8(void *, int, void *, void *, int, int, float, void *, void *, void *); extern void RaiseKernelTrap(); @@ -982,7 +983,7 @@ void FUN_L03_002ce238_c(char *m) __asm__("FUN_L03_002ce238"); extern int D_L03_001BA5D0[] __asm__("D_L03_001BA5D0"); extern HPath49_2CDDC8 *D_L03_001B08B0_2CDDC8[] __asm__("D_L03_001B05B0"); extern unsigned char D_0014171B_2CDDC8[] __asm__("D_0014C050"); -extern int helicopter_target49_2CDDC8(void*,void*,float) __asm__("FUN_L03_0024e830"); +extern int FUN_L03_0024e830_c(void*,void*,float) __asm__("FUN_L03_0024e830"); extern void func_L00_00264BB0_2CDDC8(void*,float) __asm__("FUN_L00_00263b38"); extern void func_L00_00263950_2CDDC8(char*,char*,int,float,float) __asm__("FUN_L00_002628d8"); extern void func_L03_002CF600_2CDDC8(char*) __asm__("FUN_L03_002ce238"); @@ -1034,14 +1035,15 @@ extern char D_L03_00166EC0[]; extern void func_L00_0025B178_2CDDC8(void *) __asm__("FUN_L00_0025a120"); extern void func_L00_00251E30_2CDDC8(void *) __asm__("FUN_L00_00250df8"); -void FUN_L03_002cca00(HMob49_2CDDC8 *moby) { +void blarg_helicopter_update(HMob49_2CDDC8 *moby) __asm__("FUN_L03_002cca00"); +void blarg_helicopter_update(HMob49_2CDDC8 *moby) { HData49_2CDDC8 *data=moby->data; HWork49_2CDDC8 work; float target_range=40.0f; float motion_scale,motion_gain; int index; if (data->timer) target_range=80.0f; - helicopter_target49_2CDDC8(moby,&work.target,target_range); + FUN_L03_0024e830_c(moby,&work.target,target_range); index=(short)moby->pool_index; if ((D_L03_001BA5D0[index>>5]>>(moby->pool_index&31))&1) { if (data->child_index!=-1) func_0020D678_2CDDC8((HMob49_2CDDC8*)(D_L03_0015FFD8_c+(data->child_index<<8))); @@ -1312,14 +1314,14 @@ void FUN_L03_002cca00(HMob49_2CDDC8 *moby) { extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern f32 fast_subtract_rotations(f32, f32) __asm__("func_001FA5C8"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_cos(float) __asm__("func_001F9DC8"); extern float fast_sin(float) __asm__("func_001F9DE0"); extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); extern int hit_reaction(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_L00_0025a478"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); float absolute_float(float input) __asm__("func_001F99C0"); void FUN_L03_002ce238(char *m) { @@ -1340,9 +1342,9 @@ void FUN_L03_002ce238(char *m) { *(unsigned char *)(m + 0x20) = 5; } else if (res != 0xB) { *(unsigned char *)(d + 0x67) = 0xB4; - FUN_L00_0025d458(m, (short *)(d + 0x60)); + trooper_anim_update(m, (short *)(d + 0x60)); if (*(float *)(r + 0x1C) == 5627.925f && *(unsigned char *)(m + 0x20) != 4) { - a = FUN_001f9e90(*(float *)(m + 0x10) - *(float *)(r + 0), + a = fast_arc_tan(*(float *)(m + 0x10) - *(float *)(r + 0), *(float *)(m + 0x14) - *(float *)(r + 4)); b = fast_subtract_rotations(a, *(float *)(m + 0x48)); p = fast_cos(b) * 0.08726646f; @@ -1364,7 +1366,7 @@ void FUN_L03_002ce238(char *m) { } } *(unsigned char *)(m + 0xA4) = 0xFF; - FUN_L00_0025d538(m, d + 0x60); + trooper_anim_finish(m, d + 0x60); } #include "sda.h" @@ -1393,7 +1395,8 @@ extern void FUN_L00_00263fd8(void *, int, void *, void *, int, int, float, void extern void FUN_L01_002787a0(void *); void mark_moby_for_removal_c(struct Obj *obj) __asm__("FUN_0020c828"); -void FUN_L03_002d3cd8(unsigned char *m) { +void statue_update(unsigned char *m) __asm__("FUN_L03_002d3cd8"); +void statue_update(unsigned char *m) { int flag = 0; float z; char *p, *pos, *vel; @@ -1474,10 +1477,10 @@ extern float D_0015ED6C_c __asm__("D_0015ED6C") __attribute__((section(".sdata") extern float D_L03_00161B30 __attribute__((sda)); extern float FUN_L00_0025bc00(float *, int, float, float); extern float fast_difference_between_rotations_c(float, float) __asm__("func_001FA688"); -extern int FUN_001efa68(void *, void *, int, void *, void *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); extern int collect_mobies_in_sphere(float, void *, int, void *, void *) __asm__("FUN_L00_001f2868"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int allocate_voice_for_target_entry_alt(int, int, int) __asm__("FUN_0022da68"); extern void FUN_L00_001ff660(void *, void *, void *); extern void FUN_L00_00259888(void *, void *, int, float, void *); @@ -1538,18 +1541,18 @@ void FUN_L03_002d47c0(Moby *moby) { } else if (data->vel.z < -max_climb) { data->vel.z = -max_climb; } - heading = FUN_001f9e90(data->vel.x, data->vel.y); - if (fast_difference_between_rotations_c(heading, FUN_001f9e90(target_info.pos.x - moby->pos.x, target_info.pos.y - moby->pos.y)) < 1.5707964f) { - FUN_L00_0025bc00(&heading, 0, FUN_001f9e90(target_info.pos.x - moby->pos.x, target_info.pos.y - moby->pos.y), D_L03_00161B30 * 0.017453292f * D_0015ED6C_c); + heading = fast_arc_tan(data->vel.x, data->vel.y); + if (fast_difference_between_rotations_c(heading, fast_arc_tan(target_info.pos.x - moby->pos.x, target_info.pos.y - moby->pos.y)) < 1.5707964f) { + FUN_L00_0025bc00(&heading, 0, fast_arc_tan(target_info.pos.x - moby->pos.x, target_info.pos.y - moby->pos.y), D_L03_00161B30 * 0.017453292f * D_0015ED6C_c); data->vel.x = fast_cos_c2(heading) * vector_length_xy(data); data->vel.y = fast_sin_c2(heading) * vector_length_xy(data); } add_vector_xyz(&moby->pos, &moby->pos, data); - target_distance = FUN_001f9b80(&moby->pos, &data->target->pos); + target_distance = vector_distance(&moby->pos, &data->target->pos); if (voice_slot != 0) { int voice = *voice_slot; if (data->target->pos.z - target_info.pos.z < target_distance) { - if (FUN_L00_0028d8c0(data->target, voice) == 0) { + if (voice_is_playing(data->target, voice) == 0) { *voice_slot = allocate_voice_for_target_entry_alt(0, 4, (int)data->target); } } else { @@ -1596,7 +1599,7 @@ void FUN_L03_002d47c0(Moby *moby) { add_vector_xyz(&spark_dir, &spark_dir, &spark_vel); normalize_vector_xyz(&tracer_vel, &tracer_vel, D_0015ED6C_c * 100.0f); FUN_L03_00260130(data->target, &spark_vel, &spark_dir, &tracer_vel, scale_game_frames_alt(0x2D)); - if (FUN_001efa68(&muzzle, &ray_end, 0, data->target, 0) != 0) { + if (collision_line(&muzzle, &ray_end, 0, data->target, 0) != 0) { qcopy(&muzzle, &coll_hit); normalize_vector_xyz(&aim, &aim, D_0015ED6C_c * 10.0f); for (j = 0; j < 10; j++) { @@ -1613,13 +1616,13 @@ void FUN_L03_002d47c0(Moby *moby) { } normalize_vector_xyz(&aim, &aim, -1.0f); add_vector_xyz(&ray_end, &muzzle, &aim); - if (FUN_001efa68(&muzzle, &ray_end, 0x10, data->target, &hit) != 0 && D_L03_00173F58 != 0 + if (collision_line(&muzzle, &ray_end, 0x10, data->target, &hit) != 0 && D_L03_00173F58 != 0 && (D_L03_00173F58 == ((Hero *)(D_0013E533 + 0xE1D))->moby || D_L03_00173F58->oclass == 0x1DF)) { moby->state = 2; } qcopy(&ray_end, &muzzle); ray_end.z += 2.0f; - if (FUN_001efa68(&muzzle, &ray_end, 0x10, data->target, &hit) != 0 && D_L03_00173F58 != 0 + if (collision_line(&muzzle, &ray_end, 0x10, data->target, &hit) != 0 && D_L03_00173F58 != 0 && (D_L03_00173F58 == ((Hero *)(D_0013E533 + 0xE1D))->moby || D_L03_00173F58->oclass == 0x1DF)) { moby->state = 2; } @@ -1712,7 +1715,8 @@ extern float atan_2dc310(float, float) __asm__("FUN_001f9e90"); extern float rotdiff_2dc310(float, float) __asm__("FUN_001fa688"); extern void FUN_0020c828(void *); -void FUN_L03_002dc310(char *m) { +void fred_1_update(char *m) __asm__("FUN_L03_002dc310"); +void fred_1_update(char *m) { float v[12]; /* unused; sets the frame size */ FUN_001f9b48(m + 0x10, hero.motion.pos.f); rotdiff_2dc310(atan_2dc310(hero.motion.pos.f[0] - *(float *)(m + 0x10), @@ -1782,31 +1786,32 @@ extern char D_L03_00166EC0[]; extern char D_L03_001E3628[], D_L03_001E3660[], D_L03_001E3690[]; extern unsigned char D_0015EDB0_b __asm__("D_0015EDB0"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9af0(void *); -extern float FUN_001f9b20(void *); -extern float FUN_001f9e90(float, float); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); +extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); -extern float FUN_001fa5c8(float, float); +extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); -extern int FUN_001f96f8(int); -extern int FUN_001f9740(int *); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); +extern int fast_dec_timer(int *) __asm__("FUN_001f9740"); extern int FUN_001fa6d0(float); extern float FUN_001f9b48(void *, void *); extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); extern void debug_print(void *) __asm__("FUN_001e93b0"); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void build_spherical_offset(void *, float, float, float) __asm__("FUN_00214db0"); extern void FUN_0020c828(void *); extern void FUN_L00_0025a120(void *); extern void FUN_L00_00266858(void *, int); -extern void FUN_L00_002628d8(float, float, void *, void *, int); +extern void update_joint_animation(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); extern void FUN_L01_002fb4b8(void *); /* Activate the watcher and steer its body and head toward the player. */ -void FUN_L03_002dc478(L03WatchMoby *m) { +void qwark_rilgar_update(L03WatchMoby *m) __asm__("FUN_L03_002dc478"); +void qwark_rilgar_update(L03WatchMoby *m) { L03WatchScratch scratch; L03WatchData *d = (L03WatchData *)m->data; float rate; @@ -1856,27 +1861,27 @@ void FUN_L03_002dc478(L03WatchMoby *m) { char *g = (char *)&hero.motion.pos; L03Player *q; tracking = 1; - if (FUN_001f9b80(m->position, g) < 8.0f && + if (vector_distance(m->position, g) < 8.0f && (q = (L03Player *)(g - 0x80), fast_difference_between_rotations( - m->yaw, FUN_001f9e90(q->aim[0] - m->position[0], q->aim[1] - m->position[1]))) < + m->yaw, fast_arc_tan(q->aim[0] - m->position[0], q->aim[1] - m->position[1]))) < 1.5707964f) { - if (FUN_001f9af0(g + 0x80) > 0.01f) - d->moving_timer = FUN_001f96f8(120); + if (fast_vec_length(g + 0x80) > 0.01f) + d->moving_timer = scale_game_frames(120); else - FUN_001f9740(&d->moving_timer); + fast_dec_timer(&d->moving_timer); } else if (d->moving_timer) { d->moving_timer = 0; qcopy(d->target, hero.motion.unkD0.f); } - if (FUN_001f9740(&d->target_timer)) { + if (fast_dec_timer(&d->target_timer)) { float heading; d->target_timer = FUN_001fa6d0(multiply_global_factor_ed64(random_float_between(180.0f, 300.0f))); heading = fast_add_rotations(m->yaw, random_float_between(-90.0f, 90.0f) * DEG_TO_RAD); build_spherical_offset(d->target, 6.0f, heading, random_float_between(0.0f, 30.0f) * DEG_TO_RAD); - FUN_001f9a10(d->target, d->target, m->position); + fast_vec_add(d->target, d->target, m->position); } if (d->moving_timer) { qcopy(scratch.target, hero.motion.unkD0.f); @@ -1891,9 +1896,9 @@ void FUN_L03_002dc478(L03WatchMoby *m) { float pitch; qcopy(scratch.eye, m->position); scratch.eye[2] += 1.0f; - FUN_001f9a28(scratch.delta, scratch.target, scratch.eye); - yaw = FUN_001fa5c8(FUN_001f9e90(scratch.delta[0], scratch.delta[1]), m->yaw); - pitch = -FUN_001f9e90(FUN_001f9b20(scratch.delta), scratch.delta[2]); + fast_vec_sub(scratch.delta, scratch.target, scratch.eye); + yaw = fast_subtract_rotations(fast_arc_tan(scratch.delta[0], scratch.delta[1]), m->yaw); + pitch = -fast_arc_tan(vector_length_xy(scratch.delta), scratch.delta[2]); if (yaw > 1.5707964f) yaw = 1.5707964f; else if (yaw < -1.5707964f) @@ -1908,8 +1913,8 @@ void FUN_L03_002dc478(L03WatchMoby *m) { } if (D_0015EDB0_b) d->height = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d, 0); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, (char *)d + 0x80, 1); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, (char *)d + 0x80, 1); } extern void FUN_L02_002a4058(void *, int, float); extern void add_draw_callback(void *, void *) __asm__("FUN_001f4600"); @@ -1944,7 +1949,8 @@ extern s32 current_level_index_gp __asm__("D_0015ED84") __attribute__((sda)); * target point at its position), then climbs D_0015ED6C per frame until 4 * above the target, and stays there. */ -void FUN_L03_002dca30(struct Moby *m) +void garage_door_update(struct Moby *m) __asm__("FUN_L03_002dca30"); +void garage_door_update(struct Moby *m) { Vec4 *target = (Vec4 *)m->pvars; s16 idx; @@ -1972,3 +1978,6 @@ void FUN_L03_002dca30(struct Moby *m) return; } } + +f32 D_L06_0017CBE0[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_0017CBE4[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/blarg_space_commando.c b/src/overlays/shared/gameplay/entities/blarg_space_commando.c index f09a20d416..ac7eb5aeb9 100644 --- a/src/overlays/shared/gameplay/entities/blarg_space_commando.c +++ b/src/overlays/shared/gameplay/entities/blarg_space_commando.c @@ -30,7 +30,7 @@ typedef struct { u8 pad1C[0x14]; } ShotInfo; -/* pvars of FUN_L06_002fdbd0 */ +/* pvars of blarg_space_commando_update */ typedef struct { u8 pad0[0x20]; f32 unk20; @@ -80,12 +80,12 @@ extern s32 *D_L06_001B0C30[]; extern f32 D_L06_0015F580[] MACRO_ADDR; extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); -extern s32 FUN_001f9740(s32 *); +extern s32 fast_dec_timer(s32 *) __asm__("FUN_001f9740"); extern f32 FUN_001f9b48(void *, void *); -extern f32 FUN_001f9b80(void *, void *); -extern f32 FUN_001f9dc8(f32); -extern f32 FUN_001f9de0(f32); -extern f32 FUN_001f9e90(f32, f32); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); +extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); +extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern void mark_moby_for_removal(struct Moby *) __asm__("FUN_0020c828"); @@ -98,10 +98,10 @@ extern s32 FUN_L00_00258b50(struct Moby *, MoveCtl *, void *, void *, f32); extern void make_hit_descriptor(ShotInfo *, struct Moby *, s32, void *, f32) __asm__("FUN_L00_00259888"); extern void sweep_hit_segment(void *, void *, void *, void *, struct Moby *, ShotInfo *, s32) __asm__("FUN_L00_00259d08"); extern void FUN_L00_0025a120(struct Moby *); -extern void FUN_L00_0025be00(f32 *, f32, f32 *, f32, f32, f32); -extern s32 FUN_L00_0025c698(struct Moby *, Vec4 *); -extern void FUN_L00_0025e450(struct Moby *, Vec4 *, void *, f32, f32, s32, s32, s32, f32, f32, f32, f32, s32, - f32, s32, s32, s32, s32); +extern void approach_angle(f32 *, f32, f32 *, f32, f32, f32) __asm__("FUN_L00_0025be00"); +extern s32 mine_fall(struct Moby *, Vec4 *) __asm__("FUN_L00_0025c698"); +extern void spawn_explosion(struct Moby *, Vec4 *, void *, f32, f32, s32, s32, s32, f32, f32, f32, f32, s32, + f32, s32, s32, s32, s32) __asm__("FUN_L00_0025e450"); extern s32 FUN_L00_00261b48(s32, void *, void *, void *); extern void FUN_L00_00261d78(s32, void *, void *, f32); extern void FUN_L00_00263ac8(struct Moby *, s32, void *, f32); @@ -110,7 +110,8 @@ extern void FUN_L01_0026d930(MoveCtl *); extern void FUN_L06_002feb40_u(struct Moby *) __asm__("FUN_L06_002feb40"); extern void FUN_L06_002ff100_u(struct Moby *) __asm__("FUN_L06_002ff100"); -void FUN_L06_002fdbd0(struct Moby *moby) { +void blarg_space_commando_update(struct Moby *moby) __asm__("FUN_L06_002fdbd0"); +void blarg_space_commando_update(struct Moby *moby) { Moby1068Vars *vars = (Moby1068Vars *)moby->pvars; struct Moby *target; s32 *route; @@ -158,17 +159,17 @@ void FUN_L06_002fdbd0(struct Moby *moby) { moby->state = 14; break; } - if (FUN_001f9b80(&moby->pos, &target->pos) > 7.0f) { + if (vector_distance(&moby->pos, &target->pos) > 7.0f) { break; } } - FUN_L00_0025be00(&moby->rot.z, FUN_001f9e90(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), + approach_angle(&moby->rot.z, fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), &vars->turn_speed, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 3.1415927f); if (vars->unk164 != 2) { - if (D_L06_00161FC4 < FUN_001f9b80(&moby->pos, &target->pos)) { + if (D_L06_00161FC4 < vector_distance(&moby->pos, &target->pos)) { if (fast_difference_between_rotations( - moby->rot.z, FUN_001f9e90(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y)) < + moby->rot.z, fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y)) < 0.17453292f) { moby->state = 2; if (moby->prev_seq != 3) { @@ -194,9 +195,9 @@ void FUN_L06_002fdbd0(struct Moby *moby) { } route = D_L06_001B0C30[vars->route]; qcopy(&a, &route[*route * 4]); - dist = FUN_001f9b80(&moby->pos, &a); + dist = vector_distance(&moby->pos, &a); if (dist < 0.25f) { - angle = FUN_001f9e90(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y); + angle = fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y); FUN_L00_00258278(moby, angle, &vars->turn_speed, 0.05f, 0.3f, frame_time * 5.5850534f); if (fast_difference_between_rotations(angle, moby->rot.z) < 0.2617994f) { vars->turn_speed = 0.0f; @@ -207,19 +208,19 @@ void FUN_L06_002fdbd0(struct Moby *moby) { moby->state = 1; } } else { - FUN_L00_00258278(moby, FUN_001f9e90(a.f[0] - moby->pos.x, a.f[1] - moby->pos.y), &vars->turn_speed, + FUN_L00_00258278(moby, fast_arc_tan(a.f[0] - moby->pos.x, a.f[1] - moby->pos.y), &vars->turn_speed, 0.025f, 0.3f, frame_time * 5.5850534f); if (dist > 2.0f) { dist = 2.0f; } - b.f[0] = FUN_001f9dc8(moby->rot.z) * dist; - b.f[1] = FUN_001f9de0(moby->rot.z) * dist; + b.f[0] = fast_cos(moby->rot.z) * dist; + b.f[1] = fast_sin(moby->rot.z) * dist; b.f[2] = 0.0f; FUN_L00_00258b50(moby, &vars->ctl, &b, &c, 1.0f); } break; case 2: - FUN_L00_0025be00(&moby->rot.z, FUN_001f9e90(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), + approach_angle(&moby->rot.z, fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), &vars->turn_speed, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 3.1415927f); if (moby->anim_flags & 2) { @@ -247,16 +248,16 @@ void FUN_L06_002fdbd0(struct Moby *moby) { } break; case 4: - FUN_L00_0025be00(&moby->rot.z, FUN_001f9e90(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), + approach_angle(&moby->rot.z, fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), &vars->turn_speed, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 3.1415927f); - if (FUN_001f9740(&vars->timer) != 0) { + if (fast_dec_timer(&vars->timer) != 0) { FUN_L06_002ff100_u(moby); moby->state = 3; if (moby->prev_seq != 5) { blend_moby_animation(moby, 5, 0, scale_game_frames(5)); } - } else if (FUN_001f9b80(&moby->pos, &target->pos) < D_L06_00161FC4) { + } else if (vector_distance(&moby->pos, &target->pos) < D_L06_00161FC4) { moby->state = 5; if (moby->prev_seq != 6) { blend_moby_animation(moby, 6, 0, scale_game_frames(10)); @@ -269,7 +270,7 @@ void FUN_L06_002fdbd0(struct Moby *moby) { } break; case 5: - FUN_L00_0025be00(&moby->rot.z, FUN_001f9e90(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), + approach_angle(&moby->rot.z, fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), &vars->turn_speed, frame_time_sq * 6.2831855f, frame_time_sq * 6.2831855f, frame_time * 3.1415927f); moby_point_position(moby, 0, &a); @@ -280,8 +281,8 @@ void FUN_L06_002fdbd0(struct Moby *moby) { moby->anim_speed = D_L06_00161FCC; } if (cur_frame >= 9.0f && cur_frame <= 15.0f) { - c.f[0] = FUN_001f9dc8(moby->rot.z); - c.f[1] = FUN_001f9de0(moby->rot.z); + c.f[0] = fast_cos(moby->rot.z); + c.f[1] = fast_sin(moby->rot.z); c.f[2] = 1.0f; c.f[3] = 5627.925f; make_hit_descriptor(&shot, moby, 1, &c, 1.0f); @@ -309,10 +310,10 @@ void FUN_L06_002fdbd0(struct Moby *moby) { break; case 11: near = 0; - FUN_L00_00258278(moby, FUN_001f9e90(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), &vars->turn_speed, 0.05f, 0.3f, + FUN_L00_00258278(moby, fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), &vars->turn_speed, 0.05f, 0.3f, frame_time * 6.2831855f); - a.f[0] = 2.0f * FUN_001f9dc8(moby->rot.z); - a.f[1] = 2.0f * FUN_001f9de0(moby->rot.z); + a.f[0] = 2.0f * fast_cos(moby->rot.z); + a.f[1] = 2.0f * fast_sin(moby->rot.z); a.f[2] = 0.0f; FUN_L00_00258b50(moby, &vars->ctl, &a, &b, 1.0f); FUN_L00_00261d78(vars->path, &moby->pos, &moby->pos, 0.75f); @@ -327,7 +328,7 @@ void FUN_L06_002fdbd0(struct Moby *moby) { if (moby->prev_seq != 6) { blend_moby_animation(moby, 6, 0, scale_game_frames(10)); } - } else if (FUN_001f9b80(&moby->pos, &target->pos) < D_L06_00161FC4) { + } else if (vector_distance(&moby->pos, &target->pos) < D_L06_00161FC4) { moby->state = 12; if (moby->prev_seq != 6) { blend_moby_animation(moby, 6, 0, scale_game_frames(10)); @@ -340,8 +341,8 @@ void FUN_L06_002fdbd0(struct Moby *moby) { b.f[2] += 1.5f; frame = compute_interpolated_record_value(moby); if (frame >= 9.0f && frame <= 15.0f) { - c.f[0] = FUN_001f9dc8(moby->rot.z); - c.f[1] = FUN_001f9de0(moby->rot.z); + c.f[0] = fast_cos(moby->rot.z); + c.f[1] = fast_sin(moby->rot.z); c.f[2] = 1.0f; c.f[3] = 5627.925f; make_hit_descriptor(&shot, moby, 1, &c, 1.0f); @@ -359,13 +360,13 @@ void FUN_L06_002fdbd0(struct Moby *moby) { } break; case 13: - FUN_L00_00258278(moby, FUN_001f9e90(vars->home.f[0] - moby->pos.x, vars->home.f[1] - moby->pos.y), &vars->turn_speed, 0.05f, 0.3f, + FUN_L00_00258278(moby, fast_arc_tan(vars->home.f[0] - moby->pos.x, vars->home.f[1] - moby->pos.y), &vars->turn_speed, 0.05f, 0.3f, frame_time * 6.2831855f); - a.f[0] = 2.0f * FUN_001f9dc8(moby->rot.z); - a.f[1] = 2.0f * FUN_001f9de0(moby->rot.z); + a.f[0] = 2.0f * fast_cos(moby->rot.z); + a.f[1] = 2.0f * fast_sin(moby->rot.z); a.f[2] = 0.0f; if (fast_difference_between_rotations( - moby->rot.z, FUN_001f9e90(vars->home.f[0] - moby->pos.x, vars->home.f[1] - moby->pos.y)) < + moby->rot.z, fast_arc_tan(vars->home.f[0] - moby->pos.x, vars->home.f[1] - moby->pos.y)) < 0.7853982f) { FUN_L00_00258b50(moby, &vars->ctl, &a, &b, 1.0f); FUN_L00_00261d78(vars->path, &moby->pos, &moby->pos, 0.75f); @@ -378,7 +379,7 @@ void FUN_L06_002fdbd0(struct Moby *moby) { } break; case 15: - hit = FUN_L00_0025c698(moby, &vars->vel); + hit = mine_fall(moby, &vars->vel); if (hit & 0x40) { moby->state = 1; if (moby->prev_seq != 0) { @@ -389,13 +390,13 @@ void FUN_L06_002fdbd0(struct Moby *moby) { } break; case 16: - if (FUN_L00_0025c698(moby, &vars->vel) & 0x160) { + if (mine_fall(moby, &vars->vel) & 0x160) { s32 none; qcopy(&a, &moby->pos); a.f[2] += 1.0f; none = -1; - FUN_L00_0025e450(moby, &vars->unk40, &a, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, none, 0); + spawn_explosion(moby, &vars->unk40, &a, 0.0f, 0.0f, 5, 2, 4, 2.0f, 1.0f, 9.0f, 1.0f, -1, 15.0f, 1, 1, none, 0); FUN_L00_00263fd8(moby, 0x6A6, &moby->pos, &moby->rot, 0, 0, 0.0f, D_L06_0015F580, D_L06_0015F580, D_L06_0015F580); FUN_L00_00263fd8(moby, 0x6A7, &moby->pos, &moby->rot, 0, 0, 0.0f, D_L06_0015F580, D_L06_0015F580, @@ -420,7 +421,7 @@ extern f32 fast_sin_c2(f32) __asm__("func_001F9DE0"); extern f32 random_angle_radians_c(void) __asm__("func_00213308"); extern f32 random_float_between_c(f32, f32) __asm__("func_002132A8"); extern f32 vector_distance_xy_alt(void *, void *) __asm__("FUN_001f9b80"); -extern float FUN_001f96b0(float); +extern float FUN_L04_001f1978(float); extern float FUN_L00_00257c48(float lo, float hi); extern int FUN_L00_0025ff38(float, char *, void *, int, int, void *, int); extern int fun_00213928(void *, void *, void *, int, int *, float *, int, int); @@ -437,9 +438,9 @@ extern float D_L06_00161FB8 __attribute__((sda)); extern float D_L06_00161FBC __attribute__((sda)); extern unsigned char D_0013D408[]; extern void FUN_L00_00257470(void *, int, int); -extern void FUN_L00_0025c558(void *, void *, float, int, int, int); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_start_knockback(void *, void *, float, int, int, int) __asm__("FUN_L00_0025c558"); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern void FUN_L00_00263d40(int, int); extern void FUN_L06_002ff2c8(void *); extern void allocate_voice_for_bank_entry(int, int, int) __asm__("FUN_0022db10"); @@ -465,7 +466,7 @@ void FUN_L06_002feb40(char *m) { *(float *)(m + 0x2C) = *(float *)(*(char **)(m + 0x24) + 0x24) * D_L06_00161FA8; FUN_L06_002ff2c8(m); if (*(int *)(d + 0x38) != 0) { - *(int *)(d + 0x188) = truncate_float_to_s32_c(FUN_001f96b0(random_float_between_c(180.0f, 240.0f))); + *(int *)(d + 0x188) = truncate_float_to_s32_c(FUN_L04_001f1978(random_float_between_c(180.0f, 240.0f))); *(int *)(d + 0x38) = 0; } tick_countdown_32_alt((s32 *)(d + 0x188)); @@ -507,7 +508,7 @@ void FUN_L06_002feb40(char *m) { *(float *)(d + 0x78) = a; *(float *)(d + 0xB0) = 8.0f; *(float *)(d + 0xB4) = 15.0f; - FUN_L00_0025c558(m, q, fast_arc_tan(*(float *)(t + 0x10), *(float *)(t + 0x14)), 7, 1, 0); + trooper_start_knockback(m, q, fast_arc_tan(*(float *)(t + 0x10), *(float *)(t + 0x14)), 7, 1, 0); *(unsigned char *)(d + 0x117) = 0xFA; break; } @@ -532,7 +533,7 @@ void FUN_L06_002feb40(char *m) { a = fast_arc_tan(*(float *)(t + 0x10), *(float *)(t + 0x14)); bits = 0x40400000; off = *(float *)&bits; - FUN_L00_0025c558(m, q, a, 9, 1, 0); + trooper_start_knockback(m, q, a, 9, 1, 0); bits = 0x40E00000; pull = *(float *)&bits; for (k = 0; k < 10; k++) { @@ -564,10 +565,10 @@ void FUN_L06_002feb40(char *m) { default: break; } - FUN_L00_0025d458(m, (short *)(d + 0x110)); + trooper_anim_update(m, (short *)(d + 0x110)); } *(unsigned char *)(m + 0xA4) = 0xFF; - FUN_L00_0025d538(m, d + 0x110); + trooper_anim_finish(m, d + 0x110); if (*(int *)(d + 0x188) != 0) { *(float *)(d + 0x198) = D_L06_00161FAC + 6.0f; } else { @@ -632,7 +633,7 @@ INCLUDE_ASM("config/us/overlays/asm/FUN_L06_002ff2c8.s", FUN_L06_002ff2c8); extern f32 D_L06_00161FD0 __attribute__((sda)); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern f32 dot_vectors_xyz(void *, void *) __asm__("FUN_001f9ab0"); -extern s32 FUN_001efa68(void *, void *, s32, void *, void *); +extern s32 collision_line(void *, void *, s32, void *, void *) __asm__("FUN_001efa68"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern void enqueue_callback_list_1(void (*)(char *), char *) __asm__("FUN_001f4600"); void FUN_L06_002ff680(char *); @@ -651,7 +652,7 @@ void FUN_L06_002ff2c8(char *moby) { ShotInfo shot; frames = truncate_float_to_s32(*(f32 *)(data + 0x21C)); - FUN_001f9740(&frames); + fast_dec_timer(&frames); *(f32 *)(data + 0x21C) = (f32)frames; if (frames == 0) { return; @@ -691,7 +692,7 @@ void FUN_L06_002ff2c8(char *moby) { } else if (alignment < 0.3f) { point[2] += (frame_time + frame_time); } - if (entry[3] >= 1.0f && FUN_001efa68(&data[offset + 0x230], point, 2, 0, 0) != 0) { + if (entry[3] >= 1.0f && collision_line(&data[offset + 0x230], point, 2, 0, 0) != 0) { point[3] = 0.98f; } else if (point[3] < 1.0f) { approach_value(&point[3], 0.0f, frame_time + frame_time); @@ -722,7 +723,7 @@ void FUN_L06_002ff2c8(char *moby) { shot.unk18 = 0; shot.unk19 = 1; shot.oclass = *(s16 *)(moby + 0xA6); - FUN_001efa68(&data[offset + 0x230], &data[offset + 0x240], 0, moby, &shot); + collision_line(&data[offset + 0x230], &data[offset + 0x240], 0, moby, &shot); } } enqueue_callback_list_1(FUN_L06_002ff680, moby); @@ -915,7 +916,7 @@ void FUN_L06_002ff978(char *moby) { extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern f32 D_L06_00162080_gp __asm__("D_L06_00162080") __attribute__((sda)); -extern void FUN_001f9a10(float *, float *, float *); +extern void fast_vec_add(float *, float *, float *) __asm__("FUN_001f9a10"); void FUN_L06_00300b90(struct Moby *moby) { char *data; @@ -924,8 +925,8 @@ void FUN_L06_00300b90(struct Moby *moby) { moby->pclass->scale * *(float *)&D_L06_00162080_gp; data = (char *)moby->pvars; *(float *)(data + 8) -= t; - FUN_001f9a10(&moby->pos.x, &moby->pos.x, (float *)data); - FUN_001f9a10(&moby->rot.x, &moby->rot.x, (float *)(data + 0x10)); + fast_vec_add(&moby->pos.x, &moby->pos.x, (float *)data); + fast_vec_add(&moby->rot.x, &moby->rot.x, (float *)(data + 0x10)); moby->rot.x = fast_add_rotations(moby->rot.x, *(float *)(data + 0x10)); moby->rot.y = fast_add_rotations(moby->rot.y, *(float *)(data + 0x14)); moby->rot.z = fast_add_rotations(moby->rot.z, *(float *)(data + 0x18)); @@ -1021,3 +1022,5 @@ void FUN_L06_003021d8(char *moby) { buf[7] = func_001FA898_r((float)random_integer_below(10)) + 0x30; font_print_center_large_001f6c20(W(D_L06_001620C8), W(D_L06_001620CC), col, (int)buf, 8); } + +f32 D_L10_001DA10C[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/bomb.c b/src/overlays/shared/gameplay/entities/bomb.c index 1d145c1370..30a6e59e36 100644 --- a/src/overlays/shared/gameplay/entities/bomb.c +++ b/src/overlays/shared/gameplay/entities/bomb.c @@ -461,9 +461,9 @@ extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 FUN_L00_00257b90(s32, s32); extern f32 convert_integer_to_float(int) __asm__("FUN_001fa6c0"); extern void FUN_L00_00257470(void *, int, int); -extern void *FUN_002141f8(void *); +extern void *suck_get_aim_height(void *) __asm__("FUN_002141f8"); extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); -extern void FUN_L00_002502f0(void *, u8, u8, u8); +extern void set_moby_color(void *, u8, u8, u8) __asm__("FUN_L00_002502f0"); extern void FUN_L00_00269b70(void *, int, int, int, int, f32, f32); extern void fill_transfer_words(void *, int, int) __asm__("FUN_001f97e8"); extern void FUN_L00_002c92d8_c(void *) __asm__("FUN_L00_002c92d8"); @@ -489,7 +489,7 @@ struct Moby *FUN_L00_002c9348(State *a) { if ((a->flags34 & 0x20) != 0) { o = a->unk78->unk0C; if (o != NULL) { - FUN_L00_002502f0(n, o->f4, o->f5, o->f6); + set_moby_color(n, o->f4, o->f5, o->f6); } else { n->spawn_frame = a->unk38; } @@ -527,7 +527,7 @@ struct Moby *FUN_L00_002c9348(State *a) { s2->unk74 = D_0013E520[0x15]; n->command = s2->unk74; FUN_L00_00257470(a, 0, -1); - q = FUN_002141f8(a); + q = suck_get_aim_height(a); if (q != NULL && *(u8 *)((u8 *)q + 0xE) == 1) { *(u8 *)((u8 *)q + 0xE) = 2; } else { @@ -607,7 +607,8 @@ extern void normalize_2c97e0(void *, void *, f32) __asm__("FUN_001f9bf8"); /* Update for class 0x10e. State-specific inequalities and scale omissions * follow the level-00 instructions, including the close state-3 step. */ -void FUN_L00_002c97e0(struct Moby *m) +void morphoray_chicken_update(struct Moby *m) __asm__("FUN_L00_002c97e0"); +void morphoray_chicken_update(struct Moby *m) { V4 old_pos, next_pos, velocity, offset; Sub *s2 = (Sub *)m->pvars; @@ -1004,9 +1005,9 @@ extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); extern float D_0015ED6C; extern char D_L00_0015F580[] __attribute__((section(".sdata"))); extern float D_L00_00161890_gp __asm__("D_L00_00161890") __attribute__((sda)); -extern float FUN_L00_00257e20(float, float, float, float, float); +extern float cubic_hermite_scalar(float, float, float, float, float) __asm__("FUN_L00_00257e20"); extern float fast_add_rotations(float, float) __asm__("func_001FA580"); -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int FUN_L00_00257b90_c2(int, int) __asm__("FUN_L00_00257b90"); extern s32 scale_game_frames_c2(s32) __asm__("func_001F96F8"); extern s32 truncate_float_to_s32_c(f32) __asm__("func_001FA6D0"); @@ -1065,7 +1066,7 @@ char *FUN_L00_002caf70(char *owner, char *spawn_pos, char *target, float vx, flo if (target != 0) { int bounds; qcopy(vars, target + 0x10); - bounds = (int)FUN_002141f8(target); + bounds = (int)suck_get_aim_height(target); if (bounds != 0) { *(float *)(vars + 0x8) = *(float *)(vars + 0x8) + *(float *)(bounds + 0x10); } else { @@ -1086,7 +1087,7 @@ char *FUN_L00_002caf70(char *owner, char *spawn_pos, char *target, float vx, flo *(short *)(vars + 0x26) = timer; *(w128 *)probe = *(w128 *)(owner + 0x10); probe[2] = start[2]; - result = FUN_001efa68(probe, start, 0, (int)owner, 0); + result = collision_line(probe, start, 0, (int)owner, 0); if (result != 0) { build_spherical_offset(direction, D_0015ED6C * 40.0f, *(float *)(moby + 0x48), -*(float *)(moby + 0x44)); qcopy(moby + 0x10, D_L00_00173E60_c); @@ -1134,7 +1135,7 @@ char *FUN_L00_002caf70(char *owner, char *spawn_pos, char *target, float vx, flo *(float *)(trail + 0xC) = random_float_between_c2(D_L00_00161870, D_L00_00161874); index = convert_integer_to_float_c(i); fraction = index / convert_integer_to_float_c(16); - blend = FUN_L00_00257e20(-1.5f, 0.0f, 1.0f, 0.0f, fraction); + blend = cubic_hermite_scalar(-1.5f, 0.0f, 1.0f, 0.0f, fraction); *(float *)(trail + 0xC) = *(float *)(trail + 0xC) + (D_L00_00161878 - *(float *)(trail + 0xC)) * blend; result = truncate_float_to_s32_c(blend * -64.0f + 128.0f); *(int *)(trail + 4) = (result << 24) | 0xFFFFFF; @@ -1680,7 +1681,7 @@ extern void transpose_2cc608(void *, void *) __asm__("FUN_001fa2d8"); extern int timer32_2cc608(int *) __asm__("FUN_001f9740"); extern int timer16_2cc608(short *) __asm__("FUN_001f9770"); extern void muzzle_2cc608(struct Moby *, int, float *) __asm__("FUN_L00_0024f7c8"); -extern struct Moby *find_target_2cc608(float *, float *, struct Moby **, float, float, float) __asm__("FUN_L00_002cc360"); +extern struct Moby *FUN_L00_002cc360_c(float *, float *, struct Moby **, float, float, float) __asm__("FUN_L00_002cc360"); extern int ticks_2cc608(int) __asm__("FUN_001f96f8"); extern Bounds_2cc608 *bounds_2cc608(struct Moby *) __asm__("FUN_002141f8"); extern int has_ammo_2cc608(int) __asm__("FUN_L00_00233e98"); @@ -1689,19 +1690,20 @@ extern float distance_2cc608(void *, void *) __asm__("FUN_001f9b48"); extern float fabs_2cc608(float) __asm__("FUN_001f99c0"); extern void reticle_2cc608(struct Moby *, int, float, float, float *, int, int, float, int) __asm__("FUN_L00_001edf60"); extern void hud_2cc608(int, int) __asm__("FUN_L00_002223f8"); -extern void fire_start_2cc608(void) __asm__("FUN_L00_0020e4c8"); -extern void fire_end_2cc608(void) __asm__("FUN_L00_0020e698"); +extern void FUN_L00_0020e4c8(void); +extern void FUN_L00_0020e698(void); extern void apply_mat4_2cc608(float *, float *, void *) __asm__("FUN_001f9d20"); extern void apply_mat3_2cc608(float *, float *, void *) __asm__("FUN_001f9cf8"); extern void add_2cc608(float *, void *, void *) __asm__("FUN_001f9a10"); extern void scale_2cc608(float *, float *, float) __asm__("FUN_001f9a68"); extern float angle_2cc608(float, float) __asm__("FUN_001f9e90"); extern float length_2cc608(float *) __asm__("FUN_001f9b20"); -extern unsigned char *missile_2cc608(struct Moby *, float *, struct Moby *, float, float, float) __asm__("FUN_L00_002ccee0"); +extern unsigned char *FUN_L00_002ccee0_c(struct Moby *, float *, struct Moby *, float, float, float) __asm__("FUN_L00_002ccee0"); extern int rand_2cc608(void) __asm__("FUN_001160d8"); /* Ryno (class 454) update: target lock and reticle while held, then the eight-missile salvo state machine. */ -void FUN_L00_002cc608(struct Moby *m) { +void ryno_update(struct Moby *m) __asm__("FUN_L00_002cc608"); +void ryno_update(struct Moby *m) { Mat3_2cc608 cam; Mat4_2cc608 view; Vec4 aim; @@ -1723,7 +1725,7 @@ void FUN_L00_002cc608(struct Moby *m) { qcopy(aim.f, camera_rot_2cc608.f); aim.f[1] = -aim.f[1]; muzzle_2cc608(m, d->slot, dir.f); - r = find_target_2cc608(dir.f, aim.f, 0, 1.6981583f, 1.6981583f, 80.0f); + r = FUN_L00_002cc360_c(dir.f, aim.f, 0, 1.6981583f, 1.6981583f, 80.0f); if ((r != 0 && d->target == 0) || d->target == 0 || d->target->state == 0xFE || d->target->state == 0xFD || d->target->visible == 0) { d->height = 0; d->target = r; @@ -1776,7 +1778,7 @@ void FUN_L00_002cc608(struct Moby *m) { d->shot_timer = 0; d->slot = 0; d->shots = 0; - fire_start_2cc608(); + FUN_L00_0020e4c8(); { int k; for (k = 6; k >= 0; k--) d->recent[k] = 0; @@ -1805,7 +1807,7 @@ void FUN_L00_002cc608(struct Moby *m) { d->shot_timer = 0; d->slot = 0; d->shots = 0; - fire_start_2cc608(); + FUN_L00_0020e4c8(); { int k; for (k = 6; k >= 0; k--) d->recent[k] = 0; @@ -1836,11 +1838,11 @@ void FUN_L00_002cc608(struct Moby *m) { } pitch = -angle_2cc608(length_2cc608(dir.f), dir.f[2]); muzzle_2cc608(m, d->slot, aim.f); - fire_start_2cc608(); - missile_2cc608(m, aim.f, d->target, d->height, yaw, pitch); + FUN_L00_0020e4c8(); + FUN_L00_002ccee0_c(m, aim.f, d->target, d->height, yaw, pitch); if (d->shots >= 7) { hero.items[0].unk1C = 0; - fire_end_2cc608(); + FUN_L00_0020e698(); m->state = 5; d->shot_timer = ticks_2cc608(60); d->track_timer = ticks_2cc608(60); @@ -1852,7 +1854,7 @@ void FUN_L00_002cc608(struct Moby *m) { d->count = d->count % 7; qcopy(aim.f, camera_rot_2cc608.f); aim.f[1] = -aim.f[1]; - d->target = find_target_2cc608(((float *)&m->pos), aim.f, d->recent, 3.1415927f, 3.1415927f, 100.0f); + d->target = FUN_L00_002cc360_c(((float *)&m->pos), aim.f, d->recent, 3.1415927f, 3.1415927f, 100.0f); if (d->target == 0 && d->count > 0 && (rand_2cc608() & (d->count + 1)) == 0) { d->target = d->recent[rand_2cc608() % d->count]; } @@ -2002,7 +2004,7 @@ extern float FUN_L00_00258110(float *vel, float cur, float target, float k, floa extern float fast_add_rotations(float, float) __asm__("func_001FA580"); extern float vector_distance_xy_alt(void *, void *) __asm__("FUN_001f9b80"); extern Data D_L00_00173E40; -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int FUN_L00_00257b90_c(int, int) __asm__("FUN_L00_00257b90"); extern int tick_countdown_32_alt(int *) __asm__("FUN_001f9740"); extern s32 rand(void); @@ -2018,10 +2020,11 @@ extern void mark_moby_for_removal_c(void *) __asm__("func_0020C828"); extern void set_vector_length_xy(void *, void *, f32) __asm__("FUN_001f9c48"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void transform_vector(void *, void *, void *) __asm__("func_001F9D20"); -void FUN_L00_0025e450(char *m, void *unused, char *pos, float fA, float fB, int n, int k8, int k9, float fC, float fD, float fE, float fF, int k10, float fG, int k11, int s16, int s18, unsigned char flag); +void spawn_explosion(char *m, void *unused, char *pos, float fA, float fB, int n, int k8, int k9, float fC, float fD, float fE, float fF, int k10, float fG, int k11, int s16, int s18, unsigned char flag) __asm__("FUN_L00_0025e450"); extern void func_L00_0025F4A8_alt(void *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); -void FUN_L00_002cd1f0(char *m) { +void rocket_update(char *m) __asm__("FUN_L00_002cd1f0"); +void rocket_update(char *m) { char *d; char *q; char *p; @@ -2154,7 +2157,7 @@ void FUN_L00_002cd1f0(char *m) { euler_rotation_matrix(va0, m + 0x40); transform_vector(&u.v.a, &u.v.a, va0); add_vector_xyz(m + 0x10, d + 0x10, &u.v.a); - if (FUN_001efa68(&v20, m + 0x10, 6, (int)m, 0) == 0) goto done; + if (collision_line(&v20, m + 0x10, 6, (int)m, 0) == 0) goto done; goto hit; top:; } @@ -2184,7 +2187,7 @@ void FUN_L00_002cd1f0(char *m) { u.h.w = 5627.925f; u.h.b19 = 3; u.h.s = *(unsigned short *)(m + 0xA6); - if (FUN_001efa68(&v20, m + 0x10, 0, (int)m, (int)&u.v.a)) { + if (collision_line(&v20, m + 0x10, 0, (int)m, (int)&u.v.a)) { gg = (char *)((int *)&D_L00_00173E40); p = *(char **)(gg + 0x18); if (p != 0) { @@ -2307,7 +2310,7 @@ void FUN_L00_002cde78(char *m) { extern float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern int D_L00_0015FFE4; -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int FUN_002141f8_c(char *) __asm__("FUN_002141f8"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void normalize_vector_xyz(void *out, void *a, f32 len) __asm__("FUN_001f9bf8"); @@ -2384,7 +2387,7 @@ char *FUN_L00_002cdf28(char *a, int *excl) { qcopy(v, m + 0x10); if (x != 0) v[2] = v[2] + (*(float *)(x + 0x10) + 0.05f); - if (FUN_001efa68(a, v, 6, (int)m, 0) == 0) { + if (collision_line(a, v, 6, (int)m, 0) == 0) { best = dist; result = m; } @@ -2394,7 +2397,7 @@ char *FUN_L00_002cdf28(char *a, int *excl) { extern char *spawn_2ce1f0(int) __asm__("FUN_0020c4f8"); extern void FUN_L00_00250df8(void *); -extern void place_2ce1f0(void *) __asm__("FUN_L00_0025d1b8"); +extern void FUN_L00_0025d1b8(void *); extern float atan2_2ce1f0(float, float) __asm__("FUN_001f9e90"); extern float dist_2ce1f0(void *, void *) __asm__("FUN_001f9b80"); @@ -2417,7 +2420,7 @@ char *FUN_L00_002ce1f0(int a, void *pos) { g = &hero; g->ammo_used++; FUN_L00_00250df8(m); - place_2ce1f0(m); + FUN_L00_0025d1b8(m); *(float *)(v + 0x28) = atan2_2ce1f0(*(float *)(m + 0x10) - g->motion.pos.f[0], *(float *)(m + 0x14) - g->motion.pos.f[1]); *(float *)(v + 0x24) = atan2_2ce1f0(dist_2ce1f0(&g->motion.pos, m + 0x10), *(float *)(m + 0x18) - g->motion.pos.f[2]); *(float *)(v + 0x20) = dist_2ce1f0(m + 0x10, &g->motion.pos); @@ -2489,7 +2492,8 @@ typedef struct { f32 pitch_velocity; } Vars_2ce358; -void FUN_L00_002ce358(struct Moby *m) +void drone_update(struct Moby *m) __asm__("FUN_L00_002ce358"); +void drone_update(struct Moby *m) { Vars_2ce358 *v = (Vars_2ce358 *)m->pvars; V4 collision_data[1], old_pos; @@ -2886,11 +2890,11 @@ extern void update_moby_animation_state(struct Moby *) __asm__("FUN_0020c880"); extern void break_crate(struct Moby *, int, Contact *) __asm__("FUN_L00_002d09b8"); extern void crate_drop_bolts(struct Moby *) __asm__("FUN_L00_002d0538"); extern s32 collect_mobies_in_sphere(f32, void *, s32, void *, void *) __asm__("FUN_L00_001f2868"); -extern int FUN_001fa728(void *, float); +extern int fast_bsphere_check(void *, float) __asm__("FUN_001fa728"); extern int FUN_L00_001fefc8(void *); extern int FUN_L00_002591d0(struct Moby **, int, int, int); extern int FUN_L00_002592b8(struct Moby **, struct Moby *, int, int); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); void crate_update(struct Moby *moby) __asm__("FUN_L00_002cf218"); void crate_update(struct Moby *moby) { @@ -3079,7 +3083,7 @@ void crate_update(struct Moby *moby) { qcopy(&burst.pos, &moby->pos); burst.pos.z += 0.5f; burst.pos.w = 1.0f; - if (FUN_001fa728(&burst.pos, moby->draw_dist) != -1) { + if (fast_bsphere_check(&burst.pos, moby->draw_dist) != -1) { break; } if (!FUN_L00_001fefc8(&pv->unkC9)) { @@ -3121,7 +3125,7 @@ void crate_update(struct Moby *moby) { } FUN_L00_002591d0(&it, moby->group, 0, 0); while (it != NULL) { - if (moby != it && !(FUN_001f9b80(&moby->pos, &it->pos) > 0.1f) && it->state == 1) { + if (moby != it && !(vector_distance(&moby->pos, &it->pos) > 0.1f) && it->state == 1) { CrateVars *ipv = (CrateVars *)it->pvars; if (ipv->rider == NULL) { @@ -3167,7 +3171,7 @@ void crate_update(struct Moby *moby) { } if (moby->command % scale_game_frames(60) > scale_game_frames(40) || moby->command < scale_game_frames(15)) { - FUN_L00_002502f0(moby, 0xC8, 0x40, 0x40); + set_moby_color(moby, 0xC8, 0x40, 0x40); } else { moby->spawn_frame = pv->unkB8; } diff --git a/src/overlays/shared/gameplay/entities/bot_door_lock.c b/src/overlays/shared/gameplay/entities/bot_door_lock.c index 2f6298f10e..d67ff83a66 100644 --- a/src/overlays/shared/gameplay/entities/bot_door_lock.c +++ b/src/overlays/shared/gameplay/entities/bot_door_lock.c @@ -148,9 +148,9 @@ void FUN_L06_00307578(char *moby) { /* state transitions of a moby depending on its id at 0xA6 */ /* Ported from rac1-decomp (src/overlays/shared/vendor_002FF000.c: func_L06_00309088), where it is exact; names translated to the US level program. */ -extern int FUN_L00_0028dc90(int i, int a1, int v, int k); +extern int trooper_play_sound(int i, int a1, int v, int k) __asm__("FUN_L00_0028dc90"); extern void allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); -extern void FUN_L00_002502a0(int idx); +extern void jet_clear_persistent(int idx) __asm__("FUN_L00_002502a0"); void FUN_L06_00307c48(unsigned char *a, unsigned char *m) { switch (*(short *)(m + 0xA6)) { @@ -167,9 +167,9 @@ void FUN_L06_00307c48(unsigned char *a, unsigned char *m) { break; case 0x542: m[0x20] = 2; - FUN_L00_0028dc90(0, 0, (int)m, 0x434); + trooper_play_sound(0, 0, (int)m, 0x434); m[0x30] = 0xFF; - FUN_L00_002502a0(a[0xB0]); + jet_clear_persistent(a[0xB0]); break; } } @@ -195,7 +195,8 @@ extern void add_vectors(void *, void *, void *) __asm__("FUN_L00_001ff290"); extern void draw_number(void *, void *, int, unsigned int, int, int, int, float) __asm__("FUN_L01_00285768"); extern int D_L06_0015FFD8_gp __asm__("D_L06_0015FFD8") __attribute__((sda)); -void FUN_L06_00307d30(char *moby) { +void bot_door_lock_update(char *moby) __asm__("FUN_L06_00307d30"); +void bot_door_lock_update(char *moby) { float *data = *(float **)(moby + 0x78); int *idata = (int *)data; float pos[4]; @@ -489,3 +490,6 @@ void FUN_L06_00316330(char *moby) { *(int *)(*(char **)(D_L06_0015EF50 + *(short *)(moby + 0x84) * 32 + 0x1C) + 0x50) = 1; } } + +s32 D_L06_001FE9D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001DA210[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/camera_object.c b/src/overlays/shared/gameplay/entities/camera_object.c index 9c88487be8..1143d0c4bd 100644 --- a/src/overlays/shared/gameplay/entities/camera_object.c +++ b/src/overlays/shared/gameplay/entities/camera_object.c @@ -28,7 +28,7 @@ extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern struct Amb D_L00_001CB7C0; float absolute_float(float input) __asm__("func_001F99C0"); @@ -43,7 +43,7 @@ void FUN_L00_002a4890(void) { case 2: switch (s->hE) { case 0: - if (FUN_001f9770(&s->h1E)) { + if (fast_dec_timer_s16(&s->h1E)) { a = convert_integer_to_float(s->h1C) * random_float_between_alt(0.5f, 1.5f); c = fast_add_rotations(s->f0, random_float_between_alt(-1.0471976f, 1.0471976f)); b = random_float_between_alt(s->f10 * 0.5f, s->f10 * 1.5f); @@ -54,7 +54,7 @@ void FUN_L00_002a4890(void) { } break; case 1: - if (FUN_001f9770(&s->h1E)) { + if (fast_dec_timer_s16(&s->h1E)) { s->h1E = func_001FA898_r(convert_integer_to_float(s->h1C) * random_float_between_alt(2.0f, 3.0f)); s->hE = 0; @@ -75,7 +75,7 @@ void FUN_L00_002a4890(void) { case 3: switch (s->hE) { case 0: - if (FUN_001f9770(&s->h1E)) { + if (fast_dec_timer_s16(&s->h1E)) { a = multiply_global_factor_ed64(random_float_between_alt(45.0f, 60.0f)); c = fast_add_rotations(s->f0, random_float_between_alt(-1.5707964f, 1.5707964f)); b = random_float_between_alt(s->f10 * 1.5f, s->f10 + s->f10); @@ -86,7 +86,7 @@ void FUN_L00_002a4890(void) { } break; case 1: - if (FUN_001f9770(&s->h1E)) { + if (fast_dec_timer_s16(&s->h1E)) { s->h1E = func_001FA898_r(convert_integer_to_float(s->h1C) * random_float_between_alt(1.0f, 1.5f)); s->hE = 2; @@ -103,7 +103,7 @@ void FUN_L00_002a4890(void) { } break; case 2: - if (FUN_001f9770(&s->h1E)) { + if (fast_dec_timer_s16(&s->h1E)) { a = multiply_global_factor_ed64(random_float_between_alt(45.0f, 60.0f)); c = fast_add_rotations(s->f0, random_float_between_alt(-0.785398f, 0.785398f)); b = random_float_between_alt(s->f10 * 0.8f, s->f10 * 1.2f); @@ -114,7 +114,7 @@ void FUN_L00_002a4890(void) { } break; case 3: - if (FUN_001f9770(&s->h1E)) { + if (fast_dec_timer_s16(&s->h1E)) { s->h1E = func_001FA898_r(convert_integer_to_float(s->h1C) * random_float_between_alt(3.0f, 5.0f)); s->hE = 0; @@ -147,7 +147,7 @@ extern float D_L00_00161384_gp __asm__("D_L00_00161384") __attribute__((sda)); extern float D_L00_0016138C_gp __asm__("D_L00_0016138C") __attribute__((sda)); #include "rnc/globals.h" int scale_game_frames(int) __asm__("FUN_001f96f8"); -float FUN_001fa6c0(int); +float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); void FUN_L00_002a4cd8(unsigned char *p) { float one; int r; @@ -160,7 +160,7 @@ void FUN_L00_002a4cd8(unsigned char *p) { D_L00_0016137C_gp = scale_game_frames(D_L00_00161368); r = scale_game_frames(D_L00_0016136C); D_L00_00161380 = r; - D_L00_00161384_gp = one / FUN_001fa6c0(r); + D_L00_00161384_gp = one / convert_integer_to_float(r); r = scale_game_frames(D_L00_00161370); D_L00_00161388 = r; D_L00_0016138C_gp = one / (float)r; @@ -218,7 +218,8 @@ extern float vector_length_xyz(void *) __asm__("FUN_001f9af0"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); -void FUN_L00_002a4e48(char *o) { +void camera_object_update(char *o) __asm__("FUN_L00_002a4e48"); +void camera_object_update(char *o) { OvlQuad d[1]; OvlQuad e[1]; C_2a4e48 *C = &D_166C80_2a4e48; @@ -550,7 +551,8 @@ void FUN_L00_0029a6b0_2a57a8(P_2a57a8 *) __asm__("FUN_L00_0029a6b0"); extern f32 D_L00_001613A4 __attribute__((sda)); extern f32 D_L00_0016139C __attribute__((sda)); extern f32 D_L00_001613A0 __attribute__((sda)); -void FUN_L00_002a57a8(P_2a57a8 *p) { +void vendor_update(P_2a57a8 *p) __asm__("FUN_L00_002a57a8"); +void vendor_update(P_2a57a8 *p) { Q_2a57a8 *q = p->q; s32 i, a, b, c; u8 *v; @@ -753,25 +755,25 @@ extern f32 D_0015ED6C; extern s32 FUN_00213260(s32); extern f32 FUN_00213308(void); extern f32 FUN_002132a8(f32, f32); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void lerp_vector(void *, void *, void *, f32) __asm__("FUN_001f9a40"); -extern void FUN_001f9a28(void *, void *, void *); -extern f32 FUN_001f9af0(void *); -extern f32 FUN_001f9b80(void *, void *); -extern f32 FUN_001f9b20(void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); extern void fast_vec_normalize(void *, void *, f32) __asm__("FUN_001f9bf8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); -extern f32 FUN_001f9e90(f32, f32); -extern void FUN_001f99f8(void *); +extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); +extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); extern f32 FUN_001f99c0(f32); extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); -extern s32 FUN_001f96f8(s32); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern void euler_rotation_basis(void *, void *) __asm__("FUN_001fa030"); extern void multiply_matrix3x3(void *, void *, void *) __asm__("FUN_001fa328"); extern void quaternion_nlerp(void *, void *, void *, f32) __asm__("FUN_001fa400"); extern void quaternion_to_rotation_basis(void *, void *) __asm__("FUN_001fa480"); -extern f32 FUN_001fa6c0(s32); +extern f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); extern s32 FUN_001fa6d0(f32); extern s32 FUN_001efa68(void *, void *, s32, s32, s32); extern void matrix_to_euler(void *, void *) __asm__("FUN_00214598"); @@ -789,7 +791,8 @@ extern void FUN_L00_002a6de8_c(Bolt *, void *, s32) __asm__("FUN_L00_002a6de8"); extern void FUN_L00_002a6b70_c(Bolt *) __asm__("FUN_L00_002a6b70"); extern void FUN_L00_002a7210_c(Bolt *, void *, f32, f32) __asm__("FUN_L00_002a7210"); -void FUN_L00_002a5dd8(Bolt *obj) { +void bolt_update(Bolt *obj) __asm__("FUN_L00_002a5dd8"); +void bolt_update(Bolt *obj) { BoltVars *v = obj->vars; Vec4 a; Vec4 b; @@ -829,15 +832,15 @@ void FUN_L00_002a5dd8(Bolt *obj) { v->unk55 |= 1; } fast_vec_normalize(&a, &obj->unkE0, 0.2f); - FUN_001f9a10(&a, &a, &obj->pos); + fast_vec_add(&a, &a, &obj->pos); fast_vec_normalize(&b, &obj->unkE0, -3.0f); - FUN_001f9a10(&b, &b, &obj->pos); + fast_vec_add(&b, &b, &obj->pos); hit = FUN_001efa68(&a, &b, 0x22, 0, 0); if (v->landed == 0 && hit != 0) { qcopy(&v->pos, &D_L00_00173E40.point); - FUN_001f99f8(&v->rot); - v->rot.f[2] = FUN_001f9e90(D_L00_00173E40.normal_x, D_L00_00173E40.normal_y); - v->rot.f[1] = FUN_001f9e90(D_L00_00173E40.normal_z, FUN_001f9b20(&D_L00_00173E40.normal_x)); + clear_u64_value(&v->rot); + v->rot.f[2] = fast_arc_tan(D_L00_00173E40.normal_x, D_L00_00173E40.normal_y); + v->rot.f[1] = fast_arc_tan(D_L00_00173E40.normal_z, vector_length_xy(&D_L00_00173E40.normal_x)); if (D_L00_00173E40.moby != 0 && FUN_L00_002603d0((void *)D_L00_00173E40.moby) != 0) { void *gm = (void *)D_L00_00173E40.moby; v->ground_moby = gm; @@ -845,12 +848,12 @@ void FUN_L00_002a5dd8(Bolt *obj) { } } else { qcopy(&v->pos, &obj->pos); - FUN_001f99f8(&v->rot); + clear_u64_value(&v->rot); } v->unk50 = FUN_00213308(); v->unk58 = FUN_00213308(); v->ground_z = obj->pos.f[2]; - v->slot_timer = FUN_L00_00257b90(0, FUN_001f96f8(600)); + v->slot_timer = FUN_L00_00257b90(0, scale_game_frames(600)); v->slot = -1; switch (obj->oclass) { case 0xD: @@ -869,7 +872,7 @@ void FUN_L00_002a5dd8(Bolt *obj) { break; case 1: v->vel.f[2] -= frame_time_sq * 10.8f; - FUN_001f9a10(&obj->pos, &obj->pos, &v->vel); + fast_vec_add(&obj->pos, &obj->pos, &v->vel); quaternion_to_rotation_basis(&v->spin, &c); multiply_matrix3x3(&obj->rot, &c, &obj->rot); switch (obj->oclass) { @@ -894,12 +897,12 @@ void FUN_L00_002a5dd8(Bolt *obj) { return; } qcopy(&v->pos, &D_L00_00173E40.point); - FUN_001f99f8(&v->rot); - v->rot.f[2] = FUN_001f9e90(D_L00_00173E40.normal_x, D_L00_00173E40.normal_y); - v->rot.f[1] = FUN_001f9e90(D_L00_00173E40.normal_z, FUN_001f9b20(&D_L00_00173E40.normal_x)); - FUN_001f9a28(&a, &obj->pos, &D_L00_00173E40.point); + clear_u64_value(&v->rot); + v->rot.f[2] = fast_arc_tan(D_L00_00173E40.normal_x, D_L00_00173E40.normal_y); + v->rot.f[1] = fast_arc_tan(D_L00_00173E40.normal_z, vector_length_xy(&D_L00_00173E40.normal_x)); + fast_vec_sub(&a, &obj->pos, &D_L00_00173E40.point); FUN_L00_001ff660(&v->vel, &v->vel, &a); - if (FUN_001f9b80(&obj->pos, &hero.motion.pos) < hero.reach_distance && + if (vector_distance(&obj->pos, &hero.motion.pos) < hero.reach_distance && FUN_001f99c0(obj->pos.f[2] - hero.motion.pos.f[2]) < hero.reach_height) { if (hero.health.hp == 0) { return; @@ -909,10 +912,10 @@ void FUN_L00_002a5dd8(Bolt *obj) { return; } ang = 0.7853982f; - if (!(FUN_001f9e90(a.f[2], FUN_001f9b20(&a)) < ang)) { + if (!(fast_arc_tan(a.f[2], vector_length_xy(&a)) < ang)) { return; } - if (!(FUN_001f9e90(D_L00_00173E40.normal_z, FUN_001f9b20(&D_L00_00173E40.normal_x)) < ang)) { + if (!(fast_arc_tan(D_L00_00173E40.normal_z, vector_length_xy(&D_L00_00173E40.normal_x)) < ang)) { return; } obj->state = 2; @@ -931,8 +934,8 @@ void FUN_L00_002a5dd8(Bolt *obj) { b.f[2] += k; matrix_to_euler(&obj->rot, &a); FUN_L00_00259f50(&c, &a); - s = 1.0f / FUN_001fa6c0(v->hop_left); - h = FUN_001fa6c0(v->hop_left) / FUN_001fa6c0(v->hop_frames); + s = 1.0f / convert_integer_to_float(v->hop_left); + h = convert_integer_to_float(v->hop_left) / convert_integer_to_float(v->hop_frames); quaternion_nlerp(&v->spin, &v->spin, &c, s); lerp_vector(&obj->pos, &obj->pos, &b, h); h -= 0.5f; @@ -945,7 +948,7 @@ void FUN_L00_002a5dd8(Bolt *obj) { v->hop_frames = v->hop_left = FUN_001fa6d0(multiply_global_factor_ed64(FUN_002132a8(10.0f, 20.0f))); return; case 3: - dist = FUN_001f9b80(&obj->pos, &hero.motion.pos); + dist = vector_distance(&obj->pos, &hero.motion.pos); if (dist < hero.reach_distance && FUN_001f99c0(obj->pos.f[2] - hero.motion.pos.f[2]) < hero.reach_height) { FUN_L00_002a7210_c(obj, hero.moby, 0.0f, 0.0f); return; @@ -957,14 +960,14 @@ void FUN_L00_002a5dd8(Bolt *obj) { if (obj->unk31 != 0 || v->ground_moby != 0) { FUN_L00_002a6de8_c(obj, 0, 0); if (v->hop_left != 0) { - u = FUN_001fa6c0(v->hop_left) / FUN_001fa6c0(v->hop_frames); + u = convert_integer_to_float(v->hop_left) / convert_integer_to_float(v->hop_frames); u -= 0.5f; obj->pos.f[2] += -(u * u - 0.25f) * ((f32)v->hop_frames * 0.0125f); v->hop_left--; } if (v->slot >= 0) { transform_vector_by_basis(&a, &D_L00_001D73D0[obj->oclass], &obj->rot); - FUN_001f9a10(&glints[v->slot], &a, &obj->pos); + fast_vec_add(&glints[v->slot], &a, &obj->pos); if (glints[v->slot].moby != (((u8 *)obj - D_L00_0015FFD8) >> 8)) { v->slot = -1; } @@ -974,9 +977,9 @@ void FUN_L00_002a5dd8(Bolt *obj) { return; } transform_vector_by_basis(&a, &D_L00_001D73D0[obj->oclass], &obj->rot); - FUN_001f9a10(&a, &a, &obj->pos); + fast_vec_add(&a, &a, &obj->pos); v->slot = FUN_L00_001fe990(&a, ((u8 *)obj - D_L00_0015FFD8) >> 8, 1.4f); - v->slot_timer = FUN_L00_00257b90(FUN_001f96f8(300), FUN_001f96f8(600)); + v->slot_timer = FUN_L00_00257b90(scale_game_frames(300), scale_game_frames(600)); } else if (v->hop_left != 0) { v->hop_left--; } @@ -984,7 +987,7 @@ void FUN_L00_002a5dd8(Bolt *obj) { case 4: flag = 0; if (v->unk60->oclass == 0) { - FUN_001f9a28(&a, &obj->pos, &hero.ground_point); + fast_vec_sub(&a, &obj->pos, &hero.ground_point); transform_vector(&a, &a, hero.unk40); if (a.f[2] < 0.0f) { flag = 1; @@ -992,30 +995,30 @@ void FUN_L00_002a5dd8(Bolt *obj) { } if (flag) { fast_vec_normalize(&a, &hero.unk0[8], D_0015ED6C * 7.0f); - FUN_001f9a28(&b, &a, &v->vel); + fast_vec_sub(&b, &a, &v->vel); FUN_L00_0025f730(&b, frame_time_sq * 50.0f); - FUN_001f9a10(&v->vel, &v->vel, &b); + fast_vec_add(&v->vel, &v->vel, &b); } else { t = frame_time_sq * 10.0f; - if (t < FUN_001f9af0(&v->vel)) { + if (t < fast_vec_length(&v->vel)) { fast_vec_normalize(&a, &v->vel, t); - FUN_001f9a28(&v->vel, &v->vel, &a); + fast_vec_sub(&v->vel, &v->vel, &a); } approach_value(&v->speed, D_0015ED6C * 48.0f, frame_time_sq * 16.0f); x = D_0015ED6C * 8.0f; if (x < hero.motion.speed_xy) { fast_vec_normalize(&b, &hero.motion.displacement, (hero.motion.speed_xy - x) * 0.5f); - FUN_001f9a10(&obj->pos, &obj->pos, &b); + fast_vec_add(&obj->pos, &obj->pos, &b); } } quaternion_to_rotation_basis(&v->spin, &a); multiply_matrix3x3(&obj->rot, &a, &obj->rot); - FUN_001f9a10(&obj->pos, &obj->pos, &v->vel); - FUN_001f9a28(&d, &hero.motion.unkD0, &obj->pos); - if (v->speed < FUN_001f9af0(&d)) { + fast_vec_add(&obj->pos, &obj->pos, &v->vel); + fast_vec_sub(&d, &hero.motion.unkD0, &obj->pos); + if (v->speed < fast_vec_length(&d)) { if (!(v->unk4C == 0.0f && v->unk48 == 0.0f)) { transform_vector_by_basis(&d, &d, hero.unk40); - FUN_001f99f8(&e); + clear_u64_value(&e); e.f[1] = v->unk48; e.f[2] = v->unk4C; euler_rotation_basis(m, &e); @@ -1023,7 +1026,7 @@ void FUN_L00_002a5dd8(Bolt *obj) { transform_vector_by_basis(&d, &d, hero.unk0); } fast_vec_normalize(&d, &d, v->speed); - FUN_001f9a10(&obj->pos, &obj->pos, &d); + fast_vec_add(&obj->pos, &obj->pos, &d); return; } FUN_L00_002a6b70_c(obj); @@ -1134,12 +1137,12 @@ void FUN_L00_002a6b70(struct Moby *bolt) /* Steers a thrown moby along its path: builds its orientation from the data's angles and, when done, releases the held target. */ /* Ported from rac1-decomp (src/overlays/shared/vendor_002A5138.c: func_L00_002A8088), where it is exact; names translated to the US level program. */ -extern char *c338_p(void *) __asm__("FUN_L00_002603d0"); +extern char *FUN_L00_002603d0_c(void *) __asm__("FUN_L00_002603d0"); extern float D_0015ED6C; extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern int FUN_L00_002604f0(int x, char *o, float *p, float *q, float *r, float *s); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern void euler_rotation_basis(void *, void *) __asm__("FUN_001fa030"); extern void multiply_matrix3x3(void *, void *, void *) __asm__("FUN_001fa328"); @@ -1208,8 +1211,8 @@ void FUN_L00_002a6de8(char *moby, void *out1, void *out2) { multiply_matrix3x3(moby + 0xC0, m1, m0); fast_vec_scale(moby + 0x10, &m1[8], c3); fast_vec_scale(v70, moby + 0xC0, c4); - FUN_001f9a10(moby + 0x10, moby + 0x10, v70); - FUN_001f9a10(moby + 0x10, moby + 0x10, A); + fast_vec_add(moby + 0x10, moby + 0x10, v70); + fast_vec_add(moby + 0x10, moby + 0x10, A); if (out1 != 0) qcopy(out1, A); if (out2 != 0) @@ -1229,7 +1232,7 @@ void FUN_L00_002a6de8(char *moby, void *out1, void *out2) { moby[0x20] = 1; clear_u64_value(data + 0x30); *(float *)(data + 0x3C) = 1.0f; - x = c338_p(*(char **)(data + 0x5C)); + x = FUN_L00_002603d0_c(*(char **)(data + 0x5C)); if (x != 0) { qcopy(data + 0x20, x + 0x10); } else { @@ -1237,9 +1240,9 @@ void FUN_L00_002a6de8(char *moby, void *out1, void *out2) { } FUN_001f9bf8_u(C, &m1[8], D_0015ED6C); FUN_001f9bf8_u(D, (float *)(moby + 0xC0), D_0015ED6C); - FUN_001f9a10(C, C, D); - FUN_001f9a10(data + 0x20, data + 0x20, C); - FUN_001f9a10(moby + 0x10, moby + 0x10, data + 0x20); + fast_vec_add(C, C, D); + fast_vec_add(data + 0x20, data + 0x20, C); + fast_vec_add(moby + 0x10, moby + 0x10, data + 0x20); *(char **)(data + 0x5C) = 0; } } @@ -1319,7 +1322,7 @@ typedef struct { extern void *D_001413D0 __attribute__((section(".data"))); extern f32 random_angle_radians(void) __asm__("FUN_00213308"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern void FUN_L00_002502f0(void *, int, int, int); /* sets the moby colour */ +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); /* sets the moby colour */ extern void FUN_L00_001ff500(void *, void *, float); /* @@ -1378,7 +1381,7 @@ struct Moby *FUN_L00_002a7438(struct Moby *src, void *pos, void *vel, int flags, m->scale = m->pclass->scale * scale; euler_rotation_basis(&m->rot_row0, &m->rot); if ((src->flags & 0x20) && (color = *(u8 **)(src->pvars + 0xC)) != 0) - FUN_L00_002502f0(m, color[4], color[5], color[6]); + set_moby_color(m, color[4], color[5], color[6]); else m->spawn_frame = src->spawn_frame; v->unk6E = random_int_between(0, scale_game_frames(600)); @@ -1591,7 +1594,7 @@ void FUN_L00_002a7c70(O_002a7c70 *m) { extern char *FUN_002141f8_002a7d90(void *) __asm__("FUN_002141f8"); extern void *D_L00_00173E58_002a7d90 __asm__("D_L00_00173E58") __attribute__((section(".data"))); -/* True when the record for D_L00_00173E58 (FUN_002141f8) has byte 9 equal to 1. */ +/* True when the record for D_L00_00173E58 (suck_get_aim_height) has byte 9 equal to 1. */ int FUN_L00_002a7d90(void) { int r = 0; char *x = 0; @@ -1653,11 +1656,11 @@ extern f32 rnd_2a8028(f32, f32) __asm__("FUN_L00_00257c48"); extern f32 ang_2a8028(f32, f32) __asm__("FUN_001fa580"); extern void dir_2a8028(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 rndf_2a8028(f32, f32) __asm__("FUN_002132a8"); -extern void spawn_2a8028(void *, void *) __asm__("FUN_L00_0026c6e8"); +extern void FUN_L00_0026c6e8(void *, void *); extern s32 fr_2a8028(s32) __asm__("FUN_001f96f8"); extern s32 rndi_2a8028(s32, s32) __asm__("FUN_L00_00257b90"); extern void spawn_burst(void *, void *, s32, s32, s32, s32, f32) __asm__("FUN_L00_0026cbb0"); -extern void fin_2a8028(void *, s32) __asm__("FUN_L00_002a7e20"); +extern void FUN_L00_002a7e20_c(void *, s32) __asm__("FUN_L00_002a7e20"); void FUN_L00_002a8028(u8 *o) { V2a8028 v; V2a8028 w; @@ -1673,7 +1676,7 @@ void FUN_L00_002a8028(u8 *o) { dir_2a8028(&v, 0.2f, ang_2a8028(rnd_2a8028(0.0f, 3.1415927f), pitch), a); scale_vector_xyz(&w, &v, rndf_2a8028(1.0f, 3.0f)); add_vector_xyz(&w, &w, &D_L00_00173E60_2a8028); - spawn_2a8028(&w, &v); + FUN_L00_0026c6e8(&w, &v); } for (i = 9; i >= 0; i--) { w.f[0] = D_L00_00173E40_2a8028[8] + rnd_2a8028(0.0f, 0.1f); @@ -1685,7 +1688,7 @@ void FUN_L00_002a8028(u8 *o) { spawn_burst(&w, &v, 0x4F007FFF, 0x1FFFFFFF, rndi_2a8028(n, fr_2a8028(20)), 1, 20000.0f); } if (*(s16 *)(*(u8 **)(o + 0x78) + 0x78) == 0x2B) { - fin_2a8028(&D_L00_00173E60_2a8028, 10); + FUN_L00_002a7e20_c(&D_L00_00173E60_2a8028, 10); } } typedef struct N_2a82c0 { @@ -1731,12 +1734,12 @@ void FUN_L00_002a82c0(unsigned char *m) { } /* Ported from rac1-decomp (src/overlays/shared/vendor_002A5138.c: func_L00_002A96B8), where it is exact; names translated to the US level program. */ -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern void FUN_001f9bf8_u(float *, float *, float) __asm__("FUN_001f9bf8"); void FUN_L00_002a8418(float *v) { float k = 1.8325957f; - float a = FUN_001f9e90(v[0], v[1]); + float a = fast_arc_tan(v[0], v[1]); float t = fast_difference_between_rotations(hero.motion.rot.f[2], a); if (t > k) t = k; @@ -1804,7 +1807,7 @@ typedef union { extern WrenchAttack attack_records[] __asm__("D_L00_0017BC28"); extern WrenchMoby *D_L00_00177F00[]; -extern char *FUN_002141f8(void *); +extern char *suck_get_aim_height(void *) __asm__("FUN_002141f8"); extern char D_0013E533[]; extern f32 fast_add_rotations(f32, f32) __asm__("func_001FA580"); extern f32 fast_cos(f32) __asm__("func_001F9DC8"); @@ -1813,13 +1816,13 @@ extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); extern float D_0015ED6C MACRO_ADDR; extern float frame_time_sq __asm__("D_0015ED70") MACRO_ADDR; extern float frame_time_cube __asm__("D_0015ED74") MACRO_ADDR; -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float approach_value_alt(float*,float,float) __asm__("FUN_00213ed8"); extern float fast_difference_between_rotations(float, float) __asm__("func_001FA688"); extern float probe_ground_height(void *, int, float) __asm__("func_00213508"); extern int D_L00_00173E40_u[] __asm__("D_L00_00173E40"); extern int FUN_001efa68(void*,void*,int,int,int); -extern int FUN_001f0b58(void); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern int collect_mobies_in_sphere() __asm__("FUN_L00_001f2868"); extern int FUN_L00_00211870(float); extern int FUN_L00_00216de8(int,int); @@ -1835,7 +1838,7 @@ extern void FUN_L00_00232640(int); extern void FUN_L00_002336e8(float*,float*,float); extern void moby_point_position(void*,int,void*) __asm__("FUN_L00_0024f7c8"); extern void make_hit_descriptor(void*,void*,int,float,void*) __asm__("FUN_L00_00259888"); -extern void FUN_L00_00259bc8(void*,int,int,void*,void*,float); +extern void spawn_nearby_effect(void*,int,int,void*,void*,float) __asm__("FUN_L00_00259bc8"); extern void FUN_L00_0025b6b8(void*,void*,void*,float); extern void FUN_L00_00262480(char*,float,float,float); extern void FUN_L00_00262608(void*,int); @@ -1851,7 +1854,7 @@ extern void scale_vector_xyz(void *, void *, float) __asm__("FUN_001f9a68"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); int FUN_L00_002a7d90(void); int FUN_L00_002a7de0(void); -void FUN_L00_001edf60(int a, int b, void *pos, int kind, int mode, float x, float y, float z); +void suck_draw_reticle(int a, int b, void *pos, int kind, int mode, float x, float y, float z) __asm__("FUN_L00_001edf60"); void FUN_L00_002a7c70_c(void *m) __asm__("FUN_L00_002a7c70"); void FUN_L00_002a7e20(float *pos, int n); void FUN_L00_002a8028(u8 *o); @@ -1957,7 +1960,7 @@ void wrench_update(WrenchMoby *m) { moby_point_position(m,1,wrench_hero()->sweep_end); moby_point_position(wrench_hero()->moby,0,wrench_hero()->sweep_start); if (wrench_hero()->state==19 || wrench_hero()->state==112 || wrench_hero()->state==43) { - yaw=FUN_001f9e90(wrench_hero()->sweep_end[0]-wrench_hero()->position[0],wrench_hero()->sweep_end[1]-wrench_hero()->position[1]); + yaw=fast_arc_tan(wrench_hero()->sweep_end[0]-wrench_hero()->position[0],wrench_hero()->sweep_end[1]-wrench_hero()->position[1]); if (attack_records[wrench_hero()->attack_index].side==1) yaw=fast_add_rotations(yaw,-1.5707964f); else yaw=fast_add_rotations(yaw,1.5707964f); @@ -1965,7 +1968,7 @@ void wrench_update(WrenchMoby *m) { subtract_vector_xyz(work.v[0],sweep_end(),(sweep_end()-4)); normalize_vector_xyz(work.v[0],work.v[0],vector_length_xyz(work.v[0])+0.17f); if (sweep_hero()->move_mode!=15 && sweep_hero()->state!=112 && sweep_hero()->state!=20) { - difference=fast_difference_between_rotations(sweep_hero()->yaw,FUN_001f9e90(sweep_hero()->sweep_end[0]-sweep_hero()->position[0],sweep_hero()->sweep_end[1]-sweep_hero()->position[1])); + difference=fast_difference_between_rotations(sweep_hero()->yaw,fast_arc_tan(sweep_hero()->sweep_end[0]-sweep_hero()->position[0],sweep_hero()->sweep_end[1]-sweep_hero()->position[1])); if (difference>1.5707964f) active=0; FUN_L00_002a8418(work.v[0]); } @@ -1973,16 +1976,16 @@ void wrench_update(WrenchMoby *m) { if (sweep_hero()->state!=43 && sweep_hero()->state!=112 && difference<1.2217305f && scale_game_frames_alt(10)state_timer) { float angle; qcopy(work.v[0],sweep_hero()->position); work.v[0][2]+=0.5f; - angle=FUN_001f9e90(sweep_hero()->sweep_end[0]-sweep_hero()->position[0],sweep_hero()->sweep_end[1]-sweep_hero()->position[1]); + angle=fast_arc_tan(sweep_hero()->sweep_end[0]-sweep_hero()->position[0],sweep_hero()->sweep_end[1]-sweep_hero()->position[1]); qcopy(work.v[1],sweep_hero()->position); work.v[1][2]+=0.5f; work.v[2][0]=fast_cos(angle)*1.4f; work.v[2][1]=fast_sin(angle)*1.4f; work.v[2][2]=0.0f; FUN_L00_002a8418(work.v[2]); add_vector_xyz(work.v[1],work.v[1],work.v[2]); - if (!sweep_hero()->attack_cooldown && FUN_001efa68(work.v[0],work.v[1],2,0,0) && FUN_001f0b58()) { + if (!sweep_hero()->attack_cooldown && FUN_001efa68(work.v[0],work.v[1],2,0,0) && collision_hit_material()) { if (!collision_hit.moby || FUN_L00_0025e368((char*)collision_hit.moby)) { sweep_hero()->attack_cooldown=1; allocate_voice_for_target_entry_alt(2,0,(int)m); FUN_L00_002a8028((char*)m); if (collision_hit.moby) { work.v[3][0]=fast_cos(yaw); work.v[3][1]=fast_sin(yaw); work.v[3][2]=0.0f; - FUN_L00_00259bc8(collision_hit.moby,(int)m,0x10000,collision_hit.position,work.v[3],1.0f); + spawn_nearby_effect(collision_hit.moby,(int)m,0x10000,collision_hit.position,work.v[3],1.0f); } } } @@ -2023,7 +2026,7 @@ void wrench_update(WrenchMoby *m) { FUN_L00_002223f8(33,1); if (collision_hit.moby) { WrenchMoby *target=collision_hit.moby; - wrench_hero()->reaction_yaw=FUN_001f9e90(wrench_hero()->position[0]-target->position[0],wrench_hero()->position[1]-target->position[1]); + wrench_hero()->reaction_yaw=fast_arc_tan(wrench_hero()->position[0]-target->position[0],wrench_hero()->position[1]-target->position[1]); } else wrench_hero()->reaction_yaw=fast_add_rotations(wrench_hero()->yaw,3.1415927f); } break; @@ -2085,7 +2088,7 @@ void wrench_update(WrenchMoby *m) { } } collided=0; - if (FUN_001efa68(work.v[0],position,2,0,0) && FUN_001f0b58() && (!collision_hit.moby || !FUN_L00_0025e3b8((int)collision_hit.moby))) collided=collision_hit.surface!=0; + if (FUN_001efa68(work.v[0],position,2,0,0) && collision_hit_material() && (!collision_hit.moby || !FUN_L00_0025e3b8((int)collision_hit.moby))) collided=collision_hit.surface!=0; if (collided || d->collision) { d->collision=0; if (!wrench_hero()->attack_cooldown) { d->timer=scale_game_frames_alt(30); wrench_hero()->attack_cooldown=1; allocate_voice_for_target_entry_alt(2,0,(int)m); } @@ -2099,7 +2102,7 @@ void wrench_update(WrenchMoby *m) { moby_point_position(m,1,work.v[5]); if (collide_sphere(work.v[5],0.4f,0,wrench_hero()->moby,work.v[1]) || (moby_point_position(m,0,work.v[5]),collide_sphere(work.v[5],0.4f,0,wrench_hero()->moby,work.v[1]))) { if (!wrench_hero()->attack_cooldown && collision_hit.moby && (!collision_hit.moby->model || collision_hit.moby->model->kind!=20)) { - MobyHitState *hit=(MobyHitState*)FUN_002141f8(collision_hit.moby); + MobyHitState *hit=(MobyHitState*)suck_get_aim_height(collision_hit.moby); if (!hit || hit->hit_count<2 || hit->hit_index!=work.shifted.query.class_id) { work.q[7]=*(WrenchQuad*)collision_hit.moby->position; FUN_L00_0025b6b8(work.v[6],work.v[5],work.v[7],0.5f); FUN_L00_002a7e20(work.v[6],5); @@ -2164,7 +2167,7 @@ char *FUN_L00_002a96f8(void *owner, void *pos, float a, float b, float c, char * *(int *)(d + 0x20) = 0; *(char **)(d + 0x18) = tgt; if (tgt != 0) { - unsigned char *e = (unsigned char *)FUN_002141f8(tgt); + unsigned char *e = (unsigned char *)suck_get_aim_height(tgt); if (e != 0) { *(unsigned short *)(e + 0x1E) |= 0x80; if (e[0xB] != 0) *(int *)(d + 0x38) = 0; @@ -2207,7 +2210,7 @@ char *FUN_L00_002a96f8(void *owner, void *pos, float a, float b, float c, char * /* Ported from rac1-decomp (src/overlays/shared/vendor_002A5138.c: func_L00_002AAC50), where it is exact; names translated to the US level program. */ extern char *func_0020D348_m(int); -extern void FUN_L00_002502f0(void *, int, int, int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); void *FUN_L00_002a99b0(int unused, void *pos, int c, float scale, float a, float b) { char *m = func_0020D348_m(0x593); @@ -2215,7 +2218,7 @@ void *FUN_L00_002a99b0(int unused, void *pos, int c, float scale, float a, float char *d; float s; qcopy(m + 0x10, pos); - FUN_L00_002502f0(m, 0x80, 0x80, 0x70); + set_moby_color(m, 0x80, 0x80, 0x70); d = *(char **)(m + 0x78); s = scale + scale; *(float *)d = a; @@ -2346,7 +2349,7 @@ extern f32 spin_angles[] __asm__("D_L00_001613E0") __attribute__((section(".sdat extern f32 seg_sqrt(f32) __asm__("FUN_001f9988"); extern f32 appr_2a9c50(f32, f32) __asm__("FUN_001fa580"); int scale_game_frames(int) __asm__("FUN_001f96f8"); -float FUN_001fa6c0(int); +float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); extern f32 scale_time(f32) __asm__("FUN_001f96b0"); extern f32 fast_normalize_angle(f32) __asm__("FUN_001fa610"); extern void rotation_matrix(void *, void *) __asm__("FUN_001fa050"); @@ -2373,7 +2376,7 @@ void FUN_L00_002a9c50(M_2a9c50 *m) { rot.f[2] = 0.0f; rot.f[3] = 0.0f; spin_angles_x = 0.0f; - t = FUN_001fa6c0(D_L00_0015F5CC % scale_game_frames(180)); + t = convert_integer_to_float(D_L00_0015F5CC % scale_game_frames(180)); { f32 d = scale_time(180.0f); f32 r; @@ -2577,7 +2580,7 @@ extern float D_L00_00173E80[]; extern int D_L00_0015F5C4_c __asm__("D_L00_0015F5C4"); extern int D_L00_00173E40_u[] __asm__("D_L00_00173E40"); extern int FUN_001efa68(void*,void*,int,int,int); -extern int FUN_001f0b58(void); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern int fast_dec_timer(int*) __asm__("FUN_001f9740"); extern void *D_L00_00173E58_c[] __asm__("D_L00_00173E58"); @@ -2598,8 +2601,8 @@ int FUN_L00_002aa2a8(char *a0, char *o, int mode) { if (D_L00_0015F5C4_c != 0) return 0; qcopy(C, o + 0x10); if (*(unsigned char *)(o + 0x20) == 0) { - w[0] = fast_cos(fast_add_rotations_c(-0.36196801f, FUN_001f9e90(*(float *)(base + 0x670), *(float *)(base + 0x674)))) * 0.859039f; - w[1] = fast_sin(fast_add_rotations_c(-0.36196801f, FUN_001f9e90(*(float *)(base + 0x670), *(float *)(base + 0x674)))) * 0.859039f; + w[0] = fast_cos(fast_add_rotations_c(-0.36196801f, fast_arc_tan(*(float *)(base + 0x670), *(float *)(base + 0x674)))) * 0.859039f; + w[1] = fast_sin(fast_add_rotations_c(-0.36196801f, fast_arc_tan(*(float *)(base + 0x670), *(float *)(base + 0x674)))) * 0.859039f; *(int *)&w[2] = 0; add_vector_xyz(w, w, base + 0x80); w[2] = w[2] + 0.49082f; @@ -2625,7 +2628,7 @@ int FUN_L00_002aa2a8(char *a0, char *o, int mode) { *(u128 *)box = *(u128 *)(b2 + 0x10); box[2] = w[2]; if (FUN_001efa68(box, w, 0x10, (int)b2, 0) != 0) { - if (FUN_001f0b58() != 0 && D_L00_00173E40_u[7] > 0) { + if (collision_hit_material() != 0 && D_L00_00173E40_u[7] > 0) { qcopy(a0 + 0x10, (char *)D_L00_00173E40_u + 0x20); } } @@ -2638,7 +2641,7 @@ int FUN_L00_002aa2a8(char *a0, char *o, int mode) { B[2] = B[2] - frame_time_sq * 9.8f; } while (--i >= 0); if (FUN_001efa68(C, w, 0x12, (int)o, 0) == 0) continue; - if (FUN_001f0b58() == 0 && 0.0f < B[2]) continue; + if (collision_hit_material() == 0 && 0.0f < B[2]) continue; if (D_L00_00173E40_u[7] > 0) { qcopy(a0 + 0x10, (char *)D_L00_00173E40_u + 0x20); break; @@ -2664,3 +2667,40 @@ int FUN_L00_002aa2a8(char *a0, char *o, int mode) { } return 0; } + +s32 D_L00_001D7460[1] __attribute__((section(".data"))) = {0}; +s16 D_L01_001CBC4C[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001D78E0[1] __attribute__((section(".data"))) = {0}; +s16 D_L02_001CBDCC[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001CBEE0[1] __attribute__((section(".data"))) = {0}; +s16 D_L03_001CB8CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001CB9E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001CBA60[1] __attribute__((section(".data"))) = {0}; +s16 D_L05_001CBC4C[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001CBD60[1] __attribute__((section(".data"))) = {0}; +s16 D_L06_001CBF4C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001CC060[1] __attribute__((section(".data"))) = {0}; +s16 D_L07_001CB84C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001CB960[1] __attribute__((section(".data"))) = {0}; +s16 D_L08_001CBFCC[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001CC0E0[1] __attribute__((section(".data"))) = {0}; +s16 D_L09_001CB94C[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001CBA60[1] __attribute__((section(".data"))) = {0}; +s16 D_L10_001CBC4C[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001CBD60[1] __attribute__((section(".data"))) = {0}; +s16 D_L11_001CC1CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001CC2E0[1] __attribute__((section(".data"))) = {0}; +s16 D_L12_001CBC4C[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001CBD60[1] __attribute__((section(".data"))) = {0}; +s16 D_L13_001CBACC[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001CBBE0[1] __attribute__((section(".data"))) = {0}; +s16 D_L14_001CBECC[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001D87D0[1] __attribute__((section(".data"))) = {0}; +s16 D_L15_001CBDCC[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001CBEE0[1] __attribute__((section(".data"))) = {0}; +s16 D_L16_001CBC4C[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001CBD60[1] __attribute__((section(".data"))) = {0}; +s16 D_L17_001CC0CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001CC1E0[1] __attribute__((section(".data"))) = {0}; +s16 D_L18_001CC1CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001CC2E0[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/devastator.c b/src/overlays/shared/gameplay/entities/devastator.c index a1d0806aad..a374ba9135 100644 --- a/src/overlays/shared/gameplay/entities/devastator.c +++ b/src/overlays/shared/gameplay/entities/devastator.c @@ -100,7 +100,8 @@ extern void FUN_L00_0023e838_2b2100(int) __asm__("FUN_L00_0023e838"); extern int FUN_001f9770_2b2100(short *) __asm__("FUN_001f9770"); extern float D_L00_0017ACF4_lui __asm__("D_L00_0017ACF4") __attribute__((section(".data"))); -void FUN_L00_002b2100(struct Moby *m) { +void devastator_update(struct Moby *m) __asm__("FUN_L00_002b2100"); +void devastator_update(struct Moby *m) { Matrix3_2b2100 rotation; Matrix4_2b2100 inverse; Vec_2b2100 velocity; @@ -399,7 +400,8 @@ s32 FUN_L00_002b58d8_b3058(void *, void *, f32, f32) __asm__("FUN_L00_002b58d8") s32 FUN_001f96f8_b3058(s32) __asm__("FUN_001f96f8"); void FUN_0022da68_b3058(s32, s32, void *) __asm__("FUN_0022da68"); -void FUN_L00_002b3058(O_b3058 *o) { +void visibomb_update(O_b3058 *o) __asm__("FUN_L00_002b3058"); +void visibomb_update(O_b3058 *o) { V_b3058 *v; struct Hero *g; C_b3058 *c; @@ -1287,8 +1289,8 @@ extern s32 D_L00_0015F5CC; extern f32 D_0015ED6C_c __asm__("D_0015ED6C"); extern f32 random_angle_radians(void) __asm__("FUN_00213308"); -extern f32 FUN_001f9dc8(f32); -extern f32 FUN_001f9de0(f32); +extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); +extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern f32 random_float_between(f32, f32) __asm__("FUN_002132a8"); extern void FUN_001f9cf8(V4 *, V4 *, V4 *); extern s32 FUN_001f96f8_c2(s32) __asm__("FUN_001f96f8"); @@ -1315,8 +1317,8 @@ void FUN_L00_002b3c50(X *x) { u8 *p; g = x->f78; - l0.f[0] = FUN_001f9dc8(random_angle_radians()) * 0.05f; - l0.f[1] = FUN_001f9de0(random_angle_radians()) * 0.05f; + l0.f[0] = fast_cos(random_angle_radians()) * 0.05f; + l0.f[1] = fast_sin(random_angle_radians()) * 0.05f; l0.f[2] = 0.0f; l0.f[2] = -random_float_between(0.01f, 0.03f); FUN_001f9cf8(&l0, &l0, &x->vC0); @@ -1591,8 +1593,8 @@ extern int advance_moby_animation(void *) __asm__("func_0020D580"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern int tick_countdown_32_alt(int *arg0) __asm__("FUN_001f9740"); extern u32 D_0013C940[]; -extern unsigned char *FUN_002141f8(void *); -extern void FUN_L00_001f2868(void *, float, int, void *, void *); +extern unsigned char *suck_get_aim_height(void *) __asm__("FUN_002141f8"); +extern void collect_mobies_in_sphere(void *, float, int, void *, void *) __asm__("FUN_L00_001f2868"); extern void FUN_L00_002223f8(int, int); extern void FUN_L00_0024f7c8(void *, int, void *); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); @@ -1608,7 +1610,7 @@ float absolute_float(float input) __asm__("func_001F99C0"); int FUN_L00_0023e738(void *v, float a, float b_0023e738, float c, float d, float e); struct Moby *FUN_L00_002caf70(struct Moby *source, OvlVec4 *position, struct Moby *other, f32 vx, f32 vy, f32 height, f32 speed); unsigned char *FUN_L00_002b46a8_49a8(int ign, void *from, float *yaw, float *pitch) __asm__("FUN_L00_002b46a8"); -void FUN_L00_001edf60(int a, int b, void *pos, int kind, int mode, float x, float y, float z); +void suck_draw_reticle(int a, int b, void *pos, int kind, int mode, float x, float y, float z) __asm__("FUN_L00_001edf60"); void FUN_L00_0020e698(void); void FUN_L00_00233660(float *out, float x, float y, float z); void FUN_L00_0023e838(int); @@ -1668,7 +1670,8 @@ extern float func_001FA888_2B5C98(int) __asm__("FUN_001fa6c0"); extern int func_L00_0023F0D0_2B5C98(void *, float, float, float, float, float) __asm__("FUN_L00_0023e738"); extern void func_L00_0023F1D0_2B5C98(int) __asm__("FUN_L00_0023e838"); -void FUN_L00_002b49a8(struct Moby *moby) { +void blaster_update(struct Moby *moby) __asm__("FUN_L00_002b49a8"); +void blaster_update(struct Moby *moby) { V_2B5C98 velocity; V_2B5C98 aim_point; V_2B5C98 launch; @@ -2055,9 +2058,9 @@ typedef struct { extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void copy_matrix_rotation(void *, void *) __asm__("FUN_001fa298"); extern void multiply_matrix(void *, void *, void *) __asm__("FUN_001fa378"); -extern void FUN_001fa2b8(void *, void *); -extern void FUN_001f9d20(void *, void *, void *); -extern void FUN_001f9a10(void *, void *, void *); +extern void copy_matrix3x4(void *, void *) __asm__("FUN_001fa2b8"); +extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void refresh_moby_spatial_bounds_from_basis(void *) __asm__("FUN_0020e098"); void FUN_L00_002b5ba0(unsigned char *m, unsigned char *o) { @@ -2079,9 +2082,9 @@ void FUN_L00_002b5ba0(unsigned char *m, unsigned char *o) { euler_rotation_matrix(&b, *(unsigned char **)(o + 0x20) + 0x40); copy_matrix_rotation(&c, m + 0xC0); multiply_matrix(&a, &c, &b); - FUN_001fa2b8(*(unsigned char **)(o + 0x20) + 0xC0, &a); - FUN_001f9d20(&r, &k, &a); - FUN_001f9a10(*(unsigned char **)(o + 0x20) + 0x10, &r, m + 0x10); + copy_matrix3x4(*(unsigned char **)(o + 0x20) + 0xC0, &a); + transform_vector(&r, &k, &a); + fast_vec_add(*(unsigned char **)(o + 0x20) + 0x10, &r, m + 0x10); refresh_moby_spatial_bounds_from_basis(*(unsigned char **)(o + 0x20)); } /* spawns a burst of sparks and glow flashes at a moby, scaled by its distance from the origin marker */ @@ -2246,7 +2249,8 @@ extern float D_L00_001614A4 __attribute__((sda)); extern float D_L00_001614A8 __attribute__((sda)); extern int D_L00_0015F608_macro __asm__("D_L00_0015F608") __attribute__((section(".sdata"))); /* visibomb_missile update (moby class 172): drift, homing toward the target, arming countdown. */ -void FUN_L00_002b6140(struct Moby *m) { +void visibomb_missile_update(struct Moby *m) __asm__("FUN_L00_002b6140"); +void visibomb_missile_update(struct Moby *m) { V_2b6140 v20; V_2b6140 k30; V_2b6140 k40; @@ -2606,7 +2610,8 @@ s32 FUN_L00_002b6bc8(Moby *m, f32 radius) { #endif -void FUN_L00_002b6f10(Moby *m) { +void taunter_update(Moby *m) __asm__("FUN_L00_002b6f10"); +void taunter_update(Moby *m) { Vars *o; s32 v; s32 a; @@ -2965,7 +2970,8 @@ void FUN_001fa328_2b77f0(void *, void *, void *) __asm__("FUN_001fa328"); void FUN_001f9c48_alt_2b77f0(void *, void *, void *) __asm__("FUN_001f9c48"); void FUN_L00_00250df8_2b77f0(void) __asm__("FUN_L00_00250df8"); -void FUN_L00_002b77f0(unsigned char *m) { +void pyrocitor_update(unsigned char *m) __asm__("FUN_L00_002b77f0"); +void pyrocitor_update(unsigned char *m) { unsigned char *v = *(unsigned char **)(m + 0x78); Vec_2b77f0 pos, dir, scratch, endpoint, particle_pos, random_vec; struct { @@ -3401,10 +3407,10 @@ extern int allocate_voice_for_target_entry_alt(int, int, int) __asm__("FUN_0022d extern void FUN_L00_002ba970(char *); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern int tick_countdown_32_alt(int *arg0) __asm__("FUN_001f9740"); -extern s32 FUN_L00_0028d8c0(struct Moby *, s32); +extern s32 voice_is_playing(struct Moby *, s32) __asm__("FUN_L00_0028d8c0"); extern u32 D_0013C940[]; extern u8 D_0013E550[]; -extern unsigned char *FUN_002141f8(void *); +extern unsigned char *suck_get_aim_height(void *) __asm__("FUN_002141f8"); extern void FUN_L00_0024f7c8(void *, int, void *); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void enqueue_callback_list_1_alt(void (*)(void), void *) __asm__("FUN_001f4600"); @@ -3453,7 +3459,8 @@ extern void FUN_L00_0020e4c8_2b2100a(void) __asm__("FUN_L00_0020e4c8"); extern void FUN_L00_0020e698_2b2100(void) __asm__("FUN_L00_0020e698"); extern void FUN_L00_0023e838_2b2100a(int) __asm__("FUN_L00_0023e838"); -void FUN_L00_002b87e0(struct Moby *m) { +void tesla_claw_update(struct Moby *m) __asm__("FUN_L00_002b87e0"); +void tesla_claw_update(struct Moby *m) { V_2B9AD8 t; Data_2B9AD8 *s = (Data_2B9AD8 *)m->pvars; int active; @@ -3902,3 +3909,5 @@ void FUN_L00_002b4198(void *p) { break; } } + +f32 D_L15_001D034C[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/find_moby_hit.c b/src/overlays/shared/gameplay/entities/find_moby_hit.c index 336f3b83ca..5c6c37c7a7 100644 --- a/src/overlays/shared/gameplay/entities/find_moby_hit.c +++ b/src/overlays/shared/gameplay/entities/find_moby_hit.c @@ -4,6 +4,7 @@ void probe_ground_height(void *, s32, f32) __asm__("FUN_00213508"); /* Calls probe_ground_height(a, 0x20, 0.5f). */ +void FUN_L00_00259710(void *a); void FUN_L00_00259710(void *a) { probe_ground_height(a, 0x20, 0.5f); } @@ -49,6 +50,7 @@ int FUN_L00_00259830(char *a) { extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); /* Fills a record with b, c, d and flag 0, and clears the 64-bit value at its start. */ +void FUN_L00_00259858(char *a, int b, int c, float d); void FUN_L00_00259858(char *a, int b, int c, float d) { *(int *)(a + 0x10) = b; *(int *)(a + 0x14) = c; @@ -69,7 +71,8 @@ void make_hit_descriptor(char *a, int b, int c, float d, void *q) { #include "eetypes.h" #include "rnc/math/fast_math.h" extern int collect_mobies_in_sphere(void *, float, int, void *, void *) __asm__("FUN_L00_001f2868"); -int FUN_L00_002598b0(void *moby, void *position, int c, float d, float e, float f, int g, int h, int i) { +int play_entity_sound(void *moby, void *position, int c, float d, float e, float f, int g, int h, int i) __asm__("FUN_L00_002598b0"); +int play_entity_sound(void *moby, void *position, int c, float d, float e, float f, int g, int h, int i) { float direction[4] __attribute__((aligned(16))); char descriptor[0x30] __attribute__((aligned(16))); if (*(unsigned short *)((char *)moby + 0x34) & 0x100) { @@ -89,12 +92,12 @@ int FUN_L00_002598b0(void *moby, void *position, int c, float d, float e, float return collect_mobies_in_sphere(position, d, i, moby, descriptor); } extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern int FUN_L00_002598b0(void *, void *, int, float, float, float, int, int, int); -/* Calls FUN_L00_002598b0 at a moby point; the f13 argument is ignored and c is passed again as a float. */ +extern int play_entity_sound(void *, void *, int, float, float, float, int, int, int) __asm__("FUN_L00_002598b0"); +/* Calls play_entity_sound at a moby point; the f13 argument is ignored and c is passed again as a float. */ int FUN_L00_002599e8(void *moby, int point, int c, float d, float unused, float f, int g, int h, int i) { float position[4] __attribute__((aligned(16))); moby_point_position(moby, point, position); - return FUN_L00_002598b0(moby, position, c, d, (float)c, f, g, h, i); + return play_entity_sound(moby, position, c, d, (float)c, f, g, h, i); } typedef unsigned int u128_259a88 __attribute__((mode(TI), aligned(16))); typedef struct { @@ -125,6 +128,7 @@ typedef struct { extern G_259a88 D_L00_00173E40_259a88 __asm__("D_L00_00173E40") __attribute__((section(".data"))); extern T_259a88 D_L00_00178100_259a88[] __asm__("D_L00_00178100") __attribute__((section(".data"))); void FUN_001f99f8_259a88(void *) __asm__("FUN_001f99f8"); +void FUN_L00_00259a88(unsigned char *m, L_259a88 *src); void FUN_L00_00259a88(unsigned char *m, L_259a88 *src) { L_259a88 l; int i = D_L00_00173E40_259a88.idx; @@ -171,9 +175,10 @@ typedef struct { } G_259bc8; extern G_259bc8 D_L00_00173E40 __attribute__((section(".data"))); extern T_259bc8 moby_hits[] __asm__("D_L00_00178100") __attribute__((section(".data"))); -extern float FUN_001f9af0(void *); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); -void FUN_L00_00259bc8(unsigned char *m, int x, int y, u128 *p, u128 *q, float f) { +void spawn_nearby_effect(unsigned char *m, int x, int y, u128 *p, u128 *q, float f) __asm__("FUN_L00_00259bc8"); +void spawn_nearby_effect(unsigned char *m, int x, int y, u128 *p, u128 *q, float f) { int i = D_L00_00173E40.idx; T_259bc8 *e; if (m[0xA4] != 0xFF) { @@ -187,7 +192,7 @@ void FUN_L00_00259bc8(unsigned char *m, int x, int y, u128 *p, u128 *q, float f) e->f = f; e->owner = m; e->z = 0; - if (FUN_001f9af0(q) > 0.0001f) { + if (fast_vec_length(q) > 0.0001f) { e->flag = 1; } else { e->flag = 0; @@ -260,7 +265,8 @@ extern int FUN_001f0b58_00259fe8(void) __asm__("FUN_001f0b58"); extern float FUN_001f99c0_00259fe8(float) __asm__("FUN_001f99c0"); extern E_259fe8_00259fe8 D_L00_0016E080[] __attribute__((section(".data"))); -void FUN_L00_00259fe8(unsigned char *m, float r) { +void jet_animate(unsigned char *m, float r) __asm__("FUN_L00_00259fe8"); +void jet_animate(unsigned char *m, float r) { float h, y; if (m[0x31] == 0) return; @@ -281,8 +287,9 @@ void FUN_L00_00259fe8(unsigned char *m, float r) { /* Ported from rac1-decomp (src/overlays/shared/mobyutil_00258BC8.c: func_L00_0025B178), where it is exact; names translated to the US level program. */ extern int D_L00_00173E40_25a120[] __asm__("D_L00_00173E40"); -extern int func_L00_001EFFF0(void *, void *, int, int, int) __asm__("FUN_001efa68"); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); +void FUN_L00_0025a120(char *o); void FUN_L00_0025a120(char *o) { float a[4]; float b[4]; @@ -294,7 +301,7 @@ void FUN_L00_0025a120(char *o) { } qcopy(b, p); b[2] = b[2] + 0.5f; - if (func_L00_001EFFF0(b, a, 0x22, 0, 0) != 0) { + if (collision_line(b, a, 0x22, 0, 0) != 0) { float *t = (float *)D_L00_00173E40_25a120; *(float *)(o + 0x84) = t[10] - 0.2f; *(float *)(o + 0x88) = t[10] + 0.2f; @@ -375,14 +382,14 @@ typedef struct { extern f32 D_L00_00160080[2] __attribute__((sda)); extern f32 D_L00_001B01C8[][8]; extern u8 D_L00_001B0180[][4]; -extern Q_25a478 *FUN_002141f8(void *); +extern Q_25a478 *suck_get_aim_height(void *) __asm__("FUN_002141f8"); extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern f32 FUN_001f9e90_c(f32, f32) __asm__("FUN_001f9e90"); -extern f32 FUN_001f9dc8(f32); -extern f32 FUN_001f9de0(f32); +extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); +extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern f32 FUN_001f9af0_c(void *) __asm__("FUN_001f9af0"); -extern void FUN_001f9a68(void *, void *, f32); +extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern void fast_vec_normalize(void *, void *, f32) __asm__("FUN_001f9bf8"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void set_vector_length_xy(void *, void *, f32) __asm__("FUN_001f9c48"); @@ -440,7 +447,8 @@ typedef union { } U25ab48; float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); float vector_length_xy(void *) __asm__("FUN_001f9b20"); -void FUN_L00_0025ab48(OvlQuad *v, float *ang, float *s1, float *s2) { +void trooper_knockback_arc(OvlQuad *v, float *ang, float *s1, float *s2) __asm__("FUN_L00_0025ab48"); +void trooper_knockback_arc(OvlQuad *v, float *ang, float *s1, float *s2) { U25ab48 t; t.q = *v; if (t.f[3] != 5627.9248046875f) { @@ -465,6 +473,7 @@ typedef struct { extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); +float FUN_L00_0025abf0(float *a, float *b, float *out, float speed, float g); float FUN_L00_0025abf0(float *a, float *b, float *out, float speed, float g) { Vc0 d; float t; @@ -760,6 +769,7 @@ int FUN_L00_0025b440(O_25b440 *o, S_25b440 *s) { return s->state; } /* Linear interpolation: a + (b - a) * t. */ +f32 FUN_L00_0025b6a8(f32 a, f32 b, f32 t); f32 FUN_L00_0025b6a8(f32 a, f32 b, f32 t) { return a + (b - a) * t; } @@ -771,6 +781,7 @@ typedef union { f32 f[4]; } Vec4_25b6b8 __attribute__((aligned(16))); +void FUN_L00_0025b6b8(f32 t, f32 *out, f32 *a, f32 *b); void FUN_L00_0025b6b8(f32 t, f32 *out, f32 *a, f32 *b) { Vec4_25b6b8 left, right; f32 *dest = out; @@ -794,6 +805,7 @@ extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); /* Turns from angle a toward angle b by fraction c of the difference. */ +float FUN_L00_0025b750(float a, float b, float c); float FUN_L00_0025b750(float a, float b, float c) { float r = fast_subtract_rotations(b, a); return fast_add_rotations(a, r * c); @@ -823,3 +835,7 @@ void FUN_L00_0025b798(float *ptr, float rate, float b, float c, float limit) { *ptr = -absolute_float(rate); } } + +s32 D_L03_00173F54[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_00173FD4[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_00174554[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/gadgebot_spawn_container.c b/src/overlays/shared/gameplay/entities/gadgebot_spawn_container.c index 4593ede0e5..189546512a 100644 --- a/src/overlays/shared/gameplay/entities/gadgebot_spawn_container.c +++ b/src/overlays/shared/gameplay/entities/gadgebot_spawn_container.c @@ -14,8 +14,8 @@ extern float random_float_between(float, float) __asm__("FUN_002132a8"); extern float random_angle_radians(void) __asm__("FUN_00213308"); extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_sin(float) __asm__("FUN_001f9de0"); -extern float FUN_001f9e90(float, float); -extern int FUN_001f96f8(int); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern char *D_001413D0 __attribute__((section(".data"))); extern float D_0015ED6C; extern unsigned char *FUN_L06_00300c60(char *, float *, float *); @@ -58,11 +58,11 @@ void FUN_L06_002d8178(void *moby_ptr, void *target_ptr) { vel[2] = 0.0f; speed = random_float_between(D_0015ED6C * 0.7f, D_0015ED6C * 1.5f); if (target != 0) { - direction_angle = FUN_001f9e90(*(float *)(target + 0x10), *(float *)(target + 0x14)); + direction_angle = fast_arc_tan(*(float *)(target + 0x10), *(float *)(target + 0x14)); vel[0] += fast_cos(direction_angle) * speed; - vel[1] += fast_sin(FUN_001f9e90(*(float *)(target + 0x10), *(float *)(target + 0x14))) * speed; + vel[1] += fast_sin(fast_arc_tan(*(float *)(target + 0x10), *(float *)(target + 0x14))) * speed; } else { - direction_angle = FUN_001f9e90(*(float *)(moby + 0x10) - hero.motion.pos.f[0], + direction_angle = fast_arc_tan(*(float *)(moby + 0x10) - hero.motion.pos.f[0], *(float *)(moby + 0x14) - hero.motion.pos.f[1]); vel[0] += fast_cos(direction_angle) * speed; vel[1] += fast_sin(direction_angle) * speed; @@ -76,7 +76,7 @@ void FUN_L06_002d8178(void *moby_ptr, void *target_ptr) { *(int *)(moby + 0x94) = 0; moby[0x20] = 2; *(unsigned short *)(moby + 0x34) |= 1; - moby[0xbc] = (unsigned char)FUN_001f96f8(15); + moby[0xbc] = (unsigned char)scale_game_frames(15); } #define NOT_SDA @@ -108,7 +108,7 @@ char *FUN_L06_002d8510(char *owner) { return moby; } extern int level_frame_count __asm__("D_L06_0015F5CC"); -extern float FUN_001f9de0(float); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern int FUN_L00_001fefc8(void *); @@ -117,7 +117,8 @@ extern void FUN_L06_002d8178(void *, void *); extern void FUN_L06_002d8738(char *); extern void enqueue_callback_list_1(int, int) __asm__("FUN_001f4600"); -void FUN_L06_002d85a0(unsigned char *moby) { +void gadgebot_spawn_container_update(unsigned char *moby) __asm__("FUN_L06_002d85a0"); +void gadgebot_spawn_container_update(unsigned char *moby) { char *p = find_moby_hit(moby, 0x10000, 0); float tmp[4]; int t; @@ -134,7 +135,7 @@ void FUN_L06_002d85a0(unsigned char *moby) { if (f > 3.14159274f) { f -= 6.28318548f; } - f = (FUN_001f9de0(f) + 1.0f) * 0.5f; + f = (fast_sin(f) + 1.0f) * 0.5f; *(int *)(moby + 0x90) = fast_tween_color(0x80464646, 0x80828282, f); if (p != 0) { FUN_L06_002d8178(moby, p); @@ -159,10 +160,10 @@ extern float FUN_001f99c0(float); extern float square_root(float) __asm__("FUN_001f9988"); extern long get_effect_texture(int) __asm__("FUN_001f44b8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); -extern void FUN_001f9cf8(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); -extern float FUN_001f9ab0(void *, void *); +extern float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void fast_draw_quad_real(void *, int, int) __asm__("FUN_001f7d30"); extern char D_L06_00167540[]; @@ -225,13 +226,13 @@ void FUN_L06_002d8738(char *moby) { float *uv = &D_L06_001D4360[0][0]; for (i = 0; i < 57; i++) { transform_vector(D_L06_001D4530[i], D_L06_001D3290[i], matrix); - FUN_001f9a28(direction, D_L06_001D4530[i], D_L06_00167540); + fast_vec_sub(direction, D_L06_001D4530[i], D_L06_00167540); fast_vec_normalize(direction, direction, 1.0f); transform_vector(normal, D_L06_001D3D30[i], matrix); fast_vec_normalize(normal, normal, *(float *)&D_L06_00161C64_globals[float8C]); - scale = FUN_001f9ab0(normal, direction); + scale = fast_vec_dot(normal, direction); fast_vec_scale(projected, normal, scale + scale); - FUN_001f9a28(projected, direction, projected); + fast_vec_sub(projected, direction, projected); fast_vec_normalize(projected, projected, 1.0f); projected[2] += 1.0f; scale = square_root(projected[2] + projected[2]); @@ -267,10 +268,10 @@ void FUN_L06_002d8738(char *moby) { i = 0; do { transform_vector(facePos, D_L06_001D40C0[i], matrix); - FUN_001f9a28(direction, facePos, D_L06_00167540); + fast_vec_sub(direction, facePos, D_L06_00167540); fast_vec_normalize(direction, direction, 1.0f); - FUN_001f9cf8(facePos, D_L06_001D3A90[i++], matrix); - if (!(0.0f < FUN_001f9ab0(direction, facePos))) { + transform_vector_by_basis(facePos, D_L06_001D3A90[i++], matrix); + if (!(0.0f < fast_vec_dot(direction, facePos))) { short *indices = D_L06_001D3620[i - 1]; float (*corner)[4] = quad.corner; float *uvOut = &quad.uv[0][0]; @@ -318,19 +319,20 @@ char *FUN_L06_002d8b98(char *owner) { } /* Ported from rac1-decomp (src/overlays/shared/vendor_002D9548.c: func_L06_002D9FF0), where it is exact; names translated to the US level program. */ -extern float FUN_001f9de0(float); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern int level_frame_count __asm__("D_L06_0015F5CC"); /* no foreign declaration */ extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern s32 level_frame_count __asm__("D_L06_0015F5CC"); -void FUN_L06_002d8c20(char *moby) { +void gadgebot_spawn_pad_update(char *moby) __asm__("FUN_L06_002d8c20"); +void gadgebot_spawn_pad_update(char *moby) { char *p = *(char **)(moby + 0xB8); if (p != 0 && (unsigned char)p[0x20] < 2) { int t = *(int *)&level_frame_count; float f = (float)(t % 150) / 150.0f * 2.0f * 3.14159274f; if (f > 3.14159274f) f -= 6.28318548f; - f = (FUN_001f9de0(f) + 1.0f) * 0.5f; + f = (fast_sin(f) + 1.0f) * 0.5f; *(int *)(moby + 0x90) = fast_tween_color(0x80464646, 0x80828282, f); } else { *(int *)(moby + 0x90) = fast_tween_color(*(int *)(moby + 0x90), 0x80464646, 0.1f); @@ -362,13 +364,13 @@ extern f32 random_float_between_c(f32, f32) __asm__("func_002132A8"); extern f32 vector_length_xy_c(void *) __asm__("FUN_001f9b20"); extern float D_0015ED6C_gp __asm__("D_0015ED6C") __attribute__((section(".sdata"))); extern float D_0015ED70 __attribute__((section(".sdata"))); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float FUN_L00_0025abf0(void *, void *, void *, float, float); extern float probe_ground_height_c(void *, int, float) __asm__("func_00213508"); extern int *D_L06_001B0C30[]; extern int D_L06_0015F5C4 __attribute__((section(".sdata"))); extern int D_L06_0015FDF8 __attribute__((section(".sdata"))); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int FUN_L00_00261b48(int, void *, void *, void *); extern int FUN_L00_002dc9f0(void *, void *); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); @@ -401,7 +403,8 @@ extern void func_L06_002EA920_x(void *) __asm__("FUN_L06_002e94f0"); extern void func_L06_002EB360_x(void *) __asm__("FUN_L06_002e9f30"); extern void func_L00_0025D5B0_x(void *, void *, int, int, int, float) __asm__("FUN_L00_0025c558"); -void FUN_L06_002e8678(unsigned char *moby) { +void frog_update(unsigned char *moby) __asm__("FUN_L06_002e8678"); +void frog_update(unsigned char *moby) { float A[4] __attribute__((aligned(16))); float B[4] __attribute__((aligned(16))); float C[4] __attribute__((aligned(16))); @@ -496,7 +499,7 @@ void FUN_L06_002e8678(unsigned char *moby) { break; } case 1: - if (FUN_001f9b80(moby + 0x10, target + 0x10) < 4.0f) { + if (vector_distance(moby + 0x10, target + 0x10) < 4.0f) { *(unsigned short *)(moby + 0x34) &= 0xFFBE; func_L06_002EB360_x(moby); moby[0x20] = 8; @@ -507,7 +510,7 @@ void FUN_L06_002e8678(unsigned char *moby) { subtract_vector_xyz(A, target + 0x10, moby + 0x10); FUN_L06_002e9aa8_c((char *)moby); FUN_L06_002e9998_c((char *)moby, (float *)D_L06_00174600, A); - if (FUN_001f9b80(((char *)&D_0013F3D0), moby + 0x10) < *(float *)(data + 0x24C)) { + if (vector_distance(((char *)&D_0013F3D0), moby + 0x10) < *(float *)(data + 0x24C)) { moby[0x20] = 4; if (moby[0x53] != 4) blend_moby_animation_c(moby, 4, 0, scale_game_frames_alt(5)); } @@ -533,14 +536,14 @@ void FUN_L06_002e8678(unsigned char *moby) { } qcopy(data + 0x210, (char *)path + point_count * 16); qcopy(data + 0x230, data + 0x210); - dist = FUN_001f9b80(moby + 0x10, data + 0x210); + dist = vector_distance(moby + 0x10, data + 0x210); return_speed = dist / (float)scale_game_frames_alt(30); *(float *)(data + 0x138) = return_speed; *(float *)(data + 0x13C) = FUN_L00_0025abf0(moby + 0x10, data + 0x210, 0, return_speed, -*(float *)(data + 0x130)); data[0x15D] = 3; *(int *)(data + 0x144) = 5; func_L00_0025D5B0_x(moby, data + 0x120, 2, 1, 0, - FUN_001f9e90(*(float *)(data + 0x210) - *(float *)(moby + 0x10), *(float *)(data + 0x214) - *(float *)(moby + 0x14))); + fast_arc_tan(*(float *)(data + 0x210) - *(float *)(moby + 0x10), *(float *)(data + 0x214) - *(float *)(moby + 0x14))); moby[0x20] = 5; } break; @@ -548,7 +551,7 @@ void FUN_L06_002e8678(unsigned char *moby) { case 5: set_vector_unit_z(A); FUN_L06_002e9998_c((char *)moby, A, (float *)(data + 0x120)); - if (FUN_L00_0025c698(moby, data + 0x120) & 1) { + if (mine_fall(moby, data + 0x120) & 1) { moby[0x20] = 7; if (moby[0x53] != 3) blend_moby_animation_c(moby, 3, 0, 1); *(float *)(moby + 0x54) = 1.0f; @@ -556,7 +559,7 @@ void FUN_L06_002e8678(unsigned char *moby) { } break; case 6: { - int hit = FUN_L00_0025c698(moby, data + 0x120); + int hit = mine_fall(moby, data + 0x120); if (hit & 1) { moby[0x20] = 7; if (moby[0x53] != 3) blend_moby_animation_c(moby, 3, 0, 1); @@ -603,7 +606,7 @@ void FUN_L06_002e8678(unsigned char *moby) { } break; case 9: { - float angle = fast_add_rotations_c(FUN_001f9e90(*(float *)(target + 0x10) - *(float *)(moby + 0x10), *(float *)(target + 0x14) - *(float *)(moby + 0x14)), *(float *)(data + 0x1D4)); + float angle = fast_add_rotations_c(fast_arc_tan(*(float *)(target + 0x10) - *(float *)(moby + 0x10), *(float *)(target + 0x14) - *(float *)(moby + 0x14)), *(float *)(data + 0x1D4)); B[0] = fast_cos_c(angle); B[1] = fast_sin_c(angle); B[2] = 0.0f; @@ -611,7 +614,7 @@ void FUN_L06_002e8678(unsigned char *moby) { FUN_L06_002e9998_c((char *)moby, (float *)D_L06_00174600, B); normalize_vector_xyz(A, moby + 0xC0, *(float *)(data + 0x1E4) * D_0015ED6C_gp); FUN_L06_002e9b60_c(moby, A, 1, 0.3f, 0.3f); - if (FUN_001f9b80(moby + 0x10, target + 0x10) < 2.0f) { + if (vector_distance(moby + 0x10, target + 0x10) < 2.0f) { moby[0x20] = 0xC; if (moby[0x53] != 5) blend_moby_animation_c(moby, 5, 4, scale_game_frames_alt(10)); } else if (*(int *)(data + 0x1C4) == 2) { @@ -621,7 +624,7 @@ void FUN_L06_002e8678(unsigned char *moby) { } case 10: { int near; - float angle = fast_add_rotations_c(FUN_001f9e90(*(float *)(target + 0x10) - *(float *)(moby + 0x10), *(float *)(target + 0x14) - *(float *)(moby + 0x14)), *(float *)(data + 0x1D4)); + float angle = fast_add_rotations_c(fast_arc_tan(*(float *)(target + 0x10) - *(float *)(moby + 0x10), *(float *)(target + 0x14) - *(float *)(moby + 0x14)), *(float *)(data + 0x1D4)); qcopy(C, moby + 0x10); B[0] = fast_cos_c(angle); B[1] = fast_sin_c(angle); @@ -640,7 +643,7 @@ void FUN_L06_002e8678(unsigned char *moby) { } else if (near) { moby[0x20] = 0xB; if (moby[0x53] != 6) blend_moby_animation_c(moby, 6, 0, scale_game_frames_alt(10)); - } else if (FUN_001f9b80(moby + 0x10, target + 0x10) < 2.0f) { + } else if (vector_distance(moby + 0x10, target + 0x10) < 2.0f) { moby[0x20] = 0xC; if (moby[0x53] != 5) blend_moby_animation_c(moby, 5, 0, scale_game_frames_alt(10)); } @@ -654,8 +657,8 @@ void FUN_L06_002e8678(unsigned char *moby) { break; case 12: { float wait; - B[0] = fast_cos_c(FUN_001f9e90(*(float *)(target + 0x10) - *(float *)(moby + 0x10), *(float *)(target + 0x14) - *(float *)(moby + 0x14))); - B[1] = fast_sin_c(FUN_001f9e90(*(float *)(target + 0x10) - *(float *)(moby + 0x10), *(float *)(target + 0x14) - *(float *)(moby + 0x14))); + B[0] = fast_cos_c(fast_arc_tan(*(float *)(target + 0x10) - *(float *)(moby + 0x10), *(float *)(target + 0x14) - *(float *)(moby + 0x14))); + B[1] = fast_sin_c(fast_arc_tan(*(float *)(target + 0x10) - *(float *)(moby + 0x10), *(float *)(target + 0x14) - *(float *)(moby + 0x14))); B[2] = 0.0f; FUN_L06_002e9998_c((char *)moby, (float *)(moby + 0xE0), B); wait = compute_interpolated_record_value_c(moby); @@ -665,7 +668,7 @@ void FUN_L06_002e8678(unsigned char *moby) { FUN_L00_002599e8(moby, 0, 1, 0.333f, 1.0f, 1.0f, 0, 1, 0); return; } - if ((moby[0x70] & 2) && FUN_001f9b80(moby + 0x10, target + 0x10) > 2.0f) { + if ((moby[0x70] & 2) && vector_distance(moby + 0x10, target + 0x10) > 2.0f) { moby[0x20] = 9; if (moby[0x53] != 4) blend_moby_animation_c(moby, 4, 0, scale_game_frames_alt(10)); } @@ -677,7 +680,7 @@ void FUN_L06_002e8678(unsigned char *moby) { FUN_L06_002e9998_c((char *)moby, (float *)D_L06_00174600, B); normalize_vector_xyz(A, moby + 0xC0, *(float *)(data + 0x1E4) * D_0015ED6C_gp); FUN_L06_002e9b60_c(moby, A, 1, 0.3f, 0.3f); - if (FUN_001f9b80(moby + 0x10, data + 0x210) < 2.0f) { + if (vector_distance(moby + 0x10, data + 0x210) < 2.0f) { moby[0x20] = 8; if (moby[0x53] != 4) blend_moby_animation_c(moby, 4, 0, scale_game_frames_alt(10)); } else if (*(int *)(data + 0x1C4) != 2) { @@ -877,8 +880,8 @@ void FUN_L06_002e94f0(struct Moby *moby) { /* Build an orthogonal frame from two vectors and apply it to the matrix at moby+0xC0. */ /* Ported from rac1-decomp (src/overlays/shared/vendor_002D9548.c: func_L06_002EADC8), where it is exact; names translated to the US level program. */ -extern float FUN_001f9ab0(void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void quaternion_nlerp(void *, void *, void *, float) __asm__("FUN_001fa400"); extern void quaternion_to_rotation_basis(void *, void *) __asm__("FUN_001fa480"); extern void extract_matrix_rotation_quaternion(void *, void *) __asm__("FUN_002144d8"); @@ -890,9 +893,9 @@ void FUN_L06_002e9998(char *m, float *a1, float *a2) { float d; float A[4], B[4], C[4], D[4], E[4], F[4], G[4], H[4]; fast_vec_normalize(C, a1, 1.0f); - d = FUN_001f9ab0(C, a2); + d = fast_vec_dot(C, a2); fast_vec_normalize(E, C, d); - FUN_001f9a28(D, a2, E); + fast_vec_sub(D, a2, E); fast_vec_normalize(D, D, 1.0f); qcopy(H, C); qcopy(F, D); @@ -905,8 +908,8 @@ void FUN_L06_002e9998(char *m, float *a1, float *a2) { } /* Ported from rac1-decomp (src/overlays/shared/vendor_002D9548.c: func_L06_002EAED8), where it is exact; names translated to the US level program. */ -extern int FUN_001efa68(void *, void *, int, int, int); -extern void FUN_001f9a10(void *, void *, void *); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); void FUN_L06_002e9aa8(char *moby) { float a[4]; @@ -914,13 +917,13 @@ void FUN_L06_002e9aa8(char *moby) { float c[4]; qcopy(b, moby + 0x10); fast_vec_normalize(c, moby + 0xE0, 1.0f); - FUN_001f9a10(b, b, c); + fast_vec_add(b, b, c); qcopy(a, moby + 0x10); fast_vec_normalize(c, moby + 0xE0, -1.0f); - FUN_001f9a10(a, a, c); - FUN_001efa68(b, a, 2, 0, 0); + fast_vec_add(a, a, c); + collision_line(b, a, 2, 0, 0); } -extern f32 FUN_001f9af0(void *) __asm__("FUN_001f9af0"); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern void FUN_L00_00261d78(float, int, void *, void *); extern f32 D_0015ED6C; extern u128 D_L06_001745E0 __attribute__((section(".data"))); @@ -936,20 +939,20 @@ void FUN_L06_002e9b60(float scale, float threshold, char *moby, float *out, int fast_vec_normalize(forward, moby + 0xE0, scale); fast_vec_normalize(backward, forward, -D_0015ED6C); - FUN_001f9a10(out, out, backward); + fast_vec_add(out, out, backward); qcopy(start, moby + 0x10); - FUN_001f9a10(start, start, forward); - FUN_001f9a10(moby + 0x10, moby + 0x10, out); - FUN_001f9a10(end, moby + 0x10, forward); + fast_vec_add(start, start, forward); + fast_vec_add(moby + 0x10, moby + 0x10, out); + fast_vec_add(end, moby + 0x10, forward); - if (threshold < FUN_001f9af0(out) && FUN_001efa68(start, end, 0, moby, 0) != 0) { + if (threshold < fast_vec_length(out) && collision_line(start, end, 0, moby, 0) != 0) { qcopy(end, &D_L06_001745E0); - FUN_001f9a28(moby + 0x10, end, forward); + fast_vec_sub(moby + 0x10, end, forward); } for (i = 0; i < 6; i++) { if (coll_sphere(end, threshold, 4, moby) != 0) { qcopy(end, &D_L06_001745F0); - FUN_001f9a28(moby + 0x10, end, forward); + fast_vec_sub(moby + 0x10, end, forward); } else { break; } @@ -988,7 +991,7 @@ void FUN_L06_002e9f30(struct Moby *moby) { offset[2] = random_float_between(0.0f, 1.25f); *(u128 *)pos = *(u128 *)offset; fast_vec_normalize(vel, pos, speed); - FUN_001f9a10(pos, pos, origin); + fast_vec_add(pos, pos, origin); spawn_crate_debris(*(void **)(vars + 0x20C), vel, pos, D_L06_0015F580, 0x165, 0, 0.3f, 0.6f); } for (j = 7; j >= 0; j--) { @@ -999,7 +1002,7 @@ void FUN_L06_002e9f30(struct Moby *moby) { offset[2] = random_float_between(0.0f, 1.25f); *(u128 *)pos = *(u128 *)offset; fast_vec_normalize(vel, pos, speed); - FUN_001f9a10(pos, pos, origin); + fast_vec_add(pos, pos, origin); spawn_crate_debris(*(void **)(vars + 0x20C), vel, pos, D_L06_0015F580, random_integer_below(2) + 0x166, 0, 0.5f, 0.7f); } @@ -1032,7 +1035,7 @@ extern f32 random_float_between(f32, f32) __asm__("FUN_002132a8"); extern void scale_vector_xyz(void *, void *, f32) __asm__("FUN_001f9a68"); extern float fast_cos(float); extern float fast_sin(float); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern f32 scale_time(f32) __asm__("FUN_001f96b0"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); @@ -1066,7 +1069,7 @@ void FUN_L06_002ea198(struct Moby *moby, Vec4 *dir) { vel.f[1] += fast_sin(angle) * (speed * frame_time); vel.f[2] += rise * frame_time; qcopy(&accel, &vel); - accel.f[2] -= D_L06_00161C3C * frame_time_sq * (float)FUN_001f96f8(D_L06_00161C5C); + accel.f[2] -= D_L06_00161C3C * frame_time_sq * (float)scale_game_frames(D_L06_00161C5C); for (j = 0; j < D_L06_00161C1C; j++) { float size = random_float_between(0.5f, 1.5f); int color0; @@ -1080,8 +1083,8 @@ void FUN_L06_002ea198(struct Moby *moby, Vec4 *dir) { FUN_L00_0025f8e0(&accel, D_L06_00161C28 * frame_time); color0 = fast_tween_color(D_L06_00161C48, D_L06_00161C50, random_float_between(0.0f, 1.0f)); color1 = fast_tween_color(D_L06_00161C4C, D_L06_00161C54, random_float_between(0.0f, 1.0f)); - life = FUN_001f96f8(D_L06_00161C58); - fade = FUN_001f96f8(D_L06_00161C5C); + life = scale_game_frames(D_L06_00161C58); + fade = scale_game_frames(D_L06_00161C5C); n = (float)D_L06_00161C60; spawn_spark(&pos, &vel, &accel, color0, color1, life, fade, truncate_float_to_s32(scale_time(random_float_between(n * 0.5f, n * 2.5f))), -1); @@ -1092,9 +1095,9 @@ void FUN_L06_002ea198(struct Moby *moby, Vec4 *dir) { /* Ported from rac1-decomp (src/overlays/shared/vendor_002D9548.c: func_L06_002EB8C8), where it is exact; names translated to the US level program. */ extern float random_angle_radians(void) __asm__("FUN_00213308"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void random_vector(float *, float, float) __asm__("FUN_L00_00257d78"); extern void FUN_L00_00269958(void *, void *, int, int, int, int, int, int); void build_spherical_offset(f32 *out, f32 scale, f32 a, f32 b) __asm__("FUN_00214db0"); @@ -1110,9 +1113,9 @@ void FUN_L06_002ea498(char *m) { build_spherical_offset(a, frame_time * 1.8f, r1, r2); a[2] += frame_time * 0.9f; random_vector(b, 0.0f, 0.5f); - FUN_001f9a10(b, b, m + 0x10); + fast_vec_add(b, b, m + 0x10); b[2] += 0.5f; - t = FUN_001f96f8(random_int_between(0x14, 0x23)); + t = scale_game_frames(random_int_between(0x14, 0x23)); u = random_int_between(0x28, 0x3C); FUN_L00_00269958(b, a, 0x7000A0FF, 0xFF, t, 0x1E, u, 1); } @@ -1120,7 +1123,7 @@ void FUN_L06_002ea498(char *m) { #include "rnc/gameplay/entities/moby.h" extern int FUN_L00_002db8f8(void *); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); void blend_moby_animation_u(MobyAnim *arg0, int arg1, int arg2, int arg3) __asm__("FUN_00212f90"); /* Grabbed check: while FUN_L00_002db8f8 holds the moby, park it in state 0x10 (remembering the state it came from) @@ -1139,7 +1142,7 @@ int FUN_L06_002ea5e0(struct Moby *moby) { } else if (moby->state == 0x10) { moby->state = 8; if (moby->prev_seq != 0) { - blend_moby_animation_u((MobyAnim *)moby, 0, 0, FUN_001f96f8(10)); + blend_moby_animation_u((MobyAnim *)moby, 0, 0, scale_game_frames(10)); } } return r; @@ -1158,7 +1161,7 @@ int FUN_L06_002ea6a8(unsigned char *moby) { } else if (moby[0x20] == 0x10) { moby[0x20] = 8; if (moby[0x53] != 0) { - blend_moby_animation_u(moby, 0, 0, FUN_001f96f8(10)); + blend_moby_animation_u(moby, 0, 0, scale_game_frames(10)); } } return r; @@ -1346,8 +1349,8 @@ extern char D_L06_00167540[]; extern float absolute_float(float) __asm__("func_001F99C0"); extern float convert_integer_to_float(int) __asm__("func_001FA6C0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); -extern float FUN_001f9e90(float, float); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float FUN_L00_0025bc00(float *, int, float, float); extern float approach_value(float *p, float target, float maxstep) __asm__("FUN_00213ed8"); @@ -1363,17 +1366,17 @@ extern float vector_length_xyz(void *); extern int *D_L06_001B0C30[]; extern int D_00141610[]; extern int level_frame_count __asm__("D_L06_0015F5CC"); -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int FUN_L00_00258b50(void *, void *, void *, void *, float); extern int point_in_path_xy(void *, void *, int) __asm__("FUN_L00_00259740"); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int FUN_L00_0025e3b8(void *); extern int FUN_L00_00261968(int, void *, void *); -extern int FUN_L00_0028dc90(int i, int a1, int v, int k); +extern int trooper_play_sound(int i, int a1, int v, int k) __asm__("FUN_L00_0028dc90"); extern int FUN_L01_00276a48(float, int *, int, int, void *); -extern int FUN_L01_00276fe8(int *, int, int, void *, void *, void *, float); +extern int follow_path(int *, int, int, void *, void *, void *, float) __asm__("FUN_L01_00276fe8"); extern int FUN_L06_002f32f0_u(void *, int) __asm__("FUN_L06_002f32f0"); extern int is_point_inside_clip_volume(void *arg0, int arg1) __asm__("FUN_00214720"); extern int random_integer_below(int) __asm__("FUN_00213260"); @@ -1385,11 +1388,11 @@ extern float D_L06_00161CE0 __attribute__((sda)); extern void FUN_L00_001ff290(void *, void *, void *); extern void FUN_L00_00258278(char *moby, float target, float *vel, float k, float d, float max); extern void make_hit_descriptor(void *, void *, int, void *, float) __asm__("FUN_L00_00259888"); -extern void FUN_L00_002598b0(int, float, void *, int, float, float, int, int, int); +extern void play_entity_sound(int, float, void *, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); extern void FUN_L00_00259a88(void *, void *); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025b8c0(float *p, float *v, float t, float u1, float u2, float eps); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void vendor_spring(float *p, float *v, float t, float u1, float u2, float eps) __asm__("FUN_L00_0025b8c0"); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L00_00261630(char *moby, char *d, float a, float b); extern void FUN_L00_00261d78(float, int, void *, void *); extern void FUN_L00_00272060(void *, int, float, float, int, int, int, float, void *); @@ -1406,7 +1409,8 @@ extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); extern void normalize_vector_xyz(void *, void *, float); extern void subtract_vector_xyz(void *, void *, void *); -void FUN_L06_002f0040(GbMoby *moby) { +void gadgebot_update(GbMoby *moby) __asm__("FUN_L06_002f0040"); +void gadgebot_update(GbMoby *moby) { float out[4]; float v10[4]; float save0[4]; @@ -1427,7 +1431,7 @@ void FUN_L06_002f0040(GbMoby *moby) { flags = 0; c = &d->ctl; - dist = FUN_001f9b80(moby->pos, hero.motion.pos.f); + dist = vector_distance(moby->pos, hero.motion.pos.f); dz = absolute_float(moby->pos[2] - hero.ground_point.f[2]); *(OvlQuad *)save1 = *(OvlQuad *)save0 = *(OvlQuad *)moby->pos; if (moby->state != 1) { @@ -1640,7 +1644,7 @@ void FUN_L06_002f0040(GbMoby *moby) { if (d->f27C >= 0) { int *p; - if (FUN_L01_00276fe8(&d->paths.id[d->f27C], 1, d->paths.node[d->f27C], + if (follow_path(&d->paths.id[d->f27C], 1, d->paths.node[d->f27C], moby->pos, hero.motion.pos.f, v50, 0.1f) == 0) { qcopy(v50, hero.motion.pos.f); } @@ -1655,7 +1659,7 @@ void FUN_L06_002f0040(GbMoby *moby) { } FUN_L00_00258278( (char *)moby, - fast_add_rotations(FUN_001f9e90(v50[0] - moby->pos[0], v50[1] - moby->pos[1]), + fast_add_rotations(fast_arc_tan(v50[0] - moby->pos[0], v50[1] - moby->pos[1]), d->f17C), &d->ctl.f14, frame_scale_sq * 0.07f, frame_scale_sq * 0.3f, frame_time * 5.2359877f); if (dist > 2.3f) { @@ -1675,11 +1679,11 @@ void FUN_L06_002f0040(GbMoby *moby) { int ph = ((int)moby >> 8) % 8; if (level_frame_count % 8 == ph) { - FUN_L00_002598b0((int)moby, 0.4f, moby->pos, 0x1000000, 1.0f, 1.0f, 0, 1, + play_entity_sound((int)moby, 0.4f, moby->pos, 0x1000000, 1.0f, 1.0f, 0, 1, 0); } } - dist = FUN_001f9b80(moby->pos, hero.motion.pos.f); + dist = vector_distance(moby->pos, hero.motion.pos.f); dz = absolute_float(moby->pos[2] - hero.ground_point.f[2]); probe_ground_height(moby->pos, 0, 0.5f); if (D_L06_001745D8 != 0 && D_L06_001745D8->cls_id == 0x3B1) { @@ -1688,9 +1692,9 @@ void FUN_L06_002f0040(GbMoby *moby) { hit = 0; if (flags & 1) { if (d->f184 % 14 == 0) { - if (FUN_001f9b80(d->fF0, moby->pos) < d->ctl.f10) { + if (vector_distance(d->fF0, moby->pos) < d->ctl.f10) { hit = 1; - d->f188 = FUN_001f9b80(hero.motion.pos.f, moby->pos); + d->f188 = vector_distance(hero.motion.pos.f, moby->pos); } qcopy(d->fF0, moby->pos); } @@ -1706,7 +1710,7 @@ void FUN_L06_002f0040(GbMoby *moby) { break; } case 2: { - float hd = FUN_001f9b80(d->f0, hero.motion.pos.f); + float hd = vector_distance(d->f0, hero.motion.pos.f); if ((d->f190 == 0 && hd > 1.8f) || (d->f190 != 0 && hd > d->f188 + 0.5f)) { if (dz < 1.75f) { @@ -1717,7 +1721,7 @@ void FUN_L06_002f0040(GbMoby *moby) { blend_moby_animation(moby, 0, 0, scale_game_frames(7)); } FUN_L00_00258278((char *)moby, - FUN_001f9e90(hero.motion.pos.f[0] - moby->pos[0], + fast_arc_tan(hero.motion.pos.f[0] - moby->pos[0], hero.motion.pos.f[1] - moby->pos[1]), &d->ctl.f14, frame_scale_sq * 0.05f, frame_scale_sq * 0.3f, frame_time * 3.4906585f); @@ -1734,7 +1738,7 @@ void FUN_L06_002f0040(GbMoby *moby) { } FUN_L00_00258278( (char *)moby, - FUN_001f9e90(hero.motion.pos.f[0] - moby->pos[0], hero.motion.pos.f[1] - moby->pos[1]), + fast_arc_tan(hero.motion.pos.f[0] - moby->pos[0], hero.motion.pos.f[1] - moby->pos[1]), &d->ctl.f14, frame_scale_sq * 0.05f, frame_scale_sq * 0.3f, frame_time * 3.4906585f); break; case 5: @@ -1778,7 +1782,7 @@ void FUN_L06_002f0040(GbMoby *moby) { if (d->f27C >= 0) { int *p; - if (FUN_L01_00276fe8(&d->paths.id[d->f27C], 1, d->paths.node[d->f27C], + if (follow_path(&d->paths.id[d->f27C], 1, d->paths.node[d->f27C], moby->pos, d->target->pos, v40, 0.1f) == 0) { qcopy(v40, d->target->pos); } @@ -1791,7 +1795,7 @@ void FUN_L06_002f0040(GbMoby *moby) { } else { qcopy(v40, d->target->pos); } - a = fast_add_rotations(FUN_001f9e90(v40[0] - moby->pos[0], v40[1] - moby->pos[1]), + a = fast_add_rotations(fast_arc_tan(v40[0] - moby->pos[0], v40[1] - moby->pos[1]), d->f17C); v50[0] = fast_cos(a) * 3.0f; v50[1] = fast_sin(a) * 3.0f; @@ -1807,7 +1811,7 @@ void FUN_L06_002f0040(GbMoby *moby) { moby->state = 4; *(OvlQuad *)moby->pos = *(OvlQuad *)save0; } - if (FUN_001f9b80(moby->pos, d->target->pos) < 1.5f) { + if (vector_distance(moby->pos, d->target->pos) < 1.5f) { qcopy(v70, moby->pos); v70[2] += 0.4f; v70[0] += fast_cos(moby->rot) * 0.4f; @@ -1815,7 +1819,7 @@ void FUN_L06_002f0040(GbMoby *moby) { qcopy(v80, v70); v70[0] += fast_cos(moby->rot) * 0.3f; v70[1] += fast_sin(moby->rot) * 0.3f; - if (FUN_001efa68(v70, v80, 0, (int)moby, 0) != 0 && + if (collision_line(v70, v80, 0, (int)moby, 0) != 0 && D_L06_001745D8 == d->target) { moby->sub = 2; } @@ -1898,7 +1902,7 @@ void FUN_L06_002f0040(GbMoby *moby) { *(OvlQuad *)v40 = *(OvlQuad *)d->target->pos; } FUN_L00_00258278( - (char *)moby, FUN_001f9e90(v40[0] - moby->pos[0], v40[1] - moby->pos[1]), + (char *)moby, fast_arc_tan(v40[0] - moby->pos[0], v40[1] - moby->pos[1]), &d->ctl.f14, frame_scale_sq * 0.07f, frame_scale_sq * 0.3f, frame_time * 5.2359877f); if (FUN_L00_00258b50(moby, &d->ctl, v40, out, 1.0f) & 0x20) { moby->state = 4; @@ -1916,8 +1920,8 @@ void FUN_L06_002f0040(GbMoby *moby) { case 8: { float rr; - ang = FUN_001f9e90(moby->pos[0] - d->f304->pos[0], moby->pos[1] - d->f304->pos[1]); - rr = FUN_001f9b80(d->f304->pos, moby->pos); + ang = fast_arc_tan(moby->pos[0] - d->f304->pos[0], moby->pos[1] - d->f304->pos[1]); + rr = vector_distance(d->f304->pos, moby->pos); FUN_L00_0025bc00(&ang, 0, d->f304->rot, frame_time * 6.2831855f); rr -= frame_time * 4.0f; if (rr <= 0.0f) { @@ -1927,9 +1931,9 @@ void FUN_L06_002f0040(GbMoby *moby) { ov->f14--; } if (ov->f14 == 0) { - FUN_L00_0028dc90(1, 0, (int)d->f304, 0x516); + trooper_play_sound(1, 0, (int)d->f304, 0x516); } else { - FUN_L00_0028dc90(0, 0, (int)d->f304, 0x516); + trooper_play_sound(0, 0, (int)d->f304, 0x516); } mark_moby_for_removal(moby); return; @@ -1952,10 +1956,10 @@ void FUN_L06_002f0040(GbMoby *moby) { return; } case 9: - if (FUN_L00_0025c698(moby, d->f80) & 0x41) { + if (mine_fall(moby, d->f80) & 0x41) { int i; - FUN_L00_0025f090(moby, moby->pos, -1, 0.5f, 13.0f); + cart_burst(moby, moby->pos, -1, 0.5f, 13.0f); qcopy(moby->pos, d->fE0); moby->state = 4; for (i = 0; i < 10; i++) { @@ -2016,7 +2020,7 @@ void FUN_L06_002f0040(GbMoby *moby) { qcopy(moby->pos, v40); max = frame_time * 3.0f; step = -vector_length_xyz(v50); - FUN_L00_0025b8c0(&step, &d->f284, 0.0f, frame_scale_sq * 0.025f, frame_scale_sq * 0.3f, max); + vendor_spring(&step, &d->f284, 0.0f, frame_scale_sq * 0.025f, frame_scale_sq * 0.3f, max); len = vector_length_xyz(v50); if (len < d->f284) { d->f284 = len; @@ -2045,7 +2049,7 @@ void FUN_L06_002f0040(GbMoby *moby) { moby) == 0) { break; } - if (FUN_001f9e90(D_L06_001745C0.f48, vector_length_xy(D_L06_001745C0.f40)) > + if (fast_arc_tan(D_L06_001745C0.f48, vector_length_xy(D_L06_001745C0.f40)) > 0.5235988f) { qcopy(moby->pos, hp); moby->pos[2] -= d->ctl.f04; @@ -2067,7 +2071,7 @@ void FUN_L06_002f0040(GbMoby *moby) { g = probe_ground_height(moby->pos, 0, 0.5f); moby->pos[2] -= 0.25f; if (moby->pos[2] < g) { - FUN_L00_0025b8c0(&moby->pos[2], &d->f288, g, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f, + vendor_spring(&moby->pos[2], &d->f288, g, frame_scale_sq * 0.04f, frame_scale_sq * 0.3f, frame_time * 1.5f); c->f18 = 0.0f; } else if (g < moby->pos[2]) { @@ -2097,7 +2101,7 @@ void FUN_L06_002f0040(GbMoby *moby) { } *(OvlQuad *)v50 = *(OvlQuad *)moby->pos; v50[2] += 1.0f; - if (FUN_001efa68(v50, v40, 0, (int)moby, 0) != 0 && D_L06_001745C0.f18 != 0 && + if (collision_line(v50, v40, 0, (int)moby, 0) != 0 && D_L06_001745C0.f18 != 0 && (D_L06_001745C0.f18->cls_id == 0x409 || D_L06_001745C0.f18->cls_id == 0x359 || FUN_L00_0025e3b8(D_L06_001745C0.f18) != 0)) { *(OvlQuad *)moby->pos = *(OvlQuad *)save0; @@ -2118,18 +2122,18 @@ void FUN_L06_002f0040(GbMoby *moby) { /* Ported from rac1-decomp (src/overlays/shared/vendor_002D9548.c: func_L06_002F3578), where it is exact; names translated to the US level program. */ extern char D_L06_00167400[]; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); float FUN_L06_002f2148(char *a, char *b, int c) { - float r = FUN_001f9b80(a + 0x10, b + 0x10); + float r = vector_distance(a + 0x10, b + 0x10); float *g = (float *)D_L06_00167400; float t = fast_difference_between_rotations( - g[0x56], FUN_001f9e90(*(float *)(b + 0x10) - *(float *)(a + 0x10), + g[0x56], fast_arc_tan(*(float *)(b + 0x10) - *(float *)(a + 0x10), *(float *)(b + 0x14) - *(float *)(a + 0x14))); float u = fast_difference_between_rotations( - *(float *)(a + 0x48), FUN_001f9e90(*(float *)(b + 0x10) - *(float *)(a + 0x10), + *(float *)(a + 0x48), fast_arc_tan(*(float *)(b + 0x10) - *(float *)(a + 0x10), *(float *)(b + 0x14) - *(float *)(a + 0x14))); r = r + u * 10.0f; r = r + t * 3.0f; @@ -2475,7 +2479,7 @@ int FUN_L06_002f2c28(char *ctx, char *ow, char *moby, int flag, int *out) { *(int *)(st + 4) = v58 + 1; } if (*(short *)(moby + 0xA6) == 0x515) { - FUN_L00_0028dc90(0, 0, (int)moby, 0x515); + trooper_play_sound(0, 0, (int)moby, 0x515); } for (k = 0; k < 10; k++) { @@ -2609,9 +2613,9 @@ int FUN_L06_002f32f0(char *moby, int flag) /* Ported from rac1-decomp (src/overlays/shared/vendor_002D9548.c: func_L06_002F4818), where it is exact; names translated to the US level program. */ void FUN_L06_002f33e8(char *a, char *b, char *c, int *out, float *best, float thresh) { - float dist = FUN_001f9b80(a + 0x10, c + 0x10); + float dist = vector_distance(a + 0x10, c + 0x10); if (!(thresh < dist)) { - float ang = FUN_001f9e90(*(float *)(c + 0x10) - *(float *)(a + 0x10), + float ang = fast_arc_tan(*(float *)(c + 0x10) - *(float *)(a + 0x10), *(float *)(c + 0x14) - *(float *)(a + 0x14)); float v = dist + fast_difference_between_rotations(*(float *)(a + 0x48), ang) * 5.0f; if (c == b) { @@ -2634,6 +2638,7 @@ extern s32 D_L06_00161CE4 __attribute__((sda)); extern char *D_L06_001DAE60[]; /* Picks the best target for moby among this frame's live class-0x359 mobys and the hero * (current is the target it has now), and stores it in *current. */ +void FUN_L06_002f34d8(char *moby, char **current, f32 range); void FUN_L06_002f34d8(char *moby, char **current, f32 range) { Best_2f34d8 best; char *m; @@ -2659,9 +2664,9 @@ void FUN_L06_002f34d8(char *moby, char **current, f32 range) { } typedef unsigned int Q __attribute__((mode(TI), aligned(16))); extern char *D_001413D0 __attribute__((section(".data"))); -extern void FUN_L03_00250a78(void *, float, float); -extern void FUN_L00_0025ab48(void *, float *, void *, void *); -extern void FUN_L00_0025c558(void *, void *, int, int, int, float); +extern void trooper_set_knockback(void *, float, float) __asm__("FUN_L03_00250a78"); +extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(void *, void *, int, int, int, float) __asm__("FUN_L00_0025c558"); extern void FUN_0022da68(int, int, void *); /* Looks for a target (query 0x330001); if its owner is a different hostile, sets up the aim/attack data and enters state 9. */ @@ -2671,20 +2676,20 @@ void FUN_L06_002f3640(unsigned char *moby) { char *target = find_moby_hit(moby, 0x330001, 0); if (target != 0) { Q pos; - float base_angle = FUN_001f9e90(*(float *)(target + 0x10), *(float *)(target + 0x14)); + float base_angle = fast_arc_tan(*(float *)(target + 0x10), *(float *)(target + 0x14)); char *owner = *(char **)(target + 0x20); float ang; ang = base_angle; if (owner != D_001413D0 && *(short *)(owner + 0xA6) != *(short *)(moby + 0xA6)) { - int frames_sq = FUN_001f96f8(0x50); - frames_sq *= FUN_001f96f8(0x50); + int frames_sq = scale_game_frames(0x50); + frames_sq *= scale_game_frames(0x50); state[0xBD] = 0; *(int *)(state + 0xA4) = 9; *(float *)(state + 0x90) = 4.0f / (float)frames_sq; - FUN_L03_00250a78(state + 0x80, 2.0f, 0.5f); + trooper_set_knockback(state + 0x80, 2.0f, 0.5f); pos = *(Q *)(target + 0x10); - FUN_L00_0025ab48(&pos, &ang, state + 0x98, state + 0x9C); - FUN_L00_0025c558(moby, state + 0x80, 4, 5, 2, ang); + trooper_knockback_arc(&pos, &ang, state + 0x98, state + 0x9C); + trooper_start_knockback(moby, state + 0x80, 4, 5, 2, ang); { float v = frame_time + frame_time; *(float *)(state + 0xD0) = 10.0f; @@ -2832,7 +2837,7 @@ extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern float D_0015ED6C; extern float D_L06_00161D3C __attribute__((sda)); -extern float FUN_L00_0025be00(float *, float *, float, float, float, float); +extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float D_0015ED70; extern float D_L06_00161D38 __attribute__((sda)); @@ -2920,7 +2925,7 @@ void FUN_L06_002f4f00(Moby *m) { break; case 4: case 5: - FUN_L00_0025be00(&d->f14, &d->f20, 1.0471976f, + approach_angle(&d->f14, &d->f20, 1.0471976f, D_L06_00161D38 * 0.017453292f * D_0015ED70, D_L06_00161D3C * 0.017453292f * D_0015ED70, D_L06_00161D40 * 0.017453292f * D_0015ED6C); @@ -2937,7 +2942,7 @@ void FUN_L06_002f4f00(Moby *m) { break; case 8: case 9: - FUN_L00_0025be00(&d->f14, &d->f20, 0.0f, + approach_angle(&d->f14, &d->f20, 0.0f, D_L06_00161D38 * 0.017453292f * D_0015ED70, D_L06_00161D3C * 0.017453292f * D_0015ED70, D_L06_00161D40 * 0.017453292f * D_0015ED6C); @@ -2956,14 +2961,15 @@ void FUN_L06_002f4f00(Moby *m) { extern float random_angle_radians_alt(void) __asm__("FUN_00213308"); extern int D_L06_001BAC50[]; -extern void FUN_L00_00259bc8(void *, int, int, void *, void *, float); +extern void spawn_nearby_effect(void *, int, int, void *, void *, float) __asm__("FUN_L00_00259bc8"); extern void FUN_L02_002ea7d0(char *); extern void FUN_L06_002f7548(char *); void FUN_L06_002f7628(char *m); extern char D_0014171B_86b8[] __asm__("D_0014C190"); #include "rnc/gameplay/state/game_globals.h" -void FUN_L06_002f7288(char *m) { +void energy_sphere_holder_update(char *m) __asm__("FUN_L06_002f7288"); +void energy_sphere_holder_update(char *m) { char *d = *(char **)(m + 0x78); char *o; unsigned char *q; @@ -3001,7 +3007,7 @@ void FUN_L06_002f7288(char *m) { case 1: { char *h = find_moby_hit(m, 0x330000, 0); if (h != 0) { - FUN_L00_00259bc8(*(void **)(d + 0x40), *(int *)(h + 0x20), 0x10000, h, h + 0x10, 1.0f); + spawn_nearby_effect(*(void **)(d + 0x40), *(int *)(h + 0x20), 0x10000, h, h + 0x10, 1.0f); ((unsigned char *)m)[0xA4] = 0xFF; } if ((*(char **)(d + 0x40))[0x20] < 0) { @@ -3186,17 +3192,18 @@ extern char D_0013E550[]; extern f32 fast_add_rotations(f32 a, f32 b) __asm__("FUN_001fa580"); extern float D_0015ED6C; extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern float D_L06_00161E74 __attribute__((sda)); extern float D_L06_00161E78 __attribute__((sda)); extern float D_L06_00161E7C __attribute__((sda)); extern float D_L06_00161E80 __attribute__((sda)); -extern void FUN_L00_002502f0(void *, int, int, int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); extern void FUN_L06_002f7c68_c(char *m) __asm__("FUN_L06_002f7c68"); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); void mark_moby_for_removal_u(struct Obj *obj) __asm__("FUN_0020c828"); -void FUN_L06_002f7ab8(struct Moby *m) { +void energy_sphere_update(struct Moby *m) __asm__("FUN_L06_002f7ab8"); +void energy_sphere_update(struct Moby *m) { char *d = (char *)m->pvars; if (find_moby_hit(m, 0x330000, 0) != 0) { int idx; @@ -3215,7 +3222,7 @@ void FUN_L06_002f7ab8(struct Moby *m) { } switch (m->state) { case 0: - FUN_L00_002502f0(m, 0x80, 0x80, 0x80); + set_moby_color(m, 0x80, 0x80, 0x80); m->scale = m->pclass->scale * D_L06_00161E80; *(char **)d = d + 0x20; m->state = 1; @@ -3233,7 +3240,7 @@ void FUN_L06_002f7ab8(struct Moby *m) { m->rot.z = fast_add_rotations(m->rot.z, a2); } } - if (FUN_L00_0028d8c0(m, *(int *)(d + 0x60)) == 0) { + if (voice_is_playing(m, *(int *)(d + 0x60)) == 0) { *(int *)(d + 0x60) = allocate_voice_for_target_entry(0, 4, (int)m); } } @@ -3278,3 +3285,7 @@ void FUN_L06_002f7c68(char *m) { FUN_L00_002730e0(m + 0x10, f, buf, r, c, (unsigned char)v, 0); } } + +f32 D_L10_001D4060[1] __attribute__((section(".data"))) = {0}; +f32 D_L10_001D4064[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001D9F20[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/hoverboard_ring.c b/src/overlays/shared/gameplay/entities/hoverboard_ring.c index cc2e9c20c2..122d6baa33 100644 --- a/src/overlays/shared/gameplay/entities/hoverboard_ring.c +++ b/src/overlays/shared/gameplay/entities/hoverboard_ring.c @@ -14,12 +14,13 @@ /* Ported from rac1-decomp (src/overlays/shared/vendor_002CF2C0.c: func_L05_0031C0F0), where it is exact; names translated to the US level program. */ extern float random_angle_radians(void) __asm__("FUN_00213308"); -extern int FUN_001fa728(char *, float); +extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern unsigned char *FUN_L00_002743a8(float f0, float f1, int a0, void *pos, int timer, int flag, int col, float *vel); -void FUN_L05_0031abe0(char *moby) { +void hoverboard_ring_update(char *moby) __asm__("FUN_L05_0031abe0"); +void hoverboard_ring_update(char *moby) { switch (((unsigned char *)moby)[0x20]) { case 0: ((unsigned char *)moby)[0x30] = 0x80; @@ -31,7 +32,7 @@ void FUN_L05_0031abe0(char *moby) { int i; qcopy(v, moby + 0x10); v[3] = 8.0f; - if (FUN_001fa728((char *)v, 128.0f) != -1) { + if (fast_bsphere_check((char *)v, 128.0f) != -1) { if (hero.state.control_mode == 0x16) { for (i = 0; i < 3; i++) { float a = random_angle_radians(); @@ -104,6 +105,7 @@ extern char *FUN_L05_0031d160(unsigned char *); void FUN_L05_0031cf58(char *m); /* Mine update: sets its glow, fades it out with camera distance and blows up into debris, smoke and sparks when something touches it. */ +void FUN_L05_0031c8e0(struct Moby *moby); void FUN_L05_0031c8e0(struct Moby *moby) { struct MineVars_c8e0 *vars = (struct MineVars_c8e0 *)moby->pvars; Vec4 tip; @@ -310,7 +312,7 @@ char *FUN_L05_0031d160(unsigned char *a0) { /* Ported from rac1-decomp (src/overlays/shared/vendor_002CF2C0.c: func_L05_0032A868), where it is exact; names translated to the US level program. */ -extern float FUN_001f9b80(float *, float *); +extern float vector_distance(float *, float *) __asm__("FUN_001f9b80"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void normalize_vector_xyz(void *out, void *a, f32 len) __asm__("FUN_001f9bf8"); @@ -331,7 +333,7 @@ void FUN_L05_00329358(char *moby) { w[1] = 447.82f; w[2] = 63.37f; w[3] = 1.0f; - if (FUN_001f9b80(w, p) < 48.0f) { + if (vector_distance(w, p) < 48.0f) { if (p[2] < 62.4f) { p[2] = 62.4f; } @@ -583,11 +585,11 @@ extern void cross_vectors_xyz(void *, void *, void *) __asm__("FUN_001f9ad8"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void scale_vector_xyz(void *, void *, f32) __asm__("FUN_001f9a68"); -extern f32 FUN_001f9ab0(void *, void *); +extern f32 fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); extern float fast_arc_sin(float) __asm__("FUN_001f9df8"); extern void rotate_about_axis(void *out, void *v, void *axis, f32 ang) __asm__("FUN_00214890"); -extern float FUN_L00_001eb328(void *, float, float, float, float, float); +extern float rope_spring_turn(void *, float, float, float, float, float) __asm__("FUN_L00_001eb328"); extern float FUN_001ebd78(void *, float, float, float, float, float); /* Camera that orbits the hero while hero.unk88E is set, easing yaw, pitch and distance toward their goals. */ @@ -617,22 +619,22 @@ void FUN_L05_003298d8(Camera *cam) { cross_vectors_xyz(&fwd, &up, &side); normalize_vector_xyz(&fwd, &fwd, 1.0f); subtract_vector_xyz(&rel, &cam->pos, focus); - dot = FUN_001f9ab0(&rel, &up); + dot = fast_vec_dot(&rel, &up); normalize_vector_xyz(&along, &up, dot); subtract_vector_xyz(&flat, &rel, &along); - dot = FUN_001f9ab0(&fwd, &flat); + dot = fast_vec_dot(&fwd, &flat); len = vector_length_xyz(&flat); if (len == 0.0f) { len = 0.0001f; } ang = 1.5707964f - fast_arc_sin(dot / len); normalize_vector_xyz(&unit, &flat, 1.0f); - if (FUN_001f9ab0(&side, &unit) < 0.0f) { + if (fast_vec_dot(&side, &unit) < 0.0f) { ang = -ang; } cam->yaw = ang; rotate_about_axis(&rot, &fwd, &up, ang); - dot = FUN_001f9ab0(&rot, &rel); + dot = fast_vec_dot(&rot, &rel); len = vector_length_xyz(&rel); if (len == 0.0f) { len = 0.0001f; @@ -640,7 +642,7 @@ void FUN_L05_003298d8(Camera *cam) { tilt = 1.5707964f - fast_arc_sin(dot / len); normalize_vector_xyz(&unit, &rel, 1.0f); pitch = -tilt; - if (FUN_001f9ab0(&up, &unit) < 0.0f) { + if (fast_vec_dot(&up, &unit) < 0.0f) { pitch = tilt; } cam->pitch = pitch; @@ -666,8 +668,8 @@ void FUN_L05_003298d8(Camera *cam) { normalize_vector_xyz(&fwd, &fwd, 1.0f); rotate_about_axis(&side, &side, &fwd, cam->pitch); add_vector_xyz(&cam->pos, focus, &side); - cam->yaw = FUN_L00_001eb328(&spring[3], cam->yaw, spring[0], spring[6], spring[9], 0.0f); - cam->pitch = FUN_L00_001eb328(&spring[4], cam->pitch, spring[1], spring[7], spring[10], 0.0f); + cam->yaw = rope_spring_turn(&spring[3], cam->yaw, spring[0], spring[6], spring[9], 0.0f); + cam->pitch = rope_spring_turn(&spring[4], cam->pitch, spring[1], spring[7], spring[10], 0.0f); cam->dist = FUN_001ebd78(&spring[5], cam->dist, spring[2], spring[8], spring[11], 0.0f); if (hero.unk88E == 0) { o->mode = 0; @@ -746,7 +748,7 @@ typedef struct { char pad0[0x48]; float vel; } Preset_32B1F8; typedef struct { char pad0[0x1C]; Preset_32B1F8 *preset; } Row_32B1F8; extern f32 dot_vectors_xyz(void *, void *) __asm__("func_001F9AB0"); -extern int FUN_L00_001f0d60(float, void *, int, void *); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern void scale_vector_xyz_c(void *, void *, float) __asm__("FUN_001f9a68"); f32 cam_interp_values(void *, f32, f32, f32, f32, f32) __asm__("FUN_001ebd78"); float absolute_float(float input) __asm__("func_001F99C0"); @@ -762,7 +764,7 @@ extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern int collide_32B1F8(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern float fabs_32B1F8(float) __asm__("FUN_001f99c0"); extern void fast_vec_cross(void *, void *, void *) __asm__("FUN_001f9ad8"); -extern void orbit_32B1F8(Camera_32B1F8 *) __asm__("FUN_L05_003298d8"); +extern void FUN_L05_003298d8_c(Camera_32B1F8 *) __asm__("FUN_L05_003298d8"); extern float D_L05_00174278 __attribute__((section(".data"))); void FUN_L05_00329ce8(Camera_32B1F8 *camera) { @@ -867,7 +869,7 @@ void FUN_L05_00329ce8(Camera_32B1F8 *camera) { else if (focus_state->dist < focus_distance) focus_state->dist = focus_state->dist + 0.02f; else focus_state->dist = focus_state->dist - 0.02f; } - orbit_32B1F8(camera); + FUN_L05_003298d8_c(camera); qcopy(&focus_state->pos, &orbit->next); qcopy(&focus, &focus_state->pos); fast_vec_normalize(&offset, &focus_state->axis, focus_state->dist); diff --git a/src/overlays/shared/gameplay/entities/hydrodisplacer_faucet.c b/src/overlays/shared/gameplay/entities/hydrodisplacer_faucet.c index 15069eac23..584decfcf7 100644 --- a/src/overlays/shared/gameplay/entities/hydrodisplacer_faucet.c +++ b/src/overlays/shared/gameplay/entities/hydrodisplacer_faucet.c @@ -180,7 +180,8 @@ extern short D_L05_0015FFD8; extern void FUN_L05_002f81b8_u(void *) __asm__("FUN_L05_002f81b8"); void blend_moby_animation(MobyAnim *arg0, int arg1, int arg2, int arg3) __asm__("FUN_00212f90"); -void FUN_L05_002f8080(char *m) { +void hydrodisplacer_faucet_update(char *m) __asm__("FUN_L05_002f8080"); +void hydrodisplacer_faucet_update(char *m) { struct Hero *g = &hero; int f = 0; int *d = *(int **)(m + 0x78); @@ -280,7 +281,8 @@ extern int D_00151928_87a8 __asm__("D_00151928") __attribute__((sda)); extern int D_0015190C_87a8 __asm__("D_0015190C") __attribute__((sda)); extern int D_00151910_87a8 __asm__("D_00151910") __attribute__((sda)); -void FUN_L05_002f87a8(unsigned char *moby) { +void hoverboard_update(unsigned char *moby) __asm__("FUN_L05_002f87a8"); +void hoverboard_update(unsigned char *moby) { char *data = *(char **)(moby + 0x78); float delta[4], position[4], effect_position[4], offset[4], second_position[4]; float angle, distance_scale, delta_length; @@ -442,15 +444,16 @@ void FUN_L05_00307010(char *moby) { /* UpdateMoby_823: pick random wobble parameters, then animate them each frame */ /* Ported from rac1-decomp (src/overlays/shared/vendor_002CF2C0.c: func_L05_0030D500), where it is exact; names translated to the US level program. */ -extern float FUN_001f9de0(float); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float random_angle_radians(void) __asm__("FUN_00213308"); extern void FUN_L00_001fff28(void *, int, float); -extern void FUN_L00_002502f0(void *, int, int, int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); extern void FUN_L05_0030c220(struct Moby *m); void attach_manipulator(void *arg0, s32 arg1, void *arg2) __asm__("FUN_0020cb10"); void enqueue_callback_list_1(s32 arg0, s32 arg1) __asm__("FUN_001f4600"); +void FUN_L05_0030c0a8(unsigned char *m); void FUN_L05_0030c0a8(unsigned char *m) { char *d = *(char **)(m + 0x78); float r, lo, hi; @@ -467,7 +470,7 @@ void FUN_L05_0030c0a8(unsigned char *m) { hi = frame_time * 0.2617994f; *(float *)(d + 0x50) = r; *(float *)(d + 0x4C) = randf_sym(lo, hi); - FUN_L00_002502f0(m, 0x80, 0x80, 0x80); + set_moby_color(m, 0x80, 0x80, 0x80); attach_manipulator((char *)m, 0, d); m[0x20] = 1; break; @@ -477,10 +480,10 @@ void FUN_L05_0030c0a8(unsigned char *m) { enqueue_callback_list_1((void *)FUN_L05_0030c220, m); t = fast_add_rotations(*(float *)(d + 0x44), *(float *)(d + 0x4C)); *(float *)(d + 0x44) = t; - *(float *)(m + 0x48) = fast_add_rotations(*(float *)(d + 0x40), FUN_001f9de0(t) * k); + *(float *)(m + 0x48) = fast_add_rotations(*(float *)(d + 0x40), fast_sin(t) * k); t = fast_add_rotations(*(float *)(d + 0x48), *(float *)(d + 0x50)); *(float *)(d + 0x48) = t; - FUN_L00_001fff28(d + 0x10, 1, FUN_001f9de0(t) * k + k); + FUN_L00_001fff28(d + 0x10, 1, fast_sin(t) * k + k); break; } } @@ -635,7 +638,8 @@ extern f32 fast_sin_c(f32) __asm__("FUN_001f9de0"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern s32 allocate_voice_for_target_entry(s32, s32, struct Moby *) __asm__("FUN_0022da68"); -void FUN_L05_0030c5b0(struct Moby *moby) { +void floor_button_update(struct Moby *moby) __asm__("FUN_L05_0030c5b0"); +void floor_button_update(struct Moby *moby) { s32 *vars = (s32 *)moby->pvars; s16 id; s32 i; @@ -782,7 +786,8 @@ extern void scale_vector_xyz(void *, void *, float) __asm__("FUN_001f9a68"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("func_001F9CF8"); -void FUN_L05_003186f8(char *moby) +void blarg_gun_update(char *moby) __asm__("FUN_L05_003186f8"); +void blarg_gun_update(char *moby) { char *data = *(char **)(moby + 0x78); char buf[0x70]; @@ -947,7 +952,7 @@ void FUN_L05_00319690(char *moby) { /* Wobbles a moby's position and rotation from its sine-driven state. */ /* Ported from rac1-decomp (src/overlays/shared/vendor_002CF2C0.c: func_L05_0031AC50), where it is exact; names translated to the US level program. */ -extern float FUN_001f9de0(float); +extern float fast_sin(float) __asm__("FUN_001f9de0"); void FUN_L05_00319740(char *moby) { char *d = *(char **)(moby + 0x78); @@ -956,18 +961,18 @@ void FUN_L05_00319740(char *moby) { qcopy(moby + 0x40, d + 0x70); s = fast_add_rotations(*(float *)(d + 0xC8), frame_time * 2.0943951f); *(float *)(d + 0xC8) = s; - t = FUN_001f9de0(s); + t = fast_sin(s); w = frame_time * 1.6929693f; *(float *)(moby + 0x18) += t * 0.25f; s = fast_add_rotations(*(float *)(d + 0xCC), w); *(float *)(d + 0xCC) = s; - t = fast_add_rotations(*(float *)(moby + 0x44), FUN_001f9de0(s) * 0.08726646f); + t = fast_add_rotations(*(float *)(moby + 0x44), fast_sin(s) * 0.08726646f); w = frame_time * 0.9250245f; *(float *)(moby + 0x44) = t; s = fast_add_rotations(*(float *)(d + 0xD0), w); *(float *)(d + 0xD0) = s; *(float *)(moby + 0x40) = - fast_add_rotations(*(float *)(moby + 0x40), FUN_001f9de0(s) * 0.08726646f); + fast_add_rotations(*(float *)(moby + 0x40), fast_sin(s) * 0.08726646f); if (*(float *)(moby + 0x40) > 0.17453292f) *(float *)(moby + 0x40) = 0.17453292f; else if (*(float *)(moby + 0x40) < -0.17453292f) @@ -982,8 +987,8 @@ void FUN_L05_00319740(char *moby) { extern char *D_L05_001B0930[]; extern char D_L05_00215C00[]; -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9cf8(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); void FUN_L05_003198e8(char *a) { char *data = *(char **)(a + 0x78); @@ -994,8 +999,8 @@ void FUN_L05_003198e8(char *a) { int i; struct Hero *g; for (i = 0; i < 7; i++) { - FUN_001f9cf8(p + 0x10 + i * 16, D_L05_00215C00 + i * 16, a + 0xC0); - FUN_001f9a10(p + 0x10 + i * 16, p + 0x10 + i * 16, a + 0x10); + transform_vector_by_basis(p + 0x10 + i * 16, D_L05_00215C00 + i * 16, a + 0xC0); + fast_vec_add(p + 0x10 + i * 16, p + 0x10 + i * 16, a + 0x10); } g = &hero; *(unsigned short *)&g->unk22DA = *(unsigned short *)(data + 0xDC); diff --git a/src/overlays/shared/gameplay/entities/mine.c b/src/overlays/shared/gameplay/entities/mine.c index e81583df84..505b31852c 100644 --- a/src/overlays/shared/gameplay/entities/mine.c +++ b/src/overlays/shared/gameplay/entities/mine.c @@ -151,20 +151,20 @@ extern Cam910 D_L00_00166C80; extern E D_0013E520; extern M910 *D_L00_00173E58 __attribute__((section(".data"))); extern char *active_mobies[] __asm__("D_L00_001ABA00"); -extern char *FUN_L00_0026bed0(char *, char *, int, int, float, int, int); -extern char *FUN_L00_002d3838(char *a, char *b, int c, char *d); +extern char *mine_debris(char *, char *, int, int, float, int, int) __asm__("FUN_L00_0026bed0"); +extern char *mine_camera_blast(char *a, char *b, int c, char *d) __asm__("FUN_L00_002d3838"); extern char *FUN_L00_002d7e90(void *, float); extern char D_L00_00173E70[]; extern s16 D_L00_001B07B0[]; extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); extern f32 FUN_001f9b48(void *, void *); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern f32 fast_cos(f32) __asm__("func_001F9DC8"); extern f32 fast_sin(f32) __asm__("func_001F9DE0"); extern float D_L00_00173E68[]; extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float square_root(float) __asm__("FUN_001f9988"); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float FUN_L00_00200510(float, float, float); extern float FUN_L00_00259710(void *); extern float dot_vectors_xyz(void *a, void *b); @@ -174,17 +174,17 @@ extern float random_angle_radians(void) __asm__("FUN_00213308"); extern float random_float_between(float a, float b) __asm__("FUN_002132a8"); extern float vector_length_xyz(void *a); extern int *D_L00_00177F00[]; -extern int FUN_001efa68(void *, void *, int, int, int); -extern int FUN_001f0b58(void); -extern int FUN_001f9770(void *); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_001f0d60(float, void *, int, void *); extern int collect_mobies_in_sphere(void *, int, void *, void *, float) __asm__("FUN_L00_001f2868"); -extern int FUN_L00_002371e0(int, int, float); +extern int mine_blend_color(int, int, float) __asm__("FUN_L00_002371e0"); extern int FUN_L00_00257b90(int, int); extern int FUN_L00_00258490(void *, void *, void *, float, float, float, float, int); extern int FUN_L00_00260400(void *, void *, void *, void *, void *, void *); -extern int FUN_L00_0026f080(void *, void *, float, float); -extern int FUN_L00_0028d8c0(void *, int); +extern int random_integer_below_cf(void *, void *, float, float) __asm__("FUN_L00_0026f080"); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L00_002aa2a8(W910 *, M910 *, int); extern int tick_countdown_32_alt(int *) __asm__("FUN_001f9740"); extern s32 D_L00_00166DC0[]; @@ -202,7 +202,7 @@ extern unsigned FUN_L00_0025c0e8(unsigned c, int mask); extern unsigned char *D_L00_001B2080[]; extern unsigned char *FUN_002141f8_cf(unsigned char *) __asm__("FUN_L00_002603d0"); extern int D_L00_0015F5CC; -extern unsigned char *FUN_002141f8(unsigned char *); +extern unsigned char *suck_get_aim_height(unsigned char *) __asm__("FUN_002141f8"); extern void *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); extern void *FUN_L00_0026bb70(void *, void *, int, int, float, int, int, int, int); extern void set_vector_length_xy(void *, void *, float) __asm__("FUN_001f9c48"); @@ -210,16 +210,16 @@ extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void multiply_matrix(void *, void *, void *) __asm__("FUN_001fa378"); extern void FUN_L00_001ff660(void *, void *, void *); extern void make_hit_descriptor(void *, void *, int, void *, float) __asm__("FUN_L00_00259888"); -extern void FUN_L00_00259fe8(unsigned char *, float); +extern void jet_animate(unsigned char *, float) __asm__("FUN_L00_00259fe8"); extern void send_blast_hits(void *, void *, void *, int, int, int, int, int, float, float, float) __asm__("FUN_L00_0025a9f8"); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, int, int, float, float, - float, float, int, float, int, int, int, int); -extern void FUN_L00_0025f090(void *, void *, int, float, float); -extern void FUN_L00_0025f800(void *, void *); +extern void spawn_explosion(void *, void *, void *, float, float, int, int, int, float, float, + float, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); +extern void mine_spawn_drops(void *, void *) __asm__("FUN_L00_0025f800"); extern void FUN_L00_00262b80(void *, char *, char *, float, float, float); extern void FUN_L00_0026f548(void *, void *, int, int); extern void FUN_L00_002738e8(void *, void *, int, float, float, float, int, int, int); -extern void FUN_L00_002a3ec8(int, int, int, float, float, float, float); +extern void pool_splash(int, int, int, float, float, float, float) __asm__("FUN_L00_002a3ec8"); extern void add_vector_xyz(void *, void *, void *); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); extern void build_moby_bone_transform(int, int, void *) __asm__("func_0020CCA8"); @@ -316,7 +316,7 @@ void mine_update(M910 *m) { float wz = resolve_camera_surface_height((float *)&m->pos, &q); scale_vector_xyz(&q, v, 0.25f); - FUN_L00_0026f080(&m->pos, &q, random_float_between(0.05f, 0.1f) * 210000.0f, + random_integer_below_cf(&m->pos, &q, random_float_between(0.05f, 0.1f) * 210000.0f, wz); } } @@ -341,15 +341,15 @@ void mine_update(M910 *m) { k = 0.0f; } m->pos.f[2] -= v->f6C * fast_sin(v->f70) * k; - if (!(m->state & 4) && FUN_001efa68(&old, &m->pos, 0x10, (int)m, (int)&q) != 0) { - if (v->h50 == 0 && FUN_001f0b58() == 0 && v->vel.f[2] < 0.0f) { + if (!(m->state & 4) && collision_line(&old, &m->pos, 0x10, (int)m, (int)&q) != 0) { + if (v->h50 == 0 && collision_hit_material() == 0 && v->vel.f[2] < 0.0f) { V910 t; V910 n; { int i; char *p; - FUN_L00_002a3ec8(*(int *)&D_L00_001612D0_gp, *(int *)&D_L00_001612D8_gp, 1, + pool_splash(*(int *)&D_L00_001612D0_gp, *(int *)&D_L00_001612D8_gp, 1, m->pos.f[0], m->pos.f[1], 0.5f, -0.35f); v->h50 = 1; clear_vector((float *)v); @@ -373,7 +373,7 @@ void mine_update(M910 *m) { FUN_L00_0026f548(t, n, random_integer_below(2), life); } } - } else if (v->h50 != 0 || FUN_001f0b58() != 0) { + } else if (v->h50 != 0 || collision_hit_material() != 0) { V910 t; V910 n; V910 r; @@ -411,7 +411,7 @@ void mine_update(M910 *m) { } else if ((coll_hit.moby != 0 && coll_hit.moby != hero.moby && coll_hit.moby != v->owner) || coll_hit.i1C > 0) { - if (v->h50 != 0 || FUN_001f0b58() == 0 || + if (v->h50 != 0 || collision_hit_material() == 0 || v->vel.f[2] < frame_time * -9.8f) { m->bBC = 1; qcopy(&m->pos, &coll_hit.pos); @@ -464,10 +464,10 @@ void mine_update(M910 *m) { r[2] = n[2]; m->rx = FUN_L00_00200510( m->rx, - -FUN_001f9e90(square_root(r[0] * r[0] + r[2] * r[2]), r[1]), + -fast_arc_tan(square_root(r[0] * r[0] + r[2] * r[2]), r[1]), 0.05235988f); m->ry = - FUN_L00_00200510(m->ry, FUN_001f9e90(r[2], r[0]), 0.05235988f); + FUN_L00_00200510(m->ry, fast_arc_tan(r[2], r[0]), 0.05235988f); } } } @@ -568,7 +568,7 @@ void mine_update(M910 *m) { if ((m->b70 & 2) && m->b52 == 1 && m->anim != 2) { blend_moby_animation(m, 2, 0, 10); } - if (FUN_L00_0028d8c0(m, v->i68) == 0) { + if (voice_is_playing(m, v->i68) == 0) { v->i68 = allocate_voice_for_target_entry(1, 4, (int)m); } sp = v->f40 + frame_time_sq * 15.0f; @@ -623,7 +623,7 @@ void mine_update(M910 *m) { } } } - if (!(m->state & 2) && FUN_001f9770(&v->h34) != 0) { + if (!(m->state & 2) && fast_dec_timer_s16(&v->h34) != 0) { m->state |= 2; v->p54 = 0; } @@ -638,7 +638,7 @@ void mine_update(M910 *m) { m->bA4 = 0xFF; if (m->state & 2) { if (!(m->state & 4) || - (FUN_001f9b80(&((M910 *)hero.moby)->pos, &m->pos) < 0.75f && + (vector_distance(&((M910 *)hero.moby)->pos, &m->pos) < 0.75f && absolute_float(m->pos.f[2] - hero.motion.pos.f[2]) < 0.25f && (m->state & 0x10))) { m->bBC = 1; } else if (FUN_001f9b48(&((M910 *)hero.moby)->pos, &m->pos) < 0.75f) { @@ -680,11 +680,11 @@ void mine_update(M910 *m) { goto next; } rg = range; - p = FUN_002141f8((unsigned char *)o); + p = suck_get_aim_height((unsigned char *)o); if (p != 0) { rg = range + convert_integer_to_float(p[0xA]) * 0.125f; } - if (!(FUN_001f9b80(&m->pos, &o->pos) < rg)) { + if (!(vector_distance(&m->pos, &o->pos) < rg)) { goto next; } if (!(absolute_float(o->pos.f[2] - m->pos.f[2]) < 2.0f)) { @@ -694,9 +694,9 @@ void mine_update(M910 *m) { goto next; } if (best != 0) { - float d1 = FUN_001f9b80(&m->pos, &o->pos); + float d1 = vector_distance(&m->pos, &o->pos); - if (!(d1 < FUN_001f9b80(&m->pos, &best->pos))) { + if (!(d1 < vector_distance(&m->pos, &best->pos))) { goto next; } } @@ -719,8 +719,8 @@ void mine_update(M910 *m) { } v->i78 = 0; if (v->i5C < 0 || *(int *)&D_L00_001613D0 != 0) { - FUN_L00_0025f090(m, &m->pos, -1, 0.33f, 13.0f); - FUN_L00_0025f800(m, D_L00_001B07B0); + cart_burst(m, &m->pos, -1, 0.33f, 13.0f); + mine_spawn_drops(m, D_L00_001B07B0); mark_moby_for_removal(m); } { @@ -745,7 +745,7 @@ void mine_update(M910 *m) { v->f70 = fast_add_rotations(v->f70, frame_time * 6.2831855f); m->pos.f[2] = m->pos.f[2] + v->f6C * fast_sin(v->f70) * k + 0.4f; if (m->bBC != 0) { - dist = FUN_001f9b80(&m->pos, D_L00_00166DC0); + dist = vector_distance(&m->pos, D_L00_00166DC0); if (v->h50 == 0) { V910 t; { @@ -782,7 +782,7 @@ void mine_update(M910 *m) { *(OvlQuad *)n = *(OvlQuad *)r; normalize_vector_xyz( n, n, random_float_between(frame_time * 4.0f, frame_time * 8.0f)); - FUN_L00_0026f080(&m->pos, n, + random_integer_below_cf(&m->pos, n, random_float_between(0.05f, 0.1f) * 210000.0f, wz); } cr = 0x60; @@ -811,11 +811,11 @@ void mine_update(M910 *m) { (cb << 16) | (cg << 8) | cr, 1); } for (l = 0; l < 20; l++) { - int c1 = FUN_L00_002371e0(0x7F000000, + int c1 = mine_blend_color(0x7F000000, (0x7F << 24) | (cb << 16) | (cg << 8) | cr, random_float_between(0.25f, 1.0f)); int c2 = - FUN_L00_002371e0(0, ((cb / 2) << 16) | ((cg / 2) << 8) | (cr / 2), + mine_blend_color(0, ((cb / 2) << 16) | ((cg / 2) << 8) | (cr / 2), random_float_between(0.5f, 1.0f)); float sz; int life; @@ -840,7 +840,7 @@ void mine_update(M910 *m) { V910 t; { clear_vector(t); - FUN_L00_0025e450(m, t, 0, 0.0f, 0.0f, 3, 3, 5, 2.0f, 1.0f, 4.0f, 1.0f, 2, + spawn_explosion(m, t, 0, 0.0f, 0.0f, 3, 3, 5, 2.0f, 1.0f, 4.0f, 1.0f, 2, 7.0f, 0, 1, -1, D_E910.b11); } } else { @@ -878,7 +878,7 @@ void mine_update(M910 *m) { int life = FUN_L00_00257b90(scale_game_frames(0xB4), scale_game_frames(0xF0)); - FUN_L00_0026bed0((char *)r, (char *)n, c1, 0x101010, sz, life, 0); + mine_debris((char *)r, (char *)n, c1, 0x101010, sz, life, 0); break; } case 1: { @@ -886,7 +886,7 @@ void mine_update(M910 *m) { int c2 = FUN_L00_0025c0e8(0x0F081020, D_E910.b11); float sz = random_float_between(50000.0f, 100000.0f) * sc; - FUN_L00_0026bed0((char *)r, (char *)n, c1, c2, sz, + mine_debris((char *)r, (char *)n, c1, c2, sz, scale_game_frames(0xB4), 1); break; } @@ -902,14 +902,14 @@ void mine_update(M910 *m) { sz = sc * 150000.0f; life = FUN_L00_00257b90(scale_game_frames(0x1E), scale_game_frames(0x2D)); - FUN_L00_0026bed0((char *)r, (char *)n, c1, c2, sz, life, 2); + mine_debris((char *)r, (char *)n, c1, c2, sz, life, 2); break; } case 3: { - int c1 = FUN_L00_002371e0(0x7F000000, 0x7F182030, + int c1 = mine_blend_color(0x7F000000, 0x7F182030, random_float_between(0.25f, 1.0f)); int c2 = - FUN_L00_002371e0(0, 0x5F5F5F, random_float_between(0.5f, 1.0f)); + mine_blend_color(0, 0x5F5F5F, random_float_between(0.5f, 1.0f)); float sz; int life; @@ -921,7 +921,7 @@ void mine_update(M910 *m) { sz = random_float_between(200000.0f, 300000.0f) * sc; life = FUN_L00_00257b90(scale_game_frames(0xF0), scale_game_frames(0x12C)); - FUN_L00_0026bed0((char *)r, (char *)n, c1, c2, sz, life, 3); + mine_debris((char *)r, (char *)n, c1, c2, sz, life, 3); break; } } @@ -938,14 +938,14 @@ void mine_update(M910 *m) { D_L00_00166C80.i168 = scale_game_frames(0x19); FUN_001f9b48(&m->pos, hero.motion.pos.f); if (D_E910.b11 != 0) { - FUN_L00_002d3838((char *)&b, (char *)&m->pos, 0, 0); + mine_camera_blast((char *)&b, (char *)&m->pos, 0, 0); } else { - FUN_L00_002d3838((char *)&a, (char *)&m->pos, 0, 0); + mine_camera_blast((char *)&a, (char *)&m->pos, 0, 0); } - FUN_L00_0025f800(m, D_L00_001B07B0); + mine_spawn_drops(m, D_L00_001B07B0); mark_moby_for_removal(m); } else { - FUN_L00_00259fe8((unsigned char *)m, 0.25f); + jet_animate((unsigned char *)m, 0.25f); } } } @@ -1583,7 +1583,7 @@ extern float FUN_L00_0025b6a8_2adb30(float, float, float) __asm__("FUN_L00_0025b extern void FUN_L00_0025c088_2adb30(int *, int *, int *, int) __asm__("FUN_L00_0025c088"); extern unsigned FUN_L00_0025c0e8_2adb30(unsigned c, int mask) __asm__("FUN_L00_0025c0e8"); extern unsigned char *FUN_L00_002603d0_2adb30(unsigned char *) __asm__("FUN_L00_002603d0"); -extern float normalize_rotation_l14(float) __asm__("FUN_L00_0025e310"); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern void FUN_L00_0026a9f0_2adb30(void *, void *, int, int, float, int, int, int, int, float) __asm__("FUN_L00_0026a9f0"); extern void *FUN_L00_0026bb70_2adb30(void *, void *, int, int, float, int, int, int, int) __asm__("FUN_L00_0026bb70"); extern int random_integer_below_cf(void *, void *, float, float) __asm__("FUN_L00_0026f080"); @@ -1994,7 +1994,7 @@ void bomb_update(BombMoby_2adb30 *m) { } else if (m->state != 2) { int v; d->h6a++; - v = FUN_001fa6d0_2adb30(FUN_001f9de0_2adb30(normalize_rotation_l14((float)d->h6a * 0.068f)) * 96.0f) + 0x9F; + v = FUN_001fa6d0_2adb30(FUN_001f9de0_2adb30(normalize_angle((float)d->h6a * 0.068f)) * 96.0f) + 0x9F; m->color = (v << 16) | (0xFF << 24) | (v << 8) | v; } if (m->state == 2) { @@ -2063,9 +2063,9 @@ extern float D_0015ED70_2af5b8 __asm__("D_0015ED70"); float rndf_2af5b8(float, float) __asm__("FUN_002132a8"); void scale_2af5b8(void *, void *, float) __asm__("FUN_001f9bf8"); int rndi_2af5b8(int) __asm__("FUN_00213260"); -int col_2af5b8(int, int) __asm__("FUN_L00_0025c0e8"); +int FUN_L00_0025c0e8_c(int, int) __asm__("FUN_L00_0025c0e8"); int fr_2af5b8(int) __asm__("FUN_001f96f8"); -void spark_v(void *, void *, int, int, int, int, int, int) __asm__("FUN_L00_00269958"); +void FUN_L00_00269958(void *, void *, int, int, int, int, int, int); float app_2af5b8(float, float) __asm__("FUN_001fa580"); void add_2af5b8(void *, void *, void *) __asm__("FUN_001f9a10"); void kill_2af5b8(void *) __asm__("FUN_0020c828"); @@ -2090,11 +2090,11 @@ void debris_update(unsigned char *m) { *(OvlQuad *)&v = *(OvlQuad *)&t; scale_2af5b8(&v, &v, D_0015ED6C_2af5b8); if (m[0xBC] & 0xFE) { - int a = col_2af5b8(c.c[rndi_2af5b8(4)], m[0xBC] >> 1); - int b = col_2af5b8(0x4FFF, m[0xBC] >> 1); - spark_v(m + 0x10, &v, a, b, fr_2af5b8(0x2D), 0x32, 0x78, 1); + int a = FUN_L00_0025c0e8_c(c.c[rndi_2af5b8(4)], m[0xBC] >> 1); + int b = FUN_L00_0025c0e8_c(0x4FFF, m[0xBC] >> 1); + FUN_L00_00269958(m + 0x10, &v, a, b, fr_2af5b8(0x2D), 0x32, 0x78, 1); } else { - spark_v(m + 0x10, &v, c.c[rndi_2af5b8(4)], 0x4FFF, fr_2af5b8(0x2D), 0x32, 0x78, + FUN_L00_00269958(m + 0x10, &v, c.c[rndi_2af5b8(4)], 0x4FFF, fr_2af5b8(0x2D), 0x32, 0x78, 1); } } @@ -2203,7 +2203,8 @@ extern void refl_2afa48(void *, void *, void *) __asm__("FUN_L00_001ff660"); extern void vscl_2afa48(void *, void *, f32) __asm__("FUN_001f9a68"); extern f32 rnd_2afa48(f32, f32) __asm__("FUN_L00_00257c48"); extern void kill_2afa48(void *) __asm__("FUN_0020c828"); -void FUN_L00_002afa48(M_2afa48 *m) { +void nanotech_crate_fragment_update(M_2afa48 *m) __asm__("FUN_L00_002afa48"); +void nanotech_crate_fragment_update(M_2afa48 *m) { PV_2afa48 *pv = m->pv; u128 old; u128 *t; @@ -2375,13 +2376,13 @@ extern s32 D_L00_00166DC0[] __attribute__((section(".data"))); extern s32 D_L00_00173E40[0x1C] __attribute__((section(".data"))); extern f32 FUN_001f9b48(void *, void *); -extern f32 FUN_001f9b80(void *, void *); -extern f32 FUN_001f9e90(f32, f32); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern f32 FUN_001f99c0(f32); extern f32 fast_arc_sin(f32) __asm__("FUN_001f9df8"); -extern f32 FUN_001fa6c0(s32); -extern void FUN_001f9a10(void *, void *, void *); +extern f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void FUN_00214db0(void *, f32, f32, f32); extern s32 FUN_001efa68_u(void *, void *, s32, char *, void *) __asm__("FUN_001efa68"); extern s32 FUN_002141f8_u(char *) __asm__("FUN_002141f8"); @@ -2440,13 +2441,13 @@ void FUN_L00_002affa8(char *self, O *out, char *skip) { goto next; if (*(s16 *)(*(char **)(o + 0x24) + 0x46) != 5) goto next; - angh = FUN_001f9e90(v.f[0] - *(f32 *)(self + 0x10), v.f[1] - *(f32 *)(self + 0x14)); - angv = FUN_001f9e90(FUN_001f9b80(spos, &v), v.f[2] - *(f32 *)(self + 0x18)); + angh = fast_arc_tan(v.f[0] - *(f32 *)(self + 0x10), v.f[1] - *(f32 *)(self + 0x14)); + angv = fast_arc_tan(vector_distance(spos, &v), v.f[2] - *(f32 *)(self + 0x18)); dist = FUN_001f9b48(spos, &v); if (dist < 2.5f) { char *cam = *(char **)&g->moby; if (fast_difference_between_rotations( - *(f32 *)(cam + 0x48), FUN_001f9e90(*(f32 *)(o + 0x10) - g->motion.pos.f[0], + *(f32 *)(cam + 0x48), fast_arc_tan(*(f32 *)(o + 0x10) - g->motion.pos.f[0], *(f32 *)(o + 0x14) - g->motion.pos.f[1])) < 1.0471976f) { if (FUN_001f99c0(angv) < 0.7853982f) return; @@ -2454,13 +2455,13 @@ void FUN_L00_002affa8(char *self, O *out, char *skip) { } if (best < dist) goto next; - ang = FUN_001fa6c0(D_0013E520_u.bB) * 0.6981317f; + ang = convert_integer_to_float(D_0013E520_u.bB) * 0.6981317f; FUN_00214db0(&lv, dist, yaw, pitch + g->ground_pitch.f * 0.5f); - FUN_001f9a10(&lv, &lv, spos); + fast_vec_add(&lv, &lv, spos); z = fast_arc_sin(FUN_001f9b48(&lv, &v) / (dist + dist)); ang = ang + 1.5707964f; if (ang < z + z && p != 0) { - ang = FUN_001fa6c0(*(u8 *)(p + 0xA) << 3) * 0.125f; + ang = convert_integer_to_float(*(u8 *)(p + 0xA) << 3) * 0.125f; fast_arc_sin(ang / dist); } flag = 1; @@ -2545,8 +2546,8 @@ extern P D_0013F350; extern V1688 D_L00_00160660 __attribute__((section(".sdata"))); extern V1688 D_L00_00160680 __attribute__((section(".sdata"))); extern char *FUN_L00_002af450(char *, char *, int, int, int); -extern char *FUN_L00_002d3838(char *a, char *b, int c, char *d); -extern f32 FUN_001f9b80(void *, void *); +extern char *mine_camera_blast(char *a, char *b, int c, char *d) __asm__("FUN_L00_002d3838"); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); extern f32 fast_cos(f32) __asm__("func_001F9DC8"); extern f32 fast_sin(f32) __asm__("func_001F9DE0"); @@ -2559,13 +2560,13 @@ extern float D_0015ED6C; extern float D_0015ED70; extern float D_L00_0015F5D0; extern float D_L00_0015F5D4; -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern int *D_L00_00177F00[]; extern int D_L00_0015F5CC; -extern int FUN_001efa68(void *, void *, int, int, int); -extern int FUN_001f9770(void *); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int set_identity_matrix() __asm__("FUN_001f9fc8"); -extern int FUN_L00_001f2868(void *, int, void *, void *, float); +extern int collect_mobies_in_sphere(void *, int, void *, void *, float) __asm__("FUN_L00_001f2868"); extern int FUN_L00_001ff290(); extern int FUN_L00_001ff2c0(); extern int FUN_L00_001ff430(); @@ -2590,7 +2591,7 @@ extern void clamp_vector_length(void *, void *, float) __asm__("FUN_001f9c90"); extern void multiply_matrix(void *, void *, void *) __asm__("FUN_001fa378"); extern void FUN_L00_001ff660(void *, void *, void *); extern void FUN_L00_0025a9f8(void *, void *, void *, int, int, int, int, int, float, float, float); -extern void FUN_L00_0025f800(void *, void *); +extern void mine_spawn_drops(void *, void *) __asm__("FUN_L00_0025f800"); extern void FUN_L00_0026a9f0(void *, void *, int, int, float, int, int, int, int, float); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void build_look_at_matrix(void *out, void *dir, void *axis, f32 ang) __asm__("FUN_00214890"); @@ -2602,30 +2603,31 @@ extern void transform_vector(void *, void *, void *) __asm__("func_001F9D20"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("func_001F9CF8"); void FUN_L00_0026a4c8(Q1688 *a, Q1688 *b, int c, int d, int n, float f); void FUN_L00_0026cbb0(void *, void *, int, int, int, int, float); -void FUN_L00_002712b8(void *, void *, int, int, int, int, float, float, float, float, float); +void spawn_particle(void *, void *, int, int, int, int, float, float, float, float, float) __asm__("FUN_L00_002712b8"); void FUN_L00_002affa8(char *self, O *out, char *skip); extern Impact1688 impact1688 __asm__("D_L00_00173E40"); extern HeroMotion1688 hero_motion1688 __asm__("D_0013F350"); -extern float dot1688(void *) __asm__("FUN_L00_001ff430"); -extern void cross1688(void *,void *,void *) __asm__("FUN_L00_001ff2c0"); +extern float FUN_L00_001ff430_c(void *) __asm__("FUN_L00_001ff430"); +extern void FUN_L00_001ff2c0_c(void *,void *,void *) __asm__("FUN_L00_001ff2c0"); extern float horizontal1688(void *) __asm__("FUN_001f9b20"); extern float chase1688(void *,float,float,float,float,float) __asm__("FUN_L00_00258110"); extern unsigned char *smoke1688(void *,void *,int,int,int,int,float,float,float,float,float) __asm__("FUN_L00_002712b8"); extern void rotate1688(void *,void *,void *) __asm__("FUN_001f9cf8"); extern float random_angle1688(void) __asm__("FUN_00213308"); extern void axis_rotate1688(void *,void *,void *,float) __asm__("FUN_00214890"); -extern void spark1688(void *,void *,int,int,int,int,float) __asm__("FUN_L00_0026cbb0"); -extern void combine_velocity1688(void *,void *,void *) __asm__("FUN_L00_001ff290"); +extern void FUN_L00_0026cbb0(void *,void *,int,int,int,int,float); +extern void FUN_L00_001ff290_c(void *,void *,void *) __asm__("FUN_L00_001ff290"); extern int collision1688(void *,void *,int,void *,void *) __asm__("FUN_001efa68"); -extern void reflect1688(void *,void *,void *) __asm__("FUN_L00_001ff660"); -extern void matrix_scale1688(void *,void *,float) __asm__("FUN_L00_001ffd48"); -extern void matrix_add1688(void *,void *,void *) __asm__("FUN_L00_001ffe20"); +extern void FUN_L00_001ff660(void *,void *,void *); +extern void FUN_L00_001ffd48_c(void *,void *,float) __asm__("FUN_L00_001ffd48"); +extern void FUN_L00_001ffe20_c(void *,void *,void *) __asm__("FUN_L00_001ffe20"); extern void identity1688(void *) __asm__("FUN_001f9fc8"); extern void transform1688(void *,void *,void *) __asm__("FUN_001f9d20"); -extern void rings1688(void *,void *,int,int,float,int,int,int,int,float) __asm__("FUN_L00_0026a9f0"); -extern void debris1688(void *,void *,int,int,float,int) __asm__("FUN_L00_0026a4c8"); +extern void FUN_L00_0026a9f0(void *,void *,int,int,float,int,int,int,int,float); +extern void FUN_L00_0026a4c8_c(void *,void *,int,int,float,int) __asm__("FUN_L00_0026a4c8"); -void FUN_L00_002b03a0(M910 *m) { +void gold_devastator_missile_update(M910 *m) __asm__("FUN_L00_002b03a0"); +void gold_devastator_missile_update(M910 *m) { B910 effect=D_L00_001E9950; B910 gold_effect=D_L00_001E99A0; V1688 camera_delta; @@ -2657,7 +2659,7 @@ void FUN_L00_002b03a0(M910 *m) { target=d->target; if(D_L00_0015F5D0>0.9f || D_L00_0015F5D4>0.9f) reduced=1; d->speed=d->speed+(d->desired_speed-d->speed)/10.0f*frame_scale_sq; - FUN_001f9770(&d->turn_time); + fast_dec_timer_s16(&d->turn_time); { float turn=convert_integer_to_float(d->turn_time); turn=turn/convert_integer_to_float(d->turn_period); @@ -2674,12 +2676,12 @@ void FUN_L00_002b03a0(M910 *m) { if(d->track_velocity) { float b,a,root,t1,t2,denominator,negative_b; subtract_vector_xyz(&phase.vectors.relative,&phase.vectors.target,&d->previous_target); - cross1688(&predicted,&phase.vectors.relative,&hero_velocity); + FUN_L00_001ff2c0_c(&predicted,&phase.vectors.relative,&hero_velocity); qcopy(&d->previous_target,&phase.vectors.target); - a=dot1688(&phase.vectors.relative); + a=FUN_L00_001ff430_c(&phase.vectors.relative); b=(phase.vectors.relative.f[0]*phase.collision.dir[0]+phase.vectors.relative.f[1]*phase.collision.dir[1]+phase.vectors.relative.f[2]*phase.collision.dir[2])*-2.0f; a=d->speed*d->speed-a; - root=square_root_scalar(b*b-a*4.0f*-dot1688(phase.collision.dir)); + root=square_root_scalar(b*b-a*4.0f*-FUN_L00_001ff430_c(phase.collision.dir)); negative_b=-b; denominator=a+a; t1=(negative_b+root)/denominator; @@ -2698,11 +2700,11 @@ void FUN_L00_002b03a0(M910 *m) { if(time>0.0f && time<(float)scale_game_frames_alt(300)) { scale_vector_xyz(&predicted,&phase.vectors.relative,time); add_vector_xyz(&predicted,&predicted,phase.collision.dir); - yaw=FUN_001f9e90(predicted.f[0],predicted.f[1]); - pitch=-FUN_001f9e90(horizontal1688(&predicted),predicted.f[2]); + yaw=fast_arc_tan(predicted.f[0],predicted.f[1]); + pitch=-fast_arc_tan(horizontal1688(&predicted),predicted.f[2]); } else { - yaw=FUN_001f9e90(phase.collision.dir[0],phase.collision.dir[1]); - pitch=-FUN_001f9e90(horizontal1688(phase.collision.dir),phase.collision.dir[2]); + yaw=fast_arc_tan(phase.collision.dir[0],phase.collision.dir[1]); + pitch=-fast_arc_tan(horizontal1688(phase.collision.dir),phase.collision.dir[2]); } } else { if(d->lifemtx,random_angle1688()); { int color=FUN_L00_0025c0e8(0x4F007FFF,D_0013E520.bB); - spark1688(&smoke_position,&phase.vectors.relative,color,0x1FFFFFFF,scale_game_frames_alt(15),1,25000.0f); + FUN_L00_0026cbb0(&smoke_position,&phase.vectors.relative,color,0x1FFFFFFF,scale_game_frames_alt(15),1,25000.0f); } } qcopy(&previous,(&m->pos)); - combine_velocity1688(phase.collision.dir,&motion,&hero_velocity); + FUN_L00_001ff290_c(phase.collision.dir,&motion,&hero_velocity); add_vector_xyz((&m->pos),(&m->pos),&motion); if(m->pos.f[0]<0.0f || m->pos.f[1]<0.0f || m->pos.f[2]<0.0f) { - FUN_L00_0025f800(m,D_L00_001B0770); + mine_spawn_drops(m,D_L00_001B0770); mark_moby_for_removal(m); return; } @@ -2777,7 +2779,7 @@ void FUN_L00_002b03a0(M910 *m) { hit_normal=&hit->normal; skip=m; normalize_vector_xyz(&surface_motion,&surface_motion,1.0f); - reflect1688(&blast_velocity,&motion,hit_normal); + FUN_L00_001ff660(&blast_velocity,&motion,hit_normal); normalize_vector_xyz(&blast_velocity,&blast_velocity,D_0015ED6C+D_0015ED6C); normalize_vector_xyz(&normal,hit_normal,1.0f); } @@ -2787,17 +2789,17 @@ void FUN_L00_002b03a0(M910 *m) { subtract_vector_xyz(&surface_motion,&hit->velocity_end,&hit->velocity_start); hit_normal=&hit->normal; normalize_vector_xyz(&surface_motion,&surface_motion,1.0f); - reflect1688(&blast_velocity,&motion,hit_normal); + FUN_L00_001ff660(&blast_velocity,&motion,hit_normal); normalize_vector_xyz(&blast_velocity,&blast_velocity,D_0015ED6C+D_0015ED6C); normalize_vector_xyz(&normal,hit_normal,1.0f); } - } else if(tick_countdown_32_alt(&d->life) || d->limitpos),&D_0013F350.x80)) { + } else if(tick_countdown_32_alt(&d->life) || d->limitpos),&D_0013F350.x80)) { qcopy(&normal,&D_L00_00160680); qcopy(&surface_motion,&D_L00_00160660); rotate1688(&surface_motion,&surface_motion,m->mtx); rotate1688(&normal,&normal,m->mtx); if(!D_0013E520.bB) { - FUN_L00_0025f800(m,D_L00_001B0770); + mine_spawn_drops(m,D_L00_001B0770); mark_moby_for_removal(m); return; } @@ -2809,7 +2811,7 @@ void FUN_L00_002b03a0(M910 *m) { int particles; int particle_reduction; int i,j; - int hit=FUN_L00_001f2868((&m->pos),16,m,0,(size+size)); + int hit=collect_mobies_in_sphere((&m->pos),16,m,0,(size+size)); particles=10; predicted.q=m->pos.q; FUN_L00_0025a9f8(m,&predicted,D_L00_00177F00,hit,(int)skip,0x830000,3,1,3.0f,1.0f,1.0f); @@ -2836,11 +2838,11 @@ void FUN_L00_002b03a0(M910 *m) { for(remaining=0;remainingbBC==1) { float a=random_angle1688(); - matrix_scale1688(rotation_part,basis_squared,1.0f-fast_cos(a)); - matrix_scale1688(diagonal,basis,fast_sin(a)); - matrix_add1688(diagonal,diagonal,rotation_part); + FUN_L00_001ffd48_c(rotation_part,basis_squared,1.0f-fast_cos(a)); + FUN_L00_001ffd48_c(diagonal,basis,fast_sin(a)); + FUN_L00_001ffe20_c(diagonal,diagonal,rotation_part); identity1688(rotation_part); - matrix_add1688(rotation,diagonal,rotation_part); + FUN_L00_001ffe20_c(rotation,diagonal,rotation_part); transform1688(&predicted,&surface_motion,rotation); normalize_vector_xyz(&predicted,&predicted,random_float_between(8.5f,16.5f)*D_0015ED6C*size); } else { @@ -2891,10 +2893,10 @@ void FUN_L00_002b03a0(M910 *m) { int life=FUN_L00_00257b90(scale_game_frames_alt(15),scale_game_frames_alt(20))-particle_reduction*7; int end=FUN_L00_00257b90(scale_game_frames_alt(25),scale_game_frames_alt(30))-particle_reduction*10; int white_life, white_end; - rings1688((&m->pos),&blast_velocity,c,f,400000.0f,life,end,0,0,speed); + FUN_L00_0026a9f0((&m->pos),&blast_velocity,c,f,400000.0f,life,end,0,0,speed); white_life=FUN_L00_00257b90(scale_game_frames_alt(5),scale_game_frames_alt(10))-particle_reduction*5; white_end=FUN_L00_00257b90(scale_game_frames_alt(15),scale_game_frames_alt(20))-particle_reduction*7; - rings1688((&m->pos),&blast_velocity,0x7FFFFFFF,0xFFFFFF,400000.0f,white_life,white_end,0,0,speed*0.5f); + FUN_L00_0026a9f0((&m->pos),&blast_velocity,0x7FFFFFFF,0xFFFFFF,400000.0f,white_life,white_end,0,0,speed*0.5f); } for(i=0;ipos),&v,c,f,debris_scale,life); + FUN_L00_0026a4c8_c((&m->pos),&v,c,f,debris_scale,life); } if(D_L00_0015F5D0<0.95f && distance>9.0f) { int c=127,f=127; @@ -2936,12 +2938,12 @@ void FUN_L00_002b03a0(M910 *m) { D_L00_00166C80.i168=scale_game_frames_alt(25); allocate_voice_for_target_entry_alt(0,0,(int)m); if(!reduced) { - if(D_0013E520.bB) FUN_L00_002d3838((char *)&gold_effect,(char *)(&m->pos),0,0); - else FUN_L00_002d3838((char *)&effect,(char *)(&m->pos),0,0); + if(D_0013E520.bB) mine_camera_blast((char *)&gold_effect,(char *)(&m->pos),0,0); + else mine_camera_blast((char *)&effect,(char *)(&m->pos),0,0); } d->bounce_count++; if(!D_0013E520.bB || d->bounce_count==3) { - FUN_L00_0025f800(m,D_L00_001B0770); + mine_spawn_drops(m,D_L00_001B0770); mark_moby_for_removal(m); return; } @@ -2949,9 +2951,9 @@ void FUN_L00_002b03a0(M910 *m) { d->target=0; m->bBC=0; normalize_vector_xyz(&impact1688.normal,&impact1688.normal,1.0f); - reflect1688(&bounce[0],&motion,&impact1688.normal); - m->rz=FUN_001f9e90(bounce[0].f[0],bounce[0].f[1]); - m->ry=-FUN_001f9e90(horizontal1688(&bounce[0]),bounce[0].f[2]); + FUN_L00_001ff660(&bounce[0],&motion,&impact1688.normal); + m->rz=fast_arc_tan(bounce[0].f[0],bounce[0].f[1]); + m->ry=-fast_arc_tan(horizontal1688(&bounce[0]),bounce[0].f[2]); d->yaw_velocity=0.0f; d->pitch_velocity=0.0f; normalize_vector_xyz(&bounce[1],&impact1688.normal,0.05f); add_vector_xyz((&m->pos),(&m->pos),&bounce[1]); diff --git a/src/overlays/shared/gameplay/entities/nanotech_ball.c b/src/overlays/shared/gameplay/entities/nanotech_ball.c index 4c71b6a76f..299c6505b6 100644 --- a/src/overlays/shared/gameplay/entities/nanotech_ball.c +++ b/src/overlays/shared/gameplay/entities/nanotech_ball.c @@ -41,8 +41,8 @@ extern f32 D_L00_001616DC; s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); void clear_u64_value(void *) __asm__("FUN_001f99f8"); -void FUN_001f9cf8(void *, void *, void *); -void FUN_001f9a10(void *, void *, void *); +void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); +void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); void FUN_L00_002d7f88(S_002d7f88 *self) { D_002d7f88 *d = self->p78; @@ -61,8 +61,8 @@ void FUN_L00_002d7f88(S_002d7f88 *self) { m = o->p78; clear_u64_value(self->v10); self->f14 = -d->f4; - FUN_001f9cf8(self->v10, self->v10, (u8 *)d->o + 0xC0); - FUN_001f9a10(self->v10, self->v10, m); + transform_vector_by_basis(self->v10, self->v10, (u8 *)d->o + 0xC0); + fast_vec_add(self->v10, self->v10, m); qcopy(&self->q40, &d->o->q40); if (d->f4 > D_L00_001616DC) { self->b23 = truncate_float_to_s32((1.0f - (d->f4 - D_L00_001616DC) * 10.0f) * 127.0f); @@ -448,7 +448,7 @@ extern float D_L00_00161A54 __attribute__((sda)); extern int D_L00_00161A58_gp __asm__("D_L00_00161A58") __attribute__((sda)); extern float D_L00_00161A5C __attribute__((sda)); extern int fast_bsphere_check() __asm__("FUN_001fa728"); -extern int FUN_L00_00267a08(); +extern int free_effect_particle() __asm__("FUN_L00_00267a08"); extern s32 random_integer_below_c(s32) __asm__("func_00213260"); extern unsigned char D_0013F5E0[]; extern volatile unsigned char D_0015EDB6; @@ -463,9 +463,9 @@ extern void scale_vector_xyz_c(void *, void *, float) __asm__("FUN_001f9a68"); extern void subtract_vector_xyz_c(void *, void *, void *) __asm__("FUN_001f9a28"); extern void vu_euler_rotation_basis(void *, void *) __asm__("func_001FA030"); float FUN_L00_00257c48(float lo, float hi); -float FUN_L00_00257e20(float a, float b, float c, float d, float t); +float cubic_hermite_scalar(float a, float b, float c, float d, float t) __asm__("FUN_L00_00257e20"); int FUN_L00_00257b90(int lo, int hi); -int FUN_L00_0028dc90(int i, int a1, int v, int k); +int trooper_play_sound(int i, int a1, int v, int k) __asm__("FUN_L00_0028dc90"); int FUN_L00_002d8980_c(char *a) __asm__("FUN_L00_002d8980"); s32 fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); s32 FUN_L00_002d8510_c(M_2d8510 *m) __asm__("FUN_L00_002d8510"); @@ -512,7 +512,8 @@ extern int func_L00_0028EF68_2D9EA0(int, int, void *, int) __asm__("FUN_L00_0028 extern float func_001FA888_2D9EA0(int) __asm__("FUN_001fa6c0"); extern float func_L00_00258E58_2D9EA0(float, float, float, float, float) __asm__("FUN_L00_00257e20"); -void FUN_L00_002d89f0(Moby *moby) { +void nanotech_ball_update(Moby *moby) __asm__("FUN_L00_002d89f0"); +void nanotech_ball_update(Moby *moby) { V_2D9EA0 v0, v10, v20, v30, v40, v50, v60; D_2D9EA0 *data = (D_2D9EA0 *)moby->pvars; @@ -992,7 +993,7 @@ void FUN_L00_002d9810(u8 *m) { FUN_00233980_002d9810(0x47, 0x5360b); } #endif -int FUN_001efa68(Vec4 *, Vec4 *, int, int, int); +int collision_line(Vec4 *, Vec4 *, int, int, int) __asm__("FUN_001efa68"); /* True when coll_line_fix returns 0 for the moby and (*(char * *)&D_001413D0_lui) positions, both raised by 0.5. */ int FUN_L00_002d8980(char *a) { Vec4 p, t; @@ -1000,7 +1001,7 @@ int FUN_L00_002d8980(char *a) { p.f[2] += 0.5f; qcopy(&t, (*(char * *)&D_001413D0_lui) + 0x10); t.f[2] += 0.5f; - return FUN_001efa68(&p, &t, 0x12, 0, 0) == 0; + return collision_line(&p, &t, 0x12, 0, 0) == 0; } /* False in modes 0, 1, 5, 12, and in modes 2 and 4 unless the state is 0x3C. */ int FUN_L00_002d9f78(void) { @@ -1032,9 +1033,9 @@ typedef struct { extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void copy_matrix_rotation(void *, void *) __asm__("FUN_001fa298"); -extern void FUN_001fa2b8(void *, void *); +extern void copy_matrix3x4(void *, void *) __asm__("FUN_001fa2b8"); extern void multiply_matrix(void *, void *, void *) __asm__("FUN_001fa378"); -extern void FUN_0020e098(void *); +extern void refresh_moby_spatial_bounds_from_basis(void *) __asm__("FUN_0020e098"); /* Composes the 0xC0 matrix of a with the one built from c into b+0xC0 and flags b for update. */ void FUN_L00_002d9fd0(char *a, char *b, void *c) { @@ -1042,9 +1043,9 @@ void FUN_L00_002d9fd0(char *a, char *b, void *c) { euler_rotation_matrix(&t0, c); copy_matrix_rotation(&t1, a + 0xC0); multiply_matrix(&t2, &t1, &t0); - FUN_001fa2b8(b + 0xC0, &t2); + copy_matrix3x4(b + 0xC0, &t2); *(unsigned short *)(b + 0x34) |= 4; - FUN_0020e098(b); + refresh_moby_spatial_bounds_from_basis(b); } #define NOT_SDA @@ -1194,7 +1195,7 @@ extern void FUN_L00_002ddf60(void *, void *); extern R *FUN_L00_002db890_c(M_da360 *) __asm__("FUN_L00_002db890"); extern f32 vector_distance_xy(void *, void *) __asm__("FUN_001f9b80"); extern s32 FUN_L00_002d9f78_c(void) __asm__("FUN_L00_002d9f78"); -extern f32 FUN_001f9e90(f32, f32); +extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern s32 FUN_001efa68_c(void *, V_da360 *, s32, M_da360 *, s32) __asm__("FUN_001efa68"); int FUN_L00_002da058(u8 *p, void *q, void *m_, void *r_, void *buf); @@ -1227,9 +1228,9 @@ void FUN_L00_002da360(u8 *p, void *q) { qcopy(&v, &m->pos); v.z += 0.4f; t = fast_difference_between_rotations( - a, FUN_001f9e90(v.x - *(f32 *)(p + 0x10), v.y - *(f32 *)(p + 0x14))); + a, fast_arc_tan(v.x - *(f32 *)(p + 0x10), v.y - *(f32 *)(p + 0x14))); if (t * t < thr) { - t = FUN_001f9e90(d, v.z - *(f32 *)(p + 0x18)); + t = fast_arc_tan(d, v.z - *(f32 *)(p + 0x18)); t = fast_difference_between_rotations(b, t); if (t * t < thr) { if (!FUN_001efa68_c(buf, &v, 2, m, 0)) @@ -1403,7 +1404,7 @@ typedef struct { u8 pad[9]; u8 gold; } SuckItemVariant; /* item 9 (Suck Cannon) typedef struct { u8 pad[0x10]; float height; } SuckAimHeight; extern char D_L00_00166C80[]; extern char D_L00_00166DC0[]; -extern f32 FUN_001f9e90(f32, f32); +extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 approximate_arcsine(f32) __asm__("func_001F9DF8"); extern f32 distance_xyz(void *, void *) __asm__("func_001F9B48"); extern f32 square_root_scalar(f32) __asm__("func_001F9988"); @@ -1452,7 +1453,8 @@ extern void suck_reset(SuckMoby *) __asm__("FUN_L00_002ddca0"); extern void suck_draw_reticle(int,int,float,float,int,int,int,float,int) __asm__("FUN_L00_001edf60"); extern SuckAimHeight *suck_get_aim_height(void *) __asm__("FUN_002141f8"); extern float D_L00_00173E68 __attribute__((section(".data"))); -void FUN_L00_002da790(SuckMoby *self) { +void suckcannon_update(SuckMoby *self) __asm__("FUN_L00_002da790"); +void suckcannon_update(SuckMoby *self) { SuckWork work; SuckCannon *cannon; SuckStats *stats; @@ -1668,8 +1670,8 @@ void FUN_L00_002da790(SuckMoby *self) { limit=10000.0f; best=0; if(suck_hero.aim_locked) yaw=suck_hero.aim_yaw; - else yaw=FUN_001f9e90(work.fire.velocity.f.x,work.fire.velocity.f.y); - pitch=-FUN_001f9e90(vector_length_xy(&work.fire.velocity),work.fire.velocity.f.z); + else yaw=fast_arc_tan(work.fire.velocity.f.x,work.fire.velocity.f.y); + pitch=-fast_arc_tan(vector_length_xy(&work.fire.velocity),work.fire.velocity.f.z); m=suck_moby_list; while(m) { if(m->state>=0 && m!=stored) { @@ -1680,12 +1682,12 @@ void FUN_L00_002da790(SuckMoby *self) { if(r) work.fire.point.f.z+=r->height; else work.fire.point.f.z+=0.5f; if((m->flags&0x1000) && m && m->cls && m->cls->category==5) { - tyaw=FUN_001f9e90(work.fire.point.f.x-work.fire.launch.f.x,work.fire.point.f.y-work.fire.launch.f.y); - tpitch=FUN_001f9e90(vector_distance_xy(&work.fire.launch,&work.fire.point),work.fire.point.f.z-work.fire.launch.f.z); + tyaw=fast_arc_tan(work.fire.point.f.x-work.fire.launch.f.x,work.fire.point.f.y-work.fire.launch.f.y); + tpitch=fast_arc_tan(vector_distance_xy(&work.fire.launch,&work.fire.point),work.fire.point.f.z-work.fire.launch.f.z); dyaw=fast_difference_between_rotations(yaw,tyaw); distance=distance_xyz(&work.fire.launch,&work.fire.point); if(distance<2.5f && fast_difference_between_rotations(suck_hero.yaw, - FUN_001f9e90(m->pos.f.x-suck_hero.pos.f.x,m->pos.f.y-suck_hero.pos.f.y))<1.0471976f && + fast_arc_tan(m->pos.f.x-suck_hero.pos.f.x,m->pos.f.y-suck_hero.pos.f.y))<1.0471976f && absolute_float(tpitch)<0.7853982f) { best=m; break; @@ -2000,12 +2002,12 @@ extern B50_DD3D8 D_L00_001EA0B0; extern I6_DD3D8 D_L00_001EA100; extern I6_DD3D8 D_L00_001EA118; extern char *FUN_L00_002af450(char *, char *, int, int, int); -extern char *FUN_L00_002d3838(char *, char *, int, char *); +extern char *mine_camera_blast(char *, char *, int, char *) __asm__("FUN_L00_002d3838"); extern f32 fast_vec_dot(void *a, void *b) __asm__("func_001F9AB0"); extern f32 fast_vec_length(void *) __asm__("func_001F9AF0"); extern float D_0015ED6C; extern int *D_L00_00177F00[]; -extern int FUN_L00_001f2868(); +extern int collect_mobies_in_sphere() __asm__("FUN_L00_001f2868"); extern int FUN_L00_00257b90_c(int, int) __asm__("FUN_L00_00257b90"); extern s32 random_integer_below_c2(s32) __asm__("func_00213260"); extern s32 scale_game_frames_c(s32) __asm__("func_001F96F8"); @@ -2160,7 +2162,7 @@ void FUN_L00_002dbf28(char *self, char *q) { } (*(Cam_DD3D8 *)D_L00_00166C80).f160 = (dist < 20.0f) ? 0.4f - dist * 0.0175f : 0.050000012f; (*(Cam_DD3D8 *)D_L00_00166C80).i168 = scale_game_frames_c(25); - FUN_L00_002d3838((char *)&blk, self + 0x10, 0, 0); + mine_camera_blast((char *)&blk, self + 0x10, 0, 0); if ((&D_0013E520)->b9) { k = func_L00_001F2BE8_DD3D8(3.0f, self + 0x10, 0x10, self, 0); *(u128_DD3D8 *)e = *(u128_DD3D8 *)(self + 0x10); @@ -2251,8 +2253,8 @@ extern int multiply_quaternions() __asm__("FUN_001fa3c0"); extern int quaternion_nlerp() __asm__("FUN_001fa400"); extern int quaternion_to_matrix() __asm__("FUN_001fa4f8"); extern int matrix_to_quaternion() __asm__("FUN_00214260"); -extern int FUN_L00_001f0d60(); -extern int FUN_L00_001f2868(); +extern int coll_sphere() __asm__("FUN_L00_001f0d60"); +extern int collect_mobies_in_sphere() __asm__("FUN_L00_001f2868"); extern int FUN_L00_001ff430(); extern int FUN_L00_001ff660(); extern int FUN_L00_00259888(); @@ -2274,7 +2276,7 @@ extern void subtract_vector_xyz_c2(void *, void *, void *) __asm__("FUN_001f9a28 extern void tick_countdown_32(s32 *) __asm__("func_001F9740"); extern void transform_vector(void *, void *, void *) __asm__("func_001F9D20"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("func_001F9CF8"); -f32 FUN_L00_0025e310(f32 a); +f32 normalize_angle(f32 a) __asm__("FUN_L00_0025e310"); float absolute_float_c(float input) __asm__("func_001F99C0"); int FUN_L00_002da218(char *a); s32 scale_game_frames_alt_c2(s32) __asm__("FUN_001f96f8"); @@ -2344,6 +2346,7 @@ extern int func_001FA898_2DDEA0(float) __asm__("FUN_001fa6d0"); extern int func_L00_00259B08_2DDEA0(void *, void *, float, int, float, int) __asm__("FUN_L00_00258ad0"); extern void func_001E9730_2DDEA0(void *) __asm__("FUN_001e93b0"); +int FUN_L00_002dc9f0(struct Moby *moby, char *vars); int FUN_L00_002dc9f0(struct Moby *moby, char *vars) { Frame_2DDEA0 work; R_2DDEA0 *record; @@ -2850,7 +2853,7 @@ float FUN_001ff218_002ddf60(float) __asm__("FUN_001f99c0"); float FUN_001ff800_002ddf60(float) __asm__("FUN_001f9de0"); float FUN_00200130_002ddf60(float, float) __asm__("FUN_001fa5c8"); float fast_add_rotations(float, float) __asm__("FUN_001fa580"); -float FUN_L00_001eb328(void *, float, float, float, float, float); +float rope_spring_turn(void *, float, float, float, float, float) __asm__("FUN_L00_001eb328"); float FUN_00257be8_002ddf60(float, float) __asm__("FUN_002132a8"); int random_integer_below(int) __asm__("FUN_00213260"); void FUN_001f9598_002ddf60(void (*)(void), void *) __asm__("FUN_001f4600"); @@ -2972,7 +2975,7 @@ void FUN_L00_002ddf60(void *frame_context, void *initial_vector) { delta = FUN_001ff398_002ddf60(&temp1, &temp2); length = FUN_001ff3d8_002ddf60(&temp1); angle = 1.5707964f - FUN_001ff818_002ddf60(delta / (length * D_L00_00161B84_lui)); - sampled = FUN_L00_001eb328(D_L00_001E5FE0 + row * 4, 0.0f, angle, 0.06f, 0.2f, 0.0f); + sampled = rope_spring_turn(D_L00_001E5FE0 + row * 4, 0.0f, angle, 0.06f, 0.2f, 0.0f); delta = FUN_00200130_002ddf60(angle, sampled); /* Retail retains the comparison constant as the second angle argument. */ if (FUN_001ff218_002ddf60(delta) > 0.31415927f) @@ -3322,16 +3325,17 @@ void FUN_L00_002df4a8(M09 *m) { /* update for the pulsing colour object */ /* Ported from rac1-decomp (src/overlays/shared/vendor_002D9438.c: func_L00_002E09A8), where it is exact; names translated to the US level program. */ -extern float FUN_001f9de0(float); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); -extern void FUN_L00_002502f0(void *, int, int, int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); extern void FUN_L00_002df4a8_u(void *) __asm__("FUN_L00_002df4a8"); extern int D_L00_00161B90 __attribute__((sda)); extern int D_L00_00161B94 __attribute__((sda)); extern float D_L00_00161B98 __attribute__((sda)); -void FUN_L00_002df4f8(char *m) { +void red_orb_update(char *m) __asm__("FUN_L00_002df4f8"); +void red_orb_update(char *m) { char *p = *(char **)(m + 0x78); unsigned char s = m[0x20]; float a; @@ -3345,7 +3349,7 @@ void FUN_L00_002df4f8(char *m) { a = fast_add_rotations(*(float *)p, D_L00_00161B98 * DEG_TO_RAD * frame_time); *(float *)p = a; - a = FUN_001f9de0(a); + a = fast_sin(a); c = fast_tween_color(D_L00_00161B90, D_L00_00161B94, a * 0.5f + 0.5f); b = (c >> 16) & 0xFF; g = (c >> 8) & 0xFF; @@ -3357,7 +3361,26 @@ void FUN_L00_002df4f8(char *m) { t |= g << 8; *(int *)(p + 4) = t | r; FUN_L00_002df4a8_u(m); - FUN_L00_002502f0(m, c & 0xFF, (c >> 16) & 0xFF, (unsigned)c >> 24); + set_moby_color(m, c & 0xFF, (c >> 16) & 0xFF, (unsigned)c >> 24); break; } } + +s16 D_L01_00200968[1] __attribute__((section(".data"))) = {0}; +s16 D_L02_001D8AD8[1] __attribute__((section(".data"))) = {0}; +s16 D_L03_001D78D8[1] __attribute__((section(".data"))) = {0}; +s16 D_L04_001D8718[1] __attribute__((section(".data"))) = {0}; +s16 D_L05_0020D248[1] __attribute__((section(".data"))) = {0}; +s16 D_L06_001DA1C8[1] __attribute__((section(".data"))) = {0}; +s16 D_L07_001DC188[1] __attribute__((section(".data"))) = {0}; +s16 D_L08_001EEAA8[1] __attribute__((section(".data"))) = {0}; +s16 D_L09_00205488[1] __attribute__((section(".data"))) = {0}; +s16 D_L10_001D9288[1] __attribute__((section(".data"))) = {0}; +s16 D_L11_001D8E58[1] __attribute__((section(".data"))) = {0}; +s16 D_L12_001FA828[1] __attribute__((section(".data"))) = {0}; +s16 D_L13_001D8E88[1] __attribute__((section(".data"))) = {0}; +s16 D_L14_001E5338[1] __attribute__((section(".data"))) = {0}; +s16 D_L15_001D8858[1] __attribute__((section(".data"))) = {0}; +s16 D_L16_001D7D78[1] __attribute__((section(".data"))) = {0}; +s16 D_L17_001D8B78[1] __attribute__((section(".data"))) = {0}; +s16 D_L18_001D8EB8[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/novalis_elevator.c b/src/overlays/shared/gameplay/entities/novalis_elevator.c index 9d5074a8fd..022a64d312 100644 --- a/src/overlays/shared/gameplay/entities/novalis_elevator.c +++ b/src/overlays/shared/gameplay/entities/novalis_elevator.c @@ -214,17 +214,17 @@ extern L01PathLevelState D_L01_001BB6B0; extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float FUN_001f9b48(void *, void *); -extern int FUN_001f9770(void *); -extern int FUN_L00_0028d8c0(void *, int); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L01_00277fb8(void *); extern int allocate_voice_for_target_entry(int, int, void *) __asm__("func_0022DA68"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern int hero_set_state(int, int) __asm__("FUN_L00_002223f8"); extern void FUN_L00_00227638(void); -extern void FUN_L00_00260738(void *, void *, void *, void *); +extern void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); extern void scale_vector_xyz(void *out, void *a, f32 s) __asm__("FUN_001f9a68"); @@ -236,7 +236,8 @@ extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); #define F(p, o) (*(float *)((p) + (o))) extern s32 D_0014C190_257218[][64] __asm__("D_0014C190"); -void FUN_L01_002b9eb0(unsigned char *moby) { +void novalis_elevator_update(unsigned char *moby) __asm__("FUN_L01_002b9eb0"); +void novalis_elevator_update(unsigned char *moby) { char *data = *(char **)(moby + 0x78); char *path; float orig[4], delta[4], tmp[4]; @@ -277,7 +278,7 @@ void FUN_L01_002b9eb0(unsigned char *moby) { on = 1; } qcopy(orig, moby + 0x10); - FUN_001f9770(data + 0xBA); + fast_dec_timer_s16(data + 0xBA); if (moby[0x20] == 0) { float f; char *pts; @@ -333,7 +334,7 @@ void FUN_L01_002b9eb0(unsigned char *moby) { } if (*(short *)(data + 0xBA) != 0 || (F(data, 0xBC) < 0.0f && - FUN_001f9b80((moby + 0x10), &hero.motion.pos) < 2.83f && + vector_distance((moby + 0x10), &hero.motion.pos) < 2.83f && absolute_float(hero.motion.pos.f[2] - F(moby, 0x18)) < 4.0f && F(moby, 0x18) - hero.motion.pos.f[2] > 0.9f)) { int r; @@ -353,7 +354,7 @@ void FUN_L01_002b9eb0(unsigned char *moby) { int i; float f20, t; char *q; - if (!FUN_L00_0028d8c0(moby, *(int *)(data + 0xC4))) { + if (!voice_is_playing(moby, *(int *)(data + 0xC4))) { *(int *)(data + 0xC4) = allocate_voice_for_target_entry(0, 4, (int)moby); } F(data, 0xA8) += F(data, 0xAC) * frame_time; @@ -400,9 +401,9 @@ void FUN_L01_002b9eb0(unsigned char *moby) { break; } subtract_vector_xyz(delta, (moby + 0x10), orig); - FUN_L00_00260738(data + 0x60, delta, moby + 0x40, moby + 0x40); + update_entity_matrix(data + 0x60, delta, moby + 0x40, moby + 0x40); if (!FUN_L01_00277fb8(moby)) { - if (2.0f < FUN_001f9b80((moby + 0x10), &hero.motion.pos)) { + if (2.0f < vector_distance((moby + 0x10), &hero.motion.pos)) { if (*(short *)(data + 0xBA) == 0) { *(short *)(data + 0xB8) = 1; } @@ -425,10 +426,10 @@ extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float randf_sym(float, float) __asm__("FUN_L00_00257c48"); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int FUN_L00_00257b90(int, int); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern void FUN_L00_0026c6e8(char *, char *); void build_spherical_offset(f32 *out, f32 scale, f32 a, f32 b) __asm__("FUN_00214db0"); @@ -438,7 +439,7 @@ void FUN_L01_002c72c8(void) { float p[4]; float a, b; int i; - FUN_001f9a28(v, D_L01_00167240, D_L01_001742E0); + fast_vec_sub(v, D_L01_00167240, D_L01_001742E0); a = -fast_arc_tan(vector_length_xy(v), v[2]); fast_arc_tan(v[0], v[1]); for (i = 19; i >= 0; i--) { @@ -447,7 +448,7 @@ void FUN_L01_002c72c8(void) { y = fast_add_rotations(randf_sym(0.0f, 3.1415927f), a); build_spherical_offset(v, 0.2f, y, x); fast_vec_scale(p, v, random_float_between_alt(1.0f, 3.0f)); - FUN_001f9a10(p, p, D_L01_001742E0); + fast_vec_add(p, p, D_L01_001742E0); FUN_L00_0026c6e8((char *)p, (char *)v); } for (i = 9; i >= 0; i--) { @@ -459,19 +460,19 @@ void FUN_L01_002c72c8(void) { y = fast_add_rotations(randf_sym(0.0f, 3.1415927f), a); build_spherical_offset(v, 0.05f, y, x); FUN_L00_0026cbb0(p, v, 0x4F007FFF, 0x1FFFFFFF, - FUN_L00_00257b90(FUN_001f96f8(10), FUN_001f96f8(20)), 1, 20000.0f); + FUN_L00_00257b90(scale_game_frames(10), scale_game_frames(20)), 1, 20000.0f); } } -extern int FUN_001f9740(void *); +extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); extern int FUN_001e9448(void *); extern int collect_mobies_in_sphere(float, void *, int, int, void *) __asm__("FUN_L00_001f2868"); extern void FUN_L00_00259bc8_2c7530(float, void *, void *, int, void *, void *) __asm__("FUN_L00_00259bc8"); extern void make_hit_descriptor(void *, void *, int, float, void *) __asm__("FUN_L00_00259888"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern void FUN_L01_00280970(int, void *); extern void FUN_0020c828(void *); @@ -485,13 +486,13 @@ void FUN_L01_002c7530(char *moby) { float normal[4]; float distance; - distance = FUN_001f9b80(camera, moby + 0x10); + distance = vector_distance(camera, moby + 0x10); camera -= 0x140; *(float *)(moby + 0x44) = -fast_arc_tan(distance, *(float *)(camera + 0x148) - *(float *)(moby + 0x18)); *(float *)(moby + 0x48) = fast_arc_tan(*(float *)(camera + 0x140) - *(float *)(moby + 0x10), *(float *)(camera + 0x144) - *(float *)(moby + 0x14)); *(float *)(moby + 0x40) = fast_add_rotations(*(float *)(moby + 0x40), *(float *)(data + 3)); - FUN_001f9a10(moby + 0x10, moby + 0x10, data + 8); + fast_vec_add(moby + 0x10, moby + 0x10, data + 8); switch ((u8)moby[0x20]) { case 1: FUN_L01_00280970(D_L01_00161494, moby); @@ -505,8 +506,8 @@ void FUN_L01_002c7530(char *moby) { ((void (*)(void *))FUN_L01_002c72c8)(moby); goto remove; } - if (FUN_001f9740(data)) { - data[0] = FUN_001f96f8(0x1e); + if (fast_dec_timer(data)) { + data[0] = scale_game_frames(0x1e); moby[0x20] = 2; if (data[4] != 0) data[4] = 0; @@ -515,11 +516,11 @@ void FUN_L01_002c7530(char *moby) { case 0: break; case 2: - if (FUN_001f9740(data)) { + if (fast_dec_timer(data)) { remove: FUN_0020c828(moby); } else { - int duration = FUN_001f96f8(0x1e); + int duration = scale_game_frames(0x1e); moby[0x23] = truncate_float_to_s32((float)data[0] * (127.0f / (float)duration)); } break; @@ -549,25 +550,25 @@ INCLUDE_ASM("config/us/overlays/asm/FUN_L01_002e0c68.s", FUN_L01_002e0c68); #else #include "rnc/gameplay/entities/moby.h" extern void FUN_L00_002eac18(int); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void FUN_L00_002eaa30(void *); extern void FUN_L00_002ea9d8(void *); extern void FUN_L01_00316e88(float, float); extern int FUN_L01_0023cf98(int, int); extern int pad_pressed_within(int, int, int *) __asm__("FUN_L00_00266d60"); extern float approach_value(float, float, float *) __asm__("FUN_00213ed8"); -extern float FUN_L00_0025b8c0(float *, float *, float, float, float, float); +extern float vendor_spring(float *, float *, float, float, float, float) __asm__("FUN_L00_0025b8c0"); extern void FUN_L00_0025bc00(float *, void *, float, float); extern void set_hero_animation(int, int, float) __asm__("FUN_L00_002323b8"); -extern void FUN_L00_002502a0(int); -extern void FUN_L00_00284e50(void *, void *); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern void FUN_L01_0029b0a0(void *, int, void *, int, void *); -extern void FUN_L00_001ff378(void *, void *, float); -extern float FUN_001f9ab0(void *, void *); -extern void FUN_001fa050(void *, void *); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); -extern float FUN_001fa5c8(float, float); +extern void divide_vector_xyz(void *, void *, float) __asm__("FUN_L00_001ff378"); +extern float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); +extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); +extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float probe_ground_height(void *, int, float) __asm__("FUN_00213508"); extern void fast_mem_zero16(void *, int) __asm__("FUN_001f9810"); @@ -579,7 +580,8 @@ extern float D_L01_001618A0 __attribute__((sda)); extern unsigned char D_0015EDB5; /* Six-state interaction: turn around the moby to advance its saved progress. */ -void FUN_L01_002e0c68(char *moby) { +void bolt_crank_update(char *moby) __asm__("FUN_L01_002e0c68"); +void bolt_crank_update(char *moby) { float matrix[4][4]; float direction[4], movement[4], facing[4], rotation[4]; float target[4] __attribute__((aligned(16))); @@ -615,26 +617,26 @@ void FUN_L01_002e0c68(char *moby) { break; } g = (struct Hero *)&hero.motion.pos; - if (FUN_001f9b80(moby + 0x10, g) < 1.75f && + if (vector_distance(moby + 0x10, g) < 1.75f && (g = (struct Hero *)((char *)g - 0x80), g->vehicle_mode) == 0 && fast_difference_between_rotations(g->motion.rot.f[2], fast_arc_tan(F(moby,0x10) - g->motion.pos.f[0], F(moby,0x14) - g->motion.pos.f[1])) < 1.5707964f && absolute_float(g->motion.pos.f[2] - 0.3f - F(moby,0x18)) < 0.2f && g->items[0].item_id == 8 && g->items[0].moby != 0 && - pad_pressed_within(0x80, FUN_001f96f8(7), 0) && - (unsigned int)FUN_001f96f8(30) < *(unsigned int *)(data + 0x14) && + pad_pressed_within(0x80, scale_game_frames(7), 0) && + (unsigned int)scale_game_frames(30) < *(unsigned int *)(data + 0x14) && F(moby,0x18) == F(data,0x3c) && F(data,0) < 1.0f) { *(int *)(data+0x14) = 0; available = 1; D_L01_001618A0 = 0; for (other = D_L01_0015FFE4; other != 0; other = *(char **)(other+0x28)) { - if ((*(unsigned short *)(other+0x34) & 0x1000) && FUN_001f9b80(moby+0x10, other+0x10) < 3.25f) { + if ((*(unsigned short *)(other+0x34) & 0x1000) && vector_distance(moby+0x10, other+0x10) < 3.25f) { available = 0; break; } } if (!available) break; FUN_L01_0023cf98(0x3b,1); - FUN_L00_002eaaa0(D_L01_00167240,D_L01_00167240+0x10,3,FUN_001f96f8(180),0); + jet_mount(D_L01_00167240,D_L01_00167240+0x10,3,scale_game_frames(180),0); FUN_L00_002eaa30(D_L01_001600EC + (*(int *)(data+0x20)<<7) + 0x70); FUN_L00_002ea9d8(D_L01_001600EC + (*(int *)(data+0x20)<<7) + 0x30); FUN_L01_00316e88(F(data,0x28),F(data,0x2c)); @@ -645,9 +647,9 @@ void FUN_L01_002e0c68(char *moby) { } if (F(data,0) < 1.0f) { ++*(int *)(data+0x14); - approach_value(0.0f, 1.0f / (float)FUN_001f96f8(60), (float *)data); + approach_value(0.0f, 1.0f / (float)scale_game_frames(60), (float *)data); if (0.0f < F(data,0)) { - F(moby,0x48) = FUN_001fa5c8(F(moby,0x48), (F(data,0x30) * 6.2831855f) / (float)FUN_001f96f8(60)); + F(moby,0x48) = fast_subtract_rotations(F(moby,0x48), (F(data,0x30) * 6.2831855f) / (float)scale_game_frames(60)); } F(moby,0x18) += frame_time * 0.5f; if (F(data,0x3c) <= F(moby,0x18)) F(moby,0x18) = F(data,0x3c); @@ -655,9 +657,9 @@ void FUN_L01_002e0c68(char *moby) { if (*(int *)(data+0x38) == 0) break; if (*(int *)(data+0x34) != -1 && visited52[(unsigned char)moby[0xb0] + (current_level_index << 4)] != 255) { FUN_L01_0029b0a0(data,4,moby,2,D_L01_001BAAA0); - FUN_L00_002502a0((unsigned char)moby[0xb0]); + jet_clear_persistent((unsigned char)moby[0xb0]); if (*(int *)(data+0x34) != -1) { - FUN_L00_00284e50(D_L01_001600EC + (*(int *)(data+0x34)<<7) + 0x30, + jet_reset_camera(D_L01_001600EC + (*(int *)(data+0x34)<<7) + 0x30, D_L01_001600EC + (*(int *)(data+0x34)<<7) + 0x70); } } @@ -671,7 +673,7 @@ void FUN_L01_002e0c68(char *moby) { target[2] = F(D_L01_00167240,0x18); *(u128 *)rotation = *(u128 *)target; old_angle = fast_arc_tan(hero.motion.pos.f[0]-F(moby,0x10),hero.motion.pos.f[1]-F(moby,0x14)); - if ((pad_pressed_within(0x80,FUN_001f96f8(7),0) && FUN_001f96f8(60) < hero.state_timer) || F(data,0) == 1.0f) { + if ((pad_pressed_within(0x80,scale_game_frames(7),0) && scale_game_frames(60) < hero.state_timer) || F(data,0) == 1.0f) { FUN_L01_0023cf98(0,1); if (*(int *)(data+0x38)) { moby[0x20] = 1; @@ -686,9 +688,9 @@ void FUN_L01_002e0c68(char *moby) { allocate_voice_for_target_entry(0,0,moby); if (*(int *)(data+0x34) != -1 && visited52[(unsigned char)moby[0xb0] + (current_level_index << 4)] != 255) { FUN_L01_0029b0a0(data,4,moby,2,D_L01_001BAAA0); - FUN_L00_002502a0((unsigned char)moby[0xb0]); + jet_clear_persistent((unsigned char)moby[0xb0]); if (*(int *)(data+0x34) != -1) { - FUN_L00_00284e50(D_L01_001600EC + (*(int *)(data+0x34)<<7) + 0x30, + jet_reset_camera(D_L01_001600EC + (*(int *)(data+0x34)<<7) + 0x30, D_L01_001600EC + (*(int *)(data+0x34)<<7) + 0x70); } } @@ -699,17 +701,17 @@ void FUN_L01_002e0c68(char *moby) { direction[1] = -hero.stick_x; direction[0] = -hero.stick_y; { float length = vector_length_xy(direction); - if (1.0f < length) FUN_L00_001ff378(direction,direction,length); } - FUN_001fa050(matrix,rotation); + if (1.0f < length) divide_vector_xyz(direction,direction,length); } + euler_rotation_matrix(matrix,rotation); transform_vector(direction,direction,matrix); - facing[0] = FUN_001f9dc8(hero.moby->rot.z); - facing[1] = FUN_001f9de0(hero.moby->rot.z); + facing[0] = fast_cos(hero.moby->rot.z); + facing[1] = fast_sin(hero.moby->rot.z); facing[2] = 0; { float turn, speed; { float limit; - turn = FUN_001f9ab0(facing,direction) - F(data,0x1c); + turn = fast_vec_dot(facing,direction) - F(data,0x1c); limit = frame_time_sq * 5.5f; if (limit < turn) turn = limit; if (turn < -limit) turn = -limit; @@ -724,29 +726,29 @@ void FUN_L01_002e0c68(char *moby) { if (absolute_float(F(data,0x1c)) < (frame_time_sq * 5.5f) * 0.25f) F(data,0x1c) = 0.0f; } fast_vec_normalize(movement,facing,F(data,0x1c)); - if ((hero.unkA98 & 2) && hero.moby->prev_seq == 0x44) set_hero_animation(0x3f,0,(float)FUN_001f96f8(7)); + if ((hero.unkA98 & 2) && hero.moby->prev_seq == 0x44) set_hero_animation(0x3f,0,(float)scale_game_frames(7)); if (hero.moby->prev_seq != 0x44 && hero.unkA9C == 0) { if (hero.moby->seq == 0x40 && absolute_float(F(data,0x1c)) == 0.0f) { - set_hero_animation(0x3f,0,(float)FUN_001f96f8(14)); + set_hero_animation(0x3f,0,(float)scale_game_frames(14)); } else if (hero.moby->seq == 0x3f) { - if (0.0f < F(data,0x1c)) set_hero_animation(0x40,0,(float)FUN_001f96f8(14)); + if (0.0f < F(data,0x1c)) set_hero_animation(0x40,0,(float)scale_game_frames(14)); } else if (hero.moby->seq == 0x40 && ((frame_time * 3.7f) * 0.6f) < F(data,0x1c)) { - set_hero_animation(0x41,0,(float)FUN_001f96f8(14)); + set_hero_animation(0x41,0,(float)scale_game_frames(14)); } else if (hero.moby->seq == 0x41 && F(data,0x1c) < ((frame_time * 3.7f) * 0.4f)) { - set_hero_animation(0x40,0,(float)FUN_001f96f8(16)); + set_hero_animation(0x40,0,(float)scale_game_frames(16)); } } height = hero.motion.pos.f[2]; add_vector_xyz(&hero.motion.pos,&hero.motion.pos,movement); angle = fast_arc_tan(hero.motion.pos.f[0]-F(moby,0x10),hero.motion.pos.f[1]-F(moby,0x14)); - movement[0] = FUN_001f9dc8(angle) * 1.05f; - movement[1] = FUN_001f9de0(angle) * 1.05f; + movement[0] = fast_cos(angle) * 1.05f; + movement[1] = fast_sin(angle) * 1.05f; movement[2] = 0; add_vector_xyz(target,moby+0x10,movement); subtract_vector_xyz(offset,target,&hero.motion.pos); offset[2] = 0; distance = -vector_length_xy(offset); - FUN_L00_0025b8c0(&distance,&D_L01_001618A0,0.0f,frame_scale_sq*0.015f,frame_scale_sq*0.3f,frame_time*7.0f); + vendor_spring(&distance,&D_L01_001618A0,0.0f,frame_scale_sq*0.015f,frame_scale_sq*0.3f,frame_time*7.0f); fast_vec_normalize(offset,offset,D_L01_001618A0); add_vector_xyz(&hero.motion.pos,&hero.motion.pos,offset); hero.motion.pos.f[2] = height; @@ -770,9 +772,9 @@ void FUN_L01_002e0c68(char *moby) { float turn; turn = fast_add_rotations(0.2617994f,angle); FUN_L00_0025bc00((float *)(moby+0x48),0,turn,frame_time*3.1415927f); - if (1.0471976f < FUN_001fa5c8(F(moby,0x48),turn)) { - F(moby,0x48) = FUN_001fa5c8(F(moby,0x48),1.0471976f); - } else if (FUN_001fa5c8(F(moby,0x48),turn) < -1.0471976f) { + if (1.0471976f < fast_subtract_rotations(F(moby,0x48),turn)) { + F(moby,0x48) = fast_subtract_rotations(F(moby,0x48),1.0471976f); + } else if (fast_subtract_rotations(F(moby,0x48),turn) < -1.0471976f) { F(moby,0x48) = fast_add_rotations(F(moby,0x48),1.0471976f); } } @@ -809,8 +811,8 @@ typedef struct { u8 pad_16[2]; } ItemPrice_2e1ac0; -/* pvars of the moby run by FUN_L01_002e1ac0: a scene trigger - (FUN_L00_00266448) followed by the item it sells. */ +/* pvars of the moby run by gold_weapon_case_update: a scene trigger + (update_npc_dialogue) followed by the item it sells. */ typedef struct { u8 pad_00[4]; s16 result; /* 0x04: 2 once the scene finished with a sale */ @@ -831,7 +833,8 @@ extern s32 FUN_0020b178_2e1ac0(s32, s32) __asm__("FUN_0020b178"); extern s32 D_L01_001DEB10[]; extern ItemPrice_2e1ac0 D_L01_001C4530[]; extern s32 alternate_animation_sequence_gp __asm__("D_0015EE20") __attribute__((sda)); -void FUN_L01_002e1ac0(struct Moby *m) { +void gold_weapon_case_update(struct Moby *m) __asm__("FUN_L01_002e1ac0"); +void gold_weapon_case_update(struct Moby *m) { SaleVars_2e1ac0 *v = (SaleVars_2e1ac0 *)m->pvars; s32 item; ItemPrice_2e1ac0 *price; @@ -886,7 +889,7 @@ void FUN_L01_002e30b8(int unused, void *out) { char scratch[16]; char *base = D_0013E533 + 0xE1D; fast_vec_normalize(scratch, *(char **)(base + 0x2080) + 0xD0, 1.0f); - FUN_001f9a10(out, scratch, base + 0x80); + fast_vec_add(out, scratch, base + 0x80); } #include "sda.h" @@ -944,8 +947,8 @@ s32 FUN_L01_002e3208(void *ctx, struct Moby *m) { extern f32 distance_xyz(void *, void *) __asm__("func_001F9B48"); extern float square_root(float) __asm__("FUN_001f9988"); extern float fast_difference_between_rotations_c(float, float) __asm__("func_001FA688"); -extern int FUN_001efa68(void *, void *, int, int, int); -extern void *FUN_002141f8(void *); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); +extern void *suck_get_aim_height(void *) __asm__("FUN_002141f8"); extern char D_L01_00174340_h[] __asm__("D_L01_001742C0"); extern float *func_L00_0025D390_t(void *) __asm__("FUN_002141f8"); extern int func_L00_001EFFF0_t(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); @@ -1001,10 +1004,10 @@ void *FUN_L01_002e32a8(void *moby, void *from, void *ang, float yawMax, float pi #include "rnc/overlay/quad.h" -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); -extern float FUN_001f9b80(void *, void *); -extern void *FUN_002141f8(void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern void *suck_get_aim_height(void *) __asm__("FUN_002141f8"); extern void *FUN_L01_002e32a8_u(void *, void *, void *, float, float, float, float, float, float) __asm__("FUN_L01_002e32a8"); extern void FUN_L01_0030c898(void *, void *, float, float, float, float); @@ -1028,10 +1031,10 @@ void FUN_L01_002e35a8(char *moby, char *state) { char *e; float a, b, c, d, t, dist; - if (FUN_001f9770(state + 0x4E) == 0) + if (fast_dec_timer_s16(state + 0x4E) == 0) return; qzero(&v); - FUN_001f9a10(&v, &v, moby + 0x10); + fast_vec_add(&v, &v, moby + 0x10); v.f[2] = v.f[2] + D_L01_00161914; e = FUN_L01_002e32a8_u(moby, &v, moby + 0x40, D_L01_00161908 * DEG_TO_RAD, D_L01_0016190C * DEG_TO_RAD, D_L01_00161904, 2.0f, 3.1415927f, @@ -1045,22 +1048,22 @@ void FUN_L01_002e35a8(char *moby, char *state) { if (cutscene_mode != 2) { char *r; qcopy(&q, e + 0x10); - r = FUN_002141f8(e); + r = suck_get_aim_height(e); if (r != 0) q.f[2] = q.f[2] + *(float *)(r + 0x10); else q.f[2] = q.f[2] + D_L01_00161914; - FUN_001f9a28(&p, &q, &v); + fast_vec_sub(&p, &q, &v); fast_vec_normalize(&p, &p, D_L01_00161910); - FUN_001f9a10(&v, &v, &p); + fast_vec_add(&v, &v, &p); a = fast_arc_tan(q.f[0] - v.f[0], q.f[1] - v.f[1]); - dist = FUN_001f9b80(&v, &q); + dist = vector_distance(&v, &q); b = -fast_arc_tan(dist, q.f[2] - v.f[2]); c = fast_arc_tan(q.f[0] - v.f[0], q.f[1] - v.f[1]); - dist = FUN_001f9b80(&v, &q); + dist = vector_distance(&v, &q); d = -fast_arc_tan(dist, q.f[2] - v.f[2]); FUN_L01_0030c898(moby, &v, a, b, c, d); - *(short *)(state + 0x4E) = FUN_001f96f8(D_L01_00161900); + *(short *)(state + 0x4E) = scale_game_frames(D_L01_00161900); *(int *)(state + 0x64) = *(int *)(state + 0x64) + 1; } } @@ -1074,10 +1077,10 @@ extern f32 D_L01_00161948 __attribute__((sda)); extern f32 D_L01_0016194C __attribute__((sda)); extern f32 D_L01_00161920 __attribute__((sda)); extern void FUN_L00_00258278(struct Moby *, f32, f32 *, f32, f32, f32); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); -extern f32 FUN_001f9dc8(f32); -extern f32 FUN_001f9de0(f32); +extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); +extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern void clamp_vector_length(void *, void *, f32) __asm__("FUN_001f9c90"); extern f32 probe_ground_height(void *, int, float) __asm__("FUN_00213508"); extern void blend_moby_animation_3830(void *, int, int, int) __asm__("FUN_00212f90"); @@ -1092,10 +1095,10 @@ void FUN_L01_002e3830(struct Moby *m, char *p) { subtract_vector_xyz(&v, p, &m->pos); if (m->state == 6) - d = FUN_001f9b80(&m->pos, p + 0x30); + d = vector_distance(&m->pos, p + 0x30); else - d = FUN_001f9b80(&m->pos, &hero.motion.pos); - FUN_001f9b80(&m->pos, p); + d = vector_distance(&m->pos, &hero.motion.pos); + vector_distance(&m->pos, p); switch (m->command) { case 0: @@ -1186,8 +1189,8 @@ void FUN_L01_002e3830(struct Moby *m, char *p) { if (m->state == 6 || !(d < 1.1f)) return; near = 1.1f - d; ang = fast_arc_tan(hero.motion.pos.f[0] - m->pos.x, hero.motion.pos.f[1] - m->pos.y); - ((f32 *)(p + 0x10))[0] -= near * FUN_001f9dc8(ang) * (frame_scale_sq * 0.1f); - ((f32 *)(p + 0x10))[1] -= near * FUN_001f9de0(ang) * (frame_scale_sq * 0.1f); + ((f32 *)(p + 0x10))[0] -= near * fast_cos(ang) * (frame_scale_sq * 0.1f); + ((f32 *)(p + 0x10))[1] -= near * fast_sin(ang) * (frame_scale_sq * 0.1f); return; inactive: m->command = 0; @@ -1247,7 +1250,7 @@ extern char D_L01_0020AE80[]; extern char D_L01_0020AEA0[]; extern void debug_print_2e3f20(char *) __asm__("FUN_001e93b0"); extern void initialize_mover_2e3f20(void *) __asm__("FUN_L01_0026d930"); -extern void FUN_L01_00263a28(void *, int, int *, float *, float *, int *); +extern void rig_probe_setup(void *, int, int *, float *, float *, int *) __asm__("FUN_L01_00263a28"); extern void face_target_2e3f20(struct Moby *, float, float *, float, float, float) __asm__("FUN_L00_00258278"); extern int FUN_L01_0023cf98(int, int); extern void play_sound_2e3f20(int, int, float) __asm__("FUN_L00_002323b8"); @@ -1257,10 +1260,10 @@ extern void spawn_particle_2e3f20(float *, int, int, int, int, float *, float, f extern void finish_moby_2e3f20(void *, float) __asm__("FUN_L00_00259fe8"); extern int random_integer_3830(void) __asm__("FUN_001160d8"); extern void blend_moby_animation_3830(void *, int, int, int) __asm__("FUN_00212f90"); -extern int FUN_001efa68(void *, void *, int, int, int); -extern int FUN_001f9740(void *); -extern float FUN_001f9b80(void *, void *); -extern int FUN_001f96f8(int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); +extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); extern int FUN_L00_00257b90(int, int); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); @@ -1272,7 +1275,8 @@ extern s32 FUN_L01_002e3208(void *, struct Moby *); extern void FUN_L01_002e35a8(char *, char *); extern void FUN_L01_002e3830(struct Moby *, char *); extern unsigned char D_0013D4C5 __attribute__((section(".data"))); -void FUN_L01_002e3f20(struct Moby *moby) { +void sand_mouse_update(struct Moby *moby) __asm__("FUN_L01_002e3f20"); +void sand_mouse_update(struct Moby *moby) { Data_2e3f20 *d; float va[4]; float vb[4]; @@ -1306,7 +1310,7 @@ void FUN_L01_002e3f20(struct Moby *moby) { d->s4A = 0; d->timer = 0; if (moby->prev_seq != 0) { - blend_moby_animation_3830(moby, 0, 0, FUN_001f96f8(10)); + blend_moby_animation_3830(moby, 0, 0, scale_game_frames(10)); } moby->update_dist = 0xFF; moby->draw_dist = 0xFF; @@ -1332,7 +1336,7 @@ void FUN_L01_002e3f20(struct Moby *moby) { int kind; float len; int flag; - FUN_L01_00263a28(moby, 0, &kind, va, &len, &flag); + rig_probe_setup(moby, 0, &kind, va, &len, &flag); mover_2e3f20.f14 = frame_scale * 0.4f; mover_2e3f20.f8 = 0.15f; mover_2e3f20.fC = 0.15f; @@ -1346,7 +1350,7 @@ void FUN_L01_002e3f20(struct Moby *moby) { mover_2e3f20.f3C = frame_time_sq * 11.519173f; mover_2e3f20.f40 = frame_time_sq * 3.1415927f; mover_2e3f20.f44 = frame_time * 11.519173f; - mover_2e3f20.i48 = FUN_001f96f8(4); + mover_2e3f20.i48 = scale_game_frames(4); mover_2e3f20.f28 = 3.1415927f; } moby->state = 1; @@ -1355,10 +1359,10 @@ void FUN_L01_002e3f20(struct Moby *moby) { case 1: if (D_0013D4C5 != 0 && hero_2e3f20->i1158 == 5) { d->count = 0; - d->t60 = FUN_001f96f8(D_L01_00161918); + d->t60 = scale_game_frames(D_L01_00161918); if (moby->visible != 0 && (moby->anim_flags & 2)) { if (moby->prev_seq != random_integer_3830() % 3) { - blend_moby_animation_3830(moby, random_integer_3830() % 3, 0, FUN_001f96f8(10)); + blend_moby_animation_3830(moby, random_integer_3830() % 3, 0, scale_game_frames(10)); } } if (d->parent != -1) { @@ -1378,7 +1382,7 @@ void FUN_L01_002e3f20(struct Moby *moby) { qcopy(vb, hero_2e3f20->pos); vb[2] = vb[2] + 0.2f; if (is_point_inside_clip_volume(hero_2e3f20->pos, d->vol)) { - if (!FUN_001efa68(va, vb, 0, moby, 0) + if (!collision_line(va, vb, 0, moby, 0) || D_L01_001742D8 == hero_2e3f20->p2080) { FUN_L01_002e30b8((int)moby, d); if (hero_2e3f20->helper != 0 @@ -1389,7 +1393,7 @@ void FUN_L01_002e3f20(struct Moby *moby) { } *(void **)((char *)&mover_2e3f20 + 0x50) = moby; FUN_L01_0023cf98(0x1F, 0); - play_sound_2e3f20(0, 0, (float)FUN_001f96f8(6)); + play_sound_2e3f20(0, 0, (float)scale_game_frames(6)); if (d->parent != -1) { ents_2e3f20[d->parent].command = 5; moby->state = 2; @@ -1421,15 +1425,15 @@ void FUN_L01_002e3f20(struct Moby *moby) { face_target_2e3f20(moby, ang, &mover_2e3f20.f14, frame_time_sq * 11.519173f, frame_time_sq * 3.1415927f, frame_time * 11.519173f); if ((step_mover_2e3f20(moby, &mover_2e3f20, d->target, d->vel) & 6) - || FUN_001f9b80(((float *)&moby->pos), hero_2e3f20->pos) < 1.0f) { + || vector_distance(((float *)&moby->pos), hero_2e3f20->pos) < 1.0f) { qzero(d->vel); moby->state = 4; - d->timer = FUN_001f96f8(0x78); + d->timer = scale_game_frames(0x78); } - if (FUN_001f9b80(((float *)&moby->pos), d->home) > 0.4f && d->timer == 0) { + if (vector_distance(((float *)&moby->pos), d->home) > 0.4f && d->timer == 0) { *(float *)((char *)&mover_2e3f20 + 4) = 0.7f; if (moby->prev_seq != 3) { - blend_moby_animation_3830(moby, 3, 0, FUN_001f96f8(3)); + blend_moby_animation_3830(moby, 3, 0, scale_game_frames(3)); } } break; @@ -1454,13 +1458,13 @@ void FUN_L01_002e3f20(struct Moby *moby) { && hero_2e3f20->i208C != 0x16 && hero_2e3f20->i208C != 0x14 && hero_2e3f20->b20A4 == 0 - && !FUN_001f9740(&d->t60) + && !fast_dec_timer(&d->t60) && d->count < D_L01_0016191C) { FUN_L01_002e3110((char *)moby, (char *)d); FUN_L01_002e3830(moby, d); } else { if (moby->prev_seq != 5) { - blend_moby_animation_3830(moby, 5, 0, FUN_001f96f8(10)); + blend_moby_animation_3830(moby, 5, 0, scale_game_frames(10)); } qzero(d->vel); d->timer = D_L01_00161924; @@ -1472,7 +1476,7 @@ void FUN_L01_002e3f20(struct Moby *moby) { FUN_L01_002e35a8((char *)moby, (char *)d); break; case 6: - if (FUN_001f9770(&d->timer)) { + if (fast_dec_timer_s16(&d->timer)) { moby->alpha = 0x80; qcopy(((float *)&moby->pos), d->home); qcopy(d->target, d->home); @@ -1531,7 +1535,7 @@ void FUN_L01_002e3f20(struct Moby *moby) { moby->pos.z = z; if (r & 4) { if (moby->prev_seq != 0) { - blend_moby_animation_3830(moby, 0, 0, FUN_001f96f8(6)); + blend_moby_animation_3830(moby, 0, 0, scale_game_frames(6)); } ents_2e3f20[d->parent].command = 1; moby->state = 1; @@ -1562,13 +1566,13 @@ typedef struct { } Hit_2eedd8; extern float probe_ground_height(void *, int, float) __asm__("func_00213508"); -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int tick_countdown_32_alt(void *) __asm__("FUN_001f9740"); extern void set_vector_length_xy(void *, void *, float) __asm__("FUN_001f9c48"); extern void FUN_L00_00269958(void *, void *, int, int, int, int, int, int); extern void make_hit_descriptor(void *, void *, int, float, void *) __asm__("FUN_L00_00259888"); extern void FUN_L00_00259a88(void *, void *); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void clear_vector(void *) __asm__("func_001F99F8"); void mark_moby_for_removal(void *obj) __asm__("FUN_0020c828"); extern char D_L01_00174340_c[] __asm__("D_L01_001742C0"); @@ -1600,7 +1604,7 @@ void FUN_L01_002eda00(char *m) { } else { *(float *)(d + 8) -= frame_time_sq * 10.8f; } - if (FUN_001efa68(m + 0x10, prev, 0, *(int *)(d + 0x10), 0) != 0) { + if (collision_line(m + 0x10, prev, 0, *(int *)(d + 0x10), 0) != 0) { char *p = D_L01_00174340_c; if (*(int *)(p + 0x18) != 0) { make_hit_descriptor(&h, m, 0x10001, 1.0f, d); @@ -1618,7 +1622,7 @@ void FUN_L01_002eda00(char *m) { m[0x20] = 2; break; case 2: - FUN_L00_0025f090(m, m + 0x10, -1, 0.25f, 13.0f); + cart_burst(m, m + 0x10, -1, 0.25f, 13.0f); mark_moby_for_removal(m); break; } @@ -1628,13 +1632,13 @@ extern void FUN_L00_0025a120(void *); extern void FUN_L01_002eec68_u(char *) __asm__("FUN_L01_002eec68"); extern void FUN_L01_002ef560(unsigned char *); extern void FUN_L01_002ef770(unsigned char *, float *); -extern int FUN_L01_00276fe8(int *, int, int, float, void *, void *, void *); +extern int follow_path(int *, int, int, float, void *, void *, void *) __asm__("FUN_L01_00276fe8"); extern void FUN_L01_0026d930(void *); extern void FUN_L00_00258b50(void *, void *, void *, void *, float); -extern float FUN_L00_0025be00(float *, float *, float, float, float, float); -extern int FUN_L00_0025c698(void *, void *); +extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int FUN_L00_00261b48(int, void *, void *, void *); -extern void FUN_L00_00259bc8(void *, void *, int, void *, void *, float); +extern void spawn_nearby_effect(void *, void *, int, void *, void *, float) __asm__("FUN_L00_00259bc8"); extern int FUN_L00_002dc9f0(void *, void *); extern int FUN_L00_00257470(void *, int, int); extern int FUN_00214cc8(float, void *); @@ -1645,14 +1649,14 @@ extern int FUN_00213260(int); extern float FUN_00213308(void); extern float random_float_between(float, float) __asm__("FUN_002132a8"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_001fa580(float, float); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float FUN_001f99c0(float); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern int FUN_001fa6d0(float); extern float compute_interpolated_record_value(void *) __asm__("FUN_0020c9e0"); extern void FUN_0020c828(void *); @@ -1665,7 +1669,8 @@ extern char D_L01_00161A40 __attribute__((sda)); extern char D_L01_00161A50 __attribute__((sda)); extern float D_L01_001619AC __attribute__((sda)); -void FUN_L01_002edca0(unsigned char *moby) { +void large_amoeboid_update(unsigned char *moby) __asm__("FUN_L01_002edca0"); +void large_amoeboid_update(unsigned char *moby) { char *data = *(char **)(moby + 0x78); char *target; char *target_position; @@ -1747,13 +1752,13 @@ void FUN_L01_002edca0(unsigned char *moby) { case 1: if (*(int *)(data + 0x204) != 2) { if (FUN_00213260(4) == 0) { - path_hit = FUN_L01_00276fe8((int *)(data + 0x240), 1, *(int *)(data + 0x244), + path_hit = follow_path((int *)(data + 0x240), 1, *(int *)(data + 0x244), *(float *)(data + 0x250) * 0.8f, moby + 0x10, target + 0x10, move); if (path_hit != 0) { moby[0x20] = 4; if (moby[0x53] != 1) - blend_moby_animation(moby, 1, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 1, 0, scale_game_frames(10)); clear_u64_value(data + 0x40); *(float *)(data + 0x234) = random_float_between(-0.34906584f, 0.34906584f); } else { @@ -1775,22 +1780,22 @@ void FUN_L01_002edca0(unsigned char *moby) { case 2: angle = fast_arc_tan(*(float *)(data + 0x210) - *(float *)(moby + 0x10), *(float *)(data + 0x214) - *(float *)(moby + 0x14)); - FUN_L00_0025be00((float *)(moby + 0x48), (float *)(data + 0x220), angle, + approach_angle((float *)(moby + 0x48), (float *)(data + 0x220), angle, D_0015ED70 * 1.0471976f, D_0015ED70 * 1.0471976f, frame_time_gp * 3.1415927f); - move[0] = FUN_001f9dc8(*(float *)(moby + 0x48)); - move[1] = FUN_001f9de0(*(float *)(moby + 0x48)); + move[0] = fast_cos(*(float *)(moby + 0x48)); + move[1] = fast_sin(*(float *)(moby + 0x48)); move[2] = 0.0f; FUN_L00_00258b50(moby, data + 0x170, move, data + 0x40, 1.0f); result = *(int *)(data + 0x204); if (result != 2 && FUN_00213260(4) == 0) { - path_hit = FUN_L01_00276fe8((int *)(data + 0x240), 1, *(int *)(data + 0x244), + path_hit = follow_path((int *)(data + 0x240), 1, *(int *)(data + 0x244), *(float *)(data + 0x250) * 0.8f, moby + 0x10, target + 0x10, hit); if (path_hit != 0) { moby[0x20] = 3; if (moby[0x53] != 0) - blend_moby_animation(moby, 0, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 0, 0, scale_game_frames(10)); clear_u64_value(data + 0x40); angle = random_float_between(-0.34906584f, 0.34906584f); distance = *(float *)(data + 0x23c) * frame_time_gp; @@ -1811,11 +1816,11 @@ void FUN_L01_002edca0(unsigned char *moby) { blocked = 0; angle = fast_arc_tan(*(float *)(target + 0x10) - *(float *)(moby + 0x10), *(float *)(target + 0x14) - *(float *)(moby + 0x14)); - FUN_L00_0025be00((float *)(moby + 0x48), (float *)(data + 0x220), angle, + approach_angle((float *)(moby + 0x48), (float *)(data + 0x220), angle, D_0015ED70 * 1.0471976f, D_0015ED70 * 1.0471976f, frame_time_gp * 3.1415927f); - move[0] = FUN_001f9dc8(*(float *)(moby + 0x48)); - move[1] = FUN_001f9de0(*(float *)(moby + 0x48)); + move[0] = fast_cos(*(float *)(moby + 0x48)); + move[1] = fast_sin(*(float *)(moby + 0x48)); move[2] = 0.0f; FUN_L00_00258b50(moby, data + 0x170, move, data + 0x40, 1.0f); if (FUN_L00_00261b48(*(int *)(data + 0x240), moby + 0x10, target + 0x10, hit) != 0 && @@ -1825,11 +1830,11 @@ void FUN_L01_002edca0(unsigned char *moby) { } else if (blocked) { moby[0x20] = 16; if (moby[0x53] != 0) - blend_moby_animation(moby, 0, 0, FUN_001f96f8(10)); - } else if (FUN_001f9b80(moby + 0x10, target + 0x10) < 2.0f) { + blend_moby_animation(moby, 0, 0, scale_game_frames(10)); + } else if (vector_distance(moby + 0x10, target + 0x10) < 2.0f) { moby[0x20] = 6; if (moby[0x53] != 2) - blend_moby_animation(moby, 2, 5, FUN_001f96f8(10)); + blend_moby_animation(moby, 2, 5, scale_game_frames(10)); return; } break; @@ -1837,35 +1842,35 @@ void FUN_L01_002edca0(unsigned char *moby) { if (!(moby[0x70] & 2) || *(int *)(data + 0x22c) != 0) return; moby[0x20] = 5; if (moby[0x53] != 1) - blend_moby_animation(moby, 1, 0, FUN_001f96f8(20)); + blend_moby_animation(moby, 1, 0, scale_game_frames(20)); return; case 4: { char *target_position; unsigned char path_hit; target_position = target + 0x10; - distance = FUN_001f9b80(moby + 0x10, target_position); + distance = vector_distance(moby + 0x10, target_position); if (distance < D_L01_001619AC) { moby[0x20] = 6; *(float *)(data + 0x194) = (*(float *)(data + 0x23c) + *(float *)(data + 0x23c)) * frame_time_gp; if (moby[0x53] != 2) - blend_moby_animation(moby, 2, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 2, 0, scale_game_frames(10)); return; } else { - if (FUN_L01_00276fe8((int *)(data + 0x240), 1, *(int *)(data + 0x244), + if (follow_path((int *)(data + 0x240), 1, *(int *)(data + 0x244), *(float *)(data + 0x250) * 0.8f, moby + 0x10, target_position, hit) != 0) path_hit = 1; else - path_hit = FUN_L01_00276fe8((int *)(data + 0x240), 1, *(int *)(data + 0x244), + path_hit = follow_path((int *)(data + 0x240), 1, *(int *)(data + 0x244), 0.0f, moby + 0x10, target_position, hit) != 0; if (path_hit != 0) { angle = fast_arc_tan(hit[0] - *(float *)(moby + 0x10), hit[1] - *(float *)(moby + 0x14)); - angle = FUN_001fa580(angle, *(float *)(data + 0x234)); - FUN_L00_0025be00((float *)(moby + 0x48), (float *)(data + 0x220), angle, + angle = fast_add_rotations(angle, *(float *)(data + 0x234)); + approach_angle((float *)(moby + 0x48), (float *)(data + 0x220), angle, D_0015ED70 * 12.566371f, D_0015ED70 * 12.566371f, frame_time_gp * 25.132742f); - move[0] = FUN_001f9dc8(*(float *)(moby + 0x48)); + move[0] = fast_cos(*(float *)(moby + 0x48)); move[0] += move[0]; - move[1] = FUN_001f9de0(*(float *)(moby + 0x48)); + move[1] = fast_sin(*(float *)(moby + 0x48)); move[1] += move[1]; move[2] = 0.0f; FUN_L00_00258b50(moby, data + 0x170, move, data + 0x40, 1.0f); @@ -1882,34 +1887,34 @@ void FUN_L01_002edca0(unsigned char *moby) { float *rotation = (float *)(moby + 0x48); angle = fast_arc_tan(*(float *)(target + 0x10) - *(float *)(moby + 0x10), *(float *)(target + 0x14) - *(float *)(moby + 0x14)); - FUN_L00_0025be00(rotation, (float *)(data + 0x220), angle, + approach_angle(rotation, (float *)(data + 0x220), angle, D_0015ED70 * 12.566371f, D_0015ED70 * 12.566371f, frame_time_gp * 25.132742f); distance = compute_interpolated_record_value(moby); if (moby[0x52] == moby[0x53] && 10.0f <= distance && distance <= 16.0f) { - move[0] = FUN_001f9dc8(*rotation); + move[0] = fast_cos(*rotation); move[0] += move[0]; - move[1] = FUN_001f9de0(*rotation); + move[1] = fast_sin(*rotation); move[1] += move[1]; move[2] = 0.0f; FUN_L00_00258b50(moby, data + 0x170, move, data + 0x40, 1.0f); } - if (FUN_00214cc8(15.5f, moby) != 0 && FUN_001f9b80(moby + 0x10, (target_position = target + 0x10)) < 2.0f && + if (FUN_00214cc8(15.5f, moby) != 0 && vector_distance(moby + 0x10, (target_position = target + 0x10)) < 2.0f && FUN_001f99c0(*(float *)(target + 0x18) - *(float *)(moby + 0x18)) < *(float *)(data + 0x250) + *(float *)(data + 0x250)) { - move[0] = FUN_001f9dc8(*(float *)(moby + 0x48)); - move[1] = FUN_001f9de0(*(float *)(moby + 0x48)); + move[0] = fast_cos(*(float *)(moby + 0x48)); + move[1] = fast_sin(*(float *)(moby + 0x48)); move[2] = 0.0f; move[3] = 5627.9248f; qcopy(hit, target_position); hit[2] += 0.75f; - FUN_L00_00259bc8(target, moby, 0x10001, hit, move, 1.0f); + spawn_nearby_effect(target, moby, 0x10001, hit, move, 1.0f); return; } if (moby[0x70] & 2) { moby[0x20] = 7; if (moby[0x53] != 3) - blend_moby_animation(moby, 3, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 3, 0, scale_game_frames(10)); *(float *)(data + 0x194) = *(float *)(data + 0x23c) * frame_time_gp; } break; @@ -1919,44 +1924,44 @@ void FUN_L01_002edca0(unsigned char *moby) { if (!(moby[0x70] & 2)) return; moby[0x20] = 4; if (moby[0x53] != 1) - blend_moby_animation(moby, 1, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 1, 0, scale_game_frames(10)); return; case 5: { int blocked = 0; char *target_position; - distance = FUN_001f9b80(moby + 0x10, (target_position = data + 0x210)); + distance = vector_distance(moby + 0x10, (target_position = data + 0x210)); if (distance < 1.0f) { moby[0x20] = 1; } else { - if (FUN_L01_00276fe8((int *)(data + 0x240), 1, *(int *)(data + 0x244), + if (follow_path((int *)(data + 0x240), 1, *(int *)(data + 0x244), *(float *)(data + 0x250) * 0.8f, moby + 0x10, target_position, hit) != 0) blocked = 1; else - blocked = FUN_L01_00276fe8((int *)(data + 0x240), 1, *(int *)(data + 0x244), + blocked = follow_path((int *)(data + 0x240), 1, *(int *)(data + 0x244), 0.0f, target_position, target_position, hit) != 0; } if (blocked != 0) { angle = fast_arc_tan(hit[0] - *(float *)(moby + 0x10), hit[1] - *(float *)(moby + 0x14)); - angle = FUN_001fa580(angle, *(float *)(data + 0x234)); - FUN_L00_0025be00((float *)(moby + 0x48), (float *)(data + 0x220), angle, + angle = fast_add_rotations(angle, *(float *)(data + 0x234)); + approach_angle((float *)(moby + 0x48), (float *)(data + 0x220), angle, D_0015ED70 * 12.566371f, D_0015ED70 * 12.566371f, frame_time_gp * 25.132742f); - move[0] = FUN_001f9dc8(*(float *)(moby + 0x48)); + move[0] = fast_cos(*(float *)(moby + 0x48)); move[0] += move[0]; - move[1] = FUN_001f9de0(*(float *)(moby + 0x48)); + move[1] = fast_sin(*(float *)(moby + 0x48)); move[1] += move[1]; move[2] = 0.0f; FUN_L00_00258b50(moby, data + 0x170, move, data + 0x40, 1.0f); } if (*(int *)(data + 0x204) != 2 && (moby[0x20] = 4, moby[0x53] != 1)) - blend_moby_animation(moby, 1, 0, FUN_001f96f8(3)); + blend_moby_animation(moby, 1, 0, scale_game_frames(3)); FUN_L01_002ef560(moby); return; } case 8: - result = FUN_L00_0025c698(moby, data + 0x60); + result = mine_fall(moby, data + 0x60); if (result & 1) { - path_hit = FUN_L01_00276fe8((int *)(data + 0x240), 1, *(int *)(data + 0x244), + path_hit = follow_path((int *)(data + 0x240), 1, *(int *)(data + 0x244), *(float *)(data + 0x250) * 0.8f, moby + 0x10, data + 0x210, move); if (path_hit != 0) { @@ -1964,7 +1969,7 @@ void FUN_L01_002edca0(unsigned char *moby) { *(float *)(data + 0x194) = *(float *)(data + 0x23c) * frame_time_gp; moby[0x20] = 9; if (moby[0x53] != 5) - blend_moby_animation(moby, 5, 4, FUN_001f96f8(10)); + blend_moby_animation(moby, 5, 4, scale_game_frames(10)); qcopy(data + 0x210, moby + 0x10); return; } @@ -1979,7 +1984,7 @@ void FUN_L01_002edca0(unsigned char *moby) { if (moby[0x70] & 2) { moby[0x20] = 4; if (moby[0x53] != 1) - blend_moby_animation(moby, 1, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 1, 0, scale_game_frames(10)); clear_u64_value(data + 0x40); angle = random_float_between(-0.34906584f, 0.34906584f); distance = *(float *)(data + 0x23c) * frame_time_gp; @@ -2040,8 +2045,8 @@ extern int fun_00213928(void *, void *, void *, int, int *, float *, int, int); extern s32 truncate_float_to_s32_c(f32) __asm__("func_001FA6D0"); extern short D_L01_00161998 __attribute__((sda)); extern short D_L01_0016199C __attribute__((sda)); -extern void FUN_L00_0025ab48(void *, float *, void *, void *); -extern void FUN_L00_0025c558(void *, void *, float, int, int, int); +extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(void *, void *, float, int, int, int) __asm__("FUN_L00_0025c558"); extern int allocate_voice_for_target_entry(int, int, void *) __asm__("func_0022DA68"); extern void clear_u64_value_c(void *) __asm__("func_001F99F8"); extern void mark_moby_for_removal_c(void *) __asm__("func_0020C828"); @@ -2147,9 +2152,9 @@ void FUN_L01_002eec68(char *m) { *(float *)(q + 0xB0) = seven; *(float *)(q + 0xB4) = 13.0f; v.q = *(u128_2F0040 *)(t + 0x10); - FUN_L00_0025ab48(&v, &a1, q + 0x78, q + 0x7C); + trooper_knockback_arc(&v, &a1, q + 0x78, q + 0x7C); a1 = fast_subtract_rotations(a1, 0.7853982f); - FUN_L00_0025c558(spawned, q + 0x60, a1, 4, 8, 0); + trooper_start_knockback(spawned, q + 0x60, a1, 4, 8, 0); spawned[0x20] = 8; *(float *)(spawned + 0x58) = f24; } @@ -2169,9 +2174,9 @@ void FUN_L01_002eec68(char *m) { *(float *)(q + 0xB0) = seven; *(float *)(q + 0xB4) = 13.0f; v.q = *(u128_2F0040 *)(t + 0x10); - FUN_L00_0025ab48(&v, &a2, q + 0x78, q + 0x7C); + trooper_knockback_arc(&v, &a2, q + 0x78, q + 0x7C); a2 = fast_add_rotations_c(a2, 0.7853982f); - FUN_L00_0025c558(spawned, q + 0x60, a2, 4, 8, 0); + trooper_start_knockback(spawned, q + 0x60, a2, 4, 8, 0); spawned[0x20] = 8; *(float *)(spawned + 0x58) = f24; } @@ -2544,7 +2549,8 @@ extern int FUN_001f96f8_w7(int) __asm__("FUN_001f96f8"); extern void blend_moby_animation_w7(void *m, int a, int b, int c) __asm__("FUN_00212f90"); extern float D_0015ED70_lui __asm__("D_0015ED70"); -void FUN_L01_002f2b68(unsigned char *m) { +void sandmouse_house_update(unsigned char *m) __asm__("FUN_L01_002f2b68"); +void sandmouse_house_update(unsigned char *m) { char *d; if (m == 0) return; @@ -2820,7 +2826,8 @@ extern void (*D_L01_00160770)(char *); #define B2(p, o) (*(unsigned char *)((p) + (o))) #define Q2(p, o) (*(OvlQuad *)((p) + (o))) -void FUN_L01_002f5168(char *moby) { +void gunship_follow_path(char *moby) __asm__("FUN_L01_002f5168"); +void gunship_follow_path(char *moby) { char *data; char *path; char *child; @@ -3092,7 +3099,7 @@ void FUN_L01_002f5168(char *moby) { FUN_00273310_2f5168(moby, work, point, 0.0f, 0.0f, 0x14, 3, 4, 4.0f, 2.0f, 100000.0f, 3.0f, (H2(moby, 0xa6) == 0x532 || H2(moby, 0xa6) == 0x53b || H2(moby, 0xa6) == 0x53c) ? 1 : -1, 15.0f, 1, 1, -1, 0); } } - D_L01_00160770 = FUN_L01_002f5168; + D_L01_00160770 = gunship_follow_path; B2(moby, 0xa4) = 0xff; if (H2(data, 0x13a) == 0) return; hit = FUN_00220ea8_2f5168(data + 0x13a); diff --git a/src/overlays/shared/gameplay/entities/ocean_pokitaru.c b/src/overlays/shared/gameplay/entities/ocean_pokitaru.c index 3e96fe6720..44f7ba23e7 100644 --- a/src/overlays/shared/gameplay/entities/ocean_pokitaru.c +++ b/src/overlays/shared/gameplay/entities/ocean_pokitaru.c @@ -89,7 +89,7 @@ extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); -extern void FUN_L00_002502f0(void *, int, int, int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); extern void FUN_L00_00250df8(void *); extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); @@ -120,7 +120,7 @@ unsigned char *FUN_L11_00308848(char *owner, float *dir, float *pos, float a, fl *(float *)(*(char **)(m + 0x24) + 0x24) * (*(float *)(owner + 0x2C) / *(float *)(*(char **)(owner + 0x24) + 0x24)); m[0x23] = func_001FA898_r(*(float *)(d + 0x10) * 24.0f); - FUN_L00_002502f0(m, 0xFF, 0xFF, 0xFF); + set_moby_color(m, 0xFF, 0xFF, 0xFF); FUN_L00_00250df8(m); } return m; @@ -164,13 +164,13 @@ extern void build_spherical_offset_089d0(void *, float, float, float) __asm__("F extern void no_op_089d0(void *, void *) __asm__("FUN_001e93e8"); extern void add_vector_089d0(void *, void *, void *) __asm__("FUN_001f9a10"); extern void normalize_vector_089d0(void *, void *, float) __asm__("FUN_001f9bf8"); -extern void make_hit_089d0(float, void *, struct Moby *, int) __asm__("FUN_L00_00259858"); +extern void FUN_L00_00259858(float, void *, struct Moby *, int); extern int collision_line_089d0(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); extern float random_float_between_089d0(float, float) __asm__("FUN_002132a8"); extern void reflect_089d0(void *, void *, void *) __asm__("FUN_L00_001ff660"); extern int scale_game_frames_089d0(int) __asm__("FUN_001f96f8"); extern int random_int_between_089d0(int, int) __asm__("FUN_L00_00257b90"); -extern char *spawn_spark_089d0(void *, void *, int, int, float) __asm__("FUN_L00_0026dd20"); +extern char *FUN_L00_0026dd20_c(void *, void *, int, int, float) __asm__("FUN_L00_0026dd20"); extern void remove_moby_089d0(void *) __asm__("FUN_0020c828"); extern int tick_countdown_089d0(int *) __asm__("FUN_001f9740"); char *FUN_L11_00308670(float *pos, float *aim, float r1, float r2, float maxd); @@ -237,7 +237,7 @@ void FUN_L11_003089d0(struct Moby *moby) { remove_moby_089d0(moby); return; } - make_hit_089d0(1.0f, &hit, moby, 0x10000); + FUN_L00_00259858(1.0f, &hit, moby, 0x10000); hit.oclass = moby->oclass; if (collision_line_089d0(old, &moby->pos, 0, vars->owner, &hit)) { for (i = 0; i < 5; i++) { @@ -250,7 +250,7 @@ void FUN_L11_003089d0(struct Moby *moby) { normalize_vector_089d0(q, q, vector_length_089d0(r) * 0.5f); add_vector_089d0(q, r, q); normalize_vector_089d0(q, q, random_float_between_089d0(frame_time * 5.0f, frame_time * 9.0f)); - spawn_spark_089d0(&moby->pos, q, 0x7F2F4F6F, random_int_between_089d0(scale_game_frames_089d0(10), scale_game_frames_089d0(15)), 90000.0f); + FUN_L00_0026dd20_c(&moby->pos, q, 0x7F2F4F6F, random_int_between_089d0(scale_game_frames_089d0(10), scale_game_frames_089d0(15)), 90000.0f); } remove_moby_089d0(moby); return; @@ -306,7 +306,7 @@ extern int D_L11_00161DC4 __attribute__((sda)); extern int D_L11_00161DC8 __attribute__((sda)); extern int D_L11_00161DCC __attribute__((sda)); extern float D_L11_00161DD0 __attribute__((sda)); -extern int FUN_001efa68(void *, void *, int, void *, void *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int tick_countdown_32_alt(int *) __asm__("FUN_001f9740"); @@ -343,7 +343,7 @@ void FUN_L11_00309098(char *moby) { FUN_L00_0026dd20((char *)p, (char *)v, c, scale_game_frames(D_L11_00161DC8), (float)D_L11_00161DCC); add_vector_xyz(pos, pos, data); make_hit_descriptor(hit, moby, 0x10000, *(float *)(data + 0x20), data); - if (FUN_001efa68(old, pos, 0, *(void **)(data + 0x1C), hit)) { + if (collision_line(old, pos, 0, *(void **)(data + 0x1C), hit)) { int i; for (i = 0; i < 5; i++) { *(OvlQuad *)r = 0; @@ -398,7 +398,8 @@ extern char D_L11_00174860[]; /* Homing missile: turns toward its target while the target lives and stays within 3 units of where it was last frame, leaves a smoke trail, and bursts on a hit, when its timer runs out or outside the level box. */ -void FUN_L11_003094f8(struct Moby *moby) { +void rocket_update(struct Moby *moby) __asm__("FUN_L11_003094f8"); +void rocket_update(struct Moby *moby) { Missile_94f8 *data = (Missile_94f8 *)moby->pvars; Vec4f *pos; Vec4 previous_pos, spray, offset, velocity, random; @@ -459,7 +460,7 @@ void FUN_L11_003094f8(struct Moby *moby) { return; } moby_point_position_94f8(moby, 1, &spray); - if (FUN_001efa68(&previous_pos, &spray, 0, data->collision, 0)) { + if (collision_line(&previous_pos, &spray, 0, data->collision, 0)) { FUN_L00_0025e450_94f8(moby, data, D_L11_00174860, 2.0f, 10.0f, 10, 3, 0x10, 4.0f, 2.0f, 9.0f, 1.0f, -1, 20.0f, 0, 1, -1, 0); mark_moby_for_removal(moby); @@ -736,7 +737,8 @@ extern float ocean_level __asm__("D_L11_00161E1C"); extern UV_30b358 wave_drift[] __asm__("D_L11_001D9AF0"); extern float frame_delta_time __asm__("D_0015ED7C"); -void FUN_L11_0030b358(OceanMoby_30b358 *moby) +void ocean_pokitaru_update(OceanMoby_30b358 *moby) __asm__("FUN_L11_0030b358"); +void ocean_pokitaru_update(OceanMoby_30b358 *moby) { OceanVars_30b358 *d = moby->vars; float src[4]; @@ -803,3 +805,16 @@ void FUN_L11_0030b358(OceanMoby_30b358 *moby) } enqueue_callback_b358((void *)FUN_L11_0030a908_b358, moby); } + +f32 D_L16_001D8A28[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_001D8A2C[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_001D8A30[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_001D8A34[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_001D8A38[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_001D8A3C[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001D8D28[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001D8D2C[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001D9230[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001D9234[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001D9238[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001D923C[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/plasmabot.c b/src/overlays/shared/gameplay/entities/plasmabot.c index 7677c43dbb..8064a5e53c 100644 --- a/src/overlays/shared/gameplay/entities/plasmabot.c +++ b/src/overlays/shared/gameplay/entities/plasmabot.c @@ -13,7 +13,7 @@ /* Ported from rac1-decomp (src/overlays/shared/vendor_002B2A28.c: func_L14_002B44B8), where it is exact; names translated to the US level program. */ extern char D_0013E533[]; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern int *D_L14_001B0BB0[]; extern int FUN_L00_0025ff38(char *, char *, float, int, int, int *, int); @@ -21,7 +21,7 @@ void FUN_L14_002b3268(char *moby) { char *data = *(char **)(moby + 0x78); int *tbl = D_L14_001B0BB0[*(int *)(data + 0x244)]; if (FUN_L00_0025ff38(moby, data + 0xD0, *(float *)(data + 0x234), 0, 0, tbl + 4, *tbl) != 2) { - if (*(float *)(data + 0x234) < FUN_001f9b80(moby + 0x10, data + 0xD0)) { + if (*(float *)(data + 0x234) < vector_distance(moby + 0x10, data + 0xD0)) { *(int *)(data + 0x114) = 2; } } @@ -91,7 +91,7 @@ void FUN_L14_002b3578(char *moby) { extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); -extern float FUN_L00_0025be00(float *, float *, float, float, float, float); +extern float approach_angle(float *, float *, float, float, float, float) __asm__("FUN_L00_0025be00"); extern void FUN_L00_001fff28(void *, int, float); void FUN_L14_002b37b0(char *a, float x) { @@ -105,7 +105,7 @@ void FUN_L14_002b37b0(char *a, float x) { s = -1.2217304706573486f; { float k = frame_time_sq * 12.566370964050293f; - FUN_L00_0025be00((float *)(d + 0x270), (float *)(d + 0x274), s, k, k, + approach_angle((float *)(d + 0x270), (float *)(d + 0x274), s, k, k, frame_time * 6.2831854820251465f); } FUN_L00_001fff28(d + 0x130, 2, *(float *)(d + 0x270)); @@ -113,7 +113,7 @@ void FUN_L14_002b37b0(char *a, float x) { /* Ported from rac1-decomp (src/overlays/shared/vendor_002B2A28.c: func_L14_002B4AE0), where it is exact; names translated to the US level program. */ extern char *D_L14_ffd0_e_macro[] __asm__("D_L14_0015FFD0") __attribute__((section(".sdata"))); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern short *D_L14_001ABF40[]; extern int D_L14_001614E0; @@ -126,7 +126,7 @@ void FUN_L14_002b3890(int idx) { char *moby = D_L14_ffd0_e_macro[2] + ((*(unsigned short *)p & 0x7FFF) << 8); char *data = *(char **)(moby + 0x78); if (*(short *)(moby + 0xA6) == 0x1C) { - *(short *)(data + 0x260) = FUN_001f96f8(D_L14_001614E0); + *(short *)(data + 0x260) = scale_game_frames(D_L14_001614E0); } } while (*p++ >= 0); } @@ -165,7 +165,7 @@ void FUN_L14_002fe900(char *moby) { /* rebuilds two vectors from the moby's transform and applies them to its linked object */ /* Ported from rac1-decomp (src/overlays/shared/vendor_002B2A28.c: func_L14_003000B0), where it is exact; names translated to the US level program. */ -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern float D_L14_00161FC4 __attribute__((sda)); @@ -176,10 +176,10 @@ void FUN_L14_002fec28(char *moby) { if (*(char **)(data + 0xF4) != 0) { char *p; fast_vec_normalize(tmp, moby + 0xC0, D_L14_00161FC4); - FUN_001f9a10(*(char **)(data + 0xF4) + 0x10, moby + 0x10, tmp); + fast_vec_add(*(char **)(data + 0xF4) + 0x10, moby + 0x10, tmp); fast_vec_normalize(tmp, moby + 0xE0, D_L14_00161FC8); p = *(char **)(data + 0xF4) + 0x10; - FUN_001f9a10(p, p, tmp); + fast_vec_add(p, p, tmp); } } /* Spawns moby class 0x3A5 at the given position, owned by owner, with three randomised angle values. */ @@ -242,13 +242,13 @@ extern f32 fast_arc_tan_c(f32, f32) __asm__("func_001F9E90"); extern f32 fast_cos(f32) __asm__("func_001F9DC8"); extern f32 fast_sin(f32) __asm__("func_001F9DE0"); extern f32 fast_subtract_rotations_c2(f32, f32) __asm__("func_001FA5C8"); -extern float FUN_L00_0025b8c0(float *p, float *v, float t, float u1, float u2, float eps); +extern float vendor_spring(float *p, float *v, float t, float u1, float u2, float eps) __asm__("FUN_L00_0025b8c0"); extern float fast_difference_between_rotations(float, float) __asm__("func_001FA688"); extern float probe_ground_height(float, void *, int); extern int D_L14_0015F5C4; extern int coll_line_fix(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); -extern int FUN_001f9770(void *); -extern int FUN_L00_0025c698(void *, void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int FUN_L00_00261968(int, void *, void *); extern int FUN_L00_002e1f28(void *, int, int); extern int FUN_L00_002e2040(char *); @@ -294,10 +294,11 @@ void FUN_L14_002b3890_c(int idx) __asm__("FUN_L14_002b3890"); void attach_manipulator(void *owner, s32 slot_index, void *manip) __asm__("FUN_0020cb10"); #define call_4BF0(m) FUN_L14_002b39a0_c((unsigned char *)(m)) -#define call_CE58 ((float (*)(float *, float, float *, float, float, float))FUN_L00_0025be00) +#define call_CE58 ((float (*)(float *, float, float *, float, float, float))approach_angle) #define call_F4A8 ((void (*)(char *, void *, void *, float, float, int, int, int, float, float, float, float, int, float, int, int, int, int))FUN_L00_0025e450_c) #define call_D678 ((void (*)(char *))mark_moby_for_removal_c) +void FUN_L14_002b17d8(char *moby); void FUN_L14_002b17d8(char *moby) { char *data; char *owner; @@ -414,7 +415,7 @@ void FUN_L14_002b17d8(char *moby) { case 1: { float *path; if (*(int *)(data + 0x114) == 2) return; - if (FUN_001f9770(data + 0x248) == 0) return; + if (fast_dec_timer_s16(data + 0x248) == 0) return; if (FUN_L14_002d9870_c(*(int *)(data + 0x264)) == 0) return; if (call_4BF0(moby) == 0) return; *(short *)(data + 0x248) = scale_game_frames(D_L14_001614F0); @@ -447,8 +448,8 @@ void FUN_L14_002b17d8(char *moby) { break; case 9: { float *path = (float *)D_L14_001B0BB0[*(int *)(data + 0x240)]; - FUN_L00_0025b8c0((float *)(moby + 0x10), (float *)(data + 0x254), path[4], 0.01f, 0.2f, 0.0f); - FUN_L00_0025b8c0((float *)(moby + 0x14), (float *)(data + 0x258), path[5], 0.01f, 0.2f, 0.0f); + vendor_spring((float *)(moby + 0x10), (float *)(data + 0x254), path[4], 0.01f, 0.2f, 0.0f); + vendor_spring((float *)(moby + 0x14), (float *)(data + 0x258), path[5], 0.01f, 0.2f, 0.0f); if ((moby[0x70] & 2) && ((unsigned char *)moby)[0x52] == ((unsigned char *)moby)[0x53]) { blend_moby_animation(moby, 0, 0, scale_game_frames(10)); ((unsigned char *)moby)[0x20] = 1; @@ -466,7 +467,7 @@ void FUN_L14_002b17d8(char *moby) { k = frame_time_sq * 12.566371f; call_CE58((float *)(moby + 0x48), ang, (float *)(data + 0x23C), k, k, frame_time * 6.2831855f); if (*(int *)(data + 0x114) == 2) break; - if (FUN_001f9770(data + 0x248) == 0) break; + if (fast_dec_timer_s16(data + 0x248) == 0) break; ((unsigned char *)moby)[0x20] = 3; blend_moby_animation(moby, 3, 0, scale_game_frames(10)); *(float *)(moby + 0x58) = 1.0f; @@ -527,7 +528,7 @@ void FUN_L14_002b17d8(char *moby) { FUN_L00_002e2040(moby); break; } - if (FUN_001f9770(data + 0x260) == 0) break; + if (fast_dec_timer_s16(data + 0x260) == 0) break; if (FUN_L14_002b3920_c(((unsigned char *)moby)[0x21]) >= 2) break; if (FUN_L00_002e1f28(moby, 1, 0) == 0) break; if (random_integer_below(4) != 0) break; @@ -597,7 +598,7 @@ void FUN_L14_002b17d8(char *moby) { qcopy(end, D_L14_00174560); } FUN_L00_002e2190(moby, mat, end); - if (FUN_001f9770(data + 0x262) != 0) { + if (fast_dec_timer_s16(data + 0x262) != 0) { blend_moby_animation(moby, 6, 0, scale_game_frames(10)); ((unsigned char *)moby)[0x20] = 7; FUN_L00_002e2040(moby); @@ -625,7 +626,7 @@ void FUN_L14_002b17d8(char *moby) { break; } case 11: { - if ((FUN_L00_0025c698(moby, data + 0x60) & 0x160) == 0) return; + if ((mine_fall(moby, data + 0x60) & 0x160) == 0) return; FUN_L00_002e2040(moby); FUN_L00_0024f7c8(moby, 2, mat); FUN_L14_002dea98_c(moby, (char *)mat); @@ -698,10 +699,10 @@ extern void FUN_00213358(void *, f32, f32); extern Particle *FUN_L00_00274948(void *, void *, s32, struct Moby *); extern f32 FUN_002132a8(f32, f32); extern s32 FUN_00213260(s32); -extern s32 FUN_001f96f8(s32); -extern f32 FUN_001fa6c0(s32); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); +extern f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern void fast_vec_normalize(void *, void *, f32) __asm__("FUN_001f9bf8"); @@ -724,9 +725,9 @@ void FUN_L14_002b2600(struct Moby *m) pv = (ShipVars *)m->pvars; enqueue_callback_list_1(FUN_L14_002b3a20_c, m); moby_point_position(m, 1, &pos); - FUN_001f9a28(&dir, &pos, &D_L14_001674C0); + fast_vec_sub(&dir, &pos, &D_L14_001674C0); fast_vec_normalize(&dir, &dir, -0.5f); - FUN_001f9a10(&pv->exhaust, &pos, &dir); + fast_vec_add(&pv->exhaust, &pos, &dir); FUN_00213358(&vel, 0.005f, 0.03f); p = FUN_L00_00274948(&pos, &vel, 0x7F, m); if (p != NULL) { @@ -743,8 +744,8 @@ void FUN_L14_002b2600(struct Moby *m) } else { p->life = FUN_002132a8(80000.0f, 120000.0f); } - p->frames = FUN_001f96f8(2); - f = 1.0f / FUN_001fa6c0(p->frames); + p->frames = scale_game_frames(2); + f = 1.0f / convert_integer_to_float(p->frames); fade->mode = 3; fade->color = 0x7F7F7F; fade->scale = f; @@ -752,16 +753,16 @@ void FUN_L14_002b2600(struct Moby *m) moby_point_position(m, 6, &pv->joint6); build_moby_bone_transform(m, 7, mat); fast_vec_scale(&dx, &mat[0], D_L14_001614A8); - FUN_001f9a10(&pv->nozzle, &mat[3], &dx); + fast_vec_add(&pv->nozzle, &mat[3], &dx); build_moby_bone_transform(m, 2, mat); fast_vec_scale(&dx, &mat[0], D_L14_001614B0); fast_vec_scale(&dy, &mat[1], D_L14_001614B4); fast_vec_scale(&dz, &mat[2], D_L14_001614B8); - FUN_001f9a10(&pv->beam_start, &mat[3], &dx); - FUN_001f9a10(&pv->beam_start, &pv->beam_start, &dy); - FUN_001f9a10(&pv->beam_start, &pv->beam_start, &dz); + fast_vec_add(&pv->beam_start, &mat[3], &dx); + fast_vec_add(&pv->beam_start, &pv->beam_start, &dy); + fast_vec_add(&pv->beam_start, &pv->beam_start, &dz); fast_vec_scale(&dy, &dy, -2.0f); - FUN_001f9a10(&pv->beam_end, &pv->beam_start, &dy); + fast_vec_add(&pv->beam_end, &pv->beam_start, &dy); enqueue_callback_list_1(FUN_L14_002b2928_u, m); } /* Ported from rac1-decomp (src/overlays/shared/vendor_002B2A28.c: func_L14_002B3B78), where it is exact; names translated to the US level program. */ @@ -959,8 +960,8 @@ extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); extern float D_L14_001614C8 __attribute__((sda)); extern void FUN_L00_00257470(void *, int, int); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern char D_0013E533[]; extern void func_L00_0025D5B0_i(void *, void *, float, int, int, int) __asm__("FUN_L00_0025c558"); @@ -973,7 +974,7 @@ void FUN_L14_002b2f60(char *moby) { if (((unsigned char *)moby)[0x20] == 0 || ((unsigned char *)moby)[0x20] == 0xB) { if (((unsigned char *)moby)[0x20] == 0xB) { ((unsigned char *)moby)[0xA4] = 0xFF; - FUN_L00_0025d538(moby, state + 0xC0); + trooper_anim_finish(moby, state + 0xC0); } return; } @@ -1040,16 +1041,16 @@ void FUN_L14_002b2f60(char *moby) { case 0: case 11: break; } - FUN_L00_0025d458(moby, (short *)(state + 0xC0)); + trooper_anim_update(moby, (short *)(state + 0xC0)); } ((unsigned char *)moby)[0xA4] = 0xFF; - FUN_L00_0025d538(moby, state + 0xC0); + trooper_anim_finish(moby, state + 0xC0); } /* steers the moby toward its target: queries the path, eases x/y, then turns to face the heading */ /* Ported from rac1-decomp (src/overlays/shared/vendor_002B2A28.c: func_L14_002B4668), where it is exact; names translated to the US level program. */ -extern float FUN_L00_0025b8c0(float *p, float *v, float t, float u1, float u2, float eps); -extern int FUN_L00_0025d808(void *, void *, void *, void *, int, float) __asm__("FUN_L00_0025d808"); +extern float vendor_spring(float *p, float *v, float t, float u1, float u2, float eps) __asm__("FUN_L00_0025b8c0"); +extern int sample_path(void *, void *, void *, void *, int, float) __asm__("FUN_L00_0025d808"); extern void subtract_vector_xyz_c(void *, void *, void *) __asm__("FUN_001f9a28"); extern float func_L00_0025CE58_2B4668(float *p, float a, float *v, float b, float c, float d) __asm__("FUN_L00_0025be00"); @@ -1059,14 +1060,14 @@ int FUN_L14_002b3418(char *moby) { float b[4]; float c[4]; char *data = *(char **)(moby + 0x78); - int reached = FUN_L00_0025d808(D_L14_001B0BB0[*(int *)(data + 0x240)], a, data + 0x24C, data + 0x250, 0, + int reached = sample_path(D_L14_001B0BB0[*(int *)(data + 0x240)], a, data + 0x24C, data + 0x250, 0, D_L14_001614D8 * frame_time * *(float *)(data + 0x27C)); float ang; float k; float m; qcopy(b, moby + 0x10); - FUN_L00_0025b8c0((float *)(moby + 0x10), (float *)(data + 0x254), a[0], 0.01f, 0.2f, 0.0f); - FUN_L00_0025b8c0((float *)(moby + 0x14), (float *)(data + 0x258), a[1], 0.01f, 0.2f, 0.0f); + vendor_spring((float *)(moby + 0x10), (float *)(data + 0x254), a[0], 0.01f, 0.2f, 0.0f); + vendor_spring((float *)(moby + 0x14), (float *)(data + 0x258), a[1], 0.01f, 0.2f, 0.0f); subtract_vector_xyz_c(c, a, b); ang = fast_arc_tan(c[0], c[1]); k = frame_time_sq * 12.566371f; @@ -1236,9 +1237,10 @@ void FUN_L14_002b3a20(char *m) { extern u8 *D_L14_00167500 NOT_SDA; extern s32 FUN_001f96f8_c(s32) __asm__("FUN_001f96f8"); -extern s32 FUN_001f9740(void *); +extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); -void FUN_L14_002d96e0(struct Moby *moby) { +void plasmabot_hatch_update(struct Moby *moby) __asm__("FUN_L14_002d96e0"); +void plasmabot_hatch_update(struct Moby *moby) { char *data = (char *)moby->pvars; if (hero.vehicle_mode == 2) { moby->collision = 0; @@ -1253,7 +1255,7 @@ void FUN_L14_002d96e0(struct Moby *moby) { } break; case 1: - if (FUN_001f9740(data + 8) != 0) { + if (fast_dec_timer(data + 8) != 0) { moby->state = 2; set_moby_animation(moby, 1, 0); } @@ -1279,7 +1281,7 @@ void FUN_L14_002d96e0(struct Moby *moby) { } break; case 6: - if (FUN_001f9740(data + 8) != 0) { + if (fast_dec_timer(data + 8) != 0) { set_moby_animation(moby, 3, 0); moby->state = 7; } @@ -1324,7 +1326,7 @@ int FUN_L14_002d9870(int i) { } else { r = moby[0x20] == 6; } - data[2] = FUN_001f96f8(0x3C); + data[2] = scale_game_frames(0x3C); return r; } extern float D_0015ED60; @@ -1334,17 +1336,17 @@ extern float D_0015ED60; extern void *D_001413D0_de670 __asm__("D_001413D0") __attribute__((section(".data"))); extern void FUN_L14_002dec40(struct Moby *); extern void enqueue_callback_list_1(void (*)(struct Moby *), struct Moby *) __asm__("FUN_001f4600"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern f32 absolute_float(f32) __asm__("FUN_001f99c0"); extern f32 fast_add_rotations(f32, f32); -extern s32 FUN_001f9740(void *); -extern s32 FUN_001f96f8(s32); +extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 random_integer_below_de670(s32) __asm__("FUN_00213260"); extern s32 FUN_L00_00257b90(s32, s32); extern f32 random_float_between_de670(f32, f32) __asm__("FUN_002132a8"); extern s32 coll_sphere(f32, void *, s32, void *) __asm__("FUN_L00_001f0d60"); -extern void FUN_L00_0025e450(void *, void *, void *, f32, f32, s32, s32, s32, - f32, f32, f32, f32, s32, f32, s32, s32, s32, s32); +extern void spawn_explosion(void *, void *, void *, f32, f32, s32, s32, s32, + f32, f32, f32, f32, s32, f32, s32, s32, s32, s32) __asm__("FUN_L00_0025e450"); extern void FUN_L00_0026cbb0_de670(void *, void *, s32, s32, s32, s32, f32) __asm__("FUN_L00_0026cbb0"); extern u8 *FUN_L00_0026d000_de670(void *, f32, f32, f32, s32, void *, f32, s32) __asm__("FUN_L00_0026d000"); extern void mark_moby_for_removal(struct Moby *) __asm__("FUN_0020c828"); @@ -1366,7 +1368,7 @@ void FUN_L14_002de670(struct Moby *moby) { if (random_integer_below_de670(2) != 0) { enqueue_callback_list_1(FUN_L14_002dec40, moby); } - FUN_001f9a10(&moby->pos, &moby->pos, velocity); + fast_vec_add(&moby->pos, &moby->pos, velocity); absolute_velocity = absolute_float(velocity[0]); if (DE670_THRESHOLD * D_0015ED60 < absolute_velocity) { velocity[0] *= (DE670_DAMPING - 1.0f) * D_0015ED60 + 1.0f; @@ -1389,15 +1391,15 @@ void FUN_L14_002de670(struct Moby *moby) { mark_moby_for_removal(moby); return; } - if (FUN_001f9740(velocity + 8) != 0 || coll_sphere(0.5f, &moby->pos, 0, *(void **)(velocity + 9)) != 0) { - FUN_L00_0025e450(moby, velocity, &moby->pos, 0.0f, 0.0f, 5, 2, 4, + if (fast_dec_timer(velocity + 8) != 0 || coll_sphere(0.5f, &moby->pos, 0, *(void **)(velocity + 9)) != 0) { + spawn_explosion(moby, velocity, &moby->pos, 0.0f, 0.0f, 5, 2, 4, 1.0f, 0.5f, 9.0f, 1.0f, 0, 15.0f, 1, 5, -1, 0); coll_sphere(1.0f, &moby->pos, 0, D_001413D0_de670); mark_moby_for_removal(moby); return; } FUN_L00_0026cbb0_de670(&moby->pos, D_L14_0015F580, 0x4F007FFF, 0x1FFFFFFF, - FUN_L00_00257b90(FUN_001f96f8(10), FUN_001f96f8(20)), 1, 60000.0f); + FUN_L00_00257b90(scale_game_frames(10), scale_game_frames(20)), 1, 60000.0f); for (i = 0; i < 2; i++) { n = random_integer_below_de670(6); if (random_integer_below_de670(2) != 0) n = -n; @@ -1410,7 +1412,7 @@ void FUN_L14_002de670(struct Moby *moby) { if (particle != 0) { particle[3] = 0x44; fade = particle + 0x20; - *(s16 *)(particle + 0xA) = FUN_001f96f8(0x3C); + *(s16 *)(particle + 0xA) = scale_game_frames(0x3C); *(s32 *)(fade + 4) = 2; fade[0xA] = 0x60; fade[0xB] = particle[0xA]; diff --git a/src/overlays/shared/gameplay/entities/rock.c b/src/overlays/shared/gameplay/entities/rock.c index ece6302503..eb8b5facd5 100644 --- a/src/overlays/shared/gameplay/entities/rock.c +++ b/src/overlays/shared/gameplay/entities/rock.c @@ -28,19 +28,19 @@ typedef struct { extern RailPath *D_L01_001B0930[]; extern s32 D_0015ED84; extern f32 FUN_001f9b48(void *, void *); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); -extern f32 FUN_001f9af0(void *); -extern f32 FUN_001f9e90(f32, f32); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); +extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern void fast_vec_normalize(void *, void *, f32) __asm__("FUN_001f9bf8"); -extern s32 FUN_001f96f8(s32); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern void approach_value(float *, float, float) __asm__("FUN_00213ed8"); extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); -extern s32 FUN_L00_0025d808(void *, void *, s32 *, f32 *, s32, f32); -extern f32 FUN_L00_0025b8c0(f32 *value, f32 target, f32 *speed, f32 accel, f32 decel, f32 max); +extern s32 sample_path(void *, void *, s32 *, f32 *, s32, f32) __asm__("FUN_L00_0025d808"); +extern f32 vendor_spring(f32 *value, f32 target, f32 *speed, f32 accel, f32 decel, f32 max) __asm__("FUN_L00_0025b8c0"); /* Grind rail: measures its paths once, then while the hero is in control mode 0x10 snaps it to the nearest path point in range and pulls it along, faster on level 1 the more rail is left. */ @@ -85,7 +85,7 @@ void FUN_L01_002f6328(struct Moby *m) { for (k = 0; k < d->count; k++) { path = D_L01_001B0930[d->paths[k]]; FUN_L00_0025df68(path, &hero.motion.pos, &pt, &seg, &t, 0, 999.0f, 5.0f, 0.0f); - dist = FUN_001f9b80(&hero.motion.pos, &pt); + dist = vector_distance(&hero.motion.pos, &pt); if (dist < best) { best_path = path; qcopy(&best_pt, &pt); @@ -97,7 +97,7 @@ void FUN_L01_002f6328(struct Moby *m) { if (best_path == 0) { return; } - end = FUN_L00_0025d808(best_path, &pt, &best_seg, &best_t, 0, 0.3f); + end = sample_path(best_path, &pt, &best_seg, &best_t, 0, 0.3f); if (d->range < best) { return; } @@ -117,25 +117,25 @@ void FUN_L01_002f6328(struct Moby *m) { } } if (end == 0) { - FUN_001f9a28(&dir, &pt, &best_pt); - hero.unk9D4 = FUN_001f9e90(vector_length_xy(&dir), dir.f[2]); - hero.unk9D0 = FUN_001f9e90(dir.f[0], dir.f[1]); + fast_vec_sub(&dir, &pt, &best_pt); + hero.unk9D4 = fast_arc_tan(vector_length_xy(&dir), dir.f[2]); + hero.unk9D0 = fast_arc_tan(dir.f[0], dir.f[1]); dir.i[2] = 0; if (hero.unk9DC < d->speed) { approach_value(&hero.unk9DC, d->speed, frame_time_sq * 6.0f); } else { approach_value(&hero.unk9DC, d->speed, frame_time_sq * 6.0f); } - if (0.001f < FUN_001f9af0(&dir)) { + if (0.001f < fast_vec_length(&dir)) { fast_vec_normalize(&hero.motion.platform_delta, &dir, hero.unk9DC); } - FUN_001f9a28(&pull, &best_pt, &hero.motion.pos); + fast_vec_sub(&pull, &best_pt, &hero.motion.pos); rate = frame_time * 5.0f; pull.f[2] = 0.0f; drag = -vector_length_xy(&pull); - FUN_L00_0025b8c0(&drag, 0.0f, &hero.unk9E0, frame_scale_sq * 0.008f, frame_scale_sq * 0.3f, rate); + vendor_spring(&drag, 0.0f, &hero.unk9E0, frame_scale_sq * 0.008f, frame_scale_sq * 0.3f, rate); { - f32 len = FUN_001f9af0(&pull); + f32 len = fast_vec_length(&pull); if (len < hero.unk9E0) { hero.unk9E0 = len; } @@ -143,11 +143,11 @@ void FUN_L01_002f6328(struct Moby *m) { fast_vec_normalize(&pull, &pull, hero.unk9E0); } } - FUN_001f9a10(&hero.motion.platform_delta, &hero.motion.platform_delta, &pull); + fast_vec_add(&hero.motion.platform_delta, &hero.motion.platform_delta, &pull); hero.motion.platform_delta.f[3] = 0.0f; qcopy(&hero.motion.unk150, &hero.motion.platform_delta); - if (hero.unk1E0 < FUN_001f96f8(30)) { - hero.unk1E0 = FUN_001f96f8(30); + if (hero.unk1E0 < scale_game_frames(30)) { + hero.unk1E0 = scale_game_frames(30); } } else { fast_vec_scale(&hero.motion.unk150, &hero.motion.unk150, frame_scale * -0.0099999905f + 1.0f); @@ -413,7 +413,7 @@ void FUN_L01_002f6a30(struct Moby *moby) { } #include "qcopy.h" -/* pvars of the debris moby FUN_L01_002f8530 spawns */ +/* pvars of the debris moby spawn_debris_chunk spawns */ typedef struct { Vec4f vel; /* 0x00 */ s32 unk10; /* 0x10 */ @@ -434,7 +434,9 @@ extern f32 scale_time(f32) __asm__("FUN_001f96b0"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern void upd_a(struct Moby *) __asm__("FUN_L00_00250df8"); -struct Moby *FUN_L01_002f8530(Vec4f *pos, Vec4f *vel, s32 oclass, s32 a3, s32 a4, +struct Moby *spawn_debris_chunk(Vec4f *pos, Vec4f *vel, s32 oclass, s32 a3, s32 a4, + f32 scale, f32 gravity, f32 spin, f32 seconds) __asm__("FUN_L01_002f8530"); +struct Moby *spawn_debris_chunk(Vec4f *pos, Vec4f *vel, s32 oclass, s32 a3, s32 a4, f32 scale, f32 gravity, f32 spin, f32 seconds) { u128 p; u128 v; @@ -481,12 +483,12 @@ struct Moby *FUN_L01_002f8530(Vec4f *pos, Vec4f *vel, s32 oclass, s32 a3, s32 a4 #include "rnc/overlay/collision.h" extern CollisionHit D_L01_001742C0; -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); -extern s32 FUN_001efa68(void *, void *, s32, void *, s32); +extern s32 collision_line(void *, void *, s32, void *, s32) __asm__("FUN_001efa68"); extern s32 coll_sphere(f32, void *, s32, void *) __asm__("FUN_L00_001f0d60"); extern void FUN_L00_001ff660(void *, void *, void *); extern s32 FUN_L00_00257b90(s32, s32); @@ -495,7 +497,8 @@ extern void mark_moby_for_removal(void *) __asm__("FUN_0020c828"); /* Debris update: falls and spins, bounces off what it hits with a random kick, bursts into 40 sparks once it comes to rest (or its unk10 timer runs out), or fades out over unk28 frames when unk20 is set. */ -void FUN_L01_002f8718(struct Moby *m) { +void rock_update(struct Moby *m) __asm__("FUN_L01_002f8718"); +void rock_update(struct Moby *m) { DebrisVars_2f8530 *d = (DebrisVars_2f8530 *)m->pvars; Vec4 old; Vec4 v; @@ -507,7 +510,7 @@ void FUN_L01_002f8718(struct Moby *m) { qcopy(&old, &m->pos); d->vel.z -= d->gravity; - FUN_001f9a10(&m->pos, &m->pos, &d->vel); + fast_vec_add(&m->pos, &m->pos, &d->vel); m->rot.z = fast_add_rotations(m->rot.z, d->spin); if (m->pos.x < 2.0f || 1021.0f < m->pos.x || m->pos.y < 2.0f || 1021.0f < m->pos.y || m->pos.z < 2.0f || 1021.0f < m->pos.z) { @@ -515,11 +518,11 @@ void FUN_L01_002f8718(struct Moby *m) { return; } if (fast_dec_timer(&d->life)) { - if (FUN_001efa68(&old, &m->pos, 0, m, 0) != 0 || coll_sphere(d->scale, &m->pos, 0, m) != 0) { - ang = FUN_001f9e90(d->vel.x, d->vel.y); - v.f[0] = FUN_001f9dc8(fast_add_rotations(ang, random_float_between(-3.1415927f, 3.1415927f))) * + if (collision_line(&old, &m->pos, 0, m, 0) != 0 || coll_sphere(d->scale, &m->pos, 0, m) != 0) { + ang = fast_arc_tan(d->vel.x, d->vel.y); + v.f[0] = fast_cos(fast_add_rotations(ang, random_float_between(-3.1415927f, 3.1415927f))) * random_float_between(0.0f, d->vel.z * 0.35f); - v.f[1] = FUN_001f9de0(fast_add_rotations(ang, random_float_between(-3.1415927f, 3.1415927f))) * + v.f[1] = fast_sin(fast_add_rotations(ang, random_float_between(-3.1415927f, 3.1415927f))) * random_float_between(0.0f, d->vel.z * 0.35f); v.f[2] = 0.0f; m->rot.x = random_float_between(-3.1415927f, 3.1415927f); @@ -527,9 +530,9 @@ void FUN_L01_002f8718(struct Moby *m) { m->rot.z = random_float_between(-3.1415927f, 3.1415927f); FUN_L00_001ff660(&d->vel, &d->vel, &D_L01_001742C0.normal_x); fast_vec_scale(&d->vel, &d->vel, random_float_between(0.07f, 0.13f)); - FUN_001f9a10(&d->vel, &d->vel, &v); + fast_vec_add(&d->vel, &d->vel, &v); fast_vec_normalize(&D_L01_001742C0.normal_x, &D_L01_001742C0.normal_x, 0.1f); - FUN_001f9a10(&m->pos, &D_L01_001742C0.normal_x, &D_L01_001742C0.point); + fast_vec_add(&m->pos, &D_L01_001742C0.normal_x, &D_L01_001742C0.point); spin = random_float_between(frame_time * 1.5707964f, frame_time * 6.2831855f); if (0.0f < d->spin) { spin = -spin; @@ -539,7 +542,7 @@ void FUN_L01_002f8718(struct Moby *m) { } if (d->unk20 == 0) { if (fast_dec_timer(&d->unk10) == 0) { - if (!(FUN_001f9af0(&d->vel) < frame_time * 0.5f)) { + if (!(fast_vec_length(&d->vel) < frame_time * 0.5f)) { return; } if (d->life != 0) { @@ -558,11 +561,11 @@ void FUN_L01_002f8718(struct Moby *m) { t.f[2] = random_float_between(-1.0f, 1.0f); p.q = t.q; fast_vec_normalize(&p, &p, random_float_between(0.0f, 0.5f)); - FUN_001f9a10(&p, &p, &m->pos); + fast_vec_add(&p, &p, &m->pos); fast_vec_normalize(&v, &v, random_float_between(0.0f, 0.5f) * frame_time); - FUN_001f9a10(&v, &v, &d->vel); + fast_vec_add(&v, &v, &d->vel); FUN_L00_0026ced0(&p, &v, 0x1F0C1820, 0x81020, random_float_between(70000.0f, 140000.0f), - FUN_001f96f8(FUN_L00_00257b90(20, 60))); + scale_game_frames(FUN_L00_00257b90(20, 60))); } mark_moby_for_removal(m); } else if (fast_dec_timer(&d->unk10) != 0) { @@ -639,7 +642,7 @@ extern void DebugPrint(char *, ...); extern void FUN_L00_00216f90(void *, void *, int, int); extern void FUN_L00_002ea9d8(void *); extern void FUN_L00_002eaa30(void *); -extern void FUN_L00_002eaaa0(void *, void *, int, int, int); +extern void jet_mount(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); extern void FUN_L00_002eac18(int); extern void FUN_L01_002405a0(void); extern int is_point_inside_clip_volume(void *, int) __asm__("FUN_00214720"); @@ -696,10 +699,10 @@ void FUN_L01_002fb5b0(char *m) { FUN_L00_00216f90(o + 0x30, o + 0x70, 0x72, 1); } if (*(int *)(d + 0x30) != 0) { - FUN_L00_002eaaa0(a, b, 2, *(int *)(d + 0x34), 0); + jet_mount(a, b, 2, *(int *)(d + 0x34), 0); } else { char *o = D_L01_001600EC_q + *(int *)(d + 0x24) * 128; - FUN_L00_002eaaa0(o + 0x30, o + 0x70, 0, 0, 0); + jet_mount(o + 0x30, o + 0x70, 0, 0, 0); } cutscene_active = 1; m[0x20] = 2; @@ -845,11 +848,11 @@ extern unsigned char D_0015EDB0_b __asm__("D_0015EDB0"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); -extern int FUN_001f9740(int *); +extern int tick_countdown_32(int *) __asm__("FUN_001f9740"); extern int FUN_001fa6d0(float); extern void build_spherical_offset(void *, float, float, float) __asm__("FUN_00214db0"); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_002628d8(float, float, void *, void *, int); +extern void update_joint_animation(float, float, void *, void *, int) __asm__("FUN_L00_002628d8"); extern int D_0015ED84_c __asm__("D_0015ED84"); extern int D_0015ED84_m __asm__("D_0015ED84"); extern unsigned char D_0013DD42 __attribute__((section(".data"))); @@ -868,18 +871,19 @@ extern struct { float f88; } D_0013F350_w __asm__("D_0013F350"); extern void FUN_L01_002ff028_c(void *) __asm__("FUN_L01_002ff028"); -extern void FUN_L00_002668a0(void *, void *); -extern int FUN_L00_00266448(void *, void *); -extern void FUN_L01_002783a8(void *, float); -extern void FUN_L00_002502a0(int); -extern void FUN_L00_00284e50(void *, void *); +extern void initialize_npc_dialogue(void *, void *) __asm__("FUN_L00_002668a0"); +extern int update_npc_dialogue(void *, void *) __asm__("FUN_L00_00266448"); +extern void begin_dialogue_camera_transition(void *, float) __asm__("FUN_L01_002783a8"); +extern void jet_clear_persistent(int) __asm__("FUN_L00_002502a0"); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); extern void unlock_planet(int) __asm__("FUN_L00_002607d0"); extern void FUN_L00_00262d38(int); extern void FUN_L01_0029b0a0(void *, int, void *, int, void *); extern void memcard_save_data(int, int) __asm__("FUN_0020b178"); /* Watcher moby update with a level-specific state script, then turns its head toward the hero or a random target. */ -void FUN_L01_002ff118(L01WatchMoby *m) { +void the_plumber_update(L01WatchMoby *m) __asm__("FUN_L01_002ff118"); +void the_plumber_update(L01WatchMoby *m) { L01WatchScratch scratch; L01WatchData *d = (L01WatchData *)m->data; float rate; @@ -912,11 +916,11 @@ void FUN_L01_002ff118(L01WatchMoby *m) { d->p20 = (void *)D_L01_00161D48; m->state = 7; } - FUN_L00_002668a0(m, d); + initialize_npc_dialogue(m, d); break; case 1: - if (FUN_L00_00266448(m, d)) { - FUN_L01_002783a8(m, 2.2f); + if (update_npc_dialogue(m, d)) { + begin_dialogue_camera_transition(m, 2.2f); m->state = 2; } break; @@ -924,10 +928,10 @@ void FUN_L01_002ff118(L01WatchMoby *m) { if (cutscene_mode == 2) break; if (D_0014C050_c[m->bB0 + D_0015ED84_c * 16] != 0xFF) { - FUN_L00_002502a0(m->bB0); + jet_clear_persistent(m->bB0); if (d->i4C != -1) { char *t = D_L01_001600EC_c + d->i4C * 128; - FUN_L00_00284e50(t + 0x30, t + 0x70); + jet_reset_camera(t + 0x30, t + 0x70); } } m->state = 1; @@ -943,7 +947,7 @@ void FUN_L01_002ff118(L01WatchMoby *m) { mark_moby_for_removal(m); return; case 4: - if (FUN_L00_00266448(m, d)) { + if (update_npc_dialogue(m, d)) { m->state = 5; d->b8 = 0; } @@ -970,20 +974,20 @@ void FUN_L01_002ff118(L01WatchMoby *m) { char *g = (char *)&hero.motion.pos; L01Player *q; tracking = 1; - if (FUN_001f9b80(m->position, g) < 8.0f && + if (vector_distance(m->position, g) < 8.0f && (q = (L01Player *)(g - 0x80), fast_difference_between_rotations( - m->yaw, FUN_001f9e90(q->aim[0] - m->position[0], q->aim[1] - m->position[1]))) < + m->yaw, fast_arc_tan(q->aim[0] - m->position[0], q->aim[1] - m->position[1]))) < 1.5707964f) { - if (FUN_001f9af0(g + 0x80) > 0.01f) - d->moving_timer = FUN_001f96f8(120); + if (fast_vec_length(g + 0x80) > 0.01f) + d->moving_timer = scale_game_frames(120); else - FUN_001f9740(&d->moving_timer); + tick_countdown_32(&d->moving_timer); } else if (d->moving_timer) { d->moving_timer = 0; qcopy(d->target, hero.motion.unkD0.f); } - if (FUN_001f9740(&d->target_timer)) { + if (tick_countdown_32(&d->target_timer)) { float heading; d->target_timer = FUN_001fa6d0(multiply_global_factor_ed64(random_float_between(180.0f, 300.0f))); heading = FUN_001fa580_c(m->yaw, random_float_between(-90.0f, 90.0f) * DEG_TO_RAD); @@ -1004,9 +1008,9 @@ void FUN_L01_002ff118(L01WatchMoby *m) { float pitch; qcopy(scratch.eye, m->position); scratch.eye[2] += 1.0f; - FUN_001f9a28(scratch.delta, scratch.target, scratch.eye); - yaw = fast_subtract_rotations(FUN_001f9e90(scratch.delta[0], scratch.delta[1]), m->yaw); - pitch = -FUN_001f9e90(vector_length_xy(scratch.delta), scratch.delta[2]); + fast_vec_sub(scratch.delta, scratch.target, scratch.eye); + yaw = fast_subtract_rotations(fast_arc_tan(scratch.delta[0], scratch.delta[1]), m->yaw); + pitch = -fast_arc_tan(vector_length_xy(scratch.delta), scratch.delta[2]); if (yaw > 1.5707964f) yaw = 1.5707964f; else if (yaw < -1.5707964f) @@ -1021,11 +1025,11 @@ void FUN_L01_002ff118(L01WatchMoby *m) { } if (D_0015EDB0_b) d->height = 2.75f; - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); - FUN_L00_002628d8(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->body, 0); + update_joint_animation(rate * frame_scale_sq, head_rate * frame_scale_sq, m, d->head, 1); } -/* pvars of the respawning pickup FUN_L01_00300220 updates */ +/* pvars of the respawning pickup spawn_point_update updates */ typedef struct { s32 volume; /* 0x00: clip volume that arms it */ u8 pad4[4]; @@ -1052,7 +1056,8 @@ extern u32 D_001413DC __attribute__((section(".data"))); extern f32 FUN_001f99c0(f32); extern f32 probe_ground_height(void *, s32, f32) __asm__("FUN_00213508"); -void FUN_L01_00300220(struct Moby *moby) { +void spawn_point_update(struct Moby *moby) __asm__("FUN_L01_00300220"); +void spawn_point_update(struct Moby *moby) { PickupVars *vars = (PickupVars *)moby->pvars; s32 armed = 0; Vec4f pos; @@ -1095,13 +1100,13 @@ void FUN_L01_00300220(struct Moby *moby) { if (vars->armed == 0 || vars->rearm != 0) { armed = 1; vars->armed = armed; - FUN_L00_002502a0(moby->mission); + jet_clear_persistent(moby->mission); qcopy(&pos, &moby->pos); pos.z = probe_ground_height(&pos, 0, 0.5f); if (FUN_001f99c0(moby->pos.z - pos.z) > 2.0f) { pos.z = moby->pos.z; } - FUN_L00_00284e50(&pos, &moby->rot); + jet_reset_camera(&pos, &moby->rot); D_L01_001BAA50.collected[(s16)moby->save_id] = 0; D_L01_001BB6B0.collected[(s16)moby->save_id] = 0; D_0014C190[current_level_index][(s16)moby->save_id >> 5] &= @@ -1227,7 +1232,7 @@ void FUN_L01_00302648(struct Moby *m) { if (D_L01_0015F30C) { FUN_001f4600_302648(FUN_L01_00302438_302648, m); } - if (FUN_001f96f8(90) < v->count) { + if (scale_game_frames(90) < v->count) { FUN_L00_002b5b20_302648(t, t->pvars); } } @@ -1278,7 +1283,8 @@ extern void FUN_L01_003089f0_f(struct Moby *) __asm__("FUN_L01_003089f0"); extern f32 D_L01_00161F20 __attribute__((sda)); extern f32 D_L01_00161F24 __attribute__((sda)); extern f32 D_L01_00161F28 __attribute__((sda)); -void FUN_L01_00307ca0(struct Moby *moby) { +void gold_bolt_update(struct Moby *moby) __asm__("FUN_L01_00307ca0"); +void gold_bolt_update(struct Moby *moby) { Vars_307ca0 *vars = (Vars_307ca0 *)moby->pvars; struct Hero *h; Vec4f at; @@ -1306,7 +1312,7 @@ void FUN_L01_00307ca0(struct Moby *moby) { return; case 1: moby->scale = moby->pclass->scale * D_L01_00161F10_gp; - moby->pos.z = vars->home.z + D_L01_00161F14_gp + D_L01_00161F18_gp * FUN_001f9de0(moby->rot.w); + moby->pos.z = vars->home.z + D_L01_00161F14_gp + D_L01_00161F18_gp * fast_sin(moby->rot.w); moby->rot.x = FUN_001fa580_c(moby->rot.x, D_L01_00161F20 * 0.017453292f * D_0015ED6C_f); moby->rot.y = FUN_001fa580_c(moby->rot.y, D_L01_00161F24 * 0.017453292f * D_0015ED6C_f); moby->rot.z = FUN_001fa580_c(moby->rot.z, D_L01_00161F28 * 0.017453292f * D_0015ED6C_f); @@ -1315,7 +1321,7 @@ void FUN_L01_00307ca0(struct Moby *moby) { if (!random_integer_below(D_L01_00161F50_gp)) { FUN_L01_003089f0_f(moby); } - if (!(FUN_001f9b80(&moby->pos, &hero.motion.pos) < 3.0f)) { + if (!(vector_distance(&moby->pos, &hero.motion.pos) < 3.0f)) { return; } if (!(FUN_001f99c0(moby->pos.z - hero.motion.pos.f[2]) < 2.0f)) { @@ -1328,7 +1334,7 @@ void FUN_L01_00307ca0(struct Moby *moby) { return; } if (vars->unkC != 0) { - D_L01_0015F640 = FUN_001f96f8(180); + D_L01_0015F640 = scale_game_frames(180); queue_dialogue_message(0x53B3, -1); D_0014BEC0[vars->id + D_0015ED84_n * 4] = 1; memcard_save_data(0, -1); @@ -1336,28 +1342,28 @@ void FUN_L01_00307ca0(struct Moby *moby) { mark_moby_for_removal(moby); return; } - at.x = FUN_001f9dc8(vars->home.w) * 2.5f; - at.y = FUN_001f9de0(vars->home.w) * 2.5f; + at.x = fast_cos(vars->home.w) * 2.5f; + at.y = fast_sin(vars->home.w) * 2.5f; at.z = 0.0f; add_vector_xyz(&at, &at, &vars->home); FUN_001f99f8(&look); look.z = FUN_001fa580_c(vars->home.w, 3.1415927f); - fade_to_black(FUN_001f96f8(10)); + fade_to_black(scale_game_frames(10)); if (hero.vehicle_mode == 3) { FUN_L01_00231450(); } FUN_L00_00216f90(&at, &look, 0x72, 0); allocate_voice_for_target_entry(0, 0, moby); - at2.x = FUN_001f9dc8(vars->home.w) * 1.25f; - at2.y = FUN_001f9de0(vars->home.w) * 1.25f; + at2.x = fast_cos(vars->home.w) * 1.25f; + at2.y = fast_sin(vars->home.w) * 1.25f; at2.z = 0.0f; - at2.x += FUN_001f9dc8(FUN_001fa580_c(vars->home.w, 1.5707964f)) * 4.0f; - at2.y += FUN_001f9de0(FUN_001fa580_c(vars->home.w, 1.5707964f)) * 4.0f; + at2.x += fast_cos(FUN_001fa580_c(vars->home.w, 1.5707964f)) * 4.0f; + at2.y += fast_sin(FUN_001fa580_c(vars->home.w, 1.5707964f)) * 4.0f; add_vector_xyz(&at2, &at2, &vars->home); at2.z += 1.0f; FUN_001f99f8(&look2); look2.z = fast_subtract_rotations(vars->home.w, 1.5707964f); - FUN_L00_002eaaa0(&at2, &look2, 1, 0, 0); + jet_mount(&at2, &look2, 1, 0, 0); FUN_L00_002ea9d8(&at2); FUN_L00_002eaa30(&look2); qcopy(&moby->pos, &hero.motion.pos); @@ -1372,7 +1378,7 @@ void FUN_L01_00307ca0(struct Moby *moby) { hero.unk20AF = 1; cutscene_active = 1; moby->state = 2; - vars->timer = FUN_001f96f8(60); + vars->timer = scale_game_frames(60); return; case 2: FUN_L01_003087e0_f(moby); @@ -1396,12 +1402,12 @@ void FUN_L01_00307ca0(struct Moby *moby) { } h = &hero; if (h->unkA98 & 2) { - set_hero_animation(FUN_001f96f8(30), 0, 0); + set_hero_animation(scale_game_frames(30), 0, 0); } - if (moby->seq != 0 || !FUN_001f9740(&vars->timer)) { + if (moby->seq != 0 || !tick_countdown_32(&vars->timer)) { return; } - D_L01_0015F640 = FUN_001f96f8(180); + D_L01_0015F640 = scale_game_frames(180); queue_dialogue_message(0x53B3, -1); D_0014BEC0[vars->id + D_0015ED84_n * 4] = 1; cutscene_active = 0; @@ -1431,7 +1437,7 @@ void FUN_L01_00308380(struct Moby *moby) { moby->scale = moby->pclass->scale * *(float *)&D_L01_00161F10_gp; if (moby->state == 1) { - s = FUN_001f9de0(moby->rot.w); + s = fast_sin(moby->rot.w); moby->pos.z = *(float *)(data + 0x18) + *(float *)&D_L01_00161F14_gp + *(float *)&D_L01_00161F18_gp * s; moby->rot.x = @@ -1556,7 +1562,7 @@ void FUN_L01_003087e0(char *moby) { f32 five = 5.0f; struct Hero *g = &hero; ang = FUN_001fa580_c(f22 * 0.6981316804885864f - 0.3490658402442932f, g->motion.rot.f[2]); - v.x = FUN_001f9dc8(ang) * five; + v.x = fast_cos(ang) * five; v.y = fast_sin(ang) * five; v.z = 0.0f; add_vector_xyz(&v.x, &v.x, (f32 *)(&g->motion.pos)); @@ -1673,19 +1679,20 @@ extern void FUN_L01_003094f0_u(char *) __asm__("FUN_L01_003094f0"); extern void FUN_L01_0026e0e0_c(char *, int) __asm__("FUN_L01_0026e0e0"); extern int allocate_voice_for_target_entry(int, int, void *) __asm__("FUN_0022da68"); extern void FUN_L00_00233ee8(float *, int, float); -extern void FUN_L00_002598b0(int, float, void *, int, float, float, int, int, int); +extern void play_entity_sound(int, float, void *, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); extern void advance_accelerated_scalar(float *, float *, float, float, float, float) __asm__("FUN_00213f38"); extern int FUN_L00_00233f38(void); extern void FUN_L00_00216f90(void *, void *, int, int); -extern void FUN_L01_0027a248(int, int); +extern void jet_game_state(int, int) __asm__("FUN_L01_0027a248"); extern int enqueue_callback_list_1(void (*)(char *), char *) __asm__("FUN_001f4600"); extern char *create_moby(int) __asm__("FUN_0020c4f8"); extern float D_L01_00161F88 __attribute__((sda)); extern float D_L01_00161F8C __attribute__((sda)); extern float D_L01_00161F90 __attribute__((sda)); -void FUN_L01_00308bd8(struct Moby *moby) { +void teleporter_update(struct Moby *moby) __asm__("FUN_L01_00308bd8"); +void teleporter_update(struct Moby *moby) { char *data = (char *)moby->pvars; int active = 0; @@ -1768,7 +1775,7 @@ void FUN_L01_00308bd8(struct Moby *moby) { *(int *)(data + 0x2C) = 0; *(int *)(data + 0x28) = 0; FUN_L00_00233ee8(&moby->pos.x, 0, moby->rot.z); - FUN_L00_002598b0((int)moby, 1.5f, &moby->pos, 0x10000, 20.0f, 1.0f, 0, 1, 0); + play_entity_sound((int)moby, 1.5f, &moby->pos, 0x10000, 20.0f, 1.0f, 0, 1, 0); break; } case 7: @@ -1825,7 +1832,7 @@ void FUN_L01_00308bd8(struct Moby *moby) { FUN_L00_00216f90(v, t + 0x40, 0, 1); hero.unk20A5 = 1; if (*(int *)(data + 0x40) != -1 && *(int *)(data + 0x44) != -1) { - FUN_L01_0027a248(*(int *)(data + 0x40), *(int *)(data + 0x44)); + jet_game_state(*(int *)(data + 0x40), *(int *)(data + 0x44)); } *(unsigned char *)(t + 0x20) = 4; *(float *)(td + 0x34) = 0.0f; @@ -1891,7 +1898,7 @@ void FUN_L01_003092d0(char *m) { t = *(float *)(d + 0x20) * 2.4f - 1.2f; euler_rotation_basis(*p + 0xC0, *p + 0x40); fast_vec_normalize(v, *p + 0xC0, t); - FUN_001f9a10(*p + 0x10, *p + 0x10, v); + fast_vec_add(*p + 0x10, *p + 0x10, v); *(float *)(*p + 0x44) = *(float *)(d + 0x24) * -1.0471976f - 0.34906584f; euler_rotation_basis(*p + 0xC0, *p + 0x40); FUN_L00_00250df8(*p); diff --git a/src/overlays/shared/gameplay/entities/rocket.c b/src/overlays/shared/gameplay/entities/rocket.c index 02e3465986..26dc8fb1b4 100644 --- a/src/overlays/shared/gameplay/entities/rocket.c +++ b/src/overlays/shared/gameplay/entities/rocket.c @@ -141,7 +141,8 @@ extern void burst_cc2e8(void *, void *, int, float, float) __asm__("FUN_L00_0025 extern void sfx_cc2e8(int, int, void *, int) __asm__("FUN_L00_0028dc90"); extern void kill_cc2e8(void *) __asm__("FUN_0020c828"); -void FUN_L10_002cc2e8(char *m) { +void rocket_update(char *m) __asm__("FUN_L10_002cc2e8"); +void rocket_update(char *m) { Shot_cc2e8 *d = *(Shot_cc2e8 **)(m + 0x78); float pos0[4] __attribute__((aligned(16))); float c[4] __attribute__((aligned(16))); diff --git a/src/overlays/shared/gameplay/entities/sandmouse.c b/src/overlays/shared/gameplay/entities/sandmouse.c index ed2429a1a0..0d899727d6 100644 --- a/src/overlays/shared/gameplay/entities/sandmouse.c +++ b/src/overlays/shared/gameplay/entities/sandmouse.c @@ -298,7 +298,7 @@ extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void scale_vector_xyz_30c9a8(void *, void *, f32) __asm__("FUN_001f9c48"); extern s32 is_timer_active_30c9a8(void *) __asm__("FUN_001f9770"); extern s32 collision_line_30c9a8(void *, void *, s32, void *, void *) __asm__("FUN_001efa68"); -extern s32 FUN_001f0b58(void); +extern s32 collision_hit_material(void) __asm__("FUN_001f0b58"); extern void mark_moby_for_removal_30c9a8(void *) __asm__("FUN_0020c828"); extern f32 D_L01_00167240_30c9a8[] __asm__("D_L01_00167240"); extern OvlQuad D_0013F3D0_30c9a8 __asm__("D_0013F3D0"); @@ -369,7 +369,7 @@ void FUN_L01_0030c9a8(char *m) { { if (!collision_line_30c9a8(&old_pos, pos, 0, *(void **)(e + 0x10), &probe)) return; - if (!FUN_001f0b58()) { + if (!collision_hit_material()) { if (*(s16 *)(e + 0x14) > scale_game_frames(3)) *(s16 *)(e + 0x14) = scale_game_frames(3); return; @@ -386,7 +386,7 @@ void FUN_L01_0030c9a8(char *m) { /* Ported from rac1-decomp (src/overlays/shared/vendor_002F7700.c: func_L01_0030E638), where it is exact; names translated to the US level program. */ extern char D_0013E533[]; -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); void FUN_L01_0030d260(void *unused, float *p) { @@ -395,8 +395,8 @@ void FUN_L01_0030d260(void *unused, float *p) { char *g = D_0013E533 + 0xE1D; fast_vec_normalize(a, *(char **)(g + 0x2080) + 0xD0, 1.1f); fast_vec_normalize(b, *(char **)(g + 0x2080) + 0xE0, 1.0f); - FUN_001f9a10(p, a, b); - FUN_001f9a10(p, p, g + 0x80); + fast_vec_add(p, a, b); + fast_vec_add(p, p, g + 0x80); p[2] = p[2] + 1.0f; } #include "qcopy.h" @@ -471,14 +471,14 @@ struct Moby *FUN_L01_0030d308(struct Moby *moby, f32 *from, f32 *ang, f32 yawMax #include "sda.h" -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); -extern float FUN_001f9b80(void *, void *); -extern void *FUN_002141f8(void *); -extern int FUN_001f96f8(int); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern void *suck_get_aim_height(void *) __asm__("FUN_002141f8"); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void allocate_voice_for_target_entry(int, int, char *) __asm__("FUN_0022da68"); struct Moby *FUN_L01_0030d308(struct Moby *moby, f32 *from, f32 *ang, f32 yawMax, f32 pitchMax, f32 range, f32 near, f32 nearYaw, f32 nearPitch); @@ -505,7 +505,7 @@ void FUN_L01_0030d5f0(char *moby, char *state) { char *e; float a, b, c, d, t, dist; - if (FUN_001f9770(state + 0x54) == 0) + if (fast_dec_timer_s16(state + 0x54) == 0) return; moby_point_position(moby, (state[0x56] & 1) + 1, &v); state[0x56] = state[0x56] ^ 1; @@ -521,23 +521,23 @@ void FUN_L01_0030d5f0(char *moby, char *state) { if (cutscene_mode_gp != 2) { char *r; qcopy(&q, e + 0x10); - r = FUN_002141f8(e); + r = suck_get_aim_height(e); if (r != 0) q.f[2] = q.f[2] + *(float *)(r + 0x10); else q.f[2] = q.f[2] + D_L01_00162094; - FUN_001f9a28(&p, &q, &v); + fast_vec_sub(&p, &q, &v); fast_vec_normalize(&p, &p, D_L01_00162090); - FUN_001f9a10(&v, &v, &p); + fast_vec_add(&v, &v, &p); a = fast_arc_tan(q.f[0] - v.f[0], q.f[1] - v.f[1]); - dist = FUN_001f9b80(&v, &q); + dist = vector_distance(&v, &q); b = -fast_arc_tan(dist, q.f[2] - v.f[2]); c = fast_arc_tan(q.f[0] - v.f[0], q.f[1] - v.f[1]); - dist = FUN_001f9b80(&v, &q); + dist = vector_distance(&v, &q); d = -fast_arc_tan(dist, q.f[2] - v.f[2]); FUN_L01_0030c898_c(moby, &v, a, b, c, d); allocate_voice_for_target_entry(0, 0, moby); - *(short *)(state + 0x54) = FUN_001f96f8(D_L01_00162080_i); + *(short *)(state + 0x54) = scale_game_frames(D_L01_00162080_i); *(int *)(state + 0x5C) = *(int *)(state + 0x5C) + 1; } } @@ -578,12 +578,12 @@ extern f32 D_L01_001620D8 __attribute__((sda)); extern f32 D_L01_001620DC __attribute__((sda)); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern void clamp_vector_length(void *, void *, f32) __asm__("FUN_001f9c90"); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); -extern f32 FUN_001f9de0(f32); +extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern void FUN_L00_00258278(struct Moby *, f32 *, f32, f32, f32, f32); extern s32 FUN_L00_00258ad0(struct Moby *, Vec4 *, f32, f32, s32, s32); -extern f32 FUN_L00_0025e310(f32); +extern f32 normalize_angle(f32) __asm__("FUN_L00_0025e310"); void FUN_L01_0030d880(struct Moby *m, struct HoverVars *p) { Vec4 v; @@ -595,13 +595,13 @@ void FUN_L01_0030d880(struct Moby *m, struct HoverVars *p) { s16 n; struct HoverTuning *t; - FUN_001f9a28(&v, p, &m->pos); + fast_vec_sub(&v, p, &m->pos); if (m->state == 6) { - d = FUN_001f9b80(&m->pos, &p->unk30); + d = vector_distance(&m->pos, &p->unk30); } else { - d = FUN_001f9b80(&m->pos, &hero.motion.pos); + d = vector_distance(&m->pos, &hero.motion.pos); } - FUN_001f9b80(&m->pos, p); + vector_distance(&m->pos, p); switch (m->command) { case 0: ang = fast_arc_tan(p->goal.f[0] - m->pos.x, p->goal.f[1] - m->pos.y); @@ -623,25 +623,25 @@ void FUN_L01_0030d880(struct Moby *m, struct HoverVars *p) { D_L01_001620CC * DEG_TO_RAD * frame_time); } fast_vec_scale(&v, &v, frame_scale * 0.04f); - FUN_001f9a28(&v, &v, &p->vel); + fast_vec_sub(&v, &v, &p->vel); if (1.3f < d) { fast_vec_scale(&v, &v, frame_scale_sq * 0.13f); } else { fast_vec_scale(&v, &v, frame_scale_sq * 0.25f); } v.f[2] *= frame_scale * -0.100000024f + 1.0f; - FUN_001f9a10(&p->vel, &p->vel, &v); + fast_vec_add(&p->vel, &p->vel, &v); if (m->state == 6) { clamp_vector_length(&p->vel, &p->vel, frame_time * 2.7f); } t = &D_L01_001DEB38; hit = FUN_L00_00258ad0(m, &p->vel, 1.0f, t->unk30, t->unk0, 0); - len = FUN_001f9af0(&p->vel); + len = fast_vec_length(&p->vel); if (hit == 0) { p->stuck = 0; } else if (len < 0.005f) { n = ++p->stuck; - if (FUN_001f96f8(20) < n && m->visible == 0) { + if (scale_game_frames(20) < n && m->visible == 0) { qcopy(&m->pos, p); p->stuck = 0; } @@ -650,7 +650,7 @@ void FUN_L01_0030d880(struct Moby *m, struct HoverVars *p) { k = 1.1f - d; ang = fast_arc_tan(hero.motion.pos.f[0] - m->pos.x, hero.motion.pos.f[1] - m->pos.y); p->vel.f[0] -= k * fast_cos(ang) * (frame_scale_sq * 0.1f); - p->vel.f[1] -= k * FUN_001f9de0(ang) * (frame_scale_sq * 0.1f); + p->vel.f[1] -= k * fast_sin(ang) * (frame_scale_sq * 0.1f); } break; default: @@ -661,8 +661,8 @@ void FUN_L01_0030d880(struct Moby *m, struct HoverVars *p) { break; } t = &D_L01_001DEB38; - m->rot.x += (FUN_L00_0025e310(t->yaw_speed * D_L01_001620D0) - m->rot.x) * D_L01_001620D8; - m->rot.y += (FUN_L00_0025e310(FUN_001f9af0(&p->vel) * D_L01_001620D4) - m->rot.y) * D_L01_001620DC; + m->rot.x += (normalize_angle(t->yaw_speed * D_L01_001620D0) - m->rot.x) * D_L01_001620D8; + m->rot.y += (normalize_angle(fast_vec_length(&p->vel) * D_L01_001620D4) - m->rot.y) * D_L01_001620DC; } #include "sda.h" @@ -757,7 +757,7 @@ extern void FUN_L00_002323b8(f32, s32, s32); extern void FUN_0022d798(s32); extern s32 FUN_L00_00259028(void *, void *, void *, void *); -extern void FUN_L00_00259fe8(void *, f32); +extern void jet_animate(void *, f32) __asm__("FUN_L00_00259fe8"); extern void FUN_L00_0025f8e0(void *, f32); extern s32 rand(void) __asm__("FUN_001160d8"); extern void FUN_L01_0030dda0_with_vars(char *, char *) __asm__("FUN_L01_0030dda0"); @@ -770,7 +770,8 @@ extern s32 coll_line_fix(void *, void *, s32, void *, s32) __asm__("FUN_001efa68 #define HOVER_S(off) (*(s16 *)(p + (off))) #define HOVER_F(off) (*(f32 *)(p + (off))) #define HOVER_SOUND_VALID ( *(struct Moby **)(D_0013E550 + HOVER_I(0x64) * 0x70 + 0x88) == m && *(u8 *)(D_0013E550 + HOVER_I(0x64) * 0x70 + 0x74) != 0 ) -void FUN_L01_0030df40(struct Moby *m) { +void sandmouse_update(struct Moby *m) __asm__("FUN_L01_0030df40"); +void sandmouse_update(struct Moby *m) { char *p; struct Moby *e; OvlVec4 v, q; @@ -808,7 +809,7 @@ void FUN_L01_0030df40(struct Moby *m) { qzero(p + 0x10); HOVER_S(0x50) = 0; HOVER_S(0x52) = 0; - if (m->prev_seq != 0) blend_moby_animation(m, 0, 0, FUN_001f96f8(10)); + if (m->prev_seq != 0) blend_moby_animation(m, 0, 0, scale_game_frames(10)); m->update_dist = 0xff; m->draw_dist = 0xff; if (HOVER_I(0x48) == -1) { @@ -853,7 +854,7 @@ void FUN_L01_0030df40(struct Moby *m) { *(f32 *)((char *)t + 0xc) = 0.15f; *(f32 *)((char *)t + 0x1c) = rate; } - *(s32 *)((char *)t + 0x48) = FUN_001f96f8(4); + *(s32 *)((char *)t + 0x48) = scale_game_frames(4); *(f32 *)((char *)t + 0x28) = 3.1415927f; m->state = 1; m->draw_dist = 0; @@ -863,9 +864,9 @@ void FUN_L01_0030df40(struct Moby *m) { if (D_0013D4C5 == 0) break; if (*(s32 *)(g + 0x1158) != 5) break; HOVER_I(0x5c) = 0; - HOVER_I(0x58) = FUN_001f96f8(D_L01_00162098); + HOVER_I(0x58) = scale_game_frames(D_L01_00162098); if (m->visible != 0 && (m->anim_flags & 2) && m->prev_seq != 2) - blend_moby_animation(m, 2, 0, FUN_001f96f8(10)); + blend_moby_animation(m, 2, 0, scale_game_frames(10)); if (HOVER_I(0x48) != -1) { n = is_point_inside_clip_volume_b618(&hero.motion.pos, HOVER_I(0x40)) ? 3 : 1; ((struct Moby *)(D_L01_0015FFD8_b618 + HOVER_I(0x48) * 0x100))->command = n; @@ -884,10 +885,10 @@ void FUN_L01_0030df40(struct Moby *m) { if (e != 0 && e->oclass == 0x1b1 && e->state != 0xfe && e->state != 0xfd) e->state = 1; *(struct Moby **)((char *)&D_L01_001DEB38 + 0x50) = m; FUN_L01_0023cf98(0x1f, 0); - FUN_L00_002323b8((f32)FUN_001f96f8(6), 0, 0); + FUN_L00_002323b8((f32)scale_game_frames(6), 0, 0); if (HOVER_I(0x48) == -1) { m->draw_dist = 0xff; - if (m->prev_seq != 0) blend_moby_animation(m, 0, 0, FUN_001f96f8(10)); + if (m->prev_seq != 0) blend_moby_animation(m, 0, 0, scale_game_frames(10)); m->state = 3; } else { ((struct Moby *)(D_L01_0015FFD8_b618 + HOVER_I(0x48) * 0x100))->command = 5; @@ -898,12 +899,12 @@ void FUN_L01_0030df40(struct Moby *m) { if (HOVER_I(0x48) == -1) { HOVER_S(0x52) = 0; m->draw_dist = 0xff; - if (m->prev_seq != 0) blend_moby_animation(m, 0, 0, FUN_001f96f8(20)); + if (m->prev_seq != 0) blend_moby_animation(m, 0, 0, scale_game_frames(20)); if (HOVER_I(0x64) == -1) HOVER_I(0x64) = FUN_0022da68_sound(1, 4, m); m->state = 3; } else { if (((struct Moby *)(D_L01_0015FFD8_b618 + HOVER_I(0x48) * 0x100))->state != 5) break; - if (m->prev_seq != 0) blend_moby_animation(m, 0, 0, FUN_001f96f8(10)); + if (m->prev_seq != 0) blend_moby_animation(m, 0, 0, scale_game_frames(10)); m->state = 3; HOVER_S(0x52) = 0; m->draw_dist = 0xff; @@ -914,7 +915,7 @@ void FUN_L01_0030df40(struct Moby *m) { HOVER_I(0x64) = -1; HOVER_I(0x64) = FUN_0022da68_sound(1, 4, m); } - if (FUN_001f9b80(&m->pos, p + 0x30) > 0.6f && HOVER_S(0x52) == 0) { + if (vector_distance(&m->pos, p + 0x30) > 0.6f && HOVER_S(0x52) == 0) { *(f32 *)((char *)&D_L01_001DEB38 + 4) = 0.7f; FUN_L01_0030d260(m, (f32 *)p); FUN_L01_0030d880(m, (struct HoverVars *)p); @@ -927,13 +928,13 @@ void FUN_L01_0030df40(struct Moby *m) { hit = FUN_L00_00259028(m, &D_L01_001DEB38, p, p + 0x10); } if ((hit & 6) != 0 || distance_xyz_30d308(&m->pos, p) < 0.25f) { - if (m->prev_seq != 2) blend_moby_animation(m, 2, 0, FUN_001f96f8(10)); + if (m->prev_seq != 2) blend_moby_animation(m, 2, 0, scale_game_frames(10)); qzero(p + 0x10); m->state = 4; - HOVER_S(0x52) = FUN_001f96f8(120); + HOVER_S(0x52) = scale_game_frames(120); } if (m->anim_flags & 2) { - if (m->prev_seq != 1) blend_moby_animation(m, 1, 0, FUN_001f96f8(random_integer_between_b618(7, 12))); + if (m->prev_seq != 1) blend_moby_animation(m, 1, 0, scale_game_frames(random_integer_between_b618(7, 12))); m->anim_speed = random_float_between_alt(0.95f, 1.05f); } break; @@ -954,16 +955,16 @@ void FUN_L01_0030df40(struct Moby *m) { HOVER_I(0x64) = FUN_0022da68_sound(1, 4, m); } n = HOVER_S(0x52); - if (n == FUN_001f96f8(20) || D_L01_0016209C - 5 < HOVER_I(0x5c)) { - if (m->prev_seq != 2) blend_moby_animation(m, 2, 0, FUN_001f96f8(5)); + if (n == scale_game_frames(20) || D_L01_0016209C - 5 < HOVER_I(0x5c)) { + if (m->prev_seq != 2) blend_moby_animation(m, 2, 0, scale_game_frames(5)); } else { n = HOVER_S(0x52); - if (FUN_001f96f8(20) < n && (m->anim_flags & 2)) { - if (m->prev_seq != 1) blend_moby_animation(m, 1, 0, FUN_001f96f8(random_integer_between_b618(7, 12))); + if (scale_game_frames(20) < n && (m->anim_flags & 2)) { + if (m->prev_seq != 1) blend_moby_animation(m, 1, 0, scale_game_frames(random_integer_between_b618(7, 12))); m->anim_speed = random_float_between_alt(0.95f, 1.05f); } } - if (*(s32 *)(g + 0x1130) == 0 || *(s32 *)(g + 0x1158) != 5 || hero.state.control_mode == 22 || hero.state.control_mode == 20 || hero.vehicle_mode != 0 || *(s16 *)(D_L01_00167280_lui + 0x86) == 20 || FUN_001f9740(p + 0x58) || D_L01_0016209C <= HOVER_I(0x5c)) { + if (*(s32 *)(g + 0x1130) == 0 || *(s32 *)(g + 0x1158) != 5 || hero.state.control_mode == 22 || hero.state.control_mode == 20 || hero.vehicle_mode != 0 || *(s16 *)(D_L01_00167280_lui + 0x86) == 20 || fast_dec_timer(p + 0x58) || D_L01_0016209C <= HOVER_I(0x5c)) { qzero(p + 0x10); HOVER_S(0x52) = D_L01_001620A4; if (HOVER_I(0x64) != -1 && HOVER_SOUND_VALID) FUN_0022d798(HOVER_I(0x64)); @@ -980,7 +981,7 @@ void FUN_L01_0030df40(struct Moby *m) { case 6: if (HOVER_I(0x64) != -1 && HOVER_SOUND_VALID) FUN_0022d798(HOVER_I(0x64)); HOVER_I(0x64) = -1; - if (FUN_001f9770(p + 0x52)) { + if (fast_dec_timer_s16(p + 0x52)) { m->alpha = 0x80; qcopy(&m->pos, p + 0x30); qcopy(p, p + 0x30); @@ -1013,7 +1014,7 @@ void FUN_L01_0030df40(struct Moby *m) { *(s32 *)((char *)&D_L01_001DEB38 + 0x50) = 0; angle = fast_arc_tan(HOVER_F(0) - m->pos.x, HOVER_F(4) - m->pos.y); FUN_L00_00258278(m, &D_L01_001DEB38.yaw_speed, angle, frame_time_sq * 6.2831855f, frame_time_sq * 3.1415927f, frame_time * 11.519173f); - if (m->prev_seq != 0) blend_moby_animation(m, 0, 0, FUN_001f96f8(6)); + if (m->prev_seq != 0) blend_moby_animation(m, 0, 0, scale_game_frames(6)); ((struct Moby *)(D_L01_0015FFD8_b618 + HOVER_I(0x48) * 0x100))->command = 1; m->state = 1; m->draw_dist = 0; @@ -1022,7 +1023,7 @@ void FUN_L01_0030df40(struct Moby *m) { break; } if (m->state >= 2) { - FUN_L00_00259fe8(m, 0.3f); + jet_animate(m, 0.3f); FUN_L01_0030dda0_with_vars((char *)m, p); } if (HOVER_I(0x48) != -1) { @@ -1343,9 +1344,9 @@ extern f32 approximate_arcsine(f32) __asm__("func_001F9DF8"); extern f32 dot_vectors_xyz(void *, void *) __asm__("func_001F9AB0"); extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); extern float D_L01_001672B0[]; -extern float FUN_L00_001eb328(void *, float, float, float, float, float); +extern float rope_spring_turn(void *, float, float, float, float, float) __asm__("FUN_L00_001eb328"); extern float cam_interp_values(float a, float b, float *p, float c, float d, float e); -extern int FUN_L00_0025d808(void *, void *, int *, float *, float, int); +extern int sample_path(void *, void *, int *, float *, float, int) __asm__("FUN_L00_0025d808"); extern s32 truncate_float_to_s32_c(f32) __asm__("func_001FA6D0"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void build_look_at_matrix(void *out, void *dir, void *axis, f32 ang) __asm__("FUN_00214890"); @@ -1389,7 +1390,7 @@ void FUN_L01_00315358(Cam_316730 *cam) { fraction = ((Hero *)(((char *)((char *)&hero))))->unk568; progress->t = fraction; progress->idx = segment; - FUN_L00_0025d808(D_L01_001B0C30_316730[path_index], camera_goal, &progress->idx, &progress->t, 1.0f, 0); + sample_path(D_L01_001B0C30_316730[path_index], camera_goal, &progress->idx, &progress->t, 1.0f, 0); qcopy(follow->pos, camera_goal); path = D_L01_001B0C30_316730[path_index]; dist = path->nodes[segment].w * (fraction / ((Path_316730 *)((Hero *)(((char *)((char *)&hero))))->unk560)->nodes[segment].w); @@ -1454,7 +1455,7 @@ void FUN_L01_00315358(Cam_316730 *cam) { dist = camera_length * (sum / hero_length); node = func_001FA898_r(pathC->nodes[j].w); node_fraction = 0.0f; - FUN_L00_0025d808(pathA, look_target, &node, &node_fraction, dist, 1); + sample_path(pathA, look_target, &node, &node_fraction, dist, 1); speed_scale = pathC->nodes[j].x; if (speed_scale <= 0.0f) { speed_scale = 0.01f; @@ -1484,7 +1485,7 @@ void FUN_L01_00315358(Cam_316730 *cam) { } else { lead_offset = params->f38; } - FUN_L00_0025d808(path, path_point, &segment, &fraction, lead_offset, 1); + sample_path(path, path_point, &segment, &fraction, lead_offset, 1); qcopy(camera_goal, path_point); } else { int hero_segment; @@ -1492,7 +1493,7 @@ void FUN_L01_00315358(Cam_316730 *cam) { hero_segment = ((Hero *)(((char *)((char *)&hero))))->unk564; hero_fraction = ((Hero *)(((char *)((char *)&hero))))->unk568; - FUN_L00_0025d808((Path_316730 *)((Hero *)(((char *)((char *)&hero))))->unk560, path_point, &hero_segment, &hero_fraction, params->f38, 1); + sample_path((Path_316730 *)((Hero *)(((char *)((char *)&hero))))->unk560, path_point, &hero_segment, &hero_fraction, params->f38, 1); FUN_L00_0025df68(path, path_point, camera_goal, &segment, &fraction, 0, 20.0f, 1.0f, 0.0f); } cam->pos[0] = cam_interp_values(cam->pos[0], camera_goal[0], &data->vel[0], rate, 0.175f, 0.0f); @@ -1504,9 +1505,9 @@ void FUN_L01_00315358(Cam_316730 *cam) { FUN_L00_0025df68(path, ((Hero *)(((char *)((char *)&hero))))->motion.pos.f, look_target, &segment, &fraction, 0, 20.0f, 1.0f, 0.0f); if (D_0015EE84_c == 0xE && params->f30 == 0) { - FUN_L00_0025d808(path, delta, &segment, &fraction, lead, 0); + sample_path(path, delta, &segment, &fraction, lead, 0); } else { - FUN_L00_0025d808(path, delta, &segment, &fraction, lead, 1); + sample_path(path, delta, &segment, &fraction, lead, 1); } subtract_vector_xyz(delta, delta, look_target); add_vector_xyz(look_target, ((Hero *)(((char *)((char *)&hero))))->motion.pos.f, delta); @@ -1516,7 +1517,7 @@ void FUN_L01_00315358(Cam_316730 *cam) { hero_segment = ((Hero *)(((char *)((char *)&hero))))->unk564; hero_fraction = ((Hero *)(((char *)((char *)&hero))))->unk568; - FUN_L00_0025d808((Path_316730 *)((Hero *)(((char *)((char *)&hero))))->unk560, look_target, &hero_segment, &hero_fraction, lead, 1); + sample_path((Path_316730 *)((Hero *)(((char *)((char *)&hero))))->unk560, look_target, &hero_segment, &hero_fraction, lead, 1); } normalize_vector_xyz(look_offset, D_L01_001672B0, follow->f4C); add_vector_xyz(path_point, look_offset, look_target); @@ -1535,7 +1536,7 @@ void FUN_L01_00315358(Cam_316730 *cam) { } else { look->f20 = look->f20 - 0.00015f; } - pitch_step = FUN_L00_001eb328(&look->f34, 0.0f, pitch_error, look->f20, 0.175f, 0.0f); + pitch_step = rope_spring_turn(&look->f34, 0.0f, pitch_error, look->f20, 0.175f, 0.0f); cross_vectors_xyz(delta, look_dir, cam->f40); build_look_at_matrix(cam->f0, cam->f40, delta, pitch_step); normalize_vector_xyz(cam->f40, cam->f0, 1.0f); @@ -1586,10 +1587,10 @@ void FUN_L01_00315de0(Camera *cam) { s32 count = path->count; next = seg + 1; if (next >= count) next = count - 1; - FUN_001f9a28(&delta, &path->pts[next], &path->pts[seg]); - if (FUN_001f9af0(&delta) != 0.0f && next != seg) { + fast_vec_sub(&delta, &path->pts[next], &path->pts[seg]); + if (fast_vec_length(&delta) != 0.0f && next != seg) { fast_vec_normalize(&delta, &delta, 1.0f); - FUN_001f9a28(&to_camera, (char *)cam + 0x30, &D_0013F3D0_315de0); + fast_vec_sub(&to_camera, (char *)cam + 0x30, &D_0013F3D0_315de0); if (0.0f < fast_vec_dot(&to_camera, &delta)) *(s16 *)((char *)s + 0x36) = 1; } @@ -1779,7 +1780,7 @@ void FUN_L01_00319f18(char *moby) { } extern char D_0013E5E0[]; extern char D_L01_00167240[]; -extern int FUN_L00_0028ddd8(int, int, int, int); +extern int play_voice(int, int, int, int) __asm__("FUN_L00_0028ddd8"); extern void release_voice_slot(int) __asm__("FUN_0022d798"); void FUN_L01_0031a078(int a0) { @@ -1792,7 +1793,7 @@ void FUN_L01_0031a078(int a0) { flag = *(int *)(r + 0x8C) == a0 && *(unsigned char *)(r + 0x74) != 0; if (*(int *)(D_L01_00167240 + 0x254) != 0) { if (!flag) { - *(int *)(p + 4) = FUN_L00_0028ddd8(*(int *)p, 0x15, a0, 0x400); + *(int *)(p + 4) = play_voice(*(int *)p, 0x15, a0, 0x400); } } else { if (flag) { @@ -1810,7 +1811,7 @@ void FUN_L01_0031a078(int a0) { /* Ported from rac1-decomp (src/overlays/shared/vendor_0031AD00.c: func_L01_0031B500), where it is exact; names translated to the US level program. */ extern float absolute_float(float) __asm__("func_001F99C0"); -extern void FUN_L01_0027a248(int, int); +extern void jet_game_state(int, int) __asm__("FUN_L01_0027a248"); extern void subtract_vector_xyz(void *, void *, void *); extern void transform_vector_by_basis(void *, void *, void *); @@ -1833,11 +1834,77 @@ void FUN_L01_0031a128(int *moby) { if (s[6] == -1) s[6] = s[7]; if (v[4] > 0) { - FUN_L01_0027a248(p[1], s[7]); + jet_game_state(p[1], s[7]); } else { - FUN_L01_0027a248(p[0], s[6]); + jet_game_state(p[0], s[6]); } p[2] = 0; } } } + +s32 D_L03_001D2C10[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_001D2C14[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_001D2C18[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_001D2C1C[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_001D2C20[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_001D2C34[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001D2C48[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_001D2C4C[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_001D2C50[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_001D2C54[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001D2FB0[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_001D2FB4[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_001D2FB8[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_001D2FBC[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_001D2FC0[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_001D2FD4[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001D2FE8[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_001D2FEC[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_001D2FF0[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_001D2FF4[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001D48C0[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_001D48C4[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_001D48C8[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_001D48CC[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_001D48D0[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_001D48E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001D48F8[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_001D48FC[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_001D4900[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_001D4904[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001DB300[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_001DB304[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_001DB308[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_001DB30C[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_001DB310[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_001DB324[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001DB338[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_001DB33C[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_001DB340[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_001DB344[1] __attribute__((section(".data"))) = {0}; +f32 D_L11_001D3574[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001D3588[1] __attribute__((section(".data"))) = {0}; +f32 D_L11_001D358C[1] __attribute__((section(".data"))) = {0}; +f32 D_L11_001D3590[1] __attribute__((section(".data"))) = {0}; +f32 D_L11_001D3594[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001F5B60[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_001F5B64[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_001F5B68[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_001F5B6C[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_001F5B70[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_001F5B84[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001F5B98[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_001F5B9C[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_001F5BA0[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_001F5BA4[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001DFB50[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_001DFB54[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_001DFB58[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_001DFB5C[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_001DFB60[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_001DFB74[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001DFB88[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_001DFB8C[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_001DFB90[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_001DFB94[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/scoutbot.c b/src/overlays/shared/gameplay/entities/scoutbot.c index fce807307b..c8c1d68f60 100644 --- a/src/overlays/shared/gameplay/entities/scoutbot.c +++ b/src/overlays/shared/gameplay/entities/scoutbot.c @@ -60,7 +60,7 @@ extern f32 random_angle_radians(void) __asm__("func_00213308"); extern f32 random_float_between_c(f32, f32) __asm__("func_002132A8"); extern float D_0015ED6C; extern float D_0015ED70; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("func_001FA688"); extern float probe_ground_height(void *, int, float) __asm__("func_00213508"); @@ -70,7 +70,7 @@ extern int FUN_L00_002dc9f0(); extern s32 allocate_voice_for_target_entry() __asm__("func_0022DA68"); extern s32 truncate_float_to_s32_c(f32) __asm__("func_001FA6D0"); extern short D_L08_00161888 __attribute__((sda)); -extern void FUN_L00_00259bc8(void *, int, int, void *, void *, float); +extern void spawn_nearby_effect(void *, int, int, void *, void *, float) __asm__("FUN_L00_00259bc8"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void blend_moby_animation_c(void *, s32, s32, s32) __asm__("FUN_00212f90"); extern void clear_u64_value(void *) __asm__("func_001F99F8"); @@ -78,11 +78,11 @@ extern void enqueue_callback_list_1(void *, void *) __asm__("FUN_001f4600"); extern void mark_moby_for_removal(void *) __asm__("func_0020C828"); f32 compute_interpolated_record_value(void *anim) __asm__("FUN_0020c9e0"); float absolute_float(float input) __asm__("func_001F99C0"); -int FUN_L00_0028d8c0(int a, int i); +int voice_is_playing(int a, int i) __asm__("FUN_L00_0028d8c0"); s32 is_value_within_interpolated_window(void *anim, f32 value) __asm__("FUN_00214cc8"); void FUN_L00_00258278(unsigned char *m, float *ptr, float t, float b, float c, float limit); void FUN_L00_0025a120(char *o); -void FUN_L00_0025e450(f32 burst, f32 unused_float, f32 owner_effect, f32 owner_effect2, f32 cutoff, f32 scale, f32 flash, void *owner, s32 unused2, void *pos, s32 puff_count, s32 spark_count, s32 shard_count, s32 sound, s32 shake, s32 spray_count, s32 tint, u8 alternate); +void spawn_explosion(f32 burst, f32 unused_float, f32 owner_effect, f32 owner_effect2, f32 cutoff, f32 scale, f32 flash, void *owner, s32 unused2, void *pos, s32 puff_count, s32 spark_count, s32 shard_count, s32 sound, s32 shake, s32 spray_count, s32 tint, u8 alternate) __asm__("FUN_L00_0025e450"); void FUN_L00_00263ac8(float x, int a, int b, unsigned char *p); void FUN_L08_002d36e0_c(char *m) __asm__("FUN_L08_002d36e0"); void FUN_L08_002d3878(char *m); @@ -111,18 +111,19 @@ extern void draw_3DF8(void *, void *) __asm__("FUN_001f4600"); extern int animdone_3DF8(void *, float) __asm__("FUN_00214cc8"); extern void shoot_3DF8(void *, void *, int, void *, void *, float) __asm__("FUN_L00_00259bc8"); extern int sound_busy_3DF8(void *, int) __asm__("FUN_L00_0028d8c0"); -extern int hitreact_3DF8(void *, void *) __asm__("FUN_L00_002dc9f0"); +extern int FUN_L00_002dc9f0(void *, void *); extern void explode_3DF8(void *, void *, void *, float, float, int, int, int, float, float, float, int, float, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void delete_3DF8(void *) __asm__("FUN_0020c828"); extern int colorlerp_3DF8(int, int, float) __asm__("FUN_001fa6e0"); extern void joint_3DF8(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern void glow_3DF8() __asm__("FUN_L08_002d3878"); -extern void body_3DF8() __asm__("FUN_L08_002d4108"); +extern void FUN_L08_002d3878(); +extern void FUN_L08_002d4108(); extern char hero_pos_3DF8[] __asm__("D_L08_001675C0"); extern float frame_3DF8 __asm__("D_0015ED6C"); extern float dt_3DF8 __asm__("D_0015ED70"); -void FUN_L08_002d2af0(Moby *moby) { +void scoutbot_update(Moby *moby) __asm__("FUN_L08_002d2af0"); +void scoutbot_update(Moby *moby) { Data_3DF8 *data = (struct Data_3DF8 *)moby->pvars; float target_pos[4]; float offset[4]; @@ -261,7 +262,7 @@ void FUN_L08_002d2af0(Moby *moby) { data->glow_a[2] = sine_3DF8(spin) * 0.25f * charge; data->glow_b[1] = cosine_3DF8(spin) * 0.25f * charge; data->glow_b[2] = sine_3DF8(spin) * 0.25f * charge; - draw_3DF8(glow_3DF8, moby); + draw_3DF8(FUN_L08_002d3878, moby); } if (animdone_3DF8(moby, 14.0f)) { if (fast_distance_3DF8(&data->target->pos, &moby->pos) < 3.0f && fabs_3DF8(data->current_target->pos.z - moby->pos.z) < 1.0f) { @@ -294,7 +295,7 @@ void FUN_L08_002d2af0(Moby *moby) { break; } case 5: - if (hitreact_3DF8(moby, data->react)) { + if (FUN_L00_002dc9f0(moby, data->react)) { data->f200 = 4.0f; data->f208 = 0.5f; if (moby->prev_seq != 2) { @@ -320,7 +321,7 @@ void FUN_L08_002d2af0(Moby *moby) { } moby->glow_color = colorlerp_3DF8(moby->glow_color, col, 0.1f); joint_3DF8(moby, 3, data->f220); - draw_3DF8(body_3DF8, moby); + draw_3DF8(FUN_L08_002d4108, moby); } } /* Takes hits (dying at 0 health), then follows the moby's path and gives up on it when too far off. */ @@ -328,7 +329,7 @@ void FUN_L08_002d2af0(Moby *moby) { extern char *D_L08_001B0CB0[]; extern char *find_moby_hit(void *, int, int) __asm__("FUN_L00_0025a420"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern int hit_reaction(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_L00_0025a478"); extern int FUN_L00_0025ff38(); extern void FUN_L00_00257470(void *, int, int); @@ -358,7 +359,7 @@ void FUN_L08_002d36e0(char *m) { if (((unsigned char *)m)[0x20] != 0 && ((unsigned char *)m)[0x20] != 4) { char *e = D_L08_001B0CB0[*(int *)(d + 0x21C)]; if (func_L00_00260FB0_f(m, d + 0x170, 14.0f, 0, 0, e + 0x10, *(int *)e) != 2) { - if (14.0f < FUN_001f9b80(d + 0x1C0, d + 0x170)) { + if (14.0f < vector_distance(d + 0x1C0, d + 0x170)) { *(int *)(d + 0x1B4) = 2; } else if (3.0f < absolute_float(*(float *)(d + 0x1C8) - *(float *)(d + 0x178))) { *(int *)(d + 0x1B4) = 2; @@ -391,6 +392,7 @@ extern u32 D_00151878_002d3878 __asm__("D_00151878") __attribute__((sda)); extern u32 D_0015187C_002d3878 __asm__("D_0015187C") __attribute__((sda)); extern u32 D_00151880_002d3878 __asm__("D_00151880") __attribute__((sda)); extern u32 D_00151884_002d3878 __asm__("D_00151884") __attribute__((sda)); +void FUN_L08_002d3878(char *moby); void FUN_L08_002d3878(char *moby) { char *data = *(char **)(moby + 0x78); Packet_002d3878 pk; @@ -598,6 +600,7 @@ void FUN_001f7d30_002d4108(void *, s32, s32) __asm__("FUN_001f7d30"); extern float D_L08_001D1D80[4][4] __attribute__((section(".data"))); extern float D_L08_00161898 __attribute__((sda)); extern float D_L08_0016189C __attribute__((sda)); +void FUN_L08_002d4108(char *arg); void FUN_L08_002d4108(char *arg) { char *data = *(char **)(arg + 0x78); Pk_002d4108 pk; @@ -657,7 +660,7 @@ extern void add_vector_xyz_002e7eb0(void *, void *, void *) __asm__("FUN_001f9a1 extern int random_integer_002e7eb0(int, int) __asm__("FUN_L00_00257b90"); extern void *spawn_particle_002e7eb0(void *, void *, int, int, int, int, float) __asm__("FUN_L00_0026cbb0"); extern int truncate_float_to_s32_002e7eb0(float) __asm__("FUN_001fa6d0"); -extern float scale_game_frames_002e7eb0(float) __asm__("FUN_L08_00211a20"); +extern float FUN_L08_00211a20(float); extern int scale_game_frames_int_002e7eb0(int) __asm__("FUN_001f96f8"); extern void FUN_00218888_002e7eb0(void *, void *, void *, int, int, int, int, int, int) __asm__("FUN_00218888"); extern int D_L08_0015F5CC __asm__("D_L08_0015F5CC"); @@ -736,16 +739,16 @@ char *FUN_L08_002e7eb0(int owner, float *position, float *rotation, int value) { i++; spawn_particle_002e7eb0(moby + 0x10, velocity_ptr, D_L08_00161CF8, D_L08_00161CFC, random_integer_002e7eb0(scale_game_frames_int_002e7eb0(10), scale_game_frames_int_002e7eb0(20)), 1, 20000.0f); - a = truncate_float_to_s32_002e7eb0(scale_game_frames_002e7eb0(random_float_between_002e7eb0((float)D_L08_00161D08_gp, (float)D_L08_00161D08_gp * 1.2f))); - b = truncate_float_to_s32_002e7eb0(scale_game_frames_002e7eb0(random_float_between_002e7eb0((float)D_L08_00161D0C_gp, (float)D_L08_00161D0C_gp * 1.2f))); - c = truncate_float_to_s32_002e7eb0(scale_game_frames_002e7eb0(random_float_between_002e7eb0((float)D_L08_00161D10_gp, (float)D_L08_00161D10_gp * 1.5f))); + a = truncate_float_to_s32_002e7eb0(FUN_L08_00211a20(random_float_between_002e7eb0((float)D_L08_00161D08_gp, (float)D_L08_00161D08_gp * 1.2f))); + b = truncate_float_to_s32_002e7eb0(FUN_L08_00211a20(random_float_between_002e7eb0((float)D_L08_00161D0C_gp, (float)D_L08_00161D0C_gp * 1.2f))); + c = truncate_float_to_s32_002e7eb0(FUN_L08_00211a20(random_float_between_002e7eb0((float)D_L08_00161D10_gp, (float)D_L08_00161D10_gp * 1.5f))); FUN_00218888_002e7eb0(moby + 0x10, velocity_ptr, offset_ptr, D_L08_00161CF0, D_L08_00161CF4, a, b, c, -1); } while ((float)i < D_L08_00161CE0); } if (current_level_index == 12) *(int *)(data + 0x18) = scale_game_frames_int_002e7eb0(120); else - *(int *)(data + 0x18) = truncate_float_to_s32_002e7eb0(scale_game_frames_002e7eb0(D_L08_00161CD8)); + *(int *)(data + 0x18) = truncate_float_to_s32_002e7eb0(FUN_L08_00211a20(D_L08_00161CD8)); update_moby_002e7eb0(moby); } return moby; @@ -780,6 +783,7 @@ extern float D_L08_00161D20 __attribute__((sda)); typedef struct { unsigned int words[4]; } Vec_002e8210 __attribute__((aligned(16))); extern float D_L08_00174660[4]; +void FUN_L08_002e8210(char *moby); void FUN_L08_002e8210(char *moby) { char *position_ptr = moby + 0x10; char *data = *(char **)(moby + 0x78); @@ -955,7 +959,7 @@ void FUN_L08_002f0f68(int **tabs, int n, int *counts, int flat, float r, float g /* Ported from rac1-decomp (src/overlays/shared/vendor_002D3DF8.c: func_L08_002F2618), where it is exact; names translated to the US level program. */ extern float frame_delta_time __asm__("D_0015ED7C"); -extern float FUN_001f9de0(float); +extern float fast_sin(float) __asm__("FUN_001f9de0"); void FUN_L08_002f1158(float *out, float *ph, float a, float b, float scale) { ph[0] += a * frame_delta_time; @@ -972,8 +976,8 @@ void FUN_L08_002f1158(float *out, float *ph, float a, float b, float scale) { if (ph[1] < -1.0f) { ph[1] += 2.0f; } - out[0] = FUN_001f9de0(ph[0] * 3.1415927f) * scale; - out[1] = FUN_001f9de0(ph[1] * 3.1415927f) * scale; + out[0] = fast_sin(ph[0] * 3.1415927f) * scale; + out[1] = fast_sin(ph[1] * 3.1415927f) * scale; } typedef struct { float x; @@ -1021,8 +1025,8 @@ void FUN_L08_002f1378(int i) { extern int fast_dec_timer(int *) __asm__("FUN_001f9740"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern float random_float_between(float, float) __asm__("FUN_002132a8"); -extern void FUN_001f9bf8(void *, void *, float); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); extern void spawn_spark(void *, void *, void *, int, int, int, int, int, int) __asm__("FUN_00218888"); @@ -1058,16 +1062,16 @@ void FUN_L08_002f5830(char *m) { c[1] += random_float_between(-0.05f, 0.05f); c[0] += random_float_between(-0.05f, 0.05f); random_float_between(-0.17453292f, 0.17453292f); - FUN_001f9bf8(v0, e, + fast_vec_normalize(v0, e, random_float_between(D_L08_00161F80, D_L08_00161F80 * 1.2f) * frame_time); - FUN_001f9bf8(d, e + 4, random_float_between(-D_L08_00161FA4, D_L08_00161FA4) * frame_time); - FUN_001f9a10(v0, v0, d); + fast_vec_normalize(d, e + 4, random_float_between(-D_L08_00161FA4, D_L08_00161FA4) * frame_time); + fast_vec_add(v0, v0, d); v0[2] += random_float_between(D_L08_00161F7C, D_L08_00161F7C * 1.2f) * frame_time; qcopy(v1, v0); - FUN_001f9bf8(v1, e, + fast_vec_normalize(v1, e, random_float_between(D_L08_00161F88, D_L08_00161F88 * 1.5f) * frame_time); - FUN_001f9bf8(d, e + 4, random_float_between(-D_L08_00161FA8, D_L08_00161FA8) * frame_time); - FUN_001f9a10(v1, v1, d); + fast_vec_normalize(d, e + 4, random_float_between(-D_L08_00161FA8, D_L08_00161FA8) * frame_time); + fast_vec_add(v1, v1, d); v1[2] += random_float_between(D_L08_00161F84, D_L08_00161F84 * 1.5f) * frame_time; v0[3] = D_L08_00161F9C; v1[3] = D_L08_00161FA0; @@ -1086,20 +1090,20 @@ void FUN_L08_002f5830(char *m) { c[1] += random_float_between(-0.05f, 0.05f); c[2] += random_float_between(-0.05f, 0.05f); random_float_between(-0.17453292f, 0.17453292f); - FUN_001f9bf8(v0, e, + fast_vec_normalize(v0, e, random_float_between(*(f32 *)(v + 0x18), *(f32 *)(v + 0x18) * 1.2f) * frame_time); - FUN_001f9bf8(d, e + 4, + fast_vec_normalize(d, e + 4, random_float_between(-*(f32 *)(v + 0x30), *(f32 *)(v + 0x30)) * frame_time); - FUN_001f9a10(v0, v0, d); + fast_vec_add(v0, v0, d); v0[2] += random_float_between(*(f32 *)(v + 0x1C), *(f32 *)(v + 0x1C) * 1.2f) * frame_time; qcopy(v1, v0); - FUN_001f9bf8(v1, e, + fast_vec_normalize(v1, e, random_float_between(*(f32 *)(v + 0x20), *(f32 *)(v + 0x20) * 1.5f) * frame_time); - FUN_001f9bf8(d, e + 4, + fast_vec_normalize(d, e + 4, random_float_between(-*(f32 *)(v + 0x34), *(f32 *)(v + 0x34)) * frame_time); - FUN_001f9a10(v1, v1, d); + fast_vec_add(v1, v1, d); v1[2] += random_float_between(*(f32 *)(v + 0x24), *(f32 *)(v + 0x24) * 1.5f) * frame_time; v0[3] = *(f32 *)(v + 0x28); v1[3] = *(f32 *)(v + 0x2C); @@ -1179,7 +1183,7 @@ extern float D_L08_0015F5D0; extern float D_L08_0015F5D4; extern int coll_line_fix(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int lerp_vector() __asm__("FUN_001f9a40"); -extern int FUN_L00_001f2868(); +extern int collect_mobies_in_sphere() __asm__("FUN_L00_001f2868"); extern int FUN_L00_00257b90(int, int); extern int FUN_L00_00259888(); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); @@ -1188,15 +1192,15 @@ extern s32 rand(void); extern s32 random_integer_below(s32) __asm__("func_00213260"); extern s32 truncate_float_to_s32_c2(f32) __asm__("func_001FA6D0"); extern void DebugPrint(char *, ...); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void blend_moby_animation_c2(void *, s32, s32, s32) __asm__("FUN_00212f90"); extern void normalize_vector_xyz_c(void *, void *, f32) __asm__("FUN_001f9bf8"); extern void subtract_vector_xyz_c(void *, void *, void *) __asm__("FUN_001f9a28"); f32 compute_interpolated_record_value(void *anim) __asm__("FUN_0020c9e0"); -float FUN_L00_0025be00(float *cur, float *vel, float target, float lim, float accel, float maxv); +float approach_angle(float *cur, float *vel, float target, float lim, float accel, float maxv) __asm__("FUN_L00_0025be00"); int FUN_L00_00258830(char *m, char *v, int flags, float a, float b, float c); int FUN_L00_00259028(unsigned char *m, char *c, float *tgt, void *out); -int FUN_L00_0025c698(void *moby, void *motion); +int mine_fall(void *moby, void *motion) __asm__("FUN_L00_0025c698"); int FUN_L01_0028b510(void *arg0, void *arg1, float target); void *FUN_L00_00263fd8(char *src, int cls, float *pos, void *mat, int a8, int a9, float *v10, float *v11, float scale, float *v12); void FUN_L00_0025a120(char *o); @@ -1226,14 +1230,14 @@ extern float angle302618(float, float) __asm__("FUN_001f9e90"); extern float turn302618(void *, float, void *, float, float, float) __asm__("FUN_L00_0025be00"); extern void animate302618(void *, int, int, int) __asm__("FUN_00212f90"); extern void delete302618(void *) __asm__("FUN_0020c828"); -extern void helper302618(void *) __asm__("FUN_L08_003024d8"); -extern void sound302618(float, void *, int, void *) __asm__("FUN_L00_00263ac8"); -extern void wake302618(void *) __asm__("FUN_L00_0025a120"); +extern void FUN_L08_003024d8_c(void *) __asm__("FUN_L08_003024d8"); +extern void FUN_L00_00263ac8_c(float, void *, int, void *) __asm__("FUN_L00_00263ac8"); +extern void FUN_L00_0025a120_c(void *) __asm__("FUN_L00_0025a120"); extern int hero_anim302618(int) __asm__("FUN_00213260"); extern void log302618(char *, int) __asm__("FUN_001e93b0"); -extern void steering_init302618(void *) __asm__("FUN_L01_0026d930"); -extern int closest302618(void *, void *, float) __asm__("FUN_L01_0028b510"); -extern void steer302618(void *, void *, void *, void *) __asm__("FUN_L00_00259028"); +extern void FUN_L01_0026d930_c(void *) __asm__("FUN_L01_0026d930"); +extern int FUN_L01_0028b510(void *, void *, float); +extern void FUN_L00_00259028_c(void *, void *, void *, void *) __asm__("FUN_L00_00259028"); extern int range302618(int, int) __asm__("FUN_L00_00257b90"); extern void subtract302618(void *, void *, void *) __asm__("FUN_001f9a28"); extern float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); @@ -1245,20 +1249,21 @@ extern float scale_float302618(float) __asm__("FUN_001f96b0"); extern void joint302618(void *, int, void *) __asm__("FUN_L00_0024f7c8"); extern float sine302618(float) __asm__("FUN_001f9dc8"); extern float cosine302618(float) __asm__("FUN_001f9de0"); -extern char *projectile302618(void *, void *, void *, void *, int, int) __asm__("FUN_L08_00307190"); -extern void vec_limit302618(void *, float) __asm__("FUN_L00_0025f730"); -extern void push302618(void *, void *, float, float, float, int) __asm__("FUN_L00_00258830"); +extern char *FUN_L08_00307190_c(void *, void *, void *, void *, int, int) __asm__("FUN_L08_00307190"); +extern void FUN_L00_0025f730(void *, float); +extern void FUN_L00_00258830_c(void *, void *, float, float, float, int) __asm__("FUN_L00_00258830"); extern void vec_scale302618(void *, void *, float) __asm__("FUN_001f9bf8"); extern void hit_init302618(void *, void *, int, float, void *) __asm__("FUN_L00_00259888"); extern int damage302618(float, void *, int, void *, void *) __asm__("FUN_L00_001f2868"); extern int dying302618(void *, void *) __asm__("FUN_L00_0025c698"); extern void zero302618(void *) __asm__("FUN_001f99f8"); -extern void explode302618(void *, int, int) __asm__("FUN_L00_00257470"); +extern void FUN_L00_00257470(void *, int, int); extern void effect302618(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); -extern void *debris302618(void *, int, void *, void *, int, int, float, void *, void *, void *) __asm__("FUN_L00_00263fd8"); +extern void *FUN_L00_00263fd8_c(void *, int, void *, void *, int, int, float, void *, void *, void *) __asm__("FUN_L00_00263fd8"); extern char D_L08_001FC600[]; -void FUN_L08_00301158(char *moby) { +void blarg_paratrooper_update(char *moby) __asm__("FUN_L08_00301158"); +void blarg_paratrooper_update(char *moby) { Paratrooper302618 *data = (Paratrooper302618 *)(*(char * *)((char *)(moby)+0x78)); char *path; char *target; @@ -1267,14 +1272,14 @@ void FUN_L08_00301158(char *moby) { float dir[4] __attribute__((aligned(16))); char hit[0x30] __attribute__((aligned(16))); if ((*(unsigned char *)((char *)(moby)+0x31)) == 0 && distance302618(moby+0x10,D_L08_001675C0)>40.0f) return; - sound302618(2.5f,moby,6,(char *)data+0x170); + FUN_L00_00263ac8_c(2.5f,moby,6,(char *)data+0x170); if ((*(unsigned char *)((char *)(moby)+0x31)) != 0 && distance302618(moby+0x10,D_L08_001675C0)<29.0f) { - wake302618(moby); + FUN_L00_0025a120_c(moby); (*(unsigned char *)((char *)(moby)+0x7F))=23; } if (level_game_mode == 2) return; path=0; - helper302618(moby); + FUN_L08_003024d8_c(moby); target = data->f160; if(data->f1FC!=-1) path=D_L08_001B0CB0[data->f1FC]; hero=(Hero302618 *)(((char *)&D_0013F350)); @@ -1298,7 +1303,7 @@ void FUN_L08_00301158(char *moby) { data->f5A=randomf302618(12.0f); if(data->f1D0==-1) { log302618(D_L08_001FC600,(*(short *)((char *)(moby)+0xB2))); goto delete_moby; } if(data->f1D4==-1) { log302618(D_L08_001FC630,(*(short *)((char *)(moby)+0xB2))); goto delete_moby; } - steering_init302618((char *)data+0xD0); + FUN_L01_0026d930_c((char *)data+0xD0); data->fDC=0.5f; data->fD8=0.5f; data->fD0=randomf302618(512.0f); turn_rate=D_0015ED70*6.981317f; @@ -1311,7 +1316,7 @@ void FUN_L08_00301158(char *moby) { int index; short direction; data->f20C=2*(random302618()&1)-1; - index=closest302618(moby+0x10,path,0.0f)+data->f20C; + index=FUN_L01_0028b510(moby+0x10,path,0.0f)+data->f20C; direction=data->f20C; data->f1F4=index; if(index>=(*(int *)((char *)(path)+0))||index<0) { @@ -1335,20 +1340,20 @@ void FUN_L08_00301158(char *moby) { data->f1F4=index+2*data->f20C; } } - steer302618(moby,(char *)data+0xD0,path+0x10+data->f1F4*16,pos); + FUN_L00_00259028_c(moby,(char *)data+0xD0,path+0x10+data->f1F4*16,pos); if(target && data->f164!=2 && timer302618((char *)data+0x1F0)) { - data->f1F4=closest302618(moby+0x10,D_L08_001B0CB0[data->f1D4],0.0f); + data->f1F4=FUN_L01_0028b510(moby+0x10,D_L08_001B0CB0[data->f1D4],0.0f); (*(unsigned char *)((char *)(moby)+0x20))=2; } break; case 2: { float distance; - data->f1F4=closest302618(moby+0x10,D_L08_001B0CB0[data->f1D4],0.0f); + data->f1F4=FUN_L01_0028b510(moby+0x10,D_L08_001B0CB0[data->f1D4],0.0f); distance=fast_distance302618(moby+0x10,D_L08_001B0CB0[data->f1D4]+0x10+data->f1F4*16); if(distance<1.0f || distancefE0) { data->fE0=0.0f; (*(unsigned char *)((char *)(moby)+0x20))=3; } else { - steer302618(moby,(char *)data+0xD0,D_L08_001B0CB0[data->f1D4]+0x10+data->f1F4*16,pos); + FUN_L00_00259028_c(moby,(char *)data+0xD0,D_L08_001B0CB0[data->f1D4]+0x10+data->f1F4*16,pos); if((*(unsigned char *)((char *)(moby)+0x53))!=2) animate302618(moby,2,0,random302618()%4+7); } break; @@ -1443,7 +1448,7 @@ void FUN_L08_00301158(char *moby) { dir[1]=cosine302618((*(float *)((char *)(moby)+0x48)))*(speed302618*D_0015ED6C); dir[2]=0.0f; dir[2]=(-1.0f/data->f1E8)*(speed302618*D_0015ED6C); - shot=projectile302618(dir,pos,moby,target,scale302618(180),data->f20E); + shot=FUN_L08_00307190_c(dir,pos,moby,target,scale302618(180),data->f20E); if(shot) (*(float *)((char *)(shot)+0x2C))*=1.7f; } data->f20E=(*(unsigned short *)&data->f20E)+1; @@ -1469,8 +1474,8 @@ void FUN_L08_00301158(char *moby) { frame=animframe302618(moby); if(frame>12.0f && frame<23.0f && (*(float *)((char *)(moby)+0x54))==0.0f) { subtract302618(pos,D_L08_001B0CB0[data->f1D4]+0x10,moby+0x10); - vec_limit302618(pos,D_0015ED6C*24.0f); - push302618(moby,pos,shove302618,shove_rate302618,0.0f,0); + FUN_L00_0025f730(pos,D_0015ED6C*24.0f); + FUN_L00_00258830_c(moby,pos,shove302618,shove_rate302618,0.0f,0); } else if((*(unsigned char *)((char *)(moby)+0x70))&2) { data->f1F0=randomf302618(scale_float302618(rangef302618(45.0f,90.0f))); (*(unsigned char *)((char *)(moby)+0x20))=3; @@ -1533,12 +1538,12 @@ void FUN_L08_00301158(char *moby) { char *rotation; zero302618(pos); color=D_L08_0015F580; - explode302618(moby,0,-1); + FUN_L00_00257470(moby,0,-1); effect302618(moby,moby+0x10,0,0.5f,13.0f); rotation=moby+0x40; - debris302618(moby,0x69C,moby+0x10,rotation,0,0,0.0f,color,color,color); - debris302618(moby,0x69D,moby+0x10,rotation,0,0,0.0f,color,color,color); - debris302618(moby,0x69E,moby+0x10,rotation,0,0,0.0f,color,color,color); + FUN_L00_00263fd8_c(moby,0x69C,moby+0x10,rotation,0,0,0.0f,color,color,color); + FUN_L00_00263fd8_c(moby,0x69D,moby+0x10,rotation,0,0,0.0f,color,color,color); + FUN_L00_00263fd8_c(moby,0x69E,moby+0x10,rotation,0,0,0.0f,color,color,color); delete302618(moby); if(data->f1F8) delete302618(data->f1F8); } @@ -1557,7 +1562,7 @@ extern int hit_3024d8(void *, void *, void *, int, int *, float *, int, int) __a extern int truncate_3024d8(float) __asm__("FUN_001fa6d0"); extern void set_knockback_3024d8(void *, void *, float *, float *) __asm__("FUN_L00_0025ab48"); extern void start_knockback_3024d8(float, void *, void *, int, int, int) __asm__("FUN_L00_0025c558"); -extern void play_reaction_3024d8(void *, int, int, int, int) __asm__("FUN_L00_00260a88"); +extern void FUN_L00_00260a88(void *, int, int, int, int); extern void update_animation_3024d8(void *, void *) __asm__("FUN_L00_0025d458"); extern void finish_animation_3024d8(void *, void *) __asm__("FUN_L00_0025d538"); extern int tick_countdown_16_3024d8(short *) __asm__("FUN_001f9770"); @@ -1680,7 +1685,7 @@ void FUN_L08_003024d8(char *m) { start_knockback_3024d8(knock_angle, m, d + 0x70, 12, 1, 0); m[0x20] = 11; ((unsigned char *)d)[0x67] = 0xf0; - play_reaction_3024d8(m, 2, 3, 0, -1); + FUN_L00_00260a88(m, 2, 3, 0, -1); break; } } diff --git a/src/overlays/shared/gameplay/entities/seeker.c b/src/overlays/shared/gameplay/entities/seeker.c index 1db9ea00a7..d4e86597aa 100644 --- a/src/overlays/shared/gameplay/entities/seeker.c +++ b/src/overlays/shared/gameplay/entities/seeker.c @@ -60,8 +60,8 @@ extern void clear_vector(Vec4 *) __asm__("FUN_001f99f8"); extern f32 FUN_001f9af0(Vec4 *); extern f32 FUN_001f9b48(void *, void *); extern f32 vector_distance_xy(void *, void *) __asm__("FUN_001f9b80"); -extern f32 FUN_001f9dc8(f32); -extern f32 FUN_001f9de0(f32); +extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); +extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern void mark_moby_for_removal(struct Moby *) __asm__("FUN_0020c828"); @@ -75,17 +75,18 @@ extern void FUN_L00_00257470(struct Moby *, s32, s32); extern s32 FUN_L00_00257b90(s32, s32); extern void FUN_L00_00258830(struct Moby *, Vec4 *, s32, f32, f32, f32); extern void FUN_L00_0025a120(struct Moby *); -extern void FUN_L00_0025be00(f32 *, f32, f32 *, f32, f32, f32); -extern s32 FUN_L00_0025c698(struct Moby *, Vec4 *); -extern void FUN_L00_0025e450(struct Moby *, Vec4 *, void *, s32, f32, f32, f32, f32, f32, f32, f32, s32, - s32, s32, s32, s32, s32, s32); -extern void FUN_L00_0025f090(struct Moby *, void *, s32, f32, f32); +extern void approach_angle(f32 *, f32, f32 *, f32, f32, f32) __asm__("FUN_L00_0025be00"); +extern s32 mine_fall(struct Moby *, Vec4 *) __asm__("FUN_L00_0025c698"); +extern void spawn_explosion(struct Moby *, Vec4 *, void *, s32, f32, f32, f32, f32, f32, f32, f32, s32, + s32, s32, s32, s32, s32, s32) __asm__("FUN_L00_0025e450"); +extern void cart_burst(struct Moby *, void *, s32, f32, f32) __asm__("FUN_L00_0025f090"); extern void FUN_L00_00263ac8(struct Moby *, s32, void *, f32); extern void FUN_L01_0026d930(void *); extern void FUN_L01_0026e090(s32, s32); extern void FUN_L09_002c6230_u(struct Moby *) __asm__("FUN_L09_002c6230"); -void FUN_L09_002c5990(struct Moby *moby) { +void seeker_update(struct Moby *moby) __asm__("FUN_L09_002c5990"); +void seeker_update(struct Moby *moby) { Moby52Vars *vars = (Moby52Vars *)moby->pvars; struct Moby *target; Vec4 vel; @@ -134,7 +135,7 @@ void FUN_L09_002c5990(struct Moby *moby) { break; case 1: moby->pos.z += (probe_ground_height(&moby->pos, 0, 0.5f) + 0.5f - moby->pos.z) * 0.1f; - FUN_L00_0025be00(&moby->rot.z, + approach_angle(&moby->rot.z, fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), &vars->heading_speed, frame_time_sq * 8.726646f, frame_time_sq * 8.726646f, frame_time * 12.566371f); @@ -180,7 +181,7 @@ void FUN_L09_002c5990(struct Moby *moby) { case 2: case 4: z = moby->pos.z; - FUN_L00_0025be00(&moby->rot.z, + approach_angle(&moby->rot.z, fast_arc_tan(target->pos.x - moby->pos.x, target->pos.y - moby->pos.y), &vars->heading_speed, frame_time_sq * 8.726646f, frame_time_sq * 8.726646f, frame_time * 12.566371f); @@ -192,8 +193,8 @@ void FUN_L09_002c5990(struct Moby *moby) { vars->moving = 0; } if (vars->moving != 0) { - vel.f[0] = FUN_001f9dc8(moby->rot.z) * vars->speed; - vel.f[1] = FUN_001f9de0(moby->rot.z) * vars->speed; + vel.f[0] = fast_cos(moby->rot.z) * vars->speed; + vel.f[1] = fast_sin(moby->rot.z) * vars->speed; vel.f[2] = 0.0f; diff = hero.motion.pos.f[2] + 0.8f - z; if (moby->pos.z < hero.motion.pos.f[2] + 0.8f) { @@ -241,7 +242,7 @@ void FUN_L09_002c5990(struct Moby *moby) { break; case 5: height = moby->pos.z; - FUN_L00_0025c698(moby, &vars->vel); + mine_fall(moby, &vars->vel); moby->pos.z = height; vars->vel.f[2] = 0.0f; if (FUN_001f9af0(&vars->vel) < frame_time * 2.0f) { @@ -264,8 +265,8 @@ void FUN_L09_002c5990(struct Moby *moby) { } } vars->voice = -1; - if (FUN_L00_0025c698(moby, &vars->vel) & 0x121) { - FUN_L00_0025f090(moby, &moby->pos, 0, 0.5f, 13.0f); + if (mine_fall(moby, &vars->vel) & 0x121) { + cart_burst(moby, &moby->pos, 0, 0.5f, 13.0f); mark_moby_for_removal(moby); } break; @@ -280,7 +281,7 @@ void FUN_L09_002c5990(struct Moby *moby) { } vars->voice = -1; clear_vector(&vel); - FUN_L00_0025e450(moby, &vel, &moby->pos, 10, 2.0f, 1.0f, 4.0f, 2.0f, 9.0f, 1.0f, 15.0f, 3, 0x10, + spawn_explosion(moby, &vel, &moby->pos, 10, 2.0f, 1.0f, 4.0f, 2.0f, 9.0f, 1.0f, 15.0f, 3, 0x10, 0, 0, 0, -1, 0); mark_moby_for_removal(moby); break; @@ -332,14 +333,14 @@ extern s32 allocate_voice_for_target_entry_alt(s32, s32, struct Moby *) __asm__( extern s32 random_integer_below(s32) __asm__("func_00213260"); extern s32 truncate_float_to_s32_c(f32) __asm__("func_001FA6D0"); extern void FUN_L00_00257470_c(void *, int, int) __asm__("FUN_L00_00257470"); -extern void FUN_L00_0025d458(void *m, short *p); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *m, short *p) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern void tick_countdown_32(s32 *) __asm__("func_001F9740"); float absolute_float(float input) __asm__("func_001F99C0"); int FUN_L00_0025ff38(float best, char *a, char *o, int *excluded, int excluded_count, void *region, int region_count); int FUN_L04_00252e18(char *a, char *o, float best); -void FUN_L00_0025ab48(void *v, float *ang, float *s1, float *s2); -void FUN_L00_0025c558(u8 *a, void *b, int c, int d, int e, float f); +void trooper_knockback_arc(void *v, float *ang, float *s1, float *s2) __asm__("FUN_L00_0025ab48"); +void trooper_start_knockback(u8 *a, void *b, int c, int d, int e, float f) __asm__("FUN_L00_0025c558"); void FUN_L01_0026e090_c(int i, int v) __asm__("FUN_L01_0026e090"); extern int func_001F9908_2C73D0(void *) __asm__("FUN_001f9740"); extern int func_001F9850_2C73D0(int) __asm__("FUN_001f96f8"); @@ -606,9 +607,9 @@ int FUN_L00_0025fcb8(char *a, char *o, float best); int FUN_L01_0028b5e0(char *a0, void *list, char *pt, char *out); s32 FUN_L00_00258b50(void *m, void *c, void *v, Vec4 *out, f32 f); void FUN_L00_00258278(unsigned char *m, float *ptr, float t, float b, float c, float limit); -void FUN_L00_00259bc8(unsigned char *m, int x, int y, void *p, void *q, float f); +void spawn_nearby_effect(unsigned char *m, int x, int y, void *p, void *q, float f) __asm__("FUN_L00_00259bc8"); void FUN_L00_0025a120_c(char *o) __asm__("FUN_L00_0025a120"); -void FUN_L00_0025c558(u8 *a, void *b, int c, int d, int e, float f); +void trooper_start_knockback(u8 *a, void *b, int c, int d, int e, float f) __asm__("FUN_L00_0025c558"); void FUN_L00_0025f090_c(u8 *owner, void *pos, int sound, float scale, float flash) __asm__("FUN_L00_0025f090"); void FUN_L00_00263ac8_c(float x, int a, int b, unsigned char *p) __asm__("FUN_L00_00263ac8"); void FUN_L01_0026d930_c(char *p) __asm__("FUN_L01_0026d930"); @@ -628,7 +629,7 @@ extern int hit_check_2E39E0(Moby *, Hit_2E39E0 *, float *, int, int *, float *, extern int timer16_2E39E0(short *) __asm__("FUN_001f9770"); extern int timer32_2E39E0(int *) __asm__("FUN_001f9740"); extern int ticks_2E39E0(int) __asm__("FUN_001f96f8"); -extern void event_2E39E0(int, int) __asm__("FUN_L01_0026e090"); +extern void FUN_L01_0026e090(int, int); extern float angle_2E39E0(float, float) __asm__("FUN_001f9e90"); extern void knock_2E39E0(Moby *, void *, float, int, int, int) __asm__("FUN_L00_0025c558"); extern void explode_2E39E0(Moby *, int, int) __asm__("FUN_L00_00257470"); @@ -637,7 +638,7 @@ extern void sound_2E39E0(float, Moby *, int, void *) __asm__("FUN_L00_00263ac8") extern float distance_2E39E0(void *, void *) __asm__("FUN_001f9b48"); extern float fast_distance_2E39E0(void *, void *) __asm__("FUN_001f9b80"); extern void wake_2E39E0(Moby *) __asm__("FUN_L00_0025a120"); -extern int target_2E39E0(Moby *, void *, float) __asm__("FUN_L04_00252e18"); +extern int FUN_L04_00252e18_c(Moby *, void *, float) __asm__("FUN_L04_00252e18"); extern void steer_init_2E39E0(int *) __asm__("FUN_L01_0026d930"); extern int rand_2E39E0(void) __asm__("FUN_001160d8"); extern int range_2E39E0(int, int) __asm__("FUN_L00_00257b90"); @@ -650,7 +651,7 @@ extern float fabs_2E39E0(float) __asm__("FUN_001f99c0"); extern int status_2E39E0(int) __asm__("FUN_00213260"); extern float range_float_2E39E0(float, float) __asm__("FUN_002132a8"); extern void turn_2E39E0(Moby *, float, void *, float, float, float) __asm__("FUN_L00_00258278"); -extern void project_2E39E0(Moby *, char *, void *, void *) __asm__("FUN_L01_0028b5e0"); +extern void FUN_L01_0028b5e0_c(Moby *, char *, void *, void *) __asm__("FUN_L01_0028b5e0"); extern float sine_2E39E0(float) __asm__("FUN_001f9dc8"); extern float cosine_2E39E0(float) __asm__("FUN_001f9de0"); extern int move_2E39E0(Moby *, int *, void *, void *, float) __asm__("FUN_L00_00258b50"); @@ -693,7 +694,7 @@ void FUN_L09_002e27d8(Moby *moby) { if (data->cooldown != 0) hit->damage = 0.0f; else hit->damage = 1.0f; } - if (moby->group != 0xFF) event_2E39E0(moby->group, 1); + if (moby->group != 0xFF) FUN_L01_0026e090(moby->group, 1); if (hit->damage != 0.0f) { float health = data->health - hit->damage; float lift = lift_2E39E0 * D_0015EE6C_2E39E0; @@ -763,7 +764,7 @@ void FUN_L09_002e27d8(Moby *moby) { timer32_2E39E0(&data->f208); if (timer16_2E39E0(&data->alert)) data->range = 12.0f; else data->range = 20.0f; - kind = target_2E39E0(moby, &query, data->range); + kind = FUN_L04_00252e18_c(moby, &query, data->range); } qcopy(&previous, &moby->pos); expired = timer32_2E39E0(&data->home_timer) != 0; @@ -809,7 +810,7 @@ void FUN_L09_002e27d8(Moby *moby) { turn_2E39E0(moby, angle_2E39E0(query.x - moby->pos.x, query.y - moby->pos.y), data->turn, 0.02f, 0.3f, 0.1f); fast_vec_sub(&step, &query, &moby->pos); if ((kind < 2 || fast_vec_length(&step) < data->range) && fabs_2E39E0(moby->pos.z - query.z) < 8.0f && !status_2E39E0(19)) { - if (moby->group != 0xFF) event_2E39E0(moby->group, 1); + if (moby->group != 0xFF) FUN_L01_0026e090(moby->group, 1); if (status_2E39E0(0x100) & 1) data->side_deg = -data->side_deg; data->side = data->side_deg * 0.017453292f; data->side_timer = ticks_2E39E0((int)range_float_2E39E0(30.0f, 90.0f)); @@ -831,7 +832,7 @@ void FUN_L09_002e27d8(Moby *moby) { float steep; steep = fabs_2E39E0(moby->pos.z - query.z); steep /= fast_distance_2E39E0(&moby->pos, &query); - if (data->path != -1) project_2E39E0(moby, D_L09_001B0930_2E39E0[data->path], &query, &goal); + if (data->path != -1) FUN_L01_0028b5e0_c(moby, D_L09_001B0930_2E39E0[data->path], &query, &goal); else qcopy(&goal, &query); turn_2E39E0(moby, angle_2E39E0(goal.x - moby->pos.x, goal.y - moby->pos.y) + data->side, data->turn, 0.05f, 0.3f, 0.2f); step.x = 2.0f * sine_2E39E0(moby->rot.z); @@ -851,7 +852,7 @@ void FUN_L09_002e27d8(Moby *moby) { data->home_timer = ticks_2E39E0(50); moby->state = 5; } else if (fast_vec_length(&away) < data->range + 4.0f && fabs_2E39E0(moby->pos.z - query.z) < 8.0f) { - if (moby->group != 0xFF) event_2E39E0(moby->group, 1); + if (moby->group != 0xFF) FUN_L01_0026e090(moby->group, 1); } else if (moby->command != 1) { moby->state = 5; } @@ -884,7 +885,7 @@ void FUN_L09_002e27d8(Moby *moby) { break; case 5: { int flags; - if (data->path != -1) project_2E39E0(moby, D_L09_001B0930_2E39E0[data->path], &data->home, &goal); + if (data->path != -1) FUN_L01_0028b5e0_c(moby, D_L09_001B0930_2E39E0[data->path], &data->home, &goal); else qcopy(&goal, &data->home); turn_2E39E0(moby, angle_2E39E0(goal.x - moby->pos.x, goal.y - moby->pos.y), data->turn, 0.02f, 0.3f, 0.1f); step.x = 2.0f * sine_2E39E0(moby->rot.z); @@ -898,7 +899,7 @@ void FUN_L09_002e27d8(Moby *moby) { } fast_vec_sub(&away, &query, &data->home); if (expired && fast_vec_length(&away) < data->range) { - if (moby->group != 0xFF) event_2E39E0(moby->group, 1); + if (moby->group != 0xFF) FUN_L01_0026e090(moby->group, 1); moby->state = 3; if (moby->prev_seq != 0) animate_2E39E0(moby, 0, 0, ticks_2E39E0(range_2E39E0(10, 13))); } else if (expired && moby->command == 1) { @@ -955,7 +956,7 @@ void FUN_L09_002e27d8(Moby *moby) { float steep; steep = fabs_2E39E0(moby->pos.z - query.z); steep /= fast_distance_2E39E0(&moby->pos, &query); - if (data->path != -1) project_2E39E0(moby, D_L09_001B0930_2E39E0[data->path], &data->home, &goal); + if (data->path != -1) FUN_L01_0028b5e0_c(moby, D_L09_001B0930_2E39E0[data->path], &data->home, &goal); else qcopy(&goal, &data->home); turn_2E39E0(moby, angle_2E39E0(goal.x - moby->pos.x, goal.y - moby->pos.y), data->turn, 0.05f, 0.3f, 0.2f); step.x = 2.0f * sine_2E39E0(moby->rot.z); diff --git a/src/overlays/shared/gameplay/entities/sentrybot.c b/src/overlays/shared/gameplay/entities/sentrybot.c index 7040cf0b37..d83b3cf41d 100644 --- a/src/overlays/shared/gameplay/entities/sentrybot.c +++ b/src/overlays/shared/gameplay/entities/sentrybot.c @@ -35,9 +35,9 @@ extern float D_L15_001CBFE0[]; extern float D_L15_001CC060[]; extern float D_L15_001CC0E0[]; extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); -extern float FUN_L04_00241910(int a, unsigned int b); +extern float animation_end(int a, unsigned int b) __asm__("FUN_L04_00241910"); extern float compute_interpolated_record_value(void *) __asm__("FUN_0020c9e0"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float fast_sin(float); @@ -48,10 +48,10 @@ extern int *D_L15_001B0AB0[]; extern int D_L15_0015F5C4; extern int D_L15_0015F5CC; extern int D_L15_0015FFD8_m __asm__("D_L15_0015FFD8"); -extern int FUN_001f0b58(void); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); -extern int FUN_L00_0025c698(void *, void *); +extern int mine_fall(void *, void *) __asm__("FUN_L00_0025c698"); extern int FUN_L15_00299880(unsigned char *, char *, int, int, float); extern int FUN_L15_00299ae0(char *moby, float *point, float arg); extern int FUN_L15_00299ca0(void *); @@ -70,7 +70,7 @@ extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8") extern void FUN_L00_0024f8f0(void *, int, void *, void *); extern void FUN_L00_00257470(void *, int, int); extern void FUN_L00_0025a120(void *); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L00_00263b38(void *, float); extern void FUN_L15_00299a68(char *moby, void *a, float *point, void *b, void *c); void FUN_L15_0029a0d0(void *mp); @@ -90,7 +90,8 @@ extern void transform_scaled_vertex_batch(char *arg0, int arg1, void *arg2, char *arg3) __asm__("FUN_0020cd48"); extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); -void FUN_L15_002979d8(unsigned char *moby) { +void sentrybot_update(unsigned char *moby) __asm__("FUN_L15_002979d8"); +void sentrybot_update(unsigned char *moby) { float va[4]; float vb[4]; float pos[4]; @@ -328,7 +329,7 @@ void FUN_L15_002979d8(unsigned char *moby) { if (*(int *)(data + 0x114) != 2 && fast_difference_between_rotations( *(float *)(moby + 0x48), - FUN_001f9e90(*(float *)(data + 0xD0) - *(float *)(moby + 0x10), + fast_arc_tan(*(float *)(data + 0xD0) - *(float *)(moby + 0x10), *(float *)(data + 0xD4) - *(float *)(moby + 0x14))) < 0.5235988f) { moby[0xBC] = 1; if (data[0x15F] != 0) { @@ -358,7 +359,7 @@ void FUN_L15_002979d8(unsigned char *moby) { break; } if (moby[0x70] & 2) { - int k = func_001FA898_r(FUN_L04_00241910(moby[0x22], anim)); + int k = func_001FA898_r(animation_end(moby[0x22], anim)); if (tbl != 0) { *(float *)(moby + 0x48) = fast_add_rotations(*(float *)(data + 0x170), tbl[k] * DEG_TO_RAD); @@ -511,7 +512,7 @@ void FUN_L15_002979d8(unsigned char *moby) { } } else if (fast_difference_between_rotations( *(float *)(moby + 0x48), - FUN_001f9e90(*(float *)(data + 0xD0) - *(float *)(moby + 0x10), + fast_arc_tan(*(float *)(data + 0xD0) - *(float *)(moby + 0x10), *(float *)(data + 0xD4) - *(float *)(moby + 0x14))) > 0.7853982f && data[0x15B] == 0) { @@ -623,10 +624,10 @@ void FUN_L15_002979d8(unsigned char *moby) { normalize_vector_xyz(va, mat[1], D_L15_00161410 * frame_time); subtract_vector_xyz(vb, data + 0x100, pos); normalize_vector_xyz(vb, vb, D_L15_00161410 * frame_time); - if (fast_difference_between_rotations(FUN_001f9e90(va[0], va[1]), - FUN_001f9e90(vb[0], vb[1])) > 0.7853982f || - fast_difference_between_rotations(FUN_001f9e90(vector_length_xy(va), va[2]), - FUN_001f9e90(vector_length_xy(vb), vb[2])) > + if (fast_difference_between_rotations(fast_arc_tan(va[0], va[1]), + fast_arc_tan(vb[0], vb[1])) > 0.7853982f || + fast_difference_between_rotations(fast_arc_tan(vector_length_xy(va), va[2]), + fast_arc_tan(vector_length_xy(vb), vb[2])) > 0.7853982f) { FUN_L15_002e4580((char *)moby, va, (char *)pos, (char *)(data + 0x100)); } else { @@ -651,7 +652,7 @@ void FUN_L15_002979d8(unsigned char *moby) { blend_moby_animation(moby, 0xE, 0, scale_game_frames(0x14)); } else if (fast_difference_between_rotations( *(float *)(moby + 0x48), - FUN_001f9e90(*(float *)(data + 0xD0) - *(float *)(moby + 0x10), + fast_arc_tan(*(float *)(data + 0xD0) - *(float *)(moby + 0x10), *(float *)(data + 0xD4) - *(float *)(moby + 0x14))) > 0.7853982f) { FUN_L15_00299a68((char *)moby, data, (float *)(data + 0xD0), (void *)0x10, @@ -681,10 +682,10 @@ void FUN_L15_002979d8(unsigned char *moby) { normalize_vector_xyz(va, mat[1], -(D_L15_00161410 * frame_time)); subtract_vector_xyz(vb, data + 0x100, pos); normalize_vector_xyz(vb, vb, D_L15_00161410 * frame_time); - if (fast_difference_between_rotations(FUN_001f9e90(va[0], va[1]), - FUN_001f9e90(vb[0], vb[1])) > 0.7853982f || - fast_difference_between_rotations(FUN_001f9e90(vector_length_xy(va), va[2]), - FUN_001f9e90(vector_length_xy(vb), vb[2])) > + if (fast_difference_between_rotations(fast_arc_tan(va[0], va[1]), + fast_arc_tan(vb[0], vb[1])) > 0.7853982f || + fast_difference_between_rotations(fast_arc_tan(vector_length_xy(va), va[2]), + fast_arc_tan(vector_length_xy(vb), vb[2])) > 0.7853982f) { FUN_L15_002e4580((char *)moby, va, (char *)pos, (char *)(data + 0x100)); } else { @@ -709,7 +710,7 @@ void FUN_L15_002979d8(unsigned char *moby) { blend_moby_animation(moby, 0xE, 0, scale_game_frames(0x14)); } else if (fast_difference_between_rotations( *(float *)(moby + 0x48), - FUN_001f9e90(*(float *)(data + 0xD0) - *(float *)(moby + 0x10), + fast_arc_tan(*(float *)(data + 0xD0) - *(float *)(moby + 0x10), *(float *)(data + 0xD4) - *(float *)(moby + 0x14))) > 0.7853982f) { FUN_L15_00299a68((char *)moby, data, (float *)(data + 0xD0), (void *)0x12, @@ -782,10 +783,10 @@ void FUN_L15_002979d8(unsigned char *moby) { } break; case 21: { - int r = FUN_L00_0025c698(moby, data + 0x70); + int r = mine_fall(moby, data + 0x70); if (r & 0x40) { probe_ground_height(moby + 0x10, 0, 0.5f); - if (FUN_001f0b58() == -1 && *(float *)(data + 0x168) - 5.0f < *(float *)(moby + 0x18)) { + if (collision_hit_material() == -1 && *(float *)(data + 0x168) - 5.0f < *(float *)(moby + 0x18)) { if (hero.state.current == 0x65) { moby[0x20] = 0xC; if (moby[0x53] != 0) @@ -816,7 +817,7 @@ void FUN_L15_002979d8(unsigned char *moby) { *(int *)(data + 0x150) = -1; } allocate_voice_for_target_entry(0xD, 0, (int)moby); - FUN_L00_0025f090(moby, moby + 0x10, -1, 0.5f, 13.0f); + cart_burst(moby, moby + 0x10, -1, 0.5f, 13.0f); FUN_L00_00257470(moby, 0, -1); mark_moby_for_removal(moby); return; @@ -827,7 +828,7 @@ void FUN_L15_002979d8(unsigned char *moby) { break; } case 23: - if (FUN_L00_0025c698(moby, data + 0x70) & 0x160) { + if (mine_fall(moby, data + 0x70) & 0x160) { if (*(int *)(data + 0x12C) != -1) { FUN_L15_002a35d8(D_L15_0015FFD8_m + (*(int *)(data + 0x12C) << 8)); *(int *)(data + 0x12C) = -1; @@ -837,7 +838,7 @@ void FUN_L15_002979d8(unsigned char *moby) { *(int *)(data + 0x150) = -1; } allocate_voice_for_target_entry(0xD, 0, (int)moby); - FUN_L00_0025f090(moby, moby + 0x10, -1, 0.5f, 13.0f); + cart_burst(moby, moby + 0x10, -1, 0.5f, 13.0f); FUN_L00_00257470(moby, 0, -1); mark_moby_for_removal(moby); return; @@ -947,13 +948,13 @@ int FUN_L15_00299880(unsigned char *moby, char *d, int a, int b, float angle) { /* Ported from rac1-decomp (src/overlays/shared/vendor_00298BB8.c: func_L15_0029AC48), where it is exact; names translated to the US level program. */ -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern void FUN_L15_00299880_u(void *, void *, void *, void *, float) __asm__("FUN_L15_00299880"); /* Aims at point (heading from the moby) and passes it on to FUN_L15_00299880. */ void FUN_L15_00299a68(char *moby, void *a, float *point, void *b, void *c) { float angle = - FUN_001f9e90(point[0] - *(float *)(moby + 0x10), point[1] - *(float *)(moby + 0x14)); + fast_arc_tan(point[0] - *(float *)(moby + 0x10), point[1] - *(float *)(moby + 0x14)); FUN_L15_00299880_u(moby, a, b, c, angle); } /* Ported from rac1-decomp (src/overlays/shared/vendor_00298BB8.c: func_L15_0029ACC0), where it is exact; names translated to the US level program. */ @@ -961,7 +962,7 @@ void FUN_L15_00299a68(char *moby, void *a, float *point, void *b, void *c) { extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern float FUN_001f9b80(float *, float *); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); -extern float FUN_L00_0025be00(float *p, float *v, float a, float b, float c, float d); +extern float approach_angle(float *p, float *v, float a, float b, float c, float d) __asm__("FUN_L00_0025be00"); extern float fast_cos(float) __asm__("func_001F9DC8"); extern float fast_sin(float) __asm__("func_001F9DE0"); extern void FUN_L00_00258830(int, int, float, float, float, int); @@ -972,10 +973,10 @@ int FUN_L15_00299ae0(char *moby, float *point, float arg) { float vec[4]; float a; float ang; - a = FUN_001f9e90(point[0] - *(float *)(moby + 0x10), point[1] - *(float *)(moby + 0x14)); - FUN_L00_0025be00(fp, (float *)(d + 0x138), a, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, + a = fast_arc_tan(point[0] - *(float *)(moby + 0x10), point[1] - *(float *)(moby + 0x14)); + approach_angle(fp, (float *)(d + 0x138), a, frame_time_sq * 12.566371f, frame_time_sq * 12.566371f, frame_time * 6.981317f); - ang = FUN_001f9e90(point[0] - *(float *)(moby + 0x10), point[1] - *(float *)(moby + 0x14)); + ang = fast_arc_tan(point[0] - *(float *)(moby + 0x10), point[1] - *(float *)(moby + 0x14)); if (fast_difference_between_rotations(*(float *)(moby + 0x48), ang) < 0.7853982f) { approach_value(d + 0x134, arg, frame_time_sq * 9.0f); } else { @@ -1040,7 +1041,7 @@ int FUN_L15_00299ca0(void *mm) { extern float FUN_001f9b48(void *, void *); extern int D_L15_0015FFD8_m __asm__("D_L15_0015FFD8"); extern int D_L15_001ABE40[]; -extern int FUN_001efa68(void *, void *, int, void *, void *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); int FUN_L15_00299dd8(char *m) { char *d = *(char **)(m + 0x78); @@ -1064,7 +1065,7 @@ int FUN_L15_00299dd8(char *m) { if (*(short *)(o + 0xA6) == 0x27B && *(unsigned char *)(o + 0x20) >= 6 && *(unsigned char *)(o + 0x20) < 0x10) { float f = fast_difference_between_rotations( - *(float *)(m + 0x48), FUN_001f9e90(*(float *)(o + 0x10) - *(float *)(m + 0x10), + *(float *)(m + 0x48), fast_arc_tan(*(float *)(o + 0x10) - *(float *)(m + 0x10), *(float *)(o + 0x14) - *(float *)(m + 0x14))); unsigned char st = ((char *)((id << 8) + D_L15_0015FFD8_m))[0x20]; if (st == 7 || st == 0xF) @@ -1072,7 +1073,7 @@ int FUN_L15_00299dd8(char *m) { if (*(short *)(d + 0x194) != 0 || f < 1.2217305f) { qcopy(b, (char *)((id << 8) + D_L15_0015FFD8_m) + 0x10); a[2] += 1.0f; - if (FUN_001efa68(a, b, 2, 0, 0) == 0) { + if (collision_line(a, b, 2, 0, 0) == 0) { float dist = FUN_001f9b48(a, b); if (best == 0 || dist < bd) { bd = dist; @@ -1163,7 +1164,7 @@ void FUN_L15_0029a0d0(void *mp) { } /* Ported from rac1-decomp (src/overlays/shared/vendor_00298BB8.c: func_L15_0029B428), where it is exact; names translated to the US level program. */ -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); s32 random_integer_below(s32 arg0) __asm__("FUN_00213260"); void FUN_L15_0029a248(char *a, char *b) { @@ -1172,7 +1173,7 @@ void FUN_L15_0029a248(char *a, char *b) { d = *(char **)(b + 0x78); if (*(short *)(d + 0x19C) == 0 || random_integer_below(0x10) == 0) { *(char **)(d + 0x198) = a; - *(short *)(d + 0x19C) = FUN_001f96f8(0xB4); + *(short *)(d + 0x19C) = scale_game_frames(0xB4); } } } @@ -1180,7 +1181,7 @@ void FUN_L15_0029a248(char *a, char *b) { /* Ported from rac1-decomp (src/overlays/shared/vendor_00298BB8.c: func_L15_0029B488), where it is exact; names translated to the US level program. */ extern f32 vector_length_xy_c(void *) __asm__("FUN_001f9b20"); -extern void FUN_L00_002628d8(char *, char *, int, float, float); +extern void update_joint_animation(char *, char *, int, float, float) __asm__("FUN_L00_002628d8"); extern void subtract_vector_xyz_c(void *, void *, void *) __asm__("FUN_001f9a28"); void FUN_L15_0029a2a8(void *mv) { @@ -1207,8 +1208,8 @@ void FUN_L15_0029a2a8(void *mv) { qcopy(pos, m + 0x10); pos[2] += 1.0f; subtract_vector_xyz_c(dir, tgt, pos); - yaw = fast_subtract_rotations(FUN_001f9e90(dir[0], dir[1]), *(float *)(m + 0x48)); - pitch = -FUN_001f9e90(vector_length_xy_c(dir), dir[2]); + yaw = fast_subtract_rotations(fast_arc_tan(dir[0], dir[1]), *(float *)(m + 0x48)); + pitch = -fast_arc_tan(vector_length_xy_c(dir), dir[2]); if ((unsigned int)(((unsigned char *)m)[0x20] - 0x10) < 2) { if (1.5707964f < yaw) yaw = 1.5707964f; @@ -1242,9 +1243,9 @@ void FUN_L15_0029a2a8(void *mv) { { float e = frame_scale_sq; *(float *)(d + 0x204) = pitch; - FUN_L00_002628d8(m, d + 0x1A0, 1, k1 * e, k2 * e); + update_joint_animation(m, d + 0x1A0, 1, k1 * e, k2 * e); } - FUN_L00_002628d8(m, d + 0x220, 0, k1 * frame_scale_sq, k2 * frame_scale_sq); + update_joint_animation(m, d + 0x220, 0, k1 * frame_scale_sq, k2 * frame_scale_sq); } extern float D_L15_001613EC __attribute__((sda)); extern float D_L15_001613F0 __attribute__((sda)); @@ -1266,10 +1267,10 @@ extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern int update_float_countdown(void *) __asm__("FUN_L08_00211b08"); extern int convert_float_to_int_a570(float) __asm__("FUN_001fa6d0"); extern int fun_00213928(void *, void *, void *, int, int *, float *, int, int) __asm__("FUN_00213928"); -extern void FUN_L00_0025ab48(void *, float *, void *, void *); -extern void FUN_L00_0025c558(void *, void *, int, int, int, float); -extern void FUN_L00_0025d458(void *, void *); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_knockback_arc(void *, float *, void *, void *) __asm__("FUN_L00_0025ab48"); +extern void trooper_start_knockback(void *, void *, int, int, int, float) __asm__("FUN_L00_0025c558"); +extern void trooper_anim_update(void *, void *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern int FUN_L00_0025ff38(void *, void *, float, int, int, void *, int); void FUN_L15_0029a570(void *object, int flag) { @@ -1345,13 +1346,13 @@ void FUN_L15_0029a570(void *object, int flag) { *(float *)(data + 0xC4) = 10.0f; } { - float heading = FUN_001f9e90(*(float *)(moby + 0x10) - *(float *)(*(char **)(hit + 0x20) + 0x10), + float heading = fast_arc_tan(*(float *)(moby + 0x10) - *(float *)(*(char **)(hit + 0x20) + 0x10), *(float *)(moby + 0x14) - *(float *)(*(char **)(hit + 0x20) + 0x14)); *(u128 *)pos = *(u128 *)(hit + 0x10); angle = heading; } - FUN_L00_0025ab48(pos, &angle, data + 0x88, data + 0x8C); - FUN_L00_0025c558(moby, data + 0x70, 7, 1, 0, angle); + trooper_knockback_arc(pos, &angle, data + 0x88, data + 0x8C); + trooper_start_knockback(moby, data + 0x70, 7, 1, 0, angle); moby[0x20] = 0x15; moby[0xBC] = 2; data[0x67] = 0x78; @@ -1381,22 +1382,22 @@ void FUN_L15_0029a570(void *object, int flag) { *(float *)(data + 0xC4) = 16.0f; } { - float heading = FUN_001f9e90(*(float *)(moby + 0x10) - *(float *)(*(char **)(hit + 0x20) + 0x10), + float heading = fast_arc_tan(*(float *)(moby + 0x10) - *(float *)(*(char **)(hit + 0x20) + 0x10), *(float *)(moby + 0x14) - *(float *)(*(char **)(hit + 0x20) + 0x14)); *(u128 *)pos = *(u128 *)(hit + 0x10); fall_angle = heading; } - FUN_L00_0025ab48(pos, &fall_angle, data + 0x88, data + 0x8C); - FUN_L00_0025c558(moby, data + 0x70, 8, 1, 0, fall_angle); + trooper_knockback_arc(pos, &fall_angle, data + 0x88, data + 0x8C); + trooper_start_knockback(moby, data + 0x70, 8, 1, 0, fall_angle); moby[0x20] = 0x17; moby[0xBC] = 2; data[0x67] = 0xF0; break; } - FUN_L00_0025d458(moby, data + 0x60); + trooper_anim_update(moby, data + 0x60); } moby[0xA4] = 0xFF; - FUN_L00_0025d538(moby, data + 0x60); + trooper_anim_finish(moby, data + 0x60); if (flag != 0) return; if (*(int *)(data + 0x38) != 0) { @@ -1414,7 +1415,7 @@ void FUN_L15_0029a570(void *object, int flag) { pos[2] += 1.0f; if (*(int *)(data + 0x12C) != -1) group = D_L15_0015FFD8_m + (*(int *)(data + 0x12C) << 8); - data[0x15A] = FUN_001efa68(pos, D_0013F420, 2, (void *)group, 0) == 0; + data[0x15A] = collision_line(pos, D_0013F420, 2, (void *)group, 0) == 0; } else { data[0x15A] = 0; } @@ -1422,7 +1423,7 @@ void FUN_L15_0029a570(void *object, int flag) { if (FUN_L00_0025ff38(moby, data + 0xD0, 128.0f, 0, 0, path + 4, *path) != 2) { float target_angle; seen = 0; - target_angle = FUN_001f9e90(*(float *)(data + 0xD0) - *(float *)(moby + 0x10), + target_angle = fast_arc_tan(*(float *)(data + 0xD0) - *(float *)(moby + 0x10), *(float *)(data + 0xD4) - *(float *)(moby + 0x14)); if ((fast_difference_between_rotations(*(float *)(moby + 0x48), target_angle) < 1.5707964f && (D_0013F658[0] == 0 || FUN_001f99c0(*(float *)(moby + 0x18) - *(float *)(data + 0xD8)) < 4.0f)) || @@ -1497,7 +1498,8 @@ extern void remove_y(void *) __asm__("FUN_0020c828"); void FUN_L15_0029ae18(char *moby); void FUN_L15_0029af88(char *moby); -void FUN_L15_0029ac30(unsigned char *m) { +void rocket_update(unsigned char *m) __asm__("FUN_L15_0029ac30"); +void rocket_update(unsigned char *m) { char *d = *(char **)(m + 0x78); float next[4]; float back[4]; @@ -1689,8 +1691,8 @@ extern float FUN_L00_00258110(float *vel, float cur, float target, float k, floa extern float fast_vec_dist(void *, void *); extern float vector_distance_xy_alt(float *, float *) __asm__("FUN_001f9b80"); extern int D_L15_0015F30C; -extern int FUN_001f9770(void *); -extern int FUN_L00_001f2868(void *, float, int, void *, void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +extern int collect_mobies_in_sphere(void *, float, int, void *, void *) __asm__("FUN_L00_001f2868"); extern int FUN_L00_00257b90(int, int); extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); extern int tick_countdown_32_alt(void *) __asm__("FUN_001f9740"); @@ -1699,19 +1701,19 @@ extern s32 truncate_float_to_s32_c4(f32) __asm__("func_001FA6D0"); extern unsigned char *D_L15_001B26DC __attribute__((section(".data"))); extern unsigned char *FUN_L00_002712b8(void *pos, float *vec, int s, int a, int col, int n, float x, float y, float z, float w, float pw); extern void *FUN_L00_0026bb70_c(void *, void *, int, int, float, int, int, int, int) __asm__("FUN_L00_0026bb70"); -extern void FUN_L00_001edf60(void *, int, float, float, void *, int, int, float, int); +extern void suck_draw_reticle(void *, int, float, float, void *, int, int, float, int) __asm__("FUN_L00_001edf60"); extern void FUN_L00_001ff290(void *, void *, void *); extern void FUN_L00_001ff2c0(void *, void *, void *); extern void FUN_L00_001ff660(void *, void *, void *); extern void FUN_L00_001ffd48(void *, void *, float); extern void FUN_L00_001ffe20(void *, void *, void *); extern void FUN_L00_0025a9f8(void *, void *, void *, int, int, int, int, int, float, float, float); -extern void FUN_L00_0025f800(void *, void *); +extern void mine_spawn_drops(void *, void *) __asm__("FUN_L00_0025f800"); extern void FUN_L00_0026a4c8(void *pos, void *vel, int color, int tag, int life, float size); extern void FUN_L00_0026a9f0(void *, void *, int, int, float, int, int, float, int, int); extern void FUN_L00_0026cbb0(void *, void *, int, int, int, int, float); extern void FUN_L00_002ac910(char *, char *, int, int, float, int, int, int, int); -extern void FUN_L00_002d3838(void *, void *, int, int); +extern void mine_camera_blast(void *, void *, int, int) __asm__("FUN_L00_002d3838"); extern void build_look_at_matrix(void *out, void *dir, void *axis, f32 ang) __asm__("FUN_00214890"); extern void build_spherical_offset_c(void *, f32, f32, f32) __asm__("func_00214DB0"); extern void clamp_vector_length(void *, void *, float) __asm__("FUN_001f9c90"); @@ -1756,7 +1758,7 @@ void FUN_L15_0029d6c0(M_29E8A0 *m) { d = m->data; t = d->target; d->speed = d->speed + (d->speed_end - d->speed) / 10.0f * D_0015ED64; - FUN_001f9770(&d->f3C); + fast_dec_timer_s16(&d->f3C); { float a = convert_integer_to_float_c2(d->f3C); float b = convert_integer_to_float_c2(d->f3E); @@ -1771,7 +1773,7 @@ void FUN_L15_0029d6c0(M_29E8A0 *m) { float f = fast_vec_dist(D_L15_001673C0, t->pos) / 50.0f; qcopy(delta, t->pos); delta[2] = delta[2] + d->zoff; - FUN_L00_001edf60(m, 0xFF0FFFFF, absolute_float(0.5f - f * 0.35f), 0.0f, delta, 0xD, -1, 90.0f, 4); + suck_draw_reticle(m, 0xFF0FFFFF, absolute_float(0.5f - f * 0.35f), 0.0f, delta, 0xD, -1, 90.0f, 4); } if (t != 0 && d->timer < scale_game_frames(0x96) - scale_game_frames(0) && t->state >= 0) { float s = 0.0f; @@ -1861,7 +1863,7 @@ void FUN_L15_0029d6c0(M_29E8A0 *m) { } add_vector_xyz(m->pos, m->pos, vel); if (m->pos[0] < 0.0f || m->pos[1] < 0.0f || m->pos[2] < 0.0f) { - FUN_L00_0025f800(m, D_L15_001B0D70); + mine_spawn_drops(m, D_L15_001B0D70); mark_moby_for_removal_c3(m); return; } @@ -1879,7 +1881,7 @@ void FUN_L15_0029d6c0(M_29E8A0 *m) { coll.id = m->id; coll.v[2] = 1.0f; coll.one = 1; - if (FUN_001efa68(v60, m->pos, 0, *(char **)(hero + 0x2080), &coll) != 0) { + if (collision_line(v60, m->pos, 0, *(char **)(hero + 0x2080), &coll) != 0) { char *hit = D_L15_00174440; char *hm = *(char **)(hit + 0x18); if (hm != 0) { @@ -1903,7 +1905,7 @@ void FUN_L15_0029d6c0(M_29E8A0 *m) { fast_vec_normalize(v80, hit + 0x40, 1.0f); } } else if (tick_countdown_32_alt(&d->timer) != 0 || vector_distance_xy_alt(m->pos, (float *)(hero + 0x80)) > 260.0f) { - FUN_L00_0025f800(m, D_L15_001B0D70); + mine_spawn_drops(m, D_L15_001B0D70); mark_moby_for_removal_c3(m); return; } @@ -1912,7 +1914,7 @@ void FUN_L15_0029d6c0(M_29E8A0 *m) { float dist; char *cam; int i, j; - int r = FUN_L00_001f2868(m->pos, 2.0f, 0x10, m, 0); + int r = collect_mobies_in_sphere(m->pos, 2.0f, 0x10, m, 0); *(u128_29E8A0 *)v100 = *(u128_29E8A0 *)m->pos; FUN_L00_0025a9f8(m, v100, ((char * *)D_L15_00178500), r, (int)owner, 0x810000, 3, 1, 3.0f, 1.0f, 1.0f); { @@ -2044,8 +2046,8 @@ void FUN_L15_0029d6c0(M_29E8A0 *m) { *(int *)(cam2 + 0x168) = sh; } allocate_voice_for_target_entry(0, 0, (int)m); - FUN_L00_002d3838(&tbl, m->pos, 0, 0); - FUN_L00_0025f800(m, D_L15_001B0D70); + mine_camera_blast(&tbl, m->pos, 0, 0); + mine_spawn_drops(m, D_L15_001B0D70); mark_moby_for_removal_c3(m); } } @@ -2056,7 +2058,7 @@ void FUN_L15_0029d6c0(M_29E8A0 *m) { extern int tick_countdown_32_alt(void *) __asm__("FUN_001f9740"); extern s32 truncate_float_to_s32_c(f32) __asm__("func_001FA6D0"); -extern void FUN_L00_002598b0(float, char *, char *, float, float, int, int, int, int); +extern void play_entity_sound(float, char *, char *, float, float, int, int, int, int) __asm__("FUN_L00_002598b0"); extern void mark_moby_for_removal_c(void *) __asm__("func_0020C828"); void FUN_L15_0029ead0(struct Moby *moby) { @@ -2072,7 +2074,7 @@ void FUN_L15_0029ead0(struct Moby *moby) { moby->alpha = *(int *)(state + 8) * 127 / scale_game_frames(0x28); globals = &hero; pos = &moby->pos; - FUN_L00_002598b0(t, ((char *)globals->moby), pos, (float)func_001FA898_r(*(float *)(state + 0xC)), 1.0f, 0x30000, 0, 1, 0); + play_entity_sound(t, ((char *)globals->moby), pos, (float)func_001FA898_r(*(float *)(state + 0xC)), 1.0f, 0x30000, 0, 1, 0); if (tick_countdown_32_alt((int *)(state + 8))) mark_moby_for_removal_c(moby); } @@ -2429,7 +2431,7 @@ void FUN_L15_002a2488(char *moby) { c = (char *)&hero; fa = *(float *)(c + 0x80) - *(float *)(moby + 0x10); fb = *(float *)(c + 0x84) - *(float *)(moby + 0x14); - yaw = fast_add_rotations_c(*(float *)(data + 0x64), FUN_001f9e90(fa, fb)); + yaw = fast_add_rotations_c(*(float *)(data + 0x64), fast_arc_tan(fa, fb)); target_z = *(float *)(c + 0xC8); g = fast_cos_c(yaw); va[0] = g * (*(float *)&D_L15_001614B4 * D_0015ED6C); @@ -2455,7 +2457,7 @@ void FUN_L15_002a2488(char *moby) { return; s4: - FUN_L00_0025f090(moby, moby + 0x10, -1, 0.25f, 13.0f); + cart_burst(moby, moby + 0x10, -1, 0.25f, 13.0f); func_L00_0025A8E8_m(moby, moby + 0x10, 0x10001, 1.0f, 1.0f, 1.0f, 0, 1, 0); s0: @@ -2486,10 +2488,10 @@ int FUN_L15_002a2868(int idx, void *pos) { data = *(char **)(m + 0x78); *(int *)(m + 0x94) = *(int *)(*(char **)(m + 0x24) + 0x10); *(float *)(data + 0x64) = random_float_between_alt(-15.0f, 15.0f) * DEG_TO_RAD; - *(int *)(data + 0x68) = FUN_001f96f8(0x3C); + *(int *)(data + 0x68) = scale_game_frames(0x3C); qcopy(m + 0x10, pos); *(float *)(m + 0x18) -= 1.0f; - *(float *)(m + 0x48) = FUN_001f9e90(g->motion.pos.f[0] - *(float *)(m + 0x10), + *(float *)(m + 0x48) = fast_arc_tan(g->motion.pos.f[0] - *(float *)(m + 0x10), g->motion.pos.f[1] - *(float *)(m + 0x14)); return 1; } @@ -2902,7 +2904,7 @@ extern f32 fast_cos_c4(f32) __asm__("func_001F9DC8"); extern f32 fast_normalize_angle(f32) __asm__("func_001FA610"); extern f32 fast_sin_c4(f32) __asm__("func_001F9DE0"); extern float D_0015ED6C; -extern float FUN_001f96b0(float); +extern float FUN_L04_001f1978(float); extern float fast_add_rotations_c2(float, float) __asm__("func_001FA580"); extern s32 rand(void); extern s32 random_integer_below_c4(s32) __asm__("func_00213260"); @@ -2920,7 +2922,8 @@ extern void subtract_vector_xyz_c3(void *, void *, void *) __asm__("FUN_001f9a28 void normalize_vector_triplet(f32 *vectors) __asm__("FUN_00214128"); extern unsigned char *func_L00_00273F80_r(float *pos, char *vel, int color, unsigned char life, unsigned char b, int mode, float scale) __asm__("FUN_L00_002730e0"); -void FUN_L15_002a6e68(unsigned char *moby) { +void spiderbot_update(unsigned char *moby) __asm__("FUN_L15_002a6e68"); +void spiderbot_update(unsigned char *moby) { float old[4]; float A[4]; float B[4]; @@ -3033,8 +3036,8 @@ void FUN_L15_002a6e68(unsigned char *moby) { R.b19 = 1; subtract_vector_xyz_c3(T2, moby + 0x10, old); *(u128_2A8090 *)C = *(u128_2A8090 *)T2; - FUN_001efa68(moby + 0x10, A, 9, moby, &R); - if (FUN_001efa68(moby + 0x10, A, 2, 0, 0)) { + collision_line(moby + 0x10, A, 9, moby, &R); + if (collision_line(moby + 0x10, A, 2, 0, 0)) { *(u128_2A8090 *)(d + 0x10) = *(u128_2A8090 *)D_L15_00174460; } else { *(u128_2A8090 *)(d + 0x10) = *(u128_2A8090 *)A; @@ -3046,7 +3049,7 @@ void FUN_L15_002a6e68(unsigned char *moby) { unsigned char life; s = -1.0f; if (rand() & 1) s = 1.0f; - k = truncate_float_to_s32_c5(FUN_001f96b0(random_float_between(D_L15_00161560 * 0.5f, D_L15_00161560))); + k = truncate_float_to_s32_c5(FUN_L04_001f1978(random_float_between(D_L15_00161560 * 0.5f, D_L15_00161560))); subtract_vector_xyz_c3(T2, d + 0x10, moby + 0x10); *(u128_2A8090 *)B = *(u128_2A8090 *)T2; fast_vec_scale(B, B, s); @@ -3138,7 +3141,8 @@ extern f32 fast_cos_door(f32) __asm__("FUN_001f9dc8"); extern f32 fast_sin_door(f32) __asm__("FUN_001f9de0"); extern void add_vector_door(void *, void *, void *) __asm__("FUN_001f9a10"); -void FUN_L15_002bddb0(struct Moby *moby) { +void door_update(struct Moby *moby) __asm__("FUN_L15_002bddb0"); +void door_update(struct Moby *moby) { MovingMobyVars *vars = (MovingMobyVars *)moby->pvars; Vec4 offset; Vec4 next; @@ -3283,7 +3287,7 @@ void FUN_L15_002cb4c8(unsigned char *moby) { if (data[0] == 1) { moby[0x20] = 6; if (moby[0x53] != 4) - blend_moby_animation(moby, 4, 0, FUN_001f96f8(30)); + blend_moby_animation(moby, 4, 0, scale_game_frames(30)); } else { moby[0x20] = 5; } @@ -3293,7 +3297,7 @@ void FUN_L15_002cb4c8(unsigned char *moby) { if (moby[0x70] & 2) { moby[0x20] = 3; if (moby[0x53] != 2) - blend_moby_animation(moby, 2, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 2, 0, scale_game_frames(10)); } break; case 3: @@ -3301,7 +3305,7 @@ void FUN_L15_002cb4c8(unsigned char *moby) { if (D_L15_0015F5C4 != 2) { moby[0x20] = 4; if (moby[0x53] != 3) - blend_moby_animation(moby, 3, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 3, 0, scale_game_frames(10)); } break; case 4: @@ -3310,22 +3314,22 @@ void FUN_L15_002cb4c8(unsigned char *moby) { if (data[0] == 1) { moby[0x20] = 7; if (moby[0x53] != 5) - blend_moby_animation(moby, 5, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 5, 0, scale_game_frames(10)); } else { if (moby[0x53] != 8) - blend_moby_animation(moby, 8, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 8, 0, scale_game_frames(10)); moby[0x20] = 5; } } break; stop_animation: if (moby[0x53] != 8) - blend_moby_animation(moby, 8, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 8, 0, scale_game_frames(10)); moby[0x20] = 10; break; case 5: if ((moby[0x70] & 2) && moby[0x53] != 0) - blend_moby_animation(moby, 0, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 0, 0, scale_game_frames(10)); color = interpolate_color_2a3138((fast_sin_door(*(float *)(data + 5)) + 1.0f) * 0.5f, 0x801414dc, 0x8004048c); step = frame_time; *(int *)(moby + 0x90) = color; @@ -3334,7 +3338,7 @@ void FUN_L15_002cb4c8(unsigned char *moby) { FUN_L15_002cbac0((char *)moby, 0); data[2] = 0; if (moby[0x53] != 8) - blend_moby_animation(moby, 8, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 8, 0, scale_game_frames(10)); moby[0x20] = 10; } break; @@ -3342,13 +3346,13 @@ void FUN_L15_002cb4c8(unsigned char *moby) { if (data[2] == 0) goto update; moby[0x20] = 7; if (moby[0x53] != 5) - blend_moby_animation(moby, 5, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 5, 0, scale_game_frames(10)); break; case 7: if (moby[0x70] & 2) { moby[0x20] = 8; if (moby[0x53] != 6) - blend_moby_animation(moby, 6, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 6, 0, scale_game_frames(10)); } break; case 8: { @@ -3357,7 +3361,7 @@ void FUN_L15_002cb4c8(unsigned char *moby) { if (FUN_001f9b80(pos, hero_pos) < 16.0f && D_L15_0015F5C4 != 2 && tick_countdown_32_alt(data + 3)) { qcopy(position, pos); position[2] += 1.0f; - if (FUN_001efa68(position, hero_pos + 20, 2, 0, 0) == 0 && FUN_L15_002a2868(data[1], pos)) + if (collision_line(position, hero_pos + 20, 2, 0, 0) == 0 && FUN_L15_002a2868(data[1], pos)) data[3] = data[4]; } if (tick_countdown_32_alt(data + 6) || D_L15_0015F5C4 == 2) { @@ -3365,7 +3369,7 @@ void FUN_L15_002cb4c8(unsigned char *moby) { data[2] = 0; moby[0x20] = 9; if (moby[0x53] != 7) - blend_moby_animation(moby, 7, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 7, 0, scale_game_frames(10)); } break; } @@ -3374,11 +3378,11 @@ void FUN_L15_002cb4c8(unsigned char *moby) { if (data[0] == 2) { moby[0x20] = 6; if (moby[0x53] != 4) - blend_moby_animation(moby, 4, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 4, 0, scale_game_frames(10)); } else { moby[0x20] = 10; if (moby[0x53] != 8) - blend_moby_animation(moby, 8, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 8, 0, scale_game_frames(10)); } } break; @@ -3386,7 +3390,7 @@ void FUN_L15_002cb4c8(unsigned char *moby) { if (moby[0x70] & 2) { moby[0x20] = 2; if (moby[0x53] != 1) - blend_moby_animation(moby, 1, 0, FUN_001f96f8(10)); + blend_moby_animation(moby, 1, 0, scale_game_frames(10)); } break; } @@ -3440,12 +3444,12 @@ void FUN_L15_002cbba0(unsigned char *moby) { if (moby[0x20] == 1) { moby[0x20] = 2; if (moby[0x53] != 1) { - blend_moby_animation_u(moby, 1, 0, FUN_001f96f8(10)); + blend_moby_animation_u(moby, 1, 0, scale_game_frames(10)); } } if (moby[0x20] == 3) { if (*(int *)(data + 8) == 0) { - *(int *)(data + 0x18) = FUN_001f96f8(0x78); + *(int *)(data + 0x18) = scale_game_frames(0x78); } } } @@ -3455,7 +3459,7 @@ void FUN_L15_002cbba0(unsigned char *moby) { /* Ported from rac1-decomp (src/overlays/shared/vendor_00298BB8.c: func_L15_002CCFC0), where it is exact; names translated to the US level program. */ extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int FUN_L15_002cbac0_u() __asm__("FUN_L15_002cbac0"); extern int D_0015ED84; extern s32 D_L15_00161AB8 ; @@ -3479,13 +3483,13 @@ void FUN_L15_002cbc30(void *arg) { } if (*(float *)&D_L15_00161ABC_gp != 0.0f) { *(int *)&D_L15_00161AC0_gp = 1; - if (FUN_L00_0028d8c0(*(void **)&D_L15_00161AC8, D_L15_00161AC4) == 0) { + if (voice_is_playing(*(void **)&D_L15_00161AC8, D_L15_00161AC4) == 0) { D_L15_00161AC4 = allocate_voice_for_target_entry(5, 0x11, (int)arg); *(void **)&D_L15_00161AC8 = arg; } enqueue_callback_list_1_alt(FUN_L15_002cbd88_u, arg); } else { - if (FUN_L00_0028d8c0(*(void **)&D_L15_00161AC8, D_L15_00161AC4) != 0) { + if (voice_is_playing(*(void **)&D_L15_00161AC8, D_L15_00161AC4) != 0) { release_voice_slot(D_L15_00161AC4); *(int *)&D_L15_00161AC8 = 0; D_L15_00161AC4 = -1; diff --git a/src/overlays/shared/gameplay/entities/spawner.c b/src/overlays/shared/gameplay/entities/spawner.c index f4a2b22ccc..066282bd61 100644 --- a/src/overlays/shared/gameplay/entities/spawner.c +++ b/src/overlays/shared/gameplay/entities/spawner.c @@ -364,7 +364,8 @@ extern f32 frame_time_sq_macro __asm__("D_0015ED70") MACRO_ADDR; /* Spawner update (moby class 0x75D): state 0 clears the slot list, state 1 picks a target and lobs a * 0x75E moby towards it, state 2 explodes. Ported from rac1-decomp (src/overlays/shared/vendor_002C6B30.c: * func_L09_0030BF88), where it is exact; this build has no 0.85 limit check before a spawn. */ -void FUN_L09_0030ab80(char *moby) +void spawner_update(char *moby) __asm__("FUN_L09_0030ab80"); +void spawner_update(char *moby) { char *d = *(char **)(moby + 0x78); float target[4]; @@ -581,13 +582,13 @@ typedef struct { extern CollisionHit D_L09_00173FC0; -extern s32 FUN_001efa68(void *, void *, s32, struct Moby *, s32); -extern s32 FUN_001f0b58(void); -extern s32 FUN_001f9770(void *); +extern s32 collision_line(void *, void *, s32, struct Moby *, s32) __asm__("FUN_001efa68"); +extern s32 collision_hit_material(void) __asm__("FUN_001f0b58"); +extern s32 fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void scale_vector_xyz(void *, void *, f32) __asm__("FUN_001f9a68"); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); extern f32 random_float_between(f32, f32) __asm__("FUN_002132a8"); @@ -596,8 +597,8 @@ extern s32 allocate_voice_for_target_entry(s32, s32, struct Moby *) __asm__("FUN extern s32 coll_sphere(f32, void *, s32, struct Moby *) __asm__("FUN_L00_001f0d60"); extern void FUN_L00_001fefc8(void *); extern void FUN_L00_001ff660(void *, void *, void *); -extern void FUN_L00_00259fe8(struct Moby *, f32); -extern f32 FUN_L00_0025e310(f32); +extern void jet_animate(struct Moby *, f32) __asm__("FUN_L00_00259fe8"); +extern f32 normalize_angle(f32) __asm__("FUN_L00_0025e310"); extern struct Moby *FUN_L09_0030a778(struct Moby *, Vec4 *); static inline void bubble_bounce(struct Moby *moby, BubbleVars *vars) { @@ -605,15 +606,15 @@ static inline void bubble_bounce(struct Moby *moby, BubbleVars *vars) { if (hit->moby == 0) { FUN_L00_001ff660(&vars->vel, &vars->vel, &hit->normal_x); - if (atan2_307ba8(hit->normal_z, vector_length_xy(&hit->normal_x)) < 0.6981317f && FUN_001f0b58() == -1) { + if (atan2_307ba8(hit->normal_z, vector_length_xy(&hit->normal_x)) < 0.6981317f && collision_hit_material() == -1) { scale_vector_xyz(&vars->vel, &vars->vel, 0.5f); - if (FUN_001f9af0(&vars->vel) < 0.025f) { + if (fast_vec_length(&vars->vel) < 0.025f) { moby->state = 1; } } } else if (((struct Moby *)hit->moby)->oclass != 0x75E) { FUN_L00_001ff660(&vars->vel, &vars->vel, &hit->normal_x); - if (atan2_307ba8(hit->normal_z, vector_length_xy(&hit->normal_x)) < 0.6981317f && FUN_001f0b58() == -1) { + if (atan2_307ba8(hit->normal_z, vector_length_xy(&hit->normal_x)) < 0.6981317f && collision_hit_material() == -1) { scale_vector_xyz(&vars->vel, &vars->vel, 1.2f); } } else { @@ -625,7 +626,8 @@ static inline void bubble_bounce(struct Moby *moby, BubbleVars *vars) { } } -void FUN_L09_0030b3b0(struct Moby *moby) { +void spawner_egg_update(struct Moby *moby) __asm__("FUN_L09_0030b3b0"); +void spawner_egg_update(struct Moby *moby) { BubbleVars *vars = (BubbleVars *)moby->pvars; Vec4 prev; Vec4 step; @@ -647,7 +649,7 @@ void FUN_L09_0030b3b0(struct Moby *moby) { add_vector_xyz(&step, &step, &moby->pos); moby->collision = 0; vars->owner->collision = 0; - if (FUN_001efa68(&prev, &step, 4, moby, 0) != 0) { + if (collision_line(&prev, &step, 4, moby, 0) != 0) { subtract_vector_xyz(&step, &D_L09_00173FC0.point, &step); normalize_vector_xyz(&step, &step, 0.215f); add_vector_xyz(&moby->pos, &moby->pos, &step); @@ -666,18 +668,18 @@ void FUN_L09_0030b3b0(struct Moby *moby) { other->state != 0xFD) { subtract_vector_xyz(&away, &moby->pos, &other->pos); away.f[2] = 0.0f; - dist = FUN_001f9af0(&away); + dist = fast_vec_length(&away); if (dist < 1.8f) { scale_vector_xyz(&away, &away, (1.8f - dist) * (frame_scale * -0.5f + 1.0f)); add_vector_xyz(&moby->pos, &moby->pos, &away); } } } - if (FUN_001f9770(&vars->life) != 0) { + if (fast_dec_timer_s16(&vars->life) != 0) { moby->state = 2; } - moby->rot.x = FUN_L00_0025e310(vars->vel.f[0]); - moby->rot.y = FUN_L00_0025e310(vars->vel.f[1]); + moby->rot.x = normalize_angle(vars->vel.f[0]); + moby->rot.y = normalize_angle(vars->vel.f[1]); moby->collision = moby->pclass->collision; vars->owner->collision = vars->owner->pclass->collision; vars->vel.f[2] -= frame_time_sq * 9.8f; @@ -707,7 +709,7 @@ void FUN_L09_0030b3b0(struct Moby *moby) { } break; } - FUN_L00_00259fe8(moby, moby->scale * 0.3f / moby->pclass->scale); + jet_animate(moby, moby->scale * 0.3f / moby->pclass->scale); if (moby->pos.z < 5.0f || moby->pos.z > 500.0f) { FUN_L09_0030b350(moby, (char *)vars); return; diff --git a/src/overlays/shared/gameplay/entities/thruster_pack_lock.c b/src/overlays/shared/gameplay/entities/thruster_pack_lock.c index 81d29713a1..19b347f515 100644 --- a/src/overlays/shared/gameplay/entities/thruster_pack_lock.c +++ b/src/overlays/shared/gameplay/entities/thruster_pack_lock.c @@ -64,7 +64,7 @@ extern unsigned char D_0014C190_r[] __asm__("D_0014C190"); extern unsigned char D_0013F350_r[] __asm__("D_0013F350"); extern unsigned char D_0014C050_r[] __asm__("D_0014C050"); extern unsigned char D_0013F3D0_r[] __asm__("D_0013F3D0"); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern int D_0014C050; /* no foreign declaration */ extern int D_L11_0015FC88; /* no foreign declaration */ extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); @@ -81,7 +81,8 @@ extern int func_L00_00203F20_3102C8(int a, int b) __asm__("FUN_L00_00203908"); extern float func_001F9D48_3102C8(void *, void *) __asm__("FUN_001f9b80"); extern int func_001F9850_3102C8(int) __asm__("FUN_001f96f8"); -void FUN_L11_0030ee00(Lock_3102C8 *moby) +void thruster_pack_lock_update(Lock_3102C8 *moby) __asm__("FUN_L11_0030ee00"); +void thruster_pack_lock_update(Lock_3102C8 *moby) { char *vars = moby->vars; @@ -535,7 +536,7 @@ extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9 extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); void enqueue_callback_list_1(int arg0, int arg1) __asm__("FUN_001f4600"); extern void f49(void *, void *) __asm__("FUN_001f4600"); -extern void cb(void) __asm__("FUN_L11_003192c8"); +extern void FUN_L11_003192c8_c(void) __asm__("FUN_L11_003192c8"); void FUN_L11_00319670(char *moby) { char *d = *(char **)(moby + 0x78); @@ -570,7 +571,7 @@ void FUN_L11_00319670(char *moby) { int *p = *(int **)(d + 0x2C8); if (t != *p) { *p = t; - f49(cb, moby); + f49(FUN_L11_003192c8_c, moby); } } } @@ -755,3 +756,4 @@ void FUN_L11_0031a438(char *moby) { normalize_vector_xyz(direction, direction, *(float *)(d + 0x80)); add_vector_xyz(&MOBY(moby)->pos, &MOBY(moby)->pos, direction); } + diff --git a/src/overlays/shared/gameplay/entities/timed_activation_pads.c b/src/overlays/shared/gameplay/entities/timed_activation_pads.c index 2953212609..bfe92caedd 100644 --- a/src/overlays/shared/gameplay/entities/timed_activation_pads.c +++ b/src/overlays/shared/gameplay/entities/timed_activation_pads.c @@ -40,14 +40,14 @@ extern int fast_dec_timer_s16() __asm__("FUN_001f9770"); extern int vector_distance_xy() __asm__("FUN_001f9b80"); extern int set_identity_matrix() __asm__("FUN_001f9fc8"); extern int transpose_rotation_matrix() __asm__("FUN_001fa2d8"); -extern int FUN_L00_002502f0(); +extern int set_moby_color() __asm__("FUN_L00_002502f0"); extern s32 allocate_voice_for_target_entry() __asm__("func_0022DA68"); extern s32 scale_game_frames() __asm__("func_001F96F8"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_dec_timer(s32 *) __asm__("func_001F9740"); extern void transform_vector(void *, void *, void *) __asm__("func_001F9D20"); float absolute_float(float input) __asm__("func_001F99C0"); -void FUN_L00_002502a0(int idx); +void jet_clear_persistent(int idx) __asm__("FUN_L00_002502a0"); void FUN_L01_0026e090(int i, int v); void FUN_L01_0026e0e0(int list, int state); extern char D_0013E633_30D370[] __asm__("D_0013F350") NOT_SDA; @@ -63,7 +63,8 @@ extern void glow_n(void *, int, int, int) __asm__("FUN_L00_002502f0"); extern void func_L00_002512D8_30D370(int) __asm__("FUN_L00_002502a0"); extern int func_001F9938_30D370(void *) __asm__("FUN_001f9770"); -void FUN_L07_0030bf90(unsigned char *moby) +void timed_activation_pads_update(unsigned char *moby) __asm__("FUN_L07_0030bf90"); +void timed_activation_pads_update(unsigned char *moby) { char *d; char *p; @@ -215,7 +216,8 @@ extern void subtract_vector_xyz_310df0(void *, void *, void *) __asm__("FUN_001f extern void play_sound_310df0(s32, s32, void *) __asm__("FUN_0022da68"); -void FUN_L07_00310df0(u8 *moby) +void door_update(u8 *moby) __asm__("FUN_L07_00310df0"); +void door_update(u8 *moby) { u8 *data = *(u8 **)(moby + 0x78); u8 *other; @@ -345,7 +347,8 @@ extern void play_sound_31aee0(s32, s32, void *) __asm__("FUN_0022da68"); extern void update_moby_motion_31aee0(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); extern char *level_mobys __asm__("D_L07_0015FFD8"); -void FUN_L07_0031aee0(u8 *moby) +void bridge_update(u8 *moby) __asm__("FUN_L07_0031aee0"); +void bridge_update(u8 *moby) { u8 *data = *(u8 **)(moby + 0x78); u8 *other; diff --git a/src/overlays/shared/gameplay/entities/trackdrive_left.c b/src/overlays/shared/gameplay/entities/trackdrive_left.c index e31d08c0c3..d462c2919e 100644 --- a/src/overlays/shared/gameplay/entities/trackdrive_left.c +++ b/src/overlays/shared/gameplay/entities/trackdrive_left.c @@ -298,7 +298,8 @@ void FUN_L02_002a46e0(void) { extern unsigned int D_L02_0015FFDC; -void FUN_L02_002cb978(char *moby) { +void trackdrive_left_update(char *moby) __asm__("FUN_L02_002cb978"); +void trackdrive_left_update(char *moby) { if ((unsigned int)moby < D_L02_0015FFDC) { *(int *)(moby + 0x58) = 0; *(unsigned short *)(moby + 0x34) |= 0x40; @@ -441,10 +442,10 @@ extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern s32 force_help_message(s32 arg0, s32 arg1) __asm__("FUN_002151d8"); extern void allocate_voice_for_target_entry_alt(int, int, int) __asm__("FUN_0022da68"); extern void enqueue_callback_list_1_alt(void (*)(void), void *) __asm__("FUN_001f4600"); -void FUN_L00_0025d538(s32 id, void *s); +void trooper_anim_finish(s32 id, void *s) __asm__("FUN_L00_0025d538"); void FUN_L00_002ea9d8(char *src); void FUN_L00_002eaa30(char *src); -void FUN_L00_002eaaa0(void *pa, void *pb, s32 mode, s32 w, s32 x); +void jet_mount(void *pa, void *pb, s32 mode, s32 w, s32 x) __asm__("FUN_L00_002eaaa0"); void FUN_L00_002eac18(int mode); void FUN_L01_002405a0(void); void FUN_L02_002d8910_c(float *pos, float *rot, char *moby) __asm__("FUN_L02_002d8910"); @@ -492,7 +493,8 @@ extern Hero D_0013F450_2D9F08 __asm__("D_0013F350"); extern int D_0013CAE4 __attribute__((section(".data"))); extern char D_0013C940[]; -void FUN_L02_002d8ad0(Moby *moby) { +void tresspasser_pad_update(Moby *moby) __asm__("FUN_L02_002d8ad0"); +void tresspasser_pad_update(Moby *moby) { Vec_2D9F08 camera_pos, camera_rot; Data_2D9F08 *data = (struct Data_2D9F08 *)moby->pvars; int i; @@ -729,9 +731,9 @@ extern int D_L02_00161BC0 __attribute__((sda)); extern int D_L02_00161BC4 __attribute__((sda)); extern int D_L02_0015F5CC; extern void FUN_L02_002dae88(void); -extern void draw_arc_2d93e8(u64, u32, float, float, float, float) __asm__("FUN_L02_002da3d8"); -extern void draw_arrow_2d93e8(u64, int, int, float, float) __asm__("FUN_L02_002da6c0"); -extern void draw_bar_2d93e8(u64, f32, f32, f32, s32) __asm__("FUN_L02_002da938"); +extern void FUN_L02_002da3d8(u64, u32, float, float, float, float); +extern void FUN_L02_002da6c0(u64, int, int, float, float); +extern void FUN_L02_002da938(u64, f32, f32, f32, s32); void FUN_L02_002d93e8(char *moby) { char *data = *(char **)(moby + 0x78); @@ -803,10 +805,10 @@ void FUN_L02_002d93e8(char *moby) { } } phase = add_rotation_2d93e8(angle, 0.31415927f); - draw_bar_2d93e8(texture, phase, (float)D_L02_00161B50, distance, color); + FUN_L02_002da938(texture, phase, (float)D_L02_00161B50, distance, color); if (draw_second) { phase = add_rotation_2d93e8(angle, 0.31415927f); - draw_bar_2d93e8(texture, phase, distance, (float)D_L02_00161B50, D_L02_00161BB4); + FUN_L02_002da938(texture, phase, distance, (float)D_L02_00161B50, D_L02_00161BB4); } } } @@ -843,10 +845,10 @@ void FUN_L02_002d93e8(char *moby) { } else distance = (float)-extent; } phase = add_rotation_2d93e8(angle, 0.31415927f); - draw_bar_2d93e8(texture, phase, (float)D_L02_00161B44, distance, color); + FUN_L02_002da938(texture, phase, (float)D_L02_00161B44, distance, color); if (draw_second) { phase = add_rotation_2d93e8(angle, 0.31415927f); - draw_bar_2d93e8(texture, phase, distance, (float)D_L02_00161B44, D_L02_00161BB4); + FUN_L02_002da938(texture, phase, distance, (float)D_L02_00161B44, D_L02_00161BB4); } } } @@ -882,10 +884,10 @@ void FUN_L02_002d93e8(char *moby) { } } phase = add_rotation_2d93e8(angle, 0.31415927f); - draw_bar_2d93e8(texture, phase, (float)D_L02_00161B38, distance, color); + FUN_L02_002da938(texture, phase, (float)D_L02_00161B38, distance, color); if (draw_second) { phase = add_rotation_2d93e8(angle, 0.31415927f); - draw_bar_2d93e8(texture, phase, distance, (float)D_L02_00161B38, D_L02_00161BB4); + FUN_L02_002da938(texture, phase, distance, (float)D_L02_00161B38, D_L02_00161BB4); } } } @@ -906,20 +908,20 @@ void FUN_L02_002d93e8(char *moby) { else color = D_L02_00161BA4; \ angle = add_rotation_2d93e8(angle, (float)(i * 30) * 0.017453292f); \ phase = add_rotation_2d93e8(angle, 0.5235988f); \ - draw_arc_2d93e8(texture, color, angle, phase, (float)(outer_start), (float)(outer_end)); \ + FUN_L02_002da3d8(texture, color, angle, phase, (float)(outer_start), (float)(outer_end)); \ ring_index = (i + *(int *)(data + (offset))) % 12; \ value = (slots)[ring_index]; \ if (value != 0) { \ if (value >= 3) { \ phase = add_rotation_2d93e8(angle, 0.2617994f); \ - draw_arrow_2d93e8(texture, D_L02_00161BA8, 0, phase, (float)(radius)); \ + FUN_L02_002da6c0(texture, D_L02_00161BA8, 0, phase, (float)(radius)); \ (slots)[(i + *(int *)(data + (offset))) % 12] = 2; \ } else if (value == 2) { \ phase = add_rotation_2d93e8(angle, 0.2617994f); \ - draw_arrow_2d93e8(texture, D_L02_00161BA8, 1, phase, (float)(radius)); \ + FUN_L02_002da6c0(texture, D_L02_00161BA8, 1, phase, (float)(radius)); \ } else { \ phase = add_rotation_2d93e8(angle, 0.2617994f); \ - draw_arrow_2d93e8(texture, D_L02_00161BA8, 2, phase, (float)(radius)); \ + FUN_L02_002da6c0(texture, D_L02_00161BA8, 2, phase, (float)(radius)); \ } \ } \ } } @@ -936,7 +938,7 @@ void FUN_L02_002d93e8(char *moby) { if (markers[11 - i] == 2) color = D_L02_00161BC4; else if (D_0013CAE4 & 0x20) color = D_L02_00161BC0; else color = D_L02_00161BBC; - draw_arc_2d93e8(texture, color, angle, phase, (float)D_L02_00161B58, (float)D_L02_00161B54); + FUN_L02_002da3d8(texture, color, angle, phase, (float)D_L02_00161B58, (float)D_L02_00161B54); } } vu1_add_g_sregister_2d93e8(0x47, 0x5360b); @@ -1095,8 +1097,8 @@ extern char *D_L02_00161B04 __attribute__((sda)); extern char *D_L02_00161B08 __attribute__((sda)); extern s32 D_L02_00161B64 __attribute__((sda)); -extern f32 FUN_001f9de0(f32); -extern f32 FUN_001f9dc8(f32); +extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); +extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern s32 FUN_001f44b8(s32); extern void FUN_L02_0020bc88_u(void *, void *, void *, s32, s32) __asm__("FUN_L02_0020bc88"); @@ -1137,25 +1139,25 @@ void FUN_L02_002da938(void *unused, f32 a, f32 b, f32 c, s32 d) { p4[2] = (s32)(D_L02_00161AF4 + off); p4[3] = (s32)(D_L02_00161AF8 + off); - f25 = FUN_001f9de0(a) * b; - f24 = FUN_001f9dc8(a) * b; - f28 = FUN_001f9de0(a) * c; - f27 = FUN_001f9dc8(a) * c; - s0 = FUN_001f9dc8(a); + f25 = fast_sin(a) * b; + f24 = fast_cos(a) * b; + f28 = fast_sin(a) * c; + f27 = fast_cos(a) * c; + s0 = fast_cos(a); f29 = f25 + s0 * 2.0f; - s0 = FUN_001f9dc8(a); + s0 = fast_cos(a); f25 = f25 - s0 * 2.0f; - s0 = FUN_001f9de0(a); + s0 = fast_sin(a); f26 = f24 - s0 * 2.0f; - s0 = FUN_001f9de0(a); + s0 = fast_sin(a); f24 = f24 + s0 * 2.0f; - s0 = FUN_001f9dc8(a); + s0 = fast_cos(a); f31 = f28 + s0 * 2.0f; - s0 = FUN_001f9dc8(a); + s0 = fast_cos(a); f28 = f28 - s0 * 2.0f; - s0 = FUN_001f9de0(a); + s0 = fast_sin(a); f30 = f27 - s0 * 2.0f; - s0 = FUN_001f9de0(a); + s0 = fast_sin(a); f27 = f27 + s0 * 2.0f; m[3] = 0xFFFFF000000000ULL; @@ -1180,25 +1182,25 @@ void FUN_L02_002da938(void *unused, f32 a, f32 b, f32 c, s32 d) { p4[2] = (s32)D_L02_00161B04; p4[3] = (s32)D_L02_00161B08; - f25 = FUN_001f9de0(a) * b; - f24 = FUN_001f9dc8(a) * b; - f28 = FUN_001f9de0(a) * c; - f27 = FUN_001f9dc8(a) * c; - s0 = FUN_001f9dc8(a); + f25 = fast_sin(a) * b; + f24 = fast_cos(a) * b; + f28 = fast_sin(a) * c; + f27 = fast_cos(a) * c; + s0 = fast_cos(a); f29 = f25 + s0 * 5.0f; - s0 = FUN_001f9dc8(a); + s0 = fast_cos(a); f25 = f25 - s0 * 5.0f; - s0 = FUN_001f9de0(a); + s0 = fast_sin(a); f26 = f24 - s0 * 5.0f; - s0 = FUN_001f9de0(a); + s0 = fast_sin(a); f24 = f24 + s0 * 5.0f; - s0 = FUN_001f9dc8(a); + s0 = fast_cos(a); f31 = f28 + s0 * 5.0f; - s0 = FUN_001f9dc8(a); + s0 = fast_cos(a); f28 = f28 - s0 * 5.0f; - s0 = FUN_001f9de0(a); + s0 = fast_sin(a); f30 = f27 - s0 * 5.0f; - s0 = FUN_001f9de0(a); + s0 = fast_sin(a); f27 = f27 + s0 * 5.0f; m[3] = 0xFFFFF000000000ULL; @@ -1258,7 +1260,8 @@ extern float fast_cos_2dc6b0(float) __asm__("FUN_001f9dc8"); extern float fast_sin_2dc6b0(float) __asm__("FUN_001f9de0"); extern void FUN_L00_00260738_2dc6b0(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); -void FUN_L02_002dc6b0(char *moby) { +void escalator_update(char *moby) __asm__("FUN_L02_002dc6b0"); +void escalator_update(char *moby) { char *data = *(char **)(moby + 0x78); float limit; float y; @@ -1354,14 +1357,14 @@ extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern unsigned char D_0014C050_a[] __asm__("D_0014C050"); extern int D_L02_0015F5CC; /* no foreign declaration */ extern int D_L02_0015FFD8; /* no foreign declaration */ -extern int FUN_L00_0025be00(); +extern int approach_angle() __asm__("FUN_L00_0025be00"); extern s32 random_integer_below(s32) __asm__("func_00213260"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); extern float D_L02_00161CB0 __attribute__((sda)); extern int D_L02_00161CB4 __attribute__((sda)); extern float D_L02_00161CB8 __attribute__((sda)); extern float D_L02_00161CBC; -extern void FUN_L00_002502f0(void *, int, int, int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); extern void FUN_L00_002730e0(void *, void *, int, int, int, int, float); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); @@ -1373,7 +1376,8 @@ extern void func_L02_002FBC00_c(char *) __asm__("FUN_L02_002fa7c8"); extern float func_L00_0025CE58_f(float *, float, float *, float, float, float) __asm__("FUN_L00_0025be00"); -void FUN_L02_002e0450(char *m) { +void swingshot_versatarget_update(char *m) __asm__("FUN_L02_002e0450"); +void swingshot_versatarget_update(char *m) { char *d = *(char **)(m + 0x78); float v[4]; float w[4]; @@ -1388,7 +1392,7 @@ void FUN_L02_002e0450(char *m) { m[0x20] = 2; *(unsigned short *)(m + 0x34) |= 0x41; } else { - FUN_L00_002502f0(m, 0xC0, 0xC0, 0xC0); + set_moby_color(m, 0xC0, 0xC0, 0xC0); func_L02_002FBB10_c(m); m[0x20] = 1; } @@ -1468,33 +1472,30 @@ void FUN_L02_002e0cd8(char *moby) { } } } -#ifndef NON_MATCHING -INCLUDE_ASM("config/us/overlays/asm/FUN_L02_002ea210.s", FUN_L02_002ea210); -#else extern int scale_game_frames(int) __asm__("FUN_001f96f8"); -extern void ea210_init(char *) __asm__("FUN_L02_002ea7d0"); -extern void ea210_update(char *) __asm__("FUN_L02_002ea8b0"); +extern void FUN_L02_002ea7d0_c(struct Moby *) __asm__("FUN_L02_002ea7d0"); +extern void FUN_L02_002ea8b0_c(struct Moby *) __asm__("FUN_L02_002ea8b0"); extern float probe_ground_height(void *, int, float) __asm__("FUN_00213508"); extern float ea210_addrot(float, float) __asm__("FUN_001fa580"); extern float ea210_dist(void *, void *) __asm__("FUN_001f9b80"); extern float ea210_abs(float) __asm__("FUN_001f99c0"); extern void ea210_sound(int) __asm__("FUN_L00_00298840"); -extern void ea210_switch(int, int) __asm__("FUN_L00_00260860"); +extern void FUN_L00_00260860(int, int); extern void ea210_play(int, int) __asm__("FUN_L00_00263d40"); -extern void ea210_stop(void) __asm__("FUN_L00_002039a0"); +extern void FUN_L00_002039a0(void); extern void ea210_timing(int, int) __asm__("FUN_L00_00203908"); -extern void ea210_camera(void *, void *, int, int) __asm__("FUN_L00_00216f90"); +extern void FUN_L00_00216f90(void *, void *, int, int); extern void ea210_approach(float, float, float, float, void *, void *) __asm__("FUN_00213f38"); extern void ea210_transform(float, void *, void *, void *) __asm__("FUN_001f9a40"); extern float ea210_interp(float, float) __asm__("FUN_001fa5c8"); extern float ea210_clamp(float, float) __asm__("FUN_001fa580"); extern void ea210_draw(void *, void *, int, int, int) __asm__("FUN_L00_002eaaa0"); -extern void ea210_drawend(void *) __asm__("FUN_L00_002ea9d8"); -extern void ea210_drawflush(void *) __asm__("FUN_L00_002eaa30"); +extern void FUN_L00_002ea9d8_c(void *) __asm__("FUN_L00_002ea9d8"); +extern void FUN_L00_002eaa30_c(void *) __asm__("FUN_L00_002eaa30"); extern float ea210_fade(float, float, void *) __asm__("FUN_00213ed8"); -extern void ea210_hide(int) __asm__("FUN_L00_002eac18"); +extern void FUN_L00_002eac18(int); extern void ea210_audio(int, int) __asm__("FUN_0020b178"); -extern void ea210_destroy(char *) __asm__("FUN_0020c828"); +extern void ea210_destroy(struct Moby *) __asm__("FUN_0020c828"); extern int D_L02_0015F5CC; extern unsigned char D_001413F4 __attribute__((section(".data"))); extern int D_L02_0015F640 __attribute__((sda)); @@ -1506,41 +1507,42 @@ extern float D_0015ED70; extern float D_0015ED6C; extern float D_L02_0015F3FC; -void FUN_L02_002ea210(char *moby) { +void tresspasser_update(struct Moby *moby) __asm__("FUN_L02_002ea210"); +void tresspasser_update(struct Moby *moby) { char *data; int which; int frames; float angle; - data = *(char **)(moby + 0x78); + float ground_offset; + data = (char *)moby->pvars; frames = scale_game_frames(60); angle = 3.14159274f / (float)frames; - which = *(short *)(moby + 0xA6) == 0x3ED ? 0x1A : 0x16; - switch (*(unsigned char *)(moby + 0x20)) { + which = moby->oclass == 0x3ED ? 0x1A : 0x16; + switch (moby->state) { case 0: - ea210_init(moby); + FUN_L02_002ea7d0_c(moby); + ground_offset = 0.2f; if (items_acquired[which] == 0) { - float height; - probe_ground_height(moby + 0x10, 0, 0.5f); - *(float *)(moby + 0x44) = 3.14159274f; - *(float *)(moby + 0x40) = 1.57079637f; - height = D_L02_00174468; - *(unsigned char *)(moby + 0x20) = 1; - *(float *)(moby + 0x18) = height + 0.2f; + probe_ground_height(&moby->pos, 0, 0.5f); + *(float *)((char *)moby + 0x40) = 1.57079637f; + *(float *)((char *)moby + 0x44) = 3.14159274f; + moby->pos.z = D_L02_00174468 + ground_offset; + moby->state = 1; return; } ea210_destroy(moby); return; case 1: - *(float *)(moby + 0x48) = ea210_clamp(*(float *)(moby + 0x48), angle); - ea210_update(moby); + moby->rot.z = ea210_clamp(moby->rot.z, angle); + FUN_L02_002ea8b0_c(moby); if (D_L02_0015F5CC % 10 != 0) return; - if (!(ea210_dist(moby + 0x10, D_0013F3D0) < 1.0f)) return; - if (ea210_abs(*(float *)(moby + 0x18) - *(float *)(D_0013F3D0 + 8)) < 2.0f) { - *(unsigned char *)(moby + 0x20) = 3; - *(unsigned short *)(moby + 0x34) |= 1; - moby[0x31] = 0; - *(int *)(moby + 0x94) = 0; - if (*(short *)(moby + 0xA6) == 0x3ED) { + if (!(ea210_dist(&moby->pos, D_0013F3D0) < 1.0f)) return; + if (ea210_abs(moby->pos.z - *(float *)(D_0013F3D0 + 8)) < 2.0f) { + moby->state = 3; + moby->flags |= 1; + moby->visible = 0; + moby->collision = 0; + if (moby->oclass == 0x3ED) { ea210_sound(4); } else { ea210_sound(2); @@ -1551,21 +1553,21 @@ void FUN_L02_002ea210(char *moby) { if (level_game_mode == 2) return; if (D_001413F4 != 0) { if (which == 0x16) { - ea210_switch(0x16, 0); + FUN_L00_00260860(0x16, 0); D_L02_0015F640 = 0; } else { - ea210_switch(which, 0); + FUN_L00_00260860(which, 0); } } else { - ea210_switch(which, 1); + FUN_L00_00260860(which, 1); } - if (*(short *)(moby + 0xA6) == 0x3ED) { + if (moby->oclass == 0x3ED) { ea210_play(0x7DF, -1); - ea210_stop(); + FUN_L00_002039a0(); ea210_timing(0x7D9, 0x13); D_L02_0015F3FC = 1.0f; - *(unsigned char *)(moby + 0x20) = 4; - ea210_camera(D_0013F3D0, D_0013F3D0 + 16, 0x72, 1); + moby->state = 4; + FUN_L00_00216f90(D_0013F3D0, D_0013F3D0 + 16, 0x72, 1); return; } ea210_audio(0, -1); @@ -1592,8 +1594,8 @@ void FUN_L02_002ea210(char *moby) { output[0] = ea210_clamp(ea210_interp(d[0], c[0]) * *(float *)(data + 0x40), c[0]); if (D_L02_00167400 && *(short *)(D_L02_00167400 + 0x86) != 5) ea210_draw(position, output, 1, 0, 0); - ea210_drawend(position); - ea210_drawflush(output); + FUN_L00_002ea9d8_c(position); + FUN_L00_002eaa30_c(output); if (D_L02_00179A10.i0 == 0 && D_L02_00179A10.i24 == -1 && 0.2f < *(float *)(data + 0x40)) { ea210_fade(1.0f, frame_time * 4.0f, &D_L02_0015F3FC); @@ -1601,9 +1603,9 @@ void FUN_L02_002ea210(char *moby) { ea210_fade(0.0f, D_0015ED6C * 4.0f, &D_L02_0015F3FC); } if (D_L02_0015F3FC != 1.0f) return; - ea210_camera(D_0013F3D0, D_0013F3D0 + 16, 0, 0); - ea210_hide(0); - *(unsigned char *)(moby + 0x20) = 5; + FUN_L00_00216f90(D_0013F3D0, D_0013F3D0 + 16, 0, 0); + FUN_L00_002eac18(0); + moby->state = 5; return; } case 5: @@ -1615,7 +1617,6 @@ void FUN_L02_002ea210(char *moby) { return; } } -#endif /* Initialises a moby's data block: four random floats, fixed constants, four random ints. */ /* Ported from rac1-decomp (src/overlays/shared/vendor_002A5218.c: func_L02_002EBC08), where it is exact; names translated to the US level program. */ @@ -1694,3 +1695,50 @@ void FUN_L02_002ea8b0(char *m) { func_001F9BD8_ea8b0(d, d, e); } } + +s32 D_L03_001CB4C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001CB4C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001CB4CC[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_0017C5E0[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_0017C5E4[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_001D3010[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_001D3020[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_001D3030[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_001D3040[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001CB844[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001CB848[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001CB84C[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_001D4AC0[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_001D4AD0[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_001D4AE0[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_001D4AF0[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001CB444[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001CB448[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001CB44C[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001CBBC4[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001CBBC8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001CBBCC[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_001E93A0[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_001E93B0[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_001E93C0[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_001E93D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001CB544[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001CB548[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001CB54C[1] __attribute__((section(".data"))) = {0}; +f32 D_L11_001D3750[1] __attribute__((section(".data"))) = {0}; +f32 D_L11_001D3760[1] __attribute__((section(".data"))) = {0}; +f32 D_L11_001D3770[1] __attribute__((section(".data"))) = {0}; +f32 D_L11_001D3780[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_001D3780[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_001D3790[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_001D37A0[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_001D37B0[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0017CB60[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0017CB64[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001CBAC4[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001CBAC8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001CBACC[1] __attribute__((section(".data"))) = {0}; +f32 D_L18_001D3770[1] __attribute__((section(".data"))) = {0}; +f32 D_L18_001D3780[1] __attribute__((section(".data"))) = {0}; +f32 D_L18_001D3790[1] __attribute__((section(".data"))) = {0}; +f32 D_L18_001D37A0[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/trespasser.c b/src/overlays/shared/gameplay/entities/trespasser.c index 9b4422f913..9a51fed9ef 100644 --- a/src/overlays/shared/gameplay/entities/trespasser.c +++ b/src/overlays/shared/gameplay/entities/trespasser.c @@ -20,7 +20,8 @@ extern unsigned char D_0013A4E0[]; extern void FUN_L00_002c1778_u(void *) __asm__("FUN_L00_002c1778"); /* Runs FUN_L00_002c1778 when the moby data word 4 is set, else sets byte 0xBC from a mask test. */ -void FUN_L00_002c1718(char *m) { +void trespasser_update(char *m) __asm__("FUN_L00_002c1718"); +void trespasser_update(char *m) { if (*(int *)(*(char **)(m + 0x78) + 4) != 0) { FUN_L00_002c1778_u(m); } else if (*(int *)(D_0013A4E0 + 0x2600) & *(int *)(((unsigned char *)&D_0013E533) + 0x1EBD)) { @@ -173,11 +174,11 @@ void FUN_L00_002c40a0(S_2c40a0 *self) { if (self->f18 < g) self->f18 = g; } -s32 FUN_001f0b58(); +s32 collision_hit_material() __asm__("FUN_001f0b58"); void FUN_L00_002c3440(); /* Calls FUN_L00_002c3440 on m for collision_hit_material results 0, 1, 3, 8, 11, 12 and 13. */ void FUN_L00_002c4328(void *m) { - switch (FUN_001f0b58()) { + switch (collision_hit_material()) { case 0: case 1: case 3: @@ -202,7 +203,8 @@ unsigned char *FUN_0020c4f8_002c52a8(int) __asm__("FUN_0020c4f8"); int FUN_001f96f8_002c52a8(int) __asm__("FUN_001f96f8"); void FUN_L00_00250df8_002c52a8(void *) __asm__("FUN_L00_00250df8"); void FUN_L00_0025d1b8_002c52a8(void *) __asm__("FUN_L00_0025d1b8"); -unsigned char *FUN_L00_002c52a8(u128 *a, int b, int c, int d) { +unsigned char *spawn_on_path(u128 *a, int b, int c, int d) __asm__("FUN_L00_002c52a8"); +unsigned char *spawn_on_path(u128 *a, int b, int c, int d) { unsigned char *m = 0; { S179AC0_2c52a8 *e = (S179AC0_2c52a8 *)(b * 0x4C + (u8 *)D_L00_00179AC0_002c52a8); @@ -242,7 +244,7 @@ extern float D_0015ED60_2c5be8 __asm__("D_0015ED60"); extern float D_0015ED6C_2c5be8 __asm__("D_0015ED6C"); extern int D_15F5CC_2c5be8 __asm__("D_L00_0015F5CC"); extern int f33e40_2c5be8(int, int) __asm__("FUN_L00_00233e40"); -extern void f63db0_2c5be8(int, int, int) __asm__("FUN_L00_00263db0"); +extern void FUN_L00_00263db0(int, int, int); extern void f99f8_2c5be8(void *) __asm__("FUN_001f99f8"); extern int f99a8_2c5be8(int) __asm__("FUN_001f99a8"); extern int f96f8_2c5be8(int) __asm__("FUN_001f96f8"); @@ -266,7 +268,7 @@ int FUN_L00_002c5be8(char *o) { goto fail; } d = weapon_ammo_counts[p[2]] - before; - f63db0_2c5be8(d == 1 ? ((E_2c5be8 *)(p[2] * 0x4C + (char *)D_179AC0_2c5be8))->h36 + FUN_L00_00263db0(d == 1 ? ((E_2c5be8 *)(p[2] * 0x4C + (char *)D_179AC0_2c5be8))->h36 : ((E_2c5be8 *)(p[2] * 0x4C + (char *)D_179AC0_2c5be8))->h34, d, -1); if (f < (float)p[0]) { @@ -388,7 +390,7 @@ void FUN_L00_002c5dc8(char *m) { } #include "eetypes.h" unsigned char *create_moby(int) __asm__("FUN_0020c4f8"); -void FUN_L00_002502f0(unsigned char *, int, int, int); +void set_moby_color(unsigned char *, int, int, int) __asm__("FUN_L00_002502f0"); void moby_point_position(unsigned char *, int, void *) __asm__("FUN_L00_0024f7c8"); int scale_game_frames(int) __asm__("FUN_001f96f8"); void blend_moby_animation(unsigned char *, int, int, int) __asm__("FUN_00212f90"); @@ -402,7 +404,7 @@ unsigned char *FUN_L00_002c6f88(unsigned char *src, float f) { m[0x30] = 0xff; *(short *)(m + 0x32) = 0xff; m[0x31] = 1; - FUN_L00_002502f0(m, 0x80, 0x80, 0x80); + set_moby_color(m, 0x80, 0x80, 0x80); moby_point_position(src, 0, m + 0x10); *(u128 *)(m + 0xc0) = *(u128 *)(src + 0xc0); *(u128 *)(m + 0xd0) = *(u128 *)(src + 0xd0); @@ -420,7 +422,8 @@ void FUN_00212f90_2c7070(void *, int, int, int) __asm__("FUN_00212f90"); void FUN_0020c828_2c7070(void *) __asm__("FUN_0020c828"); void FUN_0020e098_2c7070(void *) __asm__("FUN_0020e098"); extern unsigned char D_001413FF __attribute__((section(".data"))); -void FUN_L00_002c7070(unsigned char *m) { +void swingshot_hook_update(unsigned char *m) __asm__("FUN_L00_002c7070"); +void swingshot_hook_update(unsigned char *m) { unsigned char **d; unsigned char *o; if (m == 0) @@ -563,7 +566,7 @@ void FUN_L00_002c7320(V2c7320 *pos, V2c7320 *tgt, f32 *out, f32 speed, f32 unuse } } #include "qcopy.h" -s32 FUN_001f0b58(); +s32 collision_hit_material() __asm__("FUN_001f0b58"); float random_float_between(float, float) __asm__("FUN_002132a8"); int rand(void) __asm__("FUN_001160d8"); int scale_game_frames(int) __asm__("FUN_001f96f8"); @@ -574,7 +577,7 @@ void FUN_L00_002c8078(unsigned char *m) { int r, g; unsigned char b; float s; - switch (FUN_001f0b58()) { + switch (collision_hit_material()) { case 0: case 1: case 3: @@ -732,7 +735,8 @@ extern int collect_mobies_in_sphere_2bffa8(float, void *, int, void *, void *) _ #define HB_2bffa8(o) (*((u8 *)&hero + (o))) #define ANIM_2bffa8(a,t) FUN_00257880_2c4380(moby,(a),0,scale_game_frames(t)) #define OUTSIDE_2bffa8 (moby->pos.x < 2.0f || 1021.0f < moby->pos.x || moby->pos.y < 2.0f || 1021.0f < moby->pos.y || moby->pos.z < 2.0f || 1021.0f < moby->pos.z) -void FUN_L00_002bffa8(struct Moby *moby) { +void doom_bot_update(struct Moby *moby) __asm__("FUN_L00_002bffa8"); +void doom_bot_update(struct Moby *moby) { extern int level_game_mode __asm__("D_L00_0015F5C4") __attribute__((sda)); Vars_2bffa8 *vars; OvlVec4 probe, start, end, delta, result; @@ -1135,8 +1139,8 @@ extern void build_moby_bone_transform(void *, int, void *) __asm__("FUN_0020cca8 extern f32 square_root(f32) __asm__("FUN_001f9988"); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern f32 atan2_f(f32, f32) __asm__("FUN_001f9e90"); -extern f32 FUN_001f9dc8(f32); -extern f32 FUN_001f9de0(f32); +extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); +extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void scale_vector_xyz(void *, void *, f32) __asm__("FUN_001f9a68"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); @@ -1183,7 +1187,8 @@ extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); /* Mine glove update: aims the glove and throws a mine at the target. */ -void FUN_L00_002c1ad0(struct Moby *moby) { +void mine_glove_update(struct Moby *moby) __asm__("FUN_L00_002c1ad0"); +void mine_glove_update(struct Moby *moby) { GloveVars_2c1ad0 *vars; Vec4 saved, offset, rotatedOffset; Vec4 local[4]; @@ -1383,7 +1388,7 @@ extern f32 dist2(void *, void *) __asm__("FUN_001f9b80"); extern f32 cos_2c(f32) __asm__("FUN_001f9dc8"); extern f32 sin_2c(f32) __asm__("FUN_001f9de0"); extern f32 scale_ticks(s32) __asm__("FUN_001fa6c0"); -extern f32 fn_2c2488(void *, void *, f32, f32, s32) __asm__("FUN_L00_0025abf0"); +extern f32 FUN_L00_0025abf0(void *, void *, f32, f32, s32); void aim_throw_arc(V2c2488 *pos, V2c2488 *tgt, f32 *out, f32 speed, f32 unused, f32 range) __asm__("FUN_L00_002c2488"); void aim_throw_arc(V2c2488 *pos, V2c2488 *tgt, f32 *out, f32 speed, f32 unused, f32 range) { @@ -1416,7 +1421,7 @@ void aim_throw_arc(V2c2488 *pos, V2c2488 *tgt, f32 *out, f32 speed, f32 unused, out[0] = cos_2c(ang) * s; out[1] = sin_2c(ang) * s; *(s32 *)&out[2] = 0; - out[2] = fn_2c2488(pos, &t, s, -speed, 0); + out[2] = FUN_L00_0025abf0(pos, &t, s, -speed, 0); if (D_0013CAE0[0] & 5) { k = scale_ticks(D_0013E52A[0]) * 2.5f + 8.5f; k = k / s; @@ -1465,8 +1470,8 @@ extern void build_moby_bone_transform(void *, int, void *) __asm__("FUN_0020cca8 extern f32 square_root(f32) __asm__("FUN_001f9988"); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern f32 atan2_f(f32, f32) __asm__("FUN_001f9e90"); -extern f32 FUN_001f9dc8(f32); -extern f32 FUN_001f9de0(f32); +extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); +extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void scale_vector_xyz(void *, void *, f32) __asm__("FUN_001f9a68"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); @@ -1484,7 +1489,8 @@ extern int FUN_L00_00216de8_2c1ad0(int, int) __asm__("FUN_L00_00216de8"); extern int FUN_L00_00233db8_2c1ad0(int, int) __asm__("FUN_L00_00233db8"); extern int FUN_L00_00233e98_2c1ad0(int) __asm__("FUN_L00_00233e98"); /* Updates the grip, chooses a throw target, and handles the held moby states. */ -void FUN_L00_002c26c8(struct Moby *moby) { +void bomb_glove_update(struct Moby *moby) __asm__("FUN_L00_002c26c8"); +void bomb_glove_update(struct Moby *moby) { CarrierVars_2c26c8 *vars; OvlVec4 local[4], saved, offset, rotatedOffset, pos, target, basis[3], matrix[4]; OvlVec4 launch; @@ -1535,8 +1541,8 @@ void FUN_L00_002c26c8(struct Moby *moby) { launch.q = 0; launch.f[0] = 1.0f; adjust_direction_2c1ad0(&launch, &launch, hero.basis); - pos.f[0] = FUN_001f9dc8(fast_add_rotations(-0.361968011f, atan2_f(hero.unk670, hero.unk674))) * 0.859039009f; - pos.f[1] = FUN_001f9de0(fast_add_rotations(-0.361968011f, atan2_f(hero.unk670, hero.unk674))) * 0.859039009f; + pos.f[0] = fast_cos(fast_add_rotations(-0.361968011f, atan2_f(hero.unk670, hero.unk674))) * 0.859039009f; + pos.f[1] = fast_sin(fast_add_rotations(-0.361968011f, atan2_f(hero.unk670, hero.unk674))) * 0.859039009f; pos.f[2] = 0.0f; add_vector_xyz(&pos, &pos, &hero.motion.pos); pos.f[2] += 0.490819991f; @@ -1572,8 +1578,8 @@ void FUN_L00_002c26c8(struct Moby *moby) { radius = (root + root) * root * (1.0f - horizontal) / (frame_time_sq_macro * 11.0f); vertical = horizontal * radius; if (0.0f < radius) { - temporary.arc.f[0] = FUN_001f9dc8(angle) * radius; - temporary.arc.f[1] = FUN_001f9de0(angle) * radius; + temporary.arc.f[0] = fast_cos(angle) * radius; + temporary.arc.f[1] = fast_sin(angle) * radius; temporary.arc.f[2] = vertical; add_vector_xyz(&probe, &D_L00_00166DC0_2c1ad0, &temporary.arc); if (collision_line(&D_L00_00166DC0_2c1ad0, &probe, 2, moby, 0) && coll_hit.moby != (s32)hero.moby) { @@ -1582,8 +1588,8 @@ void FUN_L00_002c26c8(struct Moby *moby) { angle = atan2_f(target.f[0] - pos.f[0], target.f[1] - pos.f[1]); } if (!hit) { - target.f[0] = FUN_001f9dc8(angle) * radius * 5.0f; - target.f[1] = FUN_001f9de0(angle) * radius * 5.0f; + target.f[0] = fast_cos(angle) * radius * 5.0f; + target.f[1] = fast_sin(angle) * radius * 5.0f; target.f[2] = vertical * 5.0f; add_vector_xyz(&target, &target, &D_L00_00166DC0_2c1ad0); } @@ -1668,7 +1674,7 @@ extern u8 D_0013E539; extern s32 D_L00_0015FFD8_2c35c0 __asm__("D_L00_0015FFD8"); extern s16 D_L00_001B0830_lui[] __asm__("D_L00_001B0830")__attribute__((section(".data"))); extern f32 FUN_002132a8_2c35c0(f32, f32) __asm__("FUN_002132a8"); -extern void FUN_L00_0025f800(void *, void *); +extern void mine_spawn_drops(void *, void *) __asm__("FUN_L00_0025f800"); extern void FUN_L00_0025d1b8(void *); extern void FUN_L00_0025f780(void *, void *, s32); @@ -1720,7 +1726,7 @@ u8 *FUN_L00_002c35c0(s32 value, u128 *position, u128 *other_position) { } } if (candidate != 0) { - FUN_L00_0025f800(candidate, D_L00_001B0830_lui); + mine_spawn_drops(candidate, D_L00_001B0830_lui); candidate[0x20] = 6; } } @@ -1817,8 +1823,8 @@ extern Vec4 coll_hit_normal __asm__("D_L00_00173E80") __attribute__((section(".d extern Vec4 D_L00_00166DC0 __attribute__((section(".data"))); extern f32 atan2_f(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); -extern f32 FUN_001f9dc8(f32); /* cos */ -extern f32 FUN_001f9de0(f32); /* sin */ +extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); /* cos */ +extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); /* sin */ extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void scale_vector_xyz(void *, void *, f32) __asm__("FUN_001f9a68"); @@ -1849,8 +1855,8 @@ s32 FUN_L00_002c3af8(ThrowVars *v, struct Moby *m, s32 mode) return 0; qcopy(&a, &m->pos); if (m->state == 1) { - d.f[0] = FUN_001f9dc8(fast_add_rotations(-0.36196801066398620605f, atan2_f(hero.unk670, hero.unk674))) * 0.85903900861740112305f; - d.f[1] = FUN_001f9de0(fast_add_rotations(-0.36196801066398620605f, atan2_f(hero.unk670, hero.unk674))) * 0.85903900861740112305f; + d.f[0] = fast_cos(fast_add_rotations(-0.36196801066398620605f, atan2_f(hero.unk670, hero.unk674))) * 0.85903900861740112305f; + d.f[1] = fast_sin(fast_add_rotations(-0.36196801066398620605f, atan2_f(hero.unk670, hero.unk674))) * 0.85903900861740112305f; d.f[2] = 0.0f; add_vector_xyz(&d, &d, &hero.motion.pos); d.f[2] += 0.39081999659538269043f; @@ -1877,7 +1883,7 @@ s32 FUN_L00_002c3af8(ThrowVars *v, struct Moby *m, s32 mode) e.f[2] -= D_0015ED6C * 0.5f; q.q = ((Vec4 *)&hero.moby->pos)->q; q.f[2] = d.f[2]; - if (collision_line(&q, &d, 0x10, hero.moby, 0) && (FUN_001f0b58() || 0.0f < e.f[2])) { + if (collision_line(&q, &d, 0x10, hero.moby, 0) && (collision_hit_material() || 0.0f < e.f[2])) { if (coll_hit.moby != 0 && coll_hit.unk1C <= 0) { if (((struct Moby *)coll_hit.moby != hero.moby && (struct Moby *)coll_hit.moby != v->holder) || t < scale_game_frames(300) - scale_game_frames(10)) { @@ -1901,7 +1907,7 @@ s32 FUN_L00_002c3af8(ThrowVars *v, struct Moby *m, s32 mode) } if (!collision_line(&a, &d, 0x10, m, 0)) continue; - if (!FUN_001f0b58() && 0.0f < e.f[2]) + if (!collision_hit_material() && 0.0f < e.f[2]) continue; if (coll_hit.moby != 0 && coll_hit.unk1C <= 0) { if (((struct Moby *)coll_hit.moby == hero.moby || (struct Moby *)coll_hit.moby == v->holder) @@ -1949,11 +1955,11 @@ extern float FUN_L00_00259698_2c4380(void *, int, float) __asm__("FUN_00213508") extern void FUN_L00_00260400(void *, int, void *, void *, void *, void *); extern void FUN_L00_002c40a0(S_2c40a0 *); extern void FUN_L00_002c4328(void *); -extern void FUN_L00_0025d458(void *, void *); -extern void FUN_L00_0025d538(void *, void *); +extern void trooper_anim_update(void *, void *) __asm__("FUN_L00_0025d458"); +extern void trooper_anim_finish(void *, void *) __asm__("FUN_L00_0025d538"); extern void FUN_L00_0025f8e0(float, void *); -extern void FUN_L00_0025e450(float, void *, void *, int, float, float, int, int, int, - float, float, float, float, int, int, int, int, int); +extern void spawn_explosion(float, void *, void *, int, float, float, int, int, int, + float, float, float, float, int, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_00259858(float, void *, void *, int); extern void collect_mobies_in_sphere(float, void *, int, void *, void *) __asm__("FUN_L00_001f2868"); extern void FUN_L00_0024eb68_2c4380(void *) __asm__("FUN_0020c828"); @@ -1976,9 +1982,10 @@ extern float FUN_001ff7e8_2c4380(float) __asm__("FUN_001f9dc8"); extern float FUN_001ff800_2c4380(float) __asm__("FUN_001f9de0"); extern float FUN_00200130_2c4380(float, float) __asm__("FUN_001fa5c8"); extern float FUN_002000e8_2c4380(float, float) __asm__("FUN_001fa580"); -extern void FUN_L00_0025f800(void *, void *); +extern void mine_spawn_drops(void *, void *) __asm__("FUN_L00_0025f800"); -void FUN_L00_002c4380(char *moby) { +void decoy_update(char *moby) __asm__("FUN_L00_002c4380"); +void decoy_update(char *moby) { int active = ((unsigned char *)&D_0013E533)[6]; char *vars = *(char **)(moby + 0x78); char *target; @@ -1995,18 +2002,18 @@ void FUN_L00_002c4380(char *moby) { if (*(float *)(moby + 0x10) < 2.0f || 1021.0f < *(float *)(moby + 0x10) || *(float *)(moby + 0x14) < 2.0f || 1021.0f < *(float *)(moby + 0x14) || *(float *)(moby + 0x18) < 2.0f || 1021.0f < *(float *)(moby + 0x18)) { - FUN_L00_0025f800(moby, D_L00_001B0830_lui); + mine_spawn_drops(moby, D_L00_001B0830_lui); FUN_L00_0024eb68_2c4380(moby); return; } if ((hero.items[0].moby == 0 || *(short *)((char *)hero.items[0].moby + 0xa6) != 0x232) && (u8)moby[0x20] == 1) { - FUN_L00_0025f800(moby, D_L00_001B0830_lui); + mine_spawn_drops(moby, D_L00_001B0830_lui); FUN_L00_0024eb68_2c4380(moby); return; } if (hero.vehicle_mode != 0 && (u8)moby[0x20] == 1) { - FUN_L00_0025f800(moby, D_L00_001B0830_lui); + mine_spawn_drops(moby, D_L00_001B0830_lui); FUN_L00_0024eb68_2c4380(moby); return; } @@ -2037,7 +2044,7 @@ void FUN_L00_002c4380(char *moby) { if (target && (((u8)target[0x20] & 0xf0) != 0xf0) && hero.items[0].moby && *(short *)((char *)hero.items[0].moby + 0xa6) == 0x232) return; - FUN_L00_0025f800(moby, D_L00_001B0830_lui); + mine_spawn_drops(moby, D_L00_001B0830_lui); FUN_L00_0024eb68_2c4380(moby); return; } @@ -2171,7 +2178,7 @@ void FUN_L00_002c4380(char *moby) { ((u8 *)vars)[7] = 0xfa; *(float *)(vars + 0x48) -= len; } - FUN_L00_0025d458(moby, vars); + trooper_anim_update(moby, vars); if (*(float *)(vars + 0x48) < 0.0f) { *(OvlQuad *)scratch.w = 0; scratch.w[0] = D_0015ED60_2c4380 * 0.5f; @@ -2179,7 +2186,7 @@ void FUN_L00_002c4380(char *moby) { scratch.w[1] = scratch.w[0]; *(OvlQuad *)v = *(OvlQuad *)scratch.w; FUN_L00_0025f8e0(scratch.w[0], v); - FUN_L00_0025e450(0, moby, v, 0, 0, 4.0f, 0, 0, 0, + spawn_explosion(0, moby, v, 0, 0, 4.0f, 0, 0, 0, 3.0f, 9.0f, 1.0f, 12.0f, 2, 1, 1, -1, active); if (active) { FUN_L00_00259858(effect + effect, scratch.w, moby, 0x810000); @@ -2188,7 +2195,7 @@ void FUN_L00_002c4380(char *moby) { *(u16 *)((u8 *)scratch.x + 10) = *(u16 *)(moby + 0xa6); collect_mobies_in_sphere(effect * 3.0f, moby + 0x10, 0x10, moby, scratch.w); } - FUN_L00_0025f800(moby, D_L00_001B0830_lui); + mine_spawn_drops(moby, D_L00_001B0830_lui); FUN_L00_0024eb68_2c4380(moby); return; } @@ -2196,7 +2203,7 @@ void FUN_L00_002c4380(char *moby) { } } ((u8 *)moby)[0xa4] = 0xff; - FUN_L00_0025d538(moby, vars); + trooper_anim_finish(moby, vars); if (moby[0x70] & 2) { if (((u8 *)moby)[0x53] != 2) FUN_00257880_2c4380(moby, 2, 0, FUN_001fef20_2c4380(10)); @@ -2237,7 +2244,7 @@ void FUN_L00_002c4380(char *moby) { if (FUN_001fef98_2c4380(vars + 0x44)) { if (((u8 *)moby)[0x53]) FUN_00257880_2c4380(moby, 0, 0, FUN_001fef20_2c4380(60)); - FUN_L00_0025f800(moby, D_L00_001B0830_lui); + mine_spawn_drops(moby, D_L00_001B0830_lui); moby[0x20] = 5; } } @@ -2327,7 +2334,8 @@ typedef struct { extern int D_L00_00161838_macro __asm__("D_L00_00161838") __attribute__((section(".sdata"))); /* Update ammunition pickup physics, collection, animation and scale. Animation states share one stack value; index reloads follow calls. */ -void FUN_L00_002c53c0(struct Moby *m) { +void devestator_ammo_update(struct Moby *m) __asm__("FUN_L00_002c53c0"); +void devestator_ammo_update(struct Moby *m) { AmmoPickup_2c53c0 *p; unsigned int state; FxVec position; @@ -2571,7 +2579,7 @@ extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); extern float D_0015ED6C; extern int FUN_001efa68(void *,void *,int,int,int); extern int FUN_L00_00205000(); -extern int FUN_L00_002223f8(); +extern int hero_set_state() __asm__("FUN_L00_002223f8"); extern int FUN_L00_002323b8(); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern s32 allocate_voice_for_target_entry() __asm__("func_0022DA68"); @@ -2581,7 +2589,7 @@ extern void enqueue_callback_list_1(void *, void *) __asm__("FUN_001f4600"); extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); unsigned char *FUN_L00_002c6f88(unsigned char *src, float f); -void FUN_L00_001edf60(int a, int b, void *pos, int kind, int mode, float x, float y, float z); +void suck_draw_reticle(int a, int b, void *pos, int kind, int mode, float x, float y, float z) __asm__("FUN_L00_001edf60"); extern int FUN_L00_002223f8_2bffa8(int, int) __asm__("FUN_L00_002223f8"); extern Moby *FUN_L00_002c6f88_2bffa8(void *, float) __asm__("FUN_L00_002c6f88"); extern void FUN_L00_001edf60_2bffa8(int, int, float, void *, int, float, int, float, int) __asm__("FUN_L00_001edf60"); @@ -2600,7 +2608,8 @@ extern int FUN_L00_00205000_2bffa8(int) __asm__("FUN_L00_00205000"); extern void FUN_L00_002323b8_2bffa8(int, int, float) __asm__("FUN_L00_002323b8"); extern void FUN_L00_002c5dc8_2bffa8(char *) __asm__("FUN_L00_002c5dc8"); -void FUN_L00_002c6158(Moby *m) { +void swingshot_update(Moby *m) __asm__("FUN_L00_002c6158"); +void swingshot_update(Moby *m) { V_2C74B8 v0; V_2C74B8 v10; Data_2C74B8 *d; @@ -2876,7 +2885,8 @@ extern float FUN_001ff3d8_2c6158(void *) __asm__("FUN_001f9af0"); extern void *FUN_00205000_2c6158(s32) __asm__("FUN_L00_00205000"); extern void FUN_002323b8_2c6158(float, void *, s32) __asm__("FUN_L00_002323b8"); -void FUN_L00_002c6158(u8 *m) { +void swingshot_update(u8 *m) __asm__("FUN_L00_002c6158"); +void swingshot_update(u8 *m) { u8 *vars; u8 *child; u8 *motion; @@ -3277,7 +3287,8 @@ extern int allocate_voice_for_target_entry(int, int, void *) __asm__("FUN_0022da /* Carrier: keeps its grip point in front of it, hands the held moby over when the hero asks, and picks a new one up when get_ammo allows. */ -void FUN_L00_002c7a58(struct Moby *moby) { +void glove_of_doom_update(struct Moby *moby) __asm__("FUN_L00_002c7a58"); +void glove_of_doom_update(struct Moby *moby) { OvlVec4 pos; OvlVec4 offset; OvlVec4 local; @@ -3363,3 +3374,6 @@ void FUN_L00_002c7a58(struct Moby *moby) { vars->held = (struct Moby *)FUN_L00_002c8218((int)moby, (void *)&vars->grip, (void *)&grip); } } + +s32 D_L03_00173F64[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_00173FE4[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/underwater_ring.c b/src/overlays/shared/gameplay/entities/underwater_ring.c index 1e743fa862..65be99873e 100644 --- a/src/overlays/shared/gameplay/entities/underwater_ring.c +++ b/src/overlays/shared/gameplay/entities/underwater_ring.c @@ -29,10 +29,10 @@ extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern f32 FUN_001f9b48(void *, void *); -extern s16 FUN_001f9770(s16 *); +extern s16 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern void FUN_L00_0024f7c8(struct Moby *, int, void *); -extern void FUN_L00_002502f0(void *, int, int, int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); extern int FUN_L00_002591d0(struct Moby **, int, int, int); extern int FUN_L00_002592b8(struct Moby **, struct Moby *, int, int); extern void FUN_L01_0026e0e0(int, int); @@ -43,7 +43,8 @@ extern u8 D_L15_001BB830[]; extern u32 D_0014C190[]; extern s32 D_L15_001BAAD0[]; -void FUN_L15_002e5958(struct Moby *moby) { +void underwater_ring_update(struct Moby *moby) __asm__("FUN_L15_002e5958"); +void underwater_ring_update(struct Moby *moby) { VendorVars_2e5958 *vars = (VendorVars_2e5958 *)moby->pvars; u8 delta[16]; u8 matrix[64]; @@ -87,7 +88,7 @@ void FUN_L15_002e5958(struct Moby *moby) { vars->child_count = 0; vars->triggered = 0; vars->flash_timer = 0; - FUN_L00_002502f0(moby, 0, 0, 0); + set_moby_color(moby, 0, 0, 0); moby->state = 1; break; case 1: @@ -114,7 +115,7 @@ void FUN_L15_002e5958(struct Moby *moby) { } parent_vars->child_count++; allocate_voice_for_target_entry(3, 0x31, moby); - FUN_L00_002502f0(moby, 0, 0xff, 0); + set_moby_color(moby, 0, 0xff, 0); vars->triggered = 1; } if (moby->state == 2) { @@ -125,12 +126,12 @@ void FUN_L15_002e5958(struct Moby *moby) { moby->state = 4; break; } else { - if (FUN_001f9770(&vars->timer) != 0) { + if (fast_dec_timer_s16(&vars->timer) != 0) { vars->child_count = 0; vars->triggered = 0; allocate_voice_for_target_entry(2, 0x31, moby); FUN_L01_0026e0e0(moby->group, 3); - } else if (FUN_001f9770(&vars->delay) != 0) { + } else if (fast_dec_timer_s16(&vars->delay) != 0) { allocate_voice_for_target_entry(0, 0x31, moby); first = scale_game_frames(0x2d); second = scale_game_frames(5); @@ -148,7 +149,7 @@ void FUN_L15_002e5958(struct Moby *moby) { } break; case 3: - FUN_L00_002502f0(moby, 0, 0, 0); + set_moby_color(moby, 0, 0, 0); vars->child_count = 0; vars->triggered = 0; moby->state = 1; @@ -156,13 +157,13 @@ void FUN_L15_002e5958(struct Moby *moby) { case 4: { u16 save_id; u32 *bits; - if (FUN_001f9770(&vars->flash_timer) != 0) { + if (fast_dec_timer_s16(&vars->flash_timer) != 0) { vars->flash_timer = scale_game_frames(0x14); if (vars->flash_color != 0) { - FUN_L00_002502f0(moby, 0, 0xff, 0); + set_moby_color(moby, 0, 0xff, 0); vars->flash_color = 0; } else { - FUN_L00_002502f0(moby, 0xff, 0xff, 0xff); + set_moby_color(moby, 0xff, 0xff, 0xff); vars->flash_color = 1; } } @@ -181,13 +182,13 @@ void FUN_L15_002e5958(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/shared/vendor_002D7C00.c: func_L15_002EC490), where it is exact; names translated to the US level program. */ -extern void FUN_L00_002502f0(void *, int, int, int); +extern void set_moby_color(void *, int, int, int) __asm__("FUN_L00_002502f0"); extern void FUN_L15_002eac90(void); void enqueue_callback_list_1(s32 arg0, s32 arg1) __asm__("FUN_001f4600"); void FUN_L15_002eb0a0(char *moby) { if (*(unsigned char *)(moby + 0x20) == 0) { - FUN_L00_002502f0(moby, 0x40, 0x40, 0x40); + set_moby_color(moby, 0x40, 0x40, 0x40); moby[0x20] = 1; } else { enqueue_callback_list_1((void *)FUN_L15_002eac90, moby); @@ -226,14 +227,15 @@ extern int D_L15_0015F5C4; extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern unsigned char D_0013D388_bd78[] __asm__("D_0013D388"); extern void queue_dialogue_message(int arg0, int arg1) __asm__("FUN_L00_00263d40"); -extern void FUN_L00_00298840(int); +extern void start_scene(int) __asm__("FUN_L00_00298840"); extern void FUN_L02_002ea7d0(char *); extern void FUN_L02_002ea8b0(char *); int memcard_save_data(int slot, int flags) __asm__("FUN_0020b178"); void mark_moby_for_removal(struct Obj *obj) __asm__("FUN_0020c828"); extern float D_L15_001621A0 __attribute__((sda)); -void FUN_L15_002ebd78(struct Moby *moby) { +void codebot_update(struct Moby *moby) __asm__("FUN_L15_002ebd78"); +void codebot_update(struct Moby *moby) { unsigned char *p; if (current_level_index != 0xF) { moby->rot.z = @@ -255,7 +257,7 @@ void FUN_L15_002ebd78(struct Moby *moby) { if (FUN_001f9b48(&moby->pos, &hero.motion.pos) < 3.0f) { if (hero.state.current != 0x32) { moby->flags |= 0x41; - FUN_L00_00298840(1); + start_scene(1); moby->state = 2; } } @@ -287,12 +289,13 @@ extern void try_set_help_message(int, int) __asm__("FUN_00215130"); extern void FUN_L15_00208ca8(void); extern void set_moby_animation(struct Moby *, int, int) __asm__("FUN_00212ed8"); extern void start_scene(int) __asm__("FUN_L00_00298840"); -extern void FUN_L01_0027a248(int, int); +extern void jet_game_state(int, int) __asm__("FUN_L01_0027a248"); extern float probe_ground_height(void *, int, float) __asm__("FUN_00213508"); extern void FUN_L00_00216f90(void *, void *, int, int); extern void FUN_L00_00210a08(int, int, struct Moby *); -void FUN_L15_002ed068(struct Moby *moby) { +void giant_clank_pad_update(struct Moby *moby) __asm__("FUN_L15_002ed068"); +void giant_clank_pad_update(struct Moby *moby) { struct Moby *linked = moby->pvars; struct Moby *entry; struct Moby *pad; @@ -338,7 +341,7 @@ void FUN_L15_002ed068(struct Moby *moby) { set_moby_animation(pad, 0, 0); if (current_level_index != 0xf) return; start_scene(9); - FUN_L01_0027a248(0, 5); + jet_game_state(0, 5); return; } if (hero.vehicle_mode != 0) return; @@ -355,7 +358,7 @@ void FUN_L15_002ed068(struct Moby *moby) { start_scene(8); *(u128 *)hero.unk1D00 = *(u128 *)&hero.motion.pos; *(u128 *)(hero.unk1D00 + 16) = *(u128 *)&hero.motion.rot; - FUN_L01_0027a248(2, 4); + jet_game_state(2, 4); return; } if (current_level_index != 0x12) return; diff --git a/src/overlays/shared/gameplay/entities/veldin_ship.c b/src/overlays/shared/gameplay/entities/veldin_ship.c index 438ef19490..5c9e201870 100644 --- a/src/overlays/shared/gameplay/entities/veldin_ship.c +++ b/src/overlays/shared/gameplay/entities/veldin_ship.c @@ -287,7 +287,7 @@ f32 fast_sin(f32) __asm__("FUN_001f9de0"); s32 FUN_L00_002595a0_2d0538(f32 *, f32 *, f32, f32, f32) __asm__("FUN_L00_002595a0"); void scale_vector_xyz(void *, void *, f32) __asm__("FUN_001f9a68"); void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); -void path_e50(s32, void *, void *, void *) __asm__("FUN_L00_00261b48"); +void FUN_L00_00261b48(s32, void *, void *, void *); void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); u8 *FUN_L00_002c52a8_2d0538(u8 *, s32, s32, s32) __asm__("FUN_L00_002c52a8"); @@ -401,7 +401,7 @@ void crate_drop_bolts(u8 *a) { e = f54; scale_vector_xyz(&v20, q + 0x10, e); add_vector_xyz(&v20, &v20, a + 0x10); - path_e50(*(s32 *)(b + 0xC0), a + 0x10, &v20, &v30); + FUN_L00_00261b48(*(s32 *)(b + 0xC0), a + 0x10, &v20, &v30); subtract_vector_xyz(&v20, &v30, p + 0x10); v20.f[2] = 0.0f; normalize_vector_xyz(&v40, &v20, 0.25f); @@ -471,9 +471,9 @@ typedef struct G2d1428 { } G2d1428; extern V2d1428 D_L00_00173E60; s32 FUN_L00_0025e3b8(M2d1428 *); -void FUN_001f9a28(void *, void *, void *); -void FUN_001f9cf8(void *, void *, void *); -void FUN_001f9a10(void *, void *, void *); +void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); +void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); +void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); f32 FUN_001f99c0(f32); f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); @@ -482,7 +482,7 @@ void break_crate(M2d1428 *, s32, s32) __asm__("FUN_L00_002d09b8"); void FUN_L00_002d0538_c(M2d1428 *) __asm__("FUN_L00_002d0538"); void FUN_L00_002604f0(M2d1428 *, void *, void *, void *, void *, void *); P2d1428 *FUN_L00_002603d0(void *); -void FUN_L00_00260738(void *, void *, void *, void *); +void update_entity_matrix(void *, void *, void *, void *) __asm__("FUN_L00_00260738"); typedef union { f32 f[4]; @@ -531,7 +531,8 @@ extern s32 FUN_00257b90_2d09b8(s32, s32) __asm__("FUN_L00_00257b90"); extern void FUN_0026a9f0_2d09b8(void *, void *, s32, s32, s32, s32, s32, s32, f32, f32) __asm__("FUN_L00_0026a9f0"); extern void FUN_002ac910_2d09b8(void *, void *, void *, f32, s32, s32, s32, s32, s32) __asm__("FUN_L00_002ac910"); -void FUN_L00_002d09b8(M2d1428 *moby, s32 hit, s32 source) { +void break_crate(M2d1428 *moby, s32 hit, s32 source) __asm__("FUN_L00_002d09b8"); +void break_crate(M2d1428 *moby, s32 hit, s32 source) { u8 *vars = (u8 *)moby->vars; V2d09b8 position, away, rotation, basis[3], launch, spawn_pos, spin; s32 kind; @@ -719,8 +720,8 @@ void FUN_L00_002d1428(M2d1428 *m) { o->iB4 = D_L00_0015F5CC; if (m->state == 0) continue; - FUN_001f9a28(&a, &hero.motion.pos, &m->pos); - FUN_001f9cf8(&a, &a, m->vC0); + fast_vec_sub(&a, &hero.motion.pos, &m->pos); + transform_vector_by_basis(&a, &a, m->vC0); if (FUN_001f99c0(a.x) < 0.55f && FUN_001f99c0(a.y) < 0.55f && a.z < 0.0f && -(hero.capsule_top + hero.unk234) < a.z) { switch (m->state) { @@ -757,10 +758,10 @@ void FUN_L00_002d1428(M2d1428 *m) { qcopy(&o->vD0, &b); o->vD0.z -= o->fF4; } - FUN_001f9a28(&h, &m->pos, &c); + fast_vec_sub(&h, &m->pos, &c); h.w = o->vel.w; qcopy(&o->vel, &h); - FUN_L00_00260738(o->v60, &o->vel, &d, &m->v40); + update_entity_matrix(o->v60, &o->vel, &d, &m->v40); continue; } if (o->parent == 0) { @@ -792,7 +793,7 @@ void FUN_L00_002d1428(M2d1428 *m) { o->vel.z = 0.0f; } else { o->flags |= 4; - FUN_001f9a10(&m->pos, &m->pos, &o->vel); + fast_vec_add(&m->pos, &m->pos, &o->vel); } } while (p != 0); } @@ -952,7 +953,8 @@ extern s32 D_L00_0016C890[]; extern void build_moby_bone_transform(void *, int, void *) __asm__("FUN_0020cca8"); void enqueue_callback_list_1(void *, void *) __asm__("FUN_001f4600"); void FUN_L00_002d19b0(void); -void FUN_L00_002d1e80(M2d1e80 *m) { +void veldin_ship_update(M2d1e80 *m) __asm__("FUN_L00_002d1e80"); +void veldin_ship_update(M2d1e80 *m) { s32 *v = m->vars; if (m->state == 0) { m->state = 1; @@ -1161,7 +1163,7 @@ extern s32 scale_game_frames_c2(s32) __asm__("func_001F96F8"); extern short D_L00_001B0830[]; extern void FUN_L00_002223f8(int, int); extern void FUN_L00_0024f7c8(void *, int, void *); -extern void FUN_L00_0025f800(void *, void *); +extern void mine_spawn_drops(void *, void *) __asm__("FUN_L00_0025f800"); extern void FUN_L00_002c3888(float *, char *, void *); extern int allocate_voice_for_target_entry(int, int, void *) __asm__("FUN_0022da68"); extern void mark_moby_for_removal() __asm__("FUN_0020c828"); @@ -1173,7 +1175,8 @@ extern char D_0013CAE4[]; #include "rnc/gameplay/state/game_globals.h" extern void build_moby_bone_transform(void *, int, void *) __asm__("FUN_0020cca8"); -void FUN_L00_002d2670(unsigned char *moby) { +void decoy_glove_update(unsigned char *moby) __asm__("FUN_L00_002d2670"); +void decoy_glove_update(unsigned char *moby) { extern void mark_moby_for_removal(); extern void transform_vector_alt(); extern int allocate_voice_for_target_entry(int, int, void *); @@ -1205,7 +1208,7 @@ void FUN_L00_002d2670(unsigned char *moby) { *(int *)(p + 0x98) = 1; if (D_0013E539_lui && *(short *)(*(char **)(d + 0x50) + 0xA6) != 0x76C) { qzero(&loc); - FUN_L00_0025f800(*(char **)(d + 0x50), D_L00_001B0830); + mine_spawn_drops(*(char **)(d + 0x50), D_L00_001B0830); ((void (*)(void *))mark_moby_for_removal)(*(char **)(d + 0x50)); *(int *)(d + 0x50) = FUN_L00_002c35c0(moby, d + 0x40, &loc); } @@ -1440,7 +1443,7 @@ void FUN_L00_002d2e28(unsigned char *moby) { #include "rnc/gameplay/entities/moby.h" #include "rnc/input/pad_state.h" -/* FUN_L00_002d2ee8: update for a moby that tracks hero.unk2040, the nearest +/* metal_detector_update: update for a moby that tracks hero.unk2040, the nearest * oclass 0x25D moby. It orients itself towards it within the * D_L00_00161950/54 limits (degrees), tints itself by the distance * (hero.unk2044) while the 0x20 pad button is held, and at under 1.0 drains @@ -1489,7 +1492,7 @@ extern f32 D_L00_00161940 __attribute__((sda)); extern void moby_point_position(struct Moby *, s32, void *) __asm__("FUN_L00_0024f7c8"); extern void attach_manipulator(void *, s32, void *) __asm__("FUN_0020cb10"); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); @@ -1502,9 +1505,9 @@ extern void multiply_matrix(void *, void *, void *) __asm__("FUN_001fa378"); extern void matrix_to_quaternion(void *, void *) __asm__("FUN_00214260"); extern void FUN_L00_00259f50(void *, void *); extern void quaternion_nlerp(void *, void *, void *, f32) __asm__("FUN_001fa400"); -extern s32 FUN_L00_0028d8c0(struct Moby *, s32); +extern s32 voice_is_playing(struct Moby *, s32) __asm__("FUN_L00_0028d8c0"); extern int allocate_voice_for_target_entry(int, int, void *) __asm__("FUN_0022da68"); -extern void FUN_L00_0028df38(s32, s32); +extern void engine_voice_set_pitch(s32, s32) __asm__("FUN_L00_0028df38"); extern f32 random_float_between(f32, f32) __asm__("FUN_002132a8"); extern void FUN_L00_0025f8e0(void *, f32); extern void FUN_L00_002a7438(void *, void *, void *, s32, s32, s32); @@ -1512,10 +1515,11 @@ extern void FUN_L00_002a7438(void *, void *, void *, s32, s32, s32); extern void delete_moby(void *) __asm__("FUN_0020c828"); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); extern void FUN_L00_002d2a90_u(void) __asm__("FUN_L00_002d2a90"); -extern s32 FUN_001f96f8(s32); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern struct PadState controller_state_lui __asm__("D_0013C940") __attribute__((section(".data"))); -void FUN_L00_002d2ee8(struct Moby *moby) { +void metal_detector_update(struct Moby *moby) __asm__("FUN_L00_002d2ee8"); +void metal_detector_update(struct Moby *moby) { Vars2d2ee8 *vars; struct Moby *t; TargetVars2d2ee8 *tv; @@ -1567,7 +1571,7 @@ void FUN_L00_002d2ee8(struct Moby *moby) { v[2] = one; if (hero.unk2040 != 0 && hero.unk2040->oclass == 0x25D && hero.unk2040->state != 0xFE && hero.unk2040->state != 0xFD) { - pitch = FUN_001f9b80(&vars->pos, &hero.unk2040->pos); + pitch = vector_distance(&vars->pos, &hero.unk2040->pos); pitch = fast_arc_tan(pitch, hero.unk2040->pos.z - vars->pos.f[2]); yaw = fast_arc_tan(hero.unk2040->pos.x - vars->pos.f[0], hero.unk2040->pos.y - vars->pos.f[1]); yaw = fast_subtract_rotations(yaw, hero.motion.rot.f[2]); @@ -1588,7 +1592,7 @@ void FUN_L00_002d2ee8(struct Moby *moby) { yaw = fast_add_rotations(yaw, hero.motion.rot.f[2]); pitch = fast_add_rotations(pitch, -1.5707964f); build_spherical_offset(v, -3.0f, yaw, pitch); - FUN_001f9a10(w, &vars->pos, v); + fast_vec_add(w, &vars->pos, v); noop_main_callback(&vars->pos, w); fast_vec_normalize(m[D_L00_00161920], v, (f32)D_L00_0016192C); fast_vec_cross(m[D_L00_00161924], m[D_L00_00161920], &D_L00_00161940); @@ -1621,13 +1625,13 @@ void FUN_L00_002d2ee8(struct Moby *moby) { vars->unk24 = 0; vars->unk28 = 0; } - if ((controller_state_lui.held & 0x20) && hero.items[0].unk20 > FUN_001f96f8(0xF)) { + if ((controller_state_lui.held & 0x20) && hero.items[0].unk20 > scale_game_frames(0xF)) { if (hero.unk2044 < 10.0f) { - if (FUN_L00_0028d8c0(moby, vars->voice2) == 0 && vars->voice2 == -1) { + if (voice_is_playing(moby, vars->voice2) == 0 && vars->voice2 == -1) { vars->voice2 = allocate_voice_for_target_entry(1, 4, moby); } if (vars->voice2 != -1) { - FUN_L00_0028df38(vars->voice2, + engine_voice_set_pitch(vars->voice2, truncate_float_to_s32((10.0f - (hero.unk2044 + hero.unk2044)) * 32767.0f / 60.0f) - 0x1FFF); } { @@ -1643,7 +1647,7 @@ void FUN_L00_002d2ee8(struct Moby *moby) { w[0] = random_float_between(1.0f, 10.0f) * frame_time; w[1] = random_float_between(-10.0f, 10.0f) * frame_time; w[2] = random_float_between(1.0f, 12.0f) * frame_time; - FUN_001f9cf8(w, w, &hero); + transform_vector_by_basis(w, w, &hero); { Vec4f *q = &hero.unk2040->pos; @@ -1743,14 +1747,15 @@ void FUN_L00_002d2ee8(struct Moby *moby) { /* Ported from rac1-decomp (src/overlays/shared/vendor_002D1168.c: func_L00_002D4C80), where it is exact; names translated to the US level program. */ extern char D_0013E533[]; -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); void blend_moby_animation(MobyAnim *arg0, int arg1, int arg2, int arg3) __asm__("FUN_00212f90"); /* Blends the moby to animation 6 when D_0013F350+0x2084 is 8. */ -void FUN_L00_002d37d0(char *a) { +void helipack_update(char *a) __asm__("FUN_L00_002d37d0"); +void helipack_update(char *a) { if (*(int *)(D_0013E533 + 0x2EA1) == 8) { if (*(unsigned char *)(a + 0x53) != 6) { - blend_moby_animation(a, 6, 0, FUN_001f96f8(10)); + blend_moby_animation(a, 6, 0, scale_game_frames(10)); } } } @@ -1760,7 +1765,8 @@ void *create_moby_local(int) __asm__("FUN_0020c4f8"); void upd_a(void *) __asm__("FUN_L00_00250df8"); void FUN_L00_0025d1b8_2d3838(void *) __asm__("FUN_L00_0025d1b8"); -unsigned char *FUN_L00_002d3838(unsigned char *s, void *b, int c, void *d) { +unsigned char *mine_camera_blast(unsigned char *s, void *b, int c, void *d) __asm__("FUN_L00_002d3838"); +unsigned char *mine_camera_blast(unsigned char *s, void *b, int c, void *d) { unsigned char *m = create_moby_local(0x27F); if (m) { unsigned char *q; @@ -1823,7 +1829,7 @@ typedef struct { float x, y, z, w; } Vx __attribute__((aligned(16))); extern char *moby_table __asm__("D_L00_0015FFD8"); extern f32 convert_integer_to_float_c(s32) __asm__("func_001FA6C0"); extern f32 random_float_between_c(f32, f32) __asm__("func_002132A8"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_001fefc8(void *); extern int FUN_L00_0023e738(float *, float, float, float, float, float); extern int tick_countdown_32_alt(int *) __asm__("FUN_001f9740"); @@ -1943,7 +1949,7 @@ void FUN_L00_002d3a10(unsigned char *m) { qcopy(v21, &t2); } if (*(unsigned short *)(o + 0x72) != 0) { - if (FUN_001f9770(o + 0x7A)) { + if (fast_dec_timer_s16(o + 0x7A)) { *(short *)(o + 0x7A) = scale_game_frames(*(unsigned short *)(o + 0x72)); if (*(int *)(o + 0x4C) & 4) { c0 = 1; @@ -1987,7 +1993,7 @@ void FUN_L00_002d3a10(unsigned char *m) { } } if (*(unsigned short *)(o + 0x6C) != 0) { - if (FUN_001f9770(o + 0x74)) { + if (fast_dec_timer_s16(o + 0x74)) { *(short *)(o + 0x74) = scale_game_frames(*(unsigned short *)(o + 0x6C)); *(int *)(o + 0x4C) &= 0xFFFFFF7F; *(float *)(o + 0x54) = (float)*(unsigned char *)(o + 0x27); @@ -2034,7 +2040,7 @@ void FUN_L00_002d3a10(unsigned char *m) { } } if (*(unsigned short *)(o + 0x6E) != 0) { - if (FUN_001f9770(o + 0x76)) { + if (fast_dec_timer_s16(o + 0x76)) { *(short *)(o + 0x76) = scale_game_frames(*(unsigned short *)(o + 0x6E)); *(int *)(o + 0x4C) &= 0xFFFFF7FF; *(float *)(o + 0x58) = (float)o[0x2C]; @@ -2081,7 +2087,7 @@ void FUN_L00_002d3a10(unsigned char *m) { } } if (*(unsigned short *)(o + 0x70) != 0) { - if (FUN_001f9770(o + 0x78)) { + if (fast_dec_timer_s16(o + 0x78)) { *(short *)(o + 0x78) = scale_game_frames(*(unsigned short *)(o + 0x70)); *(int *)(o + 0x4C) &= 0xFFFF7FFF; *(float *)(o + 0x5C) = (float)o[0x31]; @@ -2867,25 +2873,25 @@ extern void FUN_L00_002d6bf0_2d5de8(struct Moby *) __asm__("FUN_L00_002d6bf0"); extern void FUN_L00_002d6cd0_2d5de8(struct Moby *) __asm__("FUN_L00_002d6cd0"); extern void FUN_L00_002d5988_2d5de8(struct Moby *, Path *, s32) __asm__("FUN_L00_002d5988"); extern f32 FUN_001f9b48(void *, void *); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern void fast_vec_normalize(void *, void *, f32) __asm__("FUN_001f9bf8"); extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); -extern f32 FUN_001f9dc8(f32); -extern f32 FUN_001f9de0(f32); -extern f32 FUN_001fa580(f32, f32); -extern f32 FUN_001fa5c8(f32, f32); +extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); +extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); +extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); +extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern s32 FUN_001fa6d0(f32); -extern f32 FUN_001fa6c0(s32); +extern f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); extern f32 spring_turn_2d5de8(f32 angle, f32 target, f32 accel, f32 damping, f32 limit, f32 *speed) __asm__("FUN_L00_00258110"); extern void FUN_L00_0025df68(Path *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); extern s32 FUN_L00_00260400(struct Moby *, struct Moby *, void *, void *, void *, void *); extern void FUN_L00_002607d0(s32); -extern void FUN_L00_002502a0(s32); -extern void FUN_L00_00284e50(void *, void *); -extern void FUN_L00_00298840(s32); +extern void jet_clear_persistent(s32) __asm__("FUN_L00_002502a0"); +extern void jet_reset_camera(void *, void *) __asm__("FUN_L00_00284e50"); +extern void start_scene(s32) __asm__("FUN_L00_00298840"); extern void FUN_L00_00299460(s32); extern void FUN_L00_00262d38(s32); extern void FUN_L00_00266858(struct Moby *, s32); @@ -2901,7 +2907,8 @@ static inline void measure_path(Path *path) { } } -void FUN_L00_002d5de8(struct Moby *moby) +void infobot_update(struct Moby *moby) __asm__("FUN_L00_002d5de8"); +void infobot_update(struct Moby *moby) { Vec offset; Vec step; @@ -3014,11 +3021,11 @@ void FUN_L00_002d5de8(struct Moby *moby) FUN_0020c828(moby); return; } - infobot->bob = FUN_001fa580(infobot->bob, D_0015ED6C * 3.1415927f); - offset.v.x = FUN_001f9dc8(infobot->bob); - offset.v.y = FUN_001f9de0(infobot->bob); + infobot->bob = fast_add_rotations(infobot->bob, D_0015ED6C * 3.1415927f); + offset.v.x = fast_cos(infobot->bob); + offset.v.y = fast_sin(infobot->bob); offset.v.z = 3.0f; - moby->rot.z = FUN_001fa580(infobot->bob, 1.5707964f); + moby->rot.z = fast_add_rotations(infobot->bob, 1.5707964f); if (infobot->carrier == -1) { break; } @@ -3043,7 +3050,7 @@ void FUN_L00_002d5de8(struct Moby *moby) pos = (Vec *)&moby->pos; FUN_L00_002d6cd0_2d5de8(moby); FUN_L00_0025df68(path, pos, &point, &segment, &fraction, 0, 999.0f, 5.0f, 0.0f); - end = FUN_001fa6c0(segment) * path->pts[0].v.w + fraction + 2.0f; + end = convert_integer_to_float(segment) * path->pts[0].v.w + fraction + 2.0f; distance = FUN_001f9b48(pos, &path->pts[path->count - 1]); accel = D_0015ED70 * 16.0f; speed = infobot->speed; @@ -3060,7 +3067,7 @@ void FUN_L00_002d5de8(struct Moby *moby) } } segment = FUN_001fa6d0(end / path->pts[0].v.w); - fraction = (end - FUN_001fa6c0(segment) * path->pts[0].v.w) / path->pts[0].v.w; + fraction = (end - convert_integer_to_float(segment) * path->pts[0].v.w) / path->pts[0].v.w; if (segment >= path->count - 1) { if (infobot->speed <= D_0015ED70 * 16.0f) { MPOS(moby)->q = ((Vec *)path)[path->count].q; @@ -3070,23 +3077,23 @@ void FUN_L00_002d5de8(struct Moby *moby) segment = path->count - 2; fraction = 1.0f; } - FUN_001f9a28(&point, &path->pts[segment + 1], &path->pts[segment]); + fast_vec_sub(&point, &path->pts[segment + 1], &path->pts[segment]); fast_vec_scale(&point, &point, fraction); - FUN_001f9a10(&point, &point, &path->pts[segment]); + fast_vec_add(&point, &point, &path->pts[segment]); heading = fast_arc_tan(path->pts[segment + 1].v.x - path->pts[segment].v.x, path->pts[segment + 1].v.y - path->pts[segment].v.y); moby->rot.z = spring_turn_2d5de8(moby->rot.z, heading, 0.01f, 0.3f, 0.1f, &infobot->spin[2]); pos = &step; - FUN_001f9a28(pos, &point, MPOS(moby)); + fast_vec_sub(pos, &point, MPOS(moby)); distance = fast_vec_length(pos); if (infobot->speed < distance) { distance = infobot->speed; } fast_vec_normalize(pos, pos, distance); - FUN_001f9a10(MPOS(moby), MPOS(moby), pos); - heading = FUN_001fa5c8(fast_arc_tan(step.v.x, step.v.y), moby->rot.z); - tilt_y = infobot->speed * 0.34906584f * FUN_001f9dc8(heading) / (D_0015ED6C * 16.0f); - tilt_x = infobot->speed * -0.34906584f * FUN_001f9de0(heading) / (D_0015ED6C * 16.0f); + fast_vec_add(MPOS(moby), MPOS(moby), pos); + heading = fast_subtract_rotations(fast_arc_tan(step.v.x, step.v.y), moby->rot.z); + tilt_y = infobot->speed * 0.34906584f * fast_cos(heading) / (D_0015ED6C * 16.0f); + tilt_x = infobot->speed * -0.34906584f * fast_sin(heading) / (D_0015ED6C * 16.0f); moby->rot.y = spring_turn_2d5de8(moby->rot.y, tilt_y, D_0015ED70 * 0.5235988f, D_0015ED70 * 1.0471976f, D_0015ED6C * 0.7853982f, &infobot->spin[1]); moby->rot.x = spring_turn_2d5de8(moby->rot.x, tilt_x, D_0015ED70 * 1.0471976f, D_0015ED70 * 2.0943952f, D_0015ED6C * 1.5707964f, &infobot->spin[0]); break; @@ -3097,13 +3104,13 @@ void FUN_L00_002d5de8(struct Moby *moby) if (1.0f < infobot->sway) { infobot->sway = 1.0f; } - infobot->bob = FUN_001fa580(infobot->bob, D_0015ED6C * 3.1415927f); - offset.v.x = FUN_001f9dc8(infobot->bob) * infobot->sway; - offset.v.y = FUN_001f9de0(infobot->bob) * infobot->sway; + infobot->bob = fast_add_rotations(infobot->bob, D_0015ED6C * 3.1415927f); + offset.v.x = fast_cos(infobot->bob) * infobot->sway; + offset.v.y = fast_sin(infobot->bob) * infobot->sway; offset.v.z = 0.0f; - heading = FUN_001fa580(infobot->bob, 1.5707964f); + heading = fast_add_rotations(infobot->bob, 1.5707964f); moby->rot.z = spring_turn_2d5de8(moby->rot.z, heading, D_0015ED6C * 25.132742f, D_0015ED6C * 25.132742f, D_0015ED6C * 12.566371f, &infobot->spin[2]); - FUN_001f9a10(&step, &offset, &p->pts[p->count - 1]); + fast_vec_add(&step, &offset, &p->pts[p->count - 1]); MPOS(moby)->q = step.q; if (FUN_001f9b48(&D_0013F3D0, &p->pts[p->count - 1]) < 2.0f && D_0013F3D0.active != 0) { moby->state = 8; @@ -3115,13 +3122,13 @@ void FUN_L00_002d5de8(struct Moby *moby) case 8: moby->flags |= 0x41; FUN_L00_002607d0(infobot->planet); - FUN_L00_002502a0(moby->mission); + jet_clear_persistent(moby->mission); if (infobot->cutscene != -1) { - FUN_L00_00284e50(&D_L00_001600EC_2d5de8[infobot->cutscene].pos, &D_L00_001600EC_2d5de8[infobot->cutscene].dir); + jet_reset_camera(&D_L00_001600EC_2d5de8[infobot->cutscene].pos, &D_L00_001600EC_2d5de8[infobot->cutscene].dir); } moby->state = 9; if (infobot->msg0 != -1) { - FUN_L00_00298840(infobot->msg0); + start_scene(infobot->msg0); } break; case 9: @@ -3138,7 +3145,7 @@ void FUN_L00_002d5de8(struct Moby *moby) break; } if (infobot->msg2 != -1) { - FUN_L00_00298840(infobot->msg2); + start_scene(infobot->msg2); } moby->state = 11; break; @@ -3157,7 +3164,7 @@ void FUN_L00_002d5de8(struct Moby *moby) step.q = 0; FUN_L00_00260400(moby, carrier, &D_L00_001600EC_2d5de8[infobot->attach].pos, &step, &D_L00_001600EC_2d5de8[infobot->attach].pos, &step); - FUN_001f9a10(&point, &offset, &D_L00_001600EC_2d5de8[infobot->attach].pos); + fast_vec_add(&point, &offset, &D_L00_001600EC_2d5de8[infobot->attach].pos); MPOS(moby)->q = point.q; } } @@ -3174,7 +3181,7 @@ typedef struct { M002d6bf0 *m; } O002d6bf0; s32 random_integer_below(s32) __asm__("FUN_00213260"); -s32 FUN_001f96f8(s32); +s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); void FUN_L00_002d6bf0(O002d6bf0 *o) { M002d6bf0 *m = o->m; s32 i; @@ -3185,7 +3192,7 @@ void FUN_L00_002d6bf0(O002d6bf0 *o) { m->a[2] = 1.25f; m->a[3] = 2.5f; for (i = 0; i < 4; i++) - m->c[i] = FUN_001f96f8(i * 0x40 + 0x3F); + m->c[i] = scale_game_frames(i * 0x40 + 0x3F); m->x40 = 2.5f; m->x44 = 3.0f; m->x4c = 2.5f; @@ -3207,7 +3214,7 @@ extern float i2f_2d6cd0(int) __asm__("FUN_001fa6c0"); extern float fabs_2d6cd0(float) __asm__("FUN_001f99c0"); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern int f2i_2d6cd0(float) __asm__("FUN_001fa6d0"); -extern void spr_2d6cd0(void *, int, int, int, int, int, int, float) __asm__("FUN_L00_00272f68"); +extern void FUN_L00_00272f68(void *, int, int, int, int, int, int, float); void FUN_L00_002d6cd0(char *o) { P_2d6cd0 *p = *(P_2d6cd0 **)(o + 0x78); @@ -3247,7 +3254,7 @@ void FUN_L00_002d6cd0(char *o) { f = f / (float)scale_game_frames(0xFF); col = fast_tween_color(0x4040FFFF, 0x1040FFFF, fabs_2d6cd0(0.5f - f)); if (D_15F5C4_2d6cd0 != 2) { - spr_2d6cd0(d, col, f2i_2d6cd0(p->a[i]) & 0xFF, 0x35, 1, 2, 0, p->d[i]); + FUN_L00_00272f68(d, col, f2i_2d6cd0(p->a[i]) & 0xFF, 0x35, 1, 2, 0, p->d[i]); } add_vector_xyz(d, d, e); } @@ -3327,7 +3334,7 @@ int FUN_00213260_c(int) __asm__("FUN_00213260"); void FUN_L00_002d7bf0(P *, int); void FUN_L00_002d7d58_c(P *, int) __asm__("FUN_L00_002d7d58"); extern int fast_bsphere_check(void *, float) __asm__("FUN_001fa728"); -float FUN_001f9b80(void *, void *); +float vector_distance(void *, void *) __asm__("FUN_001f9b80"); float FUN_L00_00257c48(float, float); void FUN_001f9d20(V *, V *, void *); float random_float_between(float, float) __asm__("FUN_002132a8"); @@ -3337,7 +3344,8 @@ s16 FUN_001f96f8_c(int) __asm__("FUN_001f96f8"); void FUN_001f4600_c(void *, P *) __asm__("FUN_001f4600"); void FUN_L00_002d73e8(P *); -void FUN_L00_002d6f28(P *p) { +void particle_spawner_smoke_fire_update(P *p) __asm__("FUN_L00_002d6f28"); +void particle_spawner_smoke_fire_update(P *p) { Q *q = p->q; u8 *tbl; V v, a, b; @@ -3390,7 +3398,7 @@ void FUN_L00_002d6f28(P *p) { v.w = 10.0f; if (fast_bsphere_check(&v, D_L00_001619E0) < 0) return; - if (q->flag42 && FUN_001f9b80(&D_L00_00166DC0, &p->pos) < 128.0f) { + if (q->flag42 && vector_distance(&D_L00_00166DC0, &p->pos) < 128.0f) { for (e = 0; e < D_L00_001619BC; e++) { a.x = FUN_L00_00257c48(0.0f, 1.0f); a.y = FUN_L00_00257c48(0.0f, 1.0f); @@ -3691,14 +3699,15 @@ void FUN_L00_002d7d58(char *m, int i) { #include "qcopy.h" unsigned char *create_moby(int) __asm__("FUN_0020c4f8"); void FUN_L00_0025d1b8(unsigned char *); -void FUN_L00_002502f0(unsigned char *, int, int, int); +void set_moby_color(unsigned char *, int, int, int) __asm__("FUN_L00_002502f0"); float random_angle_radians(void) __asm__("FUN_00213308"); void FUN_L00_00250df8(unsigned char *); +unsigned char *FUN_L00_002d7e90(u128 *v, float s); unsigned char *FUN_L00_002d7e90(u128 *v, float s) { unsigned char *m = create_moby(0x307); if (m) { FUN_L00_0025d1b8(m); - FUN_L00_002502f0(m, 0x28, 0x28, 0x46); + set_moby_color(m, 0x28, 0x28, 0x46); m[0x30] = 0xff; *(short *)(m + 0x32) = 0x40; *(float *)(m + 0x2c) *= s; @@ -3715,3 +3724,8 @@ void FUN_L00_002d7f38(u8 *m) { if ((u8)(m[0x23] -= 3) < 4) mark_moby_for_removal(); } + +f32 D_L01_001FA840[1] __attribute__((section(".data"))) = {0}; +f32 D_L01_001FA880[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_001E04D0[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_001E0510[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/vendor_orb.c b/src/overlays/shared/gameplay/entities/vendor_orb.c index b74070ebc8..d214b1442e 100644 --- a/src/overlays/shared/gameplay/entities/vendor_orb.c +++ b/src/overlays/shared/gameplay/entities/vendor_orb.c @@ -11,7 +11,8 @@ float random_angle_radians(void) __asm__("FUN_00213308"); void attach_manipulator(unsigned char *, int, char *) __asm__("FUN_0020cb10"); float fast_add_rotations(float, float) __asm__("FUN_001fa580"); void FUN_L00_001fff28(char *, int, float); -void FUN_L00_002df730(unsigned char *p) { +void vendor_orb_update(unsigned char *p) __asm__("FUN_L00_002df730"); +void vendor_orb_update(unsigned char *p) { char *m = *(char **)(p + 0x78); float s; switch (p[0x20]) { @@ -115,7 +116,7 @@ extern f32 fast_add_rotations_c2(f32, f32) __asm__("func_001FA580"); extern f32 fast_subtract_rotations_c2(f32, f32) __asm__("func_001FA5C8"); extern int FUN_001f96b0_c() __asm__("FUN_001f96b0"); extern int FUN_001f9a40_c() __asm__("FUN_001f9a40"); -extern int FUN_L00_002223f8(); +extern int hero_set_state() __asm__("FUN_L00_002223f8"); extern int FUN_L00_00266d60(); extern int allocate_voice_for_target_entry_alt(int,int,int) __asm__("FUN_0022da68"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); @@ -128,7 +129,7 @@ void FUN_L00_002e01b0_c(char *m) __asm__("FUN_L00_002e01b0"); void FUN_L00_002e0340_c(char *a) __asm__("FUN_L00_002e0340"); void FUN_L00_002ea9d8(char *src); void FUN_L00_002eaa30(char *src); -void FUN_L00_002eaaa0(void *pa, void *pb, s32 mode, s32 w, s32 x); +void jet_mount(void *pa, void *pb, s32 mode, s32 w, s32 x) __asm__("FUN_L00_002eaaa0"); void FUN_L00_002eac18_c(int mode) __asm__("FUN_L00_002eac18"); extern char D_0013E633_2E0E50[] __asm__("D_0013F350"); extern char D_0013A5E0_2E0E50[] __asm__("D_0013CAE0"); @@ -164,7 +165,8 @@ extern float func_001FA748_2E0E50(float, float) __asm__("FUN_001fa580"); extern void func_L00_002EC0C8_2E0E50(int) __asm__("FUN_L00_002eac18"); extern int func_001F9908_2E0E50(void *) __asm__("FUN_001f9740"); -void FUN_L00_002df9a0(Moby *moby) { +void hydrodisplacer_update(Moby *moby) __asm__("FUN_L00_002df9a0"); +void hydrodisplacer_update(Moby *moby) { Vec_2E0E50 camera_pos, camera_rot; Data_2E0E50 *data = (void *)moby->pvars; @@ -493,7 +495,8 @@ extern u16 D_00141B08[]; extern T_2e03a0_2e03a0 D_L00_001BA5D0; extern T_2e03a0_2e03a0 D_L00_001BB230; extern s32 current_level_index_gp __asm__("D_0015ED84") __attribute__((sda)); -void FUN_L00_002e03a0(M_2e03a0_2e03a0 *m) { +void pilots_helmet_update(M_2e03a0_2e03a0 *m) __asm__("FUN_L00_002e03a0"); +void pilots_helmet_update(M_2e03a0_2e03a0 *m) { P_2e03a0_2e03a0 *p = m->p; char *g; E_2e03a0_2e03a0 *e; @@ -627,6 +630,7 @@ extern s32_2e1f28 D_C58_2e1f28[] __asm__("D_L00_00161C58") __attribute__((sectio extern s32_2e1f28 D_C68_2e1f28[] __asm__("D_L00_00161C68") __attribute__((section(".sdata"))); extern s32_2e1f28 D_C78_2e1f28[] __asm__("D_L00_00161C78") __attribute__((section(".sdata"))); extern s32_2e1f28 D_C88_2e1f28[] __asm__("D_L00_00161C88") __attribute__((section(".sdata"))); +s32_2e1f28 FUN_L00_002e1f28(s32_2e1f28 id, s32_2e1f28 a, s32_2e1f28 b); s32_2e1f28 FUN_L00_002e1f28(s32_2e1f28 id, s32_2e1f28 a, s32_2e1f28 b) { s32_2e1f28 i, j; for (i = 0; i < 3; i++) { @@ -656,8 +660,9 @@ extern s32 D_L00_00161BF8_c[] __asm__("D_L00_00161BF8") __attribute__((section(" extern s32 D_L00_00161C38_c[] __asm__("D_L00_00161C38") __attribute__((section(".sdata"))); extern s32 D_L00_00161C48_c[] __asm__("D_L00_00161C48") __attribute__((section(".sdata"))); extern s32 D_L00_00161C88_c[] __asm__("D_L00_00161C88") __attribute__((section(".sdata"))); -extern void stop_n(int) __asm__("FUN_L00_0023e838"); +extern void FUN_L00_0023e838(int); +int FUN_L00_002e2040(int id); int FUN_L00_002e2040(int id) { unsigned int i; for (i = 0; (int)i < 3; i++) { @@ -665,11 +670,11 @@ int FUN_L00_002e2040(int id) { D_L00_00161BF8_c[i] = 0; D_L00_00161C88_c[i] = 0; if (D_L00_00161C38_c[i] != -1) { - stop_n(D_L00_00161C38_c[i]); + FUN_L00_0023e838(D_L00_00161C38_c[i]); D_L00_00161C38_c[i] = -1; } if (D_L00_00161C48_c[i] != -1) { - stop_n(D_L00_00161C48_c[i]); + FUN_L00_0023e838(D_L00_00161C48_c[i]); D_L00_00161C48_c[i] = -1; } return 1; @@ -712,6 +717,7 @@ extern Q002e2190 D_L00_001E6DE0[]; extern s32 D_L00_00161BF8[] MACRO_ADDR; extern s32 D_L00_00161C88[] MACRO_ADDR; void fast_mem_copy(void *, void *, s32) __asm__("FUN_001f98d0"); +s32 FUN_L00_002e2190(s32 id, void *src, void *v); s32 FUN_L00_002e2190(s32 id, void *src, void *v) { s32 i; for (i = 0; i < 3; i++) { @@ -793,7 +799,7 @@ extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void transform_vector_c(void *, void *, void *) __asm__("func_001F9D20"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("func_001F9CF8"); f32 FUN_L00_00257c48(f32, f32); -f32 FUN_L00_0025e310(f32 a); +f32 normalize_angle(f32 a) __asm__("FUN_L00_0025e310"); int FUN_L00_0023e738(void *v, float a, float b_0023e738, float c, float d, float e); unsigned char *FUN_L00_00274948(void *a, void *b, int c, int d); void random_spherical_offset(void *out, f32 a, f32 b) __asm__("FUN_00213358"); @@ -1289,7 +1295,8 @@ int random_integer_below(int) __asm__("FUN_00213260"); void FUN_00212f90_2e3a88(void *, int, int, int) __asm__("FUN_00212f90"); extern float D_L00_00161C98 __attribute__((sda)); extern float D_L00_00161C9C __attribute__((sda)); -void FUN_L00_002e3a88(unsigned char *m) { +void pterodactyl_update(unsigned char *m) __asm__("FUN_L00_002e3a88"); +void pterodactyl_update(unsigned char *m) { D_2e3a88 *d = *(D_2e3a88 **)(m + 0x78); int *p = vend_paths[d->path]; float y; @@ -1330,19 +1337,20 @@ void FUN_L00_002e3a88(unsigned char *m) { } } float FUN_001f9b48(void *, void *); -float FUN_001f9af0(void *); -int FUN_001f96f8(int); +float fast_vec_length(void *) __asm__("FUN_001f9af0"); +int scale_game_frames(int) __asm__("FUN_001f96f8"); void blend_moby_animation(unsigned char *, int, int, int) __asm__("FUN_00212f90"); -void FUN_L00_002e3ca8(unsigned char *p) { +void red_plant_update(unsigned char *p) __asm__("FUN_L00_002e3ca8"); +void red_plant_update(unsigned char *p) { char *g = (char *)&hero.motion.pos; if (FUN_001f9b48(g, p + 0x10) < 1.0f) { - if (FUN_001f9af0(g + 0x80) > frame_time + frame_time && p[0x53] != 1) { - blend_moby_animation(p, 1, 0, FUN_001f96f8(6)); + if (fast_vec_length(g + 0x80) > frame_time + frame_time && p[0x53] != 1) { + blend_moby_animation(p, 1, 0, scale_game_frames(6)); } } if (p[0x70] & 2) { if (p[0x53] == 1) { - blend_moby_animation(p, 0, 0, FUN_001f96f8(6)); + blend_moby_animation(p, 0, 0, scale_game_frames(6)); } } } @@ -1353,12 +1361,12 @@ extern char D_L00_0015F580[] __attribute__((section(".sdata"))); extern f32 dot_vectors_xyz(void *, void *) __asm__("func_001F9AB0"); extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); -extern int FUN_L00_001f0d60(float, void *, int, void *); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); extern void quaternion_to_matrix(void *, void *) __asm__("FUN_001fa4f8"); extern void matrix_to_euler(void *, void *) __asm__("FUN_00214598"); extern void FUN_L00_001ff660(void *, void *, void *); -extern void FUN_L00_0025e450(void *, void *, void *, float, float, int, float, int, float, float, int, float, int, float, int, int, int, int); +extern void spawn_explosion(void *, void *, void *, float, float, int, float, int, float, float, int, float, int, float, int, int, int, int) __asm__("FUN_L00_0025e450"); extern void FUN_L00_0025f3e8(void *, void *, int, float, float); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void build_quaternion_from_axis_angle(void *, void *, f32) __asm__("FUN_00214530"); @@ -1375,7 +1383,8 @@ extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); extern int func_L00_001F10E0_s(void *, float, int, void *) __asm__("FUN_L00_001f0d60"); extern float coll_hit_normal[] __asm__("D_L00_00173E80") __attribute__((section(".data"))); -void FUN_L00_002e3d88(char *m) { +void robot_arm_update(char *m) __asm__("FUN_L00_002e3d88"); +void robot_arm_update(char *m) { char *d = *(char **)(m + 0x78); float a20[4]; float a30[12]; @@ -1407,7 +1416,7 @@ void FUN_L00_002e3d88(char *m) { FUN_L00_0025f3e8(m, a20, -1, *(float *)(d + 0x2C) * 0.5f, 0.0f); } else { float h = *(float *)(d + 0x2C) * 0.5f; - FUN_L00_0025e450(m, D_L00_0015F580, a20, 0.0f, 0.0f, 5, *(float *)(d + 0x2C), 3, h, 9.0f, 5, h, -1, 0.0f, 0, 0, -1, 0); + spawn_explosion(m, D_L00_0015F580, a20, 0.0f, 0.0f, 5, *(float *)(d + 0x2C), 3, h, 9.0f, 5, h, -1, 0.0f, 0, 0, -1, 0); } mark_moby_for_removal(m); return; @@ -1590,8 +1599,8 @@ void follow_camera_reset(char *o) { /* Ported from rac1-decomp (src/overlays/shared/vendor_002E1660.c: func_L00_002E5A30), where it is exact; names translated to the US level program. */ extern char D_L00_00166E10[]; -extern float FUN_001f9ab0(void *, void *); -extern float FUN_001f9af0(void *); +extern float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern float fast_arc_sin(float) __asm__("FUN_001f9df8"); extern void FUN_001f9a10_c2(void *, void *, void *) __asm__("FUN_001f9a10"); extern void FUN_001f9a28(float *, float *, float *); @@ -1606,16 +1615,16 @@ float FUN_L00_002e4580(char *a, float f) { FUN_001f9a68_c3(v1, g + 0x20, f); FUN_001f9a10_c2(v1, v1, v0); FUN_001f9a28(v2, v1, (float *)(a + 0x30)); - len = FUN_001f9ab0(v2, a + 0x10); + len = fast_vec_dot(v2, a + 0x10); FUN_001f9a68_c3(v3, a + 0x10, len); FUN_001f9a28(v2, v2, v3); - r = FUN_001f9ab0(v2, a); - len = FUN_001f9af0(v2); + r = fast_vec_dot(v2, a); + len = fast_vec_length(v2); if (len == 0.0f) { return 0.0f; } r = 1.5707964f - fast_arc_sin(r / len); - if (FUN_001f9ab0(v2, a + 0x20) < 0.0f) { + if (fast_vec_dot(v2, a + 0x20) < 0.0f) { r = -r; } return r; @@ -1628,7 +1637,7 @@ typedef struct { extern char D_0013E533[]; extern char D_L00_00166E10[]; -extern float FUN_001f9ab0(void *, void *); +extern float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); extern int FUN_001f96f8_c(int) __asm__("FUN_001f96f8"); extern void FUN_001f9a10_c(void *, void *, void *) __asm__("FUN_001f9a10"); extern void FUN_001f9a28(float *, float *, float *); @@ -1664,7 +1673,7 @@ void FUN_L00_002e46b8(char *a) { float f; *(short *)(m2 + 0x10) = 0; FUN_001f9a68_c(&v1, b + 0x80, *(float *)(b + 0xA4)); - f = FUN_001f9ab0(s, &t); + f = fast_vec_dot(s, &t); FUN_001f9a68_c(&v2, s, f); FUN_001f9a28((float *)&v2, (float *)&t, (float *)&v2); FUN_001f9a28((float *)&v1, (float *)&v1, (float *)&v2); @@ -1677,18 +1686,18 @@ void FUN_L00_002e46b8(char *a) { } typedef float V4[4] __attribute__((aligned(16))); extern char D_L00_00166E10[]; -void FUN_001f9a68(void *, void *, float); +void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern void vcopy_2e48a0(void *, void *) __asm__("FUN_001f9a68"); -void FUN_001f9a10(void *, void *, void *); -float FUN_001f9ab0(void *, void *); +void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); void follow_camera_hero_target(int, void *) __asm__("FUN_L00_002e4168"); void FUN_L00_002e48a0(void *out) { V4 a, b; char *g = D_L00_00166E10; vcopy_2e48a0(a, g + 0x20); follow_camera_hero_target(*(int *)(g - 0x10), b); - FUN_001f9a10(a, a, b); - FUN_001f9a68(out, g + 0x30, FUN_001f9ab0(g + 0x30, a)); + fast_vec_add(a, a, b); + fast_vec_scale(out, g + 0x30, fast_vec_dot(g + 0x30, a)); } /* camera attach mode transitions: picks the next state from the player's state and arms its timers */ /* Migrated from rac1-decomp (src/overlays/shared/vendor_002E1660.c: func_L00_002E5DE0). */ @@ -1969,17 +1978,17 @@ void FUN_L00_002e4930(char *m) { /* Ported from rac1-decomp (src/overlays/shared/vendor_002E1660.c: func_L00_002E6498), where it is exact; names translated to the US level program. */ extern f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); -extern float FUN_001f9af0(void *); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern int FUN_001f96f8_c2(int) __asm__("FUN_001f96f8"); extern int FUN_001f9770_c(void *) __asm__("FUN_001f9770"); -extern int FUN_L00_001f0d60(float, void *, int, void *); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern float FUN_L00_002e4580_u(void *, float) __asm__("FUN_L00_002e4580"); extern s32 D_L00_00161D24_gp __asm__("D_L00_00161D24") __attribute__((sda)); extern short D_L00_00161D3C_gp __asm__("D_L00_00161D3C") __attribute__((sda)); extern short D_L00_00161D40_gp __asm__("D_L00_00161D40") __attribute__((sda)); extern short D_L00_00161D54_gp __asm__("D_L00_00161D54") __attribute__((sda)); extern short D_L00_00161D6C_gp __asm__("D_L00_00161D6C") __attribute__((sda)); -extern void FUN_001f9a40(float, void *, void *, void *); +extern void lerp_vector(float, void *, void *, void *) __asm__("FUN_001f9a40"); extern void FUN_001f9a68_c2(void *, void *, float) __asm__("FUN_001f9a68"); extern void FUN_L00_002e4168_c(char *, void *) __asm__("FUN_L00_002e4168"); extern void FUN_L00_002e42c0_c(void *, int) __asm__("FUN_L00_002e42c0"); @@ -2007,10 +2016,10 @@ void FUN_L00_002e4fe8(char *m, float *v2) { pad = &hero; e = d + 0x40; if (pad->state.current == 0x77) { - x = FUN_001f9ab0(e, g + 0x30); + x = fast_vec_dot(e, g + 0x30); FUN_001f9a68_c2(v2, g + 0x30, x); FUN_001f9a28(e, e, v2); - y = FUN_001f9ab0(g + 0x30, d + 0xA0); + y = fast_vec_dot(g + 0x30, d + 0xA0); FUN_001f9a68_c2(v2, g + 0x30, y); qcopy(d + 0x50, v2); if (*(unsigned char *)(e + 0xC4) != 0xB) { @@ -2041,8 +2050,8 @@ void FUN_L00_002e4fe8(char *m, float *v2) { flag = 1; } else { if (func_L00_002E5770_r(tmp, 1) == 1) { - x = FUN_001f9ab0(tmp, g + 0x30); - if (x < FUN_001f9af0(e + 0x10)) + x = fast_vec_dot(tmp, g + 0x30); + if (x < fast_vec_length(e + 0x10)) flag = 1; } else { flag = 1; @@ -2052,18 +2061,18 @@ void FUN_L00_002e4fe8(char *m, float *v2) { if (absolute_float(*(float *)(g + 0x30) - *(float *)(g + 0x40)) > 0.001f || absolute_float(*(float *)(g + 0x34) - *(float *)(g + 0x44)) > 0.001f || absolute_float(*(float *)(g + 0x38) - *(float *)(g + 0x48)) > 0.001f) { - x = FUN_001f9ab0(cam, g + 0x30); + x = fast_vec_dot(cam, g + 0x30); FUN_001f9a68_c2(v2, g + 0x30, x); FUN_001f9a28(e, cam, v2); } else { qcopy(v2, e + 0x10); - x = FUN_001f9ab0(cam, g + 0x30); + x = fast_vec_dot(cam, g + 0x30); FUN_001f9a68_c2(tmp, g + 0x30, x); FUN_001f9a28(e, cam, tmp); } } else { FUN_L00_002e42c0_c(tmp, 1); - x = FUN_001f9ab0(tmp, g + 0x30); + x = fast_vec_dot(tmp, g + 0x30); FUN_001f9a68_c2(v2, g + 0x30, x); FUN_001f9a28(e, tmp, v2); } @@ -2072,16 +2081,16 @@ void FUN_L00_002e4fe8(char *m, float *v2) { case 5: case 6: case 7: - FUN_001f9a40((float)*(short *)(e + 0xD4) * *(float *)(e + 0xCC), e + 0x10, e + 0x30, + lerp_vector((float)*(short *)(e + 0xD4) * *(float *)(e + 0xCC), e + 0x10, e + 0x30, e + 0x20); if (*(unsigned char *)(e + 0xD7) == 0) { - if (FUN_L00_001f0d60(0.2f, m + 0x30, 0x12, 0)) { + if (coll_sphere(0.2f, m + 0x30, 0x12, 0)) { qcopy(e + 0x30, e + 0x10); *(unsigned char *)(e + 0xD7) = 1; } } qcopy(v2, e + 0x10); - x = FUN_001f9ab0(cam, g + 0x30); + x = fast_vec_dot(cam, g + 0x30); FUN_001f9a68_c2(tmp, g + 0x30, x); FUN_001f9a28(e, cam, tmp); if (FUN_001f9770_c(e + 0xD4)) { @@ -2107,20 +2116,20 @@ void FUN_L00_002e4fe8(char *m, float *v2) { break; case 8: qcopy(v2, e + 0x10); - x = FUN_001f9ab0(cam, g + 0x30); + x = fast_vec_dot(cam, g + 0x30); FUN_001f9a68_c2(tmp, g + 0x30, x); FUN_001f9a28(e, cam, tmp); break; case 9: case 10: - x = FUN_001f9ab0(cam, g + 0x30); + x = fast_vec_dot(cam, g + 0x30); FUN_001f9a68_c2(v2, g + 0x30, x); FUN_001f9a28(e, cam, v2); - FUN_001f9a40(*(float *)&D_L00_00161D80, v2, v2, e + 0x20); + lerp_vector(*(float *)&D_L00_00161D80, v2, v2, e + 0x20); break; case 4: default: - x = FUN_001f9ab0(cam, g + 0x30); + x = fast_vec_dot(cam, g + 0x30); FUN_001f9a68_c2(v2, g + 0x30, x); FUN_001f9a28(e, cam, v2); break; @@ -2135,7 +2144,7 @@ void FUN_L00_002e55b8(void *mm, void *vv, void *tt, f32 a, f32 b, f32 c) { v[1] = cam_interp_values(p + 0xE4, v[1], t[1], a, b, c); v[2] = cam_interp_values(p + 0xE8, v[2], t[2], a, b, c); } -void FUN_001f9a10(void *, void *, void *); +void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); s32 FUN_L00_002e5678(void *mm, void *a, void *b, s32 k) { u8 *m = mm; s32 r = 1; @@ -2144,22 +2153,22 @@ s32 FUN_L00_002e5678(void *mm, void *a, void *b, s32 k) { switch (k) { case 3: case 4: - FUN_001f9a10(b, a, p); + fast_vec_add(b, a, p); r = 0; break; case 5: case 6: case 7: - FUN_001f9a10(b, a, p); + fast_vec_add(b, a, p); r = 0; break; case 1: follow_camera_hero_target((int)m, t); - FUN_001f9a10(b, a, t); + fast_vec_add(b, a, t); break; case 2: default: - FUN_001f9a10(b, a, p); + fast_vec_add(b, a, p); break; } return r; @@ -2344,6 +2353,7 @@ struct P1_388 { }; extern struct P1_388 *D_L00_00166E00_c __asm__("D_L00_00166E00"); /* -1 while D_L00_00166E00+0x86 is set; else clears its current id, 1 if it was id. */ +s32 FUN_L00_002e8388(s32 id); s32 FUN_L00_002e8388(s32 id) { struct P1_388 *t = D_L00_00166E00_c; if (t->f86 != 0) { @@ -2373,6 +2383,7 @@ typedef struct { char pad00[0x84]; short f84; } O842e83c0; +int FUN_L00_002e83c0(int arg1, int arg2); int FUN_L00_002e83c0(int arg1, int arg2) { void *a = D_L00_00166E00_c2; C842e83c0 *cur; @@ -2468,7 +2479,8 @@ void FUN_L00_002e8568(int v) { } extern char *D_L00_00166E00_002e8590[] __asm__("D_L00_00166E00"); /* Stores non-zero a/b at +0x11C/+0x120 of D_L00_00166E00+0x70 while its short at 0x86 is 0. */ -void FUN_L00_002e8590(float a, float b) { +void follow_camera_set_lateral_spring(float a, float b) __asm__("FUN_L00_002e8590"); +void follow_camera_set_lateral_spring(float a, float b) { char *p = D_L00_00166E00_002e8590[0]; if (*(short *)(p + 0x86) == 0) { char *q = *(char **)(p + 0x70) + 0x40; @@ -2483,6 +2495,7 @@ void FUN_L00_002e8590(float a, float b) { extern char *D_L00_00166E00_002e8620 __asm__("D_L00_00166E00") __attribute__((section(".data"))); /* Sets the short at +0x226 of D_L00_00166E00+0x70 while the short at 0x86 is 0. */ +void FUN_L00_002e8620(void); void FUN_L00_002e8620(void) { char *p = D_L00_00166E00_002e8620; if (*(short *)(p + 0x86) == 0) { @@ -2510,7 +2523,7 @@ void FUN_L00_002e8680(void) { /* Ported from rac1-decomp (src/overlays/shared/vendor_002E1660.c: func_L00_002E9B60), where it is exact; names translated to the US level program. */ extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); -extern float FUN_L00_00257e20(float a, float b, float c, float d, float t); +extern float cubic_hermite_scalar(float a, float b, float c, float d, float t) __asm__("FUN_L00_00257e20"); extern void FUN_001f9a68_c4(void *, void *, float) __asm__("FUN_001f9a68"); extern void fast_vec_cross(void *, void *, void *) __asm__("FUN_001f9ad8"); float absolute_float(float input) __asm__("func_001F99C0"); @@ -2533,24 +2546,24 @@ float FUN_L00_002e86b0(char *a0, float *a1, float lim) { float z2; float t; - FUN_001f9a68_c4(b0, axis, FUN_001f9ab0(a1, axis)); + FUN_001f9a68_c4(b0, axis, fast_vec_dot(a1, axis)); FUN_001f9a28(b1, a1, b0); - FUN_001f9a68_c4(b0, axis, FUN_001f9ab0(p, axis)); + FUN_001f9a68_c4(b0, axis, fast_vec_dot(p, axis)); FUN_001f9a28(b2, (float *)p, b0); - dot = FUN_001f9ab0(b1, b2); - len = FUN_001f9af0(b1); + dot = fast_vec_dot(b1, b2); + len = fast_vec_length(b1); if (len == r) { return r; } z2 = 0.0f; - len = len * FUN_001f9af0(b2); + len = len * fast_vec_length(b2); if (len == r) { return r; } ang = 1.5707964f - fast_arc_sin(dot / len); sign = -1.0f; fast_vec_cross(b3, b1, axis); - if (FUN_001f9ab0(b3, b2) >= 0.0f) { + if (fast_vec_dot(b3, b2) >= 0.0f) { sign = 1.0f; } r = fast_subtract_rotations(3.1415927f, ang); @@ -2561,7 +2574,7 @@ float FUN_L00_002e86b0(char *a0, float *a1, float lim) { if (t > 1.0f) { t = 1.0f; } - *(float *)(q + 0x1C) = FUN_L00_00257e20(-1.0f, 0.0f, 1.0f, 0.0f, t) * sign; + *(float *)(q + 0x1C) = cubic_hermite_scalar(-1.0f, 0.0f, 1.0f, 0.0f, t) * sign; return r; } void FUN_001f9a28_c2(void *, void *, void *) __asm__("FUN_001f9a28"); @@ -2584,6 +2597,7 @@ void FUN_L00_002e8918(char *a, float x, float y) { extern char *D_L00_00166E00_002e8970 __asm__("D_L00_00166E00") __attribute__((section(".data"))); void FUN_L00_002e88c8_002e8970(char *, char *, float) __asm__("FUN_L00_002e88c8"); /* Stores x at +0x1BC of D_L00_00166E00+0x70 and calls FUN_L00_002e88c8 with a and y. */ +void FUN_L00_002e8970(char *a, float x, float y); void FUN_L00_002e8970(char *a, float x, float y) { char *b = a; char *p = D_L00_00166E00_002e8970; @@ -2592,3 +2606,18 @@ void FUN_L00_002e8970(char *a, float x, float y) { FUN_L00_002e88c8_002e8970(p, b, y); } } + +f32 D_L01_0016736C[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_001674EC[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_00166FEC[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_0016706C[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_001672EC[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_0016766C[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_00166F6C[1] __attribute__((section(".data"))) = {0}; +f32 D_L09_0016706C[1] __attribute__((section(".data"))) = {0}; +f32 D_L10_0016736C[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_0016736C[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_001671EC[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_001675EC[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_001674EC[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_001672EC[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/entities/walloper.c b/src/overlays/shared/gameplay/entities/walloper.c index f1a1992470..9408f126cd 100644 --- a/src/overlays/shared/gameplay/entities/walloper.c +++ b/src/overlays/shared/gameplay/entities/walloper.c @@ -53,21 +53,21 @@ extern void fast_vec_scale(float, void *, void *) __asm__("FUN_001f9a68"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void clear_u64_value() __asm__("FUN_001f99f8"); extern void blend_vector_2b94d0(float, void *, void *, void *) __asm__("FUN_001f9a40"); -extern float FUN_001f9dc8(float), FUN_001f9de0(float), fast_arc_tan(float, float); -extern float FUN_001fa6c0(int); +extern float fast_cos(float), fast_sin(float), fast_arc_tan(float, float); +extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); -extern int FUN_001f9770(); -extern int FUN_002141f8(); +extern int fast_dec_timer_s16() __asm__("FUN_001f9770"); +extern int suck_get_aim_height() __asm__("FUN_002141f8"); extern float FUN_L00_00257c48(float, float), FUN_L00_00257be8(float, float); -extern float FUN_L00_0025e310(float); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern int FUN_L00_00257b90(int, int), FUN_00213260(int); extern void build_look_at_matrix(void *, void *, void *, float) __asm__("FUN_00214890"); extern void make_hit_descriptor(void *, void *, int, void *, float) __asm__("FUN_L00_00259888"); extern void FUN_L00_00259a88(void *, void *); extern int FUN_L00_00259830(void *); extern int FUN_001efa68(Vec4 *, Vec4 *, int, void *, int); -extern void FUN_L00_001f2868(float, void *, int, void *, void *); +extern void collect_mobies_in_sphere(float, void *, int, void *, void *) __asm__("FUN_L00_001f2868"); extern void FUN_0022da68(int, int, void *); extern unsigned char *FUN_L00_00272060(void *, int, int, int, int, float *, float, float, float); @@ -112,7 +112,7 @@ void FUN_L00_002b94d0(u8 *o) { *(short *)(*(char **)(candidate + 0x24) + 0x46) != 5) continue; if ((u8)candidate[0x20] == 0xfe) goto next_candidate; if ((u8)candidate[0x20] == 0xfd) goto next_candidate; - if (!FUN_002141f8(candidate)) continue; + if (!suck_get_aim_height(candidate)) continue; fast_vec_sub(&target0, candidate + 0x10, v); distance = vector_length_xy(&target0); if (D_L00_00161594 < distance) continue; @@ -156,14 +156,14 @@ next_candidate:; } primary_distance = 0.0f; if (*(char **)(v + 0x20)) { - data = (char *)FUN_002141f8(*(char **)(v + 0x20)); + data = (char *)suck_get_aim_height(*(char **)(v + 0x20)); qcopy(&target0, *(char **)(v + 0x20) + 0x10); target0.f[2] += *(float *)(data + 0x10); primary_distance = fast_vec_dist(v, &target0); spacing = primary_distance * 0.05f; } if (*(char **)(v + 0x38)) { - data = (char *)FUN_002141f8(*(char **)(v + 0x38)); + data = (char *)suck_get_aim_height(*(char **)(v + 0x38)); qcopy(&target1, *(char **)(v + 0x38) + 0x10); target1.f[2] += *(float *)(data + 0x10); spacing = (fast_vec_dist(&target0, &target1) + primary_distance) * 0.05f; @@ -174,7 +174,7 @@ next_candidate:; make_hit_descriptor(&hit, o, 0x210000, &camera_direction, enabled_float + 2.0f); hit.mode = 1; hit.kind = 5; hit.id = *(short *)(o + 0xa6); *(short *)(v + 0x3e) = 20; - FUN_L00_001f2868(0.3f, v, 0x10, *(void **)((char *)&D_001413D0), &hit); + collect_mobies_in_sphere(0.3f, v, 0x10, *(void **)((char *)&D_001413D0), &hit); fast_vec_sub(&direction, v + 0x10, v); fast_vec_normalize(&direction, &direction, 1.0f); if (*(char **)(v + 0x20) || *(char **)(v + 0x38)) { @@ -192,9 +192,9 @@ next_candidate:; for (i = 1; i < 20; i++, difference += 16, point += 16, side += 16, previous += 16) { n = (float)i; factor = D_L00_001615A4 + (D_L00_001615A8 - D_L00_001615A4) * - (FUN_001fa6c0(i) * 0.05f); - phase = FUN_L00_0025e310((*(float *)&D_L00_001615AC_gp) + n * D_L00_001615A0); - wave = factor * FUN_001f9de0(phase); + (convert_integer_to_float(i) * 0.05f); + phase = normalize_angle((*(float *)&D_L00_001615AC_gp) + n * D_L00_001615A0); + wave = factor * fast_sin(phase); wave += FUN_L00_00257c48(D_L00_001615E4, D_L00_001615E8); score = *(float *)(point + 8) - ((float *)D_L00_001DB840)[i]; @@ -216,7 +216,7 @@ next_candidate:; length = fast_vec_length(&target_delta); if (length != 0.0f) { if (i == 19) { factor = 0.5f; spacing = length; } - else if (i >= 16) { factor = 0.5f; spacing = length / FUN_001fa6c0(19 - i); } + else if (i >= 16) { factor = 0.5f; spacing = length / convert_integer_to_float(19 - i); } else factor = 0.1f; fast_vec_scale(spacing / length, &target_delta, &target_delta); blend_vector_2b94d0(factor, &step, &step, &target_delta); @@ -228,7 +228,7 @@ next_candidate:; if (length != 0.0f) { if (i == 9 || i == 19) { factor = 0.7f; spacing = length; } else if ((unsigned)(i - 5) < 5 || i > 14) { - factor = 0.7f; spacing = length / FUN_001fa6c0((unsigned)(i - 5) < 5 ? 9 - i : 19 - i); + factor = 0.7f; spacing = length / convert_integer_to_float((unsigned)(i - 5) < 5 ? 9 - i : 19 - i); } else factor = 0.2f; fast_vec_scale(spacing / length, &target_delta, &target_delta); blend_vector_2b94d0(factor, &step, &step, &target_delta); @@ -236,19 +236,19 @@ next_candidate:; } } if (i < 10) { - phase = FUN_L00_0025e310((*(float *)&D_L00_001615B4_gp) + (float)i * D_L00_001615BC); - angle = FUN_L00_0025e310((*(float *)&D_L00_001615C8_gp) + (float)i * D_L00_001615D0); - factor = D_L00_001615C0 * FUN_001f9de0(angle); + phase = normalize_angle((*(float *)&D_L00_001615B4_gp) + (float)i * D_L00_001615BC); + angle = normalize_angle((*(float *)&D_L00_001615C8_gp) + (float)i * D_L00_001615D0); + factor = D_L00_001615C0 * fast_sin(angle); qcopy(side, point); - wave = FUN_001f9de0(phase); + wave = fast_sin(phase); side_wave = FUN_L00_00257c48(0.0f, 0.1f); wave = factor * wave + side_wave; ((float *)D_L00_001DB9D0)[i] = wave; *(float *)(point + 0x148) += wave; angle = fast_add_rotations(fast_arc_tan(delta.f[0], delta.f[1]), 1.5707964f); - wave = D_L00_001615C4 * FUN_001f9dc8(phase); - offset.f[0] = FUN_001f9dc8(angle) * wave; - offset.f[1] = FUN_001f9de0(angle) * wave; + wave = D_L00_001615C4 * fast_cos(phase); + offset.f[0] = fast_cos(angle) * wave; + offset.f[1] = fast_sin(angle) * wave; offset.f[2] = 0.0f; qcopy(&D_L00_001DB890[i], &offset); fast_vec_add(side, side, &offset); @@ -275,7 +275,7 @@ next_candidate:; if (hit_result) { candidate = D_L00_00173E58; if (candidate) { - if (!FUN_002141f8(candidate) || !*(char **)(candidate + 0x24) || + if (!suck_get_aim_height(candidate) || !*(char **)(candidate + 0x24) || *(short *)(*(char **)(candidate + 0x24) + 0x46) != 5) FUN_L00_00259a88(candidate, &hit); else { @@ -308,7 +308,7 @@ next_candidate:; effects.first.hit0.id = *(short *)(o + 0xa6); effects.first.hit0.mode = 3; effects.first.hit0.kind = 5; FUN_L00_00259a88(*(char **)(v + 0x20), &effects.first.hit0); timer = 5; - data = (char *)FUN_002141f8(*(char **)(v + 0x20)); + data = (char *)suck_get_aim_height(*(char **)(v + 0x20)); if (data && *(short *)(data + 4) == 1) timer = 1; *(short *)(v + 0x44) = scale_game_frames(timer); } @@ -321,7 +321,7 @@ next_candidate:; effects.hit1.id = *(short *)(o + 0xa6); effects.hit1.kind = 5; effects.hit1.mode = 3; FUN_L00_00259a88(*(char **)(v + 0x38), &effects.hit1); timer = 5; - data = (char *)FUN_002141f8(*(char **)(v + 0x38)); + data = (char *)suck_get_aim_height(*(char **)(v + 0x38)); if (data && *(short *)(data + 4) == 1) timer = 1; *(short *)(v + 0x46) = scale_game_frames(timer); } @@ -331,7 +331,7 @@ next_candidate:; if (i < 2) { qcopy(&effects.first.origin, v); factor = 0.4f; } else { qcopy(&effects.first.origin, v + 0x10); factor = 0.5f; } point = (char *)D_L00_001DBA20 + i * 0x50; - if (FUN_001f9770(&D_L00_00161658[i])) { + if (fast_dec_timer_s16(&D_L00_00161658[i])) { D_L00_00161658[i] = scale_game_frames(D_L00_00161668[i]); (&D_L00_00161660)[i] = 0; angle = FUN_L00_00257c48(0.5235988f, 1.0471976f); @@ -362,8 +362,8 @@ next_candidate:; if (D_L00_00161670[i] < D_L00_00161658[i]) difference = D_L00_00161658[i] - D_L00_00161670[i]; else difference = D_L00_00161670[i] - D_L00_00161658[i]; - distance = FUN_001fa6c0(difference); - angle = FUN_001fa6c0(scale_game_frames(15)); + distance = convert_integer_to_float(difference); + angle = convert_integer_to_float(scale_game_frames(15)); (&D_L00_00161660)[i] = truncate_float_to_s32((1.0f - distance / angle) * 32.0f); } } @@ -836,7 +836,8 @@ extern void subtract_vector_xyz(void *, void *, void *); extern int func_001F9908_r(void *) __asm__("FUN_001f9740"); extern SparkleRowC860 D_L00_001DBB90[]; -void FUN_L00_002bb558(char *m) { +void walloper_update(char *m) __asm__("FUN_L00_002bb558"); +void walloper_update(char *m) { int flag = 0; float vec0[4] __attribute__((aligned(16))); float vec1[4] __attribute__((aligned(16))); @@ -955,7 +956,7 @@ void FUN_L00_002bb558(char *m) { extern f32 D_L00_00161660_f[] __asm__("D_L00_00161660") __attribute__((section(".sdata"))); extern f32 D_L00_00161690 __attribute__((sda)); extern f32 D_L00_00161694 __attribute__((sda)); -f32 FUN_001fa6c0(s32); +f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); void FUN_L00_002bbbc8(void *, s32, s32, s32, f32, f32, f32); void FUN_L00_002bc1a0(void *); @@ -964,7 +965,7 @@ void FUN_L00_002bbb00(void *o) { s32 r; for (i = 0; i < 10; i++) { if (D_L00_001DBEC0[i] != 0) { - r = truncate_float_to_s32(FUN_001fa6c0(D_L00_001DBED8[i]) * D_L00_00161660_f[29]); + r = truncate_float_to_s32(convert_integer_to_float(D_L00_001DBED8[i]) * D_L00_00161660_f[29]); FUN_L00_002bbbc8(&D_L00_001DBBA0[i], r, r, 5, D_L00_00161690, D_L00_00161694, 0.2f); } } @@ -1394,9 +1395,9 @@ extern int D_L00_001617BC; extern int D_L00_001617C0; extern int D_L00_001617C4; extern int D_L00_001617C8; -extern int FUN_001f9770(); +extern int fast_dec_timer_s16() __asm__("FUN_001f9770"); extern int transpose_rotation_matrix() __asm__("FUN_001fa2d8"); -extern int FUN_002141f8(); +extern int suck_get_aim_height() __asm__("FUN_002141f8"); extern int FUN_L00_002223f8(); extern int FUN_L00_00236e50(); extern int FUN_L00_0024f7c8(); @@ -1414,7 +1415,7 @@ extern void transform_vector(void *, void *, void *) __asm__("func_001F9D20"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("func_001F9CF8"); f32 compute_interpolated_record_value_c(void *anim) __asm__("FUN_0020c9e0"); int FUN_L00_0023e5e0(void *v, float a, float b, int col); -int FUN_L00_0028d8c0(int a, int i); +int voice_is_playing(int a, int i) __asm__("FUN_L00_0028d8c0"); s32 allocate_voice_for_bank_entry(s32 entry_index, s32 flags, s32 owner) __asm__("FUN_0022db10"); s32 remove_hud_item(s32 item) __asm__("FUN_001ff480"); struct Moby *FUN_L00_002c9348(void *a); @@ -1466,7 +1467,8 @@ extern void func_L00_00236BF8_2BDAF0(void) __asm__("FUN_L00_00236268"); extern void func_L00_00236DE8_2BDAF0(void) __asm__("FUN_L00_00236458"); extern void func_L00_002377E0_2BDAF0(void) __asm__("FUN_L00_00236e50"); -void FUN_L00_002bc7e8(Moby *moby) { +void morphoray_update(Moby *moby) __asm__("FUN_L00_002bc7e8"); +void morphoray_update(Moby *moby) { Vq_2BDAF0 direction; Vq_2BDAF0 points[3]; Vq_2BDAF0 matrix[4]; @@ -1638,9 +1640,6 @@ void FUN_L00_002bc7e8(Moby *moby) { D_L00_001617C0 = -1; } } -#ifndef NON_MATCHING -INCLUDE_ASM("config/us/overlays/asm/FUN_L00_002bcf98.s", FUN_L00_002bcf98); -#else extern f32 D_L00_001616DC_gp __asm__("D_L00_001616DC") __attribute__((sda)); extern f32 D_L00_001617CC_macro __asm__("D_L00_001617CC") __attribute__((section(".sdata"))); extern s32 D_L00_00161718_i __asm__("D_L00_00161718") __attribute__((sda)); @@ -1653,46 +1652,35 @@ extern s32 D_L00_001DBF50 __attribute__((section(".data"))); extern u128 D_L00_001DBF60_2bcf98 __asm__("D_L00_001DBF60") __attribute__((section(".data"))); extern s32 D_L00_001DD0D0 __attribute__((section(".data"))); extern void scale_vector_2bcf98(float, void *, void *) __asm__("FUN_001f9a68"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); -void FUN_L00_002bcf98(u8 *m) { - u128 vec; - volatile u128 *source = *(u128 **)(m + 0x78); +void FUN_L00_002bcf98(u8 *moby) { + u128 step; + u128 *source = *(u128 **)(moby + 0x78); s32 i; + s32 j; f32 scale; - u128 *copies; - s32 *clears; - u128 *scaled_vector; if (D_L00_001617BC != 0) { D_L00_001617BC = 0; scale = D_L00_001616DC_gp / convert_integer_to_float(12); D_L00_001617CC_macro = scale; - scale_vector_2bcf98(-scale, &vec, m + 0xD0); - qcopy(&D_L00_001DBF60_2bcf98, (void *)source); - for (i = 10; i >= 0; i--) { - FUN_001f9a10((&D_L00_001DBF60_2bcf98 + (11 - i)), &((u128 *)&D_L00_001DBF50)[11 - i], &vec); + scale_vector_2bcf98(-scale, &step, moby + 0xD0); + qcopy(&D_L00_001DBF60_2bcf98, source); + for (i = 1; i < 12; i++) { + fast_vec_add(&D_L00_001DBF60_2bcf98 + i, (u128 *)&D_L00_001DBF50 + i, &step); } D_L00_00161718_i = 0; D_L00_00161720_i = 0; D_L00_00161724_i = 0; - scaled_vector = &vec; D_L00_001617D0 = 0.0f; D_L00_00161824 = 0; - copies = (u128 *)&D_L00_001DD0D0; - clears = &D_L00_00161818; - { - s32 j; - for (j = 2; j >= 0; j--) { - *clears = 0; - qcopy(copies, scaled_vector); - copies++; - clears++; - } + for (j = 0; j < 3; j++) { + (&D_L00_00161818)[j] = 0; + qcopy((u128 *)&D_L00_001DD0D0 + j, &step); } } } -#endif /* Tesla claw arc: bends the twelve-point beam toward the target, builds the two side rails and the ring of * twenty points around each node, queues the draw callback, sparks at the tip, and runs the three travelling * pulses along the beam. */ @@ -1723,7 +1711,7 @@ extern f32 fast_sin(f32) __asm__("func_001F9DE0"); extern f32 random_float_between_c(f32, f32) __asm__("func_002132A8"); extern f32 vector_length_xyz_c(void *) __asm__("FUN_001f9af0"); extern float vector_distance_xy(void *, void *) __asm__("FUN_001f9b80"); -extern float FUN_L00_0025e310(float); +extern float normalize_angle(float) __asm__("FUN_L00_0025e310"); extern float D_L00_001616DC_gp __asm__("D_L00_001616DC") __attribute__((sda)); extern signed char D_L00_00161763; extern float D_L00_001617CC; @@ -1747,7 +1735,7 @@ extern void scale_vector_xyz_c3(void *, void *, float) __asm__("FUN_001f9a68"); extern void subtract_vector_xyz_c2(void *, void *, void *) __asm__("FUN_001f9a28"); unsigned char *FUN_L00_00272060(void *pos, int s, int color, int mode, int b, float *v, float x, float y, float z); unsigned char *FUN_L00_00275910(void *pos, int s, int col, int mode, int b, float *vec, int h, float x, float y); -void FUN_L00_002bcf98(u8 *m); +void FUN_L00_002bcf98(u8 *moby); void FUN_L00_002bdc50_c(void *o) __asm__("FUN_L00_002bdc50"); extern float D_L00_001616DC_gp __asm__("D_L00_001616DC") __attribute__((sda)); extern float D_L00_001617C0_2BE3A8 __asm__("D_L00_001616F0") __attribute__((sda)); @@ -2085,9 +2073,9 @@ void FUN_L00_002be078(void *, int, int, int, float, float, float, int); void FUN_L00_002be650(void *); void FUN_L00_002be890(void *); long FUN_001f44b8(int); -void FUN_001f9a28(void *, void *, void *); -void FUN_001f9ad8(void *, void *, void *); -float FUN_001f9ab0(void *, void *); +void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); +void fast_vec_cross(void *, void *, void *) __asm__("FUN_001f9ad8"); +float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); void fast_draw_quad_real(void *, void *, int) __asm__("FUN_001f7d30"); /* scrolls the two texture-offset accumulators and draws the 10x20 band of textured quads between the D_L00_001DC060/001DC1A0 rings, skipping @@ -2130,11 +2118,11 @@ void FUN_L00_002bdc50(void *o) { qcopy(&quad.corner[1], &D_L00_001DC1A0[i][(j + 1) % 20]); qcopy(&quad.corner[2], &D_L00_001DC060[i][j]); qcopy(&quad.corner[3], &D_L00_001DC060[i][(j + 1) % 20]); - FUN_001f9a28(&d1, &quad.corner[0], &quad.corner[1]); - FUN_001f9a28(&d2, &quad.corner[2], &quad.corner[1]); - FUN_001f9ad8(&n, &d2, &d1); - FUN_001f9a28(&e, &quad.corner[1], &(*(OvlVec4 *)g_debug_camera)); - if (FUN_001f9ab0(&n, &e) >= 0.0f) { + fast_vec_sub(&d1, &quad.corner[0], &quad.corner[1]); + fast_vec_sub(&d2, &quad.corner[2], &quad.corner[1]); + fast_vec_cross(&n, &d2, &d1); + fast_vec_sub(&e, &quad.corner[1], &(*(OvlVec4 *)g_debug_camera)); + if (fast_vec_dot(&n, &e) >= 0.0f) { a += D_L00_00161714; b += D_L00_00161714; } else { @@ -2612,7 +2600,7 @@ extern char D_0013F3D0[] __attribute__((section(".data"))); extern float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern float vector_distance_xy(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_001fa688(float, float); +extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_001f99c0(float); extern int FUN_001efa68_2bed90(void *, void *, int, void *, int) __asm__("FUN_001efa68"); @@ -2638,9 +2626,9 @@ char *FUN_L00_002bed90(char *self, float *position, float *angles, int unused, i checkCollision = 0; qcopy(target, candidate + 0x10); target[2] += 0.4f; - angleError = FUN_001fa688(angles[2], fast_arc_tan(target[0] - position[0], target[1] - position[1])); + angleError = fast_difference_between_rotations(angles[2], fast_arc_tan(target[0] - position[0], target[1] - position[1])); angleError *= angleError; - heightError = FUN_001fa688(angles[1], fast_arc_tan(distance, target[2] - position[2])); + heightError = fast_difference_between_rotations(angles[1], fast_arc_tan(distance, target[2] - position[2])); heightError *= heightError; if (checkCollision) { if (8.0f < FUN_001f99c0(*(float *)(candidate + 0x18) - *(float *)(self + 0x18))) @@ -2716,8 +2704,8 @@ extern f32 FUN_001f9e90_c(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); -extern f32 FUN_001f9dc8(f32); -extern f32 FUN_001f9de0(f32); +extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); +extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern s32 FUN_001efa68_c(void *, void *, s32, void *, s32) __asm__("FUN_001efa68"); extern f32 FUN_L00_002bec80_c(void *, void *) __asm__("FUN_L00_002bec80"); @@ -2757,12 +2745,12 @@ f32 FUN_L00_002bf050(Mob *m, VU *pos, f32 *tgt, f32 *out, f32 ang, f32 arc, f32 arc = fast_subtract_rotations(ang, arc); qcopy(&v0, pos); - v0.f[1] += FUN_001f9de0(cur) * r1; - v0.f[0] += FUN_001f9dc8(cur) * r1; + v0.f[1] += fast_sin(cur) * r1; + v0.f[0] += fast_cos(cur) * r1; v0.f[2] += h; qcopy(&v1, pos); - v1.f[1] += FUN_001f9de0(cur) * r2; - v1.f[0] += FUN_001f9dc8(cur) * r2; + v1.f[1] += fast_sin(cur) * r2; + v1.f[0] += fast_cos(cur) * r2; v1.f[2] += h + h; if (FUN_001efa68_c(&v0, &v1, 4, m, 0) == 0) { if (FUN_L00_002bec80_c(&v1, m) != 0.0f) { @@ -2786,12 +2774,12 @@ f32 FUN_L00_002bf050(Mob *m, VU *pos, f32 *tgt, f32 *out, f32 ang, f32 arc, f32 for (i = 0; i < n; i++) { qcopy(&v0, pos); - v0.f[1] += FUN_001f9de0(arc) * r1; - v0.f[0] += FUN_001f9dc8(arc) * r1; + v0.f[1] += fast_sin(arc) * r1; + v0.f[0] += fast_cos(arc) * r1; v0.f[2] += h; qcopy(&v1, pos); - v1.f[1] += FUN_001f9de0(arc) * r2; - v1.f[0] += FUN_001f9dc8(arc) * r2; + v1.f[1] += fast_sin(arc) * r2; + v1.f[0] += fast_cos(arc) * r2; v1.f[2] += h + h; if (FUN_001efa68_c(&v0, &v1, 4, m, 0) == 0) { if (FUN_L00_002bec80_c(&v1, m) != 0.0f) { @@ -2837,12 +2825,12 @@ f32 FUN_L00_002bf050(Mob *m, VU *pos, f32 *tgt, f32 *out, f32 ang, f32 arc, f32 ang = fast_subtract_rotations(best, 1.5707964f); qcopy(&v0, pos); - v0.f[1] += FUN_001f9de0(ang) * r1; - v0.f[0] += FUN_001f9dc8(ang) * r1; + v0.f[1] += fast_sin(ang) * r1; + v0.f[0] += fast_cos(ang) * r1; v0.f[2] += h * 0.125f; qcopy(&v1, &v0); - v1.f[1] += FUN_001f9de0(best) * r2; - v1.f[0] += FUN_001f9dc8(best) * r2; + v1.f[1] += fast_sin(best) * r2; + v1.f[0] += fast_cos(best) * r2; v1.f[2] += 0.12f; if (FUN_001efa68_c(&v0, &v1, 4, m, 0) != 0) { if (D_L00_00173E58_bf != x->p38 && @@ -2854,12 +2842,12 @@ f32 FUN_L00_002bf050(Mob *m, VU *pos, f32 *tgt, f32 *out, f32 ang, f32 arc, f32 } ang = fast_add_rotations(ang, 3.1415927f); qcopy(&v0, pos); - v0.f[1] += FUN_001f9de0(ang) * r1; - v0.f[0] += FUN_001f9dc8(ang) * r1; + v0.f[1] += fast_sin(ang) * r1; + v0.f[0] += fast_cos(ang) * r1; v0.f[2] += h * 0.125f; qcopy(&v1, &v0); - v1.f[1] += FUN_001f9de0(best) * r2; - v1.f[0] += FUN_001f9dc8(best) * r2; + v1.f[1] += fast_sin(best) * r2; + v1.f[0] += fast_cos(best) * r2; v1.f[2] += 0.12f; if (FUN_001efa68_c(&v0, &v1, 4, m, 0) != 0) { if (D_L00_00173E58_bf != x->p38 && @@ -2878,19 +2866,19 @@ f32 FUN_L00_002bf050(Mob *m, VU *pos, f32 *tgt, f32 *out, f32 ang, f32 arc, f32 /* Ported from rac1-decomp (src/overlays/shared/vendor_002BA7C8.c: func_L00_002C0B18), where it is exact; names translated to the US level program. */ extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a28(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void FUN_001f9a68(void *, void *, float); void FUN_L00_002bf810(char *a, char *b, int n) { float d[4]; float t[4]; int i; - FUN_001f9a28(d, b, a); + fast_vec_sub(d, b, a); FUN_001f9a68(d, d, 1.0f / convert_integer_to_float(n)); qcopy(t, a); for (i = 0; i < n; i++) { - FUN_001f9a10(t, t, d); + fast_vec_add(t, t, d); } } extern float vector_distance_xy(void *, void *) __asm__("FUN_001f9b80"); @@ -3109,7 +3097,7 @@ unsigned char *FUN_L00_002bfe08(int a, u128 *b, u128 *c) { #include "rnc/math/vector.h" extern char *D_L00_00173E58 __attribute__((section(".data"))); int FUN_001efa68(Vec4 *, Vec4 *, int, void *, int); -unsigned int FUN_001f0b58(void); +unsigned int collision_hit_material(void) __asm__("FUN_001f0b58"); int FUN_L00_002bfec8(unsigned char *p) { Vec4 a, b; int r = p[0x20]; @@ -3122,7 +3110,7 @@ int FUN_L00_002bfec8(unsigned char *p) { if (o && *(char **)(o + 0x24) && *(short *)(*(char **)(o + 0x24) + 0x46) == 5) { r = 11; } else { - switch (FUN_001f0b58()) { + switch (collision_hit_material()) { case 0: case 1: case 3: diff --git a/src/overlays/shared/gameplay/hero/air_accel.c b/src/overlays/shared/gameplay/hero/air_accel.c index 7cca64df29..5d4de13db3 100644 --- a/src/overlays/shared/gameplay/hero/air_accel.c +++ b/src/overlays/shared/gameplay/hero/air_accel.c @@ -56,130 +56,122 @@ void FUN_L01_00227e48(int a0, int a1, int a2) { FUN_L00_0028de68(a0, a1, flag, 0, *(int *)(g + 0x2080)); } } -#ifndef NON_MATCHING -INCLUDE_ASM("config/us/overlays/asm/FUN_L01_00228000.s", FUN_L01_00228000); -#else #include "rnc/gameplay/entities/moby.h" -extern void FUN_L00_00232670(void); -extern void hero_update(void) __asm__("FUN_L00_00211670"); -extern void FUN_L01_0022cd48(void); -extern void FUN_L01_00242930(void); -extern void FUN_L00_00216f10(void); + +extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); +extern int level_frame_count __asm__("D_L01_0015F5CC"); +extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); +extern unsigned char D_0013D4DC[]; +#include "rnc/gameplay/state/options.h" +extern float D_L01_0017C04C[]; +extern unsigned int fast_tween_color(float, unsigned int, unsigned int); extern void FUN_L00_002054e8(void); -extern void FUN_L00_00208a10(void); -extern void FUN_L00_00207c48(void); extern void FUN_L00_00207a58(void); -extern void FUN_L00_002484e0(void *); +extern void FUN_L00_00207c48(void); extern void FUN_L00_00207d00(void); -extern void FUN_L00_00216de8(int, int); +extern void FUN_L00_00208a10(void); extern void FUN_L00_00208b60(void); -extern void FUN_L00_00257024(void *); +extern void hero_update(void) __asm__("FUN_L00_00211670"); +extern void FUN_L00_00216de8(int, int); +extern void FUN_L00_00216f10(void); +extern void FUN_L00_00232670(void); +extern void FUN_L00_002484e0(void *); extern void moby_point_position(void *, int, void *) __asm__("FUN_L00_0024f7c8"); -extern int scale_game_frames(int) __asm__("FUN_001f96f8"); -extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); -extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); -extern int fast_tween_color(float, int, int) __asm__("FUN_001fa6e0"); -extern unsigned char D_0015EDB1[] __attribute__((section(".data"))); -extern unsigned char D_L00_0017A680[]; -extern int level_frame_count __asm__("D_L01_0015F5CC"); -extern unsigned char D_0013D4DC[]; +extern void FUN_L00_00257024(void *); +extern void FUN_L01_0022cd48(void); +extern void FUN_L01_00242930(void); + +/* Per-frame hero update; in vehicle mode 3 it also pulses the hero moby's glow colour. */ +void FUN_L01_00228000(void) { + struct Moby *hero_moby; + int period, red, green, blue, alpha, i; + unsigned int color; + float pulse; -void FUN_L01_00228000(void) -{ - struct Hero *p; - struct Hero *q; - long period; - int r, g, b, alpha, i; - int color; - float phase, value, numerator; - char *v; FUN_L00_00232670(); hero_update(); FUN_L01_0022cd48(); FUN_L01_00242930(); - p = &hero; - if (p->vehicle_mode == 0) return; + if (hero.vehicle_mode == 0) + return; FUN_L00_00216f10(); FUN_L00_002054e8(); - if (p->vehicle_mode == 0) return; + if (hero.vehicle_mode == 0) + return; FUN_L00_00208a10(); FUN_L00_00207c48(); FUN_L00_00207a58(); - FUN_L00_002484e0(&p->motion.pos); - if (p->vehicle_mode == 3) { - if (D_0015EDB1[0] != 0) *(float *)(D_L00_0017A680 + 0x154C) = 1.9f; - alpha = 128; - period = scale_game_frames(170); - if (p->unk22E0 == 2) period = scale_game_frames(50); - else if (p->unk22E0 == 1) period = scale_game_frames(90); - value = convert_integer_to_float(period); - phase = fast_sin((((float)(level_frame_count % (int)period) / value) * 2.0f) * 3.1415927f + -3.1415927f); - r = truncate_float_to_s32(phase * 20.0f) + 50; - g = truncate_float_to_s32(phase * 70.0f) + 180; - if (r > 255) r = 255; - b = truncate_float_to_s32(phase * 10.0f) + 20; - hero.moby->flags |= 0x10; - if (g > 255) g = 255; + FUN_L00_002484e0(&hero.motion.pos); + if (hero.vehicle_mode == 3) { + if ((&big_head_cheat_enabled)[1] != 0) + D_L01_0017C04C[0] = 1.9f; + alpha = 0x80; + period = scale_game_frames(0xAA); + if (hero.unk22E0 == 2) + period = scale_game_frames(0x32); + else if (hero.unk22E0 == 1) + period = scale_game_frames(0x5A); + pulse = fast_sin((((float)(level_frame_count % period) / convert_integer_to_float(period)) * 2.0f) * 3.1415927f + -3.1415927f); + red = truncate_float_to_s32(pulse * 20.0f) + 0x32; + green = truncate_float_to_s32(pulse * 70.0f) + 0xB4; + blue = truncate_float_to_s32(pulse * 10.0f); + hero_moby = hero.moby; + if (red > 0xFF) red = 0xFF; + if (green > 0xFF) green = 0xFF; + blue += 0x14; + hero_moby->flags |= 0x10; if (hero.unk22E0 == 2) { - int channels; - channels = alpha << 24; - channels |= b << 16; - channels |= (r / 2) << 8; - color = channels | g; + unsigned int packed = (alpha << 24) | (blue << 16); + packed |= (red / 2) << 8; + color = packed | green; } else { - color = ((alpha << 24) | (b << 16)) | ((g << 8) | r); + unsigned int packed = (alpha << 24) | (blue << 16); + packed |= green << 8; + color = packed | red; } - q = &hero; - hero.moby->glow_color = fast_tween_color(0.1f, hero.moby->glow_color, color); - v = (char *)q + 0x1D50; for (i = 0; i < 3; i++) { - moby_point_position(q->moby, i, v + i * 16); + moby_point_position(hero.moby, i, (char *)&hero + 0x1D50 + i * 16); } - q = &hero; - alpha = 48; - r = ((unsigned char *)&q->moby->glow_color)[0]; - b = ((unsigned char *)&q->moby->glow_color)[2]; - g = ((unsigned char *)&q->moby->glow_color)[1]; - if (q->unk22DE != 0) { - numerator = convert_integer_to_float(q->unk22DE); - value = convert_integer_to_float(18); - alpha = truncate_float_to_s32((numerator / value) * (float)alpha); + alpha = 0x30; + { + struct Moby *moby = hero.moby; + blue = ((unsigned char *)&moby->glow_color)[2]; + green = ((unsigned char *)&moby->glow_color)[1]; + red = ((unsigned char *)&moby->glow_color)[0]; } + if (hero.unk22DE != 0) + alpha = truncate_float_to_s32((convert_integer_to_float(hero.unk22DE) / convert_integer_to_float(0x12)) * (float)alpha); { - int packed_color; - packed_color = (alpha << 24) | (b << 16); - packed_color |= g << 8; - packed_color |= r; - *(unsigned int *)((char *)q + 0x22E4) = packed_color; + unsigned int packed = (alpha << 24) | (blue << 16); + packed |= green << 8; + packed |= red; + *(unsigned int *)((char *)&hero + 0x22E4) = packed; } FUN_L00_00207d00(); - q->unk22E0 = 0; - if (q->vehicle_mode != 3) goto finish; - if (q->pending_item[0] == 0) goto pending_zero; - if (q->pending_item[0] == 31) goto pending_zero; - if (q->unk22DE == 0) { - FUN_L00_00216de8(25, 0); - q->unk22DE = 18; - q->unk22DC = 1; + hero.unk22E0 = 0; + if (hero.vehicle_mode == 3) { + int pending = hero.pending_item[0]; + if (pending != 0 && pending != 0x1F) { + if (hero.unk22DE == 0) { + FUN_L00_00216de8(0x19, 0); + hero.unk22DE = 0x12; + hero.unk22DC = 1; + } + } else { + hero.pending_item[0] = 0; + if (hero.unk12E7 != 0 && hero.grounded_frames != 0 && D_0013D4DC[0] != 0 && + hero.unk22DE == 0) { + FUN_L00_00216de8(0x19, 0); + hero.unk22DE = 0x12; + hero.unk22DC = 1; + } + } } - goto finish; -pending_zero: - p = &hero; - p->pending_item[0] = 0; - if (p->unk12E7 == 0) goto finish; - if (p->grounded_frames == 0) goto finish; - if (D_0013D4DC[0] == 0) goto finish; - if (p->unk22DE != 0) goto finish; - FUN_L00_00216de8(25, 0); - p->unk22DE = 18; - p->unk22DC = 1; - } -finish: + } FUN_L00_00208b60(); FUN_L00_00257024(hero.moby); } -#endif #define NOT_SDA #define MACRO_ADDR @@ -213,7 +205,7 @@ extern void FUN_L00_00216f10(void); extern void FUN_L00_00232670(void); extern void FUN_L00_002484e0(void *); extern void FUN_L00_00257024(void *); -extern void FUN_L01_00228000(void); +extern void FUN_L01_00228000_u(void) __asm__("FUN_L01_00228000"); extern void FUN_L01_00228e38(void); extern void FUN_L01_0022cd48_u(void) __asm__("FUN_L01_0022cd48"); extern void FUN_L01_0022d090(void); @@ -235,7 +227,7 @@ void FUN_L01_00228870(void) { *(short *)(g + 0x1EB2) = 0; *(short *)(g + 0x1EB0) = 0; if (*(unsigned char *)(g + 0x20A4) != 0) { - FUN_L01_00228000(); + FUN_L01_00228000_u(); return; } FUN_L00_00232670(); @@ -278,8 +270,8 @@ void FUN_L01_00228870(void) { FUN_L00_00208b60(); } extern unsigned char gold_weapon_purchased[] __asm__("D_0013E520"); -extern void FUN_L00_00250320(struct Moby *, int *, int *, int *); -extern void FUN_L00_002502f0(struct Moby *, int, int, int); +extern void get_moby_color(struct Moby *, int *, int *, int *) __asm__("FUN_L00_00250320"); +extern void set_moby_color(struct Moby *, int, int, int) __asm__("FUN_L00_002502f0"); extern void FUN_L00_002072c8(void); extern void FUN_L00_00207330(struct Moby *, struct Moby *); @@ -302,7 +294,7 @@ void FUN_L01_00228e38(void) blink = 1; } if (blink) { - FUN_L00_00250320(hero.moby, &r, &g, &b); + get_moby_color(hero.moby, &r, &g, &b); if (hero.state_timer % 4 < 3) { r = 0; g = 0; @@ -312,7 +304,7 @@ void FUN_L01_00228e38(void) g = 0x90; b = 0xF0; } - FUN_L00_002502f0(hero.moby, r, g, b); + set_moby_color(hero.moby, r, g, b); FUN_L00_002072c8(); } if (hero.items[0].item_id >= 0 && gold_weapon_purchased[hero.items[0].item_id] != 0 @@ -441,7 +433,7 @@ extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern void FUN_L00_00259508(void *, void *, void *, int, float); extern char *FUN_L00_002603d0(char *); -extern u8 *FUN_002141f8(s32); +extern u8 *suck_get_aim_height(s32) __asm__("FUN_002141f8"); extern s32 coll2_2d090(void *, s32, f32, s32, f32) __asm__("FUN_L00_001f19a0"); /* Probes for a reachable ledge ahead of the hero and records its edge. */ @@ -514,7 +506,7 @@ void FUN_L01_0022d090(void) if (coll_hit.moby != 0) { moby_allowed = 0; - moby_record = FUN_002141f8(coll_hit.moby); + moby_record = suck_get_aim_height(coll_hit.moby); moby_data = FUN_L00_002603d0((char *)coll_hit.moby); if (moby_record && (*(u16 *)(moby_record + 0x1E) & 1)) moby_allowed = 1; @@ -1015,13 +1007,13 @@ void FUN_L01_00232290(void) { /* Ported from rac1-decomp (src/overlays/shared/help_002274A8.c: func_L01_00232F90), where it is exact; names translated to the US level program. */ extern char D_L01_001742C0_d[] __asm__("D_L01_001742C0") __attribute__((section(".data"))); -extern float FUN_001f9b20(void *); -extern float FUN_001f9dc8(float); -extern float FUN_001f9de0(float); +extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); +extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern float FUN_L00_002339d0(float *v); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); extern int FUN_001efa68(void *, void *, int, int, int); -extern int FUN_001f0b58(void); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern void sceVu0Normalize(void *, void *) __asm__("FUN_00125180"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); @@ -1042,7 +1034,7 @@ void FUN_L01_00232978(int flag) { if (g->unk308 != 0) { return; } - if (FUN_L00_002339d0((float *)(&g->motion.velocity)) < frame_time * 0.1f) { + if (gravity_length_xy((float *)(&g->motion.velocity)) < frame_time * 0.1f) { return; } f2 = 0.37f; @@ -1056,17 +1048,17 @@ void FUN_L01_00232978(int flag) { s[2] += f2; qcopy(t, &g->motion.pos); t[2] += f2 * 0.3f; - if (flag != 0 || FUN_001f9b20(&g->motion.velocity) < 0.01f) { - p[0] = FUN_001f9dc8(g->motion.rot.f[2]) * f21; - p[1] = FUN_001f9de0(g->motion.rot.f[2]) * f21; + if (flag != 0 || vector_length_xy(&g->motion.velocity) < 0.01f) { + p[0] = fast_cos(g->motion.rot.f[2]) * f21; + p[1] = fast_sin(g->motion.rot.f[2]) * f21; p[2] = 0.0f; - q[0] = FUN_001f9dc8(g->motion.rot.f[2]) * f21 * 1.4f; - q[1] = FUN_001f9de0(g->motion.rot.f[2]) * f21 * 1.4f; + q[0] = fast_cos(g->motion.rot.f[2]) * f21 * 1.4f; + q[1] = fast_sin(g->motion.rot.f[2]) * f21 * 1.4f; q[2] = 0.0f; } else { qcopy(p, &g->motion.velocity); p[2] = 0.0f; - fast_vec_scale(p, p, f21 / FUN_001f9b20(p)); + fast_vec_scale(p, p, f21 / vector_length_xy(p)); qcopy(q, p); fast_vec_scale(q, q, 1.4f); } @@ -1076,7 +1068,7 @@ void FUN_L01_00232978(int flag) { h1 = &hero; if (FUN_001efa68(t, q, 4, (int)h1->moby, 0) != 0) { if (D_L01_001742DC > 0) { - k = FUN_001f0b58(); + k = collision_hit_material(); } } f20 = 0.0f; @@ -1084,7 +1076,7 @@ void FUN_L01_00232978(int flag) { if (FUN_001efa68(s, p, 4, (int)h2->moby, 0) != 0) { w = D_L01_001742C0_d; if (*(int *)(w + 0x1C) > 0) { - f20 = fast_arc_tan(*(float *)(w + 0x48), FUN_001f9b20(w + 0x40)); + f20 = fast_arc_tan(*(float *)(w + 0x48), vector_length_xy(w + 0x40)); } } if (f20 >= 0.87266463f || k == 8 || k == 12) { @@ -1118,7 +1110,7 @@ s32 coll_sound_class(void) __asm__("FUN_L00_001f3608"); s32 FUN_001f0b58_c(void) __asm__("FUN_001f0b58"); f32 resolve_camera_surface_height(void *, void *) __asm__("FUN_002135f0"); s32 FUN_L00_0025e3b8(s32); -u8 *FUN_002141f8(s32); +u8 *suck_get_aim_height(s32) __asm__("FUN_002141f8"); f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); void FUN_00125180_c(void *, void *) __asm__("FUN_00125180"); f32 FUN_L00_00233d30(void *); @@ -1206,7 +1198,7 @@ void FUN_L01_00232dc0(void) { if (FUN_L00_0025e3b8(HH.moby)) { hero.unk30A = 1; } - p = FUN_002141f8(HH.moby); + p = suck_get_aim_height(HH.moby); if (p != 0 && (*(u16 *)(p + 0x1E) & 8)) { hero.unk30A = 1; } diff --git a/src/overlays/shared/gameplay/hero/hero_check_damage.c b/src/overlays/shared/gameplay/hero/hero_check_damage.c index 82e1bf6445..66698f846c 100644 --- a/src/overlays/shared/gameplay/hero/hero_check_damage.c +++ b/src/overlays/shared/gameplay/hero/hero_check_damage.c @@ -145,7 +145,7 @@ struct LedgeSpot_20cd08 { extern struct LedgeSpot_20cd08 *D_L00_0015F70C; extern s32 D_L00_0015F710; extern f32 FUN_001f9b48(void *, void *); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern f32 FUN_001f99c0(f32); extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); @@ -183,7 +183,7 @@ int FUN_L00_0020cd08(Vec4 *from, s32 **outOwner, Vec4 *to, s32 *outI, f32 *outF, height_limit = 10.0f; distance_limit += 0.5f; } - distance = FUN_001f9b80(p, to); + distance = vector_distance(p, to); height = FUN_001f99c0(p->f[2] - to->f[2]); if (!(distance < distance_limit && height < height_limit)) continue; @@ -390,6 +390,7 @@ int FUN_L00_0020d540(void) { return (unsigned)(FUN_L00_0020d498_0020d540() - 0x1c) < 2; } /* True when hero.state.control_mode is 0x11/0x12 or state.current is 0x6A, 0x75, 0x76 or 0x82. */ +s32 FUN_L00_0020d568(void); s32 FUN_L00_0020d568(void) { struct Hero *p = &hero; u32 a = p->state.control_mode; @@ -501,7 +502,7 @@ extern float dist_20d6b0(void *, void *) __asm__("FUN_001f9b48"); extern float atan2_20d6b0(float, float) __asm__("FUN_001f9e90"); extern float adiff_20d6b0(float, float) __asm__("FUN_001fa688"); extern float hdist_20d6b0(void *, void *) __asm__("FUN_001f9b80"); -extern int f5e3b8_20d6b0(void *) __asm__("FUN_L00_0025e3b8"); +extern int FUN_L00_0025e3b8_c(void *) __asm__("FUN_L00_0025e3b8"); float FUN_L00_0020d6b0(char *o, float yaw, float range, float ylim, float plim, int *out) { float v[4] __attribute__((aligned(16))); @@ -539,7 +540,7 @@ float FUN_L00_0020d6b0(char *o, float yaw, float range, float ylim, float plim, if (0.0f < plim && plim < p) *out = 1; r = d + s * d; - if (f5e3b8_20d6b0(o)) + if (FUN_L00_0025e3b8_c(o)) r += 7.0f; return r; } @@ -945,6 +946,7 @@ extern void FUN_L00_0024f0e8(u8 *, u8 **); extern void FUN_L00_0024f3e0(u8 *, u8 *, s32, s32, s32, s32); extern void FUN_L00_002323b8_c(s32, s32, f32) __asm__("FUN_L00_002323b8"); +void FUN_L00_0020e4c8(void); void FUN_L00_0020e4c8(void) { s32 t, v19, v20, v21, i; u8 *o; @@ -996,6 +998,7 @@ void FUN_L00_0020e4c8(void) { extern int hero_idle_sequence(int) __asm__("FUN_L00_00205000"); extern void set_hero_animation(int, int, float) __asm__("FUN_L00_002323b8"); +void FUN_L00_0020e698(void); void FUN_L00_0020e698(void) { struct Hero *g = &hero; if (g->unk20A8 != 0) { @@ -1734,6 +1737,7 @@ void FUN_L00_0020fde0(int id) { } s32 FUN_L00_00233f38_0020fe30(void) __asm__("FUN_L00_00233f38"); /* True when 00233f38, D_L00_0015F5C4 and hero.vehicle_mode are 0, control_mode <3 or 4, and base_condition is 0. */ +s32 FUN_L00_0020fe30(void); s32 FUN_L00_0020fe30(void) { struct Hero *b; u32 s; @@ -1766,7 +1770,7 @@ extern int D_0015ED8C; extern int D_0015ED90; extern int D_0015ED94; extern ItemDef item_defs[] __asm__("D_L00_00179AC0"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_0020d568_c() __asm__("FUN_L00_0020d568"); extern int FUN_L00_00216de8(int, int); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); @@ -2034,7 +2038,7 @@ void hero_switch_item(int i) { s->items[0].timer = s->items[0].timer_reload; } } - if (FUN_001f9770(&hero.items[i].timer) == 0) { + if (fast_dec_timer_s16(&hero.items[i].timer) == 0) { changed = 0; } if (changed) { @@ -2274,7 +2278,7 @@ void FUN_L00_00210b30(void) { /* Ported from rac1-decomp (src/overlays/shared/help_0020CDF0.c: func_L00_00211338), where it is exact; names translated to the US level program. */ -extern void FUN_001f9c48(float *, float *, float); +extern void set_vector_length_xy(float *, float *, float) __asm__("FUN_001f9c48"); /* Scales x/y by s and sets or scales z, per component or through set_vector_length_xy. */ void hero_knockback(float *v, int each, float s, float z) __asm__("FUN_L00_00210c80"); @@ -2284,7 +2288,7 @@ void hero_knockback(float *v, int each, float s, float z) { v[1] *= s; v[2] *= z; } else { - FUN_001f9c48(v, v, s); + set_vector_length_xy(v, v, s); v[2] = z; } } @@ -2515,6 +2519,7 @@ typedef struct { s16 f; } K2; /* True when p is non-null and its field f is 0x47. */ +s32 FUN_L00_00211360(K2 *p); s32 FUN_L00_00211360(K2 *p) { if (p == 0) { return 0; @@ -2653,11 +2658,11 @@ void hero_update(void) /* Ported from rac1-decomp (src/overlays/shared/help_0020CDF0.c: func_L00_00211EE8), where it is exact; names translated to the US level program. */ -extern float FUN_001f9b20(void *); +extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); /* Length from vector_length_xy on hero.stick_x, capped at 1. */ float FUN_L00_00211830(void) { - float len = FUN_001f9b20(&hero.stick_x); + float len = vector_length_xy(&hero.stick_x); if (1.0f < len) { len = 1.0f; @@ -2804,8 +2809,8 @@ void FUN_L00_00211be8(void) { /* Ported from rac1-decomp (src/overlays/shared/help_0020CDF0.c: func_L00_002123B0), where it is exact; names translated to the US level program. */ extern char D_0013E533_lui[]; -extern void FUN_001fa050(void *, void *); -extern void FUN_001fa378(void *, void *, void *); +extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); +extern void multiply_matrix(void *, void *, void *) __asm__("FUN_001fa378"); extern void FUN_00214598(void *, void *); /* Multiplies the 001fa050 matrices of (x, y, z) and of hero.unk40, stored back by 00214598. */ @@ -2815,14 +2820,14 @@ void FUN_L00_00211cf8(float x, float y, float z) { in[0] = x; in[1] = y; in[2] = z; - FUN_001fa050(t, in); - FUN_001fa050(u, D_0013E533_lui + 0xEAD); - FUN_001fa378(u, u, t); + euler_rotation_matrix(t, in); + euler_rotation_matrix(u, D_0013E533_lui + 0xEAD); + multiply_matrix(u, u, t); FUN_00214598(u, D_0013E533_lui + 0xEAD); } typedef float V4_211d78[4] __attribute__((aligned(16))); -void FUN_001f9d20(void *, void *, void *); -float FUN_001f9e90(float, float); +void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); +float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); void FUN_L00_00211cf8(float, float, float); extern float FUN_L00_0025bc98(char *, char *, int, float, float, float, float); void FUN_L00_00211d78(int a, float x, float y, float z) { @@ -2830,8 +2835,8 @@ void FUN_L00_00211d78(int a, float x, float y, float z) { float out; float zero = 0.0f; float r; - FUN_001f9d20(t, &hero.motion.unk170, hero.unk40); - r = FUN_001f9e90(t[0], t[1]); + transform_vector(t, &hero.motion.unk170, hero.unk40); + r = fast_arc_tan(t[0], t[1]); out = zero; hero.motion.unk188 = FUN_L00_0025bc98((char *)&out, (char *)&hero.motion.unk184, a, r, x, y, z); FUN_L00_00211cf8(zero, zero, out); @@ -2846,7 +2851,8 @@ extern float FUN_L00_0025bc98(char *, char *, int, float, float, float, float); extern void FUN_L00_00211d78(int, float, float, float); /* Calls 00211d78 when hero.unk20B3 is set, else updates hero.motion.unk188 via 0025bc98. */ -void FUN_L00_00211e30(int a, float x, float y, float z) { +void turn_to(int a, float x, float y, float z) __asm__("FUN_L00_00211e30"); +void turn_to(int a, float x, float y, float z) { struct Hero *g = &hero; if (g->unk20B3 != 0) { FUN_L00_00211d78(a, x, y, z); @@ -2862,7 +2868,7 @@ void FUN_L00_00211e30(int a, float x, float y, float z) { /* Ported from rac1-decomp (src/overlays/shared/help_0020CDF0.c: func_L00_00212550), where it is exact; names translated to the US level program. */ extern int FUN_L00_0020d498_u(int) __asm__("FUN_L00_0020d498"); -extern void FUN_L00_00211e30(int, float, float, float); +extern void turn_to(int, float, float, float) __asm__("FUN_L00_00211e30"); void FUN_L00_00211e98(void) { float a, b, c; @@ -2875,7 +2881,7 @@ void FUN_L00_00211e98(void) { b = frame_scale_sq * 0.07f; c = frame_time * 6.981317043304443f; } - FUN_L00_00211e30(0, a, b, c); + turn_to(0, a, b, c); } extern float D_0015ED6C_211f38 __asm__("D_0015ED6C"); extern int FUN_L00_0020d498_211f38(int) __asm__("FUN_L00_0020d498"); @@ -3126,17 +3132,17 @@ extern V D_L00_00173E60_lui __asm__("D_L00_00173E60") __attribute__((section(".d extern f32 D_L00_00173E68 __attribute__((section(".data"))); void FUN_001f99f8_c(void *) __asm__("FUN_001f99f8"); -s32 FUN_001efa68(void *, void *, s32, void *, s32); +s32 collision_line(void *, void *, s32, void *, s32) __asm__("FUN_001efa68"); s32 coll_sound_class(void) __asm__("FUN_L00_001f3608"); -s32 FUN_001f0b58(void); +s32 collision_hit_material(void) __asm__("FUN_001f0b58"); f32 resolve_camera_surface_height(void *, void *) __asm__("FUN_002135f0"); s32 FUN_L00_0025e3b8(s32); -u8 *FUN_002141f8(s32); +u8 *suck_get_aim_height(s32) __asm__("FUN_002141f8"); f32 FUN_001f9b48(void *, void *); -void FUN_00125180(void *, void *); +void sceVu0Normalize(void *, void *) __asm__("FUN_00125180"); f32 FUN_L00_00233d30(void *); f32 FUN_001f9e90_c(f32, f32) __asm__("FUN_001f9e90"); -void FUN_001f9a28(void *, void *, void *); +void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); f32 FUN_001f9ab0_c(void *, void *) __asm__("FUN_001f9ab0"); void FUN_001f9a68_c(void *, void *, f32) __asm__("FUN_001f9a68"); void FUN_001f9bf8_c(void *, void *, f32) __asm__("FUN_001f9bf8"); @@ -3181,7 +3187,7 @@ void FUN_L00_002127b8(void) { g = hero.unk234 * 2.9f; } hero_get_collision_ray_endpoints((Vec4_002126b8 *)&v10, (Vec4_002126b8 *)&v0, k, g, -48.0f); - if (FUN_001efa68(&v10, &v0, 2, hero.moby, 0) == 0) { + if (collision_line(&v10, &v0, 2, hero.moby, 0) == 0) { goto tail; } r = coll_sound_class(); @@ -3189,13 +3195,13 @@ void FUN_L00_002127b8(void) { r = 3; } hero.unk12ED = r; - hero.ground_type = FUN_001f0b58(); + hero.ground_type = collision_hit_material(); if (hero.ground_type == 0) { hero.water_surface_z = resolve_camera_surface_height(((u8 *)&D_L00_00173E60_lui), &hero.unk280); if (hero.motion.pos.f[2] < hero.water_surface_z && hero.unk2F8 <= 0) { hero.unk2F8 = 1; } - if (FUN_001efa68(&v10, &v0, 0x24, hero.moby, 0) == 0) { + if (collision_line(&v10, &v0, 0x24, hero.moby, 0) == 0) { goto d1; } r = coll_sound_class(); @@ -3207,14 +3213,14 @@ void FUN_L00_002127b8(void) { if (hero.ground_type == 0xD) { hero.water_surface_z = D_L00_00173E68; v10.f[2] = D_L00_00173E68 - 0.01f; - if (FUN_001efa68(&v10, &v0, 4, hero.moby, 0) == 0) { + if (collision_line(&v10, &v0, 4, hero.moby, 0) == 0) { goto d1; } } if (hero.ground_type == 3) { hero.unk2F4 = D_L00_00173E68; v10.f[2] = D_L00_00173E68 - 0.01f; - if (FUN_001efa68(&v10, &v0, 4, hero.moby, 0) == 0) { + if (collision_line(&v10, &v0, 4, hero.moby, 0) == 0) { goto d1; } } @@ -3229,7 +3235,7 @@ void FUN_L00_002127b8(void) { if (FUN_L00_0025e3b8(HH.moby)) { hero.unk30A = 1; } - p = FUN_002141f8(HH.moby); + p = suck_get_aim_height(HH.moby); if (p != 0 && (*(u16 *)(p + 0x1E) & 8)) { hero.unk30A = 1; } @@ -3239,10 +3245,10 @@ void FUN_L00_002127b8(void) { hero.ground_z.f = HH.point.f[2]; hero.ground_distance = FUN_001f9b48(&hero.motion.pos, &hero.ground_point); hero.ground_moby = (struct Moby *)HH.moby; - FUN_00125180(&hero.unk270, (u8 *)&HH.normal_x); + sceVu0Normalize(&hero.unk270, (u8 *)&HH.normal_x); hero.ground_slope.f = FUN_L00_00233d30((u8 *)&HH.normal_x); hero.downhill_yaw = FUN_001f9e90_c(HH.normal_x, HH.normal_y); - FUN_001f9a28(&v20, &hero.ground_point, &hero.motion.pos); + fast_vec_sub(&v20, &hero.ground_point, &hero.motion.pos); if (0.0f < FUN_001f9ab0_c(&v20, &hero.unk270)) { hero.ground_distance = -hero.ground_distance; } @@ -3275,7 +3281,7 @@ void FUN_L00_002127b8(void) { FUN_001f9a68_c(&hero.gravity_dir, &hero.gravity_dir, -1.0f); break; case 2: - FUN_001f9a28(&hero.gravity_dir, &hero.motion.unkB0, &hero.motion.pos); + fast_vec_sub(&hero.gravity_dir, &hero.motion.unkB0, &hero.motion.pos); FUN_001f9bf8_c(&hero.gravity_dir, &hero.gravity_dir, 1.0f); break; } @@ -3308,13 +3314,13 @@ void FUN_L00_002127b8(void) { } FUN_L00_002335c8(&v30, 0.2f, a, 0.45f); FUN_L00_002335c8(&v40, 0.2f, a, -0.45f); - if (FUN_001efa68(&v30, &v0, 0x22, hero.moby, 0)) { + if (collision_line(&v30, &v0, 0x22, hero.moby, 0)) { f = HH.point.f[2] - hero.ground_z.f; hero.unk2C0.f[i] = f; if (0.4f < FUN_001f99c0(f)) { hero.unk2C0.f[i] = 0.0f; } - FUN_00125180(&v60, (u8 *)&HH.normal_x); + sceVu0Normalize(&v60, (u8 *)&HH.normal_x); FUN_L00_00216078(&v60, &v50); if (-0.78539819f < v50.f[1] && v50.f[1] < 0.78539819f) { hero.unk2C8.f[i] = v50.f[1]; @@ -3335,8 +3341,8 @@ void FUN_L00_002127b8(void) { extern f32 D_0015ED6C_c __asm__("D_0015ED6C"); extern f32 dot_vectors_xyz(void *, void *) __asm__("func_001F9AB0"); extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); -extern float FUN_001f9b80(void *, void *); -extern float FUN_L00_0025b8c0(float *p, float *v, float t, float u1, float u2, float eps); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern float vendor_spring(float *p, float *v, float t, float u1, float u2, float eps) __asm__("FUN_L00_0025b8c0"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); @@ -3372,7 +3378,7 @@ void FUN_L00_00212ff0(void) { float y = absolute_float(globals->motion.velocity.f[2]) + 0.01f; if (x < y) { if (globals->wall_hit != 0) { - float d = FUN_001f9b80(&globals->unk210, &globals->motion.pos); + float d = vector_distance(&globals->unk210, &globals->motion.pos); if (globals->unk234 * 0.5f < d) { globals->motion.pos.f[2] = globals->ground_z.f; return; @@ -3407,10 +3413,10 @@ void FUN_L00_00212ff0(void) { /* Ported from rac1-decomp (src/overlays/shared/help_0020CDF0.c: func_L00_00213970), where it is exact; names translated to the US level program. */ extern char D_0013E533_lui[]; -extern float FUN_001f9af0(void *); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); -extern void FUN_001f9a68(void *, void *, float); -extern void FUN_001f9bf8(void *, void *, float); +extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); +extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); void build_spherical_offset(f32 *out, f32 scale, f32 a, f32 b) __asm__("FUN_00214db0"); void FUN_L00_002132b8(float a, float b) { @@ -3418,28 +3424,28 @@ void FUN_L00_002132b8(float a, float b) { char *q = p - 0x920; float v; build_spherical_offset(p, *(float *)(q + 0x930), *(float *)(q + 0x938), *(float *)(q + 0x934)); - FUN_001f9a68(p, p, a); - v = FUN_001f9af0(p); + fast_vec_scale(p, p, a); + v = fast_vec_length(p); if (v <= b) { clear_u64_value(p); } else { - FUN_001f9bf8(p, p, v - b); + fast_vec_normalize(p, p, v - b); } } typedef unsigned int u128_213350 __attribute__((mode(TI), aligned(16))); typedef struct { float x, y, z, w; } __attribute__((aligned(16))) Vec4_213350; -float FUN_001f9dc8(float); -float FUN_001f9de0(float); +float fast_cos(float) __asm__("FUN_001f9dc8"); +float fast_sin(float) __asm__("FUN_001f9de0"); void FUN_001f9ab0(void *, Vec4_213350 *); /* dot_vectors_xyz of v with (cos, sin, 0) of the angle hero.motion.rot.z. */ void FUN_L00_00213350(u128_213350 *v) { u128_213350 a[2]; struct Hero *g = &hero; a[0] = *v; - ((Vec4_213350 *)&a[1])->x = FUN_001f9dc8(g->motion.rot.f[2]); - ((Vec4_213350 *)&a[1])->y = FUN_001f9de0(g->motion.rot.f[2]); + ((Vec4_213350 *)&a[1])->x = fast_cos(g->motion.rot.f[2]); + ((Vec4_213350 *)&a[1])->y = fast_sin(g->motion.rot.f[2]); ((Vec4_213350 *)&a[1])->z = 0.0f; FUN_001f9ab0(&a[0], (Vec4_213350 *)&a[1]); } @@ -3451,15 +3457,15 @@ typedef union { } V_2133a8; extern u128_2133a8 coll_2133a8[] __asm__("D_L00_00173E70") __attribute__((section(".data"))); extern void vzero_2133a8(void *) __asm__("FUN_001f99f8"); -extern void f2347c0_2133a8(void) __asm__("FUN_L00_002347c0"); -extern void f233810_2133a8(void *, void *, f32) __asm__("FUN_L00_00233810"); -extern void f2334d0_2133a8(void *, void *, f32) __asm__("FUN_L00_002334d0"); +extern void FUN_L00_002347c0(void); +extern void FUN_L00_00233810(void *, void *, f32); +extern void FUN_L00_002334d0(void *, void *, f32); extern void vadd_2133a8(void *, void *, void *) __asm__("FUN_001f9a10"); extern void vsub_2133a8(void *, void *, void *) __asm__("FUN_001f9a28"); extern f32 vlen_2133a8(void *) __asm__("FUN_001f9af0"); extern s32 coll_sphere(void *, s32, s32, f32) __asm__("FUN_L00_001f0d60"); extern s32 coll2_2133a8(void *, s32, f32, s32, f32) __asm__("FUN_L00_001f19a0"); -extern s32 coll3_2133a8(void *, f32) __asm__("FUN_L00_001f3170"); +extern s32 FUN_L00_001f3170(void *, f32); extern void vscl_2133a8(void *, void *, f32) __asm__("FUN_001f9bf8"); s32 FUN_L00_002133a8(s32 mode) { V_2133a8 old; @@ -3475,15 +3481,15 @@ s32 FUN_L00_002133a8(s32 mode) { qcopy(&old, &hero.motion.pos.q); vzero_2133a8(&v); if (hero.unk22DA != 0) { - f2347c0_2133a8(); + FUN_L00_002347c0(); hero.unk22DA = 0; } if (hero.state.control_mode != 0x11) { if (hero.unk20B3 != 0 || hero.unk1F8 != 0) { if (hero.unk20B3 == 1 || hero.unk1F8 != 0) { - f233810_2133a8(&v, &v, 0.6f); + FUN_L00_00233810(&v, &v, 0.6f); } else { - f2334d0_2133a8(&v, &v, -hero.unk224); + FUN_L00_002334d0(&v, &v, -hero.unk224); } } else { v.f[2] = hero.unk224; @@ -3511,7 +3517,7 @@ s32 FUN_L00_002133a8(s32 mode) { h = 0.05f; } a = coll2_2133a8(&hero.motion.pos.q, mask, hero.unk234, ((s32)hero.moby), h); - if (!(a | coll3_2133a8(&hero.motion.pos.q, hero.unk234))) + if (!(a | FUN_L00_001f3170(&hero.motion.pos.q, hero.unk234))) break; } c = coll_2133a8; @@ -3760,10 +3766,10 @@ void FUN_L00_00213de8(float s) { char *p = D_0013E533_lui + 0xF1D; float *f; - FUN_001f9a68(p, p, s); - FUN_001f9a68(p + 0x10, p + 0x10, s); - FUN_001f9a68(p - 0x20, p - 0x20, s); - FUN_001f9a68(p + 0x50, p + 0x50, s); + fast_vec_scale(p, p, s); + fast_vec_scale(p + 0x10, p + 0x10, s); + fast_vec_scale(p - 0x20, p - 0x20, s); + fast_vec_scale(p + 0x50, p + 0x50, s); f = (float *)(p - 0x100); f[0x194 / 4] = f[0x194 / 4] * s; } @@ -4012,3 +4018,48 @@ void hero_integrate_velocity(void) { } } +f32 D_L00_0017A964[1] __attribute__((section(".data"))) = {0}; +f32 D_L00_0017AA14[1] __attribute__((section(".data"))) = {0}; +f32 D_L00_0017ACA4[1] __attribute__((section(".data"))) = {0}; +f32 D_L01_0017ADE4[1] __attribute__((section(".data"))) = {0}; +f32 D_L01_0017AE94[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_0017AF64[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_0017B014[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_0017B2A4[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_0017AA64[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_0017AB14[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_0017ADA4[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_0017AAE4[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_0017AB94[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_0017AE24[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_0017ADC4[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_0017AE74[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_0017B0E4[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_0017B194[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_0017A9E4[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_0017AA94[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_0017AD24[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_0017B164[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_0017B214[1] __attribute__((section(".data"))) = {0}; +f32 D_L09_0017AAE4[1] __attribute__((section(".data"))) = {0}; +f32 D_L09_0017AB94[1] __attribute__((section(".data"))) = {0}; +f32 D_L09_0017AE24[1] __attribute__((section(".data"))) = {0}; +f32 D_L10_0017ADE4[1] __attribute__((section(".data"))) = {0}; +f32 D_L10_0017AE94[1] __attribute__((section(".data"))) = {0}; +f32 D_L11_0017B6A4[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_0017ADE4[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_0017AE94[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_0017AC64[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_0017AD14[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_0017AFA4[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0017B064[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0017B114[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0017B3A4[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0017AF64[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0017B014[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0017B2A4[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_0017ADC4[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_0017AE74[1] __attribute__((section(".data"))) = {0}; +f32 D_L17_0017B264[1] __attribute__((section(".data"))) = {0}; +f32 D_L17_0017B314[1] __attribute__((section(".data"))) = {0}; +f32 D_L18_0017B6A4[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/hero/hero_idle_sequence.c b/src/overlays/shared/gameplay/hero/hero_idle_sequence.c index d17d23dc93..5101c49395 100644 --- a/src/overlays/shared/gameplay/hero/hero_idle_sequence.c +++ b/src/overlays/shared/gameplay/hero/hero_idle_sequence.c @@ -13,15 +13,16 @@ /* Ported from rac1-decomp (src/overlays/shared/help_00203E98.c: func_L00_00204130), where it is exact; names translated to the US level program. */ extern char D_L00_00179410[]; -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void dismiss_help(void) __asm__("FUN_001fdc08"); /* Once (flag 0x38): starts a 0x3C-frame timer, dismisses help, sets the first word to 8 if 0. */ -void FUN_L00_00203b18(void) { +void jet_camera_mode(void) __asm__("FUN_L00_00203b18"); +void jet_camera_mode(void) { char *g = D_L00_00179410; if (*(short *)(g + 0x38) == 0) { *(short *)(g + 0x38) = 1; - *(int *)(g + 0x3C) = FUN_001f96f8(0x3C); + *(int *)(g + 0x3C) = scale_game_frames(0x3C); dismiss_help(); if (*(int *)g == 0) *(int *)g = 8; @@ -152,7 +153,7 @@ void attach_manipulator(s32, s32, void *) __asm__("FUN_0020cb10"); passes ints and floats in separate registers, so the call is the same; this order gives retail's register allocation. */ f32 turn_k(f32 *, f32, f32 *, f32, f32, f32, s32) __asm__("FUN_L00_0025bc98"); -void FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); +void vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); void FUN_L00_00259f50(void *, void *); /* Eases one record's rotation and position toward their targets and rebuilds its matrix; @@ -189,9 +190,9 @@ void FUN_L00_00205168(struct HeroEase *e) { turn_k(&rot->f[0], e->rot_target.f[0], &e->rot_vel.f[0], e->accel * frame_scale_sq, e->max_speed * frame_scale_sq, 0.0f, 2); turn_k(&rot->f[1], e->rot_target.f[1], &e->rot_vel.f[1], e->accel * frame_scale_sq, e->max_speed * frame_scale_sq, 0.0f, 2); turn_k(&rot->f[2], e->rot_target.f[2], &e->rot_vel.f[2], e->accel * frame_scale_sq, e->max_speed * frame_scale_sq, 0.0f, 2); - FUN_L00_0025b8c0(&pos->f[0], &e->pos_vel.f[0], e->pos_target.f[0], e->accel, e->max_speed, 0.0f); - FUN_L00_0025b8c0(&pos->f[1], &e->pos_vel.f[1], e->pos_target.f[1], e->accel, e->max_speed, 0.0f); - FUN_L00_0025b8c0(&pos->f[2], &e->pos_vel.f[2], e->pos_target.f[2], e->accel, e->max_speed, 0.0f); + vendor_spring(&pos->f[0], &e->pos_vel.f[0], e->pos_target.f[0], e->accel, e->max_speed, 0.0f); + vendor_spring(&pos->f[1], &e->pos_vel.f[1], e->pos_target.f[1], e->accel, e->max_speed, 0.0f); + vendor_spring(&pos->f[2], &e->pos_vel.f[2], e->pos_target.f[2], e->accel, e->max_speed, 0.0f); if (!e->attached) attach_manipulator(moby, e->unkA0, e); FUN_L00_00259f50(&e->quat, rot); @@ -255,18 +256,18 @@ void FUN_L00_00205538(void) { /* Ported from rac1-decomp (src/overlays/shared/help_00203E98.c: func_L00_00205C18), where it is exact; names translated to the US level program. */ extern int D_L00_0015F5CC; -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); s32 random_integer_below(s32 arg0) __asm__("FUN_00213260"); void FUN_L00_00205600(void) { struct Hero *g = &hero; if (g->rand_timer.fired == 0) { if (g->rand_timer.range == 0) { - g->rand_timer.deadline = D_L00_0015F5CC + FUN_001f96f8(30); + g->rand_timer.deadline = D_L00_0015F5CC + scale_game_frames(30); } else if (D_L00_0015F5CC > g->rand_timer.deadline) { int a, b; g->rand_timer.fired = 1; - a = FUN_001f96f8(20); + a = scale_game_frames(20); b = random_integer_below(g->rand_timer.range); g->rand_timer.deadline = D_L00_0015F5CC + a + b + random_integer_below(g->rand_timer.range); @@ -351,15 +352,15 @@ extern u8 D_L00_0017C1E0_2059d8[] __asm__("D_L00_0017C1E0"); extern u8 D_L00_0017C220_2059d8[] __asm__("D_L00_0017C220"); extern u8 D_L00_0017C260_2059d8[] __asm__("D_L00_0017C260"); extern f32 D_L00_0017C2A0_2059d8[] __asm__("D_L00_0017C2A0"); -extern void set_help_color_2059d8(f32, f32, void *) __asm__("FUN_L00_0025b868"); -extern s32 scale_game_frames_2059d8(s32) __asm__("FUN_L00_001fef20"); -extern f32 convert_integer_to_float_2059d8(s32) __asm__("FUN_L00_00200240"); -extern s32 truncate_float_to_s32_2059d8(f32) __asm__("FUN_L00_00200250"); -extern f32 fast_sin_2059d8(f32) __asm__("FUN_L00_001ff800"); -extern s32 help_active_2059d8(void *) __asm__("FUN_L00_001fef98"); +extern void FUN_L00_0025b868(f32, f32, void *); +extern s32 FUN_L00_001fef20(s32); +extern f32 FUN_L00_00200240(s32); +extern s32 FUN_L00_00200250(f32); +extern f32 FUN_L00_001ff800(f32); +extern s32 FUN_L00_001fef98(void *); extern s32 random_int_between_2059d8(s32, s32) __asm__("FUN_L00_00257b90"); -extern void attach_manipulator_2059d8(s32, s32, void *) __asm__("FUN_L00_0024f590"); -extern void detach_manipulator_2059d8(s32, void *) __asm__("FUN_L00_0024f608"); +extern void FUN_L00_0024f590(s32, s32, void *); +extern void FUN_L00_0024f608(s32, void *); extern void transform_help_quad_2059d8(f32, void *, void *) __asm__("FUN_L00_001ff300"); void FUN_L00_002059d8(void) { @@ -368,9 +369,9 @@ void FUN_L00_002059d8(void) { s32 i; if (D_0015EDB3 != 0) - set_help_color_2059d8(1.8f, 0.05f, &D_0015EE18); + FUN_L00_0025b868(1.8f, 0.05f, &D_0015EE18); else - set_help_color_2059d8(1.0f, 0.05f, &D_0015EE18); + FUN_L00_0025b868(1.0f, 0.05f, &D_0015EE18); if ((u8)(D_0013F350_2059d8[0x20A4] - 1) < 2) moby = *(u8 **)(D_0013F350_2059d8 + 0x2080); @@ -389,46 +390,46 @@ void FUN_L00_002059d8(void) { a = 0x38; if (*(s32 *)(g + 0x22A8) == 1) a = 0x88; - k = scale_game_frames_2059d8(0x6E); - f = convert_integer_to_float_2059d8(k); - c = fast_sin_2059d8(((f32)(D_0015F5CC_2059d8 % k) / f * 2.0f) * 3.1415927f + -3.1415927f); + k = FUN_L00_001fef20(0x6E); + f = FUN_L00_00200240(k); + c = FUN_L00_001ff800(((f32)(D_0015F5CC_2059d8 % k) / f * 2.0f) * 3.1415927f + -3.1415927f); t = c * 24.0f; - r = truncate_float_to_s32_2059d8(t); - b = truncate_float_to_s32_2059d8(c * 48.0f); + r = FUN_L00_00200250(t); + b = FUN_L00_00200250(c * 48.0f); low = a + r + 0xC; high = b + 0xA0; b += 0x18; - a = truncate_float_to_s32_2059d8(t); + a = FUN_L00_00200250(t); i = a + 0x4C; if (*(s16 *)(g + 0x1EE) != 0) { s32 five, twenty, forty_five; f = 1.0f; - five = scale_game_frames_2059d8(5); - twenty = scale_game_frames_2059d8(20); - forty_five = scale_game_frames_2059d8(45); + five = FUN_L00_001fef20(5); + twenty = FUN_L00_001fef20(20); + forty_five = FUN_L00_001fef20(45); if (forty_five - five < *(s16 *)(g + 0x1EE)) { - forty_five = scale_game_frames_2059d8(45); - f = convert_integer_to_float_2059d8(forty_five - *(s16 *)(g + 0x1EE)) / - convert_integer_to_float_2059d8(five); + forty_five = FUN_L00_001fef20(45); + f = FUN_L00_00200240(forty_five - *(s16 *)(g + 0x1EE)) / + FUN_L00_00200240(five); } if (*(s16 *)(g + 0x1EE) < twenty) { - f = convert_integer_to_float_2059d8(*(s16 *)(g + 0x1EE)) / - convert_integer_to_float_2059d8(twenty); + f = FUN_L00_00200240(*(s16 *)(g + 0x1EE)) / + FUN_L00_00200240(twenty); } - low -= truncate_float_to_s32_2059d8((f32)(r + 0xC) * f); - high -= truncate_float_to_s32_2059d8((f32)b * f); - i -= truncate_float_to_s32_2059d8((f32)(a + 0xC) * f); - low += truncate_float_to_s32_2059d8(f * 112.0f); - high -= truncate_float_to_s32_2059d8(f * 72.0f); + low -= FUN_L00_00200250((f32)(r + 0xC) * f); + high -= FUN_L00_00200250((f32)b * f); + i -= FUN_L00_00200250((f32)(a + 0xC) * f); + low += FUN_L00_00200250(f * 112.0f); + high -= FUN_L00_00200250(f * 72.0f); } *(u32 *)(moby + 0x90) = ((0x80U << 24) | (i << 16)) | ((high << 8) | low); } if (g[0x20A4] != 0) return; - if (help_active_2059d8(g + 0xFFC) && moby[0x53] == 1) { + if (FUN_L00_001fef98(g + 0xFFC) && moby[0x53] == 1) { s32 low, high, a; - low = scale_game_frames_2059d8(50); - high = scale_game_frames_2059d8(200); + low = FUN_L00_001fef20(50); + high = FUN_L00_001fef20(200); a = random_int_between_2059d8(low, high); *(s16 *)(g + 0xFFE) = 1; *(s16 *)(g + 0xFFC) = a; @@ -442,7 +443,7 @@ void FUN_L00_002059d8(void) { u8 *active = g + 0xEF1; for (i = 3; i >= 0; slot += 0x40, i--, active += 0x40) if (*active) - detach_manipulator_2059d8((s32)moby, slot); + FUN_L00_0024f608((s32)moby, slot); } else { u32 i; u8 *slot = g + 0xEF0; @@ -458,7 +459,7 @@ void FUN_L00_002059d8(void) { src_a++, src_b++, dst_a += 0x40, kind++, slot += 0x40, active += 0x40, dst_b += 0x40) { if (*active == 0) { - attach_manipulator_2059d8((s32)moby, *kind, slot); + FUN_L00_0024f590((s32)moby, *kind, slot); active[2] = 1; qcopy(dst_a, src_a); qcopy(dst_b, src_b); @@ -589,7 +590,7 @@ typedef float M4_2061f0[16] __attribute__((aligned(16))); void build_moby_bone_transform(void *, int, void *) __asm__("FUN_0020cca8"); void copy_matrix3x4(void *, void *) __asm__("FUN_001fa2b8"); void matrix_to_euler(void *, void *) __asm__("FUN_00214598"); -int FUN_001f96f8(int); +int scale_game_frames(int) __asm__("FUN_001f96f8"); void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); void advance_moby_animation(void *) __asm__("FUN_0020d580"); void FUN_L00_00250df8(void *); @@ -606,7 +607,7 @@ void FUN_L00_002061f0(void) { copy_matrix3x4(o + 0xC0, m); matrix_to_euler(m, o + 0x40); *(unsigned short *)(o + 0x34) &= 0xFFBE; - blend_moby_animation(o, 0x81, 0, FUN_001f96f8(10)); + blend_moby_animation(o, 0x81, 0, scale_game_frames(10)); advance_moby_animation(o); FUN_L00_00250df8(o); } else { @@ -649,16 +650,16 @@ extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9 extern void multiply_matrix(void *, void *, void *) __asm__("FUN_001fa378"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void blend_moby_animation_2062b0(void *, s32, s32, s32) __asm__("FUN_L00_00257880"); -extern int allocate_voice_for_target_entry_2062b0(void *, s32, void *) __asm__("FUN_L00_0028dbe8"); +extern int FUN_L00_0028dbe8(void *, s32, void *); extern void FUN_L00_00216de8(s32, s32); -extern s32 fast_tween_color_2062b0(f32, s32, s32) __asm__("FUN_L00_00200298"); -extern f32 fast_sin_2059d8(f32) __asm__("FUN_L00_001ff800"); -extern f32 fast_add_rotations_2062b0(f32, f32) __asm__("FUN_L00_002000e8"); -extern s32 truncate_float_to_s32_2059d8(f32) __asm__("FUN_L00_00200250"); -extern f32 convert_integer_to_float_2059d8(s32) __asm__("FUN_L00_00200240"); -extern s32 scale_game_frames_2059d8(s32) __asm__("FUN_L00_001fef20"); -extern s32 help_active_2059d8(void *) __asm__("FUN_L00_001fef98"); -extern void set_help_color_2059d8(f32, f32, void *) __asm__("FUN_L00_0025b868"); +extern s32 FUN_L00_00200298(f32, s32, s32); +extern f32 FUN_L00_001ff800(f32); +extern f32 FUN_L00_002000e8(f32, f32); +extern s32 FUN_L00_00200250(f32); +extern f32 FUN_L00_00200240(s32); +extern s32 FUN_L00_001fef20(s32); +extern s32 FUN_L00_001fef98(void *); +extern void FUN_L00_0025b868(f32, f32, void *); void FUN_L00_002062b0(void) { char *g; @@ -732,7 +733,7 @@ void FUN_L00_002062b0(void) { scale = 1.7f; if (D_0015EDB3_macro) scale = 3.1f; if (*(s16 *)(g + 0x22fc)) scale *= 1.4f; - set_help_color_2059d8(*(f32 *)(*(char **)(*(char **)(g + 0x1624) + 0x24) + 0x24) * scale, 0.02f, *(char **)(g + 0x1624) + 0x2c); + FUN_L00_0025b868(*(f32 *)(*(char **)(*(char **)(g + 0x1624) + 0x24) + 0x24) * scale, 0.02f, *(char **)(g + 0x1624) + 0x2c); } } } @@ -742,11 +743,11 @@ void FUN_L00_002062b0(void) { color2 = 0x1e00004b; { char *g = (char *)&hero; - *(f32 *)(g + 0x1628) = fast_add_rotations_2062b0(*(f32 *)(g + 0x1628), frame_time_macro * 2.9670596f); + *(f32 *)(g + 0x1628) = FUN_L00_002000e8(*(f32 *)(g + 0x1628), frame_time_macro * 2.9670596f); } - if (help_active_2059d8(g + 0x22fc) == 0) { + if (FUN_L00_001fef98(g + 0x22fc) == 0) { char *g = (char *)&hero; - *(f32 *)(g + 0x1628) = fast_add_rotations_2062b0(*(f32 *)(g + 0x1628), frame_time_macro * 12.217304f); + *(f32 *)(g + 0x1628) = FUN_L00_002000e8(*(f32 *)(g + 0x1628), frame_time_macro * 12.217304f); switch (*(s16 *)(g + 0x22fe)) { case 1: color = 0x2814c814; color2 = 0x1e004b00; break; case 2: color = 0x2814c8c8; color2 = 0x1e004b4b; break; @@ -757,10 +758,10 @@ void FUN_L00_002062b0(void) { { char *g = (char *)&hero; s32 tint; - wave = fast_sin_2059d8(*(f32 *)(g + 0x1628)); - tint = fast_tween_color_2062b0(wave * 0.5f + 0.5f, color, color2); - if (*(char **)(g + 0x1624)) *(u32 *)(*(char **)(g + 0x1624) + 0x90) = fast_tween_color_2062b0(D_0015ED60_gp * 0.1f, *(u32 *)(*(char **)(g + 0x1624) + 0x90), tint); - *(u32 *)(g + 0x2300) = fast_tween_color_2062b0(frame_scale_macro * 0.1f, *(u32 *)(g + 0x2300), tint); + wave = FUN_L00_001ff800(*(f32 *)(g + 0x1628)); + tint = FUN_L00_00200298(wave * 0.5f + 0.5f, color, color2); + if (*(char **)(g + 0x1624)) *(u32 *)(*(char **)(g + 0x1624) + 0x90) = FUN_L00_00200298(D_0015ED60_gp * 0.1f, *(u32 *)(*(char **)(g + 0x1624) + 0x90), tint); + *(u32 *)(g + 0x2300) = FUN_L00_00200298(frame_scale_macro * 0.1f, *(u32 *)(g + 0x2300), tint); if (*(char **)(g + 0x1620) == 0) { *(char **)(g + 0x1620) = create_moby(0x47a); if (*(char **)(g + 0x1620)) { @@ -790,9 +791,9 @@ void FUN_L00_002062b0(void) { *(u64 *)(*(char **)(g + 0x1620) + 0x38) = *(u64 *)(*(char **)(g + 0x2080) + 0x38); if (*(s32 *)(g + 0x2084) == 0x4f) { if (*(u8 *)(*(char **)(g + 0x1620) + 0x53) != 1) - blend_moby_animation_2062b0(*(char **)(g + 0x1620), 1, 0, scale_game_frames_2059d8(10)); + blend_moby_animation_2062b0(*(char **)(g + 0x1620), 1, 0, FUN_L00_001fef20(10)); } else if (*(u8 *)(*(char **)(g + 0x1620) + 0x53) != 0) { - blend_moby_animation_2062b0(*(char **)(g + 0x1620), 0, 0, scale_game_frames_2059d8(0x11)); + blend_moby_animation_2062b0(*(char **)(g + 0x1620), 0, 0, FUN_L00_001fef20(0x11)); } } } @@ -800,9 +801,9 @@ void FUN_L00_002062b0(void) { { char *g = (char *)&hero; if (*(char **)(g + 0x22c0)) { - allocate_voice_for_target_entry_2062b0(*(char **)(g + 0x22c0) + 0x10, 0, *(char **)(g + 0x2080)); + FUN_L00_0028dbe8(*(char **)(g + 0x22c0) + 0x10, 0, *(char **)(g + 0x2080)); *(s16 *)(g + 0x22fe) = *(u16 *)(g + 0x22c0); - *(s16 *)(g + 0x22fc) = scale_game_frames_2059d8(0x39); + *(s16 *)(g + 0x22fc) = FUN_L00_001fef20(0x39); } *(u32 *)(g + 0x22c0) = 0; } @@ -828,15 +829,15 @@ void FUN_L00_002062b0(void) { { char *g = (char *)&hero; alpha = 0x80; - span = scale_game_frames_2059d8(0xaa); - if (*(s16 *)(g + 0x22e0) == 2) span = scale_game_frames_2059d8(0x32); - else if (*(s16 *)(g + 0x22e0) == 1) span = scale_game_frames_2059d8(0x5a); - phase = convert_integer_to_float_2059d8(span); - wave = fast_sin_2059d8((((f32)(D_L00_0015F5CC % span) / phase) * 2.0f) * 3.1415927f + -3.1415927f); - } - red = truncate_float_to_s32_2059d8(wave * 20.0f) + 0x32; - green = truncate_float_to_s32_2059d8(wave * 70.0f) + 0xb4; - blue = truncate_float_to_s32_2059d8(wave * 10.0f) + 0x14; + span = FUN_L00_001fef20(0xaa); + if (*(s16 *)(g + 0x22e0) == 2) span = FUN_L00_001fef20(0x32); + else if (*(s16 *)(g + 0x22e0) == 1) span = FUN_L00_001fef20(0x5a); + phase = FUN_L00_00200240(span); + wave = FUN_L00_001ff800((((f32)(D_L00_0015F5CC % span) / phase) * 2.0f) * 3.1415927f + -3.1415927f); + } + red = FUN_L00_00200250(wave * 20.0f) + 0x32; + green = FUN_L00_00200250(wave * 70.0f) + 0xb4; + blue = FUN_L00_00200250(wave * 10.0f) + 0x14; { char *g = (char *)&hero; { @@ -855,7 +856,7 @@ void FUN_L00_002062b0(void) { char *g; { char *g = (char *)&hero; - *(u32 *)(*(char **)(g + 0x2080) + 0x90) = fast_tween_color_2062b0(0.1f, *(u32 *)(*(char **)(g + 0x2080) + 0x90), color); + *(u32 *)(*(char **)(g + 0x2080) + 0x90) = FUN_L00_00200298(0.1f, *(u32 *)(*(char **)(g + 0x2080) + 0x90), color); } g = (char *)&hero; for (i = 0; i < 3; i++) @@ -868,7 +869,7 @@ void FUN_L00_002062b0(void) { red = *(u8 *)(moby + 0x90); alpha = 0x30; if (*(s16 *)(g + 0x22de)) - alpha = truncate_float_to_s32_2059d8(convert_integer_to_float_2059d8(*(s16 *)(g + 0x22de)) / convert_integer_to_float_2059d8(0x12) * (f32)alpha); + alpha = FUN_L00_00200250(FUN_L00_00200240(*(s16 *)(g + 0x22de)) / FUN_L00_00200240(0x12) * (f32)alpha); *(u32 *)(g + 0x22e4) = (alpha << 24) | ((u32)blue << 16) | ((u32)green << 8) | (u32)red; FUN_L00_00207d00(); *(s16 *)(g + 0x22e0) = 0; @@ -1078,7 +1079,7 @@ void FUN_L00_00206e00(void) { if (*(int *)(r + 0x21D4) >= 16) *(int *)(r + 0x21D4) = 0; } } -int FUN_001f96f8(int); +int scale_game_frames(int) __asm__("FUN_001f96f8"); void fade_to_black(int) __asm__("FUN_001f4a58"); void FUN_L00_002062b0(void); void FUN_L00_00232670(void); @@ -1117,7 +1118,7 @@ void FUN_L00_002070d0(void) { struct Hero *g = &hero; if (g->motion.pos.f[0] < 2.0f || g->motion.pos.f[1] < 2.0f || 1022.0f < g->motion.pos.f[0] || 1022.0f < g->motion.pos.f[1]) { - fade_to_black(FUN_001f96f8(0x10)); + fade_to_black(scale_game_frames(0x10)); { struct Hero *g2 = &hero; g2->unk20B1 = 1; @@ -1231,7 +1232,7 @@ extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); extern int f2i_207430(float) __asm__("FUN_001fa6d0"); extern void f4f7c8_207430(void *, int, void *) __asm__("FUN_L00_0024f7c8"); extern float fabs_207430(float) __asm__("FUN_001f99c0"); -extern void f8038_207430(void *, int, float, float) __asm__("FUN_L00_00208038"); +extern void FUN_L00_00208038_c(void *, int, float, float) __asm__("FUN_L00_00208038"); extern void fcb10_207430(void *, int, void *) __asm__("FUN_0020cb10"); extern float D_0015EE18_gp __attribute__((sda)); @@ -1261,12 +1262,12 @@ void FUN_L00_00207430(char *o) { f4f7c8_207430(o, 6, &v); v.f[2] -= 0.07f; if (2.0f < fabs_207430(*(float *)(o + 0x18) - v.f[2])) { - f8038_207430(&v, 0x200000C0, 0.25f, 0.15f); + FUN_L00_00208038_c(&v, 0x200000C0, 0.25f, 0.15f); } } else { f4f7c8_207430(o, 1, &v); v.f[2] -= 0.00700000022f; - f8038_207430(&v, 0x200000C0, 0.0469999984f, 0.15f); + FUN_L00_00208038_c(&v, 0x200000C0, 0.0469999984f, 0.15f); } t = D_17C380_207430; if (*(short *)(o + 0xA6) == 0x1A3) { @@ -1316,10 +1317,10 @@ void FUN_L00_002076a8(void) { blink = 0; if (hero.state.current == 0x80 || hero.state.current == 0x82) { - blink = hero.state_timer < FUN_001f96f8(0x1e); + blink = hero.state_timer < scale_game_frames(0x1e); } if ((current_level_index == 0xf || current_level_index == 0x11) && - hero.state.current == 0x76 && hero.state_timer < FUN_001f96f8(0x14)) { + hero.state.current == 0x76 && hero.state_timer < scale_game_frames(0x14)) { blink = 1; } if (blink) { @@ -1367,6 +1368,7 @@ void rotation_matrix(void *, void *) __asm__("FUN_001fa050"); void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern char D_L00_0017A6C0[] __attribute__((section(".data"))); +void FUN_L00_002078a8(void); void FUN_L00_002078a8(void) { struct Hero *P = &hero; Vec4_2078a8 v; @@ -1398,6 +1400,7 @@ void FUN_L00_002078a8(void) { extern void FUN_L00_00262b80(int, char *, char *, float, float, float); +void FUN_L00_002079e8(void); void FUN_L00_002079e8(void) { struct Hero *g = &hero; if (g->state.current == 0x7F) { @@ -1763,15 +1766,15 @@ void FUN_L00_002080b0(void) { } } extern unsigned char D_0015EDB5_208820 __asm__("D_0015EDB5"); -extern void f32fe8_208820(void) __asm__("FUN_L00_00232fe8"); -extern void f330d0_208820(void) __asm__("FUN_L00_002330d0"); -extern void f78a8_208820(void) __asm__("FUN_L00_002078a8"); -extern void f79e8_208820(void) __asm__("FUN_L00_002079e8"); +extern void FUN_L00_00232fe8(void); +extern void FUN_L00_002330d0(void); +extern void FUN_L00_002078a8(void); +extern void FUN_L00_002079e8(void); extern void ff090_208820(void *, void *, int) __asm__("FUN_001f9838"); extern void upd_a(void *) __asm__("FUN_L00_00250df8"); -extern void f336e8_208820(void *, void *, float) __asm__("FUN_L00_002336e8"); -extern void f4eed8_208820(void *, int, void *, float, float) __asm__("FUN_L00_0024eed8"); -extern int fd568_208820(void) __asm__("FUN_L00_0020d568"); +extern void FUN_L00_002336e8(void *, void *, float); +extern void FUN_L00_0024eed8(void *, int, void *, float, float); +extern int FUN_L00_0020d568(void); void FUN_L00_00208820(void) { OvlQuad v[1]; @@ -1780,35 +1783,35 @@ void FUN_L00_00208820(void) { ((unsigned char *)hero.moby)[0xA4] = 0xFF; if (hero.unk20A5) { - f32fe8_208820(); + FUN_L00_00232fe8(); } else { - f330d0_208820(); + FUN_L00_002330d0(); } qcopy(((unsigned char *)hero.moby) + 0x10, &hero.motion.pos); - f78a8_208820(); + FUN_L00_002078a8(); qcopy(((unsigned char *)hero.moby) + 0x40, &hero.motion.rot); - f79e8_208820(); + FUN_L00_002079e8(); ff090_208820(((unsigned char *)hero.moby) + 0xC0, &hero, 0x30); upd_a(((unsigned char *)hero.moby)); if (hero.unk1CC == 0 && *(int *)(((unsigned char *)hero.moby) + 0x94) != 0) { qcopy(v, &hero.motion.pos); m = 0.05f; - f336e8_208820(v, v, hero.unk224); + FUN_L00_002336e8(v, v, hero.unk224); d = hero.capsule_top - hero.unk224; if (d < m) d = m; - f4eed8_208820(((unsigned char *)hero.moby), 0, v, hero.unk234, d); + FUN_L00_0024eed8(((unsigned char *)hero.moby), 0, v, hero.unk234, d); f = hero.unk234 + m; if (hero.state.control_mode == 4) f += 0.15f; - if (fd568_208820()) + if (FUN_L00_0020d568()) f = hero.unk224; qcopy(v, &hero.motion.pos); - f336e8_208820(v, v, f); + FUN_L00_002336e8(v, v, f); d = hero.capsule_top - f; if (d < m) d = m; - f4eed8_208820(((unsigned char *)hero.moby), 1, v, hero.unk234, d); + FUN_L00_0024eed8(((unsigned char *)hero.moby), 1, v, hero.unk234, d); } o = ((unsigned char *)hero.moby); if (*(short *)(o + 0xA6) == 0) { @@ -2048,10 +2051,11 @@ f32 FUN_L00_00208f20(f32 a, f32 b, f32 c, f32 d) { /* Ported from rac1-decomp (src/overlays/shared/help_00203E98.c: func_L00_00209690), where it is exact; names translated to the US level program. */ -extern float FUN_L00_00200228(void *, float); +extern float split_float_fraction(void *, float) __asm__("FUN_L00_00200228"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); #include "rnc/data_labels.h" +float FUN_L00_00209018(float *a, int n); float FUN_L00_00209018(float *a, int n) { char buf[16] __attribute__((aligned(16))); char *d = (char *)((unsigned char *)&D_0013E533) + 0xE1D; @@ -2062,7 +2066,7 @@ float FUN_L00_00209018(float *a, int n) { if (*(int *)(d + 0xA98) & 2) { p = m; } - w = FUN_L00_00200228(buf, *(float *)(d + 0xAA8)); + w = split_float_fraction(buf, *(float *)(d + 0xAA8)); return w * a[i] + (*(float *)(d + 0xAAC) - w) * a[p]; } typedef unsigned int u128_002090d0 __attribute__((mode(TI), aligned(16))); @@ -2279,6 +2283,7 @@ extern int FUN_00213260_209638(int) __asm__("FUN_00213260"); extern void FUN_L00_002718d0_209638(void *, void *, void *, float, float) __asm__("FUN_L00_002718d0"); +void FUN_L00_00209638(int seed, int limit); void FUN_L00_00209638(int seed, int limit) { float v[4]; float pos[4]; @@ -2463,8 +2468,8 @@ int FUN_001fa6d0_209ec8(float) __asm__("FUN_001fa6d0"); float FUN_002132a8_209ec8(float, float) __asm__("FUN_002132a8"); float FUN_00213308_209ec8(void) __asm__("FUN_00213308"); void build_spherical_offset(void *, float, float, float) __asm__("FUN_00214db0"); -void spark_v(void *, void *, int, int, int, int, int, - int) __asm__("FUN_L00_00269958"); +void FUN_L00_00269958(void *, void *, int, int, int, int, int, + int); extern char D_0013F7EE[] __attribute__((section(".data"))); void FUN_L00_00209ec8(void) { OvlQuad v[1]; @@ -2509,7 +2514,7 @@ void FUN_L00_00209ec8(void) { theta = FUN_00213308_209ec8(); phi = FUN_00213308_209ec8(); build_spherical_offset(pt, r, theta, phi); - spark_v(v, pt, col, 0x70F0, life, n1, n2, 1); + FUN_L00_00269958(v, pt, col, 0x70F0, life, n1, n2, 1); } t = random_int_between(FUN_001f96f8_209ec8(3), FUN_001f96f8_209ec8(7)); { @@ -2818,7 +2823,7 @@ extern float FUN_001f9e90_c(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern int D_L00_0015F6B0 __asm__("D_L00_0015F5CC"); extern int FUN_001efa68_ac98(void *, void *, int, int, int) __asm__("FUN_001efa68"); -extern int FUN_002141f8(char *); +extern int suck_get_aim_height(char *) __asm__("FUN_002141f8"); extern unsigned char hero_pos[] __asm__("D_0013F3D0") NOT_SDA; extern void FUN_L00_00233660(float *, float, float, float); float absolute_float(float input) __asm__("FUN_001f99c0"); @@ -2850,7 +2855,7 @@ void FUN_L00_0020ac98(void) { bestPri = 0.0f; best = 0; for (i = 0; (m = D_L00_001ABD80[i]) != 0; i++) { - info = (char *)FUN_002141f8(m); + info = (char *)suck_get_aim_height(m); if (info != 0) { float d, a, sc, pri; d = vector_distance(hero_pos + 0x0, m + 0x10); @@ -2901,7 +2906,7 @@ void FUN_L00_0020ac98(void) { if (t == 0) return; qcopy(v, t + 0x10); - info2 = (char *)FUN_002141f8(t); + info2 = (char *)suck_get_aim_height(t); if (info2 != 0) v[2] += (float)*(unsigned char *)(info2 + 0x3A) * 0.125f; FUN_L00_00233660(&v[4], 0.3f, 0.0f, 0.85f); @@ -3362,8 +3367,8 @@ extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); extern float D_0015ED6C; extern float fast_difference_between_rotations_c(float, float) __asm__("func_001FA688"); extern int FUN_001efa68_c(void *, void *, int, int, int) __asm__("FUN_001efa68"); -extern int FUN_001f0b58(void); -extern int FUN_L00_001f19a0(); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); +extern int rig_probe() __asm__("FUN_L00_001f19a0"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern unsigned char D_0013F350[]; f32 FUN_001f9e90_c2(f32, f32) __asm__("FUN_001f9e90"); @@ -3523,3 +3528,60 @@ void FUN_L00_0020bed0(void) { } } } + +s16 D_L00_0017A722[1] __attribute__((section(".data"))) = {0}; +f32 D_L00_0017A724[1] __attribute__((section(".data"))) = {0}; +f32 D_L00_0017A728[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001798CC[1] __attribute__((section(".data"))) = {0}; +s16 D_L01_0017ABA2[1] __attribute__((section(".data"))) = {0}; +f32 D_L01_0017ABA4[1] __attribute__((section(".data"))) = {0}; +f32 D_L01_0017ABA8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_00179A4C[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_0017AD24[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_0017AD28[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_0017954C[1] __attribute__((section(".data"))) = {0}; +s16 D_L03_0017A822[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_0017A824[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_0017A828[1] __attribute__((section(".data"))) = {0}; +s16 D_L04_0017A8A2[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_0017A8A4[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_0017A8A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_0017984C[1] __attribute__((section(".data"))) = {0}; +s16 D_L05_0017AB82[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_0017AB84[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_0017AB88[1] __attribute__((section(".data"))) = {0}; +s16 D_L06_0017AEA2[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_0017AEA4[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_0017AEA8[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001794CC[1] __attribute__((section(".data"))) = {0}; +s16 D_L07_0017A7A2[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_0017A7A4[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_0017A7A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_00179C4C[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_0017AF24[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_0017AF28[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001795CC[1] __attribute__((section(".data"))) = {0}; +s16 D_L09_0017A8A2[1] __attribute__((section(".data"))) = {0}; +f32 D_L09_0017A8A4[1] __attribute__((section(".data"))) = {0}; +f32 D_L09_0017A8A8[1] __attribute__((section(".data"))) = {0}; +s16 D_L10_0017ABA2[1] __attribute__((section(".data"))) = {0}; +f32 D_L10_0017ABA4[1] __attribute__((section(".data"))) = {0}; +f32 D_L10_0017ABA8[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_00179E4C[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001798CC[1] __attribute__((section(".data"))) = {0}; +s16 D_L12_0017ABA2[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_0017ABA4[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_0017ABA8[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_0017AA24[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_0017AA28[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_00179B4C[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0017AE24[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0017AE28[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0017AD24[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0017AD28[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_0017984C[1] __attribute__((section(".data"))) = {0}; +s16 D_L16_0017AB82[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_0017AB84[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_0017AB88[1] __attribute__((section(".data"))) = {0}; +f32 D_L17_0017B024[1] __attribute__((section(".data"))) = {0}; +f32 D_L17_0017B028[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/hero/hero_set_state.c b/src/overlays/shared/gameplay/hero/hero_set_state.c index 2c1110a9db..97d6641a01 100644 --- a/src/overlays/shared/gameplay/hero/hero_set_state.c +++ b/src/overlays/shared/gameplay/hero/hero_set_state.c @@ -268,12 +268,12 @@ void FUN_L00_002215c8(void) { /* Ported from rac1-decomp (src/overlays/shared/help_00221A98.c: func_L00_002222F0), where it is exact; names translated to the US level program. */ -extern float FUN_001f9af0(void *); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern float vector_distance_xy(void *, void *) __asm__("FUN_001f9b80"); extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_sin(float) __asm__("FUN_001f9de0"); -extern float FUN_001f9e90(float, float); -extern float FUN_L00_0025b8c0(float *p, float *v, float t, float u1, float u2, float eps); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); +extern float vendor_spring(float *p, float *v, float t, float u1, float u2, float eps) __asm__("FUN_L00_0025b8c0"); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern unsigned char D_0013E533[]; @@ -288,7 +288,7 @@ void FUN_L00_00221b68(void) { int s; if (*(unsigned char *)(q + 0x257) != 0 && *(float *)(q + 0x2DC) > 0.0f && - *(float *)(q + 0x160) < frame_time * 3.0f && FUN_001f9af0(q + 0xE0) < frame_time * 3.0f && + *(float *)(q + 0x160) < frame_time * 3.0f && fast_vec_length(q + 0xE0) < frame_time * 3.0f && *(float *)(q + 0x229C) < 0.2f) { s = *(int *)(q + 0x208C); if (s == 0 || s == 2 || s == 4 || s == 10 || s == 1) { @@ -302,13 +302,13 @@ void FUN_L00_00221b68(void) { d = vector_distance_xy(p + 0x80, p + 0x210); lim = *(float *)(p + 0x234) * 0.9f; if (d < lim) { - ang = FUN_001f9e90(*(float *)(p + 0x80) - *(float *)(p + 0x210), + ang = fast_arc_tan(*(float *)(p + 0x80) - *(float *)(p + 0x210), *(float *)(p + 0x84) - *(float *)(p + 0x214)); if (d < *(float *)(p + 0x234) * 0.05f) { ang = *(float *)(p + 0x98); } t0 = d - lim; - FUN_L00_0025b8c0(&t0, (float *)(p + 0x244), 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, + vendor_spring(&t0, (float *)(p + 0x244), 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, frame_time * 2.8f); *(float *)(p + 0xF0) = fast_cos(ang) * *(float *)(p + 0x244); *(float *)(p + 0xF4) = fast_sin(ang) * *(float *)(p + 0x244); @@ -406,6 +406,7 @@ f32 FUN_L00_0020d6b0_221ee0(M_221ee0 *, s32 *, f32, f32, f32, f32) __asm__("FUN_ s32 FUN_00214720_221ee0(void *, s32) __asm__("FUN_00214720"); s32 FUN_001efa68_221ee0(void *, void *, s32, s32, s32) __asm__("FUN_001efa68"); #define G D_0013F350_221ee0 +void FUN_L00_00221ee0(void); void FUN_L00_00221ee0(void) { union { OvlQuad q; @@ -479,6 +480,7 @@ extern float FUN_L00_0020d6b0(void *, int *, float, float, float, float); extern int FUN_001efa68(void *, void *, int, int, int); extern int is_point_inside_clip_volume(void *arg0, int arg1) __asm__("FUN_00214720"); +int FUN_L00_00222158(void); int FUN_L00_00222158(void) { char *g0, *g, *gb, *g2, *g3; char *m; @@ -595,10 +597,10 @@ extern char *hero_slot_moby(int) __asm__("FUN_L00_0020d460"); extern float absolute_float(float) __asm__("func_001F99C0"); extern float D_L00_0017BDF0[][25]; extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9e90(float, float); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_0020d658(int back); -extern float FUN_L00_002339d0(float *v); +extern float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float dot_vectors_xyz(void *a, void *b); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); @@ -639,14 +641,14 @@ extern void FUN_L00_00217450(void); extern void FUN_L00_00227638(void); extern void set_hero_animation(int, int, float) __asm__("FUN_L00_002323b8"); extern void FUN_L00_002325e0(int bank, int seq); -extern void FUN_L00_00233b20(float *dst, float *src, float z); -extern void FUN_L00_00250320(void *, void *, void *, void *); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); +extern void get_moby_color(void *, void *, void *, void *) __asm__("FUN_L00_00250320"); extern void sample_path(int a, char *pos, char *b, char *c, int d, float f) __asm__("FUN_L00_0025d808"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L00_00262500(int a, char *b); extern void FUN_L00_00262528(char *o, int a, int b); extern void FUN_L00_00262840(char *o); -extern void FUN_L00_002a3ec8(int, int, int, float, float, float, float); +extern void pool_splash(int, int, int, float, float, float, float) __asm__("FUN_L00_002a3ec8"); extern void fill_transfer_words(void *, int, int) __asm__("func_001F97E8"); extern void blend_moby_animation(void *, int, int, int) __asm__("FUN_00212f90"); extern void clear_vector(void *); @@ -881,14 +883,14 @@ int hero_set_state(int a, int b) { if (p->state.prev_control_mode == 0x11) { FUN_L00_00209ca8(3, 0xA, 0); if (D_L00_001612D0 != 0) { - FUN_L00_002a3ec8(D_L00_001612D0, D_L00_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L00_001612D0, D_L00_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.4f, 0.3f); } } else if (p->motion.displacement.f[2] < frame_time * -0.5f) { int n = truncate_float_to_s32(absolute_float(p->motion.displacement.f[2]) * 300.0f); FUN_L00_00209ca8(3, n < 0x28 ? n : 0x28, 1); if (D_L00_001612D0 != 0) { - FUN_L00_002a3ec8(D_L00_001612D0, D_L00_001612D8, 0, p->motion.pos.f[0], + pool_splash(D_L00_001612D0, D_L00_001612D8, 0, p->motion.pos.f[0], p->motion.pos.f[1], 0.5f, -0.4f); } p->unk90A = scale_game_frames(0x4B); @@ -1255,7 +1257,7 @@ int hero_set_state(int a, int b) { char *v = &p->motion.unk110; p->state.control_mode = 1; p->unk2284 = 0; - p->ground_speed = FUN_L00_002339d0((float *)v); + p->ground_speed = gravity_length_xy((float *)v); qcopy(&p->motion.unk150, v); if (b) { int id = 6; @@ -1311,7 +1313,7 @@ int hero_set_state(int a, int b) { *(unsigned int *)(h + 0x64) | (1 << current_level_index) | 0x80000000; } p->motion.move_yaw = - FUN_001f9e90(*(float *)(((char *)p->unk964) + 0x10) - p->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)p->unk964) + 0x10) - p->motion.pos.f[0], *(float *)(((char *)p->unk964) + 0x14) - p->motion.pos.f[1]); if (b) { set_hero_animation(0x2F, 2, (float)scale_game_frames(5)); @@ -1387,7 +1389,7 @@ int hero_set_state(int a, int b) { if (*(float *)(d + 0x2C) != 0.0f) q->unk9CC = *(float *)(d + 0x2C); q->unk9AC = - FUN_001f9e90(*(float *)(((char *)q->unk994) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unk994) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unk994) + 0x14) - q->motion.pos.f[1]); q->unk9A4 = FUN_001f9b48(&q->motion.pos, ((char *)q->unk994) + 0x10); q->unk9B0 = frame_time_sq * 27.0f; @@ -1466,10 +1468,10 @@ int hero_set_state(int a, int b) { if (((char *)q->unk5D8) != 0) { if (1.5707964f < fast_difference_between_rotations( - FUN_001f9e90( + fast_arc_tan( *(float *)(((char *)q->unk5D8) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unk5D8) + 0x14) - q->motion.pos.f[1]), - fast_add_rotations(q->unk588, FUN_001f9e90(d.v.x, d.v.y)))) { + fast_add_rotations(q->unk588, fast_arc_tan(d.v.x, d.v.y)))) { q->unk588 = 1.5707964f; q->unk58C = 1; } @@ -1738,7 +1740,7 @@ int hero_set_state(int a, int b) { u->unk48C = 1.98f; u->unk430 = 1.95f; } else { - FUN_L00_00233b20((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); + gravity_set_z((float *)(&u->motion.velocity), (float *)(&u->motion.velocity), 0.0f); u->unk41C = 1; u->unk3D0 = scale_game_frames(2); u->unk3D4 = scale_game_frames(0x23) + u->unk3D0; @@ -2096,7 +2098,7 @@ int hero_set_state(int a, int b) { if (1.5707964f < fast_difference_between_rotations( q->motion.rot.f[2], - FUN_001f9e90(q->unk500.f[0] - q->unk540.f[0], + fast_arc_tan(q->unk500.f[0] - q->unk540.f[0], q->unk500.f[1] - q->unk540.f[1]))) id = 0x1F; set_hero_animation(id, 0, (float)scale_game_frames(5)); @@ -2339,7 +2341,7 @@ int hero_set_state(int a, int b) { if (q->items[0].item_id == 0xA && ((char *)q->unkA50) != 0) { q->unkA58 = 1; q->unkA5C = - FUN_001f9e90(*(float *)(((char *)q->unkA50) + 0x10) - q->motion.pos.f[0], + fast_arc_tan(*(float *)(((char *)q->unkA50) + 0x10) - q->motion.pos.f[0], *(float *)(((char *)q->unkA50) + 0x14) - q->motion.pos.f[1]); } break; @@ -2495,7 +2497,7 @@ int hero_set_state(int a, int b) { { struct Hero *q = &hero; q->unk22F4 = 1; - FUN_L00_00250320(((void *)q->moby), &c0, &c1, &c2); + get_moby_color(((void *)q->moby), &c0, &c1, &c2); q->unk22F8 = (c2 << 16) | ((c1 << 8) | 0x80000000) | c0; } return 0; @@ -3042,7 +3044,6 @@ extern float D_L00_00173E68 __attribute__((section(".data"))); extern int D_L00_0015F5CC; extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern int FUN_L00_00216de8(int a, int b); -extern int func_L00_001EFFF0(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern void hero_get_collision_ray_endpoints(void *, void *, int, float, float) __asm__("FUN_L00_002126b8"); float absolute_float(float input) __asm__("FUN_001f99c0"); @@ -3110,12 +3111,12 @@ int FUN_L00_002279b0(void) { scale = 16.0f; } hero_get_collision_ray_endpoints(v1, v2, 0, scale, 1.3f); - if (func_L00_001EFFF0(v1, v2, 2, *(int *)&u->moby, 0) != 0) { + if (collision_line(v1, v2, 2, u->moby, 0) != 0) { int s = collision_hit_material(); u->ground_type = s; if ((short)s == 0) { v1[2] = D_L00_00173E68 - 0.01f; - if (func_L00_001EFFF0(v1, v2, 2, *(int *)&u->moby, 0) == 0) { + if (collision_line(v1, v2, 2, u->moby, 0) == 0) { hero_set_state(0x34, 1); return 1; } @@ -3286,14 +3287,14 @@ extern unsigned char item_available[] __asm__("D_0013D4C0"); extern Rec2C_228770 D_L00_0017BD28_228770[] __asm__("D_L00_0017BC28"); /* Gadget and weapon input for the current hero state: starts the matching move and returns 1 when the state changed. */ -extern int f_fun_l00_00211360_227fa0(char *) __asm__("FUN_L00_00211360"); -extern void f_fun_l00_00217658_227fa0(void) __asm__("FUN_L00_00217658"); +extern int FUN_L00_00211360(char *); +extern void FUN_L00_00217658(void); extern int f_fun_l00_002223f8_227fa0(int, int) __asm__("FUN_L00_002223f8"); -extern void f_fun_l00_00221ee0_227fa0(void) __asm__("FUN_L00_00221ee0"); -extern int f_fun_l00_00222158_227fa0(void) __asm__("FUN_L00_00222158"); -extern int f_fun_l00_0020fe30_227fa0(void) __asm__("FUN_L00_0020fe30"); -extern int f_fun_l00_00216de8_227fa0(int, int) __asm__("FUN_L00_00216de8"); -extern void f_fun_l00_0029a6b0_227fa0(void *) __asm__("FUN_L00_0029a6b0"); +extern void FUN_L00_00221ee0(void); +extern int FUN_L00_00222158(void); +extern int FUN_L00_0020fe30(void); +extern int FUN_L00_00216de8(int, int); +extern void FUN_L00_0029a6b0(void *); extern int f_fun_l00_00233e98_227fa0(int) __asm__("FUN_L00_00233e98"); extern void f_fun_l00_0020e4c8_227fa0(void) __asm__("FUN_L00_0020e4c8"); extern int engine_voice_playing(void *, int) __asm__("FUN_L00_0028d8c0"); @@ -3340,7 +3341,7 @@ int FUN_L00_00227fa0(void) { if (m == 0) { break; } - if (!f_fun_l00_00211360_227fa0((char *)m)) { + if (!FUN_L00_00211360((char *)m)) { break; } if (m->state != 0) { @@ -3348,7 +3349,7 @@ int FUN_L00_00227fa0(void) { } if ((D_0013CA40_p228770.f1A0 & 0xA) || ((D_0013F450_h228770.f2084 == 1 || D_0013F450_h228770.f2084 == 0x1E) && D_0013F450_h228770.f198 > f_fun_001f96f8_227fa0(0x14))) { if ((D_0013F450_h228770.f2084 == 1 || D_0013F450_h228770.f2084 == 0x1E) && D_0013F450_h228770.f198 > f_fun_001f96f8_227fa0(0x14)) { - f_fun_l00_00217658_227fa0(); + FUN_L00_00217658(); break; } f_fun_l00_002223f8_227fa0(0x15, 1); @@ -3438,8 +3439,8 @@ int FUN_L00_00227fa0(void) { { int t; - f_fun_l00_00221ee0_227fa0(); - f_fun_l00_00222158_227fa0(); + FUN_L00_00221ee0(); + FUN_L00_00222158(); t = f_fun_001f96f8_227fa0(5); if (D_0013F450_h228770.f30E != 0) { t = f_fun_001f96f8_227fa0(8); @@ -3471,7 +3472,7 @@ int FUN_L00_00227fa0(void) { if (D_0013F450_h228770.f20A4 != 0) { break; } - if (!f_fun_l00_0020fe30_227fa0()) { + if (!FUN_L00_0020fe30()) { break; } if (!f_fun_l00_00266d60_227fa0(mask, f_fun_001f96f8_227fa0(7), 0)) { @@ -3486,14 +3487,14 @@ int FUN_L00_00227fa0(void) { if (D_0013F450_h228770.f22DE != 0) { break; } - f_fun_l00_00216de8_227fa0(0x18, 0); + FUN_L00_00216de8(0x18, 0); D_0013F450_h228770.f22DE = 0x12; D_0013F450_h228770.f22DC = 1; break; case 32: if (D_0013F450_h228770.f208C < 3U || D_0013F450_h228770.f208C == 4 || D_0013F450_h228770.f208C == 5) { if (f_fun_l00_00266d60_227fa0(mask, f_fun_001f96f8_227fa0(8), 0)) { - f_fun_l00_0029a6b0_227fa0(0); + FUN_L00_0029a6b0(0); } } break; diff --git a/src/overlays/shared/gameplay/hero/hero_update_movement.c b/src/overlays/shared/gameplay/hero/hero_update_movement.c index cad9a26ff1..1230f8a664 100644 --- a/src/overlays/shared/gameplay/hero/hero_update_movement.c +++ b/src/overlays/shared/gameplay/hero/hero_update_movement.c @@ -143,7 +143,7 @@ extern void FUN_L00_00217118(f32, f32); extern void stick_target(f32, s32) __asm__("FUN_L00_002118c8"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void turn_to(s32, f32, f32, f32) __asm__("FUN_L00_00211e30"); -extern s32 FUN_001f9740(void *); +extern s32 fast_dec_timer(void *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 FUN_L00_00229a98(void); extern void FUN_L00_00211e98(void); @@ -183,10 +183,10 @@ extern u8 D_L00_0017BFC0[]; extern void FUN_L00_00216e48(s32, struct MobyView *, s32); extern void release_voice_slot(s32) __asm__("FUN_0022d798"); -extern s32 FUN_001f9770(s16 *); +extern s32 fast_dec_timer_s16(s16 *) __asm__("FUN_001f9770"); extern void FUN_L00_00209a40(s32, s32); extern void FUN_L00_00209ca8(s32, s32, s32); -extern void FUN_L00_002a3ec8(s32, s32, s32, f32, f32, f32, f32); +extern void pool_splash(s32, s32, s32, f32, f32, f32, f32) __asm__("FUN_L00_002a3ec8"); extern f32 FUN_L00_0025bc98(f32 *, f32, f32 *, s32, f32, f32, f32); extern f32 fast_subtract_rotations(f32, f32) __asm__("FUN_001fa5c8"); extern void moby_point_position(struct MobyView *, s32, void *) __asm__("FUN_L00_0024f7c8"); @@ -200,7 +200,7 @@ extern void FUN_L00_00262cf0(void *, void *, f32, f32, f32); extern f32 fast_add_rotations(f32, f32) __asm__("FUN_001fa580"); extern void build_spherical_offset(void *, f32, f32, f32) __asm__("FUN_00214db0"); extern f32 FUN_L00_00209018(void *, s32); -extern f32 FUN_001f9af0(void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); extern f32 approach_value(f32 *, f32, f32) __asm__("FUN_00213ed8"); extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern void FUN_L00_0020a1e0(f32, f32); @@ -224,21 +224,21 @@ extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern s32 FUN_L00_002595a0(f32 *, f32 *, f32, f32, f32); extern void FUN_L00_0025bc00(f32 *, s32, f32, f32); -extern f32 FUN_001f9b80(void *, void *); +extern f32 vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); extern f32 fast_difference_between_rotations(f32, f32) __asm__("FUN_001fa688"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern f32 square_root(f32) __asm__("FUN_001f9988"); -extern f32 FUN_L00_00233a78(void *); -extern f32 FUN_L00_0025b8c0(f32 *, f32 *, f32, f32, f32, f32); -extern f32 FUN_L00_00213350(void *); +extern f32 gravity_z(void *) __asm__("FUN_L00_00233a78"); +extern f32 vendor_spring(f32 *, f32 *, f32, f32, f32, f32) __asm__("FUN_L00_0025b8c0"); +extern f32 forward_component(void *) __asm__("FUN_L00_00213350"); extern struct HeroTableRow2C attack_records[] __asm__("D_L00_0017BC28"); extern struct LevelTable_QS D_L00_00166C80; #define Q D_L00_00166C80 extern void FUN_L00_00233ba0(void *, void *, f32); -extern void FUN_L00_00233b20(void *, void *, f32); +extern void gravity_set_z(void *, void *, f32) __asm__("FUN_L00_00233b20"); extern void FUN_L00_002336e8(void *, void *, f32); extern void make_hit_descriptor(void *, struct MobyView *, s32, f32, void *) __asm__("FUN_L00_00259888"); extern s32 collect_mobies_in_sphere(f32, void *, s32, struct MobyView *, void *) __asm__("FUN_L00_001f2868"); @@ -250,8 +250,8 @@ extern void FUN_L00_002a9b80(struct MobyView *, void *); extern s32 FUN_L00_002a96f8(struct MobyView *, void *, f32, f32, s32, f32, f32, f32); extern void FUN_L00_002335c8(void *, f32, f32, f32); extern f32 D_L00_001C3CF0[]; -extern s32 FUN_L00_002598b0(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32); -extern f32 FUN_001f9ab0(void *, void *); +extern s32 play_entity_sound(struct MobyView *, f32, void *, s32, f32, f32, s32, s32, s32) __asm__("FUN_L00_002598b0"); +extern f32 fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); struct PlayerSpeedTuning { u8 pad0[8]; f32 x08; @@ -263,14 +263,14 @@ extern struct PlayerSpeedTuning D_L00_0017BDB8; extern s32 FUN_L00_00216de8(s32, s32); extern void FUN_L00_00233708(void *, void *, f32); extern void FUN_L00_00233810(void *, void *, f32); -extern s32 FUN_001efa68(void *, void *, s32, struct MobyView *, s32); +extern s32 collision_line(void *, void *, s32, struct MobyView *, s32) __asm__("FUN_001efa68"); extern void FUN_L00_00215b68(void); extern void FUN_L00_00233660(void *, f32, f32, f32); extern s32 FUN_L00_0025e3b8(s32); -extern void FUN_L00_00259bc8(s32, struct MobyView *, s32, void *, void *, f32); +extern void spawn_nearby_effect(s32, struct MobyView *, s32, void *, void *, f32) __asm__("FUN_L00_00259bc8"); extern s32 D_L00_00177F00[]; extern void FUN_L00_00209ec8(void); -extern void FUN_L00_002338d0(void *, void *); +extern void gravity_flatten(void *, void *) __asm__("FUN_L00_002338d0"); extern s32 hero_slot_item_id(s32) __asm__("FUN_L00_0020d498"); extern void FUN_L00_0020b5b8(void); extern void FUN_L00_0020bed0(void); @@ -283,7 +283,7 @@ extern void FUN_L00_0020d2f8(void *); extern f32 randf_sym(f32, f32) __asm__("FUN_L00_00257c48"); extern void FUN_L00_0026d598(void *, void *, s32); extern s32 FUN_L00_0025df68(void *, void *, void *, s32 *, f32 *, s32, f32, f32, f32); -extern s32 FUN_L00_0025d808(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); +extern s32 sample_path(void *, void *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); extern s32 FUN_L00_0025d7a0(void *, s32, s32, s32); extern f32 multiply_global_factor_ed64(f32) __asm__("FUN_001f96b0"); extern void hero_integrate_velocity(void) __asm__("FUN_L00_00214108"); @@ -348,7 +348,7 @@ void hero_update_movement(void) { transform_vector_by_basis(&hero.motion.unk170, &v0, &D_L00_00166DD8[0x1F8]); hero.motion.move_yaw = *(f32 *)D_L00_00166DD8; turn_to(0, frame_scale_sq, frame_scale_sq * 0.0f, frame_time * 174.53293f); - if (D_L00_0015F688 > 0 && FUN_001f9740(&D_L00_0015F688) != 0) { + if (D_L00_0015F688 > 0 && fast_dec_timer(&D_L00_0015F688) != 0) { s32 t; if (usage_stats.stat[18].count < 0xFFFF) { usage_stats.stat[18].count++; @@ -511,7 +511,7 @@ void hero_update_movement(void) { } if (hero.unk90A != 0) { s32 n; - FUN_001f9770(&hero.unk90A); + fast_dec_timer_s16(&hero.unk90A); n = (s16)hero.unk90A >> 2; FUN_L00_00209a40(n > 8 ? 8 : n, 0); } @@ -525,7 +525,7 @@ void hero_update_movement(void) { if (hero.state_timer == 1) { FUN_L00_00209ca8(3, 0x10, 0); if (D_L00_001612D0 != 0) { - FUN_L00_002a3ec8(D_L00_001612D0, D_L00_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L00_001612D0, D_L00_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, -0.3f); } hero.unk90A = scale_game_frames(70); @@ -636,7 +636,7 @@ void hero_update_movement(void) { stick_target(1.0f, 0); turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); hero.unk8EC = hero.motion.unk184; - FUN_001f9740(&hero.unk8F4); + fast_dec_timer(&hero.unk8F4); if (hero.state.step == 1) { hero.target_speed = frame_time * 6.0f; } else if (hero.state.current == 0x35) { @@ -666,7 +666,7 @@ void hero_update_movement(void) { if (hero.state.current != 0x35 || !(PD.u1A0.i1A0 & 0xA)) { hero.target_speed *= k; }; - if (FUN_001f9740(&hero_b.unk8F0) != 0) { + if (fast_dec_timer(&hero_b.unk8F0) != 0) { s32 lo2; s32 hi2; pl = &hero_b; @@ -689,7 +689,7 @@ void hero_update_movement(void) { } pl->unk8F0 = random_int_between(lo2, scale_game_frames(hi2)); } - if (hero.state.current == 0x35 && FUN_001f9770(&hero.unk8F8) != 0) { + if (hero.state.current == 0x35 && fast_dec_timer_s16(&hero.unk8F8) != 0) { struct MobyView *gm = (struct MobyView *)hero.items[3].moby; if (gm != NULL && gm->hA6 == 0x261) { s32 i; @@ -727,7 +727,7 @@ void hero_update_movement(void) { } build_spherical_offset(&hero.motion.velocity, sp, hero.motion.rot.f[2], yaw); } else if (hero.state.current == 0x34) { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); if (hero.state.prev == 0x35) { approach_value(&len, 0.0f, frame_time_sq * 8.0f); } else { @@ -775,11 +775,11 @@ void hero_update_movement(void) { break; case 0x6A: case 0x82: { - f32 len = FUN_001f9af0(&hero.motion.unk150); + f32 len = fast_vec_length(&hero.motion.unk150); approach_value(&len, 0.0f, frame_time_sq * 4.0f); fast_vec_normalize(&hero.motion.unk150, &hero.motion.unk150, len); qcopy(&hero.motion.velocity, &hero.motion.unk150); - if (FUN_001f9740(&hero.unk8F0) == 2) { + if (fast_dec_timer(&hero.unk8F0) == 2) { moby_point_position((struct MobyView *)hero.moby, 4, &v0); v20.q = 0; v20.f[0] = 0.4f; @@ -826,7 +826,7 @@ void hero_update_movement(void) { } } turn_to(0, frame_scale_sq * 0.007f, frame_scale_sq * 0.08f, frame_time * 5.2359877f); - FUN_001f9740(&hero.unk698); + fast_dec_timer(&hero.unk698); if (hero.state.current == 0x36) { if (PD.i1D4 != 0 && hero.unk698 != 0) { hero.target_speed = frame_time * 3.0f; @@ -950,7 +950,7 @@ void hero_update_movement(void) { FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, 0.0f, frame_time * 3.8397243f); } else { f32 an = fast_add_rotations( - -fast_arc_tan(FUN_001f9b80(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); + -fast_arc_tan(vector_distance(&hero.motion.pos, &v0), v0.f[2] - hero.motion.pos.f[2]), 1.5707964f); FUN_L00_0025bc00(&hero.motion.rot.f[1], 0, an, frame_time * 6.4577184f); } v20.f[0] = fast_cos(fast_add_rotations(hero.motion.rot.f[2], -1.5707964f)) * -0.57f; @@ -1034,14 +1034,14 @@ void hero_update_movement(void) { } if (hero.unk99C != 0) { f32 s; - if (FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { + if (vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10) < hero.unk9A0 * 1.57f || hero.ground_distance > 1.5f) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.displacement, frame_time_sq * 40.0f); - if (hero.unk9BE != 0 && FUN_L00_00233a78(&hero.motion.velocity) > 0.0f) { + if (hero.unk9BE != 0 && gravity_z(&hero.motion.velocity) > 0.0f) { subtract_vector_xyz(&v30, &hero.motion.pos, &((struct MobyView *)hero.unk994)->u10.v10); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 57.0f); } } - s = FUN_001f9af0(&hero.motion.velocity) * (frame_time * 0.015f); + s = fast_vec_length(&hero.motion.velocity) * (frame_time * 0.015f); fast_vec_scale(&v30, &hero.motion.velocity, -1.0f); fast_vec_normalize(&v30, &v30, s); add_vector_xyz(&hero.motion.velocity, &hero.motion.velocity, &v30); @@ -1049,7 +1049,7 @@ void hero_update_movement(void) { { struct MobyView *r; if ((struct MobyView *)hero.unk994 != NULL && (r = ((struct MobyView *)hero.unk994)->pm78) != NULL) { - f32 len = FUN_001f9af0(&hero.motion.velocity); + f32 len = fast_vec_length(&hero.motion.velocity); if (r->fC < len) { approach_value(&len, r->fC, frame_time_sq * 15.0f); fast_vec_normalize(&hero.motion.velocity, &hero.motion.velocity, len); @@ -1070,9 +1070,9 @@ void hero_update_movement(void) { add_vector_xyz(&v30, &((struct MobyView *)hero.unk994)->u10.v10, &vC0); subtract_vector_xyz(&hero.motion.velocity, &v30, &vD0); old = hero.unk9A4; - FUN_L00_0025b8c0(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); + vendor_spring(&hero.unk9A4, &hero.unk9A8, hero.unk9A0, hero.unk9C4, hero.unk9C8, hero.unk9CC); d = hero.unk9A4 - old; - if (FUN_001f9af0(&vC0) > hero.unk9A4) { + if (fast_vec_length(&vC0) > hero.unk9A4) { fast_vec_normalize(&vC0, &vC0, d); add_vector_xyz(&hero.motion.pos, &hero.motion.pos, &vC0); } @@ -1081,7 +1081,7 @@ void hero_update_movement(void) { f32 mx = frame_time * 14.0f; f32 sp = vector_length_xy(&hero.motion.velocity); if (sp < mx) { - FUN_L00_0025b8c0(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); + vendor_spring(&sp, &hero.unk9B4, mx, frame_scale_sq * 0.047f, frame_scale_sq * 0.3f, 0.0f); v30.f[0] = fast_cos(hero.unk9AC) * hero.unk9B4; v30.f[1] = fast_sin(hero.unk9AC) * hero.unk9B4; v30.f[2] = 0.0f; @@ -1098,7 +1098,7 @@ void hero_update_movement(void) { up = hero.unk9BC == 1; } else { v30.q = hero.motion.displacement.q; - up = FUN_L00_00213350(&v30) > 0.0f; + up = forward_component(&v30) > 0.0f; } if (up) { if (moby->b53 != 0x35) { @@ -1134,12 +1134,12 @@ void hero_update_movement(void) { mx = frame_time_sq * 70.0f; t2 = scale_game_frames(33); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk4B0); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unk4B8 = 1.0f; } } @@ -1172,7 +1172,7 @@ void hero_update_movement(void) { hero.target_speed = 0.0f; if (hero.unk12E2 != 0) { if ((struct MobyView *)hero.unkA54 != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = frame_time * 4.5f; } @@ -1185,7 +1185,7 @@ void hero_update_movement(void) { } } else { if ((struct MobyView *)hero.unkA54 != NULL) { - f32 d = FUN_001f9b80(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); + f32 d = vector_distance(&hero.motion.pos, &((struct MobyView *)hero.unkA54)->u10.v10); if (d > 2.0f && d < 5.0f) { hero.target_speed = frame_time * 4.5f; } @@ -1227,16 +1227,16 @@ void hero_update_movement(void) { } FUN_L00_00211870(27.0f); if (hero.state_timer < t1) { - f32 h = FUN_L00_00233a78(&hero.motion.velocity); + f32 h = gravity_z(&hero.motion.velocity); approach_value(&h, r, mx); - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, h); + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, h); } else if (t2 < hero.state_timer) { FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, frame_time_sq * 130.0f); - if (FUN_L00_00233a78(&hero.motion.velocity) < 0.0f) { + if (gravity_z(&hero.motion.velocity) < 0.0f) { hero.unkA70 = 1.0f; } - if (FUN_L00_00233a78(&hero.motion.velocity) < frame_time * -37.0f) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); + if (gravity_z(&hero.motion.velocity) < frame_time * -37.0f) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, frame_time * -37.0f); } } break; @@ -1324,7 +1324,7 @@ void hero_update_movement(void) { tb = &attack_records[hero.attack_record]; hero.target_speed = 0.0f; if ((struct MobyView *)hero.unkA54 != NULL && scale_game_frames(4) > hero.state_timer) { - f32 d = FUN_001f9b80(&((struct MobyView *)hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; + f32 d = vector_distance(&((struct MobyView *)hero.unkA54)->u10.v10, &hero.motion.pos) - 0.5f; f32 off; f32 tol; f32 mx; @@ -1592,7 +1592,7 @@ void hero_update_movement(void) { Vec4 *p = &hero.move_impulse; FUN_L00_002132b8(0.7f, 0.0f); v0.q = hero.move_impulse.q; - hero.target_speed += FUN_L00_00213350(&v0); + hero.target_speed += forward_component(&v0); if (hero.target_speed < frame_time * 0.7f) { hero.target_speed = frame_time * 0.7f; } @@ -1718,7 +1718,7 @@ void hero_update_movement(void) { v10.f[2] += random_float_between(frame_time, frame_time * 2.0f); FUN_L00_00271b18(&v0, &v10, random_float_between(37800.0f, 75600.0f)); } - f = FUN_001f9af0(&hero.motion.platform_delta); + f = fast_vec_length(&hero.motion.platform_delta); if (f > frame_time * 0.5f) { hero.motion.move_yaw = fast_arc_tan(hero.motion.platform_delta.f[0], hero.motion.platform_delta.f[1]); } else { @@ -1825,9 +1825,9 @@ void hero_update_movement(void) { if (hero.state.current == 0x42) { r = hero.unk5CC * (f32)hero.unk578; } - FUN_L00_0025d808((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); + sample_path((void *)hero.unk560, &v0, &hero.unk564, &hero.unk568, r, hero.unk584); if (hero.unk590 != 0) { - FUN_L00_0025d808((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); + sample_path((void *)hero.unk594, &v10, &hero.unk598, &hero.unk59C, r, hero.unk5A0); } if (scale_game_frames(90) < hero.unk19C) { s32 h; @@ -1837,11 +1837,11 @@ void hero_update_movement(void) { qcopy(&v20, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - h = FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); + h = sample_path((void *)hero.unk560, &v20, &si, &sf, q, hero.unk584); qcopy(&v30, &hero.motion.pos); si = hero.unk564; sf = hero.unk568; - if ((h | FUN_L00_0025d808((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || + if ((h | sample_path((void *)hero.unk560, &v30, &si, &sf, q + 0.1f, hero.unk584)) == 0 || hero.unk584 != 0) { f32 a = fast_subtract_rotations( hero.unk57C, fast_arc_tan(v30.f[0] - v20.f[0], v30.f[1] - v20.f[1])) * @@ -1898,7 +1898,7 @@ void hero_update_movement(void) { } idx = FUN_L00_0025d7a0((void *)hero.unk560, hero.unk564, hero.unk578, hero.unk584); subtract_vector_xyz(&v20, (Vec4 *)hero.unk560 + (idx + 1), &v0); - if (FUN_001f9af0(&v20) < 0.001f) { + if (fast_vec_length(&v20) < 0.001f) { if (hero.unk564 == idx) { hero.unk570 = scale_game_frames(1); break; @@ -1945,7 +1945,7 @@ void hero_update_movement(void) { hero.motion.pos.f[2] += v20.f[2]; subtract_vector_xyz(&v30, &hero.unk500, &hero.motion.pos); v30.f[2] = 0.0f; - if (FUN_001f9af0(&v30) > frame_time) { + if (fast_vec_length(&v30) > frame_time) { fast_vec_normalize(&v30, &v30, frame_time); } hero.motion.pos.f[0] += v30.f[0]; @@ -1991,8 +1991,8 @@ void hero_update_movement(void) { si = hero.unk564; sf = hero.unk568; qcopy(&v20, &hero.motion.pos); - FUN_L00_0025d808((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); - e = fast_arc_tan(FUN_001f9b80(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); + sample_path((void *)hero.unk560, &v20, &si, &sf, 0.3f, hero.unk584); + e = fast_arc_tan(vector_distance(&hero.unk500, &v20), v20.f[2] - hero.unk500.f[2]); if (e > 0.0f) { sp = e * 1.9098593f * (frame_time * -2.5f); if (e > 0.2617994f && hero.unk5A8 != 2 && hero.unk5A8 != 3) { @@ -2029,9 +2029,9 @@ void hero_update_movement(void) { f32 mx = frame_time * 7.0f; f32 fl; f32 len; - fl = -FUN_001f9af0(&v20); - FUN_L00_0025b8c0(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); - len = FUN_001f9af0(&v20); + fl = -fast_vec_length(&v20); + vendor_spring(&fl, &hero.unk5DC, 0.0f, frame_scale_sq * 0.03f, frame_scale_sq * 0.3f, mx); + len = fast_vec_length(&v20); if (len < hero.unk5DC) { hero.unk5DC = len; } @@ -2084,10 +2084,10 @@ void hero_update_movement(void) { hero.motion.velocity.f[2] = hero.motion.velocity.f[2] - frame_time_sq * 24.0f; break; } - FUN_L00_0025d808(hero.unk5F0, &v10, &hero.unk5F4, &hero.unk5F8, hero.unk604, hero.unk60C); + sample_path(hero.unk5F0, &v10, &hero.unk5F4, &hero.unk5F8, hero.unk604, hero.unk60C); idx = FUN_L00_0025d7a0(hero.unk5F0, hero.unk5F4, 1, hero.unk60C); subtract_vector_xyz(&v20, (Vec4 *)hero.unk5F0 + (idx + 1), &v10); - if (FUN_001f9af0(&v20) < 0.001f) { + if (fast_vec_length(&v20) < 0.001f) { if (hero.unk5F4 == idx) { hero.unk600 = scale_game_frames(1); break; @@ -2104,10 +2104,10 @@ void hero_update_movement(void) { { f32 fl; f32 len; - fl = -FUN_001f9af0(&v20); - FUN_L00_0025b8c0(&fl, &hero.unk618.f, 0.0f, frame_scale_sq * 0.05f, frame_scale_sq * 0.3f, + fl = -fast_vec_length(&v20); + vendor_spring(&fl, &hero.unk618.f, 0.0f, frame_scale_sq * 0.05f, frame_scale_sq * 0.3f, frame_time * 10.0f); - len = FUN_001f9af0(&v20); + len = fast_vec_length(&v20); if (len < hero.unk618.f) { hero.unk618.f = len; } @@ -2213,8 +2213,8 @@ void hero_update_movement(void) { FUN_L00_00215340(); FUN_L00_002132b8(0.7f, frame_time * 0.0f); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; case 0x77: { @@ -2226,8 +2226,8 @@ void hero_update_movement(void) { len = vector_length_xy(&hero.motion.velocity); FUN_L00_001ff600(frame_scale * -0.100000024f * len + len, &hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, hero.unk940); - if (FUN_L00_00233a78(&hero.motion.velocity) < -(frame_time * 50.0f)) { - FUN_L00_00233b20(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); + if (gravity_z(&hero.motion.velocity) < -(frame_time * 50.0f)) { + gravity_set_z(&hero.motion.velocity, &hero.motion.velocity, -(frame_time * 50.0f)); } break; } @@ -2272,11 +2272,11 @@ void hero_update_movement(void) { FUN_L00_00215340(); FUN_L00_00212318(1); if (big) { - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); hero.unk304 = hero.motion.velocity.f[2]; } else { - FUN_L00_0025b8c0(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, + vendor_spring(&hero.motion.pos.f[2], &hero.unk304, hero.ground_z.f + 0.17f, frame_scale_sq * 0.02f, frame_scale_sq * 0.35f, frame_time * 2.5f); } break; @@ -2311,7 +2311,7 @@ void hero_update_movement(void) { speed_step(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); FUN_L00_00215340(); - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); if (hero.motion.pos.f[2] < hero.unk410) { approach_value(&hero.unk410, hero.motion.pos.f[2], frame_time * 4.0f); @@ -2355,7 +2355,7 @@ void hero_update_movement(void) { if (hero.state_timer == scale_game_frames(20)) { FUN_L00_00209ca8(3, 0x10, 1); if (D_L00_001612D0 != 0) { - FUN_L00_002a3ec8(D_L00_001612D0, D_L00_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], + pool_splash(D_L00_001612D0, D_L00_001612D8, 0, hero.motion.pos.f[0], hero.motion.pos.f[1], 0.4f, 0.35f); } } @@ -2415,7 +2415,7 @@ void hero_update_movement(void) { qcopy(&v10, &v0); v10.f[0] += fast_cos(hero.motion.rot.f[2]) * 0.85f; v10.f[1] += fast_sin(hero.motion.rot.f[2]) * 0.85f; - if (FUN_001efa68(&v0, &v10, 4, (struct MobyView *)hero.moby, 0) != 0) { + if (collision_line(&v0, &v10, 4, (struct MobyView *)hero.moby, 0) != 0) { hero.unk4A4 = 1; } } @@ -2439,7 +2439,7 @@ void hero_update_movement(void) { if (hero.motion.pos.f[2] < hero.unk410) { hero.unk410 = hero.motion.pos.f[2]; } - if (hero.state_timer > hero.unk420 && FUN_L00_00233a78(&hero.motion.velocity) < 0.001f && + if (hero.state_timer > hero.unk420 && gravity_z(&hero.motion.velocity) < 0.001f && (hero.unk41C == 0 || hero.state_timer > hero.unk3D4)) { hero.unk41E = 1; if (hero.unk3F8 != 0.0f) { @@ -2465,7 +2465,7 @@ void hero_update_movement(void) { fast_vec_scale(&v10, &hero.motion.displacement, 7.0f); for (i = 0; i < n; i++) { if (FUN_L00_0025e3b8(D_L00_00177F00[i]) != 0) { - FUN_L00_00259bc8(D_L00_00177F00[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, + spawn_nearby_effect(D_L00_00177F00[i], (struct MobyView *)hero.moby, 0x10000, &hero.motion.pos, &v10, 1.0f); } } @@ -2551,7 +2551,7 @@ void hero_update_movement(void) { } case 0x66: subtract_vector_xyz(&v0, &hero.unk1640, &hero.motion.pos); - if (FUN_001f9ab0(&v0, &hero.motion.unk150) < 0.0f) { + if (fast_vec_dot(&v0, &hero.motion.unk150) < 0.0f) { clear_u64_value(&hero.motion.unk150); } clear_u64_value(&hero.motion.velocity); @@ -2619,7 +2619,7 @@ void hero_update_movement(void) { moby_point_position((struct MobyView *)hero.moby, k | 1, &v20); add_vector_xyz(&v0, &v10, &v20); fast_vec_scale(&v0, &v0, 0.5f); - FUN_L00_002598b0((struct MobyView *)hero.moby, 0.25f, &v0, 0x10000, 1.0f, 1.0f, 0, 1, 0); + play_entity_sound((struct MobyView *)hero.moby, 0.25f, &v0, 0x10000, 1.0f, 1.0f, 0, 1, 0); } approach_value(&hero.anim_speed, 1.0f, 0.2f); if (hero.unkA58 != 0 || (struct MobyView *)hero.unkA54 != NULL) { @@ -2658,7 +2658,7 @@ void hero_update_movement(void) { turn_to(0, frame_scale_sq * 0.04f, frame_scale_sq * 0.2f, frame_time * 8.726646f); speed_step(frame_time_sq * 15.0f, frame_time_sq * 7.0f); set_planar_vel(99999.0f); - FUN_L00_002338d0(&hero.motion.velocity, &hero.motion.velocity); + gravity_flatten(&hero.motion.velocity, &hero.motion.velocity); FUN_L00_002334d0(&hero.motion.velocity, &hero.motion.velocity, sp * 0.72f); break; } @@ -2838,7 +2838,7 @@ void hero_update_movement(void) { for (i = 0; i < 3; i++) { FUN_L00_002335c8(&m40[1], 1.8f, fast_add_rotations(-0.7853982f, (f32)i * 0.7853982f), 1.4f); - FUN_L00_002598b0((struct MobyView *)hero.moby, 2.2f, &m40[1], 0x30000, 40.0f, 1.0f, 0, 1, 0); + play_entity_sound((struct MobyView *)hero.moby, 2.2f, &m40[1], 0x30000, 40.0f, 1.0f, 0, 1, 0); } } switch (hero.attack_record) { @@ -2921,7 +2921,7 @@ void hero_update_movement(void) { stick_target(frame_time * 6.0f, 0); qcopy(&v0, &hero.motion.pos); v0.f[2] -= 1.0f; - FUN_L00_002598b0((struct MobyView *)hero.moby, 3.5f, &v0, 0x30000, 40.0f, 1.0f, 0, 1, 0); + play_entity_sound((struct MobyView *)hero.moby, 3.5f, &v0, 0x30000, 40.0f, 1.0f, 0, 1, 0); if (hero.unk1C4 == 0) { FUN_L00_00214658(); } @@ -2939,7 +2939,7 @@ void hero_update_movement(void) { d = fast_difference_between_rotations(hero.motion.rot.f[2], hero.motion.move_yaw); for (i = 0; i < 3; i++) { FUN_L00_002335c8(&v0, 1.8f, fast_add_rotations(-0.7853982f, (f32)i * 0.7853982f), 1.4f); - FUN_L00_002598b0((struct MobyView *)hero.moby, 2.7f, &v0, 0x30000, 40.0f, 1.0f, 0, 1, 0); + play_entity_sound((struct MobyView *)hero.moby, 2.7f, &v0, 0x30000, 40.0f, 1.0f, 0, 1, 0); } if (FUN_L00_00211870(30.0f) != 0 || FUN_L00_00211870(0.0f) != 0) { Q.f160 = 0.1f; diff --git a/src/overlays/shared/gameplay/hero/hero_update_transitions.c b/src/overlays/shared/gameplay/hero/hero_update_transitions.c index b60e93edb7..da1b856304 100644 --- a/src/overlays/shared/gameplay/hero/hero_update_transitions.c +++ b/src/overlays/shared/gameplay/hero/hero_update_transitions.c @@ -59,12 +59,12 @@ extern float D_L00_0015F638; extern float D_L00_00166DD8 __attribute__((section(".data"))); extern float multiply_global_factor_ed64(float) __asm__("FUN_001f96b0"); extern float FUN_001f9b48(void *, void *); -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern float FUN_L00_00208f20(float a, float b, float c, float d); extern float FUN_L00_00232b90(float a, float b, float c); -extern float FUN_L00_00233a78(float *v); +extern float gravity_z(float *v) __asm__("FUN_L00_00233a78"); extern float FUN_L00_00233c30(float *pos, float *vel, int *steps, float step); extern float randf_sym(float lo, float hi) __asm__("FUN_L00_00257c48"); extern float FUN_L00_00259468(float *a, float *b, int *out, float f); @@ -82,7 +82,7 @@ extern int D_L00_0015F678_t __asm__("D_L00_0015F678") __attribute__((sda)); extern int D_L00_0015F6DC __asm__("D_L00_0015F6DC"); extern int D_L00_0015F594 __attribute__((sda)); extern int D_L00_0016C780 __attribute__((section(".data"))); -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int hero_idle_sequence(int a) __asm__("FUN_L00_00205000"); extern int FUN_L00_002050b8(int); @@ -105,7 +105,7 @@ extern int hero_handle_jump_press(void) __asm__("FUN_L00_00229660"); extern int FUN_L00_00229910(void); extern int FUN_L00_00229a98(void); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern int FUN_L00_0025d808(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); +extern int sample_path(int *tab, float *out, int *a, float *b, int c, float d) __asm__("FUN_L00_0025d808"); extern int FUN_L00_0025df68(void *, void *, void *, int *, float *, int, float, float, float); extern int pad_pressed_within(int, int, int *) __asm__("FUN_L00_00266d60"); extern int FUN_L00_00266e00(int, int, int, int); @@ -133,7 +133,7 @@ extern void FUN_L00_00232628(void); extern void FUN_L00_00232640(int id); extern void FUN_L00_00233288(float a, float b, short c, unsigned char d, unsigned char e, unsigned char f); -extern void FUN_L00_00233b20(float *dst, float *src, float z); +extern void gravity_set_z(float *dst, float *src, float z) __asm__("FUN_L00_00233b20"); extern void hud_keep_visible(int, int) __asm__("FUN_L00_00235e18"); extern void FUN_L00_00237ae8(void); extern void FUN_L00_00237ba0(void); @@ -144,7 +144,7 @@ extern void FUN_L00_00238f88(void); extern void FUN_L00_00239cc8(void); extern void FUN_L00_00239d00(void); extern void FUN_L00_00239df8(void); -extern void FUN_L00_002598b0(int, float, void *, int, float, float, int, int, int); +extern void play_entity_sound(int, float, void *, int, float, float, int, int, int) __asm__("FUN_L00_002598b0"); extern void FUN_L00_0025f730(void *a, float x); extern void FUN_L00_002a7e20(void *, int); extern void add_vector_xyz(void *, void *, void *); @@ -997,7 +997,7 @@ void hero_update_transitions(void) { } break; case 101: - if (FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { + if (vector_distance(hero.motion.pos.f, hero.unk1640.f) < 0.2f) { if (frame_time * 2.7f > hero.motion.speed_xy) { if (fast_difference_between_rotations( hero.motion.rot.f[2], hero.unk1640.f[3]) < 0.034906585f) { @@ -1021,7 +1021,7 @@ void hero_update_transitions(void) { if ((hero.unkA98 & 2) || hero.unk1650 != 0) { hero_set_state(HERO_STATE_IDLE, 1); } - if (0.2f < FUN_001f9b80(hero.motion.pos.f, hero.unk1640.f)) { + if (0.2f < vector_distance(hero.motion.pos.f, hero.unk1640.f)) { hero_set_state(0x65, 1); } break; @@ -1340,7 +1340,7 @@ void hero_update_transitions(void) { v1[1] = fast_sin(hero.unk57C) * 5.0f; v1[2] = 0.0f; add_vector_xyz(v1, v1, v0); - if (FUN_001efa68(v0, v1, 2, 0, 0)) { + if (collision_line(v0, v1, 2, 0, 0)) { ok = 0; } } @@ -1501,7 +1501,7 @@ void hero_update_transitions(void) { path_seg = hero.unk564; path_t = hero.unk568; /* Step a copy of the hero position along its current path. */ - if (FUN_L00_0025d808((int *)hero.unk560, v0, &path_seg, + if (sample_path((int *)hero.unk560, v0, &path_seg, &path_t, hero.unk584, t)) { scale_vector_xyz(v1, hero.motion.displacement.f, scale_game_frames(0x30)); @@ -1532,7 +1532,7 @@ void hero_update_transitions(void) { } } if (hero.state_timer > hero.unk420) { - if (FUN_L00_00233a78(hero.motion.velocity.f) < 0.001f) { + if (gravity_z(hero.motion.velocity.f) < 0.001f) { hero.unk41E = 1; } } @@ -1783,7 +1783,7 @@ void hero_update_transitions(void) { if (hero_set_state(HERO_STATE_IDLE, 0)) { set_hero_animation(0xC, 9, -1.0f); } - FUN_L00_00233b20(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); + gravity_set_z(hero.motion.unk150.f, hero.motion.unk150.f, 0.0f); FUN_L00_0025f730(hero.motion.unk150.f, frame_time * 7.0f); hero.unk1C4 = scale_game_frames(7); if (hero.state.prev == 0x2D) { @@ -2301,7 +2301,7 @@ void hero_update_transitions(void) { scale_game_frames(0xE) < hero.state_timer && (hero.unk41E == 0 || (hero.ground_distance > 0.7f && - absolute_float(FUN_L00_00233a78(hero.motion.velocity.f)) < + absolute_float(gravity_z(hero.motion.velocity.f)) < frame_time * 5.8f))) { hero_set_state(0xE, 1); } else if (D_0013D4C0[2] != 0 && hero_slot_item_id(3) != 4 && @@ -2798,7 +2798,7 @@ void hero_update_transitions(void) { if (hero.unk41E != 0) { qcopy(v0, hero.motion.pos.f); v0[2] -= 1.0f; - FUN_L00_002598b0((int)((unsigned char *)hero.moby), 3.5f, v0, 0x30000, 40.0f, 1.0f, 0, + play_entity_sound((int)((unsigned char *)hero.moby), 3.5f, v0, 0x30000, 40.0f, 1.0f, 0, 1, 0); } if (!(hero.state_timer > hero.unk420)) { @@ -2882,7 +2882,7 @@ void hero_update_transitions(void) { if (hero.unk41E != 0) { qcopy(v0, hero.motion.pos.f); v0[2] -= 1.0f; - FUN_L00_002598b0((int)((unsigned char *)hero.moby), 3.5f, v0, 0x30000, 1.0f, 1.0f, 0, 1, + play_entity_sound((int)((unsigned char *)hero.moby), 3.5f, v0, 0x30000, 1.0f, 1.0f, 0, 1, 0); } if (hero.air_frames.s != 0) { diff --git a/src/overlays/shared/gameplay/hero/set_hero_animation.c b/src/overlays/shared/gameplay/hero/set_hero_animation.c index c8ca81de37..82590cd9f1 100644 --- a/src/overlays/shared/gameplay/hero/set_hero_animation.c +++ b/src/overlays/shared/gameplay/hero/set_hero_animation.c @@ -632,6 +632,7 @@ typedef struct { extern int D_L00_0015F5C4; +void FUN_L00_00232fe8(void); void FUN_L00_00232fe8(void) { struct Hero *base = &hero; struct Hero *tail; @@ -676,6 +677,7 @@ void FUN_L00_00232fe8(void) { block, as retail re-forms it from the saved %hi before each one. */ /* Ported from rac1-decomp (src/overlays/shared/help_00232560.c: func_L00_00233950), where it is exact; names translated to the US level program. */ +void FUN_L00_002330d0(void); void FUN_L00_002330d0(void) { struct Hero *base = &hero; struct Hero *blk2; @@ -845,6 +847,7 @@ typedef struct { } V002334d0 __attribute__((aligned(16))); void FUN_001f9bf8_002334d0(void *, void *, f32) __asm__("FUN_001f9bf8"); void FUN_001f9a10_002334d0(void *, void *, void *) __asm__("FUN_001f9a10"); +void FUN_L00_002334d0(f32 *out, f32 *in, f32 k); void FUN_L00_002334d0(f32 *out, f32 *in, f32 k) { struct Hero *b = &hero; V002334d0 t; @@ -897,6 +900,7 @@ void FUN_L00_002335c8(float *out, float r, float angle, float z) { extern void clear_u64_value(void *) __asm__("FUN_001f99f8"); /* Builds (x, y, z), transforms it by the hero matrix at 0 and adds the hero position. */ +void FUN_L00_00233660(float *out, float x, float y, float z); void FUN_L00_00233660(float *out, float x, float y, float z) { struct Hero *base; @@ -910,6 +914,7 @@ void FUN_L00_00233660(float *out, float x, float y, float z) { } void FUN_L00_002334d0_002336e8(float) __asm__("FUN_L00_002334d0"); /* Calls FUN_L00_002334d0 with -x. */ +void FUN_L00_002336e8(float x); void FUN_L00_002336e8(float x) { FUN_L00_002334d0_002336e8(-x); } @@ -965,6 +970,7 @@ void FUN_001f99f8_00233810(void *) __asm__("FUN_001f99f8"); void FUN_001fa050_00233810(void *, void *) __asm__("FUN_001fa050"); void FUN_001f9d20_00233810(void *, void *, void *) __asm__("FUN_001f9d20"); void FUN_001f9a10_00233810(void *, void *, void *) __asm__("FUN_001f9a10"); +void FUN_L00_00233810(f32 *out, f32 *in, f32 z); void FUN_L00_00233810(f32 *out, f32 *in, f32 z) { struct Hero *b = &hero; M00233810 m; @@ -992,7 +998,8 @@ extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); -void FUN_L00_002338d0(float *dst, float *src) { +void gravity_flatten(float *dst, float *src) __asm__("FUN_L00_002338d0"); +void gravity_flatten(float *dst, float *src) { struct Hero *base = &hero; float n[4] __attribute__((aligned(16))); @@ -1018,12 +1025,13 @@ void FUN_L00_002338d0(float *dst, float *src) { /* Ported from rac1-decomp (src/overlays/shared/help_00232560.c: func_L00_00234250), where it is exact; names translated to the US level program. */ -extern float FUN_001f9b20(void *); +extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); -float FUN_L00_002339d0(float *v) { +float gravity_length_xy(float *v) __asm__("FUN_L00_002339d0"); +float gravity_length_xy(float *v) { struct Hero *base = &hero; float m[16] __attribute__((aligned(16))); float inv[16] __attribute__((aligned(16))); @@ -1031,13 +1039,13 @@ float FUN_L00_002339d0(float *v) { switch (base->unk20B3) { case 0: - return FUN_001f9b20(v); + return vector_length_xy(v); case 1: case 2: euler_rotation_matrix(m, ((char *)base->moby) + 0x40); transpose_rotation_matrix(inv, m); transform_vector(out, v, inv); - return FUN_001f9b20(out); + return vector_length_xy(out); } return 0.0f; } @@ -1047,11 +1055,12 @@ float FUN_L00_002339d0(float *v) { /* Ported from rac1-decomp (src/overlays/shared/help_00232560.c: func_L00_002342F8), where it is exact; names translated to the US level program. */ -extern float FUN_001f9ab0(void *, void *); +extern float fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); -float FUN_L00_00233a78(float *v) { +float gravity_z(float *v) __asm__("FUN_L00_00233a78"); +float gravity_z(float *v) { struct Hero *base = &hero; float m[16] __attribute__((aligned(16))); float axis[4] __attribute__((aligned(16))); @@ -1065,13 +1074,14 @@ float FUN_L00_00233a78(float *v) { axis[2] = 1.0f; euler_rotation_matrix(m, ((char *)base->moby) + 0x40); transform_vector(axis, axis, m); - return FUN_001f9ab0(axis, v); + return fast_vec_dot(axis, v); } return 0.0f; } void FUN_001f9d20_00233b20(void *, void *, void *) __asm__("FUN_001f9d20"); /* Copies in to out with z, transformed by the two hero matrices in modes 1 and 2. */ -void FUN_L00_00233b20(f32 *out, f32 *in, f32 z) { +void gravity_set_z(f32 *out, f32 *in, f32 z) __asm__("FUN_L00_00233b20"); +void gravity_set_z(f32 *out, f32 *in, f32 z) { struct Hero *b = &hero; switch (b->unk20B3) { case 0: @@ -1316,8 +1326,8 @@ extern float f_001fa580(float, float) __asm__("FUN_001fa580"); extern float f_001f9dc8(float) __asm__("FUN_001f9dc8"); extern float f_001f9de0(float) __asm__("FUN_001f9de0"); extern void probe_ground_height_cf(int, void *, void *, void *, void *, void *) __asm__("FUN_L00_00260400"); -extern int f_L00_00260668(int, void *, void *, void *, void *, void *) __asm__("FUN_L00_00260668"); -extern void f_L00_002604f0(int, void *, void *, void *, void *, void *) __asm__("FUN_L00_002604f0"); +extern int FUN_L00_00260668(int, void *, void *, void *, void *, void *); +extern void FUN_L00_002604f0(int, void *, void *, void *, void *, void *); extern void f_001f99f8(void *) __asm__("FUN_001f99f8"); extern float f_001f9b20(void *) __asm__("FUN_001f9b20"); extern float approach_value(float *, float, float) __asm__("FUN_00213ed8"); @@ -1385,13 +1395,13 @@ void FUN_L00_00233f80(void) { v20.z -= -1.43f; probe_ground_height_cf(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &((Hero_234800 *)hero_233f80)->v4D0, &((Hero_234800 *)hero_233f80)->v90, &v30, &v40); probe_ground_height_cf(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &v20, &((Hero_234800 *)hero_233f80)->v90, &v20, &v40); - f_L00_00260668(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &((Hero_234800 *)hero_233f80)->v4D0, &((Hero_234800 *)hero_233f80)->v90, &((Hero_234800 *)hero_233f80)->v310, &v40); - f_L00_00260668(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &v20, &((Hero_234800 *)hero_233f80)->v90, &((Hero_234800 *)hero_233f80)->v330, &v40); + FUN_L00_00260668(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &((Hero_234800 *)hero_233f80)->v4D0, &((Hero_234800 *)hero_233f80)->v90, &((Hero_234800 *)hero_233f80)->v310, &v40); + FUN_L00_00260668(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &v20, &((Hero_234800 *)hero_233f80)->v90, &((Hero_234800 *)hero_233f80)->v330, &v40); } else if (plat->i3C & 4) { - f_L00_00260668(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &((Hero_234800 *)hero_233f80)->pos, &((Hero_234800 *)hero_233f80)->v90, &((Hero_234800 *)hero_233f80)->v310, &v20); + FUN_L00_00260668(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &((Hero_234800 *)hero_233f80)->pos, &((Hero_234800 *)hero_233f80)->v90, &((Hero_234800 *)hero_233f80)->v310, &v20); } else { probe_ground_height_cf(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &((Hero_234800 *)hero_233f80)->pos, &((Hero_234800 *)hero_233f80)->v90, &v30, &v40); - f_L00_00260668(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &v30, &v40, &((Hero_234800 *)hero_233f80)->v310, &v20); + FUN_L00_00260668(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &v30, &v40, &((Hero_234800 *)hero_233f80)->v310, &v20); } ((Hero_234800 *)hero_233f80)->i364 |= 1; } @@ -1400,7 +1410,7 @@ void FUN_L00_00233f80(void) { } if ((((Hero_234800 *)hero_233f80)->i208C == 0 || ((Hero_234800 *)hero_233f80)->i208C == 12) && ((Hero_234800 *)hero_233f80)->f184 == 0.0f && ((Hero_234800 *)hero_233f80)->h30E == 0) { if (!(((Hero_234800 *)hero_233f80)->i364 & 2)) { - f_L00_00260668(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &((Hero_234800 *)hero_233f80)->pos, &((Hero_234800 *)hero_233f80)->v90, &v20, &((Hero_234800 *)hero_233f80)->v320); + FUN_L00_00260668(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &((Hero_234800 *)hero_233f80)->pos, &((Hero_234800 *)hero_233f80)->v90, &v20, &((Hero_234800 *)hero_233f80)->v320); ((Hero_234800 *)hero_233f80)->i364 |= 2; } } else { @@ -1430,8 +1440,8 @@ void FUN_L00_00233f80(void) { qcopy((Vec_234800 *)(hero_233f80 + 0x350), &v20); } else if (mode == 2) { probe_ground_height_cf(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &((Hero_234800 *)hero_233f80)->pos, &((Hero_234800 *)hero_233f80)->v90, &v40, &v50); - f_L00_002604f0(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &((Hero_234800 *)hero_233f80)->v310, &((Hero_234800 *)hero_233f80)->v320, &v60, &v70); - f_L00_002604f0(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &((Hero_234800 *)hero_233f80)->v330, &((Hero_234800 *)hero_233f80)->v320, &v80, &v90); + FUN_L00_002604f0(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &((Hero_234800 *)hero_233f80)->v310, &((Hero_234800 *)hero_233f80)->v320, &v60, &v70); + FUN_L00_002604f0(((Hero_234800 *)hero_233f80)->i2080, ((Hero_234800 *)hero_233f80)->p360, &((Hero_234800 *)hero_233f80)->v330, &((Hero_234800 *)hero_233f80)->v320, &v80, &v90); if ((((Hero_234800 *)hero_233f80)->i2084 == 1 || ((Hero_234800 *)hero_233f80)->i2084 == 0x1E) && ((Hero_234800 *)hero_233f80)->b20A5 != 0) { ((Hero_234800 *)hero_233f80)->v90.z = v50.z; } else if (((Hero_234800 *)hero_233f80)->i364 & 2) { @@ -1486,6 +1496,7 @@ void FUN_L00_00233f80(void) { extern int FUN_L00_00262030(int, void *, void *, float); /* Sets the short at &hero.unk1F6 to 4 when FUN_L00_00262030 succeeds. */ +void FUN_L00_002347c0(void); void FUN_L00_002347c0(void) { struct Hero *base = &hero; @@ -1694,3 +1705,34 @@ void show_health_hud(void) { queue_animation_update(1, 0x7535, FUN_L00_002395b0, FUN_L00_00239630, FUN_L00_00239810, &hero.health, 8); } + +f32 D_L02_0017C960[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_0017C964[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_0017C460[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_0017C464[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_0017C4E0[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_0017C4E4[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_0017C7C0[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_0017C7C4[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_0017CAE0[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_0017CAE4[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_0017C3E0[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_0017C3E4[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_0017CB60[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_0017CB64[1] __attribute__((section(".data"))) = {0}; +f32 D_L09_0017C4E0[1] __attribute__((section(".data"))) = {0}; +f32 D_L09_0017C4E4[1] __attribute__((section(".data"))) = {0}; +f32 D_L10_0017C7E0[1] __attribute__((section(".data"))) = {0}; +f32 D_L10_0017C7E4[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_0017C7E0[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_0017C7E4[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_0017C660[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_0017C664[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0017CA60[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0017CA64[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0017C960[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0017C964[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_0017C7C0[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_0017C7C4[1] __attribute__((section(".data"))) = {0}; +f32 D_L17_0017CC60[1] __attribute__((section(".data"))) = {0}; +f32 D_L17_0017CC64[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/space/0028e8a0.c b/src/overlays/shared/gameplay/space/0028e8a0.c index dacef0a7eb..2a70685126 100644 --- a/src/overlays/shared/gameplay/space/0028e8a0.c +++ b/src/overlays/shared/gameplay/space/0028e8a0.c @@ -96,7 +96,7 @@ void f2335a0_28e9c8(void) __asm__("FUN_002335a0"); extern int hero_set_state(int, int) __asm__("FUN_L00_002223f8"); void f232fe8_28e9c8(void) __asm__("FUN_L00_00232fe8"); int fr_28e9c8(int) __asm__("FUN_001f96f8"); -void f245610_28e9c8(int, int) __asm__("FUN_L00_00245610"); +void FUN_L00_00245610(int, int); void f2049f0_28e9c8(int) __asm__("FUN_002049f0"); void f22ca50_28e9c8(void) __asm__("FUN_0022ca50"); int f122298_28e9c8(int) __asm__("FUN_00122298"); @@ -138,7 +138,7 @@ void FUN_L00_0028e9c8(int a) { m = 8; t = 14; } - f245610_28e9c8(m, fr_28e9c8(6)); + FUN_L00_00245610(m, fr_28e9c8(6)); } else { int k, r; n = D_0013E030_28e9c8.x26; @@ -161,7 +161,7 @@ void FUN_L00_0028e9c8(int a) { r = 0; if (!D_0013E030_28e9c8.x2c) r = fr_28e9c8(6); - f245610_28e9c8(m2, r); + FUN_L00_00245610(m2, r); } music_stream_state.queued_secondary_track = t + 40000; f2049f0_28e9c8(0); diff --git a/src/overlays/shared/gameplay/state/002418b0.c b/src/overlays/shared/gameplay/state/002418b0.c index 47f0b4a287..3c0e201b1f 100644 --- a/src/overlays/shared/gameplay/state/002418b0.c +++ b/src/overlays/shared/gameplay/state/002418b0.c @@ -11,7 +11,8 @@ extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); -float FUN_L04_002418b0(int a, unsigned int b) { +float animation_start(int a, unsigned int b) __asm__("FUN_L04_002418b0"); +float animation_start(int a, unsigned int b) { char *entry; char *nested; if (b >= 0xFF) @@ -22,7 +23,8 @@ float FUN_L04_002418b0(int a, unsigned int b) { } /* Ported from rac1-decomp (src/overlays/shared/mobyfunc_00242868.c: func_L04_002428C8), where it is exact; names translated to the US level program. */ -float FUN_L04_00241910(int a, unsigned int b) { +float animation_end(int a, unsigned int b) __asm__("FUN_L04_00241910"); +float animation_end(int a, unsigned int b) { char *entry; char *nested; if (b >= 0xFF) diff --git a/src/overlays/shared/gameplay/state/0024eec0.c b/src/overlays/shared/gameplay/state/0024eec0.c index faba9fb174..4ef792239c 100644 --- a/src/overlays/shared/gameplay/state/0024eec0.c +++ b/src/overlays/shared/gameplay/state/0024eec0.c @@ -23,6 +23,7 @@ void transpose_rotation_matrix(Mtx *, void *) __asm__("FUN_001fa2d8"); void subtract_vector_xyz(Vec4 *, void *, void *) __asm__("FUN_001f9a28"); void transform_vector(Vec4 *, Vec4 *, Mtx *) __asm__("FUN_001f9d20"); void fast_vec_scale(Vec4 *, Vec4 *, float) __asm__("FUN_001f9a68"); +void FUN_L00_0024eed8(char *p, int idx, void *v, float a, float b); void FUN_L00_0024eed8(char *p, int idx, void *v, float a, float b) { Mtx m; Vec4 t; @@ -43,6 +44,7 @@ void FUN_L00_0024eed8(char *p, int idx, void *v, float a, float b) { /* Ported from rac1-decomp (src/overlays/shared/mobyfunc_0024FD50.c: func_L00_0024FFE8), where it is exact; names translated to the US level program. */ /* Offsets the point pairs of each of the a[4] + a[5] entries by dx, dy. */ +void FUN_L00_0024efb0(unsigned char *a, int dx, int dy); void FUN_L00_0024efb0(unsigned char *a, int dx, int dy) { int i; int n = a[4] + a[5]; diff --git a/src/overlays/shared/gameplay/state/00250a78.c b/src/overlays/shared/gameplay/state/00250a78.c index ac0a52f0ba..b9c7b79da8 100644 --- a/src/overlays/shared/gameplay/state/00250a78.c +++ b/src/overlays/shared/gameplay/state/00250a78.c @@ -10,7 +10,8 @@ extern float square_root(float) __asm__("FUN_001f9988"); -void FUN_L03_00250a78(float *p, float a, float b) { +void trooper_set_knockback(float *p, float a, float b) __asm__("FUN_L03_00250a78"); +void trooper_set_knockback(float *p, float a, float b) { float root = square_root((b + b) * p[4]); float x = (root + root) / p[4]; p[7] = root; diff --git a/src/overlays/shared/gameplay/state/00261968.c b/src/overlays/shared/gameplay/state/00261968.c index 4b8793bf13..97c47ae339 100644 --- a/src/overlays/shared/gameplay/state/00261968.c +++ b/src/overlays/shared/gameplay/state/00261968.c @@ -103,6 +103,7 @@ extern void lerp_vector(void *, void *, void *, f32) __asm__("func_001F9A40"); extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("func_001F9CF8"); +int FUN_L00_00261b48(int idx, void *a, void *b, void *c); int FUN_L00_00261b48(int idx, void *a, void *b, void *c) { float v[4], w[4], z[4], t[4], u[4]; float best; @@ -542,7 +543,8 @@ float FUN_L00_0025bc98_2628d8(void *, void *, float, float, float, float, void FUN_L00_00259f50_2628d8(void *, void *) __asm__("FUN_L00_00259f50"); void FUN_001f99f8_2628d8(void *) __asm__("FUN_001f99f8"); -void FUN_L00_002628d8(void *m, unsigned char *p, int c, float fa, float fb) { +void update_joint_animation(void *m, unsigned char *p, int c, float fa, float fb) __asm__("FUN_L00_002628d8"); +void update_joint_animation(void *m, unsigned char *p, int c, float fa, float fb) { unsigned char *o = *(unsigned char **)(p + 0x78); float f; if (!o) { diff --git a/src/overlays/shared/gameplay/state/00263a28.c b/src/overlays/shared/gameplay/state/00263a28.c index e4bb437454..3f0d12144e 100644 --- a/src/overlays/shared/gameplay/state/00263a28.c +++ b/src/overlays/shared/gameplay/state/00263a28.c @@ -7,12 +7,14 @@ extern void rotation_matrix_263a28(void *matrix, void *rotation) __asm__("FUN_001fa050"); extern void apply_matrix_263a28(void *out, void *in, void *matrix) __asm__("FUN_001f9d20"); extern void scale_joint_263a28(float scale, void *out, void *joint) __asm__("FUN_001f9a80"); -extern void update_joints_263a28(void *moby, short joint, int flags) __asm__("FUN_0020fa90"); +extern void FUN_0020fa90(void *moby, short joint, int flags); /* Joint positions in scratchpad, 16 bytes each. */ #define JOINT_POSITIONS 0x70000000 -int FUN_L01_00263a28(char *moby, int index, unsigned int *type, float *result, +int rig_probe_setup(char *moby, int index, unsigned int *type, float *result, + float *radius, float *distance) __asm__("FUN_L01_00263a28"); +int rig_probe_setup(char *moby, int index, unsigned int *type, float *result, float *radius, float *distance) { char *entry; @@ -46,7 +48,7 @@ int FUN_L01_00263a28(char *moby, int index, unsigned int *type, float *result, } else if (*type == 2) { short joint = *(short *)(*(char **)(moby + 0x94) + 2); if (joint != 0) { - update_joints_263a28(moby, joint, 0); + FUN_0020fa90(moby, joint, 0); } qcopy(result, (void *)(JOINT_POSITIONS + *(int *)(entry + 4) * 0x10)); fast_vec_scale(result, result, scale); @@ -58,7 +60,7 @@ int FUN_L01_00263a28(char *moby, int index, unsigned int *type, float *result, } else if (*type == 4) { short joint = *(short *)(*(char **)(moby + 0x94) + 2); if (joint != 0) { - update_joints_263a28(moby, joint, 0); + FUN_0020fa90(moby, joint, 0); } joints = (short *)(entry + 4); scale_joint_263a28(scale, first, (void *)(JOINT_POSITIONS + joints[0] * 0x10)); diff --git a/src/overlays/shared/gameplay/state/00276a48.c b/src/overlays/shared/gameplay/state/00276a48.c index 009da581d1..a6b5dfdb7d 100644 --- a/src/overlays/shared/gameplay/state/00276a48.c +++ b/src/overlays/shared/gameplay/state/00276a48.c @@ -88,7 +88,9 @@ s32 FUN_L01_00276a48(s32 *ids, s32 n, f32 radius, s32 path_index, OvlVec4 *pos) } extern f32 vec_distance_276fe8(OvlVec4 *, OvlVec4 *) __asm__("FUN_001f9b80"); -s32 FUN_L01_00276fe8(s32 *ids, s32 n, s32 path_index, f32 radius, +s32 follow_path(s32 *ids, s32 n, s32 path_index, f32 radius, + OvlVec4 *pos, OvlVec4 *target, OvlVec4 *out) __asm__("FUN_L01_00276fe8"); +s32 follow_path(s32 *ids, s32 n, s32 path_index, f32 radius, OvlVec4 *pos, OvlVec4 *target, OvlVec4 *out) { OvlVec4 side; OvlVec4 left; diff --git a/src/overlays/shared/gameplay/state/00284e50.c b/src/overlays/shared/gameplay/state/00284e50.c index 557906750d..1d746af5fb 100644 --- a/src/overlays/shared/gameplay/state/00284e50.c +++ b/src/overlays/shared/gameplay/state/00284e50.c @@ -20,7 +20,8 @@ extern char D_0013E550[]; extern void copy_memory_aligned(int, void *, unsigned short) __asm__("FUN_001f9838"); extern s32 D_0014C190_257218[][64] __asm__("D_0014C190"); -void FUN_L00_00284e50(OvlQuad *a, OvlQuad *b) { +void jet_reset_camera(OvlQuad *a, OvlQuad *b) __asm__("FUN_L00_00284e50"); +void jet_reset_camera(OvlQuad *a, OvlQuad *b) { unsigned char *src; int i; char *s; diff --git a/src/overlays/shared/gameplay/state/unlock_planet.c b/src/overlays/shared/gameplay/state/unlock_planet.c index aeb98373b1..8329f46983 100644 --- a/src/overlays/shared/gameplay/state/unlock_planet.c +++ b/src/overlays/shared/gameplay/state/unlock_planet.c @@ -91,6 +91,7 @@ int FUN_L00_0025fcb8(char *a, char *o, float best) { } extern int FUN_00214720_25ff38(void *, int) __asm__("FUN_00214720"); extern int FUN_L00_00259740_25ff38(void *, void *, int) __asm__("FUN_L00_00259740"); +int FUN_L00_0025ff38(char *a, char *o, float best, int *list, int n, float *v, int nv); int FUN_L00_0025ff38(char *a, char *o, float best, int *list, int n, float *v, int nv) { struct Hero *g = &hero_lui; char *m; @@ -200,16 +201,17 @@ int FUN_L00_0025ff38(char *a, char *o, float best, int *list, int n, float *v, i return res; } typedef float M4_260400[16] __attribute__((aligned(16))); -extern char *c338_p(char *) __asm__("FUN_L00_002603d0"); +extern char *FUN_L00_002603d0_c(char *) __asm__("FUN_L00_002603d0"); void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); void multiply_matrix(void *, void *, void *) __asm__("FUN_001fa378"); void matrix_to_euler(void *, void *) __asm__("FUN_00214598"); +int FUN_L00_00260400(int u0, char *a, void *b, void *c, float *v, void *out); int FUN_L00_00260400(int u0, char *a, void *b, void *c, float *v, void *out) { M4_260400 m, n; - char *o = c338_p(a); + char *o = FUN_L00_002603d0_c(a); if (o == 0) return 0; euler_rotation_matrix(m, o); @@ -235,6 +237,7 @@ void FUN_00214598_002604f0(void *, void *) __asm__("FUN_00214598"); void FUN_L00_00260668_002604f0(void *, void *, void *, void *, void *, void *) __asm__("FUN_L00_00260668"); void FUN_L00_0025f730_002604f0(void *, float) __asm__("FUN_L00_0025f730"); +int FUN_L00_002604f0(u8 *a, u8 *b, void *c, void *d, void *e, void *f); int FUN_L00_002604f0(u8 *a, u8 *b, void *c, void *d, void *e, void *f) { float m2[16] __attribute__((aligned(16))); float m[16] __attribute__((aligned(16))); @@ -274,6 +277,7 @@ extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void multiply_matrix(void *, void *, void *) __asm__("FUN_001fa378"); extern void matrix_to_euler(void *, void *) __asm__("FUN_00214598"); +int FUN_L00_00260668(int x, char *o, float *a, float *c, float *b, float *d); int FUN_L00_00260668(int x, char *o, float *a, float *c, float *b, float *d) { float m[16]; float v[4]; @@ -295,7 +299,8 @@ void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); void multiply_matrix(void *, void *, void *) __asm__("FUN_001fa378"); void matrix_to_euler(void *, void *) __asm__("FUN_00214598"); #include "qcopy.h" -void FUN_L00_00260738(char *out, OvlQuad *pos, void *m1, void *m2) { +void update_entity_matrix(char *out, OvlQuad *pos, void *m1, void *m2) __asm__("FUN_L00_00260738"); +void update_entity_matrix(char *out, OvlQuad *pos, void *m1, void *m2) { M4 a, b, c; euler_rotation_matrix(a, m1); transpose_rotation_matrix(a, a); @@ -346,6 +351,7 @@ extern int D_00141414 __attribute__((section(".data"))); extern void queue_dialogue_message(int arg0, int arg1) __asm__("FUN_L00_00263d40"); extern u8 D_0015EDD0_257218[] __asm__("D_0015EDD0") __attribute__((section(".sdata"))); +void FUN_L00_00260860(int id, int flag); void FUN_L00_00260860(int id, int flag) { unsigned char *pa = &D_0013D4C0[id]; unsigned char *pb = &items_acquired[id]; @@ -444,6 +450,7 @@ extern void FUN_001eb078_260a88(int, ...) __asm__("FUN_001e93b0"); extern float FUN_00200240_260a88(int) __asm__("FUN_001fa6c0"); extern double FUN_00120478_260a88(float) __asm__("FUN_00120478"); +void FUN_L00_00260a88(char *moby, int lower, int upper, unsigned int flags, int path_index); void FUN_L00_00260a88(char *moby, int lower, int upper, unsigned int flags, int path_index) { Vec_260a88 base, position, velocity, offset, adjusted, difference, quarter; float crossings[2]; diff --git a/src/overlays/shared/gameplay/vendor/0029ead8.c b/src/overlays/shared/gameplay/vendor/0029ead8.c index 8e35d0594e..3d06cea614 100644 --- a/src/overlays/shared/gameplay/vendor/0029ead8.c +++ b/src/overlays/shared/gameplay/vendor/0029ead8.c @@ -146,7 +146,8 @@ extern s32 D_L00_00161220 __attribute__((sda)); extern f32 square_root(f32) __asm__("FUN_001f9988"); extern f32 absolute_float(f32) __asm__("FUN_001f99c0"); #define NEIGHBOUR(k) (grids + tile->neighbours[k]) -void FUN_L00_002a3ec8(HeightTile *grids, s32 count, s32 mode, f32 x, f32 z, f32 radius, f32 amount) +void pool_splash(HeightTile *grids, s32 count, s32 mode, f32 x, f32 z, f32 radius, f32 amount) __asm__("FUN_L00_002a3ec8"); +void pool_splash(HeightTile *grids, s32 count, s32 mode, f32 x, f32 z, f32 radius, f32 amount) { HeightTile *tile = grids; s32 k, i, j, row_first, row_last, col_first, col_last; diff --git a/src/overlays/shared/gameplay/vendor/002b7ef0.c b/src/overlays/shared/gameplay/vendor/002b7ef0.c index 90bd147c79..ab88e60b31 100644 --- a/src/overlays/shared/gameplay/vendor/002b7ef0.c +++ b/src/overlays/shared/gameplay/vendor/002b7ef0.c @@ -5,7 +5,8 @@ extern float D_L01_001CAE60[]; -void FUN_L01_002b7ef0(float s) { +void pool_set_scale(float s) __asm__("FUN_L01_002b7ef0"); +void pool_set_scale(float s) { unsigned int i; float k = s / D_L01_001CAE60[16]; for (i = 0; i < 0x5C; i++) { @@ -48,7 +49,8 @@ extern void FUN_L01_00261d78(char *, char *, char *, float); extern void func_L01_002B90E8_2B9198(void) __asm__("FUN_L01_002b7f30"); extern short D_L01_00161224 __attribute__((sda)); -void FUN_L01_002b7fe0(char *p, int n) { +void pool_flush(char *p, int n) __asm__("FUN_L01_002b7fe0"); +void pool_flush(char *p, int n) { if (1.0f - pool_light[8] <= *(float *)&D_L01_00161224) { *(float *)&D_L01_00161224 = pool_light[8]; func_L01_002B90E8_2B9198(); @@ -117,8 +119,15 @@ void FUN_L01_002b80d0(float *m) { } } } -extern void FUN_L00_002a3ec8(void *, int, int); +extern void pool_splash(void *, int, int) __asm__("FUN_L00_002a3ec8"); -void FUN_L01_002b8288(void *a, int b) { - FUN_L00_002a3ec8(a, b, 0); +void pool_ripple(void *a, int b) __asm__("FUN_L01_002b8288"); +void pool_ripple(void *a, int b) { + pool_splash(a, b, 0); } + +f32 D_L05_001CAFE0[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_001CABE0[1] __attribute__((section(".data"))) = {0}; +f32 D_L11_001CB560[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_001CAFE0[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_001CAE60[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/gameplay/vendor/002de370.c b/src/overlays/shared/gameplay/vendor/002de370.c index 70d477f65e..c27b38ab30 100644 --- a/src/overlays/shared/gameplay/vendor/002de370.c +++ b/src/overlays/shared/gameplay/vendor/002de370.c @@ -15,7 +15,7 @@ extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); -extern int FUN_001f9740(int *arg0); +extern int fast_dec_timer(int *arg0) __asm__("FUN_001f9740"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern void FUN_L00_001ff290(void *, void *, void *); void mark_moby_for_removal(struct Obj *obj) __asm__("FUN_0020c828"); @@ -34,7 +34,7 @@ void FUN_L03_002de370(char *moby) { float b = convert_integer_to_float(*(int *)(d + 0x20)); moby[0x23] = func_001FA898_r(a * 255.0f / b); } - if (FUN_001f9740((int *)(d + 0x24)) != 0) { + if (fast_dec_timer((int *)(d + 0x24)) != 0) { mark_moby_for_removal(moby); } } @@ -92,7 +92,7 @@ void FUN_L03_002e8628(char *cam) { extern f32 approximate_arcsine(f32) __asm__("func_001F9DF8"); extern f32 dot_vectors_xyz(void *, void *) __asm__("func_001F9AB0"); extern float D_L03_00166F30[]; -extern float FUN_L00_001eb328(void *, float, float, float, float, float); +extern float rope_spring_turn(void *, float, float, float, float, float) __asm__("FUN_L00_001eb328"); extern void FUN_L03_0024e6f8(float, float *, float *, float *, int); extern void cross_vectors_xyz(void *, void *, void *) __asm__("func_001F9AD8"); extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); @@ -111,7 +111,7 @@ void FUN_L03_002e8730(char *m) { subtract_vector_xyz(direction, position, m + 0x30); normalize_vector_xyz(direction, direction, 1.0f); angle = approximate_arcsine(dot_vectors_xyz(direction, m)); - t = FUN_L00_001eb328(data, 0.0f, 1.57079637f - angle, *(float *)(data + 4), + t = rope_spring_turn(data, 0.0f, 1.57079637f - angle, *(float *)(data + 4), *(float *)(data + 8), *(float *)(data + 12)); FUN_L03_0024e6f8(t, (float *)m, (float *)result, direction, 1); normalize_vector_xyz(result, m, 1.0f); diff --git a/src/overlays/shared/gameplay/vendor/002e3de8.c b/src/overlays/shared/gameplay/vendor/002e3de8.c index 021a5c25d4..195c64114b 100644 --- a/src/overlays/shared/gameplay/vendor/002e3de8.c +++ b/src/overlays/shared/gameplay/vendor/002e3de8.c @@ -14,7 +14,7 @@ extern float fast_sin(float) __asm__("FUN_001f9de0"); extern float random_angle_radians(void) __asm__("FUN_00213308"); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); -extern void FUN_001f9a10(float *, float *, float *); +extern void fast_vec_add(float *, float *, float *) __asm__("FUN_001f9a10"); extern void FUN_L01_00287158(float *, float, float, int, int, int); extern short D_L10_00161E58 __attribute__((sda)); @@ -35,7 +35,7 @@ void FUN_L10_002e3de8(char *moby) { v[0] = fast_cos(a) * b; v[1] = fast_sin(a) * b; v[2] = 0.0f; - FUN_001f9a10(v, v, (float *)(moby + 0x10)); + fast_vec_add(v, v, (float *)(moby + 0x10)); v[2] = v[2] + 0.025f; g = *(int *)&D_L10_00161E58; h = *(int *)&D_L10_00161E5C; diff --git a/src/overlays/shared/gameplay/vendor/002e8540.c b/src/overlays/shared/gameplay/vendor/002e8540.c index d15173961d..128e9ac7e2 100644 --- a/src/overlays/shared/gameplay/vendor/002e8540.c +++ b/src/overlays/shared/gameplay/vendor/002e8540.c @@ -15,7 +15,8 @@ void FUN_L00_002e8540(float f) { } typedef struct { char b[0x140]; } Pane_2e3fa0; extern char *D_L00_00166E00_002e8590[] __asm__("D_L00_00166E00"); -void FUN_L00_002e85d8(float a, float b) { +void follow_camera_set_up_spring(float a, float b) __asm__("FUN_L00_002e85d8"); +void follow_camera_set_up_spring(float a, float b) { char *p = D_L00_00166E00_002e8590[0]; if (*(short *)(p + 0x86) == 0) { char *q = *(char **)(p + 0x70) + 0x40; @@ -30,6 +31,7 @@ void FUN_L00_002e85d8(float a, float b) { extern char *D_L00_00166E00 __attribute__((section(".data"))); extern char *FUN_L00_001eb1f8(int); +void FUN_L00_002eaa30(char *src); void FUN_L00_002eaa30(char *src) { char *g = D_L00_00166E00; char *p; diff --git a/src/overlays/shared/gameplay/vendor/003015d0.c b/src/overlays/shared/gameplay/vendor/003015d0.c index 4fa0741b45..e263a36e96 100644 --- a/src/overlays/shared/gameplay/vendor/003015d0.c +++ b/src/overlays/shared/gameplay/vendor/003015d0.c @@ -34,13 +34,13 @@ typedef struct { u8 pad40[0x40]; } VendorBeamFrame; -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern float vector_length_xyz(void *); extern VendorBeamFrame *D_L14_001600EC; extern int D_L14_001620C8; /* no foreign declaration */ extern int D_L14_001620D8_t; /* no foreign declaration */ -extern int FUN_001f9770(void *); -extern int FUN_001fa728(void *, float); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +extern int fast_bsphere_check(void *, float) __asm__("FUN_001fa728"); extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void FUN_L14_003017f8(char *); extern void FUN_L14_00301de8(char *); @@ -62,7 +62,7 @@ void FUN_L14_003015d0(unsigned char *m) { if (m[0x20] != 0) { qcopy(v, m + 0x10); v[3] = d->f624; - if (FUN_001fa728(v, 52.0f) < 0) { + if (fast_bsphere_check(v, 52.0f) < 0) { return; } } @@ -88,14 +88,14 @@ void FUN_L14_003015d0(unsigned char *m) { } break; case 2: - if (FUN_001f9770(&d->s10) != 0) { + if (fast_dec_timer_s16(&d->s10) != 0) { m[0x20] = 3; d->s10 = scale_game_frames(d->s4); FUN_L14_003017f8((char *)m); } break; case 3: - if (FUN_001f9770(&d->s10) != 0) { + if (fast_dec_timer_s16(&d->s10) != 0) { if (d->s6 != 0) { m[0x20] = 2; arg = d->s6; @@ -109,7 +109,7 @@ void FUN_L14_003015d0(unsigned char *m) { break; } if (D_L14_001620D8 == 0) { - if (FUN_001f9b80(m + 0x10, &hero.motion.pos) < 10.0f) { + if (vector_distance(m + 0x10, &hero.motion.pos) < 10.0f) { FUN_L14_00302538((char *)m); } } @@ -138,8 +138,8 @@ extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void scale_vector_xyz(void *, void *, float) __asm__("FUN_001f9a68"); extern void set_vector_xyz(void *, float, float) __asm__("FUN_L00_00257d78"); extern void transform_vector(void *, void *, void *) __asm__("FUN_001f9d20"); -extern float FUN_001f9b80(void *, void *); -extern void FUN_001fa050(void *, void *) __asm__("FUN_001fa050"); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); +extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); extern void *spawn_spark(void *, void *, void *, int, int, int, int, int, int) __asm__("FUN_00218888"); extern float D_0015ED6C; extern int D_L14_001620BC __attribute__((sda)); @@ -243,8 +243,8 @@ void FUN_L14_003017f8(char *m) { } } } - if (FUN_001f9b80(&D_L14_001600EC[*(int *)d].origin, D_L14_001674C0) >= 4.0f) { - FUN_001fa050(matrix, &D_L14_001600EC[*(int *)d].pad40[0x30]); + if (vector_distance(&D_L14_001600EC[*(int *)d].origin, D_L14_001674C0) >= 4.0f) { + euler_rotation_matrix(matrix, &D_L14_001600EC[*(int *)d].pad40[0x30]); qcopy(origin, &D_L14_001600EC[*(int *)d].origin); { int i; @@ -344,8 +344,8 @@ typedef struct { u64 gs_state; } VendorBeamStripPacket; -extern void FUN_001fa050(void *, void *) __asm__("FUN_001fa050"); -extern void FUN_001fa2d8(void *, void *) __asm__("FUN_001fa2d8"); +extern void euler_rotation_matrix(void *, void *) __asm__("FUN_001fa050"); +extern void transpose_rotation_matrix(void *, void *) __asm__("FUN_001fa2d8"); extern void transform_vector_xyz(void *, void *, void *) __asm__("FUN_001f9cf8"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); @@ -386,8 +386,8 @@ void FUN_L14_00301fa8(char *m) { int next; int branch_next; - FUN_001fa050(base, &frame->pad40[0x30]); - FUN_001fa2d8(matrix, base); + euler_rotation_matrix(base, &frame->pad40[0x30]); + transpose_rotation_matrix(matrix, base); frame = &D_L14_001600EC[*(int *)d]; qcopy(base + 12, &frame->origin); subtract_vector_xyz(direction, D_L14_001674C0, &frame->origin); @@ -523,7 +523,7 @@ extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void scale_vector_xyz(void *, void *, f32) __asm__("FUN_001f9a68"); extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); extern f32 dot_vectors_xyz(void *, void *) __asm__("FUN_001f9ab0"); -extern int FUN_001efa68(void *, void *, int, void *, void *); +extern int collision_line(void *, void *, int, void *, void *) __asm__("FUN_001efa68"); /* Sweeps the beam's two end lines; anything they cross takes damage pushed away from the beam. */ void FUN_L14_00302538(char *self) { @@ -560,7 +560,7 @@ void FUN_L14_00302538(char *self) { qcopy_nc(&base, &D_L14_001600EC[d->w0].origin); if (d->s8) { add_vector_xyz(&end_a, &base, &D_L14_001600EC[d->w0].axis[1]); - if (FUN_001efa68(&base, &end_a, 0, m, 0)) { + if (collision_line(&base, &end_a, 0, m, 0)) { subtract_vector_xyz(&from, D_L14_00174560, &base); len = vector_length_xyz(&from); scale_vector_xyz(&from, &from, len * 0.98f / len); @@ -572,7 +572,7 @@ void FUN_L14_00302538(char *self) { } if (d->sA) { subtract_vector_xyz(&end_b, &base, &D_L14_001600EC[d->w0].axis[1]); - if (FUN_001efa68(&base, &end_b, 0, m, 0)) { + if (collision_line(&base, &end_b, 0, m, 0)) { subtract_vector_xyz(&from, D_L14_00174560, &base); len = vector_length_xyz(&from); scale_vector_xyz(&from, &from, len * 0.98f / len); @@ -587,17 +587,17 @@ void FUN_L14_00302538(char *self) { normalize_vector_xyz(&off, &D_L14_001600EC[d->w0].axis[0], d->radius); add_vector_xyz(&from, &end_a, &off); add_vector_xyz(&to, &end_b, &off); - FUN_001efa68(&from, &to, 1, m, &req); + collision_line(&from, &to, 1, m, &req); subtract_vector_xyz(&from, &end_a, &off); subtract_vector_xyz(&to, &end_b, &off); - FUN_001efa68(&from, &to, 1, m, &req); + collision_line(&from, &to, 1, m, &req); normalize_vector_xyz(&off, &D_L14_001600EC[d->w0].axis[2], d->radius); add_vector_xyz(&from, &end_a, &off); add_vector_xyz(&to, &end_b, &off); - FUN_001efa68(&from, &to, 1, m, &req); + collision_line(&from, &to, 1, m, &req); subtract_vector_xyz(&from, &end_a, &off); subtract_vector_xyz(&to, &end_b, &off); - FUN_001efa68(&from, &to, 1, m, &req); + collision_line(&from, &to, 1, m, &req); } #include "sda.h" diff --git a/src/overlays/shared/gameplay/vendor/00307190.c b/src/overlays/shared/gameplay/vendor/00307190.c index 86283d99e9..1616a17dd1 100644 --- a/src/overlays/shared/gameplay/vendor/00307190.c +++ b/src/overlays/shared/gameplay/vendor/00307190.c @@ -14,11 +14,12 @@ /* Ported from rac1-decomp (src/overlays/shared/vendor_002D3DF8.c: func_L08_00308650), where it is exact; names translated to the US level program. */ extern char *func_0020D348_m(int); -extern float FUN_001f9b20(void *); +extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void FUN_L00_00250df8(void *); +char *FUN_L08_00307190(char *pos, char *dir, int a2, int a3, int a4, int a5); char *FUN_L08_00307190(char *pos, char *dir, int a2, int a3, int a4, int a5) { char *m = func_0020D348_m(0x50C); if (m != 0) { @@ -30,13 +31,13 @@ char *FUN_L08_00307190(char *pos, char *dir, int a2, int a3, int a4, int a5) { m[0x20] = 1; qcopy(m + 0x10, dir); qcopy(d, pos); - *(int *)(d + 0x18) = FUN_001f96f8(a4); + *(int *)(d + 0x18) = scale_game_frames(a4); *(int *)(d + 0x10) = a2; *(int *)(d + 0x14) = a3; *(int *)(d + 0x2C) = a5; *(int *)(d + 0x28) = 0; *(float *)(m + 0x48) = fast_arc_tan(*(float *)d, *(float *)(d + 4)); - *(float *)(m + 0x44) = -fast_arc_tan(FUN_001f9b20(d), *(float *)(d + 8)); + *(float *)(m + 0x44) = -fast_arc_tan(vector_length_xy(d), *(float *)(d + 8)); FUN_L00_00250df8(m); } return m; @@ -46,13 +47,13 @@ char *FUN_L08_00307190(char *pos, char *dir, int a2, int a3, int a4, int a5) { extern char D_L08_00174640[]; extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); -extern int FUN_001efa68(void *, void *, int, int, int); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); extern int fast_dec_timer(int *) __asm__("FUN_001f9740"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); extern void FUN_L00_001ff290(void *, void *, void *); -extern void FUN_L00_00259bc8(void *, int, int, void *, void *, float); -extern void FUN_L00_0025f090(void *, void *, int, float, float); +extern void spawn_nearby_effect(void *, int, int, void *, void *, float) __asm__("FUN_L00_00259bc8"); +extern void cart_burst(void *, void *, int, float, float) __asm__("FUN_L00_0025f090"); extern void FUN_L00_00269958(void *, void *, int, int, int, int, int, int); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); @@ -85,11 +86,11 @@ void FUN_L08_00307298(char *m) { scale_game_frames(random_int_between(7, 0xA)), 1); } add_vector_xyz(m + 0x10, m + 0x10, d); - if (FUN_001efa68(m + 0x10, prev, 0x10, *(int *)(d + 0x10), 0) != 0) { + if (collision_line(m + 0x10, prev, 0x10, *(int *)(d + 0x10), 0) != 0) { char *t = D_L08_00174640; if (*(int *)(t + 0x18) != *(int *)(d + 0x10)) { if (*(int *)(t + 0x18) != 0) { - FUN_L00_00259bc8(*(void **)(t + 0x18), (int)m, 0x10001, t + 0x20, d, 1.0f); + spawn_nearby_effect(*(void **)(t + 0x18), (int)m, 0x10001, t + 0x20, d, 1.0f); } m[0x20] = 2; } @@ -99,9 +100,9 @@ void FUN_L08_00307298(char *m) { break; case 2: if ((D_L08_0015F5D4 < 0.85f && D_L08_0015F5D0 < 0.85f) || *(int *)(d + 0x2C) == 1) { - FUN_L00_0025f090(m, m + 0x10, -1, 0.25f, 13.0f); + cart_burst(m, m + 0x10, -1, 0.25f, 13.0f); } else { - FUN_L00_0025f090(m, m + 0x10, -1, 0.25f, 0.0f); + cart_burst(m, m + 0x10, -1, 0.25f, 0.0f); } mark_moby_for_removal(m); break; @@ -143,7 +144,7 @@ void FUN_L08_00307b90(int arg) { D_L08_00162370 = random_float_between_alt(b, multiply_global_factor_ed64(10.0f)); v[0] = a * frame_time; v[1] = v[0]; - t = FUN_001f9b20(D_L08_00162360) / fast_vec_length(v); + t = vector_length_xy(D_L08_00162360) / fast_vec_length(v); D_L08_00162374 = (int)(t * (c - d) + d); } #include "rnc/gameplay/entities/moby.h" @@ -174,11 +175,11 @@ extern float D_L08_00162348 __attribute__((sda)); extern float D_L08_00162354 __attribute__((sda)); extern int D_L08_00162358 __attribute__((sda)); extern float D_L08_0016235C __attribute__((sda)); -extern int FUN_L08_00211b08(); +extern int update_float_countdown() __asm__("FUN_L08_00211b08"); extern u128_3091B0 D_L08_00160250 __attribute__((section(".sdata"))); extern void FUN_L08_00272cb8(void *, void *, void *, float); extern void subtract_vector_xyz_c(void *, void *, void *) __asm__("FUN_001f9a28"); -float FUN_L00_00263468(Vec4 *v); +float ground_height_at(Vec4 *v) __asm__("FUN_L00_00263468"); void FUN_L00_00262cf0(void *a, void *b); void FUN_L00_002634f8(void *v); void FUN_L08_0027f5f0(void *pos, int kind, void *vel, float f); @@ -449,7 +450,6 @@ void FUN_L08_00313ba8(void) { INCLUDE_ASM("config/us/overlays/asm/FUN_L08_00316fa8.s", FUN_L08_00316fa8); #else extern void rotate_about_axis(void *, void *, void *, float) __asm__("FUN_00214890"); -extern float ground_height_at(void *) __asm__("FUN_L00_00263468"); extern int play_voice(int, int, void *, int) __asm__("FUN_L00_0028ddd8"); extern int set_voice_volume(int, int) __asm__("FUN_L01_002a1968"); extern float frame_delta_time __asm__("D_0015ED7C"); diff --git a/src/overlays/shared/math/interpolation/00258830.c b/src/overlays/shared/math/interpolation/00258830.c index 0ee8e4e4d6..d002baab48 100644 --- a/src/overlays/shared/math/interpolation/00258830.c +++ b/src/overlays/shared/math/interpolation/00258830.c @@ -15,14 +15,15 @@ extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); extern f32 vector_length_xyz(void *) __asm__("FUN_001f9af0"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern int D_L00_00173E40[]; -extern int FUN_001efa68(void *, void *, int, int, int); -extern int FUN_L00_001f0d60(); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); +extern int coll_sphere() __asm__("FUN_L00_001f0d60"); extern void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); extern void normalize_vector_xyz(void *, void *, f32) __asm__("FUN_001f9bf8"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern Vec4 D_94C8_60 __asm__("D_L00_00173E60"); extern int func_L00_001F10E0_l(void *, float, int, void *) __asm__("FUN_L00_001f0d60"); +int FUN_L00_00258830(char *moby, char *velocity, int flags, float step_height, float radius, float height); int FUN_L00_00258830(char *moby, char *velocity, int flags, float step_height, float radius, float height) { Vs old_pos; Vs ray_start; @@ -42,7 +43,7 @@ int FUN_L00_00258830(char *moby, char *velocity, int flags, float step_height, f normalize_vector_xyz(&reach, velocity, radius); add_vector_xyz(&ray_end, &reach, pos); ray_end.a[2] += step_height; - if (FUN_001efa68(&ray_start, &ray_end, coll_flags, (int)moby, 0)) { + if (collision_line(&ray_start, &ray_end, coll_flags, (int)moby, 0)) { subtract_vector_xyz(pos, (char *)&D_94C8_60, &reach); result = 1; *(float *)(moby + 0x18) -= step_height; @@ -64,7 +65,7 @@ int FUN_L00_00258830(char *moby, char *velocity, int flags, float step_height, f qcopy(&ray_end, position); ray_start.a[2] += step_height; ray_end.a[2] = radius - 0.05f; - if (FUN_001efa68(&ray_start, &ray_end, coll_flags | 2, (int)moby, 0)) { + if (collision_line(&ray_start, &ray_end, coll_flags | 2, (int)moby, 0)) { if (D_L00_00173E40[7] > 0) { float surface; result |= 2; diff --git a/src/overlays/shared/math/interpolation/0025b8c0.c b/src/overlays/shared/math/interpolation/0025b8c0.c index 60b3d34c55..f193518d94 100644 --- a/src/overlays/shared/math/interpolation/0025b8c0.c +++ b/src/overlays/shared/math/interpolation/0025b8c0.c @@ -11,7 +11,8 @@ extern void FUN_L00_0025b798(float *ptr, float rate, float b, float c, float limit); float absolute_float(float input) __asm__("func_001F99C0"); -float FUN_L00_0025b8c0(float *p, float *v, float t, float u1, float u2, float eps) { +float vendor_spring(float *p, float *v, float t, float u1, float u2, float eps) __asm__("FUN_L00_0025b8c0"); +float vendor_spring(float *p, float *v, float t, float u1, float u2, float eps) { float n, d; FUN_L00_0025b798(v, t - *p, u1, u2, eps); n = *p + *v; diff --git a/src/overlays/shared/math/interpolation/0025bb38.c b/src/overlays/shared/math/interpolation/0025bb38.c index 29f3b93bb4..34f042a6c4 100644 --- a/src/overlays/shared/math/interpolation/0025bb38.c +++ b/src/overlays/shared/math/interpolation/0025bb38.c @@ -22,16 +22,16 @@ float FUN_L00_0025bb38(int n, float x, float y) { return d - 6.2831855f; return d + 6.2831855f; } -extern float bb38_fif(float, void *, float) __asm__("FUN_L00_0025bb38"); +extern float FUN_L00_0025bb38_c(float, void *, float) __asm__("FUN_L00_0025bb38"); float fast_add_rotations(float, float) __asm__("FUN_001fa580"); void FUN_L00_0025bc00(float *p, void *o, float a, float lim) { - float r = bb38_fif(a, o, *p); + float r = FUN_L00_0025bb38_c(a, o, *p); if (lim < r) r = lim; else if (r < -lim) r = -lim; *p = fast_add_rotations(*p, r); - bb38_fif(a, o, *p); + FUN_L00_0025bb38_c(a, o, *p); } extern float FUN_L00_0025bb38_0025bc98(float, int, float) __asm__("FUN_L00_0025bb38"); extern void FUN_L00_0025b798_0025bc98(float *, float, float, float, @@ -39,6 +39,7 @@ extern void FUN_L00_0025b798_0025bc98(float *, float, float, float, extern float FUN_001fa580_0025bc98(float, float) __asm__("FUN_001fa580"); extern float FUN_001f99c0_0025bc98(float) __asm__("FUN_001f99c0"); +float FUN_L00_0025bc98(float *p, float *q, int n, float x, float a, float b, float c); float FUN_L00_0025bc98(float *p, float *q, int n, float x, float a, float b, float c) { float d; if (n == 2) { @@ -67,7 +68,8 @@ extern float FUN_001f9988_25be00(float) __asm__("FUN_001f9988"); extern float FUN_00213ed8_25be00(float, float, float *) __asm__("FUN_00213ed8"); extern void FUN_L00_0025bc00_25be00(float *, void *, float, float) __asm__("FUN_L00_0025bc00"); -float FUN_L00_0025be00(float *cur, float *vel, float target, float lim, float accel, float maxv) { +float approach_angle(float *cur, float *vel, float target, float lim, float accel, float maxv) __asm__("FUN_L00_0025be00"); +float approach_angle(float *cur, float *vel, float target, float lim, float accel, float maxv) { float d; float v; float stop; @@ -111,6 +113,7 @@ extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); /* Ported from rac1-decomp (src/overlays/shared/mobyutil_00258BC8.c: func_L00_0025D038), where it is exact; names translated to the US level program. */ +unsigned int FUN_L00_0025bfe0(float r, float g, float b, float a); unsigned int FUN_L00_0025bfe0(float r, float g, float b, float a) { unsigned int x = truncate_float_to_s32(r * 255.0f) & 0xFF; unsigned int y = truncate_float_to_s32(g * 255.0f) & 0xFF; @@ -155,6 +158,7 @@ void FUN_L00_0025c088(int *a, int *b, int *c, int mask) { extern void FUN_L00_0025c088(int *, int *, int *, int); /* Splits colour c into bytes, passes the low three through 0025c088 with mask, and repacks them. */ +unsigned FUN_L00_0025c0e8(unsigned c, int mask); unsigned FUN_L00_0025c0e8(unsigned c, int mask) { int v[3]; unsigned a; diff --git a/src/overlays/shared/math/interpolation/002650a8.c b/src/overlays/shared/math/interpolation/002650a8.c index 26d0b0c68c..8354da282e 100644 --- a/src/overlays/shared/math/interpolation/002650a8.c +++ b/src/overlays/shared/math/interpolation/002650a8.c @@ -9,7 +9,8 @@ /* Ported from rac1-decomp (src/overlays/shared/mobyutil_00266060.c: func_L13_00266060), where it is exact; names translated to the US level program. */ -void FUN_L13_002650a8(int idx, int a, int b, int c) { +void jet_group_state(int idx, int a, int b, int c) __asm__("FUN_L13_002650a8"); +void jet_group_state(int idx, int a, int b, int c) { short *list = D_L13_001ABB40[idx]; if (list) { short *p = list; diff --git a/src/overlays/shared/math/interpolation/0026d930.c b/src/overlays/shared/math/interpolation/0026d930.c index 14b1625778..e47f14212f 100644 --- a/src/overlays/shared/math/interpolation/0026d930.c +++ b/src/overlays/shared/math/interpolation/0026d930.c @@ -8,6 +8,7 @@ /* Ported from rac1-decomp (src/overlays/shared/mobyutil_0026E8E0.c: func_L01_0026E8E0), where it is exact; names translated to the US level program. */ +void FUN_L01_0026d930(char *p); void FUN_L01_0026d930(char *p) { *(int *)(p + 0x0) = 0x280; *(float *)(p + 0x4) = 1.0f; @@ -34,6 +35,7 @@ typedef struct { extern unsigned short *D_L01_001ABCC0_26e008[] __asm__("D_L01_001ABCC0") NOT_SDA; extern O_26e008 *D_L01_0015FFD8_26e008 __asm__("D_L01_0015FFD8"); +int FUN_L01_0026e008(int i, int st); int FUN_L01_0026e008(int i, int st) { unsigned short *p; int n = 0; @@ -57,6 +59,7 @@ int FUN_L01_0026e008(int i, int st) { extern char *D_L01_0015FFD8; extern unsigned short *D_L01_001ABCC0[]; +void FUN_L01_0026e090(int i, int v); void FUN_L01_0026e090(int i, int v) { unsigned short *t = D_L01_001ABCC0[i]; unsigned short *p; @@ -73,6 +76,7 @@ extern char *D_L01_0015FFD8_e0e0 __asm__("D_L01_0015FFD8"); * func_L01_0026F090), where it is exact; names translated to the US level * program. The datum needs the unsplit macro form here, so it is declared * through an alias (same symbol, .sdata) beside its neighbour's declaration. */ +void FUN_L01_0026e0e0(int list, int state); void FUN_L01_0026e0e0(int list, int state) { unsigned short *p; unsigned short *q = (unsigned short *)D_L01_001ABCC0[list]; diff --git a/src/overlays/shared/math/interpolation/spring_turn.c b/src/overlays/shared/math/interpolation/spring_turn.c index b5990feae3..c7b23364e9 100644 --- a/src/overlays/shared/math/interpolation/spring_turn.c +++ b/src/overlays/shared/math/interpolation/spring_turn.c @@ -8,14 +8,14 @@ /* Ported from rac1-decomp (src/overlays/shared/mobyutil_00258BC8.c: func_L00_00258F28), where it is exact; names translated to the US level program. */ -extern float FUN_001f9dc8(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); /* Cosine-eased rotation from x toward y at z. */ float FUN_L00_00257ef0(float x, float y, float z) { float t = fast_subtract_rotations(y, x); - float c = FUN_001f9dc8(z * 3.1415927f); + float c = fast_cos(z * 3.1415927f); return fast_add_rotations(x, t * ((1.0f - c) * 0.5f)); } #include "qcopy.h" @@ -51,13 +51,13 @@ void FUN_L00_00257f70(void *dst, void *a, void *b, float t) { /* Ported from rac1-decomp (src/overlays/shared/mobyutil_00258BC8.c: func_L00_00259088), where it is exact; names translated to the US level program. */ -extern float FUN_001f9dc8(float); +extern float fast_cos(float) __asm__("FUN_001f9dc8"); extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); /* Blends three angles from a toward b with a cosine ease; ang 0 gives a, 1 gives b. */ void FUN_L00_00258050(float *out, float *a, float *b, float ang) { - float s = (1.0f - FUN_001f9dc8(ang * 3.1415927f)) * 0.5f; + float s = (1.0f - fast_cos(ang * 3.1415927f)) * 0.5f; out[0] = fast_add_rotations(a[0], fast_subtract_rotations(b[0], a[0]) * s); out[1] = fast_add_rotations(a[1], fast_subtract_rotations(b[1], a[1]) * s); out[2] = fast_add_rotations(a[2], fast_subtract_rotations(b[2], a[2]) * s); @@ -88,6 +88,7 @@ float spring_turn(float *p, float a, float b, float c, float d, float lim) { } extern float FUN_001f99c0(float); +void FUN_L00_00258278(unsigned char *m, float *ptr, float t, float b, float c, float limit); void FUN_L00_00258278(unsigned char *m, float *ptr, float t, float b, float c, float limit) { float r = fast_subtract_rotations(t, *(float *)(m + 0x48)); float k = r / 0.15707964f; @@ -125,7 +126,7 @@ typedef struct { s32 x1c; } G002583f0; extern G002583f0 D_L00_00173E40_u __asm__("D_L00_00173E40"); -s32 FUN_001efa68(void *, void *, s32, s32, s32); +s32 collision_line(void *, void *, s32, s32, s32) __asm__("FUN_001efa68"); s32 FUN_L00_002583f0(void *pos, s32 a, s32 flag, f32 up, f32 down) { V002583f0 t0, t1; s32 r; @@ -135,7 +136,7 @@ s32 FUN_L00_002583f0(void *pos, s32 a, s32 flag, f32 up, f32 down) { t1.f[2] -= down; if (t1.f[2] < 0.0f) t1.f[2] = 0.0f; - r = FUN_001efa68(&t0, &t1, 0x22, a, 0); + r = collision_line(&t0, &t1, 0x22, a, 0); if (D_L00_00173E40_u.x1c < 0) r = 0; if (flag && D_L00_00173E40_u.x18 != 0) @@ -276,8 +277,8 @@ extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern float vector_length_xy(void *); extern float vector_length_xyz(void *); extern int D_L00_00173E40[]; -extern int FUN_001efa68(void *, void *, int, int, int); -extern int FUN_L00_001f0d60(); +extern int collision_line(void *, void *, int, int, int) __asm__("FUN_001efa68"); +extern int coll_sphere() __asm__("FUN_L00_001f0d60"); extern void add_vector_xyz(void *, void *, void *); extern void normalize_vector_xyz(void *, void *, float); extern void subtract_vector_xyz(void *, void *, void *); @@ -305,7 +306,7 @@ int FUN_L00_00258830_c(char *m, char *v, int flags, float a, float b, float c) { normalize_vector_xyz(&t3, v, b); add_vector_xyz(&t2, &t3, p); t2.a[2] += a; - if (FUN_001efa68(&t1, &t2, fl, (int)m, 0)) { + if (collision_line(&t1, &t2, fl, (int)m, 0)) { subtract_vector_xyz(p, (char *)&D_94C8_60, &t3); r = 1; *(float *)(m + 0x18) -= a; @@ -327,7 +328,7 @@ int FUN_L00_00258830_c(char *m, char *v, int flags, float a, float b, float c) { qcopy(&t2, q); t1.a[2] += a; t2.a[2] = b - 0.05f; - if (FUN_001efa68(&t1, &t2, fl | 2, (int)m, 0)) { + if (collision_line(&t1, &t2, fl | 2, (int)m, 0)) { if (D_L00_00173E40[7] > 0) { float g; r |= 2; @@ -345,11 +346,11 @@ int FUN_L00_00258830_c(char *m, char *v, int flags, float a, float b, float c) { subtract_vector_xyz(v, q, &t0); return r; } -float FUN_001fa6c0(int); +float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); void FUN_L00_00258830(int, int, float, float, float, int); /* Calls FUN_L00_00258830 with c converted to float and divided by 1024. */ void FUN_L00_00258ad0(int a, int b, float x, float y, int c, int d) { - FUN_L00_00258830(a, b, x, FUN_001fa6c0(c) * (1.0f / 1024.0f), y, d); + FUN_L00_00258830(a, b, x, convert_integer_to_float(c) * (1.0f / 1024.0f), y, d); } #include "rnc/math/vector.h" @@ -390,11 +391,11 @@ typedef struct { extern Glob D_L00_00173E40_c __asm__("D_L00_00173E40"); -extern void FUN_001f9a28(void *, void *, void *); -extern f32 FUN_001f9b20(void *); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); +extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); extern f32 FUN_001f9dc8_c(f32) __asm__("FUN_001f9dc8"); extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern s32 FUN_L00_002583f0_c(void *, void *, s32, f32, f32) __asm__("FUN_L00_002583f0"); extern f32 fast_arc_tan(f32, f32) __asm__("FUN_001f9e90"); extern void fast_vec_normalize(void *, void *, f32) __asm__("FUN_001f9bf8"); @@ -404,6 +405,7 @@ extern f32 probe_ground_height(void *, s32, f32) __asm__("FUN_00213508"); extern f32 frame_time_sq_gp __asm__("D_0015ED70") __attribute__((sda)); extern f32 frame_scale __asm__("D_0015ED60") __attribute__((sda)); +s32 FUN_L00_00258b50(Obj *m, Ctl *c, void *v, Vec4 *out, f32 f); s32 FUN_L00_00258b50(Obj *m, Ctl *c, void *v, Vec4 *out, f32 f) { Vec4 save; Vec4 d; @@ -424,8 +426,8 @@ s32 FUN_L00_00258b50(Obj *m, Ctl *c, void *v, Vec4 *out, f32 f) { sp = c->f1C * f; lim = c->f24 * f; - FUN_001f9a28(&d, v, &m->pos); - len = FUN_001f9b20(&d); + fast_vec_sub(&d, v, &m->pos); + len = vector_length_xy(&d); save.q = m->pos.q; t = sp * len; if (sp < t) @@ -451,20 +453,20 @@ s32 FUN_L00_00258b50(Obj *m, Ctl *c, void *v, Vec4 *out, f32 f) { c->f18 = c->f18 - frame_time_sq_gp * 9.0f; } lim = m->pos.f[2] + 0.04f; - FUN_001f9a10(&p, &m->pos, &d); + fast_vec_add(&p, &m->pos, &d); p.f[2] = m->pos.f[2] - c->f30; if (FUN_L00_002583f0_c(&p, m, c->i38 & 0x20, c->f08, c->f0C)) { g = &D_L00_00173E40_c; - a = fast_arc_tan(g->v40.f[2], FUN_001f9b20(&g->v40)); + a = fast_arc_tan(g->v40.f[2], vector_length_xy(&g->v40)); h1 = g->f28; - if (0.5f < a && 0.1f < FUN_001f9b20(&d)) { + if (0.5f < a && 0.1f < vector_length_xy(&d)) { { fast_vec_normalize(&q, &d, 0.57f); - FUN_001f9a10(&q, &q, &m->pos); + fast_vec_add(&q, &q, &m->pos); q.f[2] = m->pos.f[2] - c->f30; if (FUN_L00_002583f0_c(&q, m, c->i38 & 0x20, c->f08, c->f0C)) { h2 = g->f28; - if (!(0.5f <= fast_arc_tan(g->v40.f[2], FUN_001f9b20(&g->v40)))) + if (!(0.5f <= fast_arc_tan(g->v40.f[2], vector_length_xy(&g->v40)))) goto done; mask = 0x22; if (!(c->i38 & 8)) @@ -485,7 +487,7 @@ s32 FUN_L00_00258b50(Obj *m, Ctl *c, void *v, Vec4 *out, f32 f) { } done: if (!(mask & 2)) { - l2 = FUN_001f9b20(&d); + l2 = vector_length_xy(&d); FUN_001f9a68_c(&p, &d, 1.0f / l2); r = FUN_L00_00258ad0_c(m, &d, c->f04, c->i00, c->f30, c->i38); if (r & 2) @@ -519,6 +521,7 @@ int FUN_001f9740_259028(void *) __asm__("FUN_001f9740"); int FUN_001f96f8_259028(int) __asm__("FUN_001f96f8"); int FUN_L00_00258b50_259028(unsigned char *, char *, float *, void *, float) __asm__("FUN_L00_00258b50"); +int FUN_L00_00259028(unsigned char *m, char *c, float *tgt, void *out); int FUN_L00_00259028(unsigned char *m, char *c, float *tgt, void *out) { int r = 0; float a, d; @@ -549,7 +552,7 @@ extern char *D_L00_00160114; extern unsigned short *D_L00_0016010C_2591d0 __asm__("D_L00_0016010C"); extern short D_L00_00160110; extern char *D_L00_0015FFD8_2591d0 __asm__("D_L00_0015FFD8"); -int f2592b8_2591d0(char **, char *) __asm__("FUN_L00_002592b8"); +int FUN_L00_002592b8_c(char **, char *) __asm__("FUN_L00_002592b8"); /* Looks up table entry idx and makes it current; the flag test reads the * current entry back, as the original did. */ int FUN_L00_002591d0(char **out, int idx, int a, int b) { @@ -573,8 +576,8 @@ int FUN_L00_002591d0(char **out, int idx, int a, int b) { *out = e; c = (unsigned)(*(char *volatile *)&D_L00_00160114)[0x20] >> 31; if (!a) { - if (b || c) return f2592b8_2591d0(out, D_L00_00160114); - } else if (b && !c) return f2592b8_2591d0(out, D_L00_00160114); + if (b || c) return FUN_L00_002592b8_c(out, D_L00_00160114); + } else if (b && !c) return FUN_L00_002592b8_c(out, D_L00_00160114); return 0; } @@ -667,14 +670,14 @@ float FUN_L00_00259468(float *a, float *b, int *out, float f) { /* Ported from rac1-decomp (src/overlays/shared/mobyutil_00258BC8.c: func_L00_0025A540), where it is exact; names translated to the US level program. */ extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); void FUN_L00_00259508(void *a, void *b, void *c, int d, float f) { float t[4]; fast_vec_scale(t, c, convert_integer_to_float(d)); t[2] -= convert_integer_to_float((d * d + d) >> 1) * f; - FUN_001f9a10(a, b, t); + fast_vec_add(a, b, t); } float FUN_001f99c0(float); float square_root(float) __asm__("FUN_001f9988"); diff --git a/src/overlays/shared/math/rotations/0025d238.c b/src/overlays/shared/math/rotations/0025d238.c index 6145b683cd..7cde16790f 100644 --- a/src/overlays/shared/math/rotations/0025d238.c +++ b/src/overlays/shared/math/rotations/0025d238.c @@ -43,22 +43,23 @@ typedef struct { short hi; } S; int scale_game_frames(int) __asm__("FUN_001f96f8"); -float FUN_001fa6c0(int); +float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); -void FUN_L00_00250320(void *, int *, int *, int *); -void FUN_L00_0025d458(void *a, S *s) { +void get_moby_color(void *, int *, int *, int *) __asm__("FUN_L00_00250320"); +void trooper_anim_update(void *a, S *s) __asm__("FUN_L00_0025d458"); +void trooper_anim_update(void *a, S *s) { int old = s->cur; if (old == 0 || s->flag != 0) { s->cur = scale_game_frames(s->lo); s->flag = 0; if (old != 0) { int n = scale_game_frames(s->lo); - s->cur = truncate_float_to_s32(n * (old / FUN_001fa6c0(scale_game_frames(s->hi)))); + s->cur = truncate_float_to_s32(n * (old / convert_integer_to_float(scale_game_frames(s->hi)))); if (s->cur <= 0) s->cur = 1; } else { int x, y, z; - FUN_L00_00250320(a, &x, &y, &z); + get_moby_color(a, &x, &y, &z); s->r = x; s->g = y; s->b = z; @@ -79,7 +80,8 @@ s32 FUN_001fa6d0_25d538(f32) __asm__("FUN_001fa6d0"); s32 fast_dec_timer(void *) __asm__("FUN_001f9770"); s32 FUN_001f96f8_25d538(s32) __asm__("FUN_001f96f8"); void glow_n(s32, s32, s32, s32) __asm__("FUN_L00_002502f0"); -void FUN_L00_0025d538(s32 id, S_25d538 *s) { +void trooper_anim_finish(s32 id, S_25d538 *s) __asm__("FUN_L00_0025d538"); +void trooper_anim_finish(s32 id, S_25d538 *s) { f32 d, f; s32 r, g, b; if (s->t == 0) @@ -280,7 +282,7 @@ float FUN_L00_0025db00(float *out, float *p, OvlQuad *a, OvlQuad *b) { return FUN_001f9b80_25db00(p, out); } extern float fabs_25dcd8(float) __asm__("FUN_001f99c0"); -extern float db00_25dcd8(void *, void *, void *, void *) __asm__("FUN_L00_0025db00"); +extern float FUN_L00_0025db00_c(void *, void *, void *, void *) __asm__("FUN_L00_0025db00"); extern float dist_25dcd8(void *, void *) __asm__("FUN_001f9b80"); extern float dsq_25dcd8(void *, void *) __asm__("FUN_001f9b48"); extern void b6b8_25dcd8(void *, void *, void *, float) __asm__("FUN_L00_0025b6b8"); @@ -289,7 +291,8 @@ extern void vadd_25dcd8(void *, void *, void *) __asm__("FUN_001f9a10"); extern void vscl_25dcd8(void *, void *, float) __asm__("FUN_001f9bf8"); extern void scale_vector_xyz(void *, void *, float) __asm__("FUN_001f9a68"); extern float dot_25dcd8(void *, void *) __asm__("FUN_001f9ab0"); -extern float da70_25dcd8(void *, void *, float) __asm__("FUN_L00_0025da70"); +extern float FUN_L00_0025da70_c(void *, void *, float) __asm__("FUN_L00_0025da70"); +float FUN_L00_0025dcd8(OvlQuad *out, OvlQuad *p, OvlQuad *a, OvlQuad *b, float r); float FUN_L00_0025dcd8(OvlQuad *out, OvlQuad *p, OvlQuad *a, OvlQuad *b, float r) { OvlQuad d[2]; OvlQuad c[1]; @@ -300,7 +303,7 @@ float FUN_L00_0025dcd8(OvlQuad *out, OvlQuad *p, OvlQuad *a, OvlQuad *b, float r int i; if (r > 0.0f && fabs_25dcd8(((float *)p)[2] - ((float *)a)[2]) < r && fabs_25dcd8(((float *)p)[2] - ((float *)b)[2]) < r) { - res = db00_25dcd8(out, p, a, b); + res = FUN_L00_0025db00_c(out, p, a, b); r = dist_25dcd8(a, out); u = dist_25dcd8(a, b); d[0] = *a; @@ -339,13 +342,16 @@ float FUN_L00_0025dcd8(OvlQuad *out, OvlQuad *p, OvlQuad *a, OvlQuad *b, float r } e[0] = *p; g[0] = *out; - return da70_25dcd8(e, g, 0.0f); + return FUN_L00_0025da70_c(e, g, 0.0f); } extern f32 path_distance_25df68(void *, void *, f32) __asm__("FUN_L00_0025da70"); extern void clear_vector_25df68(void *) __asm__("FUN_001f99f8"); extern s32 sample_path(s32 *, OvlQuad *, s32 *, f32 *, f32, s32) __asm__("FUN_L00_0025d808"); +s32 FUN_L00_0025df68(s32 *path, OvlQuad *point, OvlQuad *nearest, + s32 *segment, f32 *fraction, s32 wrap, + f32 limit, f32 step, f32 height_tolerance); s32 FUN_L00_0025df68(s32 *path, OvlQuad *point, OvlQuad *nearest, s32 *segment, f32 *fraction, s32 wrap, f32 limit, f32 step, f32 height_tolerance) { @@ -438,16 +444,17 @@ s32 FUN_L00_0025df68(s32 *path, OvlQuad *point, OvlQuad *nearest, } return 1; } -extern f32 FUN_L00_00200228(void *, f32); +extern f32 split_float_fraction(void *, f32) __asm__("FUN_L00_00200228"); /* Wraps angle a into -pi..pi. */ -f32 FUN_L00_0025e310(f32 a) { +f32 normalize_angle(f32 a) __asm__("FUN_L00_0025e310"); +f32 normalize_angle(f32 a) { f32 out; f32 x; f32 pi = 3.14159274f; f32 tp = 6.2831855f; x = a + pi; x /= tp; - x = FUN_L00_00200228(&out, x); + x = split_float_fraction(&out, x); x *= tp; return x - pi; } @@ -522,7 +529,10 @@ extern f32 frame_time_macro __asm__("D_0015ED6C") __attribute__((section(".sdata extern float D_L00_0015F5D4_macro __asm__("D_L00_0015F5D4") __attribute__((section(".sdata"))); extern float D_L00_0015F5D0_macro __asm__("D_L00_0015F5D0") __attribute__((section(".sdata"))); /* Beam explosion at moby m: a spark burst from a spawn event, optional glow sparks and a flash, with a cam tint. */ -void FUN_L00_0025e450(char *m, void *unused, char *pos, float fA, float fB, int n, int k8, int k9, +void spawn_explosion(char *m, void *unused, char *pos, float fA, float fB, int n, int k8, int k9, + float fC, float fD, float fE, float fF, int k10, float fG, int k11, + int s16, int s18, unsigned char flag) __asm__("FUN_L00_0025e450"); +void spawn_explosion(char *m, void *unused, char *pos, float fA, float fB, int n, int k8, int k9, float fC, float fD, float fE, float fF, int k10, float fG, int k11, int s16, int s18, unsigned char flag) { Q_25e450 vb; @@ -725,10 +735,10 @@ extern s32 scale_game_frames_c(s32) __asm__("func_001F96F8"); extern unsigned FUN_L00_0025c0e8(unsigned, int); extern void FUN_L00_0025c088(int *, int *, int *, int); extern void FUN_L00_0026a9f0(void *, void *, int, int, float, int, int, int, int, float); -extern void FUN_L00_002d3838(void *, void *, int, int); +extern void mine_camera_blast(void *, void *, int, int) __asm__("FUN_L00_002d3838"); extern void clear_u64_value(void *) __asm__("func_001F99F8"); -extern int FUN_001fa728(void *, float); +extern int fast_bsphere_check(void *, float) __asm__("FUN_001fa728"); extern void allocate_voice_for_target_entry(int, int, void *) __asm__("FUN_0022da68"); typedef struct { @@ -742,7 +752,8 @@ extern Shake0025f090 D_L00_00166C80; /* Explosion burst at `pos`: three random-coloured particles, two tinted particles on `owner`, a camera shake when the spot is in view, the owner's sound unless it is dying, and a light flash of intensity `flash` (13 if negative). */ -void FUN_L00_0025f090(u8 *owner, u128 *pos, int sound, float scale, float flash) { +void cart_burst(u8 *owner, u128 *pos, int sound, float scale, float flash) __asm__("FUN_L00_0025f090"); +void cart_burst(u8 *owner, u128 *pos, int sound, float scale, float flash) { Vy10 vel; int i; float sp, big; @@ -766,7 +777,7 @@ void FUN_L00_0025f090(u8 *owner, u128 *pos, int sound, float scale, float flash) Vy10 at; *(u128 *)&at = *pos; at.w = 2.0f; - if (FUN_001fa728(&at, 10.0f) != -1) { + if (fast_bsphere_check(&at, 10.0f) != -1) { D_L00_00166C80.scale = scale * 0.1f; D_L00_00166C80.frames = scale_game_frames_c(0x14); } @@ -784,13 +795,14 @@ void FUN_L00_0025f090(u8 *owner, u128 *pos, int sound, float scale, float flash) D_L00_001B02F0[10] = 13.0f; D_L00_001B02F0[8] = 13.0f; } - FUN_L00_002d3838(D_L00_001B02F0, pos, 0, 0); + mine_camera_blast(D_L00_001B02F0, pos, 0, 0); } } /* Ported from rac1-decomp (src/overlays/shared/mobyutil_00258BC8.c: func_L00_00260460), where it is exact; names translated to the US level program. */ /* Spawns an explosion burst at `pos`: three random-coloured particles, two tinted particles when `owner` is set, and (when `flash` is nonzero) a light with intensity `flash` (or 13 if negative). */ +void FUN_L00_0025f3e8(char *owner, char *pos, float scale, float flash); void FUN_L00_0025f3e8(char *owner, char *pos, float scale, float flash) { Vy10 zero_vec; S6y10 c0; @@ -829,7 +841,7 @@ void FUN_L00_0025f3e8(char *owner, char *pos, float scale, float flash) { D_L00_001B02F0[10] = 13.0f; D_L00_001B02F0[8] = 13.0f; } - FUN_L00_002d3838(D_L00_001B02F0, pos, 0, 0); + mine_camera_blast(D_L00_001B02F0, pos, 0, 0); } } #define NOT_SDA @@ -838,12 +850,13 @@ void FUN_L00_0025f3e8(char *owner, char *pos, float scale, float flash) { /* Ported from rac1-decomp (src/overlays/shared/mobyutil_00258BC8.c: func_L00_002607A8), where it is exact; names translated to the US level program. */ -extern float FUN_001f9af0(void *); +extern float fast_vec_length(void *) __asm__("FUN_001f9af0"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); /* Clamps vector a to length x: normalizes it to x when vector_length_xyz is longer. */ +void FUN_L00_0025f730(void *a, float x); void FUN_L00_0025f730(void *a, float x) { - if (x < FUN_001f9af0(a)) { + if (x < fast_vec_length(a)) { fast_vec_normalize(a, a, x); } } @@ -870,7 +883,8 @@ void FUN_L00_0025f780(int a, short *list, short max) { } extern s32 D_L00_0015FFD8_c2 __asm__("D_L00_0015FFD8"); /* Removes moby p from the index list a by moving the last entry into its place. */ -void FUN_L00_0025f800(s32 p, s16 *a) { +void mine_spawn_drops(s32 p, s16 *a) __asm__("FUN_L00_0025f800"); +void mine_spawn_drops(s32 p, s16 *a) { s32 i; for (i = 1; i <= a[0]; i++) { if (D_L00_0015FFD8_c2 + (a[i] << 8) == p) { @@ -911,6 +925,7 @@ void FUN_L00_0025f8e0(f32 *v, f32 r) { extern u8 *D_L00_0015FFD8_c __asm__("D_L00_0015FFD8"); extern u8 *D_L00_0015FFE0 __attribute__((sda)); /* True for a moby inside the moby table whose class at 0xA6 is 0x1F4..0x21C. */ +s32 FUN_L00_0025e3b8(u8 *m); s32 FUN_L00_0025e3b8(u8 *m) { u32 v; if (m == 0) { diff --git a/src/overlays/shared/math/rotations/002899f8.c b/src/overlays/shared/math/rotations/002899f8.c index 874fa67d8f..b8866ed139 100644 --- a/src/overlays/shared/math/rotations/002899f8.c +++ b/src/overlays/shared/math/rotations/002899f8.c @@ -7,6 +7,7 @@ typedef struct { float f; } O_2899f8; +O_2899f8 *FUN_L05_002899f8(O_2899f8 *a, O_2899f8 *b, O_2899f8 *c, O_2899f8 *d); O_2899f8 *FUN_L05_002899f8(O_2899f8 *a, O_2899f8 *b, O_2899f8 *c, O_2899f8 *d) { O_2899f8 *r = a; diff --git a/src/overlays/shared/math/vectors/001fd108.c b/src/overlays/shared/math/vectors/001fd108.c index 145c175eb8..9b47f03143 100644 --- a/src/overlays/shared/math/vectors/001fd108.c +++ b/src/overlays/shared/math/vectors/001fd108.c @@ -90,3 +90,20 @@ INCLUDE_ASM("config/us/overlays/asm/FUN_L00_001ffe20.s", FUN_L00_001ffe20); INCLUDE_ASM("config/us/overlays/asm/FUN_L00_001fff28.s", FUN_L00_001fff28); INCLUDE_ASM("config/us/overlays/asm/FUN_L00_001ff9c0.s", FUN_L00_001ff9c0); + +f32 D_L01_0016EED8[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_0016F058[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_0016EB58[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_0016EBD8[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_0016EE58[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_0016F1D8[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_0016EAD8[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_0016F258[1] __attribute__((section(".data"))) = {0}; +f32 D_L09_0016EBD8[1] __attribute__((section(".data"))) = {0}; +f32 D_L10_0016EED8[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_0016EED8[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_0016ED58[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0016F158[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0016F058[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_0016EE58[1] __attribute__((section(".data"))) = {0}; +f32 D_L17_0016F358[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/math/vectors/0025c230.c b/src/overlays/shared/math/vectors/0025c230.c index 0914c63cc6..b2a35a59b2 100644 --- a/src/overlays/shared/math/vectors/0025c230.c +++ b/src/overlays/shared/math/vectors/0025c230.c @@ -38,6 +38,7 @@ extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); /* Sets a to b plus c (normalised) scaled by s times the dot of c and b. */ +void FUN_L00_0025c2b0(void *a, void *b, void *c, float s); void FUN_L00_0025c2b0(void *a, void *b, void *c, float s) { Vq t0, t1; fast_vec_normalize(&t1, c, 1.0f); @@ -120,7 +121,8 @@ int FUN_001f96f8_0025c558(int) __asm__("FUN_001f96f8"); float *FUN_002141f8_0025c558(void *) __asm__("FUN_002141f8"); void FUN_002130d8_0025c558(void *, int, int, int, int) __asm__("FUN_002130d8"); void FUN_00212f90_0025c558(void *, int, int, int) __asm__("FUN_00212f90"); -void FUN_L00_0025c558(u8 *a, B_25c558 *b, int c, int d, int e, float f) { +void trooper_start_knockback(u8 *a, B_25c558 *b, int c, int d, int e, float f) __asm__("FUN_L00_0025c558"); +void trooper_start_knockback(u8 *a, B_25c558 *b, int c, int d, int e, float f) { float *r; b->f0 = FUN_001f9dc8_0025c558(f) * b->f18; b->f4 = FUN_001f9de0_0025c558(f) * b->f18; @@ -159,9 +161,9 @@ extern int *D_L00_00177F00[]; extern float frame_scale __asm__("D_0015ED60") __attribute__((section(".sdata"))); extern Vec4 D_94C8_60 __asm__("D_L00_00173E60"); /* no foreign declaration */ extern int FUN_001efa68(void *, void *, int, int, int); -extern int FUN_001f0b58(void); -extern int FUN_L00_001f0d60(); -extern int FUN_L00_001f2868(void *, float, int, void *, void *); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); +extern int coll_sphere() __asm__("FUN_L00_001f0d60"); +extern int collect_mobies_in_sphere(void *, float, int, void *, void *) __asm__("FUN_L00_001f2868"); extern int FUN_L00_0025e3b8(void *); extern void add_vector_xyz_c(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_normalize_c(void *, void *, f32) __asm__("FUN_001f9bf8"); @@ -173,7 +175,7 @@ float absolute_float(float input) __asm__("func_001F99C0"); int FUN_L00_002595a0(float *r0, float *r1, float a, float b, float c); void FUN_L00_00258278(unsigned char *m, float *ptr, float t, float b, float c, float limit); void FUN_L00_00259710(void *a); -void FUN_L00_00259bc8(char *, float, int, int, void *, void *); +void spawn_nearby_effect(char *, float, int, int, void *, void *) __asm__("FUN_L00_00259bc8"); void FUN_L00_0025c398_c(void *a0, void *a1, void *a2) __asm__("FUN_L00_0025c398"); extern Vec4 D_94C8_60 __asm__("D_L00_00173E60"); extern float func_L00_0025A748_f(void *) __asm__("FUN_L00_00259710"); @@ -183,7 +185,8 @@ extern float probe_ground_height(void *, int, float) __asm__("FUN_00213508"); extern float frame_scale __asm__("D_0015ED60") __attribute__((section(".sdata"))); extern int func_L00_001F2BE8_d6f0(float, void *, int, void *, void *) __asm__("FUN_L00_001f2868"); -int FUN_L00_0025c698(char *moby, char *st) { +int mine_fall(char *moby, char *st) __asm__("FUN_L00_0025c698"); +int mine_fall(char *moby, char *st) { float eye[4]; float v10[4]; float v20[4]; @@ -217,7 +220,7 @@ int FUN_L00_0025c698(char *moby, char *st) { qcopy(v10, moby + 0x10); v10[2] = v10[2] + *(float *)(st + 0x28); f21 = probe_ground_height(v10, 0, 0.5f); - if (FUN_001f0b58() == 0) { + if (collision_hit_material() == 0) { if (*(float *)(st + 0x5C) == 0.0f && f21 <= v10[2] && v10[2] + *(float *)(st + 0x8) < f21) { *(float *)(st + 0x5C) = 1.0f; v10[2] = f21; @@ -318,7 +321,7 @@ int FUN_L00_0025c698(char *moby, char *st) { } } } else { - FUN_L00_00259bc8((char *)*pp, 1.0f, (int)moby, 0x10000, (moby + 0x10), st); + spawn_nearby_effect((char *)*pp, 1.0f, (int)moby, 0x10000, (moby + 0x10), st); } pp++; } while (--k != 0); diff --git a/src/overlays/shared/math/vectors/random_vector.c b/src/overlays/shared/math/vectors/random_vector.c index 150b210dc7..8b4d34fa4e 100644 --- a/src/overlays/shared/math/vectors/random_vector.c +++ b/src/overlays/shared/math/vectors/random_vector.c @@ -22,7 +22,8 @@ void random_vector(float *out, float lo, float hi) { /* Ported from rac1-decomp (src/overlays/shared/mobyutil_00258BC8.c: func_L00_00258E58), where it is exact; names translated to the US level program. */ /* Cubic interpolation through four points a..d at t. */ -float FUN_L00_00257e20(float a, float b, float c, float d, float t) { +float cubic_hermite_scalar(float a, float b, float c, float d, float t) __asm__("FUN_L00_00257e20"); +float cubic_hermite_scalar(float a, float b, float c, float d, float t) { float p = (d - c) - (a - b); float q = (a - b) - p; float t2 = t * t; diff --git a/src/overlays/shared/rendering/00245c28.c b/src/overlays/shared/rendering/00245c28.c index 7aa10b7187..18dce4809a 100644 --- a/src/overlays/shared/rendering/00245c28.c +++ b/src/overlays/shared/rendering/00245c28.c @@ -359,7 +359,7 @@ extern float map_coefficients[] __asm__("D_L00_00182A70"); extern s32 D_L00_00173E08 __attribute__((section(".data"))); extern int D_L00_00183EF0[]; extern RenderArchiveState D_L00_001841F0 __asm__("D_L00_001841F0"); -extern int FUN_L00_0024d8d0(); +extern int fast_decompress() __asm__("FUN_L00_0024d8d0"); extern s32 D_0015ED84; extern s32 hud_heap_alloc() __asm__("func_001FF288"); extern unsigned char D_0013D4C0[]; @@ -425,7 +425,7 @@ void FUN_L00_002464a8(void) { load(archive, file->sector, file->size); state->file_handle = stash_send_data((int)archive, scratch, 0x4800, (int)D_L00_001E8B00); state->transfer_bytes = scratch; - FUN_L00_0024d8d0((int)archive, (int)archive_base); + fast_decompress((int)archive, (int)archive_base); archive = archive_base; first_size = archive[1] - archive[0]; state->first_data = hud_heap_alloc(first_size, 0, (char *)heap_tag, 0x2DB); @@ -532,3 +532,134 @@ void FUN_L00_002468b8(void) { } D_L00_001841F0.active = 0; } + +s32 D_L00_00184420[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_00184424[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_00184470[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_00184474[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_0018489C[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001848A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001848F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001848F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001848F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_00184904[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_00184908[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_00184A1C[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_00184A20[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_00184A70[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_00184A74[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_00184A78[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_00184A84[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_00184A88[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_0018451C[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_00184520[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_00184570[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_00184574[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_00184578[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_00184584[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_00184588[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_0018459C[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001845A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001845F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001845F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001845F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_00184604[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_00184608[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_0018489C[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001848A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001848F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001848F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001848F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_00184904[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_00184908[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_00184B9C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_00184BA0[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_00184BF0[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_00184BF4[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_00184BF8[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_00184C04[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_00184C08[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_0018449C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001844A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001844F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001844F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001844F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_00184504[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_00184508[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_00184C1C[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_00184C20[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_00184C70[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_00184C74[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_00184C78[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_00184C84[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_00184C88[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_0018459C[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001845A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001845F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001845F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001845F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_00184604[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_00184608[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_0018489C[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001848A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001848F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001848F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001848F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_00184904[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_00184908[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_00184E1C[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_00184E20[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_00184E70[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_00184E74[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_00184E78[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_00184E84[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_00184E88[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_0018489C[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001848A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001848F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001848F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001848F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_00184904[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_00184908[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_0018471C[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_00184720[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_00184770[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_00184774[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_00184778[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_00184784[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_00184788[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_00184B1C[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_00184B20[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_00184B70[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_00184B74[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_00184B78[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_00184B84[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_00184B88[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_00184A1C[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_00184A20[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_00184A70[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_00184A74[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_00184A78[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_00184A84[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_00184A88[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_0018489C[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001848A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001848F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001848F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001848F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_00184904[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_00184908[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_00184D1C[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_00184D20[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_00184D70[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_00184D74[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_00184D78[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_00184D84[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_00184D88[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_00184E1C[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_00184E20[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_00184E70[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_00184E74[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_00184E78[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_00184E84[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_00184E88[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/rendering/00250df8.c b/src/overlays/shared/rendering/00250df8.c index d323991364..e54433def8 100644 --- a/src/overlays/shared/rendering/00250df8.c +++ b/src/overlays/shared/rendering/00250df8.c @@ -93,6 +93,7 @@ extern unsigned char D_L00_001E8F28[] __attribute__((section(".data"))); extern s32 D_0014C190_257218[][64] __asm__("D_0014C190") __attribute__((section(".data"))); extern int D_L00_001BA4D0_lui[] __asm__("D_L00_001BA4D0") __attribute__((section(".data"))); extern struct Hero hero_lui __asm__("D_0013F350") __attribute__((section(".data"))); +void FUN_L00_00257470(unsigned char *m, int flags, int arg); void FUN_L00_00257470(unsigned char *m, int flags, int arg) { float amt; int lvl; diff --git a/src/overlays/shared/rendering/0025e2c0.c b/src/overlays/shared/rendering/0025e2c0.c index c5286cd422..9b916d2b76 100644 --- a/src/overlays/shared/rendering/0025e2c0.c +++ b/src/overlays/shared/rendering/0025e2c0.c @@ -86,3 +86,5 @@ unsigned char *FUN_L15_002647f0(void *pos, float *p, float *c, int d, int e, int } return r; } + +s32 D_L17_001B2A70[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/rendering/00269290.c b/src/overlays/shared/rendering/00269290.c index 072a4455b1..208216b999 100644 --- a/src/overlays/shared/rendering/00269290.c +++ b/src/overlays/shared/rendering/00269290.c @@ -85,14 +85,14 @@ extern float fast_add_rotations(float, float) __asm__("FUN_001fa580"); extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern int D_L00_0015F5CC; -extern int FUN_001f9770(void *); -extern int FUN_L00_001f0d60(float, void *, int, void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +extern int coll_sphere(float, void *, int, void *) __asm__("FUN_L00_001f0d60"); extern int FUN_L00_00257b90(int, int); extern int func_001F9850(int) __asm__("FUN_001f96f8"); extern int func_L00_001EFFF0(void *, void *, int, int, int) __asm__("FUN_001efa68"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_L00_00267a08(void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); float absolute_float(float input) __asm__("FUN_001f99c0"); extern int truncate_float_to_s32(float) __asm__("FUN_001fa6d0"); @@ -109,7 +109,7 @@ void FUN_L00_002694f8(char *m) { if (t >= 3) { s = *(short *)(m + 0xA); pos = m + 0x10; - if (s > func_001F9850(0x78) && FUN_L00_001f0d60(7.99f, pos, 0x12, 0)) { + if (s > func_001F9850(0x78) && coll_sphere(7.99f, pos, 0x12, 0)) { *(int *)(p + 0x14) = 1; *(short *)(m + 0xA) = func_001F9850(0x78); *(int *)(p + 0x1C) = -1; @@ -127,7 +127,7 @@ void FUN_L00_002694f8(char *m) { *(float *)p = fast_cos(g[1]) * g[5] / 2.5f; *(float *)(p + 4) = fast_sin(g[1]) * g[5] / 2.5f; *(int *)(p + 8) = 0; - FUN_001f9a10(pos, pos, p); + fast_vec_add(pos, pos, p); } after: q = D_L00_00166DC0; @@ -146,7 +146,7 @@ void FUN_L00_002694f8(char *m) { fast_add_rotations(*(float *)(B + 0x158), a > 0.0f ? -1.0471976f : 1.0471976f)) * d; v[2] = *(float *)(m + 0x18) - *(float *)(B + 0x148); - FUN_001f9a10(pos, v, q); + fast_vec_add(pos, v, q); qcopy(v, pos); v[2] = v[2] + 32.0f; if (func_L00_001EFFF0(pos, v, 0x12, 0, 0)) @@ -172,11 +172,11 @@ void FUN_L00_002694f8(char *m) { k = truncate_float_to_s32(convert_integer_to_float_c(k) * (96.0f - d) * 0.0625f); } *(int *)(m + 4) = (k << 24) | (*(int *)(m + 4) & 0xFFFFFF); - if (FUN_001f9770(m + 0xA)) { + if (fast_dec_timer_s16(m + 0xA)) { if (*(int *)(p + 0x14)) { kill: **(char **)(p + 0x10) = 0; - FUN_L00_00267a08(m); + free_effect_particle(m); } else { *(int *)(p + 0x14) = 1; *(short *)(m + 0xA) = @@ -190,6 +190,7 @@ unsigned char *FUN_L00_002678b8_00269958(int) __asm__("FUN_L00_002678b8"); int FUN_001fa6d0_00269958(float) __asm__("FUN_001fa6d0"); int FUN_001160d8_00269958(void) __asm__("FUN_001160d8"); extern unsigned char *D_L00_001B2090 __attribute__((section(".data"))); +void FUN_L00_00269958(u128 *a, u128 *b, int c, int d, int n, int s1, int s2, int flag); void FUN_L00_00269958(u128 *a, u128 *b, int c, int d, int n, int s1, int s2, int flag) { unsigned char *m = FUN_L00_002678b8_00269958(4); if (m) { @@ -234,21 +235,21 @@ typedef struct { S00269a70 s; } O00269a70; extern f32 D_0015ED60; -f32 FUN_001fa6c0(s32); -void FUN_001f9a68(void *, void *, f32); -void FUN_001f9a10(void *, void *, void *); -s32 FUN_L00_002371e0(s32, s32, f32); -s32 FUN_001f9770(void *); -void FUN_L00_00267a08(void *); +f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); +void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); +void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +s32 mine_blend_color(s32, s32, f32) __asm__("FUN_L00_002371e0"); +s32 fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); void FUN_L00_00269a70(O00269a70 *o) { S00269a70 *s = &o->s; - o->xc = FUN_001fa6c0(s->x18 * (s->x1c - o->xa) / s->x1c + s->x1a) * 1000.0f; - FUN_001f9a68(s, s, D_0015ED60 * -0.019999980926513672f + 1.0f); - FUN_001f9a10(o->p10, o->p10, s); + o->xc = convert_integer_to_float(s->x18 * (s->x1c - o->xa) / s->x1c + s->x1a) * 1000.0f; + fast_vec_scale(s, s, D_0015ED60 * -0.019999980926513672f + 1.0f); + fast_vec_add(o->p10, o->p10, s); o->x8++; - o->x4 = FUN_L00_002371e0(s->x14, s->x10, o->xa / FUN_001fa6c0(s->x1c)); - if (FUN_001f9770(&o->xa)) - FUN_L00_00267a08(o); + o->x4 = mine_blend_color(s->x14, s->x10, o->xa / convert_integer_to_float(s->x1c)); + if (fast_dec_timer_s16(&o->xa)) + free_effect_particle(o); } #define NOT_SDA @@ -293,14 +294,14 @@ void FUN_L00_00269b70(void *pos, unsigned char red, unsigned char green, unsigne /* Ported from rac1-decomp (src/overlays/shared/partupd_0026A130.c: func_L00_0026AB10), where it is exact; names translated to the US level program. */ extern int scale_game_frames(int) __asm__("FUN_001f96f8"); -extern int FUN_001f9740(void *); -extern void FUN_L00_00267a08(void *); +extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); +extern void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); void FUN_L00_00269c70(char *m) { float *p; p = (float *)(m + 0x20); - if (FUN_001f9740(p)) { - FUN_L00_00267a08(m); + if (fast_dec_timer(p)) { + free_effect_particle(m); return; } *(float *)(m + 0xC) += p[1]; @@ -314,7 +315,7 @@ void FUN_L00_00269c70(char *m) { INCLUDE_ASM("config/us/overlays/asm/FUN_L00_00269d20.s", FUN_L00_00269d20); #else extern int particle_collision_269d20(void *, void *, int, void *, int) __asm__("FUN_001efa68"); -extern void particle_step_269d20(float, void *, void *, void *) __asm__("FUN_L00_0025c2b0"); +extern void FUN_L00_0025c2b0(float, void *, void *, void *); extern void particle_matrix_269d20(float, void *, void *) __asm__("FUN_001f9bf8"); extern void particle_transform_269d20(void *, void *, void *) __asm__("FUN_001f9a10"); extern float particle_color_float_269d20(int) __asm__("FUN_001fa6c0"); @@ -346,7 +347,7 @@ void FUN_L00_00269d20(unsigned char *m) { velocity[0] = *(float *)(p + 0x0); velocity[1] = *(float *)(p + 0x4); velocity[2] = *(float *)(p + 0x8); - particle_step_269d20(*(float *)(e + 0x3c), matrix, velocity, D_L00_00173E80_26ff10); + FUN_L00_0025c2b0(*(float *)(e + 0x3c), matrix, velocity, D_L00_00173E80_26ff10); *(float *)(p + 0x0) = matrix[0]; *(float *)(p + 0x4) = matrix[1]; *(float *)(p + 0x8) = matrix[2]; @@ -459,7 +460,7 @@ void FUN_L00_00269d20(unsigned char *m) { *(float *)(e + 0x20) < *(float *)(m + 0x10) || *(float *)(e + 0x24) < *(float *)(m + 0x14) || *(float *)(e + 0x28) < *(float *)(m + 0x18)) - FUN_L00_00267a08(m); + free_effect_particle(m); } #endif #include "eetypes.h" @@ -470,6 +471,7 @@ extern unsigned char *D_L00_001B20A0_0026a4c8 __asm__("D_L00_001B20A0") unsigned char *FUN_L00_002678b8_0026a4c8(int) __asm__("FUN_L00_002678b8"); int FUN_001fa6d0_0026a4c8(float) __asm__("FUN_001fa6d0"); float FUN_001fa6c0_0026a4c8(int) __asm__("FUN_001fa6c0"); +void FUN_L00_0026a4c8(u128 *a, u128 *b, int c, int d, int n, float f); void FUN_L00_0026a4c8(u128 *a, u128 *b, int c, int d, int n, float f) { if (n) { unsigned char *m = FUN_L00_002678b8_0026a4c8(8); @@ -583,6 +585,8 @@ void FUN_001f9bf8_26a9f0(void *, void *, float) __asm__("FUN_001f9bf8"); void FUN_001f9a10_26a9f0(void *, void *, void *) __asm__("FUN_001f9a10"); extern unsigned char *D_L00_001B20AC __attribute__((section(".data"))); +void FUN_L00_0026a9f0(void *pos, void *dir, int col, int d, int n, int b1A, int b18, int b19, + float x, float y); void FUN_L00_0026a9f0(void *pos, void *dir, int col, int d, int n, int b1A, int b18, int b19, float x, float y) { unsigned char *m; @@ -647,13 +651,13 @@ extern float D_L00_0015F5D0; extern float square_root(float) __asm__("FUN_001f9988"); extern float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); extern float random_float_between_alt(float, float) __asm__("FUN_002132a8"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int fast_tween_color(int, int, float) __asm__("FUN_001fa6e0"); extern int FUN_L00_001fefc8(void *); extern int FUN_L00_00257b90(int, int); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_001f9a68(void *, void *, float); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); extern void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); extern void FUN_L00_0026a9f0_u(void *, void *, int, int, int, int, int, float, int, float) __asm__("FUN_L00_0026a9f0"); @@ -664,7 +668,7 @@ void FUN_L00_0026ac78(char *m) { m[8]++; if ((p[0x19] ^ 1) & 1) { int i; - FUN_001f9a10(m + 0x10, m + 0x10, p); + fast_vec_add(m + 0x10, m + 0x10, p); if (p[0x19] & 4) { *(float *)(p + 8) += frame_time_sq * 9.8f; } @@ -672,7 +676,7 @@ void FUN_L00_0026ac78(char *m) { float s = 0.8f; if (p[0x19] & 2) s = 0.6f; - FUN_001f9a68(p, p, s); + fast_vec_scale(p, p, s); } if (*(short *)(m + 0xA) == truncate_float_to_s32((float)(unsigned char)p[0x1B] * 0.85f) && (unsigned char)p[0x1A] < 2 && !(p[0x19] & 4)) { @@ -715,7 +719,7 @@ void FUN_L00_0026ac78(char *m) { (float)*(short *)(m + 0xA) / (float)(unsigned char)p[0x1B]); } FUN_L00_001fefc8(m + 0x38); - if (FUN_001f9770(m + 0xA)) { + if (fast_dec_timer_s16(m + 0xA)) { if (p[0x19] & 2) { int t = (unsigned char)p[0x1B] * 3; *(short *)(m + 0xA) = t; @@ -739,8 +743,8 @@ void FUN_L00_0026ac78(char *m) { int n2 = truncate_float_to_s32((float)(unsigned char)p[0x1B] * 0.25f) + 1; int life; *(float *)(p + 8) += frame_time_sq * 3.0f; - FUN_001f9a10(m + 0x10, m + 0x10, p); - FUN_001f9a68(p, p, 0.98f); + fast_vec_add(m + 0x10, m + 0x10, p); + fast_vec_scale(p, p, 0.98f); life = *(short *)(m + 0xA); if (n1 < life) { *(int *)(m + 4) = fast_tween_color(*(int *)(p + 0x14), *(int *)(p + 0x10), @@ -751,9 +755,9 @@ void FUN_L00_0026ac78(char *m) { *(int *)(m + 4) = (*(int *)(m + 4) & 0xFFFFFF) | ((life * 15 / n1) << 24); } if (D_L00_0015F5D0 > 1.0f) - FUN_001f9770(m + 0xA); - if (FUN_001f9770(m + 0xA)) - FUN_L00_00267a08(m); + fast_dec_timer_s16(m + 0xA); + if (fast_dec_timer_s16(m + 0xA)) + free_effect_particle(m); } } extern unsigned char *create_part2(int, int) __asm__("FUN_L00_002678c0"); @@ -898,8 +902,8 @@ void FUN_L00_0026b500(unsigned char *m) { if (*(float *)(m + 0x10) < 2.0f || *(float *)(m + 0x10) > 1021.0f || *(float *)(m + 0x14) < 2.0f || *(float *)(m + 0x14) > 1021.0f || *(float *)(m + 0x18) < 2.0f || *(float *)(m + 0x18) > 1021.0f || - FUN_001f9770(m + 0xA) != 0) { - FUN_L00_00267a08(m); + fast_dec_timer_s16(m + 0xA) != 0) { + free_effect_particle(m); } else if (*(float *)(p + 0x10) < 0.01f) { *(short *)(m + 0xA) = *(short *)(m + 0xA) - 1; } @@ -1122,7 +1126,8 @@ extern int FUN_001160d8_26bed0(void) __asm__("FUN_001160d8"); extern int FUN_00213260_26bed0(int) __asm__("FUN_00213260"); extern unsigned char *D_L00_001B20C0 __attribute__((section(".data"))); -unsigned char *FUN_L00_0026bed0(void *a, void *b, int c, int d, float f, int n, int k) { +unsigned char *mine_debris(void *a, void *b, int c, int d, float f, int n, int k) __asm__("FUN_L00_0026bed0"); +unsigned char *mine_debris(void *a, void *b, int c, int d, float f, int n, int k) { unsigned char *m; unsigned char *q; if (n == 0) { @@ -1202,7 +1207,7 @@ void FUN_L00_0026c088(Part_0026CF28 *m) { if (p->kind == 3 && D_L00_0015F5D0 > 0.95f) tick_countdown_32_alt(&m->timer); if (tick_countdown_32_alt(&m->timer)) { - FUN_L00_00267a08(m); + free_effect_particle(m); return; } { @@ -1213,7 +1218,7 @@ void FUN_L00_0026c088(Part_0026CF28 *m) { if (m->timer < scale_game_frames_alt(6)) c = c * m->timer / scale_game_frames_alt(6); if (f < 4.0f) { - FUN_L00_00267a08(m); + free_effect_particle(m); return; } if (f < 8.0f) @@ -1234,7 +1239,7 @@ void FUN_L00_0026c088(Part_0026CF28 *m) { r = FUN_L00_00257b90(t, scale_game_frames_alt(0x96)); FUN_L00_0026bed0_c(m->pos, p, u, w, f, r, 3); } - FUN_L00_00267a08(m); + free_effect_particle(m); } else m->b8++; } @@ -1335,6 +1340,7 @@ E0026c6e8 *FUN_L00_002678b8_u(s32) __asm__("FUN_L00_002678b8"); s32 random_integer_below(s32) __asm__("FUN_00213260"); s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); +void FUN_L00_0026c6e8(void *pos, void *vel); void FUN_L00_0026c6e8(void *pos, void *vel) { E0026c6e8 *e = FUN_L00_002678b8_u(0x13); u32 v; @@ -1360,19 +1366,19 @@ void FUN_L00_0026c6e8(void *pos, void *vel) { /* Ported from rac1-decomp (src/overlays/shared/partupd_0026A130.c: func_L00_0026D690), where it is exact; names translated to the US level program. */ -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_L00_00267a08(void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); /* Moves both points by the vector at 0x30; lowers the top byte at a+4 by 6, 00267a08 below 0. */ void FUN_L00_0026c7f0(char *a) { int t; - FUN_001f9a10(a + 0x10, a + 0x10, a + 0x30); - FUN_001f9a10(a + 0x20, a + 0x20, a + 0x30); + fast_vec_add(a + 0x10, a + 0x10, a + 0x30); + fast_vec_add(a + 0x20, a + 0x20, a + 0x30); t = *(int *)(a + 4) + 0xFA000000; *(int *)(a + 4) = t; *(int *)(a + 0xC) = t; if (t < 0) - FUN_L00_00267a08(a); + free_effect_particle(a); } typedef struct { f32 x, y, z, w; @@ -1468,6 +1474,7 @@ extern s32 rand(); extern void *FUN_L00_002678b8_c(int) __asm__("FUN_L00_002678b8"); extern unsigned char *D_L00_001B20D4 __attribute__((section(".data"))); +char *FUN_L00_0026cbb0(void *pos, void *dir, int c, int d, int n, int k, float f); char *FUN_L00_0026cbb0(void *pos, void *dir, int c, int d, int n, int k, float f) { char *p; char *q; @@ -1983,6 +1990,7 @@ char *FUN_L00_002678b8_0026dd20(int) __asm__("FUN_L00_002678b8"); int FUN_001160d8_0026dd20(void) __asm__("FUN_001160d8"); int FUN_001fa6d0_0026dd20(float) __asm__("FUN_001fa6d0"); extern unsigned char *D_L00_001B20EC[]; +char *FUN_L00_0026dd20(void *pos, void *dir, int a, int b, float f); char *FUN_L00_0026dd20(void *pos, void *dir, int a, int b, float f) { char *o = FUN_L00_002678b8_0026dd20(0x1B); if (o) { @@ -2008,17 +2016,17 @@ char *FUN_L00_0026dd20(void *pos, void *dir, int a, int b, float f) { /* Ported from rac1-decomp (src/overlays/shared/partupd_0026A130.c: func_L00_0026ECA0), where it is exact; names translated to the US level program. */ -extern int FUN_001f9740(void *); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_L00_00267a08(void *); +extern int fast_dec_timer(void *) __asm__("FUN_001f9740"); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); void FUN_L00_0026de00(char *a) { char *b = a + 0x20; - FUN_001f9a10(a + 0x10, a + 0x10, b); + fast_vec_add(a + 0x10, a + 0x10, b); *(unsigned *)(a + 4) = (*(unsigned *)(a + 4) & 0xFFFFFF) + (((*(int *)(b + 0x18) * *(int *)(b + 0x10)) / *(int *)(b + 0x14)) << 24); - if (FUN_001f9740(a + 0x30)) - FUN_L00_00267a08(a); + if (fast_dec_timer(a + 0x30)) + free_effect_particle(a); } typedef struct { f32 f[4]; @@ -2523,13 +2531,13 @@ void FUN_L00_0026ee48(unsigned char *p) { /* Ported from rac1-decomp (src/overlays/shared/partupd_0026A130.c: func_L00_0026FEE8), where it is exact; names translated to the US level program. */ -extern int FUN_001f9770(void *); -extern void FUN_L00_00267a08(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +extern void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); -/* Calls FUN_L00_00267a08 on a once fast_dec_timer_s16(a + 10) returns non-zero. */ +/* Calls free_effect_particle on a once fast_dec_timer_s16(a + 10) returns non-zero. */ void FUN_L00_0026f048(char *a) { - if (FUN_001f9770(a + 10) != 0) { - FUN_L00_00267a08(a); + if (fast_dec_timer_s16(a + 10) != 0) { + free_effect_particle(a); } } typedef struct { @@ -2547,6 +2555,7 @@ float FUN_002132a8_26f080(float, float) __asm__("FUN_002132a8"); int FUN_L00_00257b90_26f080(int, int) __asm__("FUN_L00_00257b90"); int FUN_001f96f8_26f080(int) __asm__("FUN_001f96f8"); extern unsigned char *D_L00_001B2108 __attribute__((section(".data"))); +unsigned char *FUN_L00_0026f080(void *pos, float *v, float x, float y); unsigned char *FUN_L00_0026f080(void *pos, float *v, float x, float y) { unsigned char *m = FUN_L00_002678b8_26f080(0x22); if (m) { @@ -2600,8 +2609,8 @@ void FUN_L00_0026f280(char *m) { float v[3]; char *q; float a, k; - if (FUN_001f9770(m + 0xA)) { - FUN_L00_00267a08(m); + if (fast_dec_timer_s16(m + 0xA)) { + free_effect_particle(m); return; } if (*(float *)(m + 0x18) > *(float *)(p + 0x10)) { @@ -2633,7 +2642,7 @@ void FUN_L00_0026f280(char *m) { float len = vector_length_xy(v); set_vector_length_xy(v, v, D_0015ED60_c * -0.029999971f * len + len); } - FUN_001f9a10(m + 0x10, m + 0x10, v); + fast_vec_add(m + 0x10, m + 0x10, v); approach_value(v + 2, frame_time * 1.3f, frame_time_sq * 5.0f); *(float *)(p + 0) = v[0]; *(float *)(p + 4) = v[1]; @@ -2644,7 +2653,7 @@ void FUN_L00_0026f280(char *m) { v[0] = fast_cos(a) * k; v[1] = fast_sin(a) * k; v[2] = 0; - FUN_001f9a10(m + 0x10, m + 0x10, v); + fast_vec_add(m + 0x10, m + 0x10, v); } extern float D_0015ED70_0026f548 __asm__("D_0015ED70"); unsigned char *FUN_L00_002678b8_0026f548(int) __asm__("FUN_L00_002678b8"); @@ -2683,7 +2692,7 @@ typedef struct { } V __attribute__((aligned(16))); extern V D_L00_00173E60; -extern int FUN_001f0b58(void); +extern int collision_hit_material(void) __asm__("FUN_001f0b58"); extern void FUN_L00_002715e8(void *, int, int, float, float); extern void FUN_L00_002741a0(void *, int, float, float); @@ -2694,39 +2703,39 @@ void FUN_L00_0026f660(char *m) { char *q; if (mode == 0) { - FUN_001f9a10(m + 0x10, m + 0x10, b); + fast_vec_add(m + 0x10, m + 0x10, b); } else if (mode == 1) { q = m + 0x10; - FUN_001f9a10(&tmp, q, b); + fast_vec_add(&tmp, q, b); if (func_L00_001EFFF0(q, &tmp, 2, 0, 0)) { - if (FUN_001f0b58() == 0) { + if (collision_hit_material() == 0) { FUN_L00_002715e8(&D_L00_00173E60, 0, -1, 0.2f, 5250.0f); } - FUN_L00_00267a08(m); + free_effect_particle(m); return; } qcopy(q, &tmp); } else if (mode == 3) { float lim; q = m + 0x10; - FUN_001f9a10(q, q, b); + fast_vec_add(q, q, b); lim = hero.water_surface_z; if (*(float *)(m + 0x18) < lim) { *(float *)(m + 0x18) = lim; FUN_L00_002715e8(q, 0, -1, 0.2f, 5250.0f); - FUN_L00_00267a08(m); + free_effect_particle(m); return; } } else { q = m + 0x10; - FUN_001f9a10(&tmp, q, b); + fast_vec_add(&tmp, q, b); if (func_L00_001EFFF0(q, &tmp, 2, 0, 0)) { - if (FUN_001f0b58() != 0) { + if (collision_hit_material() != 0) { int *d = D_L00_00173E40; *(float *)((char *)d + 0x28) += 0.05f; FUN_L00_002741a0(d + 8, -1, 0.25f, 3150.0f); } - FUN_L00_00267a08(m); + free_effect_particle(m); return; } qcopy(q, &tmp); @@ -2737,7 +2746,7 @@ void FUN_L00_0026f660(char *m) { if (*(int *)(b + 0x14) <= 0 || *(float *)(m + 0x18) < *(float *)(b + 0x18)) { *(int *)(m + 4) += 0xF0000000; if (*(int *)(m + 4) < 0) { - FUN_L00_00267a08(m); + free_effect_particle(m); } } } @@ -2792,32 +2801,32 @@ void FUN_L00_0026f898(unsigned char *p) { } typedef float V4[4] __attribute__((aligned(16))); extern char D_L00_00166DC0[]; -int FUN_001f9770(void *); -void FUN_L00_00267a08(void *); +int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); float fast_vec_length(void *) __asm__("FUN_001f9af0"); void fast_vec_normalize(void *, void *, float) __asm__("FUN_001f9bf8"); -void FUN_001f9a68(void *, void *, float); -void FUN_001f9a10(void *, void *, void *); -int FUN_L00_002371e0(int, int, float); +void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); +void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +int mine_blend_color(int, int, float) __asm__("FUN_L00_002371e0"); void FUN_L00_0026fa00(char *p) { V4 d; int *q = (int *)(p + 0x20); int n, k; - if (FUN_001f9770(p + 0xA)) { - FUN_L00_00267a08(p); + if (fast_dec_timer_s16(p + 0xA)) { + free_effect_particle(p); return; } subtract_vector_xyz(d, D_L00_00166DC0, q); if (5.0f < fast_vec_length(d)) fast_vec_normalize(d, d, 1.25f); else - FUN_001f9a68(d, d, 0.25f); - FUN_001f9a10(p + 0x10, q, d); + fast_vec_scale(d, d, 0.25f); + fast_vec_add(p + 0x10, q, d); n = q[5]; k = *(short *)(p + 0xA) - n; k = k < 0 ? -k : k; - *(int *)(p + 4) = FUN_L00_002371e0(0, q[4], (float)(n - k) / (float)n); + *(int *)(p + 4) = mine_blend_color(0, q[4], (float)(n - k) / (float)n); } typedef struct { float v[4]; @@ -2933,7 +2942,7 @@ typedef struct { E_26fd28 e; } P_26fd28; extern P_26fd28 *alloc_26fd28(s32) __asm__("FUN_L00_002678b8"); -extern s32 col_26fd28(f32, f32, f32, f32) __asm__("FUN_L00_0025bfe0"); +extern s32 FUN_L00_0025bfe0(f32, f32, f32, f32); extern s32 trunc_26fd28(f32) __asm__("FUN_001fa6d0"); extern f32 rang_26fd28(void) __asm__("FUN_00213308"); extern f32 rfb_26fd28(f32, f32) __asm__("FUN_002132a8"); @@ -2949,7 +2958,7 @@ P_26fd28 *FUN_L00_0026fd28(u128 *pos, u128 *vel, u8 c, s32 d) { e = &p->e; qcopy(&p->pos, pos); qcopy(e, vel); - p->w4 = col_26fd28(0.7f, 0.7f, 0.7f, 0.08f); + p->w4 = FUN_L00_0025bfe0(0.7f, 0.7f, 0.7f, 0.08f); p->b9 = trunc_26fd28(4.0f) + 0x40; p->b1 = 0; p->b3 = 0x44; @@ -3192,14 +3201,14 @@ void FUN_L00_0026ff10(Moby_26ff10 *p) { /* Ported from rac1-decomp (src/overlays/shared/partupd_0026A130.c: func_L00_002715B0), where it is exact; names translated to the US level program. */ -extern int FUN_001f9770(void *); -extern void FUN_L00_00267a08(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +extern void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); -/* Calls FUN_L00_00267a08 on a once fast_dec_timer_s16(a + 0xA) returns non-zero; skips id -1. */ +/* Calls free_effect_particle on a once fast_dec_timer_s16(a + 0xA) returns non-zero; skips id -1. */ void FUN_L00_00270710(char *a) { if (*(short *)(a + 0xA) != -1) { - if (FUN_001f9770(a + 0xA) != 0) { - FUN_L00_00267a08(a); + if (fast_dec_timer_s16(a + 0xA) != 0) { + free_effect_particle(a); } } } @@ -3330,7 +3339,7 @@ void FUN_L00_00270948(M_270948 *m) { m->pos.f[2] += random_float_between(nr, r); } m->b2 = D_L00_001B20B0_c[0][(m->hA + e->h16 + (m->b2 - D_L00_001B20B0_c[0][0])) & 7]; - FUN_001f9a10(&v, &m->pos, e); + fast_vec_add(&v, &m->pos, e); hit = 0; if (e->h14 > FUN_001f96f8_c(3)) { FUN_001f9a28_c(&p, &m->pos, e); @@ -3363,7 +3372,7 @@ void FUN_L00_00270948(M_270948 *m) { m->fC -= 260000.0f / (f32)(s32)(8.0f / (D_0015ED60 * 0.443f)) * D_0015ED60 * 1.25f; if (m->fC <= 0.0f) { kill: - FUN_L00_00267a08(m); + free_effect_particle(m); return; } } else { @@ -3448,3 +3457,185 @@ void FUN_L00_002710a0(u8 *p) { FUN_001f9a10_2710a0(p + 0x10, p + 0x10, q); *(f32 *)(q + 8) += frame_scale_sq * 0.0005f; } + +s32 D_L01_001B2548[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B2554[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B2558[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B2560[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B2564[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B2568[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B256C[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B2570[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B2588[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2690[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B26B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B26BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B26C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B26D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B26D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B26E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B26E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B26E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B26EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B26F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B26F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2708[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2190[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B21B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B21BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B21C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B21CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B21D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B21D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B21F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2210[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2514[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2530[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B253C[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2548[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2554[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2558[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2560[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2564[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2568[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B256C[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2570[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2588[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2810[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2814[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2830[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2834[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B283C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2848[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2854[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2858[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2860[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2864[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2868[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B286C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2870[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2888[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B2110[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B2134[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B2154[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B2158[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B2188[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2890[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B28B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B28B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B28BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B28C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B28D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B28D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B28E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B28E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B28E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B28EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B28F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2908[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2210[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2514[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2530[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B253C[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2548[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2554[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2558[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2560[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2564[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2568[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B256C[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2570[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2588[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2AC8[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2AD4[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2AD8[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2AE0[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2AE4[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2AE8[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2AEC[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2AF0[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2B08[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2514[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2530[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B253C[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2548[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2554[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2558[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2560[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2564[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2568[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B256C[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2570[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2588[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B23C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B23D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B23D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B23E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B23E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B23E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B23EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B23F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B23F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B2408[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2790[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2794[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B27BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B27D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B27D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B27E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B27E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B27E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B27EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B27F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2808[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2690[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B26B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B26B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B26BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B26C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B26D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B26D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B26E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B26E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B26E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B26EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B26F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B26F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2708[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2514[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2530[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B253C[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2548[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2554[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2558[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2560[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2564[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2568[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B256C[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2570[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2588[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2990[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B29B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B29B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B29BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B29C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B29D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B29D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B29E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B29E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B29E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B29EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B29F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2A08[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2A90[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2AB0[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2ABC[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2AC8[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2AD4[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2AD8[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2AE0[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2AE4[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2AE8[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2AEC[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2AF0[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2B08[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/rendering/002712b8.c b/src/overlays/shared/rendering/002712b8.c index 22dea5942e..14ef8203b8 100644 --- a/src/overlays/shared/rendering/002712b8.c +++ b/src/overlays/shared/rendering/002712b8.c @@ -14,6 +14,8 @@ extern int FUN_001fa6d0_2712b8(float) __asm__("FUN_001fa6d0"); extern int FUN_00213260_2712b8(int) __asm__("FUN_00213260"); extern unsigned char *D_L00_001B2130 __attribute__((section(".data"))); +unsigned char *FUN_L00_002712b8(OvlQuad *pos, float *vec, int s, int a, int col, int n, float x, + float y, float z, float w, float pw); unsigned char *FUN_L00_002712b8(OvlQuad *pos, float *vec, int s, int a, int col, int n, float x, float y, float z, float w, float pw) { unsigned char *m = p27fe00_alloc(0x2C); @@ -137,18 +139,18 @@ unsigned char *FUN_L00_002715e8(void *pos, int x, int color, float size, float w } return m; } -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_L00_00267a08(void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); extern float FUN_001f99c0(float); void FUN_L00_00271748(unsigned char *m) { unsigned char *v = m + 0x20; float z; - FUN_001f9a10(m + 0x10, m + 0x10, v); + fast_vec_add(m + 0x10, m + 0x10, v); if (*(float *)(m + 0x10) < 2.0f || 1021.0f < *(float *)(m + 0x10) || *(float *)(m + 0x14) < 2.0f || 1021.0f < *(float *)(m + 0x14) || (z = *(float *)(m + 0x18)) < 2.0f || 1021.0f < z) { - FUN_L00_00267a08(m); + free_effect_particle(m); return; } *(float *)(m + 0xC) += *(float *)(v + 0x10); @@ -161,7 +163,7 @@ void FUN_L00_00271748(unsigned char *m) { *(int *)(m + 4) += 0xFF000000; } if (!(*(int *)(m + 4) & 0xFF000000)) { - FUN_L00_00267a08(m); + free_effect_particle(m); } } #include "eetypes.h" @@ -170,7 +172,8 @@ extern unsigned char *D_L00_001B2138 __attribute__((section(".data"))); extern int p2718d0_rnd(int) __asm__("FUN_00213260"); extern int p2718d0_trunc(float) __asm__("FUN_001fa6d0"); extern float p2718d0_rndf(float, float) __asm__("FUN_002132a8"); -unsigned char *FUN_L00_002718d0(u128 *pos, u128 *dir, int w, float scale, float speed) { +unsigned char *spawn_splash(u128 *pos, u128 *dir, int w, float scale, float speed) __asm__("FUN_L00_002718d0"); +unsigned char *spawn_splash(u128 *pos, u128 *dir, int w, float scale, float speed) { unsigned char *p; unsigned char *m; float r; @@ -244,21 +247,21 @@ unsigned char *FUN_L00_00271b18(u128 *a, u128 *b, float x) { /* Ported from rac1-decomp (src/overlays/shared/partupd_00272158.c: func_L00_00272A88), where it is exact; names translated to the US level program. */ -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); -extern void FUN_L00_00267a08(void *); +extern void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); void FUN_L00_00271be8(char *m) { char *v = m + 0x20; int t; fast_vec_scale(v, v, 0.975f); - FUN_001f9a10(m + 0x10, m + 0x10, v); + fast_vec_add(m + 0x10, m + 0x10, v); *(float *)(m + 0xC) += 14700.0f; m[8] += v[0x10]; t = *(int *)(m + 4) + 0xFE000000; *(int *)(m + 4) = t; if (t < 0) { - FUN_L00_00267a08(m); + free_effect_particle(m); } } #define NOT_SDA @@ -268,20 +271,20 @@ void FUN_L00_00271be8(char *m) { /* Ported from rac1-decomp (src/overlays/shared/partupd_00272158.c: func_L00_00272B28), where it is exact; names translated to the US level program. */ extern f32 convert_integer_to_float(s32) __asm__("func_001FA6C0"); -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_001fa6e0(int, int, float); -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_L00_00267a08(void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); void FUN_L00_00271c88(char *m) { char *v = m + 0x20; m[8] += v[0x1C]; - FUN_001f9a10(m + 0x10, m + 0x10, v); + fast_vec_add(m + 0x10, m + 0x10, v); *(int *)(m + 4) = FUN_001fa6e0( *(int *)(v + 0x18), *(int *)(v + 0x14), absolute_float(convert_integer_to_float(*(short *)(m + 0xA)) * *(float *)(v + 0x10) - 1.0f)); - if (FUN_001f9770(m + 0xA)) { - FUN_L00_00267a08(m); + if (fast_dec_timer_s16(m + 0xA)) { + free_effect_particle(m); } } #include "eetypes.h" @@ -299,9 +302,9 @@ typedef struct { V00271d20 acc; } O00271d20; extern V00271d20 D_L00_00173E60; -void FUN_001f9a10(void *, void *, void *); -s32 FUN_001f9770(void *); -void FUN_L00_00267a08(void *); +void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +s32 fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); s32 coll_line_fix(void *, void *, s32, s32, s32) __asm__("FUN_001efa68"); void FUN_L00_00271d20(O00271d20 *o) { V00271d20 t; @@ -312,10 +315,10 @@ void FUN_L00_00271d20(O00271d20 *o) { t.f[1] = acc->f[1]; t.f[2] = acc->f[2]; t.f[3] = 0.0f; - FUN_001f9a10(pos, pos, &t); - FUN_001f9a10(vel, vel, &t); - if (FUN_001f9770(&o->xa)) { - FUN_L00_00267a08(o); + fast_vec_add(pos, pos, &t); + fast_vec_add(vel, vel, &t); + if (fast_dec_timer_s16(&o->xa)) { + free_effect_particle(o); } else if (coll_line_fix(vel, pos, 0x10, acc->i[3], 0)) { o->pos.q = D_L00_00173E60.q; o->xa = 0; @@ -345,8 +348,8 @@ typedef struct { } V __attribute__((aligned(16))); void FUN_L00_001ff318(V *, V *, f32); void FUN_L00_001ff290(V *, V *, V *); -s32 FUN_001f9770(void *); -void FUN_L00_00267a08(void *); +s32 fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); void FUN_L00_00271ec8(u8 *m) { V t; V *v = (V *)(m + 0x20); @@ -356,8 +359,8 @@ void FUN_L00_00271ec8(u8 *m) { FUN_L00_001ff290(&t, (V *)(m + 0x10), v); c = *(u32 *)(m + 4) + 0xFE000000; *(u32 *)(m + 4) = c; - if ((c & 0xFF000000) - 1 > 0x5EFFFFFF || FUN_001f9770(m + 0xA) != 0) { - FUN_L00_00267a08(m); + if ((c & 0xFF000000) - 1 > 0x5EFFFFFF || fast_dec_timer_s16(m + 0xA) != 0) { + free_effect_particle(m); } else { f32 f = *(f32 *)(m + 0xC); m[8]++; @@ -370,15 +373,15 @@ void FUN_L00_00271ec8(u8 *m) { /* Ported from rac1-decomp (src/overlays/shared/partupd_00272158.c: func_L00_00272E60), where it is exact; names translated to the US level program. */ -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_001fa6e0(int, int, float); -extern void FUN_L00_00267a08(void *); +extern void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); void FUN_L00_00271fc0(char *m) { char *v; float f; - if (FUN_001f9770(m + 0xA)) { - FUN_L00_00267a08(m); + if (fast_dec_timer_s16(m + 0xA)) { + free_effect_particle(m); } else { v = m + 0x20; f = convert_integer_to_float(*(short *)(m + 0xA)) * *(float *)(v + 0x10); @@ -390,6 +393,8 @@ void FUN_L00_00271fc0(char *m) { int FUN_00213260_272060(int) __asm__("FUN_00213260"); int FUN_001fa6d0_272060(float) __asm__("FUN_001fa6d0"); extern unsigned char *D_L00_001B2154 __attribute__((section(".data"))); +unsigned char *FUN_L00_00272060(void *pos, int s, int color, int mode, int b, float *v, float x, + float y, float z); unsigned char *FUN_L00_00272060(void *pos, int s, int color, int mode, int b, float *v, float x, float y, float z) { unsigned char *m = p27fe00_alloc(0x35); @@ -587,49 +592,49 @@ typedef struct { f32 unk2C; Q_2726d8 q; } P_2726d8; -void FUN_L00_00267a08(void *); +void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); f32 random_float_between(f32, f32) __asm__("FUN_002132a8"); void moby_point_position(void *, s32, void *) __asm__("FUN_L00_0024f7c8"); -void FUN_001f9a28(void *, void *, void *); -f32 FUN_001f9af0(void *); +void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); +f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); void fast_vec_normalize(void *, void *, f32) __asm__("FUN_001f9bf8"); -void FUN_001f9a10(void *, void *, void *); +void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); void FUN_L00_002726d8(P_2726d8 *p) { Q_2726d8 *q = &p->q; u128_2726d8 t; f32 save, sc, r2, f; if (p->q.owner == 0 || *(s16 *)(p->q.owner + 0xA6) != q->x8 || p->q.owner[0x20] == 0xFE || p->q.owner[0x20] == 0xFD) { - FUN_L00_00267a08(p); + free_effect_particle(p); return; } sc = q->xC * random_float_between(0.5f, 1.0f); save = p->unk2C; qcopy(&t, &p->pos); moby_point_position(p->q.owner, q->x4, &p->pos); - FUN_001f9a28(&t, &t, &p->pos); + fast_vec_sub(&t, &t, &p->pos); r2 = random_float_between(-0.021f, 0.021f); - if (FUN_001f9af0(&t) < 0.0625f) { + if (fast_vec_length(&t) < 0.0625f) { f = r2 + 0.0625f; } else { - f = FUN_001f9af0(&t) + r2; + f = fast_vec_length(&t) + r2; } fast_vec_normalize(&t, &t, f); - FUN_001f9a10((u8 *)p + 0x20, &p->pos, &t); + fast_vec_add((u8 *)p + 0x20, &p->pos, &t); *(f32 *)((u8 *)p + 0x1C) = sc; p->unk2C = save; } void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); -void FUN_001f9a10(void *, void *, void *); -void FUN_L00_00267a08(void *); +void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); void FUN_L00_00272838(u8 *m) { s32 n; fast_vec_scale(m + 0x20, m + 0x20, 0.975f); - FUN_001f9a10(m + 0x10, m + 0x10, m + 0x20); + fast_vec_add(m + 0x10, m + 0x10, m + 0x20); *(f32 *)(m + 0xC) += 6300.0f; n = m[4] - 4; if (n <= 0) { - FUN_L00_00267a08(m); + free_effect_particle(m); } else { s32 t = (n << 8) | 0x60000000; *(s32 *)(m + 4) = ((n << 16) | t) | n; @@ -804,6 +809,8 @@ void FUN_L00_00272bc0(unsigned char *p) { extern char D_0013F3D0[] __attribute__((section(".data"))); int FUN_001fa6d0_00272f68(float) __asm__("FUN_001fa6d0"); extern unsigned char *D_L00_001B2080_lui[] __asm__("D_L00_001B2080") __attribute__((section(".data"))); +unsigned char *FUN_L00_00272f68(u128 *a, int c, unsigned char b, int idx, int flag, int n, int mode, + float f); unsigned char *FUN_L00_00272f68(u128 *a, int c, unsigned char b, int idx, int flag, int n, int mode, float f) { unsigned char *m = p27fe00_alloc(0x3B); @@ -824,22 +831,24 @@ unsigned char *FUN_L00_00272f68(u128 *a, int c, unsigned char b, int idx, int fl } return m; } -void FUN_001f9a10(void *, void *, void *); -s32 FUN_001f9770(void *); -void FUN_L00_00267a08(void *); +void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +s32 fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); /* Adds the vector at D_0013F3D0 in mode 1, then calls 00267a08 once the timer at +0xA ends. */ void FUN_L00_00273088(u8 *a) { u8 *q = a + 0x20; if (*(s32 *)(q + 0x10) == 1) - FUN_001f9a10(a + 0x10, &hero.motion.pos, q); - if (FUN_001f9770(a + 0xA)) - FUN_L00_00267a08(a); + fast_vec_add(a + 0x10, &hero.motion.pos, q); + if (fast_dec_timer_s16(a + 0xA)) + free_effect_particle(a); } typedef struct { u8 p0[0x80]; f32 x, y, z; } G_2730e0; int FUN_001fa6d0_2730e0(float) __asm__("FUN_001fa6d0"); +unsigned char *FUN_L00_002730e0(float *pos, OvlQuad *vel, int color, u8 life, u8 b, int mode, + float scale); unsigned char *FUN_L00_002730e0(float *pos, OvlQuad *vel, int color, u8 life, u8 b, int mode, float scale) { unsigned char *m; @@ -1034,7 +1043,7 @@ unsigned char *FUN_L00_00273708(void *a, int b, int c) { /* Ported from rac1-decomp (src/overlays/shared/partupd_00272158.c: func_L00_002746A0), where it is exact; names translated to the US level program. */ -extern void FUN_L00_00267a08(void *); +extern void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); void FUN_L00_00273800(char *a) { char *s = a + 0x20; @@ -1052,7 +1061,7 @@ void FUN_L00_00273800(char *a) { t = w >> 24; t -= *(short *)(a + 0x20); if (t <= 0) { - FUN_L00_00267a08(a); + free_effect_particle(a); } else { *(int *)(a + 4) = (w & 0xFFFFFF) | (t << 24); } @@ -1060,7 +1069,7 @@ void FUN_L00_00273800(char *a) { /* Spawns a type-64 particle at pos moving with vel, sprite size chosen by distance to the hero. */ /* Ported from rac1-decomp (src/overlays/shared/partupd_00272158.c: func_L00_00274788), where it is exact; names translated to the US level program. */ -extern float FUN_001f9b80(void *, void *); +extern float vector_distance(void *, void *) __asm__("FUN_001f9b80"); extern unsigned char *D_L00_001B2180[]; extern unsigned char D_0013F3D0_c[] __asm__("D_0013F3D0"); @@ -1070,7 +1079,7 @@ unsigned char *FUN_L00_002738e8(void *pos, void *vel, float scale, int life, flo if (r != 0) { u = r + 0x20; qcopy(r + 0x10, pos); - if (FUN_001f9b80(D_0013F3D0_c, pos) < 80.0f) { + if (vector_distance(D_0013F3D0_c, pos) < 80.0f) { r[9] = truncate_float_to_s32(1.0f) + 0x30; } else { r[9] = truncate_float_to_s32(1.0f) + 0x20; @@ -1116,7 +1125,7 @@ extern s32 FUN_L00_00257b90(s32, s32); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern unsigned char *FUN_L00_0026bb70(void *a, void *b, int c, int d, float f, int n, int e, int g, int h); -extern unsigned char *FUN_L00_0026bed0(void *a, void *b, int c, int d, float f, int n, int k); +extern unsigned char *mine_debris(void *a, void *b, int c, int d, float f, int n, int k) __asm__("FUN_L00_0026bed0"); extern int FUN_L00_002371e0(int, int, float); extern u32 D_L00_00160228 __attribute__((sda)); @@ -1127,9 +1136,9 @@ void FUN_L00_00273a68(struct EmberParticle *p) { s32 n, c1, c2; f32 f; - if (FUN_001f9770(&p->life)) + if (fast_dec_timer_s16(&p->life)) m->vel.f[2] -= m->gravity; - FUN_001f9a10(&p->pos, &p->pos, &m->vel); + fast_vec_add(&p->pos, &p->pos, &m->vel); p->spin += 2; if (!(p->pos.f[2] < m->floor_z)) return; @@ -1175,10 +1184,10 @@ void FUN_L00_00273a68(struct EmberParticle *p) { t.f[2] -= 1.5f; f = random_float_between(420000.0f, 630000.0f); n = FUN_L00_00257b90(scale_game_frames(0x5A), scale_game_frames(0x96)); - FUN_L00_0026bed0(&t, &m->vel, c1, c2, f, n, 3); + mine_debris(&t, &m->vel, c1, c2, f, n, 3); } } - FUN_L00_00267a08(p); + free_effect_particle(p); } extern V00271d20 D_L00_00173E60 __attribute__((section(".data"))); void FUN_001f9a10_273ee0(void *, void *, void *) __asm__("FUN_001f9a10"); @@ -1269,13 +1278,13 @@ unsigned char *FUN_L00_002741a0(void *a, int color, float s, float z) { /* Ported from rac1-decomp (src/overlays/shared/partupd_00272158.c: func_L00_002751A8), where it is exact; names translated to the US level program. */ -extern void FUN_001f9a10(void *, void *, void *); -extern void FUN_L00_00267a08(void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +extern void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); void FUN_L00_00274308(char *m) { char *v = m + 0x20; int t; - FUN_001f9a10(m + 0x10, m + 0x10, v); + fast_vec_add(m + 0x10, m + 0x10, v); *(float *)(m + 0xC) += *(float *)(v + 0x10); m[8] += 1; t = *(unsigned short *)(m + 0xA) - 1; @@ -1285,14 +1294,14 @@ void FUN_L00_00274308(char *m) { *(short *)(m + 0xA) = 2; } if ((*(int *)(m + 4) & 0xFF000000) == 0) { - FUN_L00_00267a08(m); + free_effect_particle(m); } } extern unsigned char *D_L00_001B218C __attribute__((section(".data"))); unsigned char *FUN_L00_002678b8(int); int FUN_001fa6d0(float); int FUN_00213260(int); -float FUN_001fa6c0(int); +float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); unsigned char *FUN_L00_002743a8(int k, u128 *pos, int n, float x, float y, int mode, int col, float *vec) { @@ -1317,7 +1326,7 @@ unsigned char *FUN_L00_002743a8(int k, u128 *pos, int n, float x, float y, int m m[2] = D_L00_001B218C[1]; } if (mode == 0) { - *(short *)(v + 0x1A) = FUN_001fa6d0(127.0f / FUN_001fa6c0(n)); + *(short *)(v + 0x1A) = FUN_001fa6d0(127.0f / convert_integer_to_float(n)); } if (vec) { *(float *)(v + 0) = vec[0]; @@ -1473,6 +1482,7 @@ extern int FUN_001f96f8_274948(int) __asm__("FUN_001f96f8"); extern float FUN_001fa6c0_274948(int) __asm__("FUN_001fa6c0"); extern unsigned char *D_L00_001B2194 __attribute__((section(".data"))); +unsigned char *FUN_L00_00274948(u128 *a, u128 *b, int c, int d); unsigned char *FUN_L00_00274948(u128 *a, u128 *b, int c, int d) { unsigned char *m = p27fe00_alloc(0x45); if (m) { @@ -1570,7 +1580,7 @@ unsigned char *FUN_L00_00274cf8(void *a, int idx, float ang) { /* Ported from rac1-decomp (src/overlays/shared/partupd_00272158.c: func_L00_00275C80), where it is exact; names translated to the US level program. */ -extern void FUN_L00_00267a08(void *); +extern void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); /* Every second tick lowers the top byte at a+4 by 1; calls 00267a08 once it reaches 0. */ void FUN_L00_00274de0(char *a) { @@ -1581,7 +1591,7 @@ void FUN_L00_00274de0(char *a) { *(short *)(a + 0xA) = 2; } if ((*(int *)(a + 4) & 0xFF000000) == 0) - FUN_L00_00267a08(a); + free_effect_particle(a); } typedef struct { f32 x, y, z, w; @@ -1722,14 +1732,14 @@ unsigned char *FUN_L00_00275158(void *a, void *b, int n, float f) { /* Ported from rac1-decomp (src/overlays/shared/partupd_00272158.c: func_L00_00276180), where it is exact; names translated to the US level program. */ -extern void FUN_L00_00267a08(void *); +extern void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); -/* Adds byte 0x38 to byte 8; calls FUN_L00_00267a08 once the float at 0xC is <= 0. */ +/* Adds byte 0x38 to byte 8; calls free_effect_particle once the float at 0xC is <= 0. */ void FUN_L00_002752e0(char *a) { *(unsigned char *)(a + 8) = *(unsigned char *)(a + 8) + *(unsigned char *)(a + 0x38); if (*(float *)(a + 0xC) <= 0.0f) { *(float *)(a + 0xC) = 0.0f; - FUN_L00_00267a08(a); + free_effect_particle(a); } } typedef union { @@ -1879,13 +1889,13 @@ void FUN_L00_002756f0(unsigned char *m) { } extern int D_L00_00160240 __attribute__((sda)); void FUN_L00_00259430(); -int FUN_001f9770(void *); -void FUN_L00_00267a08(); +int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +void free_effect_particle() __asm__("FUN_L00_00267a08"); /* Lowers the top byte at p+4 by D_L00_00160240; calls 00267a08 once fast_dec_timer_s16(p+0xA) is set. */ void FUN_L00_00275810(char *p) { FUN_L00_00259430(p + 4, D_L00_00160240); - if (FUN_001f9770(p + 0xA)) - FUN_L00_00267a08(p); + if (fast_dec_timer_s16(p + 0xA)) + free_effect_particle(p); } typedef union { u128 q; @@ -1900,23 +1910,23 @@ typedef struct { V00275860 pos; V00275860 vel; } O00275860; -f32 FUN_001fa6c0(s32); +f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); s32 FUN_001fa6d0(f32); -void FUN_001f9a10(void *, void *, void *); -s32 FUN_001f9770(void *); -void FUN_L00_00267a08(void *); +void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); +s32 fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); +void free_effect_particle(void *) __asm__("FUN_L00_00267a08"); void FUN_L00_00275860(O00275860 *o) { V00275860 t; f32 w, k; t.q = o->vel.q; w = t.f[3]; t.f[3] = 0.0f; - k = FUN_001fa6c0(o->h) / w; + k = convert_integer_to_float(o->h) / w; o->col = (FUN_001fa6d0(k * 38.0f) << 24) | 0x808080; o->a = FUN_001fa6d0(k * 33.0f); - FUN_001f9a10(&o->pos, &o->pos, &t); - if (FUN_001f9770(&o->h)) - FUN_L00_00267a08(o); + fast_vec_add(&o->pos, &o->pos, &t); + if (fast_dec_timer_s16(&o->h)) + free_effect_particle(o); } extern int FUN_001fa6d0_275910(float) __asm__("FUN_001fa6d0"); extern int FUN_00213260_275910(int) __asm__("FUN_00213260"); @@ -2025,11 +2035,11 @@ void FUN_L00_00275aa0(char *m) { w[2] = a[2]; } } - if (FUN_001f9770(m + 0xA)) { - FUN_L00_00267a08(m); + if (fast_dec_timer_s16(m + 0xA)) { + free_effect_particle(m); } } -extern float FUN_001fa6c0(int); +extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); void FUN_L00_00275d68(unsigned char *m) { float *v = (float *)(m + 0x20); @@ -2039,25 +2049,25 @@ void FUN_L00_00275d68(unsigned char *m) { v[0] += v[4]; v[1] += v[5]; v[2] += v[6]; - FUN_001f9a10(m + 0x10, (char *)*(int *)(v + 7) + 0x10, v); + fast_vec_add(m + 0x10, (char *)*(int *)(v + 7) + 0x10, v); } else { ((float *)(m + 0x10))[0] += v[4]; ((float *)(m + 0x10))[1] += v[5]; ((float *)(m + 0x10))[2] += v[6]; } - if (FUN_001f9770(m + 0xA)) { - FUN_L00_00267a08(m); + if (fast_dec_timer_s16(m + 0xA)) { + free_effect_particle(m); return; } if (*(int *)(v + 7)) { c = *(int *)(m + 4) & 0xFFFFFF; *(int *)(m + 4) = FUN_001fa6e0(c, *(int *)(m + 4), - FUN_001fa6c0(*(short *)(m + 0xA) - 1) / FUN_001fa6c0(*(short *)(m + 0xA))); + convert_integer_to_float(*(short *)(m + 0xA) - 1) / convert_integer_to_float(*(short *)(m + 0xA))); } else { *(int *)(m + 4) = FUN_001fa6e0(0, *(int *)(m + 4), - FUN_001fa6c0(*(short *)(m + 0xA) - 1) / FUN_001fa6c0(*(short *)(m + 0xA))); + convert_integer_to_float(*(short *)(m + 0xA) - 1) / convert_integer_to_float(*(short *)(m + 0xA))); } } typedef struct { @@ -2116,3 +2126,68 @@ void FUN_L00_00276078(void) { } } } + +s32 D_L02_001B2730[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2774[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2788[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B25B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B25B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B25B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B25BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2608[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B28B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B28F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2908[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B21B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B21B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B21B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B21C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2930[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2934[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2938[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2974[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2988[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B29A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B25B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B25B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B25B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2608[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2B30[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2B34[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2B74[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2B88[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B25B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B25B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2608[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2620[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B2430[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B2434[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B2438[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B2448[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B2474[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B2488[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2830[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2848[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2874[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2880[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2888[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2894[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B28A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2730[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2734[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2738[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2788[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2794[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B25B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B25B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B25B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2608[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2A30[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2A34[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2A38[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2A88[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2B30[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2B34[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2B38[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2B74[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2B88[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/rendering/0027f5f0.c b/src/overlays/shared/rendering/0027f5f0.c index 7874e238d0..69535a9d62 100644 --- a/src/overlays/shared/rendering/0027f5f0.c +++ b/src/overlays/shared/rendering/0027f5f0.c @@ -51,3 +51,6 @@ void FUN_L08_0027f5f0(void *pos, int kind, void *vel, float f) { *(float *)(p + 0x2C) = f; } } + +s32 D_L12_001B2624[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B28A4[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/rendering/0027f660.c b/src/overlays/shared/rendering/0027f660.c index d620de9db1..1c27fa7732 100644 --- a/src/overlays/shared/rendering/0027f660.c +++ b/src/overlays/shared/rendering/0027f660.c @@ -90,7 +90,8 @@ extern int trunc_285768(float) __asm__("FUN_001fa6d0"); /* Allocates a type 0x29 particle and fills it from the arguments; kind 0xFF * derives the frame from flags and picks one of two blend modes. */ -char *FUN_L01_00285768(float scale, void *pos, int a, int idx, int b, unsigned char flags, short h, unsigned char kind) { +char *draw_number(float scale, void *pos, int a, int idx, int b, unsigned char flags, short h, unsigned char kind) __asm__("FUN_L01_00285768"); +char *draw_number(float scale, void *pos, int a, int idx, int b, unsigned char flags, short h, unsigned char kind) { char *r = alloc_285768(0x29); if (r != 0) { int *tail = (int *)(r + 0x20); @@ -232,6 +233,7 @@ typedef struct { extern float fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); float absolute_float(float input) __asm__("func_001F99C0"); +int FUN_L01_0028b510(void *arg0, List *arg1, float target); int FUN_L01_0028b510(void *arg0, List *arg1, float target) { int best = 0; int i; @@ -245,6 +247,7 @@ int FUN_L01_0028b510(void *arg0, List *arg1, float target) { } return best; } +int FUN_L01_0028b5e0(char *a0, List *list, char *pt, char *out); int FUN_L01_0028b5e0(char *a0, List *list, char *pt, char *out) { int idx0 = -1; int idx1 = -1; @@ -384,7 +387,7 @@ void FUN_L01_0028b8c8(void *out, int *l, int idx, float a, float b) { } /* Ported from rac1-decomp (src/overlays/shared/partupd_00280428.c: func_L01_0028C848), where it is exact; names translated to the US level program. */ -extern void FUN_001f9a10(void *, void *, void *); +extern void fast_vec_add(void *, void *, void *) __asm__("FUN_001f9a10"); extern void fast_vec_scale(void *, void *, float) __asm__("FUN_001f9a68"); void FUN_L01_0028ba80(float t, void *out, void *p1, void *p2, void *p3, void *p4) { @@ -396,11 +399,11 @@ void FUN_L01_0028ba80(float t, void *out, void *p1, void *p2, void *p3, void *p4 float c = t2 + t2; fast_vec_scale(out, p1, a - b + 1.0f); fast_vec_scale(tmp, p3, t3 - c + t); - FUN_001f9a10(out, out, tmp); + fast_vec_add(out, out, tmp); fast_vec_scale(tmp, p4, t3 - t2); - FUN_001f9a10(out, out, tmp); + fast_vec_add(out, out, tmp); fast_vec_scale(tmp, p2, b - a); - FUN_001f9a10(out, out, tmp); + fast_vec_add(out, out, tmp); } float FUN_L01_0028bb90(float a, float b, T_28b828 *path, int particles, void *moby) { OvlVec4 previousTangent; @@ -417,7 +420,7 @@ float FUN_L01_0028bb90(float a, float b, T_28b828 *path, int particles, void *mo *(int *)path = 0; nextNode.q = *(OvlQuad *)((char *)path->f10 + 0x10); if (particles) { - FUN_L01_00285768(0.666f, &nextNode, (int)moby, 0, 0x80101080, 0x7f, -1, 0xff); + draw_number(0.666f, &nextNode, (int)moby, 0, 0x80101080, 0x7f, -1, 0xff); } /* The SN ABI assigns float arguments independently of the integer arguments. * Keep the retail argument setup order without changing the shared helper. */ @@ -432,7 +435,7 @@ float FUN_L01_0028bb90(float a, float b, T_28b828 *path, int particles, void *mo currentNode.q = nextNode.q; previousTangent.q = nextTangent.q; if (particles) { - FUN_L01_00285768(1.0f, ¤tNode, (int)moby, index % 15 + 2, 0x80108010, 0x7f, -1, 0xff); + draw_number(1.0f, ¤tNode, (int)moby, index % 15 + 2, 0x80108010, 0x7f, -1, 0xff); } t = 0.05f; nextIndex = FUN_L01_0028b828(path, index + 1); @@ -444,7 +447,7 @@ float FUN_L01_0028bb90(float a, float b, T_28b828 *path, int particles, void *mo step = t; do { if (particles) { - FUN_L01_00285768(0.2f, &previousPoint, (int)moby, 0, 0x80404080, 0x7f, -1, 0xff); + draw_number(0.2f, &previousPoint, (int)moby, 0, 0x80404080, 0x7f, -1, 0xff); } FUN_L01_0028ba80(t, &point, ¤tNode, &nextNode, &previousTangent, &nextTangent); t += step; @@ -461,3 +464,15 @@ float FUN_L01_0028bb90(float a, float b, T_28b828 *path, int particles, void *mo *(int *)path = savedIndex; return total; } + +s32 D_L04_001B220C[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B25D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2838[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B28B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B25D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2B50[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B25D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B2450[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B278C[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B26B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B29B8[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/rendering/0029a2a0.c b/src/overlays/shared/rendering/0029a2a0.c index 7cf7c0dcbf..c61d7f9a32 100644 --- a/src/overlays/shared/rendering/0029a2a0.c +++ b/src/overlays/shared/rendering/0029a2a0.c @@ -43,6 +43,7 @@ extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern unsigned char *D_L07_001B21F4 __asm__("D_L07_001B21F4") __attribute__((section(".data"))); extern float D_L07_00166E40[]; +unsigned char *FUN_L07_0029b8d8(void *m, short index, float amount, float factor); unsigned char *FUN_L07_0029b8d8(void *m, short index, float amount, float factor) { float v[4]; float t[4]; @@ -75,3 +76,5 @@ unsigned char *FUN_L07_0029b8d8(void *m, short index, float amount, float factor } return p; } + +s32 D_L13_001B244C[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/rendering/commands/0020bc88.c b/src/overlays/shared/rendering/commands/0020bc88.c index 356b41f0a9..48a0567cbc 100644 --- a/src/overlays/shared/rendering/commands/0020bc88.c +++ b/src/overlays/shared/rendering/commands/0020bc88.c @@ -9,6 +9,7 @@ extern int *D_L02_001611B8[] __attribute__((section(".sdata"))); extern char D_L02_001609A0[]; /* Append a 0x154-tagged packet to the display list: header, qcopy of a static block, then four vector triples (a, b, m rows), a value `c` and a flag-dependent word. */ +void FUN_L02_0020bc88(long *m, int *b, int *a, long c, int flag); void FUN_L02_0020bc88(long *m, int *b, int *a, long c, int flag) { int *p; long *q; diff --git a/src/overlays/shared/rendering/culling/0025fa38.c b/src/overlays/shared/rendering/culling/0025fa38.c index 5af492cb55..8dfcfb1b95 100644 --- a/src/overlays/shared/rendering/culling/0025fa38.c +++ b/src/overlays/shared/rendering/culling/0025fa38.c @@ -13,7 +13,7 @@ typedef struct { float x, y, z, w; } Vp __attribute__((aligned(16))); -extern float FUN_001f9b20(void *); +extern float vector_length_xy(void *) __asm__("FUN_001f9b20"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern void transform_vector_by_basis(void *, void *, void *) __asm__("FUN_001f9cf8"); @@ -28,7 +28,7 @@ int FUN_L00_0025fa38(void *p, int i) { subtract_vector_xyz(&a, p, e + 0x30); a.w = 0; transform_vector_by_basis(&b, &a, e + 0x40); - if (FUN_001f9b20(&b) < 1.0f) { + if (vector_length_xy(&b) < 1.0f) { if (-1.0f <= b.z && b.z <= 1.0f) { return 1; } diff --git a/src/overlays/shared/rendering/debug/001f36f8.c b/src/overlays/shared/rendering/debug/001f36f8.c index 39ba8599cc..b4e20a5293 100644 --- a/src/overlays/shared/rendering/debug/001f36f8.c +++ b/src/overlays/shared/rendering/debug/001f36f8.c @@ -1314,3 +1314,31 @@ void FUN_L00_001f58e0(void) { } } +s32 D_L06_0016C7E4[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_0016C860[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_0016C864[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_0016C86C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_0016C870[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_0016C874[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_0016C864[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_0016C8E0[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_0016C8E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_0016C8EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_0016C8F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_0016C8F4[1] __attribute__((section(".data"))) = {0}; +f32 D_L11_0016CAE0[1] __attribute__((section(".data"))) = {0}; +f32 D_L11_0016CAE4[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_0016CAEC[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_0016CAF0[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_0016CAF4[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0016C7E0[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0016C7E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_0016C7EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_0016C7F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_0016C7F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_0016C964[1] __attribute__((section(".data"))) = {0}; +f32 D_L18_0016CAE0[1] __attribute__((section(".data"))) = {0}; +f32 D_L18_0016CAE4[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_0016CAEC[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_0016CAF0[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_0016CAF4[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/rendering/effects/001edf60.c b/src/overlays/shared/rendering/effects/001edf60.c index 10de1c6ea9..80d2527540 100644 --- a/src/overlays/shared/rendering/effects/001edf60.c +++ b/src/overlays/shared/rendering/effects/001edf60.c @@ -22,7 +22,8 @@ typedef struct { int count; } T1edf60; extern T1edf60 D_L00_00169040; -void FUN_L00_001edf60(int a, int b, OvlQuad *pos, int kind, int mode, float x, float y, float z) { +void suck_draw_reticle(int a, int b, OvlQuad *pos, int kind, int mode, float x, float y, float z) __asm__("FUN_L00_001edf60"); +void suck_draw_reticle(int a, int b, OvlQuad *pos, int kind, int mode, float x, float y, float z) { E1edf60 *e; if (D_L00_0015F5C4 == 2) return; diff --git a/src/overlays/shared/rendering/effects/0023db30.c b/src/overlays/shared/rendering/effects/0023db30.c index bd7ebd6ffe..1030ec8722 100644 --- a/src/overlays/shared/rendering/effects/0023db30.c +++ b/src/overlays/shared/rendering/effects/0023db30.c @@ -15,15 +15,15 @@ typedef struct { float texcoords[8]; u64 texture[4]; } __attribute__((aligned(16))) Quad_0023db30; -extern u64 get_texture_0023db30(int) __asm__("FUN_L00_001f9298"); -extern void getpos_0023db30(void *, int, void *) __asm__("FUN_L00_0024f728"); -extern void rotate_0023db30(float, void *, void *, void *) __asm__("FUN_L00_0025fc08"); -extern void cross_0023db30(void *, void *, void *) __asm__("FUN_L00_001ff3c0"); -extern void scale_0023db30(float, void *, void *) __asm__("FUN_L00_001ff500"); +extern u64 FUN_L00_001f9298(int); +extern void FUN_L00_0024f728(void *, int, void *); +extern void FUN_L00_0025fc08(float, void *, void *, void *); +extern void FUN_L00_001ff3c0(void *, void *, void *); +extern void FUN_L00_001ff500(float, void *, void *); extern void scale_to_0023db30(float, void *, void *) __asm__("FUN_L00_001ff300"); -extern void add_0023db30(void *, void *, void *) __asm__("FUN_L00_001ff278"); -extern void clear_0023db30(void *) __asm__("FUN_L00_001ff260"); -extern void draw_0023db30(void *, void *, int) __asm__("FUN_L00_001fd228"); +extern void FUN_L00_001ff278(void *, void *, void *); +extern void FUN_L00_001ff260(void *); +extern void FUN_L00_001fd228(void *, void *, int); extern char D_L00_0015FC0A; void FUN_L00_0023db30(void *m) { @@ -37,7 +37,7 @@ void FUN_L00_0023db30(void *m) { int i; OvlVec4 *p; OvlVec4 *point1; OvlVec4 *copied_ptr; OvlVec4 *other_ptr; - texture = get_texture_0023db30(14); + texture = FUN_L00_001f9298(14); quad.colors[0] = 0x3ff08080; quad.colors[1] = 0x3ff08080; quad.colors[2] = 0x3ff08030; @@ -54,24 +54,24 @@ void FUN_L00_0023db30(void *m) { quad.texcoords[5] = 1.0f; quad.texcoords[6] = 1.0f; quad.texcoords[7] = 1.0f; - getpos_0023db30(m, 0, &pos); + FUN_L00_0024f728(m, 0, &pos); four = 4.0f; - rotate_0023db30(-0.34906584f, &pos, &pos, &rot); - cross_0023db30(&rot, &pos, &normal); - scale_0023db30(1.0f, &rot, &rot); - cross_0023db30(&normal, &rot, &pos); + FUN_L00_0025fc08(-0.34906584f, &pos, &pos, &rot); + FUN_L00_001ff3c0(&rot, &pos, &normal); + FUN_L00_001ff500(1.0f, &rot, &rot); + FUN_L00_001ff3c0(&normal, &rot, &pos); base.f[3] = 1.0f; scale_to_0023db30(four, &scaled, &pos); scaled.f[3] = 1.0f; - add_0023db30(&offset, &scaled, &base); + FUN_L00_001ff278(&offset, &scaled, &base); qcopy(&copied, &pos); - add_0023db30(&other, &copied, &pos); + FUN_L00_001ff278(&other, &copied, &pos); { quarter = 0.25f; copied.f[3] = quarter; other.f[3] = 0.5f; - clear_0023db30(&quad.points[0]); + FUN_L00_001ff260(&quad.points[0]); quad.points[0].i[2] = 0; quad.points[0].f[3] = 1.0f; point1 = &quad.points[1]; @@ -80,14 +80,14 @@ void FUN_L00_0023db30(void *m) { quad.points[1].f[2] += minus_quarter; quad.points[1].f[0] = four * copied.f[3]; quad.points[1].f[3] = 1.0f; - clear_0023db30(&quad.points[2]); + FUN_L00_001ff260(&quad.points[2]); quad.points[2].i[2] = 0; quad.points[2].f[3] = 1.0f; qcopy(&quad.points[3], &copied); quad.points[3].f[2] += quarter; quad.points[3].f[0] = four * copied.f[3]; quad.points[3].f[3] = 1.0f; - draw_0023db30(&quad, &pos, 1); + FUN_L00_001fd228(&quad, &pos, 1); i = 1; p = point1; @@ -102,7 +102,7 @@ void FUN_L00_0023db30(void *m) { i += 2; p += 2; } while (i < 4); - draw_0023db30(&quad, &pos, 1); + FUN_L00_001fd228(&quad, &pos, 1); } { @@ -125,7 +125,7 @@ void FUN_L00_0023db30(void *m) { quad.points[3].f[0] = other_x; quad.points[3].f[2] += 0.25f; quad.points[3].f[3] = 1.0f; - draw_0023db30(&quad, &pos, 1); + FUN_L00_001fd228(&quad, &pos, 1); i = 0; p = quad.points; do { @@ -139,7 +139,7 @@ void FUN_L00_0023db30(void *m) { i += 1; p += 1; } while (i < 4); - draw_0023db30(&quad, &pos, 1); + FUN_L00_001fd228(&quad, &pos, 1); } { @@ -148,7 +148,7 @@ void FUN_L00_0023db30(void *m) { quad.points[0].f[0] = four * other.f[3]; quad.points[0].f[2] += minus_quarter; quad.points[0].f[3] = 1.0f; - clear_0023db30(point1); + FUN_L00_001ff260(point1); other_x = 3.0f; quad.points[1].f[0] = four * copied.f[3] * other_x; quad.points[1].f[2] += *(float *)(&D_L00_0015FC0A - 0x102); @@ -158,11 +158,11 @@ void FUN_L00_0023db30(void *m) { quarter = 0.25f; quad.points[2].f[2] += quarter; quad.points[2].f[3] = 1.0f; - clear_0023db30(&quad.points[3]); + FUN_L00_001ff260(&quad.points[3]); quad.points[3].f[0] = four * copied.f[3] * other_x; quad.points[3].i[2] = 0; quad.points[3].f[3] = 1.0f; - draw_0023db30(&quad, &pos, 1); + FUN_L00_001fd228(&quad, &pos, 1); i = 0; p = quad.points; do { @@ -176,7 +176,7 @@ void FUN_L00_0023db30(void *m) { i += 2; p += 2; } while (i < 4); - draw_0023db30(&quad, &pos, 1); + FUN_L00_001fd228(&quad, &pos, 1); } } #endif @@ -189,8 +189,8 @@ extern float rnda_23e008(void) __asm__("FUN_00213308"); extern void dir_23e008(void *, float, float, float) __asm__("FUN_00214db0"); extern float rnd_23e008(float, float) __asm__("FUN_L00_00257c48"); extern int fr_23e008(int) __asm__("FUN_001f96f8"); -extern unsigned char *emit_23e008(float *, int, float, float, float, int, int, int, - void *) __asm__("FUN_L00_00272060"); +extern unsigned char *FUN_L00_00272060(float *, int, float, float, float, int, int, int, + void *); extern int rf_23e008(float) __asm__("FUN_001fa6d0"); void FUN_L00_0023e008(void *p) { @@ -213,11 +213,11 @@ void FUN_L00_0023e008(void *p) { pos[0] += rnd_23e008(0.0f, 0.15f); pos[1] += rnd_23e008(0.0f, 0.15f); pos[2] += rnd_23e008(0.0f, 0.15f); - r = emit_23e008(pos, fr_23e008(0x3C), s * 0.1f, s, 0.009f, 0x7F7F2020, 0, k, dir); + r = FUN_L00_00272060(pos, fr_23e008(0x3C), s * 0.1f, s, 0.009f, 0x7F7F2020, 0, k, dir); if (r) r[9] = rf_23e008(4.0f) + 0x70; k = -k; - r = emit_23e008(pos, fr_23e008(0x3C), s * 0.07f, s * 0.7f, 0.009f, 0x7F7F7F7F, 1, k, dir); + r = FUN_L00_00272060(pos, fr_23e008(0x3C), s * 0.07f, s * 0.7f, 0.009f, 0x7F7F7F7F, 1, k, dir); if (r) r[9] = rf_23e008(4.0f) + 0x70; } @@ -304,6 +304,7 @@ typedef struct { extern T_0023e738 D_L00_001804C0_0023e738[] __asm__("D_L00_001804C0"); extern P_0023e738 D_L00_001802C0_0023e738[] __asm__("D_L00_001802C0"); void FUN_001f9810_0023e738(void *, int) __asm__("FUN_001f9810"); +int FUN_L00_0023e738(u128 *v, float a, float b_0023e738, float c, float d, float e); int FUN_L00_0023e738(u128 *v, float a, float b_0023e738, float c, float d, float e) { int i; T_0023e738 *t; @@ -333,6 +334,7 @@ extern char D_L00_001804C0[]; void detach_point_light() __asm__("FUN_00201f88"); void fast_mem_zero16() __asm__("FUN_001f9810"); /* Detaches the point light and clears entry i of D_L00_001802C0 and D_L00_001804C0. */ +void FUN_L00_0023e838(int i); void FUN_L00_0023e838(int i) { detach_point_light(); fast_mem_zero16(D_L00_001802C0 + i * 32, 32); diff --git a/src/overlays/shared/rendering/effects/002bc210.c b/src/overlays/shared/rendering/effects/002bc210.c index 5d00741eb4..a9a46580d1 100644 --- a/src/overlays/shared/rendering/effects/002bc210.c +++ b/src/overlays/shared/rendering/effects/002bc210.c @@ -98,3 +98,6 @@ extern void FUN_L12_002bc210_u(void *, int, int, int) __asm__("FUN_L12_002bc210" void FUN_L12_002e71b0(void) { FUN_L12_002bc210_u(D_L12_001F5480, 0x2F, get_effect_texture(0x2C), get_effect_texture(0x2D)); } + +f32 D_L15_0017CA60[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0017CA64[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/rendering/effects/create_part.c b/src/overlays/shared/rendering/effects/create_part.c index 6ec44af243..5ddfacbd5d 100644 --- a/src/overlays/shared/rendering/effects/create_part.c +++ b/src/overlays/shared/rendering/effects/create_part.c @@ -7,7 +7,7 @@ INCLUDE_ASM("config/us/overlays/asm/FUN_L00_002678b8.s", FUN_L00_002678b8); #else extern void *create_part2(s32, s32) __asm__("FUN_L00_002678c0"); -/* Calls FUN_L00_002678c0 with type and 0. */ +/* Calls create_part2 with type and 0. */ void *create_part(s32 type) __asm__("FUN_L00_002678b8"); void *create_part(s32 type) { return create_part2(type, 0); diff --git a/src/overlays/shared/rendering/effects/register_part_types.c b/src/overlays/shared/rendering/effects/register_part_types.c index c3ca88e021..2f2914cc71 100644 --- a/src/overlays/shared/rendering/effects/register_part_types.c +++ b/src/overlays/shared/rendering/effects/register_part_types.c @@ -283,3 +283,1002 @@ void FUN_L00_00268fe8(unsigned char *p) { p[2] = D_L00_001B2084[(a - *(short *)(p + 0xa)) * 9 / b]; } } + +s32 D_L00_001B1E84[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1E88[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1E8C[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1E90[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1E94[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1E98[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1E9C[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EA0[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EA4[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EA8[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EAC[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EB0[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EB4[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EB8[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EBC[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EC0[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EC4[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EC8[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1ECC[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1ED0[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1ED4[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1ED8[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EDC[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EE0[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EE4[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EE8[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EEC[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EF0[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EF8[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1EFC[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F00[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F04[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F08[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F0C[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F10[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F14[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F18[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F1C[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F20[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F24[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F28[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F2C[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F30[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F34[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F38[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F3C[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F40[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F44[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F48[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F4C[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F50[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F54[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F58[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F5C[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F60[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F64[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F70[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F74[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F78[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F7C[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F80[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F84[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F88[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F8C[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F90[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F94[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F98[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1F9C[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1FA0[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1FA4[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1FA8[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1FAC[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1FB0[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1FB4[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1FB8[1] __attribute__((section(".data"))) = {0}; +s32 D_L00_001B1FBC[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B23C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B23C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B23C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B23CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B23D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B23D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B23D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B23DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B23E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B23E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B23E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B23EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B23F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B23F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B2408[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B2428[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B242C[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B2430[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B2434[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B2438[1] __attribute__((section(".data"))) = {0}; +s32 D_L01_001B243C[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2484[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2488[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B24F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2504[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2508[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2514[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2520[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2524[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2528[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B252C[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2530[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2534[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2538[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B253C[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2540[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2544[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2548[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B254C[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2550[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2554[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2558[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B255C[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2560[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2564[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2568[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B256C[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2570[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2574[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2578[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2584[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2588[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B258C[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2590[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2594[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B2598[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B259C[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B25A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B25A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B25A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B25AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B25B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B25B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B25B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B25BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1F84[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1F88[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1F8C[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1F90[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1F94[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1F98[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1F9C[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FA0[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FA4[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FA8[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FAC[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FB0[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FB4[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FB8[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FBC[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FC0[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FC4[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FC8[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FCC[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FD0[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FD4[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FD8[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FE4[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FE8[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FEC[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B1FF0[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2000[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2004[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2008[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B200C[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2010[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2014[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2018[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2020[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2024[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2028[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B202C[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2034[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B203C[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2040[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2044[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2048[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2054[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2058[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B205C[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2060[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2064[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B207C[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2080[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2084[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2088[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B208C[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2090[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2094[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B2098[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B209C[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B20A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B20A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B20A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B20AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B20B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B20B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B20B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_001B20BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2004[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2008[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B200C[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2010[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2014[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2018[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2020[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2024[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2028[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B202C[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2034[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B203C[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2040[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2044[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2048[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2054[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2058[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B205C[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2060[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2064[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B207C[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2080[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2084[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2088[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B208C[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2090[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2094[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2098[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B209C[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B20A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B20A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B20A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B20AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B20B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B20B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B20B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B20BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B20C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B20C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B20C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B20CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B20D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B20D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B20F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2108[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B210C[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2110[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2114[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2118[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_001B2134[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B23C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B23C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B23C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B23CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B23D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B23D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B23D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B23DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B23E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B23E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B23E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B23EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B23F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B23F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2408[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2428[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B242C[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2430[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2434[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B2438[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_001B243C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2604[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2608[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B260C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2610[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2614[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2618[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B261C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2620[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2624[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2628[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B262C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2630[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2634[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2638[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B263C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2640[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2644[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2648[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B264C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2650[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2654[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2658[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B265C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2660[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2664[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2668[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B266C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2670[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2674[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2688[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B268C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2690[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2694[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2698[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B269C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B26F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2708[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B270C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2710[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2714[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2718[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B271C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2720[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2724[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2728[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B272C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2730[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2734[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B2738[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_001B273C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F04[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F08[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F0C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F10[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F14[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F18[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F1C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F20[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F24[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F28[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F2C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F30[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F34[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F38[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F3C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F40[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F44[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F48[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F4C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F50[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F54[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F58[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F5C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F60[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F64[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F70[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F74[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F78[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F7C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F80[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F84[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F88[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F8C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F90[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F94[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F98[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1F9C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FA0[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FA4[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FA8[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FAC[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FB0[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FB4[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FB8[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FBC[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FC0[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FC4[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FC8[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FCC[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FD0[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FD4[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FD8[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FE4[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FE8[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FEC[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B1FF0[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B2000[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B2004[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B2008[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B200C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B2010[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B2014[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B2018[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B2020[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B2024[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B2028[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B202C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B2034[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_001B203C[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2688[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B268C[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2690[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2694[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2698[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B269C[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B26F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2708[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B270C[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2710[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2714[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2718[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B271C[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2720[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2724[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2728[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B272C[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2730[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2734[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2738[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B273C[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2740[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2744[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2748[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B274C[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2750[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2754[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2758[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B275C[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2760[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2764[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2768[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B276C[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2770[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2774[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2778[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2784[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2788[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B278C[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2790[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B2794[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B27A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B27A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B27A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B27AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B27B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B27BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2004[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2008[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B200C[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2010[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2014[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2018[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2020[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2024[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2028[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B202C[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2034[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B203C[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2040[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2044[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2048[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2054[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2058[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B205C[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2060[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2064[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B207C[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2080[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2084[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2088[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B208C[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2090[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2094[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2098[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B209C[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B20A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B20A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B20A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B20AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B20B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B20B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B20B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B20BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B20C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B20C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B20C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B20CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B20D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B20D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B20F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2108[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B210C[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2110[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2114[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2118[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_001B2134[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B23C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B23C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B23C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B23CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B23D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B23D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B23D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B23DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B23E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B23E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B23E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B23EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B23F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B23F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2408[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2428[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B242C[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2430[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2434[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B2438[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_001B243C[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2888[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B288C[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2890[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2894[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2898[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B289C[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B28FC[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2900[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2904[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2908[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B290C[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2910[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2914[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2918[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B291C[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2920[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2924[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2928[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B292C[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2930[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2934[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2938[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B293C[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2940[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2944[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2948[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B294C[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2950[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2954[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2958[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B295C[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2960[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2964[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2968[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B296C[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2970[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2974[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2978[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B297C[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2980[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2984[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2988[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B298C[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2990[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2994[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B2998[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B299C[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B29A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B29A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B29A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B29AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B29B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B29B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B29B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B29BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B23C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B23C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B23C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B23CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B23D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B23D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B23D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B23DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B23E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B23E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B23E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B23EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B23F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B23F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2408[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2428[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B242C[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2430[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2434[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B2438[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_001B243C[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B2184[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B2188[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B2190[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B2198[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B21A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B21AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B21B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B21B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B21B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B21BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B21C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B21C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B21C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B21CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B21D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B21D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B21F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B220C[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_001B2210[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2584[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2588[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B258C[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2590[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2594[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2598[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B259C[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B25F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2604[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2608[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B260C[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2610[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2614[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2618[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B261C[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2620[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2624[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2628[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B262C[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2630[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2634[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2638[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B263C[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2640[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2644[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2648[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B264C[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2650[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2654[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2658[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B265C[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2660[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2664[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2668[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B266C[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2670[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2674[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2688[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B268C[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2690[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2694[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B2698[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B269C[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B26A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B26A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B26A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B26AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B26B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B26B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B26B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B26BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2484[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2488[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B24F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2504[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2508[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2514[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2520[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2524[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2528[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B252C[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2530[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2534[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2538[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B253C[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2540[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2544[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2548[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B254C[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2550[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2554[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2558[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B255C[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2560[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2564[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2568[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B256C[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2570[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2574[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2578[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2584[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2588[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B258C[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2590[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2594[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B2598[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B259C[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B25A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B25A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B25A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B25AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B25B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B25B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B25B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B25BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B23C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B23C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B23C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B23CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B23D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B23D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B23D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B23DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B23E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B23E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B23E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B23EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B23F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B23F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2408[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2428[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B242C[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2430[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2434[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B2438[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_001B243C[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2784[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2788[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B278C[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2790[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2794[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B27FC[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2808[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B280C[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2810[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2814[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2820[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2824[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2828[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B282C[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2830[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2834[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2838[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B283C[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2840[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2844[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2848[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B284C[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2850[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2854[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2858[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B285C[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2860[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2864[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2868[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B286C[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2870[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2874[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2878[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B287C[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2880[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2888[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B288C[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2890[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2894[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B2898[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B289C[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B28A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B28A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B28A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B28AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B28B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B28B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B28B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B28BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2888[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B288C[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2890[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2894[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2898[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B289C[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28BC[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28C4[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28C8[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28CC[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28D0[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28D4[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28D8[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28DC[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28E0[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28E4[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28E8[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28EC[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28F0[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28F4[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B28FC[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2900[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2904[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2908[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B290C[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2910[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2914[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2918[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B291C[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2920[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2924[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2928[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B292C[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2930[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2934[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2938[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B293C[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2940[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2944[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2948[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B294C[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2950[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2954[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2958[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B295C[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2960[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2964[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2968[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B296C[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2970[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2974[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2978[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B297C[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2980[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2984[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2988[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B298C[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2990[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2994[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B2998[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B299C[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B29A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B29A4[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B29A8[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B29AC[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B29B0[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B29B4[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B29B8[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_001B29BC[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/rendering/sky/00252570.c b/src/overlays/shared/rendering/sky/00252570.c index 8dff6a2ba0..95feb5aabf 100644 --- a/src/overlays/shared/rendering/sky/00252570.c +++ b/src/overlays/shared/rendering/sky/00252570.c @@ -31,3 +31,19 @@ INCLUDE_ASM("config/us/overlays/asm/FUN_L01_00261d78.s", FUN_L01_00261d78); INCLUDE_ASM("config/us/overlays/asm/FUN_L01_00261df8.s", FUN_L01_00261df8); INCLUDE_ASM("config/us/overlays/asm/FUN_L01_00262038.s", FUN_L01_00262038); INCLUDE_ASM("config/us/overlays/asm/FUN_L01_00262388.s", FUN_L01_00262388); + +s16 D_L01_001CADA0[1] __attribute__((section(".data"))) = {0}; +s16 D_L01_001CAE00[1] __attribute__((section(".data"))) = {0}; +s16 D_L05_001CADA0[1] __attribute__((section(".data"))) = {0}; +s16 D_L05_001CAE00[1] __attribute__((section(".data"))) = {0}; +s16 D_L07_001CA940[1] __attribute__((section(".data"))) = {0}; +s16 D_L07_001CA9A0[1] __attribute__((section(".data"))) = {0}; +s16 D_L07_001CAA00[1] __attribute__((section(".data"))) = {0}; +s16 D_L11_001CB2C0[1] __attribute__((section(".data"))) = {0}; +s16 D_L11_001CB320[1] __attribute__((section(".data"))) = {0}; +s16 D_L11_001CB380[1] __attribute__((section(".data"))) = {0}; +s16 D_L12_001CADA0[1] __attribute__((section(".data"))) = {0}; +s16 D_L12_001CAE00[1] __attribute__((section(".data"))) = {0}; +s16 D_L13_001CABC0[1] __attribute__((section(".data"))) = {0}; +s16 D_L13_001CAC20[1] __attribute__((section(".data"))) = {0}; +s16 D_L13_001CAC80[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/rendering/state/00265880.c b/src/overlays/shared/rendering/state/00265880.c index ad48f27ade..ee8537cdb1 100644 --- a/src/overlays/shared/rendering/state/00265880.c +++ b/src/overlays/shared/rendering/state/00265880.c @@ -11,6 +11,7 @@ extern char D_001516D0[]; /* Stores v in the three entries of D_001516D0 whose flag 0x8000 is set. */ +void FUN_L00_00265880(int v); void FUN_L00_00265880(int v) { char *b = D_001516D0; if (*(short *)(b + 0x40) & 0x8000) diff --git a/src/overlays/shared/rendering/view/00252e18.c b/src/overlays/shared/rendering/view/00252e18.c index 611da7ec9f..ea236a1f69 100644 --- a/src/overlays/shared/rendering/view/00252e18.c +++ b/src/overlays/shared/rendering/view/00252e18.c @@ -12,6 +12,7 @@ extern float FUN_001f9b80_25fcb8(void *, void *) __asm__("FUN_001f9b80"); extern short D_L04_001B09B0[] __attribute__((section(".data"))); extern char *D_L04_001D1700[] __attribute__((section(".data"))); extern struct Hero hero_lui __asm__("D_0013F350") __attribute__((section(".data"))); +int FUN_L04_00252e18(char *a, char *o, float best); int FUN_L04_00252e18(char *a, char *o, float best) { struct Hero *g = &hero_lui; char *m; diff --git a/src/overlays/shared/rendering/view/002603d0.c b/src/overlays/shared/rendering/view/002603d0.c index 6f9f281e32..7ff50bcb28 100644 --- a/src/overlays/shared/rendering/view/002603d0.c +++ b/src/overlays/shared/rendering/view/002603d0.c @@ -3,6 +3,7 @@ #include "asm.h" /* Returns the pointer at +8 of the moby data when flag 0x20 at 0x34 is set, else 0. */ +char *FUN_L00_002603d0(char *m); char *FUN_L00_002603d0(char *m) { if (m == 0) return 0; diff --git a/src/overlays/shared/rendering/view/00274b78.c b/src/overlays/shared/rendering/view/00274b78.c index f557c7f1ea..ddc41f21eb 100644 --- a/src/overlays/shared/rendering/view/00274b78.c +++ b/src/overlays/shared/rendering/view/00274b78.c @@ -12,6 +12,7 @@ extern float FUN_001f9b80_25fcb8(void *, void *) __asm__("FUN_001f9b80"); extern short D_L01_001B0CB0[] __attribute__((section(".data"))); extern char *D_L01_001DD580[] __attribute__((section(".data"))); extern struct Hero hero_lui __asm__("D_0013F350") __attribute__((section(".data"))); +int FUN_L01_00274b78(char *a, char *o, float best); int FUN_L01_00274b78(char *a, char *o, float best) { struct Hero *g = &hero_lui; char *m; diff --git a/src/overlays/shared/rendering/view/00275690.c b/src/overlays/shared/rendering/view/00275690.c index 4f2198ea16..ac91cc73d1 100644 --- a/src/overlays/shared/rendering/view/00275690.c +++ b/src/overlays/shared/rendering/view/00275690.c @@ -11,6 +11,7 @@ extern int fast_bsphere_check(char *, float) __asm__("FUN_001fa728"); extern void scale_vector(void *, void *, float) __asm__("FUN_001f9a80"); +void FUN_L01_00275690(char *vec, float scale); void FUN_L01_00275690(char *vec, float scale) { char scratch[16]; scale_vector(scratch, vec, 0.0009765625f); diff --git a/src/overlays/shared/runtime/dma/002b7a48.c b/src/overlays/shared/runtime/dma/002b7a48.c index 43a6519517..4b9e4a839e 100644 --- a/src/overlays/shared/runtime/dma/002b7a48.c +++ b/src/overlays/shared/runtime/dma/002b7a48.c @@ -13,7 +13,8 @@ extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern int func_001FA898_r(float) __asm__("FUN_001fa6d0"); -void FUN_L01_002b7c68(float *in, int *out) { +void pool_bind_tile(float *in, int *out) __asm__("FUN_L01_002b7c68"); +void pool_bind_tile(float *in, int *out) { out[0] = func_001FA898_r((in[0] + pool_light[2]) * 1024.0f); out[1] = func_001FA898_r((in[1] + pool_light[3]) * 1024.0f); out[2] = func_001FA898_r((in[2] - 1.0f) * 1024.0f); @@ -46,7 +47,8 @@ typedef struct VuChainRecord { extern void memset(void *, s32, s32); -void FUN_L01_002b7a48(VuChainRecord *records, int count) { +void pool_init_tiles(VuChainRecord *records, int count) __asm__("FUN_L01_002b7a48"); +void pool_init_tiles(VuChainRecord *records, int count) { int i; for (i = 0; i < count; i++) { int j; diff --git a/src/overlays/shared/runtime/memory/002018c8.c b/src/overlays/shared/runtime/memory/002018c8.c index 6794cbc53c..9191c62d81 100644 --- a/src/overlays/shared/runtime/memory/002018c8.c +++ b/src/overlays/shared/runtime/memory/002018c8.c @@ -86,7 +86,8 @@ extern void vu1_add_g_sregister(s32, s64) __asm__("FUN_00233980"); #define SCRATCHPAD ((u8 *)0x70000000) -void FUN_L00_002018c8(void) { +void level_draw_dialog_text(void) __asm__("FUN_L00_002018c8"); +void level_draw_dialog_text(void) { char buf[0x200]; struct TextRegion box; diff --git a/src/overlays/shared/ui/help/001fe778.c b/src/overlays/shared/ui/help/001fe778.c index ba0b0aa3d8..97b4895ac6 100644 --- a/src/overlays/shared/ui/help/001fe778.c +++ b/src/overlays/shared/ui/help/001fe778.c @@ -71,7 +71,7 @@ s32 coll_sound_class(void) __asm__("FUN_L00_001f3608"); s32 FUN_001f0b58_c(void) __asm__("FUN_001f0b58"); f32 resolve_camera_surface_height(void *, void *) __asm__("FUN_002135f0"); s32 FUN_L00_0025e3b8(s32); -u8 *FUN_002141f8(s32); +u8 *suck_get_aim_height(s32) __asm__("FUN_002141f8"); f32 fast_vec_dist(void *, void *) __asm__("FUN_001f9b48"); void FUN_00125180_c(void *, void *) __asm__("FUN_00125180"); f32 FUN_L00_00233d30(void *); @@ -165,7 +165,7 @@ void FUN_L15_0020a7a0(void) { if (FUN_L00_0025e3b8(HH.moby)) { hero.unk30A = 1; } - p = FUN_002141f8(HH.moby); + p = suck_get_aim_height(HH.moby); if (p != 0 && (*(u16 *)(p + 0x1E) & 8)) { hero.unk30A = 1; } diff --git a/src/overlays/shared/ui/help/0020a1f8.c b/src/overlays/shared/ui/help/0020a1f8.c index b475a046fc..fc73406a9c 100644 --- a/src/overlays/shared/ui/help/0020a1f8.c +++ b/src/overlays/shared/ui/help/0020a1f8.c @@ -62,3 +62,49 @@ void FUN_L00_002321a8(void) { p[0x2278 / 4] = 0; p[0x227C / 4] = 0; } + +f32 D_L00_0017A7D4[1] __attribute__((section(".data"))) = {0}; +f32 D_L00_0017A884[1] __attribute__((section(".data"))) = {0}; +f32 D_L00_0017A934[1] __attribute__((section(".data"))) = {0}; +f32 D_L01_0017AC54[1] __attribute__((section(".data"))) = {0}; +f32 D_L01_0017AD04[1] __attribute__((section(".data"))) = {0}; +f32 D_L01_0017ADB4[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_0017ADD4[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_0017AE84[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_0017AF34[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_0017A8D4[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_0017A984[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_0017AA34[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_0017A954[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_0017AA04[1] __attribute__((section(".data"))) = {0}; +f32 D_L04_0017AAB4[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_0017AC34[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_0017ACE4[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_0017AD94[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_0017AF54[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_0017B004[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_0017A854[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_0017A904[1] __attribute__((section(".data"))) = {0}; +f32 D_L07_0017A9B4[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_0017AFD4[1] __attribute__((section(".data"))) = {0}; +f32 D_L09_0017A954[1] __attribute__((section(".data"))) = {0}; +f32 D_L09_0017AA04[1] __attribute__((section(".data"))) = {0}; +f32 D_L09_0017AAB4[1] __attribute__((section(".data"))) = {0}; +f32 D_L10_0017AC54[1] __attribute__((section(".data"))) = {0}; +f32 D_L10_0017AD04[1] __attribute__((section(".data"))) = {0}; +f32 D_L10_0017ADB4[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_0017AC54[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_0017AD04[1] __attribute__((section(".data"))) = {0}; +f32 D_L12_0017ADB4[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_0017AAD4[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_0017AB84[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_0017AC34[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0017AED4[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0017AF84[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0017B034[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0017ADD4[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0017AE84[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0017AF34[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_0017AC34[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_0017ACE4[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_0017AD94[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/ui/help/00214658.c b/src/overlays/shared/ui/help/00214658.c index 85577fbc23..3342c13ac2 100644 --- a/src/overlays/shared/ui/help/00214658.c +++ b/src/overlays/shared/ui/help/00214658.c @@ -611,18 +611,18 @@ void FUN_L00_002165b8(void) { break; } } -float FUN_L00_002339d0(void *); -void FUN_L00_00233b20(void *, void *, float); +float gravity_length_xy(void *) __asm__("FUN_L00_002339d0"); +void gravity_set_z(void *, void *, float) __asm__("FUN_L00_00233b20"); void FUN_L00_00233ba0(void *, void *, float); void add_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a10"); void clear_u64_value(void *) __asm__("FUN_001f99f8"); void FUN_L00_00216710(float x) { char *g = (&hero.motion.unk150); - float d = FUN_L00_002339d0(g); + float d = gravity_length_xy(g); if (0.001f < d) { float z = 0.0f; float s; - FUN_L00_00233b20(g, g, z); + gravity_set_z(g, g, z); s = d - x; if (s < z) s = z; @@ -639,17 +639,17 @@ typedef union { extern s32 D_0013CB14[]; extern void FUN_L00_002118c8_c(s32, f32) __asm__("FUN_L00_002118c8"); -extern void FUN_L00_00211e30(s32, f32, f32, f32); +extern void turn_to(s32, f32, f32, f32) __asm__("FUN_L00_00211e30"); extern f32 fast_cos(f32) __asm__("FUN_001f9dc8"); extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern void FUN_L00_002132b8(f32, f32); extern void FUN_001f9a10_c(void *, void *, void *) __asm__("FUN_001f9a10"); extern void FUN_001f99f8_c(void *) __asm__("FUN_001f99f8"); -extern f32 FUN_001f9b20(void *); +extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern f32 fast_vec_dot(void *, void *) __asm__("FUN_001f9ab0"); -extern f32 FUN_001f9af0(void *); -extern void FUN_001f9a28(void *, void *, void *); +extern f32 fast_vec_length(void *) __asm__("FUN_001f9af0"); +extern void fast_vec_sub(void *, void *, void *) __asm__("FUN_001f9a28"); extern void fast_vec_normalize(void *, void *, f32) __asm__("FUN_001f9bf8"); extern f32 FUN_001f9e90_c(f32, f32) __asm__("FUN_001f9e90"); extern void fast_vec_scale(void *, void *, f32) __asm__("FUN_001f9a68"); @@ -665,7 +665,7 @@ void FUN_L00_002167d0(void) { FUN_L00_002118c8_c(0, 1.0f); f20 = 0.2f; - FUN_L00_00211e30(0, frame_scale_sq * 0.02f, frame_scale_sq * f20, frame_time * 3.66519141f); + turn_to(0, frame_scale_sq * 0.02f, frame_scale_sq * f20, frame_time * 3.66519141f); if (hero.state.current == HERO_STATE_WRENCH_COMBO) { if (hero.unk229C < f20) { hero.motion.move_yaw = hero.motion.rot.f[2]; @@ -691,8 +691,8 @@ void FUN_L00_002167d0(void) { } f20 = -(hero.motion.velocity.f[0] * v0.f[0] + hero.motion.velocity.f[1] * v0.f[1]); if (f21 < f20) { - f20 = f20 / FUN_001f9b20(&v0); - f20 = f20 / FUN_001f9b20(hero.motion.velocity.f); + f20 = f20 / vector_length_xy(&v0); + f20 = f20 / vector_length_xy(hero.motion.velocity.f); } if (1.0f < f20) { f20 = 1.0f; @@ -716,11 +716,11 @@ void FUN_L00_002167d0(void) { f22 = 0.0f; if (f22 < e) { f20 = -fast_vec_dot(&v1, &v2); - e = FUN_001f9af0(&v1); + e = fast_vec_length(&v1); if (f22 < e) { f20 = f20 / e; } - b = FUN_001f9b20(&v2); + b = vector_length_xy(&v2); a = (b - f20) / b; c = frame_time_sq * 3.0f; b = c * a; @@ -733,9 +733,9 @@ void FUN_L00_002167d0(void) { f21 = b; } } - FUN_001f9a28(&v3, &v0, &hero.motion.unk130); + fast_vec_sub(&v3, &v0, &hero.motion.unk130); v3.f[2] = 0.0f; - if (f21 < FUN_001f9af0(&v3)) { + if (f21 < fast_vec_length(&v3)) { fast_vec_normalize(&v3, &v3, f21); } r = &hero.motion.velocity; @@ -751,9 +751,9 @@ void FUN_L00_002167d0(void) { v3.f[0] = fast_cos(f21) * f20; v3.f[1] = fast_sin(f21) * f20; v3.f[2] = 0.0f; - FUN_001f9a28(&v4, &v3, r); + fast_vec_sub(&v4, &v3, r); v4.f[2] = 0.0f; - if (f22 < FUN_001f9af0(&v4)) { + if (f22 < fast_vec_length(&v4)) { fast_vec_normalize(&v4, &v4, f22); } FUN_001f9a10_c(r, r, &v4); @@ -762,7 +762,7 @@ void FUN_L00_002167d0(void) { v3.f[2] = 0.0f; m = &hero; m->unk3B0 = fast_vec_dot(&v3, &v0); - k = FUN_001f9af0(&v0); + k = fast_vec_length(&v0); if (0.0f < k) { m->unk3B0 = m->unk3B0 / (k * (frame_time * 5.9f)); } @@ -786,6 +786,7 @@ extern char D_0013E533[]; extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); /* In mode 3 allocates a voice for the object at D_0013F350+0xA88, else for the one at +0x2080. */ +int FUN_L00_00216de8(int a, int b); int FUN_L00_00216de8(int a, int b) { char *p = D_0013E533 + 0xE1D; int c; @@ -816,6 +817,7 @@ extern G D_0013F350; extern int allocate_voice_for_target_entry(int, int, int) __asm__("FUN_0022da68"); /* Allocates a voice (b, 4, a) for slot idx when it has none; records a in slot idx. */ +void FUN_L00_00216e48(int idx, int a, int b); void FUN_L00_00216e48(int idx, int a, int b) { G *g = &D_0013F350; if (g->a[idx] == -1) { @@ -849,7 +851,7 @@ void FUN_L00_00216ec0_00216ec0(s32 a, s32 b, s32 c) { /* Ticks eight timer slots and, for each that has run out, clears a field and calls the release helper. */ /* Ported from rac1-decomp (src/overlays/shared/help_00214D60.c: func_L00_00217698), where it is exact; names translated to the US level program. */ -extern int FUN_001f9770(void *); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_00216de8(); /* For each of eight timers that fast_dec_timer reports as 2, clears a field and calls 00216de8. */ @@ -859,7 +861,7 @@ void FUN_L00_00216f10(void) { int i; for (i = 0; i < 8; i++) { - if (FUN_001f9770(p + i * 8) == 2) { + if (fast_dec_timer_s16(p + i * 8) == 2) { q[i * 4 - 3] = 0; FUN_L00_00216de8(q[i * 4 - 2], q[i * 4]); } @@ -884,6 +886,7 @@ void FUN_L00_002127b8_00216f90(void) __asm__("FUN_L00_002127b8"); void FUN_L00_001ed280_00216f90(void) __asm__("FUN_L00_001ed280"); void FUN_L00_002500b8_00216f90(int) __asm__("FUN_L00_002500b8"); extern char D_0013F3D0[] __attribute__((section(".data"))); +void FUN_L00_00216f90(Vec4_00216f90 *pos, Vec4_00216f90 *rot, int mode, int flag); void FUN_L00_00216f90(Vec4_00216f90 *pos, Vec4_00216f90 *rot, int mode, int flag) { char *q = D_0013F3D0; char *g; @@ -1024,8 +1027,8 @@ extern float random_angle_radians(void) __asm__("FUN_00213308"); extern void FUN_00214db0_217450(void *, float, float, float) __asm__("FUN_00214db0"); extern float FUN_001f9dc8_217450(float) __asm__("FUN_001f9dc8"); extern float FUN_001f9de0_217450(float) __asm__("FUN_001f9de0"); -extern void spark_v(void *, void *, int, int, int, int, int, - int) __asm__("FUN_L00_00269958"); +extern void FUN_L00_00269958(void *, void *, int, int, int, int, int, + int); void FUN_L00_00217450(void) { V_217450 pos[1]; @@ -1056,7 +1059,7 @@ void FUN_L00_00217450(void) { FUN_00214db0_217450(&out, s, ang, e); pos[0].f[0] += FUN_001f9dc8_217450(ang) * r; pos[0].f[1] += FUN_001f9de0_217450(ang) * r; - spark_v(pos, &out, 0x7000C0F0, 0x70F0, t, a, b, 1); + FUN_L00_00269958(pos, &out, 0x7000C0F0, 0x70F0, t, a, b, 1); } while (i >= 0); if (!ang) { } @@ -1092,6 +1095,7 @@ extern void blend_moby_animation(void *, s32, s32, s32) __asm__("FUN_00212f90"); /* Launches the equipped gadget moby: aims it at its target (or along the camera), * builds its orientation matrix and starts its animation/sound. */ +void FUN_L00_00217658(void); void FUN_L00_00217658(void) { f32 dir[4]; f32 delta[4]; @@ -1116,9 +1120,9 @@ void FUN_L00_00217658(void) { if (tpv->unk7E) { has_target = 1; FUN_L00_00233660(dir, 0.5f, 0.0f, 0.5f); - FUN_001f9a28(delta, tpv->unk50, dir); + fast_vec_sub(delta, tpv->unk50, dir); hero.aim_yaw = FUN_001f9e90_c2(delta[0], delta[1]); - hero.aim_pitch = FUN_001f9e90_c2(FUN_001f9b20(delta), delta[2]); + hero.aim_pitch = FUN_001f9e90_c2(vector_length_xy(delta), delta[2]); } } if (!has_target) { @@ -1165,3 +1169,32 @@ void FUN_L00_00217658(void) { FUN_L00_00262528(hero.unk17B0, 0x17, 5); blend_moby_animation(item, 6, 0, scale_game_frames(5)); } + +f32 D_L01_0017AC14[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_0017AD94[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_0017B984[1] __attribute__((section(".data"))) = {0}; +f32 D_L02_0017B988[1] __attribute__((section(".data"))) = {0}; +f32 D_L03_0017A894[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_0017ABF4[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_0017B7E4[1] __attribute__((section(".data"))) = {0}; +f32 D_L05_0017B7E8[1] __attribute__((section(".data"))) = {0}; +f32 D_L06_0017AF14[1] __attribute__((section(".data"))) = {0}; +f32 D_L08_0017AF94[1] __attribute__((section(".data"))) = {0}; +f32 D_L11_0017B194[1] __attribute__((section(".data"))) = {0}; +f32 D_L11_0017BD84[1] __attribute__((section(".data"))) = {0}; +f32 D_L11_0017BD88[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_0017B684[1] __attribute__((section(".data"))) = {0}; +f32 D_L13_0017B688[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0017BA84[1] __attribute__((section(".data"))) = {0}; +f32 D_L14_0017BA88[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0017AD94[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0017B984[1] __attribute__((section(".data"))) = {0}; +f32 D_L15_0017B988[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_0017ABF4[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_0017B7E4[1] __attribute__((section(".data"))) = {0}; +f32 D_L16_0017B7E8[1] __attribute__((section(".data"))) = {0}; +f32 D_L17_0017BC84[1] __attribute__((section(".data"))) = {0}; +f32 D_L17_0017BC88[1] __attribute__((section(".data"))) = {0}; +f32 D_L18_0017B194[1] __attribute__((section(".data"))) = {0}; +f32 D_L18_0017BD84[1] __attribute__((section(".data"))) = {0}; +f32 D_L18_0017BD88[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/ui/help/00220b80.c b/src/overlays/shared/ui/help/00220b80.c index d3f12bde8f..01c9b33e4f 100644 --- a/src/overlays/shared/ui/help/00220b80.c +++ b/src/overlays/shared/ui/help/00220b80.c @@ -372,7 +372,7 @@ extern void FUN_L00_00217658(void); extern void FUN_L00_00221ee0(void); extern void FUN_L00_00222158(void); extern s32 get_ammo(s32) __asm__("FUN_L00_00233e98"); -extern s32 FUN_L00_0028d8c0(struct Moby *, s32); +extern s32 voice_is_playing(struct Moby *, s32) __asm__("FUN_L00_0028d8c0"); extern void FUN_L00_0029a6b0(s32); /* @@ -540,7 +540,7 @@ s32 FUN_L02_0022ee00(void) FUN_L00_0020e4c8(); } } else if ((controller_state.held & buttons) && get_ammo(-1) == 0 && - FUN_L00_0028d8c0(hero.items[0].moby, vars->voice) == 0) { + voice_is_playing(hero.items[0].moby, vars->voice) == 0) { vars->voice = allocate_voice_for_target_entry(0, 0, hero.items[0].moby); } } diff --git a/src/overlays/shared/ui/help/00237488.c b/src/overlays/shared/ui/help/00237488.c index d355b06ed1..e13e7df528 100644 --- a/src/overlays/shared/ui/help/00237488.c +++ b/src/overlays/shared/ui/help/00237488.c @@ -78,8 +78,8 @@ extern int D_0015ED8C; extern int D_0015ED90; extern int D_0015ED94; extern ItemDef D_L05_00179F20[]; -extern int FUN_001f96f8(int); -extern int FUN_001f9770(void *); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); +extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); extern int FUN_L00_0020d568(); extern int FUN_L00_00216de8(int, int); extern int random_int_between(int, int) __asm__("FUN_L00_00257b90"); @@ -354,14 +354,14 @@ void FUN_L05_0023dc88(int i) { s->items[0].timer = s->items[0].timer_reload; } } - if (FUN_001f9770(&hero.items[i].timer) == 0) { + if (fast_dec_timer_s16(&hero.items[i].timer) == 0) { changed = 0; } if (changed) { struct Hero *g = &hero; *(int *)((char *)g + i * 0x50 + 0x10B0) = 3; FUN_L00_0020a500(); - *(int *)((char *)g + 0x1010) = random_int_between(FUN_001f96f8(0x32), FUN_001f96f8(0x5A)); + *(int *)((char *)g + 0x1010) = random_int_between(scale_game_frames(0x32), scale_game_frames(0x5A)); FUN_L00_0020fde0(*(hero.selected_item + i)); FUN_L00_0020fd80(*(hero.selected_item + i)); if (g->unk20A8 != 0) { @@ -412,7 +412,7 @@ extern u8 D_L05_00174260[] __attribute__((section(".data"))); extern u8 D_L05_0017AB20[] __attribute__((section(".data"))); extern int FUN_L05_002388a0(float, float, float *) __asm__("FUN_L00_0020a240"); extern float FUN_L00_0022e0f0(void *) __asm__("FUN_001f9b20"); -extern float FUN_L00_0022e598(float, float) __asm__("FUN_001f9e90"); +extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern s32 FUN_L00_0025e3b8(s32); extern void FUN_L00_0025c9d8(float *, float, float, float) __asm__("FUN_L00_00233660"); extern int FUN_L00_0021e8d8(void *, void *, int, void *, int) __asm__("FUN_001efa68"); @@ -442,7 +442,7 @@ void FUN_L05_0024bdc0(void) { if (FUN_L05_002388a0(0.7f, 4.0f, &hero.wall_probe_distance)) { CollisionHit *wall = &D_L05_00174240; float normal_xy = FUN_L00_0022e0f0(&wall->normal_x); - hero.unk250 = FUN_L00_0022e598(wall->normal_z, normal_xy); + hero.unk250 = fast_arc_tan(wall->normal_z, normal_xy); if (wall->moby != 0) { hero.unk255 = 1; if (FUN_L00_0025e3b8(wall->moby)) hero.unk254 = 1; @@ -620,7 +620,7 @@ extern int FUN_L00_00211360(void *); extern int FUN_L00_00222158(void); extern int FUN_L00_00233e98(int); extern int FUN_L00_00266d60(int, int, int *); -extern int FUN_L00_0028d8c0(void *, int); +extern int voice_is_playing(void *, int) __asm__("FUN_L00_0028d8c0"); extern int allocate_voice_for_target_entry_alt(int, int, int) __asm__("FUN_0022da68"); extern int scale_game_frames_alt(int) __asm__("FUN_001f96f8"); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); @@ -853,7 +853,7 @@ int FUN_L05_00251be8(void) { } if (D_0013CA40_p2523C8.held & mask) { if (!FUN_L00_00233e98(-1)) { - if (!FUN_L00_0028d8c0((Moby *)(*(Hero *)((char *)&hero)).items[0].moby, pv->fC)) { + if (!voice_is_playing((Moby *)(*(Hero *)((char *)&hero)).items[0].moby, pv->fC)) { pv->fC = allocate_voice_for_target_entry_alt(0, 0, (int)((Moby *)(*(Hero *)((char *)&hero)).items[0].moby)); } } @@ -1102,7 +1102,7 @@ void FUN_L05_00253850(void) { } } } -extern s32 FUN_001f96f8(s32); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern s32 FUN_L00_001fefc8_c(u8 *) __asm__("FUN_L00_001fefc8"); extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); extern f32 FUN_001f99c0(f32); @@ -1146,7 +1146,7 @@ void FUN_L05_00253b48(void) { transform_vector(delta, delta, matrix); if (FUN_001f99c0(delta[0]) < 0.5f && FUN_001f99c0(delta[1]) < 2.9f && FUN_001f99c0(delta[2]) < 2.9f) { hero.unk8C4 += **(s32 **)(first + 0x78); - first[0xBC] = FUN_001f96f8(0x3C); + first[0xBC] = scale_game_frames(0x3C); if (hero.unk86C != 0) allocate_voice_for_target_entry(1, 0, hero.unk86C); } @@ -1155,7 +1155,7 @@ void FUN_L05_00253b48(void) { } while (first != 0); } } - count = FUN_001f96f8(0x32); + count = scale_game_frames(0x32); period = convert_integer_to_float(count); ratio = (f32)(D_L00_0015F5CC % count) / period; ratio += ratio; @@ -1181,7 +1181,7 @@ void FUN_L05_00253b48(void) { transform_vector(delta, delta, matrix); if (FUN_001f99c0(delta[0]) < 2.8f && FUN_001f99c0(delta[1]) < 1.25f && FUN_001f99c0(delta[2]) < 1.5f) { hero.unk8C4 += **(s32 **)(second + 0x78); - second[0xBC] = FUN_001f96f8(0x3C); + second[0xBC] = scale_game_frames(0x3C); if (hero.unk86C != 0) allocate_voice_for_target_entry(1, 0, hero.unk86C); } @@ -1198,7 +1198,7 @@ void FUN_L05_00253b48(void) { if (*(s16 *)(third + 0xA6) == 0x1D6 && FUN_L00_001fefc8_c(third + 0xBC) != 0 && FUN_001f9b48(&hero.motion.unkD0, third + 0x10) < 1.5f) { struct Hero *g = &hero; - third[0xBC] = FUN_001f96f8(300); + third[0xBC] = scale_game_frames(300); if (*(s32 *)((u8 *)g + 0x10B8) != 0x24) { *(s32 *)((u8 *)g + 0x20B8) = 0x24; g->unk20AC = 0; @@ -1223,7 +1223,7 @@ extern u8 D_0013D388; extern s32 D_0015ED84 __attribute__((sda)); extern s32 D_0015EEA4_gp __asm__("D_0015EEA4") __attribute__((sda)); extern f32 D_L05_002169F8[] __asm__("D_L05_002169F8"); -extern f32 FUN_001f96b0(f32) __asm__("FUN_L05_0022dbc8"); +extern f32 FUN_L05_0022dbc8(f32); void FUN_L05_00254058(void) { s32 *counter; @@ -1309,7 +1309,7 @@ void FUN_L05_00254058(void) { struct Hero *g = &hero; table = *(struct ScoreTable *)D_L05_002169F8; *(f32 *)((char *)g + 0x6F4) = table.values[*(s32 *)((char *)g + 0x6F0)]; - frames = FUN_001f96b0(1.0f); + frames = FUN_L05_0022dbc8(1.0f); *(s32 *)((char *)g + 0x6FC) = truncate_float_to_s32((f32)((*(s32 *)((char *)g + 0x6F8) * 100) / (s32)(frames * 60.0f))); *(s32 *)((char *)g + 0x6FC) += *(s32 *)((char *)g + 0x6F0) * 25; *(s32 *)((char *)g + 0x6FC) = truncate_float_to_s32((f32)*(s32 *)((char *)g + 0x6FC) * *(f32 *)((char *)g + 0x6F4)); @@ -1717,9 +1717,9 @@ int FUN_L05_00255208(void) { if (FUN_L00_0021e8d8(start, end, 2, 0, 0) && D_L05_00174240.moby == 0 && D_L05_00174240.unk1C != 0) { CollisionHit *wall = &D_L05_00174240; - if (1.2217305f < FUN_L00_0022e598(wall->normal_z, FUN_L00_0022e0f0(&wall->normal_x))) { - player->unk8A4 = fast_add_rotations(FUN_L00_0022e598(wall->normal_x, wall->normal_y), 3.1415927f); - if (fast_difference_between_rotations(FUN_L00_0022e598(player->motion.velocity.f[0], player->motion.velocity.f[1]), player->unk8A4) < 0.7853982f) { + if (1.2217305f < fast_arc_tan(wall->normal_z, FUN_L00_0022e0f0(&wall->normal_x))) { + player->unk8A4 = fast_add_rotations(fast_arc_tan(wall->normal_x, wall->normal_y), 3.1415927f); + if (fast_difference_between_rotations(fast_arc_tan(player->motion.velocity.f[0], player->motion.velocity.f[1]), player->unk8A4) < 0.7853982f) { state = 0x6F; if (!(player->ground_distance < 1.0f)) state = 0x6D; goto change_state; @@ -1778,7 +1778,7 @@ int FUN_L05_00255208(void) { (*((unsigned char *)(&hero)->moby + 0x53) == 0x55 || *((unsigned char *)(&hero)->moby + 0x53) == 0x7F) && *((unsigned char *)(&hero)->moby + 0x51) < 13) { int animation = FUN_L05_002551b8(); - int frames = FUN_001f96f8(7); + int frames = scale_game_frames(7); set_hero_animation(animation, 14, (float)frames); } } @@ -1812,14 +1812,14 @@ int FUN_L05_00255208(void) { hero_set_state(0x6B, 0); if (*((unsigned char *)(&hero)->moby + 0x53) != 0x55 && *((unsigned char *)(&hero)->moby + 0x53) != 0x7F) { int animation = FUN_L05_002551b8(); - int frames = FUN_001f96f8(7); + int frames = scale_game_frames(7); set_hero_animation(animation, 14, (float)frames); } return 1; } if (*((unsigned char *)(&hero)->moby + 0x53) != 0x55 && *((unsigned char *)(&hero)->moby + 0x53) != 0x7F) { int animation = FUN_L05_002551b8(); - int frames = FUN_001f96f8(7); + int frames = scale_game_frames(7); set_hero_animation(animation, 14, (float)frames); } return 0; diff --git a/src/overlays/shared/ui/help/002644e0.c b/src/overlays/shared/ui/help/002644e0.c index d871798514..252b1f0184 100644 --- a/src/overlays/shared/ui/help/002644e0.c +++ b/src/overlays/shared/ui/help/002644e0.c @@ -12,6 +12,7 @@ s32 remove_hud_item(s32 arg0) __asm__("FUN_001ff480"); /* When D_L00_0015F594 is a and a HUD item is set: removes it and clears both; true if removed. */ +int FUN_L00_002644e0(int a); int FUN_L00_002644e0(int a) { if (D_L00_0015F594 == a) { if (D_L00_00161E04 != -1) { diff --git a/src/overlays/shared/ui/help/help_request.c b/src/overlays/shared/ui/help/help_request.c index b241b66569..03bc9344b1 100644 --- a/src/overlays/shared/ui/help/help_request.c +++ b/src/overlays/shared/ui/help/help_request.c @@ -41,6 +41,7 @@ s32 help_request(s32 a, s32 b) { extern char D_L00_00179410[]; /* When D_L00_00179410 is active, may set the 0x5A state to 5, then clears and resets the record. */ +void FUN_L00_002039a0(void); void FUN_L00_002039a0(void) { if (*(int *)(D_L00_00179410) != 0) { int v = *(int *)((char *)(*(int *)(D_L00_00179410 + 0x20) << 4) + (int)D_L00_0015F660 + 8); diff --git a/src/overlays/shared/ui/hud/00234fd0.c b/src/overlays/shared/ui/hud/00234fd0.c index 7557ecd1ef..429cce8349 100644 --- a/src/overlays/shared/ui/hud/00234fd0.c +++ b/src/overlays/shared/ui/hud/00234fd0.c @@ -144,3 +144,20 @@ void FUN_L00_00235668(int state) { D_L00_0015FA7C = oldE8; } } + +s32 D_L02_0017EB18[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_0017EB1C[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_0017E618[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_0017E61C[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_0017EC98[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_0017EC9C[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_0017E598[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_0017E59C[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_0017ED18[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_0017ED1C[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_0017EC18[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_0017EC1C[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_0017EB18[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_0017EB1C[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_0017EE18[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_0017EE1C[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/ui/hud/002661a0.c b/src/overlays/shared/ui/hud/002661a0.c index c4b9b0f8aa..2b56c6ad9f 100644 --- a/src/overlays/shared/ui/hud/002661a0.c +++ b/src/overlays/shared/ui/hud/002661a0.c @@ -31,10 +31,6 @@ void FUN_L05_002661e8(char *moby) { *(int *)(moby + 0x6C) = -6; } } -#ifndef NON_MATCHING -INCLUDE_ASM("config/us/overlays/asm/FUN_L05_00266320.s", FUN_L05_00266320); -#else -#endif extern int D_0013E500[]; extern int D_0015ED80; extern u8 D_0013D388[]; @@ -60,7 +56,6 @@ extern char *get_help_message_text(int) __asm__("FUN_001fdd10"); extern int sprintf(char *, const char *, ...) __asm__("FUN_00116248"); extern int FUN_001f6250(char *, int); extern void FUN_L00_001fb470(int x, int y, u64 color, char *text, int len); -#ifdef NON_MATCHING extern int D_0015ED84; extern char D_L05_0015F860[]; extern char D_L05_0015F9E0[]; @@ -134,14 +129,12 @@ int FUN_L05_00266320(HudElem *e) { FUN_L00_001fb470(x, y, D_L05_0015F998, buf, -1); if (D_0015ED84 == 0x10) { int y2, x2; - int *y2_ptr = &y2; - int count; sprintf(small_buf, D_L05_0015F860, hero.unk8CE); - count = D_0015ED80; - *y2_ptr = D_0013D388[0]; + /* Fakematch: the dead early copy of the default row gives retail's register order. */ + y2 = D_0015ED80 ? 10 : 18; x2 = e->unk50; - if ((u8)*y2_ptr == 0) { - y2 = count ? 10 : 18; + if (D_0013D388[0] == 0) { + y2 = D_0015ED80 ? 10 : 18; } else { x2 = D_L05_0015F9C0; y2 = D_L05_0015F9C4; @@ -157,7 +150,6 @@ int FUN_L05_00266320(HudElem *e) { } return e->w; } -#endif int FUN_L05_00266710(HudElem *e) { char buf[64]; diff --git a/src/overlays/shared/ui/hud/hud_keep_visible.c b/src/overlays/shared/ui/hud/hud_keep_visible.c index a3f1629f26..298700a5b9 100644 --- a/src/overlays/shared/ui/hud/hud_keep_visible.c +++ b/src/overlays/shared/ui/hud/hud_keep_visible.c @@ -46,7 +46,8 @@ void FUN_L00_00235878(void) { /* Ported from rac1-decomp (src/overlays/shared/hud_00235960.c: func_L00_00236400), where it is exact; names translated to the US level program. */ /* Offsets x/y for the element's anchor flags (centre or right/bottom alignment). */ -int FUN_L00_00235a70(HudElem *rec, int *x, int *y) { +int hud_screen_position(HudElem *rec, int *x, int *y) __asm__("FUN_L00_00235a70"); +int hud_screen_position(HudElem *rec, int *x, int *y) { int w = rec->w; int h = rec->h; int flags = rec->flags; @@ -199,7 +200,7 @@ s32 hud_keep_visible(s32 key, s32 val) { } return 1; } -extern float FUN_001fa6c0(int); +extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); extern int FUN_001fa6d0(float); extern float square_root(float) __asm__("FUN_001f9988"); extern void FUN_L00_0023aaa8(void *); @@ -229,7 +230,7 @@ void FUN_L00_00235ea0(e) HudElem *e; int t = e->unk74 - e->unk78; d = t < 0 ? -t : t; if (d != 0) { - s = FUN_001fa6d0(square_root(FUN_001fa6c0(d) / 25.0f) * 5.0f); + s = FUN_001fa6d0(square_root(convert_integer_to_float(d) / 25.0f) * 5.0f); s = s < d * scale_game_frames(2) / scale_game_frames(10) ? d * scale_game_frames(2) / scale_game_frames(10) : s; @@ -436,7 +437,7 @@ int FUN_L00_002365a8(HudElem *e) { e->w = D_L00_0015F760; e->h = D_L00_0015F764; - FUN_L00_00235a70(e, &x, &y); + hud_screen_position(e, &x, &y); FUN_L00_00235ad8(e, &x, &y, e->unk6C, 0); w = D_L00_0015F760; h = D_L00_0015F764; @@ -543,7 +544,7 @@ int FUN_L00_00236e50(HudElem *e) { e->w = D_L00_0015F760; e->h = D_L00_0015F764; - FUN_L00_00235a70(e, &x, &y); + hud_screen_position(e, &x, &y); FUN_L00_00235ad8(e, &x, &y, e->unk6C, 0); image = FUN_0023b208(*(int *)e, 0); FUN_L00_0023bac0(image, x + e->unk48, y + e->unk4A, @@ -593,7 +594,8 @@ int FUN_L00_00236e50(HudElem *e) { #endif void FUN_L00_00235ea0(); /* Calls FUN_L00_00235ea0. */ -void FUN_L00_002371e0(void) { +void mine_blend_color(void) __asm__("FUN_L00_002371e0"); +void mine_blend_color(void) { FUN_L00_00235ea0(); } #ifndef NON_MATCHING diff --git a/src/overlays/shared/ui/menus/00248d08.c b/src/overlays/shared/ui/menus/00248d08.c index e2438aa0ed..cb90c89421 100644 --- a/src/overlays/shared/ui/menus/00248d08.c +++ b/src/overlays/shared/ui/menus/00248d08.c @@ -16,9 +16,6 @@ void FUN_L00_0024a798(s32 v, s32 i) { } } -#ifndef NON_MATCHING -INCLUDE_ASM("config/us/overlays/asm/FUN_L00_00249d80.s", FUN_L00_00249d80); -#else typedef unsigned int MenuCacheQuad __attribute__((mode(TI), aligned(16))); typedef struct { @@ -60,13 +57,17 @@ s32 FUN_L00_00249d80(s32 key) { if (D_L00_001841F0_49d80.entries[0].key != key) { times = &D_L00_001841F0_49d80.entries[0].last_used; entry = &D_L00_001841F0_49d80.entries[0].key; + /* Fakematch: the outer do-while (0) and the miss++/miss-- below give + * retail's registers. */ do { - if (entry[1] < times[victim * 4]) { - victim = i; - } - ++i; - entry += 4; - } while (i < 8 && *entry != key); + do { + if (entry[1] < times[victim * 4]) { + victim = i; + } + ++i; + entry += 4; + } while (i < 8 && *entry != key); + } while (0); } if (i == 8) { FUN_L00_002483c8(D_L00_001841F0_49d80.entries[victim].pixels, key, @@ -79,10 +80,12 @@ s32 FUN_L00_00249d80(s32 key) { base = (MenuCacheQuad *)&D_L00_001841F0_49d80.entries[0]; other = base + i; temp = *other; + /* Fakematch: see the loop above. */ + miss++; + miss--; *other = *base; *base = temp; } D_L00_001841F0_49d80.entries[0].last_used = D_L00_0015F3F8; return miss; } -#endif diff --git a/src/overlays/shared/ui/text/001fb470.c b/src/overlays/shared/ui/text/001fb470.c index 9baf90e760..fcd776118f 100644 --- a/src/overlays/shared/ui/text/001fb470.c +++ b/src/overlays/shared/ui/text/001fb470.c @@ -8,6 +8,7 @@ extern int tex_1fb470(int) __asm__("FUN_001f44b8"); extern void font_print(int, int, int, int, int, int, void *) __asm__("FUN_001f62b0"); /* font_print with effect texture 3 and D_L00_001C3890. */ +void FUN_L00_001fb470(int a, int b, int c, int d, int e); void FUN_L00_001fb470(int a, int b, int c, int d, int e) { font_print(a, b, c, d, e, tex_1fb470(3), D_L00_001C3890); } diff --git a/src/overlays/shared/ui/text/002377b8.c b/src/overlays/shared/ui/text/002377b8.c index 243f05271c..9d380ca39d 100644 --- a/src/overlays/shared/ui/text/002377b8.c +++ b/src/overlays/shared/ui/text/002377b8.c @@ -9,7 +9,7 @@ extern unsigned char D_0013E529[]; void FUN_L00_00235ea0(char *); -int FUN_001f96f8(int); +int scale_game_frames(int) __asm__("FUN_001f96f8"); /* Sets p+8 to 10 or 5 by D_0013E529, then sets or caps the 0x7C timer by the hero mode. */ void FUN_L00_002377b8(char *p) { FUN_L00_00235ea0(p); @@ -18,7 +18,7 @@ void FUN_L00_002377b8(char *p) { else *(int *)(p + 8) = 5; if (hero.items[0].item_id == 9 && hero.vehicle_mode == 0) { - *(int *)(p + 0x7C) = FUN_001f96f8(0x78) + 30; + *(int *)(p + 0x7C) = scale_game_frames(0x78) + 30; } else if (*(int *)(p + 0x7C) > 30) { *(int *)(p + 0x7C) = 30; } @@ -138,7 +138,7 @@ extern s32 D_L00_0015F72C __attribute__((sda)); extern D00237ae8 D_L00_0017DAC0[]; extern E00237ae8 item_defs[] __asm__("D_L00_00179AC0"); extern s32 pause_iop_sprite_lists[] __asm__("D_00141EA0"); -s32 FUN_001f96f8(s32); +s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); void FUN_L00_00237ae8(O00237ae8 *o) { s32 i; D00237ae8 *d; @@ -151,7 +151,7 @@ void FUN_L00_00237ae8(O00237ae8 *o) { o->x58 = D_L00_0015F718_gp; o->x5c = D_L00_0015F71C_gp; o->x74 = -2; - o->x78 = FUN_001f96f8(0x1E); + o->x78 = scale_game_frames(0x1E); o->x70 = 0; D_L00_0015F72C = 0; d = D_L00_0017DAC0; @@ -205,7 +205,7 @@ extern int D_00141610[]; extern int D_L00_0015FA98 __attribute__((section(".sdata"))); extern int D_L00_0015FA94; extern int D_L00_0015F3F8; -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern float square_root(float) __asm__("FUN_001f9988"); extern float fast_arc_tan(float, float) __asm__("FUN_001f9e90"); extern int remove_hud_item(int) __asm__("FUN_001ff480"); @@ -227,9 +227,9 @@ extern int D_L00_0017DC20 __attribute__((section(".data"))); extern int D_L00_0017DC24 __attribute__((section(".data"))); extern int D_0015EEA4; extern int fast_dec_timer_s16(void *) __asm__("FUN_001f9770"); -extern float FUN_001fa6c0(int); -extern float FUN_001fa5c8(float, float); -extern float FUN_001fa688(float, float); +extern float convert_integer_to_float(int) __asm__("FUN_001fa6c0"); +extern float fast_subtract_rotations(float, float) __asm__("FUN_001fa5c8"); +extern float fast_difference_between_rotations(float, float) __asm__("FUN_001fa688"); extern int FUN_001fa6d0(float); extern float fast_normalize_angle(float) __asm__("FUN_001fa610"); @@ -240,7 +240,7 @@ void FUN_L00_00237ba0(Obj *p) { int old, n, s, k, id; u8 *c = &p->b70; - p->w7C = FUN_001f96f8(0xB4); + p->w7C = scale_game_frames(0xB4); p->w6C = 0x18; if (fast_dec_timer_s16(D_00141622)) D_0013C940.w1CC = 2; x = D_0013C940.unk148; @@ -263,8 +263,8 @@ void FUN_L00_00237ba0(Obj *p) { if (mag > 0.9f) { a = ang + 3.1415927f + 3.1415927f + 1.5707964f + 3.1415927f / (float)D_L00_0015FA90; f = a * ((float)D_L00_0015FA90 / 6.2831855f); - r = (float)old * 6.2831855f / FUN_001fa6c0(D_L00_0015FA90) - 3.1415927f; - if (old == -1 || FUN_001fa688(r, FUN_001fa5c8(ang, 1.5707964f)) > 0.58904862f) { + r = (float)old * 6.2831855f / convert_integer_to_float(D_L00_0015FA90) - 3.1415927f; + if (old == -1 || fast_difference_between_rotations(r, fast_subtract_rotations(ang, 1.5707964f)) > 0.58904862f) { s = (int)f % D_L00_0015FA90; if (((s ^ 1) & 1)) { float fr = f - (float)FUN_001fa6d0(f); @@ -305,8 +305,8 @@ void FUN_L00_00237ba0(Obj *p) { if (hero_lui.items[0].item_id != id) { if (usage_stats.stat[20].count < 0xFFFF) usage_stats.stat[20].count++; } - if (FUN_001f96f8(D_0015EEA4) / 600 > usage_stats.stat[20].unk2) - usage_stats.stat[20].unk2 = FUN_001f96f8(D_0015EEA4) / 600; + if (scale_game_frames(D_0015EEA4) / 600 > usage_stats.stat[20].unk2) + usage_stats.stat[20].unk2 = scale_game_frames(D_0015EEA4) / 600; usage_stats.stat[20].level_mask = usage_stats.stat[20].level_mask | (1 << current_level_index) | 0x80000000; if (id == 0x18) hero_lui.unk1FF5 = 1; else hero_lui.pending_item[0] = id; @@ -526,7 +526,7 @@ extern int D_L00_0015F718_gp __asm__("D_L00_0015F718") __attribute__((sda)); extern int D_L00_0015F71C_gp __asm__("D_L00_0015F71C") __attribute__((sda)); extern int D_L00_0015F72C __attribute__((sda)); extern int D_L00_0015F740 __attribute__((sda)); -int FUN_001f96f8(int); +int scale_game_frames(int) __asm__("FUN_001f96f8"); void FUN_L00_00238b18(char *p) { int a, b; D_L00_0015FA90 = 4; @@ -538,7 +538,7 @@ void FUN_L00_00238b18(char *p) { *(int *)(p + 0x58) = a; *(int *)(p + 0x5C) = b; *(int *)(p + 0x74) = -2; - *(int *)(p + 0x78) = FUN_001f96f8(30); + *(int *)(p + 0x78) = scale_game_frames(30); D_L00_0015F72C = 0; } @@ -547,7 +547,7 @@ void FUN_L00_00238b80(Obj *o) { int old, cur, n, t; u8 *c = &o->b70; - o->w7C = FUN_001f96f8(0xB4); + o->w7C = scale_game_frames(0xB4); o->w6C = 0x18; D_0013C940.w1CC = 2; x = D_0013C940.unk148; @@ -691,7 +691,7 @@ extern int D_L00_0015F7D4 __attribute__((sda)); /* no foreign declaration */ extern int D_L00_0015F7D8 __attribute__((sda)); /* no foreign declaration */ extern int D_L00_0015F7DC __attribute__((sda)); /* no foreign declaration */ extern Ent_239918 **D_L00_0015FAC0_c2 __asm__("D_L00_0015FAC0"); -extern int FUN_001fa6e0(int, int, f32); +extern int fast_tween_color(int, int, f32) __asm__("FUN_001fa6e0"); extern s32 find_valid_animation_frame_index_alt(s32, s32) __asm__("func_001FF960"); extern s32 font_print_center(s32, s32, s64, char *, s32) __asm__("func_001F6AF0"); extern s32 truncate_float_to_s32_c(f32) __asm__("func_001FA6D0"); @@ -805,11 +805,11 @@ typedef struct { short a, b, c, d; } Q2395b0; extern Q2395b0 D_L00_0015FAB0; -int FUN_001f96f8(int); +int scale_game_frames(int) __asm__("FUN_001f96f8"); void FUN_L00_00235c80(); /* Sets 0x7C, 0x58/0x5C = 64, 0x48 = 32, calls 00235c80 and links D_L00_0015FAB0. */ void FUN_L00_002395b0(char *p) { - int r = FUN_001f96f8(0xB4); + int r = scale_game_frames(0xB4); *(int *)(p + 0x7C) = r + 30; *(int *)(p + 0x58) = 64; *(int *)(p + 0x5C) = 64; @@ -880,10 +880,10 @@ void FUN_L00_00239630(HudElem *e) { } } if (e->unk74 != e->unk78 || e->unk74 == 1) { - e->unk7C = FUN_001f96f8(0x78); + e->unk7C = scale_game_frames(0x78); e->unk74 = e->unk78; } - if (e->unk7C >= FUN_001f96f8(5)) { + if (e->unk7C >= scale_game_frames(5)) { if (*(int *)&D_L00_0015F7F0_gp > c[0]) { c[0]++; } else if (c[1] < *(int *)&D_L00_0015F7F0_gp) { @@ -918,7 +918,7 @@ typedef struct { s16 *p; } Hud; -extern f32 FUN_001fa6c0(s32); +extern f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern s32 FUN_001ff960_c(s32, s32) __asm__("FUN_001ff960"); extern void draw_hud_sprite_flipped(s32, s32, s32, s32, s32, s32) __asm__("FUN_001ffe18"); @@ -972,12 +972,12 @@ s32 FUN_L00_00239810(Hud *m) { q = m->ab; if (q[0] == 0) goto out; - ratio_x = FUN_001fa6c0(q[0]) / FUN_001fa6c0(D_L00_0015F7F0_gp); + ratio_x = convert_integer_to_float(q[0]) / convert_integer_to_float(D_L00_0015F7F0_gp); if (1.0f < ratio_x) ratio_x = 1.0f; else if (ratio_x < 0.0f) ratio_x = 0.0f; - ratio_y = FUN_001fa6c0(q[1]) / FUN_001fa6c0(D_L00_0015F7F0_gp); + ratio_y = convert_integer_to_float(q[1]) / convert_integer_to_float(D_L00_0015F7F0_gp); if (1.0f < ratio_y) ratio_y = 1.0f; else if (ratio_y < 0.0f) @@ -1095,7 +1095,7 @@ void FUN_L00_00239d00(T00239d00 *o) { } } /* - * Draw callback of the bolt counter HUD element (queued by FUN_L00_00266448 + * Draw callback of the bolt counter HUD element (queued by update_npc_dialogue * with FUN_L00_00239cc8 / FUN_L00_00239d00): a panel that slides open by * cnt[0] / bolt_panel_open_steps_gp, the spinning bolt icon (frame from *unk80), the * bolt count with a drop shadow, and a thousands separator every three @@ -1204,11 +1204,11 @@ int FUN_L00_00239df8(HudElem *m) #include "sda.h" extern s32 D_00141398 NOT_SDA; extern s32 D_L00_0015F7F0_gp __asm__("D_L00_0015F7F0") __attribute__((sda)); -s32 FUN_001f96f8(s32); +s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); void FUN_L00_0023a218(u8 *m) { u8 *q = m + 0x70; if (D_00141398) { - s32 r = FUN_001f96f8(10); + s32 r = scale_game_frames(10); s32 lim = D_L00_0015F7F0_gp; *(s32 *)(m + 0x7C) = r; if (m[0x70] < lim) { @@ -1239,7 +1239,7 @@ extern s32 D_L00_0015F908 __attribute__((sda)); extern s32 D_L00_0015F90C __attribute__((sda)); extern s32 D_L00_0015F910 __attribute__((sda)); extern s32 D_L00_0015F914 __attribute__((sda)); -extern s32 FUN_001f96f8(s32); +extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern void FUN_L00_001fb470(s32, s32, s32, char *, s32); @@ -1291,7 +1291,7 @@ s32 FUN_L00_0023a2d0(Hud *m) { sprintf_alt(buf, D_L00_0015F918); text_x = x + D_L00_0015F904; text_y = y + D_L00_0015F908; - period = FUN_001f96f8(D_L00_0015F914); + period = scale_game_frames(D_L00_0015F914); pulse = fast_sin((f32)(D_L00_0015F5CC % period) / convert_integer_to_float(period) * 6.28318f - 3.14159f) * 4.0f - 3.0f; if (pulse < 0.0f) @@ -1305,7 +1305,7 @@ s32 FUN_L00_0023a2d0(Hud *m) { return m->ret; } extern short D_00140986 __attribute__((section(".data"))); -int FUN_L00_00235a70(char *, int *, int *); +int hud_screen_position(char *, int *, int *) __asm__("FUN_L00_00235a70"); void FUN_L00_00235ad8(char *, int *, int *, int, int); int get_icon_frame(int, int) __asm__("FUN_001ff960"); void FUN_L00_0023b6c0(int, int, int, int, int, int); @@ -1317,7 +1317,7 @@ int FUN_L00_0023a640(char *rec) { y = *(int *)(rec + 0x54); *(int *)(rec + 0x58) = 0x100; *(int *)(rec + 0x5C) = 0x40; - FUN_L00_00235a70(rec, &x, &y); + hud_screen_position(rec, &x, &y); FUN_L00_00235ad8(rec, &x, &y, *(int *)(rec + 0x6C), 0); n = *(int *)(rec + 0x74) * 0xDD / *(int *)(rec + 0x8) + 0x1B; FUN_L00_0023b6c0(get_icon_frame(0x7558, 1), x, y, n, 0x40, 0x80); @@ -1330,13 +1330,39 @@ int FUN_L00_0023a640(char *rec) { of 30 + func_001F9850(120). */ /* Ported from rac1-decomp (src/overlays/shared/hud_00235960.c: func_L00_0023B0F8), where it is exact; names translated to the US level program. */ -extern int FUN_001f96f8(int); +extern int scale_game_frames(int) __asm__("FUN_001f96f8"); extern void FUN_L00_00235c80(HudElem *); /* Sets unk7C to scale_game_frames(0x78) + 0x1E and w/h to 0x20, calls FUN_L00_00235c80. */ void FUN_L00_0023a760(HudElem *e) { - e->unk7C = FUN_001f96f8(0x78) + 0x1E; + e->unk7C = scale_game_frames(0x78) + 0x1E; e->w = 0x20; e->h = 0x20; FUN_L00_00235c80(e); } + +s32 D_L01_0017E0A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_0017E220[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_0017DD20[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_0017DDA0[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_0017DDC0[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_0017E0A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_0017E3A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L06_0017E3C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_0017DCA0[1] __attribute__((section(".data"))) = {0}; +s32 D_L07_0017DCC0[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_0017E420[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_0017DDA0[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_0017DDC0[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_0017E0A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_0017E0C0[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_0017E620[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_0017E0A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_0017DF20[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_0017DF40[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_0017E320[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_0017E220[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_0017E0A0[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_0017E520[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_0017E540[1] __attribute__((section(".data"))) = {0}; +s32 D_L18_0017E620[1] __attribute__((section(".data"))) = {0}; diff --git a/src/overlays/shared/ui/text/00262ae8.c b/src/overlays/shared/ui/text/00262ae8.c index e379f96d8d..b4e01c822b 100644 --- a/src/overlays/shared/ui/text/00262ae8.c +++ b/src/overlays/shared/ui/text/00262ae8.c @@ -228,7 +228,7 @@ extern f32 fast_sin(f32) __asm__("FUN_001f9de0"); extern char *get_help_message_text(s32) __asm__("FUN_001fdd10"); extern void font_print_center_large(s32, s32, s32, char *, s32) __asm__("FUN_001f6c20"); extern void draw_framed_text(s32, s32, s32, char *) __asm__("FUN_00201200"); -extern s32 FUN_L00_00235a70(char *, s32 *, s32 *); +extern s32 hud_screen_position(char *, s32 *, s32 *) __asm__("FUN_L00_00235a70"); extern s32 get_icon_frame(s32, s32) __asm__("FUN_001ff960"); extern void FUN_L00_0023b6c0(s32, s32, s32, s32, s32, s32); extern void draw_hud_sprite(s32, s32, s32, s32, s32, s32) __asm__("FUN_001ffc30"); @@ -323,7 +323,7 @@ s32 FUN_L05_00262f50(char *e) { y = *(s32 *)((u8 *)e + 0x54); *(s32 *)((u8 *)e + 0x58) = 0x100; *(s32 *)((u8 *)e + 0x5c) = 0x40; - FUN_L00_00235a70((char *)e, &x, &y); + hud_screen_position((char *)e, &x, &y); value = *(s32 *)((u8 *)e + 0x74); value *= 0xdd; value /= *(s32 *)((u8 *)e + 8); diff --git a/src/overlays/shared/world/animation/002454c8.c b/src/overlays/shared/world/animation/002454c8.c index 1030b4b892..d55ad12b75 100644 --- a/src/overlays/shared/world/animation/002454c8.c +++ b/src/overlays/shared/world/animation/002454c8.c @@ -21,6 +21,7 @@ extern H D_L00_0016C860; void start_audio_stream_read(void *, s32, s32) __asm__("FUN_00216788"); void update_audio_stream_until_idle(s32) __asm__("FUN_002168a8"); void fade_to_black(s32) __asm__("FUN_001f4a58"); +void FUN_L00_002454c8(s32 i); void FUN_L00_002454c8(s32 i) { s32 n; s32 *e; @@ -60,6 +61,7 @@ extern H_245610 H245610 __asm__("D_L00_0016C860"); void start_audio_stream_read(void *, s32, s32) __asm__("FUN_00216788"); void update_audio_stream_until_idle(s32) __asm__("FUN_002168a8"); void fade_to_black(s32) __asm__("FUN_001f4a58"); +void FUN_L00_00245610(s32 i, s32 p); void FUN_L00_00245610(s32 i, s32 p) { s32 n; s32 *e; diff --git a/src/overlays/shared/world/collision/001ee1b0.c b/src/overlays/shared/world/collision/001ee1b0.c index 02b1fa9482..4d3542807e 100644 --- a/src/overlays/shared/world/collision/001ee1b0.c +++ b/src/overlays/shared/world/collision/001ee1b0.c @@ -12,7 +12,7 @@ typedef union { } V; extern void subtract_vector_xyz(void *, void *, void *) __asm__("FUN_001f9a28"); -extern f32 FUN_001f9b20(void *); +extern f32 vector_length_xy(void *) __asm__("FUN_001f9b20"); extern s32 truncate_float_to_s32(f32) __asm__("FUN_001fa6d0"); extern void debug_print(char *) __asm__("FUN_001e93b0"); extern char D_L00_001E78B0[]; @@ -45,7 +45,7 @@ s32 *FUN_L00_001ee1b0(OvlQuad *v, f32 rad) { subtract_vector_xyz(&d, e, tp); f = *(f32 *)(e + 0xC); d.f[3] = 1.0f; - if (FUN_001f9b20(&d) < f + rad) { + if (vector_length_xy(&d) < f + rad) { if (FUN_L00_001ee318_c(tp, (s32 *)e, rad) != 0) { return (s32 *)e; } diff --git a/src/overlays/shared/world/loaders/load_level_gameplay.c b/src/overlays/shared/world/loaders/load_level_gameplay.c index 7242441c60..45c2b73cfd 100644 --- a/src/overlays/shared/world/loaders/load_level_gameplay.c +++ b/src/overlays/shared/world/loaders/load_level_gameplay.c @@ -35,7 +35,7 @@ typedef struct { f32 length; } P_241788; -extern f32 FUN_001fa6c0(s32); +extern f32 convert_integer_to_float(s32) __asm__("FUN_001fa6c0"); extern s32 FUN_001fa6d0(f32); extern s32 fptodp(f32) __asm__("FUN_00120478"); extern void debug_print(void *, s32, s32) __asm__("FUN_001e93b0"); @@ -58,7 +58,7 @@ void FUN_L00_00241788(u8 *src, s32 n) { if (next_start == 0) { next_start = *(s32 *)(src + 0x40); } - entries[i].length = FUN_001fa6c0(next_start - *(s32 *)(src + 0)) * 0.0009765625f; + entries[i].length = convert_integer_to_float(next_start - *(s32 *)(src + 0)) * 0.0009765625f; entries[i + 1].id = -1.0f; entries[i + 1].length = 0.0f; } @@ -466,7 +466,7 @@ extern int D_L00_0016C058[]; extern int D_L00_001AB840[]; extern int D_L00_001BA4D0[]; extern int debug_print_alt() __asm__("FUN_001e93b0"); -extern int FUN_L00_0024d8d0(void *, void *); +extern int fast_decompress(void *, void *) __asm__("FUN_L00_0024d8d0"); extern int FUN_L00_00284d90(int, int); extern s32 truncate_float_to_s32(f32) __asm__("func_001FA6D0"); extern short D_L00_001AC780[]; @@ -538,7 +538,7 @@ char *load_level_gameplay(int arg0) { level_root[1] = mem; /* D_0015EE50 */ } FlushCache(0); - FUN_L00_0024d8d0(level_root[1], hdr); + fast_decompress(level_root[1], hdr); FlushCache(0); FillTransferWords(&D_0013F350, 0, 0x2310); FillTransferWords(D_L00_00166C80, 0, 0x3A0); @@ -2108,6 +2108,7 @@ extern s32 start_audio_stream_read(void *, s32, s32) __asm__("FUN_00216788"); extern void update_audio_stream_until_idle(s32) __asm__("FUN_002168a8"); /* streams entry i of the current sector list into the loader buffer */ +s32 FUN_L00_002451b8(s32 i); s32 FUN_L00_002451b8(s32 i) { u8 *buf = D_L00_0016C860.buf; s32 start; @@ -2126,3 +2127,73 @@ s32 FUN_L00_002451b8(s32 i) { } return 1; } + +s64 D_L01_00182C60[1] __attribute__((section(".data"))) = {0}; +s64 D_L01_00182C68[1] __attribute__((section(".data"))) = {0}; +s64 D_L01_00182C78[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_0017441C[1] __attribute__((section(".data"))) = {0}; +s64 D_L02_00182DE0[1] __attribute__((section(".data"))) = {0}; +s64 D_L02_00182DE8[1] __attribute__((section(".data"))) = {0}; +s64 D_L02_00182DF8[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B0220[1] __attribute__((section(".data"))) = {0}; +s32 D_L02_001B0280[1] __attribute__((section(".data"))) = {0}; +s32 D_L03_00173F1C[1] __attribute__((section(".data"))) = {0}; +s64 D_L03_001828E0[1] __attribute__((section(".data"))) = {0}; +s64 D_L03_001828E8[1] __attribute__((section(".data"))) = {0}; +s64 D_L03_001828F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L04_00173F9C[1] __attribute__((section(".data"))) = {0}; +s64 D_L04_00182960[1] __attribute__((section(".data"))) = {0}; +s64 D_L04_00182968[1] __attribute__((section(".data"))) = {0}; +s64 D_L04_00182978[1] __attribute__((section(".data"))) = {0}; +s32 D_L05_0017421C[1] __attribute__((section(".data"))) = {0}; +s64 D_L05_00182C60[1] __attribute__((section(".data"))) = {0}; +s64 D_L05_00182C68[1] __attribute__((section(".data"))) = {0}; +s64 D_L05_00182C78[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_0017461C[1] __attribute__((section(".data"))) = {0}; +s64 D_L08_00182FE0[1] __attribute__((section(".data"))) = {0}; +s64 D_L08_00182FE8[1] __attribute__((section(".data"))) = {0}; +s64 D_L08_00182FF8[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B0420[1] __attribute__((section(".data"))) = {0}; +s32 D_L08_001B0480[1] __attribute__((section(".data"))) = {0}; +s32 D_L09_00173F9C[1] __attribute__((section(".data"))) = {0}; +s64 D_L09_00182960[1] __attribute__((section(".data"))) = {0}; +s64 D_L09_00182968[1] __attribute__((section(".data"))) = {0}; +s64 D_L09_00182978[1] __attribute__((section(".data"))) = {0}; +s32 D_L10_0017429C[1] __attribute__((section(".data"))) = {0}; +s64 D_L10_00182C60[1] __attribute__((section(".data"))) = {0}; +s64 D_L10_00182C68[1] __attribute__((section(".data"))) = {0}; +s64 D_L10_00182C78[1] __attribute__((section(".data"))) = {0}; +s64 D_L11_001831E0[1] __attribute__((section(".data"))) = {0}; +s64 D_L11_001831E8[1] __attribute__((section(".data"))) = {0}; +s64 D_L11_001831F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B0620[1] __attribute__((section(".data"))) = {0}; +s32 D_L11_001B0680[1] __attribute__((section(".data"))) = {0}; +s32 D_L12_0017429C[1] __attribute__((section(".data"))) = {0}; +s64 D_L12_00182C60[1] __attribute__((section(".data"))) = {0}; +s64 D_L12_00182C68[1] __attribute__((section(".data"))) = {0}; +s64 D_L12_00182C78[1] __attribute__((section(".data"))) = {0}; +s32 D_L13_0017411C[1] __attribute__((section(".data"))) = {0}; +s64 D_L13_00182AE0[1] __attribute__((section(".data"))) = {0}; +s64 D_L13_00182AE8[1] __attribute__((section(".data"))) = {0}; +s64 D_L13_00182AF8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_0017451C[1] __attribute__((section(".data"))) = {0}; +s64 D_L14_00182EE0[1] __attribute__((section(".data"))) = {0}; +s64 D_L14_00182EE8[1] __attribute__((section(".data"))) = {0}; +s64 D_L14_00182EF8[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B0320[1] __attribute__((section(".data"))) = {0}; +s32 D_L14_001B0380[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_0017441C[1] __attribute__((section(".data"))) = {0}; +s64 D_L15_00182DE0[1] __attribute__((section(".data"))) = {0}; +s64 D_L15_00182DE8[1] __attribute__((section(".data"))) = {0}; +s64 D_L15_00182DF8[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B0220[1] __attribute__((section(".data"))) = {0}; +s32 D_L15_001B0280[1] __attribute__((section(".data"))) = {0}; +s32 D_L16_0017421C[1] __attribute__((section(".data"))) = {0}; +s64 D_L16_00182C60[1] __attribute__((section(".data"))) = {0}; +s64 D_L16_00182C68[1] __attribute__((section(".data"))) = {0}; +s64 D_L16_00182C78[1] __attribute__((section(".data"))) = {0}; +s64 D_L17_001830E0[1] __attribute__((section(".data"))) = {0}; +s64 D_L17_001830E8[1] __attribute__((section(".data"))) = {0}; +s64 D_L17_001830F8[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B0520[1] __attribute__((section(".data"))) = {0}; +s32 D_L17_001B0580[1] __attribute__((section(".data"))) = {0}; diff --git a/src/rendering/dmac_vif1_enable.c b/src/rendering/dmac_vif1_enable.c index 2cd8590982..605fa6b2ef 100644 --- a/src/rendering/dmac_vif1_enable.c +++ b/src/rendering/dmac_vif1_enable.c @@ -2,7 +2,7 @@ #include "rnc/data_labels.h" extern s32 AddDmacHandler(); extern s32 enable_dmac() __asm__("func_00119160"); -extern s32 vif1_dma_interrupt_handler(s32 cause) __asm__("FUN_00233e00"); +extern s32 vif1_dma_interrupt_handler(s32 cause) __asm__("func_00233E00"); extern void print_register_values_and_halt() __asm__("func_00233F00"); void dmac_vif1_enable(void) __asm__("FUN_00233d00"); diff --git a/src/rendering/sky/sky_draw_shell_gouraud.c b/src/rendering/sky/sky_draw_shell_gouraud.c index c8aec67385..7d5b9c5d46 100644 --- a/src/rendering/sky/sky_draw_shell_gouraud.c +++ b/src/rendering/sky/sky_draw_shell_gouraud.c @@ -25,7 +25,7 @@ struct Shell { extern u8 sky_gouraud_gs_block[] __asm__("D_0013D0F0"); -extern void FUN_0022c4c8(struct SkyTile *tiles, s32 count, u8 *visibility) __asm__("FUN_0022c4c8"); +extern void sky_bsphere_check(struct SkyTile *tiles, s32 count, u8 *visibility) __asm__("FUN_0022c4c8"); extern void WriteDmaChannelRegisters(s32 address, s32 qwc, s32 destination); extern void dma_to_spr_sync(void) __asm__("func_0020B3E0"); extern s32 FUN_0022bf94(s32, s32, s32, s32) __asm__("FUN_0022bf94"); @@ -46,7 +46,7 @@ void sky_draw_shell_gouraud(struct Shell *shell) { return; } - FUN_0022c4c8(shell->tiles, shell->count, visibility); + sky_bsphere_check(shell->tiles, shell->count, visibility); render_packet_cursor.words[0] = 0x30000007; *(s32 *)((u32)render_packet_cursor.words + 4) = (s32)sky_gouraud_gs_block; diff --git a/src/rendering/sky/sky_draw_shell_textured.c b/src/rendering/sky/sky_draw_shell_textured.c index f900ebe573..06e5e0ea21 100644 --- a/src/rendering/sky/sky_draw_shell_textured.c +++ b/src/rendering/sky/sky_draw_shell_textured.c @@ -24,7 +24,7 @@ struct Shell { extern u8 sky_textured_gs_block[] __asm__("D_0013D160"); -extern void FUN_0022c4c8(struct SkyTile *tiles, s32 count, u8 *visibility) __asm__("FUN_0022c4c8"); +extern void sky_bsphere_check(struct SkyTile *tiles, s32 count, u8 *visibility) __asm__("FUN_0022c4c8"); extern void WriteDmaChannelRegisters(s32 address, s32 qwc, s32 destination); extern void dma_to_spr_sync(void) __asm__("func_0020B3E0"); extern s32 FUN_0022bf94(s32, s32, s32, s32) __asm__("FUN_0022bf94"); @@ -44,7 +44,7 @@ void sky_draw_shell_textured(struct Shell *shell) { return; } - FUN_0022c4c8(shell->tiles, shell->count, visibility); + sky_bsphere_check(shell->tiles, shell->count, visibility); render_packet_cursor.words[0] = 0x30000007; *(s32 *)((u32)render_packet_cursor.words + 4) = (s32)sky_textured_gs_block; diff --git a/src/rendering/vif1_dma_interrupt_handler.c b/src/rendering/vif1_dma_interrupt_handler.c index 2da2847474..a09a0462c7 100644 --- a/src/rendering/vif1_dma_interrupt_handler.c +++ b/src/rendering/vif1_dma_interrupt_handler.c @@ -7,7 +7,7 @@ extern volatile s32 vif_chain_flags __asm__("D_00160EE0") __attribute__((sda)); /* VIF1 DMA interrupt handler: clears the busy bit of the chain part whose tag ID raised the interrupt, all of them at the end of the chain, then resumes the channel. */ -s32 vif1_dma_interrupt_handler(s32 cause) __asm__("FUN_00233e00"); +s32 vif1_dma_interrupt_handler(s32 cause) __asm__("func_00233E00"); s32 vif1_dma_interrupt_handler(s32 cause) { u32 chcr = *(volatile u32 *)0x10009000; diff --git a/src/rnc1_functions.h b/src/rnc1_functions.h index d029fef7ae..2566676c6a 100644 --- a/src/rnc1_functions.h +++ b/src/rnc1_functions.h @@ -64,7 +64,7 @@ int is_state_field_large(int *state_fields) __asm__("func_0023AEE0"); float scale_time(float input) __asm__("func_001F96B0"); float multiply_global_scale(float input) __asm__("func_001F96E8"); -float multiply_global_factor_ed70(float input) __asm__("func_001F9730"); +float func_001F9730(float input); float absolute_float(float input) __asm__("func_001F99C0"); diff --git a/src/assembly/sdk/dma/dma_ref_image.c b/src/sdk/dma/dma_ref_image.c similarity index 92% rename from src/assembly/sdk/dma/dma_ref_image.c rename to src/sdk/dma/dma_ref_image.c index cf670a5006..7ad077eef3 100644 --- a/src/assembly/sdk/dma/dma_ref_image.c +++ b/src/sdk/dma/dma_ref_image.c @@ -1,8 +1,3 @@ -#include "asm.h" - -#ifndef NON_MATCHING -INCLUDE_ASM("config/us/expected/asm/assembly/sdk/dma/dma_ref_image/dmaRefImage.s", dmaRefImage); -#else #include "types.h" #include "eetypes.h" #include "kernel.h" @@ -71,4 +66,3 @@ void dmaRefImage(MpegRefImageState *state) { EnableInterrupts(); } } -#endif /* NON_MATCHING */ diff --git a/src/sdk/library/fun_00129b38.c b/src/sdk/library/fun_00129b38.c index efc071cc69..5b68fd306b 100644 --- a/src/sdk/library/fun_00129b38.c +++ b/src/sdk/library/fun_00129b38.c @@ -33,7 +33,8 @@ typedef struct Obj40 { the entry budget at +0xE0; an unsized one has to fit width * height against +0xE4. On a refusal, format the two figures into the message at D_00153A80 and report it. Returns whether it fits. */ -int FUN_00129b38(void *object) { +int FinishMpegReferenceImage(void *object) __asm__("FUN_00129b38"); +int FinishMpegReferenceImage(void *object) { Obj40 *s = (Obj40 *)object; int r = 1; if (s->unk008 != 2) { @@ -45,4 +46,4 @@ int FUN_00129b38(void *object) { return r; } -extern __typeof__(FUN_00129b38) func_00129B38 __attribute__((alias("FUN_00129b38"))); +extern __typeof__(FinishMpegReferenceImage) func_00129B38 __attribute__((alias("FUN_00129b38"))); diff --git a/src/textbin/audio/music/music_update.c b/src/textbin/audio/music/music_update.c index aea04636f4..fbc7af1b39 100644 --- a/src/textbin/audio/music/music_update.c +++ b/src/textbin/audio/music/music_update.c @@ -11,7 +11,7 @@ extern void set_sound_handle_id(u32, s64) __asm__("func_00216B68"); extern void snd_continue_vag_stream(s32) __asm__("func_0012ECA0"); extern s32 snd_stream_safe_cd_sync(s32) __asm__("func_0012EE08"); extern s32 scale_game_frames(s32) __asm__("func_001F96F8"); -extern s32 func_001F9740(void *); +extern s32 fast_dec_timer(void *) __asm__("func_001F9740"); extern void music_start_track_by_id(s32, s32, s32) __asm__("func_00215970"); extern void music_preseek_track(s32, s32, s32) __asm__("func_00215B68"); extern void music_start_track(s32, s32, s32) __asm__("func_00215C40"); @@ -43,7 +43,7 @@ void music_update(void) { } } } - if (func_001F9740(&music_stream_state.retry_timer) != 0) { + if (fast_dec_timer(&music_stream_state.retry_timer) != 0) { requested_track = music_stream_state.requested_track; if (requested_track != -1 && music_stream_state.crossfade_state == 0) { if (music_stream_state.primary.track != requested_track) { diff --git a/src/ui/help/update_help_state.c b/src/ui/help/update_help_state.c index d8c3fe459a..8021641aa1 100644 --- a/src/ui/help/update_help_state.c +++ b/src/ui/help/update_help_state.c @@ -34,7 +34,7 @@ extern TextEntry *help_msgs __asm__("D_0015F6A0"); extern HelpState D_001996D0; extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); -extern s32 func_001F9740(void *); +extern s32 fast_dec_timer(void *) __asm__("func_001F9740"); extern s32 find_help_message_index(s32 arg0) __asm__("FUN_001fdca0"); extern void link_localized_display_text(void) __asm__("FUN_001fdd58"); extern s32 force_help_message(s32 arg0, s32 arg1) __asm__("FUN_002151d8"); @@ -86,7 +86,7 @@ void update_help_state(void) { } if (D_001996D0.msg >= 0) { if (D_001996D0.shown == 0) { - if (func_001F9740(D_001996D0.wait) != 0) { + if (fast_dec_timer(D_001996D0.wait) != 0) { link_localized_display_text(); D_001996D0.shown++; } diff --git a/src/ui/map/map_filters.c b/src/ui/map/map_filters.c index db838501e0..6d7f10229c 100644 --- a/src/ui/map/map_filters.c +++ b/src/ui/map/map_filters.c @@ -146,7 +146,7 @@ union RegionVector { u128 region_center; f32 f[4]; }; -extern f32 func_001F9B80(union RegionVector *, union RegionVector *); +extern f32 vector_distance(union RegionVector *, union RegionVector *) __asm__("func_001F9B80"); s32 map_filter_l07_0(s32 projected_x, s32 projected_y, f32 x, f32 y, f32 z) __asm__("func_00206BD8"); @@ -172,7 +172,7 @@ s32 map_filter_l07_0(s32 projected_x, s32 projected_y, f32 x, f32 y, f32 z) { position.f[1] = y; region_center.f[0] = 337.5f; region_center.f[1] = 250.0f; - if (func_001F9B80(&position, ®ion_center) <= 7.0f) { + if (vector_distance(&position, ®ion_center) <= 7.0f) { return 1; } if (point_is_clockwise(projected_x, projected_y, 0x142, 0x12A, 0x173, 0xFC) && diff --git a/src/ui/menus/fade_menu_color.c b/src/ui/menus/fade_menu_color.c index 5823e7291e..98f019efe1 100644 --- a/src/ui/menus/fade_menu_color.c +++ b/src/ui/menus/fade_menu_color.c @@ -2,7 +2,7 @@ #include "rnc/data_labels.h" #include "rnc/ui/menus/menu_globals.h" extern s32 scale_game_frames(s32) __asm__("FUN_001f96f8"); -extern s32 func_001FA6E0(s32, s32, f32); +extern s32 fast_tween_color(s32, s32, f32) __asm__("func_001FA6E0"); /* Fades from one color to another once the delay has passed. -1 picks the default color. The defaults are written back into the parameters: with @@ -28,7 +28,7 @@ s32 fade_menu_color(s32 delay, s32 from, s32 to) { } else { t = 1.0f; } - return func_001FA6E0(from, to, t); + return fast_tween_color(from, to, t); } extern __typeof__(fade_menu_color) func_0021B6D8 __attribute__((alias("FUN_0021b6d8"))); diff --git a/src/ui/menus/fun_00216c48.c b/src/ui/menus/fun_00216c48.c index 570dee1295..905e8228f3 100644 --- a/src/ui/menus/fun_00216c48.c +++ b/src/ui/menus/fun_00216c48.c @@ -54,8 +54,6 @@ extern s32 sprintf(char *, const char *, ...); extern void copy_text_to_shared_buffer(char *) __asm__("func_001FF658"); extern s32 compute_clamped_count_difference(void) __asm__("FUN_00215248"); -void func_00216C48(void *arg0, Menu *menu, s32 arg2) __asm__("func_00216C48"); - #define SCRATCH ((char *)0x70000000) void FUN_00216c48(void *arg0, Menu *menu, s32 arg2) { @@ -161,7 +159,7 @@ void FUN_00216c48(void *arg0, Menu *menu, s32 arg2) { menu->unk38 = world_update_time_macro; e = (MenuItem *)(menu->unk3C + next * 0x1C); menu->unk8 = *(u8 *)&e->unk10 & 1; - func_00216C48(arg0, menu, 0); + FUN_00216c48(arg0, menu, 0); } } diff --git a/src/ui/menus/fun_00224b68.c b/src/ui/menus/fun_00224b68.c index 23a43cd641..9f07e08f34 100644 --- a/src/ui/menus/fun_00224b68.c +++ b/src/ui/menus/fun_00224b68.c @@ -1,5 +1,6 @@ /* Ported from rac1-decomp (src/game/pause.c, func_00225DF8). */ -void FUN_00224b68(void) { +void attachment_update_callback(void) __asm__("FUN_00224b68"); +void attachment_update_callback(void) { } -extern __typeof__(FUN_00224b68) func_00224B68 __attribute__((alias("FUN_00224b68"))); +extern __typeof__(attachment_update_callback) func_00224B68 __attribute__((alias("FUN_00224b68"))); diff --git a/src/video/decoder/buffers/read_buf_end_get.c b/src/video/decoder/buffers/read_buf_end_get.c index f4a6eee839..427b2d42ba 100644 --- a/src/video/decoder/buffers/read_buf_end_get.c +++ b/src/video/decoder/buffers/read_buf_end_get.c @@ -4,6 +4,8 @@ struct ReadBuf { s32 count; }; +s32 read_buf_end_get(struct ReadBuf *table, s32 requested) __asm__("GetStateTableWord"); + s32 read_buf_end_get(struct ReadBuf *table, s32 requested) { s32 taken; s32 result; diff --git a/src/video/decoder/callbacks/video_callback.c b/src/video/decoder/callbacks/video_callback.c index fdeda1e80e..af9cecf7bc 100644 --- a/src/video/decoder/callbacks/video_callback.c +++ b/src/video/decoder/callbacks/video_callback.c @@ -22,7 +22,7 @@ extern void video_dec_begin_put(u8 *, u32 *, s32 *, u32 *, s32 *) __asm__("func_ extern void video_dec_end_put(u8 *, s32) __asm__("func_0023CC10"); extern s32 video_dec_put_ts(u8 *, s64, s64, u32, s32) __asm__("func_0023CC98"); -s32 video_callback(s32 arg0, struct VdecCb *cb, struct VdecBuf *ab) __asm__("FUN_0023b5f0"); +s32 video_callback(s32 unused_callback_arg, struct VdecCb *cb, struct VdecBuf *ab) __asm__("FUN_0023b5f0"); s32 video_callback(s32 unused_callback_arg, struct VdecCb *cb, struct VdecBuf *ab) { u32 ptr0; diff --git a/src/video/decoder/read_mpeg.c b/src/video/decoder/read_mpeg.c index 874936e445..45f5d42956 100644 --- a/src/video/decoder/read_mpeg.c +++ b/src/video/decoder/read_mpeg.c @@ -25,11 +25,11 @@ extern s32 proceed_audio(void) __asm__("func_0023ABA0"); extern void audio_dec_start(s32) __asm__("func_0023ACB8"); extern void audio_dec_reset(s32) __asm__("FUN_0023ad10"); extern void start_display(s32) __asm__("func_0023B590"); -extern void end_display(void); +extern void end_display(void) __asm__("ClearStageStateFlag"); extern s32 read_buf_begin_put(struct ReadBuf *, u8 **) __asm__("func_0023B960"); extern void read_buf_end_put(struct ReadBuf *, s32) __asm__("func_0023B990"); extern s32 read_buf_begin_get(struct ReadBuf *, u8 **) __asm__("func_0023B9D8"); -extern s32 read_buf_end_get(struct ReadBuf *, s32); +extern s32 read_buf_end_get(struct ReadBuf *, s32) __asm__("GetStateTableWord"); extern s32 read_cd_stream_sectors(struct MpegCdStream *, u8 *, s32, s32) __asm__("func_0023BA60"); extern s32 video_dec_abort(s32) __asm__("func_0023CC70"); extern s32 video_dec_get_state(struct VideoDec *) __asm__("func_0023CC80"); diff --git a/src/video/display/end_display.c b/src/video/display/end_display.c index 715e04bbf8..97adf8a0ef 100644 --- a/src/video/display/end_display.c +++ b/src/video/display/end_display.c @@ -2,6 +2,8 @@ #include "rnc/data_labels.h" #include "rnc/video/decoder/decoder_globals.h" +void end_display(void) __asm__("ClearStageStateFlag"); + void end_display(void) { movie_display_active = 0; }