From 9f36bae2aa92bf9a33d54c422e8e8cbd4e772e37 Mon Sep 17 00:00:00 2001 From: Aaron B <74215195+AaronB-Hub@users.noreply.github.com> Date: Mon, 30 Sep 2024 16:05:42 -0400 Subject: [PATCH] Link `it_2F28` (#1476) Co-authored-by: Robin Avery --- asm/melee/it/items/it_2F28.s | 269 ----------------------------------- configure.py | 2 +- obj_files.mk | 2 +- src/melee/it/forward.h | 3 +- src/melee/it/itCommonItems.h | 11 ++ src/melee/it/it_2725.h | 2 +- src/melee/it/items/it_2F28.c | 132 +++++++++++++++++ src/melee/it/items/it_2F28.h | 3 +- src/melee/it/types.h | 1 + 9 files changed, 151 insertions(+), 274 deletions(-) delete mode 100644 asm/melee/it/items/it_2F28.s diff --git a/asm/melee/it/items/it_2F28.s b/asm/melee/it/items/it_2F28.s deleted file mode 100644 index 5ae123be80..0000000000 --- a/asm/melee/it/items/it_2F28.s +++ /dev/null @@ -1,269 +0,0 @@ -.include "macros.inc" - -.section .text - -.global it_802F28C8 -it_802F28C8: -/* 802F28C8 002EF4A8 7C 08 02 A6 */ mflr r0 -/* 802F28CC 002EF4AC 90 01 00 04 */ stw r0, 4(r1) -/* 802F28D0 002EF4B0 94 21 FF D0 */ stwu r1, -0x30(r1) -/* 802F28D4 002EF4B4 DB E1 00 28 */ stfd f31, 0x28(r1) -/* 802F28D8 002EF4B8 FF E0 08 90 */ fmr f31, f1 -/* 802F28DC 002EF4BC 93 E1 00 24 */ stw r31, 0x24(r1) -/* 802F28E0 002EF4C0 93 C1 00 20 */ stw r30, 0x20(r1) -/* 802F28E4 002EF4C4 3B C4 00 00 */ addi r30, r4, 0 -/* 802F28E8 002EF4C8 93 A1 00 1C */ stw r29, 0x1c(r1) -/* 802F28EC 002EF4CC 7C 7D 1B 78 */ mr r29, r3 -/* 802F28F0 002EF4D0 38 9D 00 00 */ addi r4, r29, 0 -/* 802F28F4 002EF4D4 83 E3 00 2C */ lwz r31, 0x2c(r3) -/* 802F28F8 002EF4D8 80 7F 0D 00 */ lwz r3, 0xd00(r31) -/* 802F28FC 002EF4DC 4B F8 8B A9 */ bl it_8027B4A4 -/* 802F2900 002EF4E0 FC 20 F8 90 */ fmr f1, f31 -/* 802F2904 002EF4E4 80 7F 0D 00 */ lwz r3, 0xd00(r31) -/* 802F2908 002EF4E8 7F A4 EB 78 */ mr r4, r29 -/* 802F290C 002EF4EC 4B F8 8A 6D */ bl it_8027B378 -/* 802F2910 002EF4F0 2C 1E 00 00 */ cmpwi r30, 0 -/* 802F2914 002EF4F4 41 82 00 0C */ beq .L_802F2920 -/* 802F2918 002EF4F8 38 00 00 00 */ li r0, 0 -/* 802F291C 002EF4FC 90 1F 0D 60 */ stw r0, 0xd60(r31) -.L_802F2920: -/* 802F2920 002EF500 38 00 00 00 */ li r0, 0 -/* 802F2924 002EF504 90 1F 0D 04 */ stw r0, 0xd04(r31) -/* 802F2928 002EF508 7F A3 EB 78 */ mr r3, r29 -/* 802F292C 002EF50C 90 1F 0D 00 */ stw r0, 0xd00(r31) -/* 802F2930 002EF510 4B F8 A5 15 */ bl it_8027CE44 -/* 802F2934 002EF514 7F A3 EB 78 */ mr r3, r29 -/* 802F2938 002EF518 4B F7 7F B5 */ bl Item_8026A8EC -/* 802F293C 002EF51C 80 01 00 34 */ lwz r0, 0x34(r1) -/* 802F2940 002EF520 CB E1 00 28 */ lfd f31, 0x28(r1) -/* 802F2944 002EF524 83 E1 00 24 */ lwz r31, 0x24(r1) -/* 802F2948 002EF528 83 C1 00 20 */ lwz r30, 0x20(r1) -/* 802F294C 002EF52C 83 A1 00 1C */ lwz r29, 0x1c(r1) -/* 802F2950 002EF530 38 21 00 30 */ addi r1, r1, 0x30 -/* 802F2954 002EF534 7C 08 03 A6 */ mtlr r0 -/* 802F2958 002EF538 4E 80 00 20 */ blr - -.global it_802F295C -it_802F295C: -/* 802F295C 002EF53C 7C 08 02 A6 */ mflr r0 -/* 802F2960 002EF540 38 C0 00 00 */ li r6, 0 -/* 802F2964 002EF544 90 01 00 04 */ stw r0, 4(r1) -/* 802F2968 002EF548 38 00 00 35 */ li r0, 0x35 -/* 802F296C 002EF54C 94 21 FF 88 */ stwu r1, -0x78(r1) -/* 802F2970 002EF550 DB E1 00 70 */ stfd f31, 0x70(r1) -/* 802F2974 002EF554 93 E1 00 6C */ stw r31, 0x6c(r1) -/* 802F2978 002EF558 93 C1 00 68 */ stw r30, 0x68(r1) -/* 802F297C 002EF55C 3B C4 00 00 */ addi r30, r4, 0 -/* 802F2980 002EF560 90 01 00 20 */ stw r0, 0x20(r1) -/* 802F2984 002EF564 C3 E2 E0 08 */ lfs f31, it_804DD9E8@sda21(r2) -/* 802F2988 002EF568 80 A4 00 00 */ lwz r5, 0(r4) -/* 802F298C 002EF56C 38 80 00 01 */ li r4, 1 -/* 802F2990 002EF570 80 1E 00 04 */ lwz r0, 4(r30) -/* 802F2994 002EF574 90 A1 00 38 */ stw r5, 0x38(r1) -/* 802F2998 002EF578 90 01 00 3C */ stw r0, 0x3c(r1) -/* 802F299C 002EF57C 80 1E 00 08 */ lwz r0, 8(r30) -/* 802F29A0 002EF580 90 01 00 40 */ stw r0, 0x40(r1) -/* 802F29A4 002EF584 D3 E1 00 40 */ stfs f31, 0x40(r1) -/* 802F29A8 002EF588 C0 02 E0 0C */ lfs f0, it_804DD9EC@sda21(r2) -/* 802F29AC 002EF58C 80 A1 00 38 */ lwz r5, 0x38(r1) -/* 802F29B0 002EF590 80 01 00 3C */ lwz r0, 0x3c(r1) -/* 802F29B4 002EF594 90 A1 00 2C */ stw r5, 0x2c(r1) -/* 802F29B8 002EF598 90 01 00 30 */ stw r0, 0x30(r1) -/* 802F29BC 002EF59C 80 01 00 40 */ lwz r0, 0x40(r1) -/* 802F29C0 002EF5A0 90 01 00 34 */ stw r0, 0x34(r1) -/* 802F29C4 002EF5A4 D0 01 00 50 */ stfs f0, 0x50(r1) -/* 802F29C8 002EF5A8 B0 C1 00 54 */ sth r6, 0x54(r1) -/* 802F29CC 002EF5AC 80 BE 00 0C */ lwz r5, 0xc(r30) -/* 802F29D0 002EF5B0 80 1E 00 10 */ lwz r0, 0x10(r30) -/* 802F29D4 002EF5B4 90 A1 00 44 */ stw r5, 0x44(r1) -/* 802F29D8 002EF5B8 90 01 00 48 */ stw r0, 0x48(r1) -/* 802F29DC 002EF5BC 80 1E 00 14 */ lwz r0, 0x14(r30) -/* 802F29E0 002EF5C0 90 01 00 4C */ stw r0, 0x4c(r1) -/* 802F29E4 002EF5C4 90 61 00 18 */ stw r3, 0x18(r1) -/* 802F29E8 002EF5C8 90 61 00 1C */ stw r3, 0x1c(r1) -/* 802F29EC 002EF5CC 38 61 00 18 */ addi r3, r1, 0x18 -/* 802F29F0 002EF5D0 88 01 00 5C */ lbz r0, 0x5c(r1) -/* 802F29F4 002EF5D4 50 80 3E 30 */ rlwimi r0, r4, 7, 0x18, 0x18 -/* 802F29F8 002EF5D8 98 01 00 5C */ stb r0, 0x5c(r1) -/* 802F29FC 002EF5DC 90 C1 00 58 */ stw r6, 0x58(r1) -/* 802F2A00 002EF5E0 4B F7 61 19 */ bl Item_80268B18 -/* 802F2A04 002EF5E4 7C 7F 1B 79 */ or. r31, r3, r3 -/* 802F2A08 002EF5E8 41 82 00 30 */ beq .L_802F2A38 -/* 802F2A0C 002EF5EC C0 1E 00 1C */ lfs f0, 0x1c(r30) -/* 802F2A10 002EF5F0 7F E3 FB 78 */ mr r3, r31 -/* 802F2A14 002EF5F4 80 9F 00 2C */ lwz r4, 0x2c(r31) -/* 802F2A18 002EF5F8 D0 04 0D D4 */ stfs f0, 0xdd4(r4) -/* 802F2A1C 002EF5FC C0 3E 00 18 */ lfs f1, 0x18(r30) -/* 802F2A20 002EF600 4B F8 27 39 */ bl it_80275158 -/* 802F2A24 002EF604 7F E3 FB 78 */ mr r3, r31 -/* 802F2A28 002EF608 48 00 00 31 */ bl it_802F2A58 -/* 802F2A2C 002EF60C 7F E3 FB 78 */ mr r3, r31 -/* 802F2A30 002EF610 4B F8 2E A5 */ bl it_802758D4 -/* 802F2A34 002EF614 FF E0 08 90 */ fmr f31, f1 -.L_802F2A38: -/* 802F2A38 002EF618 FC 20 F8 90 */ fmr f1, f31 -/* 802F2A3C 002EF61C 80 01 00 7C */ lwz r0, 0x7c(r1) -/* 802F2A40 002EF620 CB E1 00 70 */ lfd f31, 0x70(r1) -/* 802F2A44 002EF624 83 E1 00 6C */ lwz r31, 0x6c(r1) -/* 802F2A48 002EF628 83 C1 00 68 */ lwz r30, 0x68(r1) -/* 802F2A4C 002EF62C 38 21 00 78 */ addi r1, r1, 0x78 -/* 802F2A50 002EF630 7C 08 03 A6 */ mtlr r0 -/* 802F2A54 002EF634 4E 80 00 20 */ blr - -.global it_802F2A58 -it_802F2A58: -/* 802F2A58 002EF638 7C 08 02 A6 */ mflr r0 -/* 802F2A5C 002EF63C 90 01 00 04 */ stw r0, 4(r1) -/* 802F2A60 002EF640 94 21 FF E8 */ stwu r1, -0x18(r1) -/* 802F2A64 002EF644 93 E1 00 14 */ stw r31, 0x14(r1) -/* 802F2A68 002EF648 93 C1 00 10 */ stw r30, 0x10(r1) -/* 802F2A6C 002EF64C 7C 7E 1B 78 */ mr r30, r3 -/* 802F2A70 002EF650 83 E3 00 2C */ lwz r31, 0x2c(r3) -/* 802F2A74 002EF654 4B F7 89 35 */ bl it_8026B3A8 -/* 802F2A78 002EF658 38 7E 00 00 */ addi r3, r30, 0 -/* 802F2A7C 002EF65C 38 80 00 00 */ li r4, 0 -/* 802F2A80 002EF660 38 A0 00 02 */ li r5, 2 -/* 802F2A84 002EF664 4B F7 63 D9 */ bl Item_80268E5C -/* 802F2A88 002EF668 88 1F 0D CE */ lbz r0, 0xdce(r31) -/* 802F2A8C 002EF66C 38 60 00 00 */ li r3, 0 -/* 802F2A90 002EF670 50 60 07 FE */ rlwimi r0, r3, 0, 0x1f, 0x1f -/* 802F2A94 002EF674 98 1F 0D CE */ stb r0, 0xdce(r31) -/* 802F2A98 002EF678 80 01 00 1C */ lwz r0, 0x1c(r1) -/* 802F2A9C 002EF67C 83 E1 00 14 */ lwz r31, 0x14(r1) -/* 802F2AA0 002EF680 83 C1 00 10 */ lwz r30, 0x10(r1) -/* 802F2AA4 002EF684 38 21 00 18 */ addi r1, r1, 0x18 -/* 802F2AA8 002EF688 7C 08 03 A6 */ mtlr r0 -/* 802F2AAC 002EF68C 4E 80 00 20 */ blr - -.global it_802F2AB0 -it_802F2AB0: -/* 802F2AB0 002EF690 80 63 00 2C */ lwz r3, 0x2c(r3) -/* 802F2AB4 002EF694 C0 02 E0 10 */ lfs f0, it_804DD9F0@sda21(r2) -/* 802F2AB8 002EF698 C0 23 0D 44 */ lfs f1, 0xd44(r3) -/* 802F2ABC 002EF69C EC 01 00 28 */ fsubs f0, f1, f0 -/* 802F2AC0 002EF6A0 D0 03 0D 44 */ stfs f0, 0xd44(r3) -/* 802F2AC4 002EF6A4 C0 23 0D 44 */ lfs f1, 0xd44(r3) -/* 802F2AC8 002EF6A8 C0 02 E0 08 */ lfs f0, it_804DD9E8@sda21(r2) -/* 802F2ACC 002EF6AC FC 01 00 40 */ fcmpo cr0, f1, f0 -/* 802F2AD0 002EF6B0 4C 40 13 82 */ cror 2, 0, 2 -/* 802F2AD4 002EF6B4 40 82 00 0C */ bne .L_802F2AE0 -/* 802F2AD8 002EF6B8 38 60 00 01 */ li r3, 1 -/* 802F2ADC 002EF6BC 4E 80 00 20 */ blr -.L_802F2AE0: -/* 802F2AE0 002EF6C0 38 60 00 00 */ li r3, 0 -/* 802F2AE4 002EF6C4 4E 80 00 20 */ blr - -.global it_802F2AE8 -it_802F2AE8: -/* 802F2AE8 002EF6C8 94 21 FF E8 */ stwu r1, -0x18(r1) -/* 802F2AEC 002EF6CC 80 63 00 2C */ lwz r3, 0x2c(r3) -/* 802F2AF0 002EF6D0 C0 02 E0 08 */ lfs f0, it_804DD9E8@sda21(r2) -/* 802F2AF4 002EF6D4 C0 43 00 40 */ lfs f2, 0x40(r3) -/* 802F2AF8 002EF6D8 C0 23 00 44 */ lfs f1, 0x44(r3) -/* 802F2AFC 002EF6DC EC 42 00 B2 */ fmuls f2, f2, f2 -/* 802F2B00 002EF6E0 EC 21 00 72 */ fmuls f1, f1, f1 -/* 802F2B04 002EF6E4 EC 82 08 2A */ fadds f4, f2, f1 -/* 802F2B08 002EF6E8 FC 04 00 40 */ fcmpo cr0, f4, f0 -/* 802F2B0C 002EF6EC 40 81 00 50 */ ble .L_802F2B5C -/* 802F2B10 002EF6F0 FC 20 20 34 */ frsqrte f1, f4 -/* 802F2B14 002EF6F4 C8 62 E0 18 */ lfd f3, it_804DD9F8@sda21(r2) -/* 802F2B18 002EF6F8 C8 42 E0 20 */ lfd f2, it_804DDA00@sda21(r2) -/* 802F2B1C 002EF6FC FC 01 00 72 */ fmul f0, f1, f1 -/* 802F2B20 002EF700 FC 23 00 72 */ fmul f1, f3, f1 -/* 802F2B24 002EF704 FC 04 10 3C */ fnmsub f0, f4, f0, f2 -/* 802F2B28 002EF708 FC 21 00 32 */ fmul f1, f1, f0 -/* 802F2B2C 002EF70C FC 01 00 72 */ fmul f0, f1, f1 -/* 802F2B30 002EF710 FC 23 00 72 */ fmul f1, f3, f1 -/* 802F2B34 002EF714 FC 04 10 3C */ fnmsub f0, f4, f0, f2 -/* 802F2B38 002EF718 FC 21 00 32 */ fmul f1, f1, f0 -/* 802F2B3C 002EF71C FC 01 00 72 */ fmul f0, f1, f1 -/* 802F2B40 002EF720 FC 23 00 72 */ fmul f1, f3, f1 -/* 802F2B44 002EF724 FC 04 10 3C */ fnmsub f0, f4, f0, f2 -/* 802F2B48 002EF728 FC 01 00 32 */ fmul f0, f1, f0 -/* 802F2B4C 002EF72C FC 04 00 32 */ fmul f0, f4, f0 -/* 802F2B50 002EF730 FC 00 00 18 */ frsp f0, f0 -/* 802F2B54 002EF734 D0 01 00 10 */ stfs f0, 0x10(r1) -/* 802F2B58 002EF738 C0 81 00 10 */ lfs f4, 0x10(r1) -.L_802F2B5C: -/* 802F2B5C 002EF73C C0 03 0D D4 */ lfs f0, 0xdd4(r3) -/* 802F2B60 002EF740 FC 04 00 40 */ fcmpo cr0, f4, f0 -/* 802F2B64 002EF744 40 81 00 34 */ ble .L_802F2B98 -/* 802F2B68 002EF748 EC 04 00 28 */ fsubs f0, f4, f0 -/* 802F2B6C 002EF74C C0 23 00 40 */ lfs f1, 0x40(r3) -/* 802F2B70 002EF750 EC 01 00 32 */ fmuls f0, f1, f0 -/* 802F2B74 002EF754 EC 00 20 24 */ fdivs f0, f0, f4 -/* 802F2B78 002EF758 D0 03 00 40 */ stfs f0, 0x40(r3) -/* 802F2B7C 002EF75C C0 03 0D D4 */ lfs f0, 0xdd4(r3) -/* 802F2B80 002EF760 C0 23 00 44 */ lfs f1, 0x44(r3) -/* 802F2B84 002EF764 EC 04 00 28 */ fsubs f0, f4, f0 -/* 802F2B88 002EF768 EC 01 00 32 */ fmuls f0, f1, f0 -/* 802F2B8C 002EF76C EC 00 20 24 */ fdivs f0, f0, f4 -/* 802F2B90 002EF770 D0 03 00 44 */ stfs f0, 0x44(r3) -/* 802F2B94 002EF774 48 00 00 0C */ b .L_802F2BA0 -.L_802F2B98: -/* 802F2B98 002EF778 C0 02 E0 08 */ lfs f0, it_804DD9E8@sda21(r2) -/* 802F2B9C 002EF77C D0 03 00 40 */ stfs f0, 0x40(r3) -.L_802F2BA0: -/* 802F2BA0 002EF780 38 21 00 18 */ addi r1, r1, 0x18 -/* 802F2BA4 002EF784 4E 80 00 20 */ blr - -.global it_802F2BA8 -it_802F2BA8: -/* 802F2BA8 002EF788 7C 08 02 A6 */ mflr r0 -/* 802F2BAC 002EF78C 90 01 00 04 */ stw r0, 4(r1) -/* 802F2BB0 002EF790 94 21 FF F8 */ stwu r1, -8(r1) -/* 802F2BB4 002EF794 4B F7 B3 FD */ bl it_8026DFB0 -/* 802F2BB8 002EF798 2C 03 00 00 */ cmpwi r3, 0 -/* 802F2BBC 002EF79C 41 82 00 0C */ beq .L_802F2BC8 -/* 802F2BC0 002EF7A0 38 60 00 01 */ li r3, 1 -/* 802F2BC4 002EF7A4 48 00 00 08 */ b .L_802F2BCC -.L_802F2BC8: -/* 802F2BC8 002EF7A8 38 60 00 00 */ li r3, 0 -.L_802F2BCC: -/* 802F2BCC 002EF7AC 80 01 00 0C */ lwz r0, 0xc(r1) -/* 802F2BD0 002EF7B0 38 21 00 08 */ addi r1, r1, 8 -/* 802F2BD4 002EF7B4 7C 08 03 A6 */ mtlr r0 -/* 802F2BD8 002EF7B8 4E 80 00 20 */ blr - -.global it_802F2BDC -it_802F2BDC: -/* 802F2BDC 002EF7BC 7C 08 02 A6 */ mflr r0 -/* 802F2BE0 002EF7C0 90 01 00 04 */ stw r0, 4(r1) -/* 802F2BE4 002EF7C4 94 21 FF F8 */ stwu r1, -8(r1) -/* 802F2BE8 002EF7C8 4B F7 8C AD */ bl it_8026B894 -/* 802F2BEC 002EF7CC 80 01 00 0C */ lwz r0, 0xc(r1) -/* 802F2BF0 002EF7D0 38 21 00 08 */ addi r1, r1, 8 -/* 802F2BF4 002EF7D4 7C 08 03 A6 */ mtlr r0 -/* 802F2BF8 002EF7D8 4E 80 00 20 */ blr - - -.section .data - .balign 8 -.global it_803F9470 -it_803F9470: - .4byte 0 - .4byte it_802F2AB0 - .4byte it_802F2AE8 - .4byte it_802F2BA8 - - -.section .sdata2 - .balign 8 -.global it_804DD9E8 -it_804DD9E8: - .4byte 0x00000000 -.global it_804DD9EC -it_804DD9EC: - .4byte 0xBF800000 -.global it_804DD9F0 -it_804DD9F0: - .4byte 0x3F800000 - .balign 8 -.global it_804DD9F8 -it_804DD9F8: - .4byte 0x3FE00000 - .4byte 0x00000000 -.global it_804DDA00 -it_804DDA00: - .4byte 0x40080000 - .4byte 0x00000000 diff --git a/configure.py b/configure.py index bbed9945cd..65a52742f0 100755 --- a/configure.py +++ b/configure.py @@ -1140,7 +1140,7 @@ def TRKLib(lib_name: str, objects: Objects) -> Library: Object(NonMatching, "melee/it/items/itcrazyhandbomb.c"), Object(Matching, "melee/it/items/itcoin.c"), Object(NonMatching, "melee/it/items/itkirby_2F23.c"), - Object(NonMatching, "melee/it/items/it_2F28.c"), + Object(Matching, "melee/it/items/it_2F28.c"), Object(Matching, "melee/it/items/it_2F2B.c"), Object(Matching, "melee/it/items/itkirbyyoshispecialn.c"), Object(NonMatching, "melee/it/items/it_27CF.c"), diff --git a/obj_files.mk b/obj_files.mk index c5ab027503..faffe05099 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -732,7 +732,7 @@ TEXT_O_FILES +=\ $(BUILD_DIR)/asm/melee/it/items/itcrazyhandbomb.s.o\ $(BUILD_DIR)/src/melee/it/items/itcoin.c.o\ $(BUILD_DIR)/asm/melee/it/items/itkirby_2F23.s.o\ - $(BUILD_DIR)/asm/melee/it/items/it_2F28.s.o\ + $(BUILD_DIR)/src/melee/it/items/it_2F28.c.o\ $(BUILD_DIR)/src/melee/it/items/it_2F2B.c.o\ $(BUILD_DIR)/src/melee/it/items/itkirbyyoshispecialn.c.o\ $(BUILD_DIR)/asm/melee/it/items/it_27CF.s.o\ diff --git a/src/melee/it/forward.h b/src/melee/it/forward.h index 966a2466bd..baa9080fca 100644 --- a/src/melee/it/forward.h +++ b/src/melee/it/forward.h @@ -5,6 +5,7 @@ typedef struct Article Article; typedef struct BobOmbRain BobOmbRain; +typedef struct BoneDynamicsDesc BoneDynamicsDesc; typedef struct CameraBoxFlags CameraBoxFlags; typedef struct DynamicBoneTable DynamicBoneTable; typedef struct ECB ECB; @@ -14,12 +15,12 @@ typedef struct HSD_ObjAllocUnk2 HSD_ObjAllocUnk2; typedef struct HSD_ObjAllocUnk4 HSD_ObjAllocUnk4; typedef struct HSD_ObjAllocUnk5 HSD_ObjAllocUnk5; typedef struct HSD_ObjAllocUnk6 HSD_ObjAllocUnk6; +typedef struct it_2F28_DatAttrs it_2F28_DatAttrs; typedef struct Item Item; typedef struct Item_DynamicBones Item_DynamicBones; typedef struct ItemAttr ItemAttr; typedef struct ItemCommonData ItemCommonData; typedef struct ItemDynamics ItemDynamics; -typedef struct BoneDynamicsDesc BoneDynamicsDesc; typedef struct ItemModelDesc ItemModelDesc; typedef struct ItemModStruct ItemModStruct; typedef struct ItemStateArray ItemStateArray; diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index 7e9cb4d240..8ed011f0b8 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -393,4 +393,15 @@ typedef struct itTaruCann_DatAttrs { /* +2C */ int x2C; } itTaruCann_DatAttrs; +typedef struct it_2F28_ItemVars { + f32 x0; +} it_2F28_ItemVars; + +struct it_2F28_DatAttrs { + Vec3 pos; + Vec3 vel; + f32 float1; + f32 float2; +}; + #endif diff --git a/src/melee/it/it_2725.h b/src/melee/it/it_2725.h index 7f694c4e21..d3c64bf27c 100644 --- a/src/melee/it/it_2725.h +++ b/src/melee/it/it_2725.h @@ -128,7 +128,7 @@ /* 275788 */ UNK_RET it_80275788(UNK_PARAMS); /* 275820 */ UNK_RET it_80275820(UNK_PARAMS); /* 275870 */ bool it_80275870(Item_GObj* gobj); -/* 2758D4 */ UNK_RET it_802758D4(UNK_PARAMS); +/* 2758D4 */ float it_802758D4(Item_GObj* gobj); /* 2759DC */ UNK_RET it_802759DC(UNK_PARAMS); /* 275BC8 */ UNK_RET it_80275BC8(UNK_PARAMS); /* 275D5C */ void it_80275D5C(Item_GObj*, ECB*); diff --git a/src/melee/it/items/it_2F28.c b/src/melee/it/items/it_2F28.c index 8b13789179..c8769a3c12 100644 --- a/src/melee/it/items/it_2F28.c +++ b/src/melee/it/items/it_2F28.c @@ -1 +1,133 @@ +#include "it/forward.h" +#include "it_2F28.h" + +#include "it/inlines.h" +#include "it/it_266F.h" +#include "it/it_26B1.h" +#include "it/it_2725.h" +#include "it/itCommonItems.h" +#include "it/item.h" +#include "it/items/types.h" +#include "it/types.h" + +#include +#include +#include +#include +#include +#include + +extern float it_802758D4(Item_GObj*); /* extern */ +static void it_802F2A58(Item_GObj*); /* static */ +static bool it_802F2AB0(Item_GObj*); /* static */ +static void it_802F2AE8(HSD_GObj*); /* static */ +// static bool it_802F2BA8(HSD_GObj*); /* static */ +static bool it_802F2BA8(Item_GObj*); /* static */ + +ItemStateTable it_803F9470[] = { + { 0, it_802F2AB0, it_802F2AE8, it_802F2BA8 }, +}; + +void it_802F28C8(Item_GObj* item_gobj, int arg1, float arg2) +{ + Item* item; + + item = item_gobj->user_data; + it_8027B4A4((Fighter_GObj*) item->grab_victim, item_gobj); + it_8027B378((Fighter_GObj*) item->grab_victim, item_gobj, arg2); + if (arg1 != 0) { + item->destroy_type = 0; + } + item->atk_victim = NULL; + item->grab_victim = NULL; + it_8027CE44(item_gobj); + Item_8026A8EC(item_gobj); +} + +float it_802F295C(HSD_GObj* owner_gobj, it_2F28_DatAttrs* attr) +{ + SpawnItem spawn; + + Item_GObj* item_gobj; + Item* item; + float var_f31; + PAD_STACK(4); + + var_f31 = 0.0f; + spawn.kind = It_Kind_Unk2; + spawn.prev_pos = attr->pos; + spawn.prev_pos.z = 0.0f; + spawn.pos = spawn.prev_pos; + spawn.facing_dir = -1.0f; + spawn.x3C_damage = 0; + spawn.vel = attr->vel; + spawn.x0_parent_gobj = owner_gobj; + spawn.x4_parent_gobj2 = owner_gobj; + spawn.x44_flag.b0 = 1; + spawn.x40 = 0; + item_gobj = Item_80268B18(&spawn); + + if (item_gobj != NULL) { + item = item_gobj->user_data; + item->xDD4_itemVar.it_2F28.x0 = attr->float2; + it_80275158((HSD_GObj*) item_gobj, attr->float1); + it_802F2A58(item_gobj); + var_f31 = it_802758D4(item_gobj); + } + return var_f31; +} + +void it_802F2A58(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + it_8026B3A8(item_gobj); + Item_80268E5C((HSD_GObj*) item_gobj, 0, ITEM_ANIM_UPDATE); + item->xDCE_flag.b7 = 0; +} + +bool it_802F2AB0(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xD44_lifeTimer = (item->xD44_lifeTimer - 1.0f); + if (item->xD44_lifeTimer <= 0.0f) { + return true; + } + return false; +} + +void it_802F2AE8(HSD_GObj* item_gobj) +{ + Item* item = GET_ITEM(item_gobj); + f32 var_f4 = sqrtf(SQ(item->x40_vel.x) + SQ(item->x40_vel.y)); + if (var_f4 > item->xDD4_itemVar.it_2F28.x0) { + item->x40_vel.x = + (item->x40_vel.x * (var_f4 - item->xDD4_itemVar.it_2F28.x0)) / + var_f4; + item->x40_vel.y = + (item->x40_vel.y * (var_f4 - item->xDD4_itemVar.it_2F28.x0)) / + var_f4; + } else { + item->x40_vel.x = 0.0f; + } + return; +} + +bool it_802F2BA8(Item_GObj* item_gobj) +// bool it_802F2BA8(HSD_GObj* item_gobj) +{ + if (it_8026DFB0(item_gobj) != 0) { + // if (it_8026DFB0((Item_GObj*) item_gobj) != 0) { + return true; + } + return false; +} + +void it_802F2BDC(Item_GObj* item_gobj, HSD_GObj* ref_gobj) +{ + it_8026B894(item_gobj, ref_gobj); +} diff --git a/src/melee/it/items/it_2F28.h b/src/melee/it/items/it_2F28.h index eb6d4d14e1..081d395a74 100644 --- a/src/melee/it/items/it_2F28.h +++ b/src/melee/it/items/it_2F28.h @@ -6,7 +6,8 @@ #include "it/items/types.h" /* 2F28C8 */ void it_802F28C8(Item_GObj*, int, float); -/* 2F2BDC */ void it_802F2BDC(Item_GObj*, Item_GObj*); +/* 2F295C */ float it_802F295C(HSD_GObj* owner_gobj, it_2F28_DatAttrs* attr); +/* 2F2BDC */ void it_802F2BDC(Item_GObj*, HSD_GObj*); /* 3F9470 */ extern ItemStateTable it_803F9470[]; #endif diff --git a/src/melee/it/types.h b/src/melee/it/types.h index e1132de1de..596e122672 100644 --- a/src/melee/it/types.h +++ b/src/melee/it/types.h @@ -543,6 +543,7 @@ struct Item { UnkFlagStruct xDD3_flag; union { it_266F_ItemVars it_266F; + it_2F28_ItemVars it_2F28; itBombHei_ItemVars bombhei; itCapsule_ItemVars capsule; itCoin_ItemVars coin;