From 2784bbebf6ddfdb37aa14f97280c6f91bda23834 Mon Sep 17 00:00:00 2001 From: Aaron B Date: Mon, 30 Sep 2024 15:53:34 -0400 Subject: [PATCH 01/25] it_2F28 match --- src/melee/it/itCommonItems.h | 10 +++ src/melee/it/it_2725.h | 2 +- src/melee/it/items/it_2F28.c | 132 +++++++++++++++++++++++++++++++++++ src/melee/it/items/it_2F28.h | 2 +- src/melee/it/types.h | 1 + 5 files changed, 145 insertions(+), 2 deletions(-) diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index 7e9cb4d240..b75ab1c6be 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -393,4 +393,14 @@ typedef struct itTaruCann_DatAttrs { /* +2C */ int x2C; } itTaruCann_DatAttrs; +typedef struct it_2F28_ItemVars { + f32 x0; +} it_2F28_ItemVars; +typedef struct it_2F28_DatAttrs { + Vec3 pos; + Vec3 vel; + f32 float1; + f32 float2; +} it_2F28_DatAttrs; + #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..17edee90c5 100644 --- a/src/melee/it/items/it_2F28.h +++ b/src/melee/it/items/it_2F28.h @@ -6,7 +6,7 @@ #include "it/items/types.h" /* 2F28C8 */ void it_802F28C8(Item_GObj*, int, float); -/* 2F2BDC */ void it_802F2BDC(Item_GObj*, Item_GObj*); +/* 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; From d06b8a4a433042013d59319cd89efe1720cc3a7f Mon Sep 17 00:00:00 2001 From: Robin Avery Date: Mon, 30 Sep 2024 16:02:51 -0400 Subject: [PATCH 02/25] Link `it_2F28` --- 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 | 5 +- src/melee/it/items/it_2F28.h | 1 + 6 files changed, 8 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 b75ab1c6be..8ed011f0b8 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -396,11 +396,12 @@ typedef struct itTaruCann_DatAttrs { typedef struct it_2F28_ItemVars { f32 x0; } it_2F28_ItemVars; -typedef struct it_2F28_DatAttrs { + +struct it_2F28_DatAttrs { Vec3 pos; Vec3 vel; f32 float1; f32 float2; -} it_2F28_DatAttrs; +}; #endif diff --git a/src/melee/it/items/it_2F28.h b/src/melee/it/items/it_2F28.h index 17edee90c5..081d395a74 100644 --- a/src/melee/it/items/it_2F28.h +++ b/src/melee/it/items/it_2F28.h @@ -6,6 +6,7 @@ #include "it/items/types.h" /* 2F28C8 */ void it_802F28C8(Item_GObj*, int, float); +/* 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[]; From 0d543e8a80557aeccbf8fab11ebe8152dd1bb67c Mon Sep 17 00:00:00 2001 From: Aaron B Date: Wed, 2 Oct 2024 11:51:22 -0400 Subject: [PATCH 03/25] it_27CF work --- src/melee/it/itCommonItems.h | 19 ++- src/melee/it/items/it_27CF.c | 244 +++++++++++++++++++++++++++++++++-- src/melee/it/items/it_27CF.h | 25 ++-- src/melee/it/types.h | 3 +- 4 files changed, 263 insertions(+), 28 deletions(-) diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index 8ed011f0b8..27bad8c54d 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -400,8 +400,23 @@ typedef struct it_2F28_ItemVars { struct it_2F28_DatAttrs { Vec3 pos; Vec3 vel; - f32 float1; - f32 float2; + f32 float1; // lifetime + f32 float2; // item var x0 }; +// Should it_2F28 and it_27CF use the same structs? +typedef struct it_27CF_ItemVars { + f32 x0; +} it_27CF_ItemVars; + +typedef struct it_27CF_DatAttrs { + Vec3 pos; + Vec3 vel; + f32 float1; // lifetime + f32 float2; + f32 float3; // item var x0 + f32 x24; // item->xC98 + int x28; // ItemKind +} it_27CF_DatAttrs; + #endif diff --git a/src/melee/it/items/it_27CF.c b/src/melee/it/items/it_27CF.c index 6f05932d0d..ffe3cc6a7c 100644 --- a/src/melee/it/items/it_27CF.c +++ b/src/melee/it/items/it_27CF.c @@ -1,25 +1,243 @@ -/// #it_802F2F34 +#include "it/forward.h" -/// #it_802F3020 +#include "it_27CF.h" -/// #it_802F3078 +#include "ef/efasync.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" -/// #it_802F3120 +#include +#include +#include +#include -/// #it_802F3150 +ItemStateTable it_803F94A0[] = { + { -1, it_802F31B8, it_802F3260, it_802F3264 }, + { -1, it_802F3078, it_802F3120, it_802F3150 }, + { -1, it_802F32F8, NULL, NULL }, +}; -/// #it_802F317C +void it_802F2F34(it_27CF_DatAttrs* attr) +{ + Item* item; + Item_GObj* item_gobj; + SpawnItem spawn; + PAD_STACK(8); -/// #it_802F31B8 + spawn.kind = attr->x28; + spawn.prev_pos = attr->pos; + spawn.prev_pos.z = 0.0f; + spawn.pos = spawn.prev_pos; + spawn.facing_dir = attr->float2; + spawn.x3C_damage = 0; + spawn.vel = attr->vel; + spawn.x0_parent_gobj = 0; + spawn.x4_parent_gobj2 = 0; + 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_27CF.x0 = attr->float3; + item->xC98 = attr->x24; + it_80275158(item_gobj, attr->float1); + // it_802F3020(item_gobj); + it_802F3020((HSD_GObj*) item_gobj); + } +} -void it_802F3260(void) {} +// void it_802F3020(Item_GObj* item_gobj) { +void it_802F3020(HSD_GObj* item_gobj) +{ + Item* item; -/// #it_802F3264 + item = item_gobj->user_data; + it_8026B3A8((Item_GObj*) item_gobj); + Item_80268E5C((HSD_GObj*) item_gobj, 1, ITEM_ANIM_UPDATE); + item->xDCE_flag.b7 = 0; +} -/// #it_802F3290 +#if 0 +inline bool inline1(HSD_GObj* item_gobj) { + Item* item; + f32 sp1C; + HSD_JObj* item_jobj; + // PAD_STACK(10); -/// #it_802F32F8 + item = item_gobj->user_data; + item->xD44_lifeTimer -= 1.0f; + if (item->xD44_lifeTimer <= 0.0f) { + item = item_gobj->user_data; + item_jobj = item_gobj->hsd_obj; + sp1C = 1.0f; + Item_8026AE84(item, 280088, 127, 64); + efAsync_Spawn(item_gobj, &item->xBC0, 4U, 1231, item_gobj->hsd_obj, &sp1C); + it_802F3290((Item_GObj*) item_gobj); + } + return false; +} -/// #it_802F3330 +bool it_802F3078(HSD_GObj* item_gobj) { + PAD_STACK(8); + return inline1(item_gobj); +} -/// #it_802F3374 +// void it_802F3120(Item_GObj* item_gobj) { +void it_802F3120(HSD_GObj* item_gobj) { + ItemAttr* attr; + + attr = ((Item*) item_gobj->user_data)->xCC_item_attr; + it_80272860((Item_GObj*) item_gobj, attr->x10_fall_speed, attr->x14_fall_speed_max); +} + +// bool it_802F3150(Item_GObj* item_gobj) { +bool it_802F3150(HSD_GObj* item_gobj) { + it_8026E15C((Item_GObj*) item_gobj, it_802F317C); + return false; +} + +// void it_802F317C(Item_GObj* gobj) { +void it_802F317C(HSD_GObj* item_gobj) { + Item* item; + + item = item_gobj->user_data; + item->x40_vel.x = item->x40_vel.y = item->x40_vel.z = 0.0f; + Item_80268E5C(item_gobj, 0, ITEM_ANIM_UPDATE); +} + +bool it_802F31B8(HSD_GObj* item_gobj) { + PAD_STACK(8); + return inline1(item_gobj); +} + +#else +// bool it_802F3078(Item_GObj* item_gobj) { +bool it_802F3078(HSD_GObj* item_gobj) +{ + Item* item; + f32 sp1C; + HSD_JObj* item_jobj; + PAD_STACK(10); + + item = item_gobj->user_data; + item->xD44_lifeTimer -= 1.0f; + if (item->xD44_lifeTimer <= 0.0f) { + item = item_gobj->user_data; + item_jobj = item_gobj->hsd_obj; + sp1C = 1.0f; + Item_8026AE84(item, 280088, 127, 64); + efAsync_Spawn(item_gobj, &item->xBC0, 4U, 1231, item_gobj->hsd_obj, + &sp1C); + it_802F3290((Item_GObj*) item_gobj); + } + return false; +} + +// void it_802F3120(Item_GObj* item_gobj) { +void it_802F3120(HSD_GObj* item_gobj) +{ + ItemAttr* attr; + + attr = ((Item*) item_gobj->user_data)->xCC_item_attr; + it_80272860((Item_GObj*) item_gobj, attr->x10_fall_speed, + attr->x14_fall_speed_max); +} + +// bool it_802F3150(Item_GObj* item_gobj) { +bool it_802F3150(HSD_GObj* item_gobj) +{ + it_8026E15C((Item_GObj*) item_gobj, it_802F317C); + return false; +} + +// void it_802F317C(Item_GObj* gobj) { +void it_802F317C(HSD_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->x40_vel.x = item->x40_vel.y = item->x40_vel.z = 0.0f; + Item_80268E5C(item_gobj, 0, ITEM_ANIM_UPDATE); +} + +// bool it_802F31B8(Item_GObj* item_gobj) { +bool it_802F31B8(HSD_GObj* item_gobj) +{ + Item* item; + f32 sp1C; + HSD_JObj* item_jobj; + PAD_STACK(10); + + item = item_gobj->user_data; + item->xD44_lifeTimer -= 1.0f; + if (item->xD44_lifeTimer <= 0.0f) { + item = item_gobj->user_data; + item_jobj = item_gobj->hsd_obj; + sp1C = 1.0f; + Item_8026AE84(item, 280088, 127, 64); + efAsync_Spawn(item_gobj, &item->xBC0, 4U, 1231, item_gobj->hsd_obj, + &sp1C); + it_802F3290((Item_GObj*) item_gobj); + } + return false; +} +#endif + +// void it_802F3260(Item_GObj* item_gobj) { +void it_802F3260(HSD_GObj* item_gobj) {} + +// bool it_802F3264(Item_GObj* item_gobj) { +bool it_802F3264(HSD_GObj* item_gobj) +{ + it_8026D62C((Item_GObj*) item_gobj, it_802F3020); + return false; +} + +void it_802F3290(Item_GObj* item_gobj) +{ + HSD_JObj* item_jobj; + Item* item; + PAD_STACK(8); + + item_jobj = item_gobj->hsd_obj; + item = item_gobj->user_data; + item->x40_vel.x = item->x40_vel.y = item->x40_vel.z = 0.0f; + item->xD44_lifeTimer = 40.0f; + HSD_JObjSetFlagsAll(item_jobj, 0x10U); + it_802756D0(item_gobj); + Item_80268E5C((HSD_GObj*) item_gobj, 2, ITEM_ANIM_UPDATE); +} + +// bool it_802F32F8(Item_GObj* item_gobj) { +bool it_802F32F8(HSD_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xD44_lifeTimer -= 1.0f; + if (item->xD44_lifeTimer <= 0.0f) { + return true; + } + return false; +} + +bool it_802F3330(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + // item->xD44_lifeTimer = -((item->xCA0 * item->xDD4_itemVar.it_27CF.x0) - + // item->xD44_lifeTimer); + item->xD44_lifeTimer -= item->xCA0 * item->xDD4_itemVar.it_27CF.x0; + return false; +} + +void it_802F3374(Item_GObj* item_gobj, HSD_GObj* ref_gobj) +{ + it_8026B894(item_gobj, ref_gobj); +} diff --git a/src/melee/it/items/it_27CF.h b/src/melee/it/items/it_27CF.h index 25eafde50e..705998256c 100644 --- a/src/melee/it/items/it_27CF.h +++ b/src/melee/it/items/it_27CF.h @@ -9,6 +9,7 @@ #include #include "ftSeak/types.h" +#include "it/itCommonItems.h" #include "it/items/types.h" /* 283AE4 */ Item_GObj* it_80283AE4(Item_GObj*, Vec3*, s32); @@ -78,19 +79,19 @@ /* 2C7AD0 */ void it_802C7AD0(Item_GObj*); /* 2C7AF0 */ void it_802C7AF0(Item_GObj*); /* 2F2094 */ Item_GObj* it_802F2094(int, Vec3*, int, int); -/* 2F2F34 */ UNK_RET it_802F2F34(UNK_PARAMS); -/* 2F3020 */ UNK_RET it_802F3020(UNK_PARAMS); -/* 2F3078 */ UNK_RET it_802F3078(UNK_PARAMS); -/* 2F3120 */ UNK_RET it_802F3120(UNK_PARAMS); -/* 2F3150 */ UNK_RET it_802F3150(UNK_PARAMS); -/* 2F317C */ UNK_RET it_802F317C(UNK_PARAMS); -/* 2F31B8 */ UNK_RET it_802F31B8(UNK_PARAMS); -/* 2F3260 */ UNK_RET it_802F3260(UNK_PARAMS); -/* 2F3264 */ UNK_RET it_802F3264(UNK_PARAMS); -/* 2F3290 */ UNK_RET it_802F3290(UNK_PARAMS); -/* 2F32F8 */ UNK_RET it_802F32F8(UNK_PARAMS); +/* 2F2F34 */ void it_802F2F34(it_27CF_DatAttrs*); +/* 2F3020 */ void it_802F3020(HSD_GObj*); +/* 2F3078 */ bool it_802F3078(HSD_GObj*); +/* 2F3120 */ void it_802F3120(HSD_GObj*); +/* 2F3150 */ bool it_802F3150(HSD_GObj*); +/* 2F317C */ void it_802F317C(HSD_GObj*); +/* 2F31B8 */ bool it_802F31B8(HSD_GObj*); +/* 2F3260 */ void it_802F3260(HSD_GObj*); +/* 2F3264 */ bool it_802F3264(HSD_GObj*); +/* 2F3290 */ void it_802F3290(Item_GObj*); +/* 2F32F8 */ bool it_802F32F8(HSD_GObj*); /* 2F3330 */ bool it_802F3330(Item_GObj*); -/* 2F3374 */ void it_802F3374(Item_GObj*, Item_GObj*); +/* 2F3374 */ void it_802F3374(Item_GObj*, HSD_GObj*); /* 3F94A0 */ extern ItemStateTable it_803F94A0[]; #endif diff --git a/src/melee/it/types.h b/src/melee/it/types.h index 596e122672..9707fe2474 100644 --- a/src/melee/it/types.h +++ b/src/melee/it/types.h @@ -378,7 +378,7 @@ struct Item { u16 xC8C; // 0xc8c HSD_GObj* xC90_absorbGObj; // 0xc90 s32 xC94; // 0xc94 - s32 xC98; // 0xc98 + f32 xC98; // 0xc98 s32 xC9C; // Total damage taken? s32 xCA0; // Last amount of damage taken? s32 xCA4; // 0xca4 @@ -543,6 +543,7 @@ struct Item { UnkFlagStruct xDD3_flag; union { it_266F_ItemVars it_266F; + it_27CF_ItemVars it_27CF; it_2F28_ItemVars it_2F28; itBombHei_ItemVars bombhei; itCapsule_ItemVars capsule; From 6288908ff84be8c72b24e06495e88607bef82255 Mon Sep 17 00:00:00 2001 From: Aaron B Date: Wed, 2 Oct 2024 11:51:30 -0400 Subject: [PATCH 04/25] formatting --- src/melee/it/itCommonItems.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index 27bad8c54d..c27e9debea 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -415,8 +415,8 @@ typedef struct it_27CF_DatAttrs { f32 float1; // lifetime f32 float2; f32 float3; // item var x0 - f32 x24; // item->xC98 - int x28; // ItemKind + f32 x24; // item->xC98 + int x28; // ItemKind } it_27CF_DatAttrs; #endif From e86532315104bb12039bdbcd2753db9f2f14db8f Mon Sep 17 00:00:00 2001 From: Aaron B Date: Wed, 2 Oct 2024 19:52:14 -0400 Subject: [PATCH 05/25] Fixing func params --- src/melee/it/items/it_27CF.c | 76 ++++++++++++++---------------------- src/melee/it/items/it_27CF.h | 2 +- 2 files changed, 31 insertions(+), 47 deletions(-) diff --git a/src/melee/it/items/it_27CF.c b/src/melee/it/items/it_27CF.c index ffe3cc6a7c..03534d6c10 100644 --- a/src/melee/it/items/it_27CF.c +++ b/src/melee/it/items/it_27CF.c @@ -3,6 +3,7 @@ #include "it_27CF.h" #include "ef/efasync.h" +#include "it/inlines.h" #include "it/it_266F.h" #include "it/it_26B1.h" #include "it/it_2725.h" @@ -22,12 +23,10 @@ ItemStateTable it_803F94A0[] = { { -1, it_802F32F8, NULL, NULL }, }; -void it_802F2F34(it_27CF_DatAttrs* attr) -{ +void it_802F2F34(HSD_GObj* gobj, it_27CF_DatAttrs* attr) { Item* item; Item_GObj* item_gobj; SpawnItem spawn; - PAD_STACK(8); spawn.kind = attr->x28; spawn.prev_pos = attr->pos; @@ -42,7 +41,7 @@ void it_802F2F34(it_27CF_DatAttrs* attr) spawn.x40 = 0; item_gobj = Item_80268B18(&spawn); if (item_gobj != NULL) { - item = item_gobj->user_data; + item = GET_ITEM((HSD_GObj*) item_gobj); item->xDD4_itemVar.it_27CF.x0 = attr->float3; item->xC98 = attr->x24; it_80275158(item_gobj, attr->float1); @@ -52,13 +51,12 @@ void it_802F2F34(it_27CF_DatAttrs* attr) } // void it_802F3020(Item_GObj* item_gobj) { -void it_802F3020(HSD_GObj* item_gobj) -{ +void it_802F3020(HSD_GObj* item_gobj) { Item* item; - item = item_gobj->user_data; + item = GET_ITEM(item_gobj); it_8026B3A8((Item_GObj*) item_gobj); - Item_80268E5C((HSD_GObj*) item_gobj, 1, ITEM_ANIM_UPDATE); + Item_80268E5C((HSD_GObj* ) item_gobj, 1, ITEM_ANIM_UPDATE); item->xDCE_flag.b7 = 0; } @@ -67,9 +65,8 @@ inline bool inline1(HSD_GObj* item_gobj) { Item* item; f32 sp1C; HSD_JObj* item_jobj; - // PAD_STACK(10); - item = item_gobj->user_data; + item = GET_ITEM(item_gobj); item->xD44_lifeTimer -= 1.0f; if (item->xD44_lifeTimer <= 0.0f) { item = item_gobj->user_data; @@ -117,8 +114,7 @@ bool it_802F31B8(HSD_GObj* item_gobj) { #else // bool it_802F3078(Item_GObj* item_gobj) { -bool it_802F3078(HSD_GObj* item_gobj) -{ +bool it_802F3078(HSD_GObj* item_gobj) { Item* item; f32 sp1C; HSD_JObj* item_jobj; @@ -131,33 +127,28 @@ bool it_802F3078(HSD_GObj* item_gobj) item_jobj = item_gobj->hsd_obj; sp1C = 1.0f; Item_8026AE84(item, 280088, 127, 64); - efAsync_Spawn(item_gobj, &item->xBC0, 4U, 1231, item_gobj->hsd_obj, - &sp1C); + efAsync_Spawn(item_gobj, &item->xBC0, 4U, 1231, item_gobj->hsd_obj, &sp1C); it_802F3290((Item_GObj*) item_gobj); } return false; } // void it_802F3120(Item_GObj* item_gobj) { -void it_802F3120(HSD_GObj* item_gobj) -{ +void it_802F3120(HSD_GObj* item_gobj) { ItemAttr* attr; attr = ((Item*) item_gobj->user_data)->xCC_item_attr; - it_80272860((Item_GObj*) item_gobj, attr->x10_fall_speed, - attr->x14_fall_speed_max); + it_80272860((Item_GObj*) item_gobj, attr->x10_fall_speed, attr->x14_fall_speed_max); } // bool it_802F3150(Item_GObj* item_gobj) { -bool it_802F3150(HSD_GObj* item_gobj) -{ +bool it_802F3150(HSD_GObj* item_gobj) { it_8026E15C((Item_GObj*) item_gobj, it_802F317C); return false; } // void it_802F317C(Item_GObj* gobj) { -void it_802F317C(HSD_GObj* item_gobj) -{ +void it_802F317C(HSD_GObj* item_gobj) { Item* item; item = item_gobj->user_data; @@ -166,8 +157,7 @@ void it_802F317C(HSD_GObj* item_gobj) } // bool it_802F31B8(Item_GObj* item_gobj) { -bool it_802F31B8(HSD_GObj* item_gobj) -{ +bool it_802F31B8(HSD_GObj* item_gobj) { Item* item; f32 sp1C; HSD_JObj* item_jobj; @@ -180,8 +170,7 @@ bool it_802F31B8(HSD_GObj* item_gobj) item_jobj = item_gobj->hsd_obj; sp1C = 1.0f; Item_8026AE84(item, 280088, 127, 64); - efAsync_Spawn(item_gobj, &item->xBC0, 4U, 1231, item_gobj->hsd_obj, - &sp1C); + efAsync_Spawn(item_gobj, &item->xBC0, 4U, 1231, item_gobj->hsd_obj, &sp1C); it_802F3290((Item_GObj*) item_gobj); } return false; @@ -189,36 +178,34 @@ bool it_802F31B8(HSD_GObj* item_gobj) #endif // void it_802F3260(Item_GObj* item_gobj) { -void it_802F3260(HSD_GObj* item_gobj) {} +void it_802F3260(HSD_GObj* item_gobj) { + return; +} // bool it_802F3264(Item_GObj* item_gobj) { -bool it_802F3264(HSD_GObj* item_gobj) -{ +bool it_802F3264(HSD_GObj* item_gobj) { it_8026D62C((Item_GObj*) item_gobj, it_802F3020); return false; } -void it_802F3290(Item_GObj* item_gobj) -{ +void it_802F3290(Item_GObj* item_gobj) { HSD_JObj* item_jobj; Item* item; - PAD_STACK(8); - item_jobj = item_gobj->hsd_obj; - item = item_gobj->user_data; + item_jobj = GET_JOBJ((HSD_GObj*) item_gobj); + item = GET_ITEM((HSD_GObj*) item_gobj); item->x40_vel.x = item->x40_vel.y = item->x40_vel.z = 0.0f; item->xD44_lifeTimer = 40.0f; HSD_JObjSetFlagsAll(item_jobj, 0x10U); it_802756D0(item_gobj); - Item_80268E5C((HSD_GObj*) item_gobj, 2, ITEM_ANIM_UPDATE); + Item_80268E5C((HSD_GObj* ) item_gobj, 2, ITEM_ANIM_UPDATE); } // bool it_802F32F8(Item_GObj* item_gobj) { -bool it_802F32F8(HSD_GObj* item_gobj) -{ +bool it_802F32F8(HSD_GObj* item_gobj) { Item* item; - item = item_gobj->user_data; + item = GET_ITEM(item_gobj); item->xD44_lifeTimer -= 1.0f; if (item->xD44_lifeTimer <= 0.0f) { return true; @@ -226,18 +213,15 @@ bool it_802F32F8(HSD_GObj* item_gobj) return false; } -bool it_802F3330(Item_GObj* item_gobj) -{ +bool it_802F3330(Item_GObj* item_gobj) { Item* item; - item = item_gobj->user_data; - // item->xD44_lifeTimer = -((item->xCA0 * item->xDD4_itemVar.it_27CF.x0) - - // item->xD44_lifeTimer); + item = GET_ITEM((HSD_GObj*) item_gobj); + // item->xD44_lifeTimer = -((item->xCA0 * item->xDD4_itemVar.it_27CF.x0) - item->xD44_lifeTimer); item->xD44_lifeTimer -= item->xCA0 * item->xDD4_itemVar.it_27CF.x0; return false; } -void it_802F3374(Item_GObj* item_gobj, HSD_GObj* ref_gobj) -{ +void it_802F3374(Item_GObj* item_gobj, HSD_GObj* ref_gobj) { it_8026B894(item_gobj, ref_gobj); -} +} \ No newline at end of file diff --git a/src/melee/it/items/it_27CF.h b/src/melee/it/items/it_27CF.h index 705998256c..4bdc460fee 100644 --- a/src/melee/it/items/it_27CF.h +++ b/src/melee/it/items/it_27CF.h @@ -79,7 +79,7 @@ /* 2C7AD0 */ void it_802C7AD0(Item_GObj*); /* 2C7AF0 */ void it_802C7AF0(Item_GObj*); /* 2F2094 */ Item_GObj* it_802F2094(int, Vec3*, int, int); -/* 2F2F34 */ void it_802F2F34(it_27CF_DatAttrs*); +/* 2F2F34 */ void it_802F2F34(HSD_GObj*, it_27CF_DatAttrs*); /* 2F3020 */ void it_802F3020(HSD_GObj*); /* 2F3078 */ bool it_802F3078(HSD_GObj*); /* 2F3120 */ void it_802F3120(HSD_GObj*); From 3c121b7bdeb2f3220abaa0d47f845395b4e1d4c2 Mon Sep 17 00:00:00 2001 From: Aaron B Date: Wed, 2 Oct 2024 19:52:31 -0400 Subject: [PATCH 06/25] formatting --- src/melee/it/items/it_27CF.c | 55 +++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/src/melee/it/items/it_27CF.c b/src/melee/it/items/it_27CF.c index 03534d6c10..051620e6c1 100644 --- a/src/melee/it/items/it_27CF.c +++ b/src/melee/it/items/it_27CF.c @@ -23,7 +23,8 @@ ItemStateTable it_803F94A0[] = { { -1, it_802F32F8, NULL, NULL }, }; -void it_802F2F34(HSD_GObj* gobj, it_27CF_DatAttrs* attr) { +void it_802F2F34(HSD_GObj* gobj, it_27CF_DatAttrs* attr) +{ Item* item; Item_GObj* item_gobj; SpawnItem spawn; @@ -51,12 +52,13 @@ void it_802F2F34(HSD_GObj* gobj, it_27CF_DatAttrs* attr) { } // void it_802F3020(Item_GObj* item_gobj) { -void it_802F3020(HSD_GObj* item_gobj) { +void it_802F3020(HSD_GObj* item_gobj) +{ Item* item; item = GET_ITEM(item_gobj); it_8026B3A8((Item_GObj*) item_gobj); - Item_80268E5C((HSD_GObj* ) item_gobj, 1, ITEM_ANIM_UPDATE); + Item_80268E5C((HSD_GObj*) item_gobj, 1, ITEM_ANIM_UPDATE); item->xDCE_flag.b7 = 0; } @@ -114,7 +116,8 @@ bool it_802F31B8(HSD_GObj* item_gobj) { #else // bool it_802F3078(Item_GObj* item_gobj) { -bool it_802F3078(HSD_GObj* item_gobj) { +bool it_802F3078(HSD_GObj* item_gobj) +{ Item* item; f32 sp1C; HSD_JObj* item_jobj; @@ -127,28 +130,33 @@ bool it_802F3078(HSD_GObj* item_gobj) { item_jobj = item_gobj->hsd_obj; sp1C = 1.0f; Item_8026AE84(item, 280088, 127, 64); - efAsync_Spawn(item_gobj, &item->xBC0, 4U, 1231, item_gobj->hsd_obj, &sp1C); + efAsync_Spawn(item_gobj, &item->xBC0, 4U, 1231, item_gobj->hsd_obj, + &sp1C); it_802F3290((Item_GObj*) item_gobj); } return false; } // void it_802F3120(Item_GObj* item_gobj) { -void it_802F3120(HSD_GObj* item_gobj) { +void it_802F3120(HSD_GObj* item_gobj) +{ ItemAttr* attr; attr = ((Item*) item_gobj->user_data)->xCC_item_attr; - it_80272860((Item_GObj*) item_gobj, attr->x10_fall_speed, attr->x14_fall_speed_max); + it_80272860((Item_GObj*) item_gobj, attr->x10_fall_speed, + attr->x14_fall_speed_max); } // bool it_802F3150(Item_GObj* item_gobj) { -bool it_802F3150(HSD_GObj* item_gobj) { +bool it_802F3150(HSD_GObj* item_gobj) +{ it_8026E15C((Item_GObj*) item_gobj, it_802F317C); return false; } // void it_802F317C(Item_GObj* gobj) { -void it_802F317C(HSD_GObj* item_gobj) { +void it_802F317C(HSD_GObj* item_gobj) +{ Item* item; item = item_gobj->user_data; @@ -157,7 +165,8 @@ void it_802F317C(HSD_GObj* item_gobj) { } // bool it_802F31B8(Item_GObj* item_gobj) { -bool it_802F31B8(HSD_GObj* item_gobj) { +bool it_802F31B8(HSD_GObj* item_gobj) +{ Item* item; f32 sp1C; HSD_JObj* item_jobj; @@ -170,7 +179,8 @@ bool it_802F31B8(HSD_GObj* item_gobj) { item_jobj = item_gobj->hsd_obj; sp1C = 1.0f; Item_8026AE84(item, 280088, 127, 64); - efAsync_Spawn(item_gobj, &item->xBC0, 4U, 1231, item_gobj->hsd_obj, &sp1C); + efAsync_Spawn(item_gobj, &item->xBC0, 4U, 1231, item_gobj->hsd_obj, + &sp1C); it_802F3290((Item_GObj*) item_gobj); } return false; @@ -178,17 +188,20 @@ bool it_802F31B8(HSD_GObj* item_gobj) { #endif // void it_802F3260(Item_GObj* item_gobj) { -void it_802F3260(HSD_GObj* item_gobj) { +void it_802F3260(HSD_GObj* item_gobj) +{ return; } // bool it_802F3264(Item_GObj* item_gobj) { -bool it_802F3264(HSD_GObj* item_gobj) { +bool it_802F3264(HSD_GObj* item_gobj) +{ it_8026D62C((Item_GObj*) item_gobj, it_802F3020); return false; } -void it_802F3290(Item_GObj* item_gobj) { +void it_802F3290(Item_GObj* item_gobj) +{ HSD_JObj* item_jobj; Item* item; @@ -198,11 +211,12 @@ void it_802F3290(Item_GObj* item_gobj) { item->xD44_lifeTimer = 40.0f; HSD_JObjSetFlagsAll(item_jobj, 0x10U); it_802756D0(item_gobj); - Item_80268E5C((HSD_GObj* ) item_gobj, 2, ITEM_ANIM_UPDATE); + Item_80268E5C((HSD_GObj*) item_gobj, 2, ITEM_ANIM_UPDATE); } // bool it_802F32F8(Item_GObj* item_gobj) { -bool it_802F32F8(HSD_GObj* item_gobj) { +bool it_802F32F8(HSD_GObj* item_gobj) +{ Item* item; item = GET_ITEM(item_gobj); @@ -213,15 +227,18 @@ bool it_802F32F8(HSD_GObj* item_gobj) { return false; } -bool it_802F3330(Item_GObj* item_gobj) { +bool it_802F3330(Item_GObj* item_gobj) +{ Item* item; item = GET_ITEM((HSD_GObj*) item_gobj); - // item->xD44_lifeTimer = -((item->xCA0 * item->xDD4_itemVar.it_27CF.x0) - item->xD44_lifeTimer); + // item->xD44_lifeTimer = -((item->xCA0 * item->xDD4_itemVar.it_27CF.x0) - + // item->xD44_lifeTimer); item->xD44_lifeTimer -= item->xCA0 * item->xDD4_itemVar.it_27CF.x0; return false; } -void it_802F3374(Item_GObj* item_gobj, HSD_GObj* ref_gobj) { +void it_802F3374(Item_GObj* item_gobj, HSD_GObj* ref_gobj) +{ it_8026B894(item_gobj, ref_gobj); } \ No newline at end of file From 12ce95bb506bd40b073f5870850e682d134b9947 Mon Sep 17 00:00:00 2001 From: Aaron B Date: Wed, 2 Oct 2024 22:14:13 -0400 Subject: [PATCH 07/25] it_2E6A work --- src/melee/it/itCommonItems.h | 45 +++++-- src/melee/it/items/it_2E6A.c | 249 +++++++++++++++++++++++++++++++++++ src/melee/it/items/it_2E6A.h | 7 +- src/melee/it/types.h | 2 + 4 files changed, 290 insertions(+), 13 deletions(-) diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index c27e9debea..1b28266ba8 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -393,17 +393,6 @@ 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; // lifetime - f32 float2; // item var x0 -}; - // Should it_2F28 and it_27CF use the same structs? typedef struct it_27CF_ItemVars { f32 x0; @@ -419,4 +408,38 @@ typedef struct it_27CF_DatAttrs { int x28; // ItemKind } it_27CF_DatAttrs; +// Not sure if there is a way to combine these two structs? +typedef struct it_2E6A_ItemVars_1 { + /* +0 ip+DD4 */ s16 x0; + /* +0 ip+DD4 */ s16 x2; + /* +4 ip+DD8 */ HSD_JObj* x4; + /* +8 ip+DDC */ f32 x8; // unused? + /* +C ip+DE0 */ f32 xC; // unused? + /* +10 ip+DE4 */ void* x10; + /* +14 ip+DE8 */ void* x14; + /* +18 ip+DEC */ void* x18; + /* +1C ip+DF0 */ void* x1C; +} it_2E6A_ItemVars_1; + +typedef struct it_2E6A_ItemVars_2 { + /* +0 ip+DD4 */ s16 x0; + /* +0 ip+DD4 */ u16 x2; + /* +4 ip+DD8 */ Vec3 x4; + /* +10 ip+DE4 */ void* x10; + /* +14 ip+DE8 */ void* x14; + /* +18 ip+DEC */ void* x18; + /* +1C ip+DF0 */ void* x1C; +} it_2E6A_ItemVars_2; + +typedef struct it_2F28_ItemVars { + f32 x0; +} it_2F28_ItemVars; + +struct it_2F28_DatAttrs { + Vec3 pos; + Vec3 vel; + f32 float1; // lifetime + f32 float2; // item var x0 +}; + #endif diff --git a/src/melee/it/items/it_2E6A.c b/src/melee/it/items/it_2E6A.c index 8b13789179..90bf605ed1 100644 --- a/src/melee/it/items/it_2E6A.c +++ b/src/melee/it/items/it_2E6A.c @@ -1 +1,250 @@ +#include "it/forward.h" +#include "it_2E6A.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 "lb/lb_00B0.h" + +// static void it_802E6D60(Item_GObj* arg0); /* static */ +static void it_802E6D60(HSD_GObj* arg0); /* static */ +// static bool it_802E7054(Item_GObj* gobj); /* static */ +static bool it_802E7054(HSD_GObj* gobj); /* static */ +// static Article it_803F8C08 = { + +static ItemAttr it_803F8C08 = { + // 0x31080000 + 0, // x0_is_heavy? + 6, // x0_78? + 1, // x0_hold_kind? + 0, // x1_1? + 0, // x1_3? + 0, // x1_4? + 1, // x1_5? + 0, // x1_67_cam_kind? + 0, // x1_8? + 0, // x3? + 0, // x4_throw_speed_mul + 0, // x8 + 0, // xC_spin_speed + 0, // x10_fall_speed + 0, // x14_fall_speed_max + 0, // x18 + 0, // x1C_damage_mul + 0, // x20.top? + 0, // x20.bottom? + 0, // x20.right? + 0, // x20.left? + 0, // x30_unk.x? + 0, // x30_unk.y? + 0, // x38_grab_range.x? + 0, // x38_grab_range.y? + 2.0f, // x40.top? + 2.0f, // x40.bottom? + 2.0f, // x40.right? + 2.0f, // x40.left? + 0, // x50? + 0, // x54? + 0, // x58? + 0, // x5C? + 1.0f, // x60_scale? + 0, // destroy_gfx? - 0xFFFFFFFF + 0, // x68? - 0xFFFFFFFF + 0x00083D60, // x6C? + 0x00083D60, // x70? + 0x00083D60, // x74? + 0x00083D60, // destroy_sfx? + 0x00083D60, // x7C? + 0x00083D60, // x80? + // Missing 0x84 - 0x9C? +}; + +ItemStateTable it_803F8C8C[] = { + { 0, NULL, it_802E6D60, NULL }, { 1, NULL, it_802E6D60, NULL }, + { 2, NULL, it_802E6D60, NULL }, { 3, NULL, it_802E6D60, NULL }, + { 4, NULL, it_802E6D60, NULL }, { 5, NULL, it_802E6D60, NULL }, + { 6, NULL, it_802E6D60, NULL }, { 7, NULL, it_802E6D60, NULL }, + { 8, NULL, it_802E6D60, NULL }, { 9, NULL, it_802E6D60, NULL }, + { 10, NULL, it_802E6D60, NULL }, { 11, NULL, it_802E6D60, NULL }, + { 12, NULL, it_802E6D60, NULL }, { 13, NULL, it_802E6D60, NULL }, + { 14, NULL, it_802E6D60, NULL }, { 15, NULL, it_802E6D60, NULL }, + { 16, NULL, it_802E6D60, NULL }, { 17, NULL, it_802E6D60, NULL }, + { 18, NULL, it_802E6D60, NULL }, { 19, NULL, it_802E6D60, NULL }, +}; + +// static s8 it_803F8DCC[0x10] = "%s:%d: oioi...\n"; +// static u8 it_803F8DDC[9] = "ityaku.c"; +// static s8 it_804D56B8[7] = "jobj.h"; +// static s8 it_804D56C0[5] = "jobj"; +static Vec3 it_803B8730 = { 1.0f, 1.0f, 1.0f }; + +HSD_GObj* it_802E6AEC(Ground* arg0, int arg1, int arg2, HSD_JObj* arg3, + Vec3 pos, int arg5, int arg6, HSD_GObjEvent arg7, + int arg8) +{ + // bool it_802E6AEC(Ground* arg0, int arg1, int arg2, HSD_JObj* arg3, Vec3 + // pos, int arg5, int arg6, HSD_GObjEvent arg7, int arg8) { bool + // it_802E6AEC(int arg0, int arg1, int arg2, HSD_JObj* arg3, Vec3 pos, int + // arg5, int arg6, int arg7, int arg8) { + SpawnItem spawn; + Vec3 sp30; + HSD_JObj* item_jobj; + Item* item; + Item_GObj* item_gobj; + s32 var_r4; + + spawn.kind = Pokemon_Random; // 44 + if (arg3) { + lb_8000B1CC(arg3, 0, &spawn.prev_pos); + } else { + if (&pos != NULL) { + spawn.prev_pos = pos; + } else { + return NULL; + } + } + var_r4 = 0; + spawn.pos = spawn.prev_pos; + spawn.facing_dir = 0.0f; + spawn.x3C_damage = 0; + // spawn.x3C_damage = var_r4; + spawn.vel.x = spawn.vel.y = spawn.vel.z = 0.0f; + spawn.x0_parent_gobj = 0; + // spawn.x0_parent_gobj = (HSD_GObj*) var_r4; + spawn.x4_parent_gobj2 = spawn.x0_parent_gobj; + if (arg5 != 0) { + var_r4 = 1; + } + spawn.x44_flag.b0 = var_r4; + // spawn.x44_flag.b0 = 1 | ((var_r4 << 7) & 0x80); + spawn.x40 = 0; + // *it_804D6D38[spawn.kind].unk-AC = &it_803F8C08; + it_804D6D38[spawn.kind - 0x2B]->x0_common_attr = &it_803F8C08; + // it_804D6D38[Pokemon_Random] = &it_803F8C08; + + item_gobj = Item_80268B18(&spawn); + if (item_gobj != NULL) { + item = GET_ITEM((HSD_GObj*) item_gobj); + if (arg3 != 0) { + item->xDD4_itemVar.it_2E6A_1.x2 = 1; + item->xDD4_itemVar.it_2E6A_1.x4 = arg3; + } else if (&pos != 0) { + item->xDD4_itemVar.it_2E6A_2.x2 = 2; + item->xDD4_itemVar.it_2E6A_2.x4 = pos; + } + + item->xDD4_itemVar.it_2E6A_1.x0 = arg1; + item->xDD4_itemVar.it_2E6A_1.x10 = arg0; + item->xDD4_itemVar.it_2E6A_1.x14 = (void*) arg6; + item->xDD4_itemVar.it_2E6A_1.x18 = arg7; + item->xDD4_itemVar.it_2E6A_1.x1C = (void*) arg8; + item_jobj = GET_JOBJ((HSD_GObj*) item_gobj); + sp30 = it_803B8730; + HSD_JObjSetScale(item_jobj, &sp30); + item->xDCC_flag.b3 = 0; + it_802756D0(item_gobj); + Item_80268E5C((HSD_GObj*) item_gobj, arg2, ITEM_ANIM_UPDATE); + item->touched = it_802E7054; + item->x378_itemColl.x34_flags.b1234 = 5; + } + return (HSD_GObj*) item_gobj; +} + +// void it_802E6D60(Item_GObj* item_gobj) { +void it_802E6D60(HSD_GObj* item_gobj) +{ + Vec3 sp24; + Quaternion sp14; + HSD_JObj* jobj1; + HSD_JObj* jobj2; + HSD_JObj* item_jobj; + Item* item; + PAD_STACK(4); + + item = GET_ITEM((HSD_GObj*) item_gobj); + item_jobj = item_gobj->hsd_obj; + if (item->xDD4_itemVar.it_2E6A_1.x2 == 1) { + lb_8000B1CC(item->xDD4_itemVar.it_2E6A_1.x4, NULL, &sp24); + item->pos = sp24; + jobj1 = item->xDD4_itemVar.it_2E6A_1.x4; + HSD_JObjGetScale(jobj1, &sp24); + HSD_JObjSetScale(item_jobj, &sp24); + jobj2 = item->xDD4_itemVar.it_2E6A_1.x4; + HSD_JObjGetRotation(jobj2, &sp14); + HSD_JObjSetRotation(item_jobj, &sp14); + } else if (item->xDD4_itemVar.it_2E6A_1.x2 != 2) { + OSReport("%s:%d: oioi...\n", "ityaku.c", 0xD7); + // while (false) {} + loop_29: + goto loop_29; + } +} + +bool it_802E6F7C(Item_GObj* item_gobj) +{ + Item* item; + // void (*temp_r12)(); + + item = item_gobj->user_data; + // temp_r12 = item->xDD4_itemVar.it_2E6A_1.x14; + if ((item->xDD4_itemVar.it_2E6A_1.x14 != 0U) && + (item->xDD4_itemVar.it_2E6A_1.x10 != 0U)) + { + // temp_r12(); + ((void (*)(HSD_GObj*)) item->xDD4_itemVar.it_2E6A_1.x14)( + (HSD_GObj*) item_gobj); + } + return false; +} + +bool it_802E6FC0(Item_GObj* item_gobj) +{ + Vec3 sp10; + Item* item; + // void (*temp_r12)(Item_GObj*, Vec3*, HSD_GObj*, f32); + HSD_GObj* fighter_gobj; + + item = GET_ITEM((HSD_GObj*) item_gobj); + item->xC9C = 0; + it_8027B798(item_gobj, &sp10); + // temp_r12 = item->xDD4_itemVar.it_2E6A_1.x18; + fighter_gobj = item->xCEC_fighterGObj; + if ((item->xDD4_itemVar.it_2E6A_1.x18 != 0U) && + (item->xDD4_itemVar.it_2E6A_1.x10 != 0U)) + { + ((void (*)(Item_GObj*, Vec3*, HSD_GObj*, + f32)) item->xDD4_itemVar.it_2E6A_1.x18)( + item_gobj, &sp10, fighter_gobj, item->xCA0); + // temp_r12(item_gobj, &sp10, fighter_gobj, item->xCA0); + } + return false; +} + +// bool it_802E7054(Item_GObj* item_gobj) { +bool it_802E7054(HSD_GObj* item_gobj) +{ + // void (*temp_r12)(HSD_GObj*); + Item* item; + + item = GET_ITEM(item_gobj); + // temp_r12 = item->xDD4_itemVar.it_2E6A_1.x1C; + if ((item->xDD4_itemVar.it_2E6A_1.x1C != NULL) && + (item->xDD4_itemVar.it_2E6A_1.x10 != 0U)) + { + // temp_r12(item->toucher) + ((void (*)(HSD_GObj*)) item->xDD4_itemVar.it_2E6A_1.x1C)( + item->toucher); + } + return false; +} + +void it_802E709C(Item_GObj* item_gobj, HSD_GObj* ref_gobj) +{ + it_8026B894(item_gobj, ref_gobj); +} diff --git a/src/melee/it/items/it_2E6A.h b/src/melee/it/items/it_2E6A.h index db6a04f52e..9fc5d76586 100644 --- a/src/melee/it/items/it_2E6A.h +++ b/src/melee/it/items/it_2E6A.h @@ -3,14 +3,17 @@ #include +#include "gr/forward.h" #include "it/forward.h" +#include #include "it/items/types.h" -/* 2E6AEC */ void it_802E6AEC(int, int, int, int, int, int, int, int, int); +/* 2E6AEC */ HSD_GObj* it_802E6AEC(Ground*, int, int, HSD_JObj*, Vec3, int, + int, HSD_GObjEvent, int); /* 2E6F7C */ bool it_802E6F7C(Item_GObj*); /* 2E6FC0 */ bool it_802E6FC0(Item_GObj*); -/* 2E709C */ void it_802E709C(Item_GObj*, Item_GObj*); +/* 2E709C */ void it_802E709C(Item_GObj*, HSD_GObj*); /* 3F8C8C */ extern ItemStateTable it_803F8C8C[]; #endif diff --git a/src/melee/it/types.h b/src/melee/it/types.h index 9707fe2474..a6bb16d370 100644 --- a/src/melee/it/types.h +++ b/src/melee/it/types.h @@ -544,6 +544,8 @@ struct Item { union { it_266F_ItemVars it_266F; it_27CF_ItemVars it_27CF; + it_2E6A_ItemVars_1 it_2E6A_1; + it_2E6A_ItemVars_2 it_2E6A_2; it_2F28_ItemVars it_2F28; itBombHei_ItemVars bombhei; itCapsule_ItemVars capsule; From 15de5e276ee7aa5d07ce2505861998fb67244b04 Mon Sep 17 00:00:00 2001 From: Aaron B Date: Wed, 2 Oct 2024 22:16:06 -0400 Subject: [PATCH 08/25] Update itCommonItems.h --- src/melee/it/itCommonItems.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index 1b28266ba8..2758fa6dbd 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -408,6 +408,17 @@ typedef struct it_27CF_DatAttrs { int x28; // ItemKind } it_27CF_DatAttrs; +typedef struct it_2F28_ItemVars { + f32 x0; +} it_2F28_ItemVars; + +struct it_2F28_DatAttrs { + Vec3 pos; + Vec3 vel; + f32 float1; // lifetime + f32 float2; // item var x0 +}; + // Not sure if there is a way to combine these two structs? typedef struct it_2E6A_ItemVars_1 { /* +0 ip+DD4 */ s16 x0; @@ -431,15 +442,4 @@ typedef struct it_2E6A_ItemVars_2 { /* +1C ip+DF0 */ void* x1C; } it_2E6A_ItemVars_2; -typedef struct it_2F28_ItemVars { - f32 x0; -} it_2F28_ItemVars; - -struct it_2F28_DatAttrs { - Vec3 pos; - Vec3 vel; - f32 float1; // lifetime - f32 float2; // item var x0 -}; - #endif From 25d1fa7397b32785c6bbea77e227030cb0d867e2 Mon Sep 17 00:00:00 2001 From: Aaron B Date: Wed, 2 Oct 2024 22:21:16 -0400 Subject: [PATCH 09/25] Fix line ending --- src/melee/it/items/it_27CF.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/melee/it/items/it_27CF.c b/src/melee/it/items/it_27CF.c index 051620e6c1..b02c3608ba 100644 --- a/src/melee/it/items/it_27CF.c +++ b/src/melee/it/items/it_27CF.c @@ -241,4 +241,4 @@ bool it_802F3330(Item_GObj* item_gobj) void it_802F3374(Item_GObj* item_gobj, HSD_GObj* ref_gobj) { it_8026B894(item_gobj, ref_gobj); -} \ No newline at end of file +} From 33b87a26f2c07bedf90cf1ce067e0a5636a20cff Mon Sep 17 00:00:00 2001 From: Robin Avery Date: Sun, 13 Oct 2024 05:45:14 -0400 Subject: [PATCH 10/25] Fix errors --- src/melee/gr/grmaterial.c | 10 +++++----- src/melee/it/items/it_2E6A.c | 22 +++++++--------------- src/melee/it/items/it_2E6A.h | 4 ++-- 3 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/melee/gr/grmaterial.c b/src/melee/gr/grmaterial.c index a457718efc..ddd066523a 100644 --- a/src/melee/gr/grmaterial.c +++ b/src/melee/gr/grmaterial.c @@ -151,14 +151,14 @@ void grMaterial_801C8CDC(Item_GObj* gobj) Item_8026A8EC(gobj); } -void grMaterial_801C8CFC(int arg0, int arg1, int arg2, int arg3, int arg4, - int arg5, int arg6) +void grMaterial_801C8CFC(int arg0, int arg1, Ground* arg2, HSD_JObj* arg3, + int arg4, HSD_GObjEvent arg5, int arg6) { - it_802E6AEC(arg2, arg0, arg1, arg3, 0, 0, arg4, arg5, arg6); + it_802E6AEC(arg2, arg0, arg1, arg3, NULL, 0, arg4, arg5, arg6); } -void grMaterial_801C8D44(int arg0, int arg1, int arg2, int arg3, int arg4, - int arg5, int arg6, int arg7) +void grMaterial_801C8D44(int arg0, int arg1, Ground* arg2, Vec3* arg3, + int arg4, int arg5, HSD_GObjEvent arg6, int arg7) { it_802E6AEC(arg2, arg0, arg1, 0, arg3, arg4, arg5, arg6, arg7); } diff --git a/src/melee/it/items/it_2E6A.c b/src/melee/it/items/it_2E6A.c index 90bf605ed1..29d288156b 100644 --- a/src/melee/it/items/it_2E6A.c +++ b/src/melee/it/items/it_2E6A.c @@ -78,20 +78,12 @@ ItemStateTable it_803F8C8C[] = { { 18, NULL, it_802E6D60, NULL }, { 19, NULL, it_802E6D60, NULL }, }; -// static s8 it_803F8DCC[0x10] = "%s:%d: oioi...\n"; -// static u8 it_803F8DDC[9] = "ityaku.c"; -// static s8 it_804D56B8[7] = "jobj.h"; -// static s8 it_804D56C0[5] = "jobj"; static Vec3 it_803B8730 = { 1.0f, 1.0f, 1.0f }; -HSD_GObj* it_802E6AEC(Ground* arg0, int arg1, int arg2, HSD_JObj* arg3, - Vec3 pos, int arg5, int arg6, HSD_GObjEvent arg7, - int arg8) +Item_GObj* it_802E6AEC(Ground* arg0, int arg1, int arg2, HSD_JObj* arg3, + Vec3* pos, int arg5, int arg6, HSD_GObjEvent arg7, + int arg8) { - // bool it_802E6AEC(Ground* arg0, int arg1, int arg2, HSD_JObj* arg3, Vec3 - // pos, int arg5, int arg6, HSD_GObjEvent arg7, int arg8) { bool - // it_802E6AEC(int arg0, int arg1, int arg2, HSD_JObj* arg3, Vec3 pos, int - // arg5, int arg6, int arg7, int arg8) { SpawnItem spawn; Vec3 sp30; HSD_JObj* item_jobj; @@ -103,8 +95,8 @@ HSD_GObj* it_802E6AEC(Ground* arg0, int arg1, int arg2, HSD_JObj* arg3, if (arg3) { lb_8000B1CC(arg3, 0, &spawn.prev_pos); } else { - if (&pos != NULL) { - spawn.prev_pos = pos; + if (pos != NULL) { + spawn.prev_pos = *pos; } else { return NULL; } @@ -136,7 +128,7 @@ HSD_GObj* it_802E6AEC(Ground* arg0, int arg1, int arg2, HSD_JObj* arg3, item->xDD4_itemVar.it_2E6A_1.x4 = arg3; } else if (&pos != 0) { item->xDD4_itemVar.it_2E6A_2.x2 = 2; - item->xDD4_itemVar.it_2E6A_2.x4 = pos; + item->xDD4_itemVar.it_2E6A_2.x4 = *pos; } item->xDD4_itemVar.it_2E6A_1.x0 = arg1; @@ -153,7 +145,7 @@ HSD_GObj* it_802E6AEC(Ground* arg0, int arg1, int arg2, HSD_JObj* arg3, item->touched = it_802E7054; item->x378_itemColl.x34_flags.b1234 = 5; } - return (HSD_GObj*) item_gobj; + return item_gobj; } // void it_802E6D60(Item_GObj* item_gobj) { diff --git a/src/melee/it/items/it_2E6A.h b/src/melee/it/items/it_2E6A.h index 9fc5d76586..a80b207cc0 100644 --- a/src/melee/it/items/it_2E6A.h +++ b/src/melee/it/items/it_2E6A.h @@ -9,8 +9,8 @@ #include "it/items/types.h" -/* 2E6AEC */ HSD_GObj* it_802E6AEC(Ground*, int, int, HSD_JObj*, Vec3, int, - int, HSD_GObjEvent, int); +/* 2E6AEC */ Item_GObj* it_802E6AEC(Ground*, int, int, HSD_JObj*, Vec3*, int, + int, HSD_GObjEvent, int); /* 2E6F7C */ bool it_802E6F7C(Item_GObj*); /* 2E6FC0 */ bool it_802E6FC0(Item_GObj*); /* 2E709C */ void it_802E709C(Item_GObj*, HSD_GObj*); From fe462d50ed2e8ac05b486331771826cd1c0a7d84 Mon Sep 17 00:00:00 2001 From: Aaron B Date: Thu, 17 Oct 2024 11:00:59 -0400 Subject: [PATCH 11/25] it_2E5A work --- src/melee/it/itCommonItems.h | 134 +++++-- src/melee/it/it_2725.h | 8 +- src/melee/it/items/it_2E5A.c | 723 +++++++++++++++++++++++++++++++++-- src/melee/it/items/it_2E5A.h | 44 ++- src/melee/it/types.h | 1 + 5 files changed, 839 insertions(+), 71 deletions(-) diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index 2758fa6dbd..0be6eb1225 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -6,6 +6,7 @@ #include #include +#include "it/forward.h" #include #include @@ -393,6 +394,116 @@ typedef struct itTaruCann_DatAttrs { /* +2C */ int x2C; } itTaruCann_DatAttrs; +// Not sure if there is a way to combine these two structs? +typedef struct it_2E6A_ItemVars_1 { + /* +0 ip+DD4 */ s16 x0; + /* +0 ip+DD4 */ s16 x2; + /* +4 ip+DD8 */ HSD_JObj* x4; + /* +8 ip+DDC */ f32 x8; // unused? + /* +C ip+DE0 */ f32 xC; // unused? + /* +10 ip+DE4 */ void* x10; + /* +14 ip+DE8 */ void* x14; + /* +18 ip+DEC */ void* x18; + /* +1C ip+DF0 */ void* x1C; +} it_2E6A_ItemVars_1; + +typedef struct it_2E6A_ItemVars_2 { + /* +0 ip+DD4 */ s16 x0; + /* +0 ip+DD4 */ u16 x2; + /* +4 ip+DD8 */ Vec3 x4; + /* +10 ip+DE4 */ void* x10; + /* +14 ip+DE8 */ void* x14; + /* +18 ip+DEC */ void* x18; + /* +1C ip+DF0 */ void* x1C; +} it_2E6A_ItemVars_2; + +typedef struct it_2E5A_ItemVars_struct { + f32 x0; // set to float calc result/item->x3C + HSD_JObj* x4; // set to item_gobj->hsd_obj + Vec3 x8; // called in lb_8000B1CC + Vec3 x14; // set equal to x8 +} it_2E5A_ItemVars_struct; + +typedef struct it_2E5A_ItemVars { + // /* ip+DD4 */ HSD_GObj* x0; + /* ip+DD4 */ s32 x0; + /* ip+DD8 */ s32 x4; // uses regular registers (#? gets multiplied by 2C, + // then indexed into attr) + /* ip+DDC */ s32 x8; // uses regular registers + /* ip+DE0 */ s32 xC; // uses regular registers + /* ip+DE4 */ f32 x10; // uses float registers; timer? + /* ip+DE8 */ f32 x14; + /* ip+DEC */ UnkFlagStruct x18; // has bit assignments + /* ip+DF0 */ it_2E5A_ItemVars_struct* x1C; + // /* ip+DF4 */ s32 x20; + // /* ip+DF8 */ s32 x24; + // /* ip+DFC */ s32 x28; + // /* ip+E00 */ s32 x2C; + // /* ip+E04 */ s32 x30; + // /* ip+E08 */ s32 x34; + // /* ip+E0C */ s32 x38; + // /* ip+E10 */ s32 x3C; + // /* ip+E14 */ s32 x40; + // /* ip+E18 */ s32 x44; + // /* ip+E1C */ s32 x48; + // /* ip+E20 */ s32 x4C; + // /* ip+E24 */ s32 x50; + // /* ip+E28 */ s32 x54; + // /* ip+E2C */ s32 x58; +} it_2E5A_ItemVars; + +typedef struct it_2E5A_DatAttrs_1 { + f32 x0; // lifetime? + f32 x4; // float assignment + f32 x8; + f32 xC; + f32 x10; + f32 x14; // item->x40_vel.x + f32 x18; + f32 x1C; + f32 x20; + f32 x24; // float assignment + f32 x28; + f32 x2C; // float assignment + f32 x30; + f32 x34; + f32 x38; + HSD_Joint* x3C; // called in it_80273318 + f32 x40; + f32 x44; + f32 x48; + s32 x4C; // item->xD84 + s32 x50; + f32 x54; // item->scl + ECB* x58; // called in it_80275D5C + s32 x5C; +} it_2E5A_DatAttrs_1; + +typedef struct it_2E5A_DatAttrs_2 { + f32 x0; // lifetime? + f32 x4; // float assignment + f32 x8; + f32 xC; + HSD_Joint* x10; // called in it_80273318 + ItemStateDesc* x14; // item2->xD0_itemStateDesc + f32 x18; + f32 x1C; + s32 x20; // item->xD84 + f32 x24; // float assignment + f32 x28; // item->scl + // ECB* x2C; // called in it_80275D5C +} it_2E5A_DatAttrs_2; + +typedef struct it_802E5FXX_struct { // used for it_802E5F00 and it_802E5F8C + HSD_GObj* x0; // Item GObj assignment/passed to db_80225DD8 + f32 x4; // float assignment (angle?) + f32 x8; // float assignment (used in x40_vel.y calc) + s32 xC; // non-float assignment (arg3/arg2/while condition) + s32 x10; // non-float assignment + s32 x14; // non-float assignment + s32 x18; // non-float assignment (gm_8016C6C0) +} it_802E5FXX_struct; + // Should it_2F28 and it_27CF use the same structs? typedef struct it_27CF_ItemVars { f32 x0; @@ -419,27 +530,4 @@ struct it_2F28_DatAttrs { f32 float2; // item var x0 }; -// Not sure if there is a way to combine these two structs? -typedef struct it_2E6A_ItemVars_1 { - /* +0 ip+DD4 */ s16 x0; - /* +0 ip+DD4 */ s16 x2; - /* +4 ip+DD8 */ HSD_JObj* x4; - /* +8 ip+DDC */ f32 x8; // unused? - /* +C ip+DE0 */ f32 xC; // unused? - /* +10 ip+DE4 */ void* x10; - /* +14 ip+DE8 */ void* x14; - /* +18 ip+DEC */ void* x18; - /* +1C ip+DF0 */ void* x1C; -} it_2E6A_ItemVars_1; - -typedef struct it_2E6A_ItemVars_2 { - /* +0 ip+DD4 */ s16 x0; - /* +0 ip+DD4 */ u16 x2; - /* +4 ip+DD8 */ Vec3 x4; - /* +10 ip+DE4 */ void* x10; - /* +14 ip+DE8 */ void* x14; - /* +18 ip+DEC */ void* x18; - /* +1C ip+DF0 */ void* x1C; -} it_2E6A_ItemVars_2; - #endif diff --git a/src/melee/it/it_2725.h b/src/melee/it/it_2725.h index d3c64bf27c..5a72137b88 100644 --- a/src/melee/it/it_2725.h +++ b/src/melee/it/it_2725.h @@ -42,7 +42,7 @@ /* 273168 */ void it_80273168(Item_GObj* gobj); /* 2731A4 */ void it_802731A4(Item_GObj*); /* 2731E0 */ void it_802731E0(Item_GObj*); -/* 27321C */ UNK_RET it_8027321C(UNK_PARAMS); +/* 27321C */ void it_8027321C(Item_GObj*); /* 27327C */ void it_8027327C(Item_GObj* gobj, s32 ID1, s32 ID2); /* 2732E4 */ UNK_RET it_802732E4(UNK_PARAMS); /* 273318 */ void it_80273318(Item_GObj*, HSD_Joint*, s32); @@ -119,7 +119,7 @@ /* 275534 */ UNK_RET it_80275534(UNK_PARAMS); /* 275594 */ UNK_RET it_80275594(UNK_PARAMS); /* 2755C0 */ UNK_RET it_802755C0(UNK_PARAMS); -/* 275640 */ UNK_RET it_80275640(UNK_PARAMS); +/* 275640 */ void it_80275640(Item_GObj*, f32); /* 2756D0 */ void it_802756D0(Item_GObj* gobj); /* 2756E0 */ void it_802756E0(Item_GObj* gobj); /* 27570C */ UNK_RET it_8027570C(UNK_PARAMS); @@ -151,7 +151,7 @@ /* 276934 */ UNK_RET it_80276934(UNK_PARAMS); /* 276CB8 */ void it_80276CB8(Item_GObj* gobj); /* 276CEC */ void it_80276CEC(Item_GObj*); -/* 276D9C */ UNK_RET it_80276D9C(UNK_PARAMS); +/* 276D9C */ bool it_80276D9C(Item_GObj*, s32); /* 276FC4 */ void it_80276FC4(Item_GObj*); /* 277040 */ bool it_80277040(Item_GObj*); /* 27737C */ void it_8027737C(Item_GObj* gobj, Vec3* pos); @@ -159,7 +159,7 @@ /* 2775F0 */ UNK_RET it_802775F0(UNK_PARAMS); /* 27770C */ UNK_RET it_8027770C(UNK_PARAMS); /* 27781C */ bool it_8027781C(Item_GObj*); -/* 277C40 */ UNK_RET it_80277C40(UNK_PARAMS); +/* 277C40 */ void it_80277C40(Item_GObj*, s32); /* 277D08 */ UNK_RET it_80277D08(UNK_PARAMS); /* 277D8C */ UNK_RET fn_80277D8C(UNK_PARAMS); /* 277F90 */ UNK_RET it_80277F90(UNK_PARAMS); diff --git a/src/melee/it/items/it_2E5A.c b/src/melee/it/items/it_2E5A.c index c4326e8bbf..bffe59ce8d 100644 --- a/src/melee/it/items/it_2E5A.c +++ b/src/melee/it/items/it_2E5A.c @@ -1,50 +1,727 @@ #include "it_2E5A.h" +#include "types.h" + +#include "db/db_2253.h" #include "it/inlines.h" +#include "it/it_266F.h" +#include "it/it_26B1.h" +#include "it/it_2725.h" +#include "it/item.h" +#include "lb/lb_00B0.h" +#include "lb/lbaudio_ax.h" +#include "lb/lbvector.h" + +#include +#include +#include +#include +#include +#include +#include + +s32 gm_8016C6C0(Item_GObj*); /* extern */ +void it_8027321C(Item_GObj*); /* extern */ +void it_80275640(Item_GObj*, f32); /* extern */ +bool it_80276D9C(Item_GObj*, s32); /* extern */ +void it_80277C40(Item_GObj*, s32); /* extern */ +bool mpColl_80048844(CollData*, f32); /* extern */ +bool mpColl_8004CB78(CollData*, Vec3*); /* extern */ +static Vec3 it_803B8718 = { + 0.0f, 0.0f, 0.0f +}; /* unable to generate initializer: unknown type; const */ +static Vec3 it_803B8724 = { + 0.0f, 0.0f, 0.0f +}; /* unable to generate initializer: unknown type; const */ + +ItemStateTable it_803F8BD8[] = { + { 0, it_802E67A8, it_802E67F4, it_802E6824 }, + { -1, it_802E67A8, it_802E67F4, NULL }, + { 0, it_802E68EC, it_802E690C, it_802E6910 }, +}; + +bool it_802E5AC4(Item_GObj* item_gobj, bool arg_check) +{ + Vec3 sp40; + Vec3 sp34; + Vec3 sp28; + Item* item; + f32 temp_f1; + f32 temp_f1_10; + f32 temp_f2; + f32 vel_x; + f32 vel_y; + f32 var_f31; + f32 var_f4; + bool check1; + bool check2; + CollData* coll_data; + ItemAttr* comm_attr; + it_2E5A_DatAttrs_1* spec_attr; + PAD_STACK(4); + + item = GET_ITEM((HSD_GObj*) item_gobj); + coll_data = &item->x378_itemColl; + comm_attr = item->xCC_item_attr; + spec_attr = item->xC4_article_data->x4_specialAttributes; + it_80276214(item_gobj); + temp_f1 = coll_data->cur_topn.y; + coll_data->cur_topn.y = temp_f1 - item->xC1C.bottom; + check1 = mpColl_80048844(coll_data, temp_f1); + coll_data->cur_topn.y = coll_data->cur_topn.y + item->xC1C.bottom; + item->pos = coll_data->cur_topn; + + // Rounds item velocities to 0 if they are close to it + if (check1 && arg_check) { + vel_x = item->x40_vel.x; + if (item->x40_vel.x < 0.0f) { + vel_x = -vel_x; + } + if (vel_x <= 0.00001f) { + item->x40_vel.x = 0.0f; + } + vel_y = item->x40_vel.y; + if (vel_y < 0.0f) { + vel_y = -vel_y; + } + if (vel_y <= 0.00001f) { + item->x40_vel.y = 0.0f; + } + vel_x = item->x40_vel.x; + if (vel_x < 0.0f) { + vel_x = -vel_x; + } + temp_f2 = comm_attr->x5c; + if (vel_x <= temp_f2) { + vel_y = item->x40_vel.y; + if (vel_y < 0.0f) { + vel_y = -vel_y; + } + if (!(vel_y <= temp_f2)) { + goto block_16; + } + goto block_18; + } + block_16: + if (item->xDCD_flag.b4 || (comm_attr->x58 == 0.0f)) { + block_18: + item->x40_vel.z = 0.0f; + item->x40_vel.y = 0.0f; + item->x40_vel.x = 0.0f; + item->xD50_landNum = 0; + } else { + check2 = false; + sp34 = it_803B8718; + check1 = false; + sp28 = it_803B8724; + var_f31 = + sqrtf_accurate(SQ(item->x40_vel.x) + SQ(item->x40_vel.y)); + if (((item->x40_vel.x * coll_data->floor.normal.x) + + (item->x40_vel.y * coll_data->floor.normal.y)) < 0.0f) + { + sp40 = item->x40_vel; + lbVector_Mirror(&sp40, &coll_data->floor.normal); + lbVector_Add_xy(&sp28, &sp40); + if (mpColl_8004CB78(coll_data, &sp40) != 0) { + lbVector_Add_xy(&sp34, &sp40); + } + check2 = true; + } + if (check2) { + lbVector_NormalizeXY(&sp28); + var_f4 = sqrtf(SQ(sp28.x) + SQ(sp28.y) + SQ(sp28.z)); + + if (var_f4 < 0.01f) { + sp28.x = item->x40_vel.x; + sp28.y = -1.0f * item->x40_vel.y; + } + temp_f1_10 = var_f31 * comm_attr->x58; + sp28.x *= temp_f1_10; + sp28.y *= temp_f1_10; + item->x64_vec_unk2 = sp34; + item->x40_vel = sp28; + } + if (it_80276D9C(item_gobj, 1) != 0) { + it_8027321C(item_gobj); + it_80277C40(item_gobj, 0); + it_80275640(item_gobj, comm_attr->x58); + } + if (item->xD50_landNum == 1) { + item->xD84 = spec_attr->x4C; // or spec_attr[1]->x20 + } + item->x40_vel.x *= spec_attr->x14; // or spec_attr[0]->x14 + item->xD50_landNum += 1; + if (item->xD50_landNum >= 3U) { + if (!(item->xDCF_flag.b0)) { + item->xDCF_flag.b0 = 1; + } + } + } + } + return check1; +} + +s32 it_802E5EF4(Item_GObj* item_gobj) +{ + // HSD_GObj* it_802E5EF4(Item_GObj* item_gobj) { + return GET_ITEM((HSD_GObj*) item_gobj)->xDD4_itemVar.it_2E5A.x0; +} + +void it_802E5F00(Item_GObj* item_gobj, Vec3* pos, Vec3* vel, s32 arg3) +{ + // void it_802E5F00(Item_GObj* parent_gobj1, Item_GObj* parent_gobj2, Vec3* + // pos, Vec3* vel, s32 arg3) { + it_802E5FXX_struct vars; + SpawnItem sp1C; + f32 unused1; + + it_802E614C(NULL, item_gobj, &sp1C, pos, vel); + // sp68 = item_gobj; + // sp6C = 0.0f; + // sp70 = 0.0f; + // sp74 = arg3; + // sp78 = 0; + // sp7C = 1; + // sp54 = -1.0f; + // sp80 = 0; + vars.x0 = (HSD_GObj*) item_gobj; + vars.x4 = 0.0f; + vars.x8 = 0.0f; + vars.xC = arg3; + vars.x10 = 0; + vars.x14 = 1; + sp1C.facing_dir = -1.0f; + vars.x18 = 0; + it_802E609C(&vars, &sp1C); +} + +s32 it_802E5F8C(Item_GObj* item_gobj, Vec3* pos, s32 arg2, s32 arg3, f32 arg4, + f32 arg5) +{ + it_802E5FXX_struct vars; + SpawnItem sp2C; + f32 dir; + f32 angle; + Vec3 vel; + + vel.x = vel.y = vel.z = 0.0f; + it_802E614C(NULL, item_gobj, &sp2C, pos, &vel); + angle = M_PI_2 + arg4; + while (angle < 0.0f) { + angle += 2 * M_PI; + } + while (angle > 2 * M_PI) { + angle -= 2 * M_PI; + } + if (angle > M_PI) { + dir = -1.0f; + } else { + dir = 1.0f; + } + // sp78 = item_gobj; + // sp7C = angle; + // sp80 = arg5; + // sp84 = arg2; + // sp88 = 1; + // sp64 = dir; + // sp8C = arg3; + vars.x0 = (HSD_GObj*) item_gobj; + vars.x4 = angle; + vars.x8 = arg5; + vars.xC = arg2; + vars.x10 = 1; + sp2C.facing_dir = dir; + vars.x14 = arg3; + vars.x18 = gm_8016C6C0(item_gobj); + return it_802E609C(&vars, &sp2C); +} + +// s32 it_802E609C(Fighter* fighter, SpawnItem* spawn) { +s32 it_802E609C(it_802E5FXX_struct* vars, SpawnItem* spawn) +{ + Item_GObj* spawn_gobj; + s32 temp_r3_2; + s32 var_r30; + s32 var_r29 = 0; + + // var_r30 = saved_reg_r30; + // var_r30 = 0; + // var_r29 = 0; + while (vars->xC) { + it_802E6658(); + spawn_gobj = Item_80268B18(spawn); + if (spawn_gobj != NULL) { + if ((vars->x10 == 1) && (var_r29 == 0)) { + temp_r3_2 = it_802E61C4(spawn_gobj, vars->xC, vars->x18); + vars->xC = temp_r3_2; + var_r30 = temp_r3_2; + var_r29 = 1; + } + it_802E6380(spawn_gobj, vars); + it_802E66A0(spawn_gobj); + db_80225DD8(spawn_gobj, (Fighter_GObj*) vars->x0); + it_802750F8(spawn_gobj); + } + // goto loop_6; + } + return var_r30; +} + +// void it_802E614C(Item_GObj* arg0, Item_GObj* arg1, Vec3* arg2, f32* arg3, +// void* arg4) { +inline void it_802E614C(Item_GObj* parent_gobj1, Item_GObj* parent_gobj2, + SpawnItem* spawn, Vec3* pos, Vec3* vel) +{ + spawn->kind = It_Kind_Unk4; + spawn->prev_pos = *pos; + spawn->pos = spawn->prev_pos; + spawn->x3C_damage = 0; + spawn->vel = *vel; + spawn->x0_parent_gobj = (HSD_GObj*) parent_gobj1; + spawn->x4_parent_gobj2 = (HSD_GObj*) parent_gobj2; + spawn->x44_flag.b0 = 1; + spawn->x40 = 0; +} + +s32 it_802E61C4(Item_GObj* item_gobj, s32 arg1, s32 arg2) +{ + // s32 it_802E61C4(SpawnItem* spawn, s32 arg1, s32 arg2) { + f32 temp_r29; + s32 var_r29; + // it_2E5A_DatAttrs_1* attr; + it_2E5A_DatAttrs_2* attr; + Item* item; + // void* temp_r3; + // f32 temp_f0; + // u32 num; + // s32 temp_r0; + + s32 unused1; + s32 unused2; + // s32 unused3; + // s32 unused4; + f64 unused5; + // PAD_STACK(10); + + // temp_r30 = arg0->user_data->xC4_article_data->x4_specialAttributes; + // temp_r29 = (s32) ((f32) arg1 * (attr[arg2 * 4 + 1]->x0); + // var_r29 = (s32) ((f32) temp_r29 * ((0.01f * (temp_r30->unk24 * + // HSD_Randf())) + 1.0f)); + + // num = arg2 * 4; + // temp_r29 = arg2 * 4; + + item = GET_ITEM((HSD_GObj*) item_gobj); + attr = item->xC4_article_data->x4_specialAttributes; + + // temp_r29 = arg1 * attr[arg2 * 4 + 1].x0; + // var_r29 = temp_r29 * ((0.01f * (attr->x24 * HSD_Randf())) + 1.0f); + var_r29 = arg1 * attr[arg2 * 4 + 1].x0 * + ((0.01f * (attr->x24 * HSD_Randf())) + 1.0f); + + // item = &attr + arg2 * 4; + // temp_f0 = attr->x2C; + // temp_f0 = (float) ((HSD_GObj*) item)->x2C; + // temp_f0 = (float) ((it_2E5A_ItemVars*) item)->x2C; + // temp_r0 = arg2 * 4; + // temp_f0 *= 4; + // temp_f0 += temp_r0; + // temp_f0 += arg2 * 4; + // temp_r29 = temp_f0; + // temp_r29 = (s32) ((f32) arg1 * (attr + (arg2 * 4))->unk2C); + // temp_r29 = (arg1 * (attr + (arg2 * 4))); + // num = arg2 * 4; + // // temp_r29 = arg1 * attr[num].x2C->top; + // temp_r29 = arg1 * attr[num + 1].x0; + // // var_r29 = (temp_f0 * ((0.01f * (attr->x24 * HSD_Randf())) + 1.0f)); + // var_r29 = (temp_r29 * ((0.01f * (attr->x24 * HSD_Randf())) + 1.0f)); + if (var_r29 < 1) { + var_r29 = 1; + // var_r29 = true; + } + return var_r29; +} + +// void it_802E628C(Item_GObj* item_gobj, f64 arg8, f32 arg9) { +void it_802E628C(Item_GObj* item_gobj, f32 arg8, f32 arg9) +{ + Item* item; + f32 temp_f31; + f32 temp_f2; + f32 temp_f1; + f32 temp_f0; + f32 var_f30; + it_2E5A_DatAttrs_1* attr; + + item = GET_ITEM((HSD_GObj*) item_gobj); + attr = item->xC4_article_data->x4_specialAttributes; + temp_f31 = HSD_Randf(); + temp_f1 = M_PI_2; + temp_f2 = attr->xC; + temp_f0 = M_PI_3; + temp_f1 = arg8 - M_PI_2; + // var_f30 = temp_f31 * attr->xC * item->facing_dir; + var_f30 = temp_f31 * temp_f2; + var_f30 *= item->facing_dir; + if (((arg8 >= M_PI_3) && (arg8 <= 2 * M_PI_3)) || + ((arg8 >= 2 * M_PI_3) && (arg8 <= 5 * M_PI_3))) + { + var_f30 += attr->x10 * cosf((temp_f1)); + } + item->x40_vel.x = var_f30; + temp_f0 = attr->x20; + temp_f1 = attr->x18; + temp_f0 = temp_f31 * temp_f0; + temp_f0 += arg9; + temp_f1 += temp_f0; + // item->x40_vel.y = temp_f31 * attr->x20 + arg9 + attr->x18; + item->x40_vel.y = temp_f1; + item->x40_vel.z = 0.0f; +} + +s32 it_802E6380(Item_GObj* item_gobj, it_802E5FXX_struct* arg1) +{ + // Item* temp_r30_2; + // s32 temp_r25; + // s32 temp_r26; + // s32 temp_r4; + // u8 temp_r0; + // it_2E5A_DatAttrs_1* attr; + Item* item; + s32 var_r31; + it_2E5A_DatAttrs_2* attr; + it_2E5A_ItemVars_struct* temp_r29_2; + + // it_2E5A_DatAttrs_2* temp_r4_2; + // void* temp_r5; + // u32 num; + PAD_STACK(14); + + var_r31 = 2; + item = item_gobj->user_data; + // temp_r4 = arg1->xC; + attr = item->xC4_article_data->x4_specialAttributes; + // if (arg1->xC < attr->xA8) { + if (arg1->xC < attr[3].x24) { + var_r31 = 1; + // if (arg1->xC < (s32) (attr + 0x58)->unk24) { + if (arg1->xC < attr[2].x24) { + var_r31 = 0; + } + } + // temp_r26 = var_r31 * 0x2C; + item->xDD4_itemVar.it_2E5A.x4 = var_r31; + // temp_r4_2 = attr[var_r31]; + + // arg1->xC -= attr[var_r31 + 1].x50; + arg1->xC -= attr[var_r31 + 1].x24; + + // item->xDD4_itemVar.it_2E5A.x0 = attr[var_r31].x50; + item->xDD4_itemVar.it_2E5A.x0 = attr[var_r31 + 1].x24; + + if (arg1->x10 == 1) { + arg1->x8 *= attr->x1C; + it_802E628C(item_gobj, arg1->x4, arg1->x8); + } + it_80275158(item_gobj, attr->x0); + // temp_r25 = var_r31 * 0x2C; + item->xDD4_itemVar.it_2E5A.x10 = attr->x4; + // temp_r5 = attr + temp_r26; + item->xDD4_itemVar.it_2E5A.x14 = attr->x8; + item->xDD4_itemVar.it_2E5A.x8 = arg1->x14; + item->xDCD_flag.b01 |= 2; + + // item->xD84 = temp_r5->unk4C; + // item->xD84 = attr[var_r31].x4C; + item->xD84 = attr[var_r31 + 1].x20; + + // item->scl = attr[var_r31]->unk54; + // item->scl = attr[var_r31].x54; + item->scl = attr[var_r31 + 1].x28; -/// #it_802E5AC4 + // it_80273318(item_gobj, (attr + temp_r25)->unk3C, (s32) temp_r5); + // it_80273318(item_gobj, attr[var_r31].x3C, var_r31); + // it_80273318(item_gobj, attr[var_r31].x3C, (s32) &attr[var_r31]); + it_80273318(item_gobj, attr[var_r31].x10, (s32) &attr[var_r31]); -int it_802E5EF4(Item_GObj* arg0) + // it_80275D5C(item_gobj, attr + (temp_r25 + 0x58)); + // it_80275D5C(item_gobj, attr[var_r31].x58); + // it_80275D5C(item_gobj, attr[var_r31 + 1].x2C); + it_80275D5C(item_gobj, (ECB*) &attr[var_r31 + 2].x0); + + // item->xC0C.top = item->xC1C.top; + // item->xC0C.bottom = item->xC1C.bottom; + // item->xC0C.right = item->xC1C.right; + // item->xC0C.left = item->xC1C.left; + item->xC0C = item->xC1C; + + item->xC1C.bottom *= item->scl; + item->xDD4_itemVar.it_2E5A.xC = 0; + item = item_gobj->user_data; + + // temp_r0 = item->xDD4_itemVar.it_2E5A.x18 & ~0x40; + // temp_r0 = item->xDD4_itemVar.it_2E5A.x18.b0 & ~0x40; + // item->xDD4_itemVar.it_2E5A.x18.b0 = temp_r0; + item->xDD4_itemVar.it_2E5A.x18.b1 = 0; + // temp_r0 = item->xDD4_itemVar.it_2E5A.x18.b1; + + // item->xDD4_itemVar.it_2E5A.x18.b0 = (item->xDD4_itemVar.it_2E5A.x18.b0 & + // ~0x80) | ((((temp_r0 >> 6U) & 1) << 7) & 0x80); + // item->xDD4_itemVar.it_2E5A.x18.b0 = (item->xDD4_itemVar.it_2E5A.x18.b0 & + // ~0x80) | (temp_r0 & 0x80); item->xDD4_itemVar.it_2E5A.x18.b0 = + // item->xDD4_itemVar.it_2E5A.x18.b0 | item->xDD4_itemVar.it_2E5A.x18.b1; + item->xDD4_itemVar.it_2E5A.x18.b0 = item->xDD4_itemVar.it_2E5A.x18.b1 | 1; + + if (item->xDD4_itemVar.it_2E5A.x8 != 0) { + temp_r29_2 = item->xDD4_itemVar.it_2E5A.x1C; + item->xDD4_itemVar.it_2E5A.x1C->x4 = item_gobj->hsd_obj; + item->xDD4_itemVar.it_2E5A.x1C->x0 = + (0.003906f * ((it_2E5A_DatAttrs_2*) + item->xC4_article_data->x4_specialAttributes) + ->x28) / + item->scl; + item->x3C = item->xDD4_itemVar.it_2E5A.x1C->x0; + lb_8000B1CC(item->xDD4_itemVar.it_2E5A.x1C->x4, NULL, + (Vec3*) &temp_r29_2->x8); + temp_r29_2->x14 = temp_r29_2->x8; + if (db_80225B34() != 0) { + item->xDAA_flag.b0 = 0; + } + } + return arg1->xC; +} + +bool it_802E657C(Item_GObj* item_gobj) { - return GET_ITEM(arg0)->xDD4_itemVar.capsule.x0; + Item* item; + f32 timer; + f32 temp_f0_2; + f32 temp_f1; + u8 temp_r4; + + item = GET_ITEM((HSD_GObj*) item_gobj); + timer = item->xD44_lifeTimer; + if (timer <= 0.0f) { + return true; + } + item->xD44_lifeTimer = timer - 1.0f; + if (item->xDD4_itemVar.it_2E5A.x8 == 1) { + temp_f0_2 = item->xDD4_itemVar.it_2E5A.x10; + if (temp_f0_2 <= 0.0f) { + temp_r4 = item->xDD4_itemVar.it_2E5A.x18.b0; + if (!temp_r4) { + item->xDD4_itemVar.it_2E5A.x18.b0 = 1; + } + } else { + item->xDD4_itemVar.it_2E5A.x10 = temp_f0_2 - 1.0f; + } + temp_f1 = item->xDD4_itemVar.it_2E5A.x14; + if (temp_f1 <= 0.0f) { + if (item->xDCD_flag.b5 != 1) { + it_80275444(item_gobj); + item->xDD4_itemVar.it_2E5A.x18.b1 = 1; + } + } else { + item->xDD4_itemVar.it_2E5A.x14 = temp_f1 - 1.0f; + } + } + return false; } -/// #it_802E5F00 +void it_802E6658(void) +{ + if ((u32) Item_804A0C64.x50 >= it_804D6D28->x20 - 2) + { // HSD_ObjAllocUnk.x50 >= ItemCommonData->x20 - 2 + Item_8026A8EC((Item_GObj*) it_80272828(158)); + } +} -/// #it_802E5F8C +void it_802E66A0(HSD_GObj* item_gobj) +{ + Item* item; + HSD_JObj* item_jobj; + // HSD_JObj* item_jobj2; + // u32 num; + // u32 index; + // it_2E5A_DatAttrs_2* attr; + PAD_STACK(30); -/// #it_802E609C + item = item_gobj->user_data; + if (item->xDD4_itemVar.it_2E5A.x8 == 1) { + if (item->xDD4_itemVar.it_2E5A.xC != 0) { + // Item_80268E5C(item_gobj, 0, 0x11); + Item_80268E5C(item_gobj, 0, ITEM_HIT_PRESERVE | ITEM_UNK_0x1); + } else { + Item_80268E5C(item_gobj, 0, ITEM_ANIM_UPDATE); + item->xDD4_itemVar.it_2E5A.xC = 1; + item = item_gobj->user_data; + item_jobj = item_gobj->hsd_obj; + // item->xD0_itemStateDesc = (ItemStateDesc* ) + // (item->xC4_article_data->x4_specialAttributes + + // ((item->xDD4_itemVar.it_2E5A.x4 * 0x2C) + 0x40)); num = + // item->xDD4_itemVar.it_2E5A.x4 + 1; // index = 0x14; (0x40 - 0x2C + // = 0x14) attr = item->xC4_article_data->x4_specialAttributes; + // item->xD0_itemStateDesc = attr[num].x14; + item->xD0_itemStateDesc = + ((it_2E5A_DatAttrs_2*) item->xC4_article_data + ->x4_specialAttributes)[item->xDD4_itemVar.it_2E5A.x4 + 1] + .x14; // index = 0x14; (0x40 - 0x2C = 0x14) -/// #it_802E614C + Item_80268D34(item_gobj, item->xD0_itemStateDesc); + HSD_JObjAnimAll(item_jobj); + // HSD_JObjAnimAll(item_gobj->hsd_obj); + } + item->on_accessory = it_802E6A74; + return; + } + Item_80268E5C(item_gobj, 1, ITEM_ANIM_UPDATE); + item = item_gobj->user_data; + item_jobj = item_gobj->hsd_obj; + // item->xD0_itemStateDesc = (ItemStateDesc* ) + // (item->xC4_article_data->x4_specialAttributes + + // ((item->xDD4_itemVar.it_2E5A.x4 * 0x2C) + 0x40)); num = + // item->xDD4_itemVar.it_2E5A.x4 + 1; // index = 0x14; (0x40 - 0x2C = 0x14) + item->xD0_itemStateDesc = + ((it_2E5A_DatAttrs_2*) item->xC4_article_data + ->x4_specialAttributes)[item->xDD4_itemVar.it_2E5A.x4 + 1] + .x14; // index = 0x14; (0x40 - 0x2C = 0x14) + Item_80268D34(item_gobj, item->xD0_itemStateDesc); + HSD_JObjAnimAll(item_jobj); + // HSD_JObjAnimAll(item_gobj->hsd_obj); +} -/// #it_802E61C4 +bool it_802E67A8(HSD_GObj* item_gobj) +{ + f32 var_f2; + Item* item; -/// #it_802E628C + item = GET_ITEM(item_gobj); + var_f2 = item->x40_vel.y; + if (var_f2 < 0.0f) { + var_f2 = -var_f2; + } + item->x5D0_animFrameSpeed = (0.1 * var_f2) + 1.0; + return it_802E657C((Item_GObj*) item_gobj); +} -/// #it_802E6380 +void it_802E67F4(HSD_GObj* item_gobj) +{ + ItemAttr* comm_attr; -/// #it_802E657C + comm_attr = GET_ITEM(item_gobj)->xCC_item_attr; + it_80272860((Item_GObj*) item_gobj, comm_attr->x10_fall_speed, + comm_attr->x14_fall_speed_max); +} -/// #it_802E6658 +bool it_802E6824(HSD_GObj* item_gobj) +{ + Item* item; + PAD_STACK(10); -/// #it_802E66A0 + item = GET_ITEM(item_gobj); + if (it_802E5AC4((Item_GObj*) item_gobj, 1)) { + it_802E6888(item_gobj); + item->xD50_landNum = 0; + item->xDCF_flag.b0 = 0; + } + return false; +} -/// #it_802E67A8 +void it_802E6888(HSD_GObj* item_gobj) +{ + Item* item; -/// #it_802E67F4 + item = item_gobj->user_data; + item->x40_vel.z = 0.0f; + item->x40_vel.y = 0.0f; + item->x40_vel.x = 0.0f; + item->x5D0_animFrameSpeed = 1.0f; + Item_80268E5C(item_gobj, 2, ITEM_HIT_PRESERVE | ITEM_UNK_0x1); + if (item->xDD4_itemVar.it_2E5A.x8 == 1) { + item->on_accessory = it_802E6A74; + } +} -/// #it_802E6824 +bool it_802E68EC(HSD_GObj* item_gobj) +{ + return it_802E657C((Item_GObj*) item_gobj); +} -/// #it_802E6888 +void it_802E690C(HSD_GObj* item_gobj) {} -/// #it_802E68EC +bool it_802E6910(HSD_GObj* item_gobj) +{ + HSD_JObj* item_jobj; + Item* item; + PAD_STACK(54); -void it_802E690C(void) {} + item = item_gobj->user_data; + if ((item->xDD4_itemVar.it_2E5A.x8 == 1) && + !(it_802E5AC4((Item_GObj*) item_gobj, 0))) + { + item = item_gobj->user_data; + if (item->xDD4_itemVar.it_2E5A.x8 == 1) { + if (item->xDD4_itemVar.it_2E5A.xC) { + Item_80268E5C(item_gobj, 0, ITEM_HIT_PRESERVE | ITEM_UNK_0x1); + } else { + Item_80268E5C(item_gobj, 0, ITEM_ANIM_UPDATE); + item->xDD4_itemVar.it_2E5A.xC = 1; + item = item_gobj->user_data; + item_jobj = item_gobj->hsd_obj; + // item->xD0_itemStateDesc = + // item->xC4_article_data->x4_specialAttributes + (((s32) + // item->xDD4_itemVar.it_2E5A.x4 * 0x2C) + 0x40); + item->xD0_itemStateDesc = + ((it_2E5A_DatAttrs_2*) + item->xC4_article_data->x4_specialAttributes) + [item->xDD4_itemVar.it_2E5A.x4 + 1] + .x14; // index = 0x14; (0x40 - 0x2C = 0x14) + Item_80268D34(item_gobj, item->xD0_itemStateDesc); + HSD_JObjAnimAll(item_jobj); + } + item->on_accessory = it_802E6A74; + } else { + Item_80268E5C(item_gobj, 1, ITEM_ANIM_UPDATE); + item = item_gobj->user_data; + item_jobj = item_gobj->hsd_obj; + // item->xD0_itemStateDesc = + // item->xC4_article_data->x4_specialAttributes + (((s32) + // item->xDD4_itemVar.it_2E5A.x4 * 0x2C) + 0x40); + item->xD0_itemStateDesc = + ((it_2E5A_DatAttrs_2*) item->xC4_article_data + ->x4_specialAttributes)[item->xDD4_itemVar.it_2E5A.x4 + 1] + .x14; // index = 0x14; (0x40 - 0x2C = 0x14) + Item_80268D34(item_gobj, item->xD0_itemStateDesc); + HSD_JObjAnimAll(item_jobj); + } + } + return false; +} -/// #it_802E6910 +bool it_802E6A40(Item_GObj* item_gobj) +{ + lbAudioAx_80023870(0x93, 0x7F, 0x40, 0x1A); + return true; +} -/// #it_802E6A40 +void it_802E6A74(HSD_GObj* gobj) +{ + Item* item; + // Vec3* temp_r3; + it_2E5A_ItemVars_struct* temp_r6; -/// #it_802E6A74 + item = gobj->user_data; + if (item->xDD4_itemVar.it_2E5A.x8) { + temp_r6 = item->xDD4_itemVar.it_2E5A.x1C; + // temp_r3 = &item->xDD4_itemVar.it_2E5A.x1C->x8; + // temp_r6->x14 = *temp_r3; + // lb_8000B1CC(temp_r6->x4, NULL, temp_r3); + temp_r6->x14 = temp_r6->x8; + lb_8000B1CC(temp_r6->x4, NULL, &temp_r6->x8); + } +} -/// #it_802E6ACC +void it_802E6ACC(Item_GObj* item_gobj, HSD_GObj* ref_gobj) +{ + it_8026B894(item_gobj, ref_gobj); +} diff --git a/src/melee/it/items/it_2E5A.h b/src/melee/it/items/it_2E5A.h index 757394a2d7..8a636d6610 100644 --- a/src/melee/it/items/it_2E5A.h +++ b/src/melee/it/items/it_2E5A.h @@ -6,30 +6,32 @@ #include "it/forward.h" #include +#include "it/itCommonItems.h" #include "it/items/types.h" -/* 2E5AC4 */ UNK_RET it_802E5AC4(UNK_PARAMS); -/* 2E5EF4 */ int it_802E5EF4(Item_GObj*); -/* 2E5F00 */ UNK_RET it_802E5F00(UNK_PARAMS); -/* 2E5F8C */ s32 it_802E5F8C(Item_GObj*, Vec3*, s32, bool, float, float); -/* 2E609C */ UNK_RET it_802E609C(UNK_PARAMS); -/* 2E614C */ UNK_RET it_802E614C(UNK_PARAMS); -/* 2E61C4 */ UNK_RET it_802E61C4(UNK_PARAMS); -/* 2E628C */ UNK_RET it_802E628C(UNK_PARAMS); -/* 2E6380 */ UNK_RET it_802E6380(UNK_PARAMS); -/* 2E657C */ UNK_RET it_802E657C(UNK_PARAMS); -/* 2E6658 */ UNK_RET it_802E6658(UNK_PARAMS); -/* 2E66A0 */ UNK_RET it_802E66A0(UNK_PARAMS); -/* 2E67A8 */ UNK_RET it_802E67A8(UNK_PARAMS); -/* 2E67F4 */ UNK_RET it_802E67F4(UNK_PARAMS); -/* 2E6824 */ UNK_RET it_802E6824(UNK_PARAMS); -/* 2E6888 */ UNK_RET it_802E6888(UNK_PARAMS); -/* 2E68EC */ UNK_RET it_802E68EC(UNK_PARAMS); -/* 2E690C */ UNK_RET it_802E690C(UNK_PARAMS); -/* 2E6910 */ UNK_RET it_802E6910(UNK_PARAMS); +/* 2E5AC4 */ bool it_802E5AC4(Item_GObj*, bool); +/* 2E5EF4 */ s32 it_802E5EF4(Item_GObj*); +/* 2E5F00 */ void it_802E5F00(Item_GObj*, Vec3*, Vec3*, s32); +/* 2E5F8C */ s32 it_802E5F8C(Item_GObj*, Vec3*, s32, s32, f32, f32); +/* 2E609C */ s32 it_802E609C(it_802E5FXX_struct*, SpawnItem*); +/* 2E614C */ void it_802E614C(Item_GObj*, Item_GObj*, SpawnItem*, Vec3*, + Vec3*); +/* 2E61C4 */ s32 it_802E61C4(Item_GObj*, s32, s32); +/* 2E628C */ void it_802E628C(Item_GObj*, f32, f32); +/* 2E6380 */ s32 it_802E6380(Item_GObj*, it_802E5FXX_struct*); +/* 2E657C */ bool it_802E657C(Item_GObj*); +/* 2E6658 */ void it_802E6658(void); +/* 2E66A0 */ void it_802E66A0(HSD_GObj*); +/* 2E67A8 */ bool it_802E67A8(HSD_GObj*); +/* 2E67F4 */ void it_802E67F4(HSD_GObj*); +/* 2E6824 */ bool it_802E6824(HSD_GObj*); +/* 2E6888 */ void it_802E6888(HSD_GObj*); +/* 2E68EC */ bool it_802E68EC(HSD_GObj*); +/* 2E690C */ void it_802E690C(HSD_GObj*); +/* 2E6910 */ bool it_802E6910(HSD_GObj*); /* 2E6A40 */ bool it_802E6A40(Item_GObj*); -/* 2E6A74 */ UNK_RET it_802E6A74(UNK_PARAMS); -/* 2E6ACC */ void it_802E6ACC(Item_GObj*, Item_GObj*); +/* 2E6A74 */ void it_802E6A74(HSD_GObj*); +/* 2E6ACC */ void it_802E6ACC(Item_GObj*, HSD_GObj*); /* 3F8BD8 */ extern ItemStateTable it_803F8BD8[]; #endif diff --git a/src/melee/it/types.h b/src/melee/it/types.h index a6bb16d370..a0f5dbf64d 100644 --- a/src/melee/it/types.h +++ b/src/melee/it/types.h @@ -544,6 +544,7 @@ struct Item { union { it_266F_ItemVars it_266F; it_27CF_ItemVars it_27CF; + it_2E5A_ItemVars it_2E5A; it_2E6A_ItemVars_1 it_2E6A_1; it_2E6A_ItemVars_2 it_2E6A_2; it_2F28_ItemVars it_2F28; From 512ef3df536f989a7137a9704a2acec9678458bd Mon Sep 17 00:00:00 2001 From: Aaron B Date: Thu, 17 Oct 2024 11:03:17 -0400 Subject: [PATCH 12/25] Updating structs ordering --- src/melee/it/itCommonItems.h | 46 ++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index 0be6eb1225..d158639e70 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -394,29 +394,6 @@ typedef struct itTaruCann_DatAttrs { /* +2C */ int x2C; } itTaruCann_DatAttrs; -// Not sure if there is a way to combine these two structs? -typedef struct it_2E6A_ItemVars_1 { - /* +0 ip+DD4 */ s16 x0; - /* +0 ip+DD4 */ s16 x2; - /* +4 ip+DD8 */ HSD_JObj* x4; - /* +8 ip+DDC */ f32 x8; // unused? - /* +C ip+DE0 */ f32 xC; // unused? - /* +10 ip+DE4 */ void* x10; - /* +14 ip+DE8 */ void* x14; - /* +18 ip+DEC */ void* x18; - /* +1C ip+DF0 */ void* x1C; -} it_2E6A_ItemVars_1; - -typedef struct it_2E6A_ItemVars_2 { - /* +0 ip+DD4 */ s16 x0; - /* +0 ip+DD4 */ u16 x2; - /* +4 ip+DD8 */ Vec3 x4; - /* +10 ip+DE4 */ void* x10; - /* +14 ip+DE8 */ void* x14; - /* +18 ip+DEC */ void* x18; - /* +1C ip+DF0 */ void* x1C; -} it_2E6A_ItemVars_2; - typedef struct it_2E5A_ItemVars_struct { f32 x0; // set to float calc result/item->x3C HSD_JObj* x4; // set to item_gobj->hsd_obj @@ -504,6 +481,29 @@ typedef struct it_802E5FXX_struct { // used for it_802E5F00 and it_802E5F8C s32 x18; // non-float assignment (gm_8016C6C0) } it_802E5FXX_struct; +// Not sure if there is a way to combine these two structs? +typedef struct it_2E6A_ItemVars_1 { + /* +0 ip+DD4 */ s16 x0; + /* +0 ip+DD4 */ s16 x2; + /* +4 ip+DD8 */ HSD_JObj* x4; + /* +8 ip+DDC */ f32 x8; // unused? + /* +C ip+DE0 */ f32 xC; // unused? + /* +10 ip+DE4 */ void* x10; + /* +14 ip+DE8 */ void* x14; + /* +18 ip+DEC */ void* x18; + /* +1C ip+DF0 */ void* x1C; +} it_2E6A_ItemVars_1; + +typedef struct it_2E6A_ItemVars_2 { + /* +0 ip+DD4 */ s16 x0; + /* +0 ip+DD4 */ u16 x2; + /* +4 ip+DD8 */ Vec3 x4; + /* +10 ip+DE4 */ void* x10; + /* +14 ip+DE8 */ void* x14; + /* +18 ip+DEC */ void* x18; + /* +1C ip+DF0 */ void* x1C; +} it_2E6A_ItemVars_2; + // Should it_2F28 and it_27CF use the same structs? typedef struct it_27CF_ItemVars { f32 x0; From a3c4bfde097d1b252fa42c82272aba709f86e701 Mon Sep 17 00:00:00 2001 From: Aaron B Date: Thu, 17 Oct 2024 11:04:26 -0400 Subject: [PATCH 13/25] Redo ordering --- src/melee/it/itCommonItems.h | 52 ++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index d158639e70..f619f1488e 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -394,6 +394,32 @@ typedef struct itTaruCann_DatAttrs { /* +2C */ int x2C; } itTaruCann_DatAttrs; +// Should it_2F28 and it_27CF use the same structs? +typedef struct it_27CF_ItemVars { + f32 x0; +} it_27CF_ItemVars; + +typedef struct it_27CF_DatAttrs { + Vec3 pos; + Vec3 vel; + f32 float1; // lifetime + f32 float2; + f32 float3; // item var x0 + f32 x24; // item->xC98 + int x28; // ItemKind +} it_27CF_DatAttrs; + +typedef struct it_2F28_ItemVars { + f32 x0; +} it_2F28_ItemVars; + +struct it_2F28_DatAttrs { + Vec3 pos; + Vec3 vel; + f32 float1; // lifetime + f32 float2; // item var x0 +}; + typedef struct it_2E5A_ItemVars_struct { f32 x0; // set to float calc result/item->x3C HSD_JObj* x4; // set to item_gobj->hsd_obj @@ -504,30 +530,4 @@ typedef struct it_2E6A_ItemVars_2 { /* +1C ip+DF0 */ void* x1C; } it_2E6A_ItemVars_2; -// Should it_2F28 and it_27CF use the same structs? -typedef struct it_27CF_ItemVars { - f32 x0; -} it_27CF_ItemVars; - -typedef struct it_27CF_DatAttrs { - Vec3 pos; - Vec3 vel; - f32 float1; // lifetime - f32 float2; - f32 float3; // item var x0 - f32 x24; // item->xC98 - int x28; // ItemKind -} it_27CF_DatAttrs; - -typedef struct it_2F28_ItemVars { - f32 x0; -} it_2F28_ItemVars; - -struct it_2F28_DatAttrs { - Vec3 pos; - Vec3 vel; - f32 float1; // lifetime - f32 float2; // item var x0 -}; - #endif From 9b6e13a2baac0312762a5913442798068dbcf3c1 Mon Sep 17 00:00:00 2001 From: Aaron B Date: Mon, 13 Jan 2025 15:03:33 -0500 Subject: [PATCH 14/25] item file work --- src/common_structs.h | 4 +- src/melee/ft/ft_0881.h | 2 +- src/melee/ft/ft_0892.h | 4 +- src/melee/ft/ftaction.c | 2 +- src/melee/ft/ftcoll.c | 8 +- src/melee/ft/ftcoll.h | 4 + src/melee/ft/ftlib.c | 2 +- src/melee/ft/ftlib.h | 2 +- src/melee/ft/types.h | 11 +- src/melee/gm/gm_1601.h | 7 +- src/melee/gm/gm_1A36.h | 2 +- src/melee/gr/grzakogenerator.h | 4 +- src/melee/gr/stage.c | 8 +- src/melee/gr/stage.h | 2 +- src/melee/it/forward.h | 3 + src/melee/it/itCommonItems.h | 129 +- src/melee/it/it_266F.c | 1805 +++-- src/melee/it/it_266F.h | 105 +- src/melee/it/it_2725.c | 10151 +++++++++++++++++++++---- src/melee/it/it_2725.h | 358 +- src/melee/it/it_3F14.c | 1668 ++-- src/melee/it/itcoll.c | 1848 +++++ src/melee/it/itcoll.h | 29 +- src/melee/it/item.c | 39 +- src/melee/it/items/it_2E5A.c | 19 +- src/melee/it/items/itarwinglaser.h | 11 + src/melee/it/items/itcapsule.h | 2 +- src/melee/it/items/itchicorita.c | 269 +- src/melee/it/items/itchicorita.h | 35 +- src/melee/it/items/itchicoritaleaf.c | 93 +- src/melee/it/items/itchicoritaleaf.h | 13 +- src/melee/it/items/itcoin.c | 2 +- src/melee/it/items/itcoin.h | 2 +- src/melee/it/items/itfoxillusion.h | 7 +- src/melee/it/items/itgreatfoxlaser.h | 14 +- src/melee/it/items/ithassam.c | 3 +- src/melee/it/items/itklap.h | 12 +- src/melee/it/items/itkyasarin.h | 11 +- src/melee/it/items/itkyasarinegg.h | 16 + src/melee/it/items/itlikelike.h | 14 +- src/melee/it/items/itlinkarrow.c | 3 +- src/melee/it/items/itlinkarrow.h | 4 +- src/melee/it/items/itlinkbomb.c | 3 +- src/melee/it/items/itlinkboomerang.h | 2 +- src/melee/it/items/itmato.h | 2 +- src/melee/it/items/itnokonoko.h | 15 +- src/melee/it/items/itoldkuri.h | 2 +- src/melee/it/items/itpatapata.h | 16 +- src/melee/it/items/ittincle.h | 10 +- src/melee/it/items/ittools.h | 19 +- src/melee/it/items/itwhispyapple.h | 25 +- src/melee/it/items/itwhitebea.h | 14 +- src/melee/it/items/itzgshell.h | 20 +- src/melee/it/items/itzrshell.h | 11 +- src/melee/it/types.h | 207 +- src/melee/lb/lb_00B0.h | 2 +- src/melee/lb/lb_00F9.h | 8 +- src/melee/lb/lbaudio_ax.h | 2 +- src/melee/lb/lbcollision.c | 4 +- src/melee/lb/lbcollision.h | 6 +- src/melee/lb/types.h | 8 +- src/melee/mp/mpcoll.h | 10 +- src/melee/mp/mplib.h | 2 +- src/melee/pl/pl_0371.h | 4 +- src/melee/pl/plattack.h | 2 +- src/melee/pl/plbonuslib.h | 3 + src/melee/pl/pltrick.h | 10 + src/melee/ty/tydisplay.h | 1 + src/sysdolphin/baselib/jobj.h | 45 + 69 files changed, 13786 insertions(+), 3394 deletions(-) diff --git a/src/common_structs.h b/src/common_structs.h index f7b3713f9e..8e523d93be 100644 --- a/src/common_structs.h +++ b/src/common_structs.h @@ -56,9 +56,11 @@ typedef u32 HSD_Pad; #define MPCOLL_FLAGS_B11 (1 << 11) #define MPCOLL_CEIL 0x6000 ///< Bits 13-14 #define MPCOLL_FLAGS_B14 (1 << 14) -#define MPCOLL_UNK 0x18000 +#define MPCOLL_UNK 0x18000 // Floor?? #define MPCOLL_GRPUSH (1 << 15) #define MPCOLL_FLAGS_B16 (1 << 16) +#define MPCOLL_FLAGS_B20 (1 << 20) //0x100000 +#define MPCOLL_FLAGS_B21 (1 << 21) //0x200000 #define MPCOLL_FLAGS_B23 (1 << 23) #define MPCOLL_FLAGS_B24 (1 << 24) #define MPCOLL_FLAGS_B25 (1 << 25) diff --git a/src/melee/ft/ft_0881.h b/src/melee/ft/ft_0881.h index 07090be4f1..83101af41b 100644 --- a/src/melee/ft/ft_0881.h +++ b/src/melee/ft/ft_0881.h @@ -27,7 +27,7 @@ /* 088C5C */ void ft_80088C5C(Fighter_GObj* gobj); /* 0890BC */ void ft_800890BC(Fighter* fp); /* 0890D0 */ void ft_800890D0(Fighter* fp, u32 move_id); -/* 089228 */ UNK_RET ft_80089228(UNK_PARAMS); +/* 089228 */ float ft_80089228(Fighter*, s32, s32, f32); /* 0892A0 */ void ft_800892A0(Fighter_GObj* gobj); #endif diff --git a/src/melee/ft/ft_0892.h b/src/melee/ft/ft_0892.h index 4fae585dd5..f53247bc0e 100644 --- a/src/melee/ft/ft_0892.h +++ b/src/melee/ft/ft_0892.h @@ -6,12 +6,12 @@ /* 0892D4 */ void ft_800892D4(Fighter*); /* 089460 */ UNK_RET ft_80089460(UNK_PARAMS); /* 0895E0 */ void ft_800895E0(Fighter*, int); -/* 089768 */ UNK_RET ft_80089768(UNK_PARAMS); +/* 089768 */ void ft_80089768(Vec2*); /* 089824 */ void ft_80089824(Fighter_GObj* gobj); /* 089884 */ union Struct2070* ft_80089884(Fighter_GObj* gobj); /* 089890 */ UNK_T ft_80089890(Fighter_GObj* gobj); /* 08989C */ u16 ft_8008989C(Fighter_GObj* gobj); -/* 0898A8 */ UNK_T ft_800898A8(Fighter_GObj* gobj); +/* 0898A8 */ struct Struct2074* ft_800898A8(Fighter_GObj* gobj); /* 0898B4 */ int ft_800898B4(Fighter_GObj* gobj); /* 0898C0 */ UNK_RET ft_800898C0(UNK_PARAMS); /* 089914 */ UNK_RET ft_80089914(UNK_PARAMS); diff --git a/src/melee/ft/ftaction.c b/src/melee/ft/ftaction.c index 790ad6a652..832cafd1ea 100644 --- a/src/melee/ft/ftaction.c +++ b/src/melee/ft/ftaction.c @@ -482,7 +482,7 @@ void ftAction_80071784(Fighter_GObj* gobj, FtCmdState* cmd) cmd->x8 += 4; } -void ftAction_800717C8(Fighter_GObj* gobj, FtCmdState* cmd) +void ftAction_800717C8(Fighter_GObj* gobj, *cmd) { cmd->x8 += 4; } diff --git a/src/melee/ft/ftcoll.c b/src/melee/ft/ftcoll.c index 053486d5be..fcd35e61d6 100644 --- a/src/melee/ft/ftcoll.c +++ b/src/melee/ft/ftcoll.c @@ -65,8 +65,8 @@ STATIC_ASSERT(sizeof(DmgLogEntry) == 0x28); /* 07A06C */ static void ftColl_8007A06C(float facing_dir, DmgLogEntry** log, int idx, bool); -/* 076808 */ static void ftColl_80076808(Fighter* fp, HitCapsule* hit, int, - Fighter* victim, bool); +// /* 076808 */ static void ftColl_80076808(Fighter* fp, HitCapsule* hit, int, +// Fighter* victim, bool); // .data IntVec3 ftColl_803C0C40 = { 141, 142, 143 }; @@ -285,7 +285,7 @@ void ftColl_80076764(int arg0, enum_t arg1, Fighter_GObj* arg2, } } -void ftColl_80076808(Fighter* fp, HitCapsule* hit, int arg2, Fighter* victim, +void ftColl_80076808(Fighter* fp, HitCapsule* hit, int arg2, void* victim, bool arg4) { s8 j; @@ -520,7 +520,7 @@ struct ftCollSFX lbl_803C0C40 = { /// @todo #ftColl_80076808 inline void inlineB0(Fighter* fp0, HitCapsule* hitbox, Fighter* fp1, int arg3, - bool (*cb)(HitCapsule* hit, int arg1, Fighter* fp)) + bool (*cb)(HitCapsule* hit, int arg1, void* fp)) { size_t i; for (i = 0; i < ARRAY_SIZE(fp0->x914); i++) { diff --git a/src/melee/ft/ftcoll.h b/src/melee/ft/ftcoll.h index 6500fc7cd0..cf792414a3 100644 --- a/src/melee/ft/ftcoll.h +++ b/src/melee/ft/ftcoll.h @@ -55,6 +55,10 @@ /* 079AB0 */ UNK_RET ftColl_80079AB0(UNK_PARAMS); /* 079C70 */ float ftColl_80079C70(Fighter*, Fighter*, void*, int); /* 079EA8 */ float ftColl_80079EA8(Fighter*, HitCapsule*, int); +// /* 07A06C */ static void ftColl_8007A06C(float facing_dir, DmgLogEntry** log, +// int idx, bool); +/* 076808 */ static void ftColl_80076808(Fighter* fp, HitCapsule* hit, int, + void* victim, bool); /* 07AB48 */ void ftColl_8007AB48(Fighter_GObj*); /* 07AB80 */ void ftColl_8007AB80(Fighter_GObj*); /* 07ABD0 */ void ftColl_8007ABD0(HitCapsule*, u32 damageAmount, diff --git a/src/melee/ft/ftlib.c b/src/melee/ft/ftlib.c index a998c5645b..f1ba70b289 100644 --- a/src/melee/ft/ftlib.c +++ b/src/melee/ft/ftlib.c @@ -947,7 +947,7 @@ s32 ftLib_800874BC(HSD_GObj* gobj) return fp->x221F_b4; } -void ftLib_800874CC(HSD_GObj* gobj, s32 arg1, s32 arg2) +void ftLib_800874CC(HSD_GObj* gobj, void* arg1, s32 arg2) { Fighter* fp = GET_FIGHTER(gobj); pl_8003E4A4(fp->player_id, fp->x221F_b4, arg1, arg2); diff --git a/src/melee/ft/ftlib.h b/src/melee/ft/ftlib.h index 9d5dcd1d7b..f277e84183 100644 --- a/src/melee/ft/ftlib.h +++ b/src/melee/ft/ftlib.h @@ -91,7 +91,7 @@ /* 087460 */ u32 ftLib_80087460(HSD_GObj*); /* 08746C */ s32 ftLib_8008746C(HSD_GObj*); /* 0874BC */ s32 ftLib_800874BC(HSD_GObj*); -/* 0874CC */ void ftLib_800874CC(HSD_GObj*, s32, s32); +/* 0874CC */ void ftLib_800874CC(HSD_GObj*, void*, s32); /* 087508 */ void ftLib_80087508(s8, u8); /* 087574 */ void ftLib_80087574(s8); /* 087610 */ void ftLib_80087610(u8); diff --git a/src/melee/ft/types.h b/src/melee/ft/types.h index a0b1cf4481..100f868196 100644 --- a/src/melee/ft/types.h +++ b/src/melee/ft/types.h @@ -868,6 +868,14 @@ struct Fighter_DemoStrings { /* fp+2070 */ s32 x2070_int; }; +/// @todo See if this should likewise be instituted for item->xD94 thru xDA4_word/xDA8_short +/* fp+2074 */ struct Struct2074 { + /* fp+2074 */ Vec2 x2074_vec; + /* fp+207C */ Vec2 x207C; + /* fp+2084 */ u32 x2084; + /* fp+2088 */ u16 x2088; +}; + struct ftSubactionList { u8 x0_opcode; }; @@ -1410,8 +1418,7 @@ struct Fighter { /* fp+206C */ u16 x206C_attack_instance; /* fp+206E */ short x206E; /* fp+2070 */ union Struct2070 x2070; - /* fp+2074 */ int x2074; - /* fp+2074 */ u8 _2078[0x208C - 0x2078]; + /* fp+2074 */ struct Struct2074 x2074; /* fp+208C */ s32 x208C; /* fp+2090 */ u16 x2090; /* fp+2092 */ u16 x2092; diff --git a/src/melee/gm/gm_1601.h b/src/melee/gm/gm_1601.h index 383cd1ad13..956c7f13ce 100644 --- a/src/melee/gm/gm_1601.h +++ b/src/melee/gm/gm_1601.h @@ -5,6 +5,7 @@ #include #include "gm/forward.h" +#include "it/forward.h" /* 1601C4 */ UNK_RET gm_801601C4(UNK_PARAMS); /* 160244 */ UNK_RET gm_80160244(UNK_PARAMS); @@ -120,7 +121,7 @@ /* 164B48 */ UNK_RET fn_80164B48(UNK_PARAMS); /* 164F18 */ UNK_RET gm_80164F18(UNK_PARAMS); /* 16505C */ UNK_RET gm_8016505C(UNK_PARAMS); -/* 165084 */ UNK_RET gm_80165084(UNK_PARAMS); +/* 165084 */ bool gm_80165084(void); /* 1650E8 */ UNK_RET fn_801650E8(UNK_PARAMS); /* 165108 */ UNK_RET fn_80165108(UNK_PARAMS); /* 165190 */ UNK_RET fn_80165190(UNK_PARAMS); @@ -299,8 +300,8 @@ /* 16C4F4 */ UNK_RET fn_8016C4F4(UNK_PARAMS); /* 16C5C0 */ bool gm_8016C5C0(int pl_slot); /* 16C658 */ UNK_RET gm_8016C658(UNK_PARAMS); -/* 16C6C0 */ /* static */ UNK_RET gm_8016C6C0(UNK_PARAMS); -/* 16C6C0 */ UNK_RET gm_8016C6C0(UNK_PARAMS); +/* 16C6C0 */ /* static */ s32 gm_8016C6C0(Item_GObj*); +/* 16C6C0 */ s32 gm_8016C6C0(Item_GObj*); /* 16C75C */ /* static */ UNK_RET gm_8016C75C(UNK_PARAMS); /* 16C75C */ UNK_RET gm_8016C75C(UNK_PARAMS); /* 16C7D0 */ UNK_RET fn_8016C7D0(UNK_PARAMS); diff --git a/src/melee/gm/gm_1A36.h b/src/melee/gm/gm_1A36.h index 041e3d4c88..c478e1c15e 100644 --- a/src/melee/gm/gm_1A36.h +++ b/src/melee/gm/gm_1A36.h @@ -478,7 +478,7 @@ /* 1BEBA8 */ UNK_RET gm_801BEBA8(UNK_PARAMS); /* 1BEBC0 */ UNK_RET gm_801BEBC0(UNK_PARAMS); /* 1BEBF8 */ UNK_RET gm_801BEBF8(UNK_PARAMS); -/* 1BEC54 */ UNK_RET gm_801BEC54(UNK_PARAMS); +/* 1BEC54 */ void* gm_801BEC54(void); /* 1BEC80 */ UNK_RET gm_801BEC80(UNK_PARAMS); /* 1BECA8 */ UNK_RET gm_801BECA8(UNK_PARAMS); /* 1BECD0 */ UNK_RET gm_801BECD0(UNK_PARAMS); diff --git a/src/melee/gr/grzakogenerator.h b/src/melee/gr/grzakogenerator.h index aebe9a6425..4725e58ded 100644 --- a/src/melee/gr/grzakogenerator.h +++ b/src/melee/gr/grzakogenerator.h @@ -5,7 +5,9 @@ #include "gr/types.h" -void grZakoGenerator_801CACB8(Ground_GObj* gobj); +/* 1CAC14 */ void grZakoGenerator_801CAC14(void); +/* 1CACB8 */ void grZakoGenerator_801CACB8(Ground_GObj* gobj); /* 1CAE04 */ void grZakoGenerator_801CAE04(bool); + #endif diff --git a/src/melee/gr/stage.c b/src/melee/gr/stage.c index fef5526c1f..0f464e40ee 100644 --- a/src/melee/gr/stage.c +++ b/src/melee/gr/stage.c @@ -267,7 +267,7 @@ void Stage_80224E64(enum_t arg0, Vec3* arg_vec) Ground_801C2D24(arg0, arg_vec); } -s32 Stage_80224FDC(Vec3* arg0) +bool Stage_80224FDC(Vec3* arg0) { s32 rand_output; s32 counter = 0x15; @@ -275,7 +275,7 @@ s32 Stage_80224FDC(Vec3* arg0) while (counter != 0) { if (Ground_801C2D24(HSD_Randi(counter) + 0x7F, arg0)) { - return 1; + return true; } counter += -1; } @@ -286,12 +286,12 @@ s32 Stage_80224FDC(Vec3* arg0) counter2 = Ground_801C2D24(rand_output, arg0); if (counter2 != 0) { - return 1; + return true; } counter2 = rand_output; } - return 0; + return false; } s32 Stage_80225074(s32 arg0) diff --git a/src/melee/gr/stage.h b/src/melee/gr/stage.h index 0c557cef99..697abe304e 100644 --- a/src/melee/gr/stage.h +++ b/src/melee/gr/stage.h @@ -39,7 +39,7 @@ /* 224DC8 */ bool Stage_80224DC8(s32); /* 224E38 */ void Stage_80224E38(Vec3*, s32); /* 224E64 */ void Stage_80224E64(enum_t, Vec3*); -/* 224FDC */ s32 Stage_80224FDC(Vec3*); +/* 224FDC */ bool Stage_80224FDC(Vec3*); /* 225074 */ s32 Stage_80225074(s32); /* 225194 */ enum_t Stage_80225194(void); /* 22519C */ s32 Stage_8022519C(InternalStageId idx); diff --git a/src/melee/it/forward.h b/src/melee/it/forward.h index baa9080fca..f2c8265eff 100644 --- a/src/melee/it/forward.h +++ b/src/melee/it/forward.h @@ -1,6 +1,7 @@ #ifndef MELEE_IT_FORWARD_H #define MELEE_IT_FORWARD_H +#include "ft/forward.h" #include typedef struct Article Article; @@ -55,6 +56,8 @@ struct Item_GObj { typedef HSD_GObj Item_GObj; #endif +typedef void (*ItCmd)(Item_GObj* gobj, FtCmdState* cmd); + typedef enum Item_StateChangeFlags { ITEM_UNK_0x1 = (1 << 0), ITEM_ANIM_UPDATE = (1 << 1), diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index f619f1488e..f3ad2c19ea 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -299,7 +299,8 @@ typedef struct itPokemonAttributes { } itPokemonAttributes; typedef struct { - u8 padding[0xE34 - 0xDD4]; + s16 x0; + u8 padding[0xE34 - 0xDD8]; s32 timer; int x64; } itPokemon_ItemVars; @@ -394,6 +395,128 @@ typedef struct itTaruCann_DatAttrs { /* +2C */ int x2C; } itTaruCann_DatAttrs; +typedef struct itKlap_ItemVars { + /* +0 ip+DD4 */ f32 x0; + /* +4 ip+DD8 */ f32 x4; + /* +8 ip+DDC */ f32 x8; + /* +C ip+DE0 */ f32 xC; + /* +10 ip+DE4 */ f32 x10; + /* +14 ip+DE8 */ f32 x14; + /* +18 ip+DEC */ f32 x18; + /* +1C ip+DF0 */ f32 x1C; + /* +20 ip+DF4 */ f32 x20; + /* +24 ip+DF8 */ f32 x24; + /* +28 ip+DFC */ f32 x28; +} itKlap_ItemVars; + +typedef struct itChicorita_ItemVars { + /* ip+DD4 */ u8 _0[0x60 - 0x0]; + /* ip+E34 */ s32 x60; // timer? + /* ip+E38 */ f32 x64; // y vel +} itChicorita_ItemVars; + +typedef struct itChicoritaAttr { + f32 scale; + s32 x4; // x60 in item vars gets set to this if -1; max timer/lifetime? +} itChicoritaAttr; + +typedef struct itChicoritaLeafAttr { + f32 timer; + f32 x4; + f32 x8; // x pos + f32 xC; // y pos + f32 x10; // x vel +} itChicoritaLeafAttr; + +typedef struct it_2728_DatAttrs { + Fighter* fighter; +} it_2728_DatAttrs; + +typedef struct it_279D_ItemVars { + /* ip+DD4 */ s32 x0; + /* ip+DD8 */ Vec3 x4; + /* ip+DE4 */ Vec3 x10; + /* ip+DF0 */ f32 x1C; + /* ip+DF4 */ f32 x20; + /* ip+DF8 */ f32 x24; + /* ip+DFC */ f32 x28; + /* ip+E00 */ f32 x2C[6]; + // /* ip+E04 */ s32 x30; // scale? + // /* ip+E08 */ s32 x34; + // /* ip+E0C */ s32 x38; + // /* ip+E10 */ s32 x3C; + // /* ip+E14 */ s32 x40; + /* ip+E18 */ f32 x44; + /* ip+E1C */ f32 x48; + /* ip+E20 */ f32 x4C; // scale + /* ip+E24 */ f32 x50; + /* ip+E28 */ s32 x54; + /* ip+E2C */ s32 x58; // used as an index back into this struct? + /* ip+E30 */ s32 x5C; +} it_279D_ItemVars; + +typedef struct it_279D_DatAttrs { + f32 x0; + f32 x4; + f32 x8; + f32 xC; + f32 x10; + f32 x14; + f32 x18; + f32 x1C[6]; + // f32 x20; + // f32 x24; + // f32 x28; + // f32 x2C; + // f32 x30; + f32 x34; + s32 x38; + s32 x3C[160]; + // f32 x3C; + // f32 x40; + // f32 x44; + // f32 x48; + // f32 x4C; + // f32 x50; + // f32 x54; + // f32 x58; + // f32 x5C; + // s32 x60[160]; + // f32 padding[0x248 - 0x4C]; + // f32 x248; +} it_279D_DatAttrs; + +typedef struct it_27B5_ItemVars { + /* ip+DD4 */ HSD_JObj* x0; + /* ip+DD8 */ s32 x4; + /* ip+DDC */ Vec3 x8; + /* ip+DE8 */ S32Vec3 x14; + /* ip+DF4 */ s32 x20; + /* ip+DF8 */ s32 x24; + /* ip+DFC */ s32 x28; + /* ip+E00 */ f32 x2C; + /* ip+E04 */ s32 x30; // scale? + /* ip+E08 */ s32 x34; + /* ip+E0C */ s32 x38; + /* ip+E10 */ s32 x3C; + /* ip+E14 */ s32 x40; + /* ip+E18 */ f32 x44; + /* ip+E1C */ s32 x48; + /* ip+E20 */ f32 x4C; // scale + /* ip+E24 */ f32 x50; + /* ip+E28 */ s32 x54; + /* ip+E2C */ s32 x58; + /* ip+E30 */ s32 x5C; +} it_27B5_ItemVars; + +typedef struct it_27B5_DatAttrs { + f32 scale; +} it_27B5_DatAttrs; + +typedef struct it_27CE_ItemVars { + /* ip+DD4 */ void* attr; +} it_27CE_ItemVars; + // Should it_2F28 and it_27CF use the same structs? typedef struct it_27CF_ItemVars { f32 x0; @@ -510,7 +633,7 @@ typedef struct it_802E5FXX_struct { // used for it_802E5F00 and it_802E5F8C // Not sure if there is a way to combine these two structs? typedef struct it_2E6A_ItemVars_1 { /* +0 ip+DD4 */ s16 x0; - /* +0 ip+DD4 */ s16 x2; + /* +2 ip+DD6 */ s16 x2; /* +4 ip+DD8 */ HSD_JObj* x4; /* +8 ip+DDC */ f32 x8; // unused? /* +C ip+DE0 */ f32 xC; // unused? @@ -522,7 +645,7 @@ typedef struct it_2E6A_ItemVars_1 { typedef struct it_2E6A_ItemVars_2 { /* +0 ip+DD4 */ s16 x0; - /* +0 ip+DD4 */ u16 x2; + /* +2 ip+DD6 */ u16 x2; /* +4 ip+DD8 */ Vec3 x4; /* +10 ip+DE4 */ void* x10; /* +14 ip+DE8 */ void* x14; diff --git a/src/melee/it/it_266F.c b/src/melee/it/it_266F.c index 4ea85ee60a..741fa74ff6 100644 --- a/src/melee/it/it_266F.c +++ b/src/melee/it/it_266F.c @@ -1,5 +1,3 @@ - - #include #include "it/it_266F.h" @@ -17,6 +15,8 @@ #include "it/it_26B1.h" #include "it/it_2725.h" #include "it/item.h" +#include "it/items/it_2E5A.h" +#include "lb/lb_00F9.h" #include "lb/lbcollision.h" #include "lb/lbgx.h" #include "mp/mpcoll.h" @@ -32,196 +32,238 @@ #include #include -extern ItemCommonData* it_804D6D28; extern HSD_ObjAllocUnk Item_804A0C64; +extern HSD_ObjAllocUnk4 it_804A0E30; +extern HSD_ObjAllocUnk6 it_804A0E50; +extern HSD_ObjAllocUnk6 it_804A0E60; +extern ItemCommonData* it_804D6D28; + +extern u64 __shr2u(u64, u32, s32); + +static Quaternion it_803B8560 = { 0.0f, 0.0f, 1.0f, 0.0f }; +static Vec3 it_803B8570 = { 0.0f, 0.0f, 0.0f }; +static Vec3 it_803B857C = { 0.0f, 0.0f, 0.0f }; +static Quaternion it_803B8588 = { 0.0f, 0.0f, 0.0f, 0.0f }; +static Quaternion it_803B8598 = { 0.0f, 0.0f, 0.0f, 0.0f }; +static const Vec3 it_803B85A8[6] = { + { 1.0f, 0.0f, 0.0f }, + { 0.0f, 0.0f, 1.0f }, + { 0.0f, 1.0f, 0.0f }, + { 0.0f, 1.0f, 0.0f }, + { 0.0f, 1.0f, 0.0f }, + { 0.0f, 1.0f, 0.0f }, +}; +static s32 it_803B85F0[4]; -s32 lb_800149E0(f32*, u32); /* extern */ static U8Vec4 it_804D5168 = { 0xFF, 0x40, 0x80, 0x80 }; -void it_8026C47C(struct it_8026C47C_arg0_t* arg0) +// static f64 it_804DC698 = S32_TO_F32; +// static f32 it_804DC6A0 = 0.0f; +// static f32 it_804DC6A4 = 0.99f; +// static f32 it_804DC6A8 = 0.0f; +// static f32 it_804DC6AC = 0.00001f; +// static f64 it_804DC6B0 = 0.0f; +// static f32 it_804DC6B8 = 0.0f; +// static f32 it_804DC6BC = 2.0f; +// static Vec2 it_804DC6C0 = { 0.5f, 0.0f }; + +void it_8026C47C(struct it_8026C47C_arg0_t* arg_struct) { s32* var_r28; - s32 var_r29; - u32 var_r30; - f32 pad[2]; + s32 var_r29; // Hold Kind?? + ItemKind it_kind; + PAD_STACK(8); - var_r30 = 0; + it_kind = It_Kind_Capsule; var_r29 = 0; - var_r28 = (s32*) arg0; - arg0->unk0 = 0; - arg0->unk4 = 0; - arg0->unk8 = 0; - arg0->unkC = 0; - arg0->unk10 = 0; - arg0->unk14 = 0; - arg0->unk18 = 0; - arg0->unk1C = 0; - while (var_r30 < 238) { - if (it_80272828(var_r30) != 0U) { + var_r28 = (s32*) arg_struct; + arg_struct->unk0 = 0; + arg_struct->unk4 = 0; + arg_struct->unk8 = 0; + arg_struct->unkC = 0; + arg_struct->unk10 = 0; + arg_struct->unk14 = 0; + arg_struct->unk18 = 0; + arg_struct->unk1C = 0; + while (it_kind < 238U) { + if (it_80272828(it_kind)) { *var_r28 |= 1 << var_r29; } - var_r30 += 1; - var_r29 += 1; - if (!(var_r30 & 0x1F)) { + it_kind++; + var_r29++; + if (!(it_kind & It_Kind_RabbitC)) { var_r29 = 0; - var_r28 += 1; + var_r28++; } } } -#if 0 -s32 it_8026C530(s32 arg0, void *arg1, s32 arg2, s32 arg3) { - s32 temp_r10; +s32 it_8026C530(s32 arg0, HSD_ObjAllocUnk6* arg1, s32 arg2, s32 arg3) +{ + u16* temp_r10; s32 temp_r5; s32 temp_r6; s32 temp_r7; - s32 temp_r7_2; + // s32 temp_r7_2; s32 temp_r7_3; - s32 temp_r8; + // s32 temp_r8; s32 temp_r9; s32 temp_r9_2; s32 var_r5; var_r5 = arg2; - temp_r8 = arg3 - 1; - if (var_r5 == temp_r8) { + // temp_r8 = arg3 - 1; + if (var_r5 == (arg3 - 1)) { return var_r5; } - temp_r10 = arg1->unkC; - temp_r9 = (s32) (var_r5 + arg3) / 2; - temp_r7_2 = temp_r9 * 2; - if ((s32) *(temp_r10 + temp_r7_2) > arg0) { - if (var_r5 == (s32) (temp_r9 - 1)) { - + temp_r10 = arg1->xC; + temp_r9 = (var_r5 + arg3) / 2; + // temp_r7_2 = temp_r9 * 2; + // temp_r7_2 = temp_r9; + // if ((s32) *(temp_r10 + temp_r7_2) > arg0) { + // if (((s32) *temp_r10[temp_r7_2])->x0 > arg0) { + if (temp_r10[temp_r9] > arg0) { + if (var_r5 == (temp_r9 - 1)) { } else { - temp_r6 = (s32) (var_r5 + temp_r9) / 2; - temp_r7_3 = temp_r6 * 2; - if ((s32) *(temp_r10 + temp_r7_3) > arg0) { - var_r5 = it_8026C530(); - } else if ((s32) (temp_r10 + temp_r7_3)->unk2 > arg0) { + temp_r6 = (var_r5 + temp_r9) / 2; + temp_r7_3 = temp_r6 * 1; + // if ((s32) *(temp_r10 + temp_r7_3) > arg0) { + // if (temp_r10[temp_r7_3]->x0 > arg0) { + if (temp_r10[temp_r7_3] > arg0) { + var_r5 = it_8026C530(arg0, arg1, var_r5, temp_r6); + // } else if ((s32) (temp_r10 + temp_r7_3)->unk2 > arg0) { + // } else if (temp_r10[temp_r7_3]->x2 > arg0) { + } else if (temp_r10[temp_r7_3] > arg0) { var_r5 = temp_r6; } else { - var_r5 = it_8026C530(temp_r6, temp_r9); + var_r5 = it_8026C530(arg0, arg1, temp_r6, temp_r9); } } return var_r5; } - temp_r9_2 = temp_r10 + 2; - if ((s32) *(temp_r9_2 + temp_r7_2) > arg0) { + temp_r9_2 = (s32) temp_r10 + 2; + // temp_r9_2 = temp_r10->x2; + // if ((s32) *(temp_r9_2 + temp_r7_2) > arg0) { + if ((temp_r9_2 + temp_r9) > arg0) { return temp_r9; } - if (temp_r9 == temp_r8) { + if (temp_r9 == arg3 - 1) { return temp_r9; } temp_r7 = (s32) (temp_r9 + arg3) / 2; - temp_r5 = temp_r7 * 2; - if ((s32) *(temp_r10 + temp_r5) > arg0) { - return it_8026C530(temp_r9, temp_r7); - } - if ((s32) *(temp_r9_2 + temp_r5) > arg0) { + // temp_r5 = temp_r7 * 2; + temp_r5 = temp_r7; + // if ((s32) *(temp_r10 + temp_r5) > arg0) { + if (temp_r10[temp_r5] > arg0) { + return it_8026C530(arg0, arg1, temp_r9, temp_r7); + } + // if ((s32) *(temp_r9_2 + temp_r5) > arg0) { + if ((temp_r9_2 + temp_r5) > arg0) { return temp_r7; } - return it_8026C530(temp_r7); + return it_8026C530(arg0, arg1, temp_r7, arg3); } -#endif // argument is definitely size 0x10 -u8 it_8026C65C(HSD_ObjAllocUnk6* arg0) +u8 it_8026C65C(HSD_ObjAllocUnk6* arg_struct) { - s32 temp_r3; - s32 temp_r4; - s32* temp_r5; + s32 rand_int; s32 temp_r6; s32 var_r3; - u8 temp_r31; - s32 val; + u16* temp_r5; - temp_r3 = HSD_Randi(arg0->x8); - if ((arg0->x0 - 1) == 0) { + rand_int = HSD_Randi((s32) arg_struct->x8); + if ((arg_struct->x0 - 1) == 0) { var_r3 = 0; } else { - temp_r6 = (s32) arg0->x0 / 2; - temp_r4 = temp_r6 * 2; - val = arg0->xC[temp_r6]; - if (val > temp_r3) { - var_r3 = it_8026C530(0, arg0, 0, temp_r6); - } else if (arg0->xC[temp_r6 + 1] > temp_r3) { + temp_r5 = arg_struct->xC; + temp_r6 = arg_struct->x0 / 2; + if (temp_r5[temp_r6] > rand_int) { + var_r3 = it_8026C530(rand_int, arg_struct, 0, temp_r6); + // } else if (temp_r5[temp_r6].unk2 > rand_int) { + // } else if (temp_r5[temp_r6] > rand_int) { + // } else if ((&temp_r5[temp_r6] + 2) > rand_int) { + } else if ((arg_struct->x0 << 2) > rand_int) { var_r3 = temp_r6; } else { - var_r3 = it_8026C530(0, arg0, temp_r6, (s32) arg0->x0); + var_r3 = + it_8026C530(rand_int, arg_struct, temp_r6, arg_struct->x0); } } - return arg0->x4[var_r3]; + return arg_struct->x4[var_r3]; } -s32 it_8026C704(void) +bool it_8026C704(void) { - s32 var_r31; + bool chk; - var_r31 = 0; - if ((Item_804A0C64.x1C >= Item_804A0C64.x20) || (it_8026D324(34) == 0)) { - var_r31 = 1; + chk = false; + if ((Item_804A0C64.x1C >= Item_804A0C64.x20) || + (it_8026D324(It_Kind_M_Ball) == false)) + { + chk = true; } - return var_r31; + return chk; } -s8 it_8026C75C(HSD_ObjAllocUnk6* arg0) +// Decides item kind for spawned items - not sure in which context (i.e from +// pokeballs, from capsules, thin air, etc.) +ItemKind it_8026C75C(HSD_ObjAllocUnk6* arg_struct) { s32 temp_r0; - s32 var_r29; - s32 var_r31; - u16 temp_r5; + s32 chk2; + bool chk1; u16 var_r30; - u8 temp_r0_2; u8 temp_r4; - u8 var_r3; + ItemKind kind; + PAD_STACK(4); - var_r31 = it_8026C704(); - var_r29 = 0; - if (arg0->x8 == 0) { + chk1 = it_8026C704(); // Check if pokeball or Item_804A0C64.x1C >= + // Item_804A0C64.x20 (something related to hold kind) + chk2 = false; + if (arg_struct->x8 == 0) { return -1; } - if (var_r31 != 0) { - temp_r4 = arg0->x0; - if (arg0->x4[temp_r4 - 1] == 34) { - temp_r0 = arg0->x0 - 1; + if (chk1) { + temp_r4 = arg_struct->x0; + if (arg_struct->x4[temp_r4 - 1] == It_Kind_M_Ball) { + temp_r0 = arg_struct->x0 - 1; if (temp_r0 < 1) { return -1; } - var_r30 = arg0->x8; - var_r29 = 1; - arg0->x8 = arg0->xC[temp_r0]; - arg0->x0 -= 1; + var_r30 = arg_struct->x8; + chk2 = true; + arg_struct->x8 = arg_struct->xC[temp_r0]; + arg_struct->x0 -= 1; } } - var_r3 = arg0->x4[it_8026C530(HSD_Randi((s32) arg0->x8), arg0, 0, - (s32) arg0->x0)]; - if ((var_r31 != 0) && (var_r29 != 0)) { - arg0->x8 = var_r30; - arg0->x0 += 1; - if ((s32) var_r3 == 34) { - var_r3 = -1; + kind = arg_struct->x4[it_8026C530(HSD_Randi(arg_struct->x8), arg_struct, 0, + arg_struct->x0)]; + if (chk1 && chk2) { + arg_struct->x8 = var_r30; + arg_struct->x0 += 1; + if (kind == It_Kind_M_Ball) { + kind = -1; } } - return var_r3; + return kind; } +// .L_8026C88C void fn_8026C88C(HSD_GObj* gobj) { - Item_GObj* temp_r3; - Item_GObj* temp_ret; - s32 var_r4; - Item_GObj* spawn_gobj; SpawnItem spawn; - s32 temp_r4; + bool chk; + f32* temp_r29; + // PAD_STACK(18); if (db_80225D54(&it_804A0E30) != 0U) { - it_804A0E30.x0 -= 1; + it_804A0E30.x0--; if ((s32) it_804A0E30.x0 == 0) { spawn.kind = it_8026C75C(&it_804A0E30.x4); if ((s32) spawn.kind != -1) { - if (it_8026CB3C(&spawn.prev_pos) != 0) { + if (it_8026CB3C(&spawn.prev_pos)) { spawn.pos = spawn.prev_pos; spawn.facing_dir = it_8026B684(&spawn.prev_pos); spawn.x3C_damage = 0; @@ -229,11 +271,11 @@ void fn_8026C88C(HSD_GObj* gobj) spawn.x4_parent_gobj2 = spawn.x0_parent_gobj = NULL; spawn.x44_flag.b0 = 1; spawn.x40 = 0; - var_r4 = 1; + chk = true; } else { - var_r4 = 0; + chk = false; } - if (var_r4 != 0) { + if (chk) { spawn_gobj = Item_80268B18(&spawn); if (spawn_gobj != NULL) { efSync_Spawn(0x420, spawn_gobj, &spawn.prev_pos); @@ -241,115 +283,209 @@ void fn_8026C88C(HSD_GObj* gobj) } } } - { - // @todo: Make a FLT_RAND(min, max) define or inline - f32* temp_r29 = - ((f32*) it_804D6D28) + (gm_8016AE80() * 8) + 0xFC; - it_804A0E30.x0 = - (s32) (((temp_r29[4] - temp_r29[0]) * HSD_Randf()) + - (f32) temp_r29[0]); - it_804A0E30.x0 = (s32) ((f32) it_804A0E30.x0 * - Ground_801C2AE8(Stage_80225194())); - } + // @todo: Make a FLT_RAND(min, max) define or inline + temp_r29 = ((f32*) it_804D6D28) + (gm_8016AE80() * 8) + 0xFC; + it_804A0E30.x0 = + (s32) (((temp_r29[4] - temp_r29[0]) * HSD_Randf()) + + (f32) temp_r29[0]); + it_804A0E30.x0 = (s32) ((f32) it_804A0E30.x0 * + Ground_801C2AE8(Stage_80225194())); } } } -void it_8026CA4C(u16* arg0, s32* arg1, u64 arg2, s32 arg4, f32 arg8) +void it_8026CA4C(u16* arg0, s32* arg1, u64 arg2, s32 arg3, f32 arg4) { +#if 1 u64 var_r5; s32* var_r28; s32 var_r31; s32 var_r27; var_r5 = arg2; - var_r31 = arg4; - var_r28 = arg1 + arg4; + var_r31 = arg3; + var_r28 = arg1 + arg3; var_r27 = 0; - while (var_r31 < 0x23) { + while (var_r31 < It_Kind_L_Gun_Ray) { if (((var_r5 & 1) ^ 0) != 0) { - var_r27 = ((f32) var_r27 + ((arg8 * (f32) *var_r28) + 0.99f)); + var_r27 = ((f32) var_r27 + ((arg4 * (f32) *var_r28) + 0.99f)); } - var_r28 += 1; - var_r31 += 1; + var_r28++; + var_r31++; var_r5 = var_r5 >> 1; } arg0[4] = var_r27; +#else + s16 var_r27; + s32 var_r31; + s32 var_r6; + s32* var_r28; + u64 temp_r3; + u64 temp_ret; + u64 var_r5; + + var_r5 = arg2; + var_r6 = arg3; + var_r31 = M2C_ERROR(/* Read from unset register $r7 */); + var_r28 = arg1 + arg3; + var_r27 = 0; + while (var_r31 < It_Kind_L_Gun_Ray) { + if ((((var_r6 & 1) ^ 0) | ((var_r5 & 0) ^ 0)) != 0) { + var_r27 = + (s16) ((f32) var_r27 + ((arg4 * (f32) *var_r28) + 0.99f)); + } + var_r28 += 4; + var_r31++; + temp_ret = __shr2u(var_r5, (u32) var_r6, 1); + temp_r3 = temp_ret; + var_r6 = (s32) (u32) temp_ret; + var_r5 = temp_r3; + } + arg0[4] = var_r27; +#endif } -s32 it_8026CB3C(Vec3* arg0) +bool it_8026CB3C(Vec3* vec) { - if (Stage_80224FDC(arg0) == 0) { - return 0; + if (!Stage_80224FDC(vec)) { + return false; } - arg0->z = 0.0f; - if (mpColl_8004D024(arg0) != 0) { - return 0; + vec->z = 0.0f; + if (mpColl_8004D024(vec)) { + return false; } - return 1; + return true; } -void it_8026CB9C(s32* arg0, u64 arg2, u32 arg3, f32 arg8) +// Builds some structs for items +void it_8026CB9C(s32* arg0, u64 arg2, f32 arg8) { - s32 temp_r26; + s32 struct_size; { u64 var_r5; s32* var_r28; - s32 var_r31; - s32 var_r27; + ItemKind it_kind; + s32 cnt; var_r5 = arg2; - var_r31 = 0; + it_kind = 0; var_r28 = arg0; - var_r27 = 0; - while (var_r31 < 35) { + cnt = 0; + while (it_kind < It_Kind_L_Gun_Ray) { if (((var_r5 & 1) ^ 0) != 0 && *var_r28 != 0) { - var_r27 += 1; + cnt++; } - var_r28 += 1; - var_r31 += 1; + var_r28++; + it_kind++; var_r5 = var_r5 >> 1; } - temp_r26 = var_r27 * 4; - it_804A0E30.x4.x0 = var_r27; - it_804A0E30.x4.x4 = (u8*) HSD_MemAlloc(temp_r26); - it_804A0E30.x4.xC = (u16*) HSD_MemAlloc(temp_r26); + struct_size = cnt * 4; + it_804A0E30.x4.x0 = cnt; + it_804A0E30.x4.x4 = (u8*) HSD_MemAlloc(struct_size); + it_804A0E30.x4.xC = (u16*) HSD_MemAlloc(struct_size); } { u64 var_r5; s32* var_r28; s32 var_r31; - s32 var_r27; - s32 var_r26_2; + ItemKind it_kind; + s32 cnt; s32 var_r29; s32 var_r25; - var_r26_2 = 0; + cnt = 0; var_r5 = arg2; var_r28 = arg0; var_r29 = 0; - var_r27 = 0; + it_kind = It_Kind_Capsule; // 0 var_r25 = 0; - while (var_r27 < 35) { + while (it_kind < It_Kind_L_Gun_Ray) { if (((var_r5 & 1) ^ 0) != 0 && *var_r28 != 0) { - it_804A0E30.x4.x4[var_r26_2] = var_r27; - var_r26_2 += 1; + it_804A0E30.x4.x4[cnt] = it_kind; + cnt++; it_804A0E30.x4.xC[var_r29] = var_r25; + // it_804A0E30.x4.xC[2 * cnt] = var_r25; var_r29 += 2; var_r25 = (s16) ((f32) var_r25 + ((arg8 * (f32) *var_r28) + 0.99f)); } - var_r28 += 1; - var_r27 += 1; + var_r28++; + it_kind++; var_r5 = var_r5 >> 1; } } } -/// #it_8026CD50 +// extern HSD_ObjAllocUnk4 it_804A0E30; +void it_8026CD50(s32* arg0, u64 arg1, f32 arg2) +{ + s16 var_r25; + s32 struct_size; + ItemKind it_kind; // r26 + s32 var_r29; + s32* var_r28; + s32* var_r28_2; + s32 cnt; // r27 + u32 var_r6; + u64 temp_ret; + u64 var_r5; + + var_r6 = (u32) arg1; + var_r5 = arg1; + // r29 = it_804A0E30; + var_r28 = arg0 + 0x18; + cnt = 0; + it_kind = It_Kind_BombHei; // 6 + // r30 = 1 + // r31 = 0 + while (it_kind < It_Kind_L_Gun_Ray) { + if (((((var_r5 << 8 & 1) ^ 0) | ((var_r6 & 0) ^ 0))) && + ((s32) *var_r28 != 0)) + { + cnt++; + } + var_r28 += 4; + it_kind++; + temp_ret = __shr2u(var_r5, var_r6, 1); + var_r6 = (u32) temp_ret; + // var_r5 = temp_ret; + // var_r5 = var_r5 >> 1; + } + struct_size = cnt * 4; + // it_804A0E30.unk20 = cnt; + // it_804A0E30.unk24 = HSD_MemAlloc(struct_size); + // it_804A0E30.unk2C = HSD_MemAlloc(struct_size); + it_804A0E50.x0 = cnt; + it_804A0E50.x4 = HSD_MemAlloc(struct_size); + it_804A0E50.xC = HSD_MemAlloc(struct_size); + cnt = 0; + var_r6 = (u32) arg1; + // var_r5 = arg1; + var_r28_2 = arg0 + 0x18; + var_r29 = 0; + var_r25 = 0; + it_kind = It_Kind_BombHei; // 6 + while (it_kind < It_Kind_L_Gun_Ray) { + if (((((var_r5 & 1) ^ 0) | ((var_r6 & 0) ^ 0)) != 0) && + ((s32) *var_r28_2 != 0)) + { + *(it_804A0E50.x4 + cnt) = it_kind; + cnt++; + *(it_804A0E50.xC + var_r29) = var_r25; + var_r29 += 2; + var_r25 = var_r25 + ((arg2 * *var_r28_2) + 0.99f); + } + var_r28_2 += 4; + it_kind++; + temp_ret = __shr2u(var_r5, var_r6, 1); + var_r6 = (u32) temp_ret; + var_r5 = temp_ret; + } +} +// Builds structs for monster items void it_8026CF04(void) { s16 temp_r4; @@ -360,52 +496,52 @@ void it_8026CF04(void) // @todo: probably a double somewhere temp_r4 = it_804D6D28->x128 + it_804D6D28->x12C + it_804D6D28->x130 + it_804D6D28->x134; - // @todo: Investigate why it_804A0E30 is used instead of it_804A0E50. + // @todo: Investigate why it_804A0E30 is used instead of it_804A0E60. if (temp_r4 != 0) { - it_804A0E50.x8 = temp_r4; - it_804A0E50.x0 = 4U; - temp_r30 = it_804A0E50.x4; - it_804A0E50.x4 = (u8*) HSD_MemAlloc(it_804A0E50.x0 * 4); - it_804A0E50.xC = (u16*) HSD_MemAlloc(it_804A0E50.x0 * 4); - temp_r30[0] = 0x2B; - it_804A0E50.xC[0] = 0; + it_804A0E60.x8 = temp_r4; + it_804A0E60.x0 = 4U; + temp_r30 = it_804A0E60.x4; + it_804A0E60.x4 = (u8*) HSD_MemAlloc(it_804A0E60.x0 * 4); + it_804A0E60.xC = (u16*) HSD_MemAlloc(it_804A0E60.x0 * 4); + temp_r30[0] = It_Kind_Kuriboh; + it_804A0E60.xC[0] = 0; temp_r8 = it_804D6D28->x128; - temp_r30[1] = 0x2C; - it_804A0E50.xC[1] = (s16) temp_r8; + temp_r30[1] = It_Kind_Leadead; + it_804A0E60.xC[1] = (s16) temp_r8; temp_r8_2 = temp_r8 + it_804D6D28->x12C; - temp_r30[2] = 0x2D; - it_804A0E50.xC[2] = temp_r8_2; - temp_r30[3] = 0x2E; - it_804A0E50.xC[3] = temp_r8_2 + it_804D6D28->x130; + temp_r30[2] = It_Kind_Octarock; + it_804A0E60.xC[2] = temp_r8_2; + temp_r30[3] = It_Kind_Ottosea; + it_804A0E60.xC[3] = temp_r8_2 + it_804D6D28->x130; } } void it_8026D018(void) { - s32 var_r29; - if ((gm_8016B238() == 0) && (gm_8016AE80() != -1)) { +#if 1 + bool chk; + if (!gm_8016B238() && (gm_8016AE80() != -1)) { it_804A0E30.x18 = gm_8016AEA4(); - var_r29 = 0; + chk = false; { u64 temp_r28 = it_804A0E30.x18; - s32* temp_r26 = (s32*) Ground_801C2AD8(); - s32 temp_r30 = gm_8016AE80(); + s32* temp_r26 = (s32*) Ground_801C2AD8(); // stage_info.xA0 + bool chk2 = gm_8016AE80(); f32 temp_f31 = gm_8016AE94(); - if (((temp_r28 ^ 0) == 0) || (temp_r26 == NULL) || - (temp_r30 == -1)) - { - var_r29 = 0; + // chk = false; + if (((temp_r28 ^ 0) == 0) || (temp_r26 == NULL) || (chk2 == -1)) { + chk = false; } else { it_8026CA4C((u16*) &it_804A0E30.x4.x0, temp_r26, temp_r28, 0, temp_f31); if ((u16) it_804A0E30.x4.x8 == 0) { } else { - it_8026CB9C(temp_r26, temp_r28, 0, temp_f31); - var_r29 = 1; + it_8026CB9C(temp_r26, temp_r28, temp_f31); + chk = true; } } } - if (var_r29 != 0) { + if (chk) { { u64 temp_r26_2 = it_804A0E30.x18; s32* temp_r28_2 = (s32*) Ground_801C2AD8(); @@ -414,7 +550,9 @@ void it_8026D018(void) u64 temp_r3 = temp_r26_2 >> 6; it_8026CA4C((u16*) &it_804A0E30.x4.x0, temp_r28_2, temp_r26_2, 6, temp_f31_2); - if (*(u16*) ((u8*) &it_804A0E30 + 0x28) != 0) { + // if (*(u16*) ((u8*) &it_804A0E30 + 0x28) != 0) { + if (it_804A0E30.x4.x8 != 0) { + // if (it_804A0E50.x8 != 0) { it_8026CD50(temp_r28_2, temp_r3, temp_f31_2); } } @@ -433,109 +571,141 @@ void it_8026D018(void) } } } +#else + u64 temp_r28; + s32* temp_r26; + u64 temp_r3; + bool chk2; + bool chk; + f32 temp_f31; + f32* temp_r29; + + if (!gm_8016B238() && (gm_8016AE80() != -1)) { + it_804A0E30.x18 = gm_8016AEA4(); + // chk = false; + temp_r28 = it_804A0E30.x18; + temp_r26 = (s32*) Ground_801C2AD8(); // stage_info.xA0 + chk2 = gm_8016AE80(); + temp_f31 = gm_8016AE94(); + if (((temp_r28 ^ 0) == 0) || (temp_r26 == NULL) || (chk2 == -1)) { + chk = false; + } else { + it_8026CA4C((u16*) &it_804A0E30.x4.x0, temp_r26, temp_r28, 0, + temp_f31); + if ((u16) it_804A0E30.x4.x8 == 0) { + } else { + it_8026CB9C(temp_r26, temp_r28, temp_f31); + chk = true; + } + } + if (chk) { + temp_r28 = it_804A0E30.x18; + temp_r26 = (s32*) Ground_801C2AD8(); + temp_f31 = gm_8016AE94(); + if (((temp_r28 ^ 0) != 0) && (temp_r26 != NULL)) { + temp_r3 = temp_r28 >> 6; + it_8026CA4C((u16*) &it_804A0E30.x4.x0, temp_r26, temp_r28, 6, + temp_f31); + // if (*(u16*) ((u8*) &it_804A0E30 + 0x28) != 0) { + if (it_804A0E30.x4.x8 != 0) { + // if (it_804A0E50.x8 != 0) { + it_8026CD50(temp_r26, temp_r3, temp_f31); + } + } + it_8026CF04(); + HSD_GObjProc_8038FD54(GObj_Create(5U, 7U, 0U), fn_8026C88C, 0U); + + // @todo: Make a FLT_RAND(min, max) define or inline + temp_r29 = it_804D6D28 + ((gm_8016AE80() * 8) + 0xFC); + it_804A0E30.x0 = + ((temp_r29[4] - temp_r29[0]) * HSD_Randf()) + temp_r29[0]; + it_804A0E30.x0 = + it_804A0E30.x0 * Ground_801C2AE8(Stage_80225194()); + } + } +#endif } -#if 0 -s32 it_8026D258(void *arg0, s32 arg1) { - u8 sp54; - s32 sp50; - s16 sp4C; - f32 sp48; - f32 sp44; - f32 sp40; - f32 sp3C; - f32 sp38; - s32 sp34; - s32 sp30; - f32 sp2C; - s32 sp28; - s32 sp24; - s32 sp18; - s32 sp14; - s32 sp10; - s32 temp_r0; - s32 temp_r4; - s32 var_r7; - - var_r7 = 0; - if ((s32) Item_804A0C64.x60 < (s32) Item_804A0C64.x64) { - sp18 = arg1; - temp_r4 = arg0->unk0; - temp_r0 = arg0->unk4; - sp30 = temp_r4; - sp34 = temp_r0; - sp38 = arg0->unk8; - sp38 = 0.0f; - sp24 = temp_r4; - sp28 = temp_r0; - sp2C = sp38; - sp48 = it_8026B684((Vec3 *) &sp30); - sp4C = 0; - sp44 = 0.0f; - sp40 = 0.0f; - sp3C = 0.0f; - sp10 = 0; - sp14 = sp10; - sp54 |= 0x80; - sp50 = 0; - Item_80268B9C((SpawnItem *) &sp10); - var_r7 = 1; - } - return var_r7; +// Spawn item of specified kind at specified position (but no z-offset) +bool it_8026D258(Vec3* pos, ItemKind kind) +{ + SpawnItem spawn; + bool item_spawn_chk; + + item_spawn_chk = false; + if (Item_804A0C64.x60 < Item_804A0C64.x64) { + spawn.kind = kind; + spawn.prev_pos = *pos; + spawn.prev_pos.z = 0.0f; + spawn.pos = spawn.prev_pos; + spawn.facing_dir = it_8026B684(&spawn.prev_pos); + spawn.x3C_damage = 0; + spawn.vel.z = 0.0f; + spawn.vel.y = 0.0f; + spawn.vel.x = 0.0f; + spawn.x0_parent_gobj = NULL; + spawn.x4_parent_gobj2 = spawn.x0_parent_gobj; + spawn.x44_flag.b0 = 1; + spawn.x40 = 0; + Item_80268B9C(&spawn); + item_spawn_chk = true; + } + return item_spawn_chk; } -#endif -bool it_8026D324(s32 arg0) +bool it_8026D324(ItemKind kind) { u64 temp_r29; s32 temp_r3; - u32 temp_r28; - u64 temp_ret; u8* temp_r30; temp_r29 = it_804A0E30.x18; - temp_r30 = Ground_801C2AD8(); + temp_r30 = Ground_801C2AD8(); // u8* [4] temp_r3 = gm_8016AE80(); if ((((temp_r29 ^ 0)) == 0) || (temp_r30 == NULL) || (temp_r3 == -1)) { - return 0; + return false; } - temp_ret = temp_r29 >> arg0; - if (((temp_ret & 1) ^ 0) == 0) { - return 0; + temp_r29 = temp_r29 >> kind; + if (((temp_r29 & 1) ^ 0) == 0) { + return false; } - return 1; + return true; } -s32 it_8026D3CC(void) +bool it_8026D3CC(void) { - return it_8026D324(9) | it_8026D324(18) | it_8026D324(8); + return it_8026D324(It_Kind_Tomato) | it_8026D324(It_Kind_Foods) | + it_8026D324(It_Kind_Heart); } -void it_8026D564(Item_GObj* gobj) +void it_8026D564(Item_GObj* item_gobj) { bool test; - Item* ip = GET_ITEM(gobj); + Item* ip = GET_ITEM((HSD_GObj*) item_gobj); CollData* coll = &ip->x378_itemColl; - it_80276214(gobj); PAD_STACK(4); + + it_80276214(item_gobj); test = mpColl_8004B108(coll); ip->pos = coll->cur_topn; - if (test != 0) { + if (test) { ip->xC30 = coll->floor.index; } } -void it_8026D5CC(Item_GObj* gobj) +void it_8026D5CC(Item_GObj* item_gobj) { - Item* ip = GET_ITEM(gobj); + Item* ip = GET_ITEM((HSD_GObj*) item_gobj); CollData* coll = &ip->x378_itemColl; - it_80276214(gobj); + + it_80276214(item_gobj); mpColl_8004B108(coll); } -s32 it_8026D604(HSD_GObj* gobj) +bool it_8026D604(Item_GObj* item_gobj) { - Item* ip = GET_ITEM(gobj); + Item* ip = GET_ITEM((HSD_GObj*) item_gobj); + return mpLib_80054ED8(ip->xC30); } @@ -554,16 +724,16 @@ void it_8026D62C(Item_GObj* gobj, HSD_GObjEvent arg1) test = mpColl_8004B108(coll); ip->pos = coll->cur_topn; - if (test != 0) { + if (test != false) { ip->xC30 = (u32) coll->floor.index; } - if (test == 0) { + if (test == false) { it_802762BC(ip); - arg1(gobj); + arg1((HSD_GObj*) gobj); return; } if ((it_80277544(gobj) != 0) && !ip->xDCD_flag.b3) { - Item_8026ADC0(gobj); + Item_8026ADC0((HSD_GObj*) gobj); } } @@ -582,11 +752,11 @@ void it_8026D6F4(Item_GObj* gobj, HSD_GObjEvent arg1) test = mpColl_8004B108(coll); ip->pos = coll->cur_topn; - if (test != 0) { + if (test != false) { ip->xC30 = coll->floor.index; } - if (test == 0) { - arg1(gobj); + if (test == false) { + arg1((HSD_GObj*) gobj); } } @@ -605,11 +775,11 @@ void it_8026D78C(Item_GObj* gobj, HSD_GObjEvent arg1) test = mpColl_8004B108(coll); ip->pos = coll->cur_topn; - if (test != 0) { + if (test != false) { ip->xC30 = coll->floor.index; } - if (test == 0) { - arg1(gobj); + if (test == false) { + arg1((HSD_GObj*) gobj); it_802762BC(ip); } } @@ -629,15 +799,15 @@ void it_8026D82C(Item_GObj* gobj) test = mpColl_8004B108(coll); ip->pos = coll->cur_topn; - if (test != 0) { + if (test) { ip->xC30 = coll->floor.index; } - if (test == 0) { + if (!test) { it_802762BC(ip); } } -s32 it_8026D8A4(Item_GObj* gobj, HSD_GObjEvent arg1) +bool it_8026D8A4(Item_GObj* gobj, HSD_GObjEvent arg1) { Item* ip; CollData* coll; @@ -654,27 +824,27 @@ s32 it_8026D8A4(Item_GObj* gobj, HSD_GObjEvent arg1) test = mpColl_8004B2DC(coll); ip->pos = coll->cur_topn; - if (test != 0) { + if (test != false) { ip->xC30 = coll->floor.index; } - if (it_802762D8(gobj) != 0) { - arg1(gobj); + if (it_802762D8(gobj) != false) { + arg1((HSD_GObj*) gobj); } return test; } void it_8026D938(Item_GObj* gobj, HSD_GObjEvent arg1) { - Item* ip = gobj->user_data; - if (mpLib_80054ED8(ip->xC30) == 0) { + Item* ip = GET_ITEM((HSD_GObj*) gobj); + if (mpLib_80054ED8(ip->xC30) == false) { ip->xC30 = -1; - arg1(gobj); + arg1((HSD_GObj*) gobj); } } bool it_8026D9A0(Item_GObj* gobj) { - Item* item = GET_ITEM(gobj); + Item* item = GET_ITEM((HSD_GObj*) gobj); CollData* coll_data = &item->x378_itemColl; it_80276214(gobj); { @@ -703,7 +873,7 @@ bool it_8026DA08(Item_GObj* gobj) test = mpColl_800471F8(coll); ip->pos = coll->cur_topn; - if (test != 0) { + if (test) { ip->xC30 = coll->floor.index; } return test; @@ -711,61 +881,65 @@ bool it_8026DA08(Item_GObj* gobj) bool it_8026DA70(Item_GObj* gobj) { - Item* item = GET_ITEM(gobj); + Item* item = GET_ITEM((HSD_GObj*) gobj); CollData* coll = &item->x378_itemColl; + it_80276214(gobj); return mpColl_800471F8(coll); } -s32 it_8026DAA8(Item_GObj* gobj) +bool it_8026DAA8(Item_GObj* gobj) { CollData* coll; Item* ip; bool test; - ip = GET_ITEM(gobj); + PAD_STACK(12); + + ip = GET_ITEM((HSD_GObj*) gobj); coll = &ip->x378_itemColl; it_80276214(gobj); - PAD_STACK(12); test = mpColl_800471F8(coll); ip->pos = coll->cur_topn; - if (test != 0) { + if (test != false) { ip->xC30 = coll->floor.index; } test |= it_80276308(gobj); - return test | it_802763E0(gobj); + test |= it_802763E0(gobj); + return test; } -s32 it_8026DB40(Item_GObj* gobj) +bool it_8026DB40(Item_GObj* gobj) { CollData* coll; Item* ip; bool test; - ip = GET_ITEM(gobj); + PAD_STACK(12); + + ip = GET_ITEM((HSD_GObj*) gobj); coll = &ip->x378_itemColl; it_80276214(gobj); - PAD_STACK(12); test = mpColl_800471F8(coll); ip->pos = coll->cur_topn; - if (test != 0) { + if (test != false) { ip->xC30 = coll->floor.index; } return test |= it_80276308(gobj); } -s32 it_8026DBC8(HSD_GObj* gobj) +bool it_8026DBC8(Item_GObj* gobj) { - if ((it_8026DDFC(gobj) != 0) && (it_8026DC24(gobj) != 0)) { + if (it_8026DDFC(gobj) && it_8026DC24(gobj)) { it_802725D4(gobj); return it_8026DD5C(gobj); } - return 0; + return false; } -s32 it_8026DC24(HSD_GObj* gobj) +bool it_8026DC24(Item_GObj* gobj) { - Item* ip = GET_ITEM(gobj); + Item* ip = GET_ITEM((HSD_GObj*) gobj); ItemAttr* attr = ip->xCC_item_attr; if (ip->xD50_landNum <= 1) { @@ -779,119 +953,133 @@ s32 it_8026DC24(HSD_GObj* gobj) ip->x40_vel.y = 0.0f; } if (fabs_inline(ip->x40_vel.x) <= attr->x5c) { - if (!(fabs_inline(ip->x40_vel.y) <= attr->x5c)) { - return 0; + if ((fabs_inline(ip->x40_vel.y) <= attr->x5c)) { + goto block_18a8; } } - if (ip->xDCD_flag.b3 || (attr->x58 == 0.0f)) { + if (ip->xDCD_flag.b4 || (attr->x58 == 0.0f)) { + block_18a8: ip->x40_vel.x = ip->x40_vel.y = ip->x40_vel.z = 0.0F; - return 1; + return true; } - return 0; + return false; } -s32 it_8026DD5C(Item_GObj* gobj) +bool it_8026DD5C(Item_GObj* gobj) { - Item* ip = GET_ITEM(gobj); + Item* ip = GET_ITEM((HSD_GObj*) gobj); + ip->xD50_landNum = 0; it_802762B0(ip); - if ((it_80277040(gobj) == 0) || ip->xDCD_flag.b3) { + if (!it_80277040(gobj) || ip->xDCD_flag.b3) { it_80274740(gobj); it_80276CEC(gobj); - return 1; - } - if (ip->xB8_itemLogicTable->entered_air != NULL) { - Item_8026ADC0(gobj); - return 0; + } else { + if (ip->xB8_itemLogicTable->entered_air != NULL) { + Item_8026ADC0((HSD_GObj*) gobj); + return false; + } + it_802734B4(gobj); } - it_802734B4(gobj); - return 1; + return true; } -s32 it_8026DDFC(Item_GObj* gobj) +bool it_8026DDFC(Item_GObj* gobj) { - Item* ip = GET_ITEM(gobj); - ip->xD50_landNum += 1; - if ((u32) ip->xD50_landNum == 1U) { + Item* ip = GET_ITEM((HSD_GObj*) gobj); + + ip->xD50_landNum += 1U; + if (ip->xD50_landNum == 1U) { if (ip->xD54_throwNum != 0U) { - if ((((ip->xD54_throwNum == - ((u32) (it_804D6D28->x48_float >> 4U) & 0xF)) != 0)) || + if ((ip->xD54_throwNum == + ((it_804D6D28->x48_float >> 4U) & 0xF)) || (HSD_Randi(it_804D6D28->x48_float & 0xF) == 0)) { ip->destroy_type = 1; Item_8026A8EC(gobj); + return false; } - return 0; } } - return 1; + return true; } -s32 it_8026DE98(Item_GObj* arg0) +bool it_8026DE98(Item_GObj* gobj) { - return it_8026DDFC(arg0); + return it_8026DDFC(gobj); } -s32 it_8026DF34(Item_GObj* gobj) +bool it_8026DF34(Item_GObj* gobj) { bool cond; CollData* coll; Item* ip; - ip = GET_ITEM(gobj); - coll = &ip->x378_itemColl; PAD_STACK(12); + + ip = GET_ITEM((HSD_GObj*) gobj); + coll = &ip->x378_itemColl; it_80276214(gobj); cond = mpColl_800471F8(coll); ip->pos = coll->cur_topn; if (cond) { - ip->xC30 = (u32) coll->floor.index; + ip->xC30 = coll->floor.index; } if (cond) { - return 1; + return true; } - return 0; + return false; } -s32 it_8026DFB0(Item_GObj* gobj) +bool it_8026DFB0(Item_GObj* gobj) { +#if 1 bool cond; CollData* coll; Item* ip; - ip = GET_ITEM(gobj); - coll = &ip->x378_itemColl; PAD_STACK(26); + + ip = GET_ITEM((HSD_GObj*) gobj); + coll = &ip->x378_itemColl; it_80276214(gobj); cond = mpColl_800471F8(coll); ip->pos = coll->cur_topn; if (cond) { - ip->xC30 = (u32) coll->floor.index; + ip->xC30 = coll->floor.index; } cond |= it_80276308(gobj); - if ((cond | it_802763E0(gobj)) & 0xF) { - return 1; + cond |= it_802763E0(gobj); + if (cond & 0xF) { + return true; } - return 0; + return false; +#else + if (it_8026E_inline(gobj)) { + return true; + } + return false; +#endif } -s32 it_8026E058(Item_GObj* gobj) +bool it_8026E058(Item_GObj* gobj) { bool cond; CollData* coll; Item* ip; - ip = GET_ITEM(gobj); - coll = &ip->x378_itemColl; PAD_STACK(26); + + ip = GET_ITEM((HSD_GObj*) gobj); + coll = &ip->x378_itemColl; it_80276214(gobj); cond = mpColl_800471F8(coll); ip->pos = coll->cur_topn; if (cond) { - ip->xC30 = (u32) coll->floor.index; + ip->xC30 = coll->floor.index; } cond |= it_80276308(gobj); if (cond & 0xD) { - return 1; + return true; } - return 0; + return false; } void it_8026E0F4(Item_GObj* gobj) @@ -899,32 +1087,55 @@ void it_8026E0F4(Item_GObj* gobj) bool cond; CollData* coll; Item* ip; - ip = GET_ITEM(gobj); - coll = &ip->x378_itemColl; PAD_STACK(16); + + ip = GET_ITEM((HSD_GObj*) gobj); + coll = &ip->x378_itemColl; + it_80276214(gobj); + cond = mpColl_800477E0(coll); + ip->pos = coll->cur_topn; + if (cond) { + ip->xC30 = coll->floor.index; + } +} + +inline bool it_8026E_inline(Item_GObj* gobj) +{ + bool cond; + CollData* coll; + Item* ip; + PAD_STACK(26); + + ip = GET_ITEM((HSD_GObj*) gobj); + coll = &ip->x378_itemColl; it_80276214(gobj); cond = mpColl_800471F8(coll); ip->pos = coll->cur_topn; if (cond) { - ip->xC30 = (u32) coll->floor.index; + ip->xC30 = coll->floor.index; } + cond |= it_80276308(gobj); + cond |= it_802763E0(gobj); + return cond & 0xF; } void it_8026E15C(Item_GObj* gobj, HSD_GObjEvent arg1) { - s32 var_r3; - bool res = it_8026DFB0(gobj); + bool res2; + bool res = it_8026E_inline(gobj); + PAD_STACK(14); + if (res) { - it_80276FC4(gobj); + it_80276FC4(gobj, res); if (res & 1) { - if ((it_8026DDFC(gobj) != 0) && (it_8026DC24(gobj) != 0)) { + if (it_8026DDFC(gobj) && it_8026DC24(gobj)) { it_802725D4(gobj); - var_r3 = it_8026DD5C(gobj); + res2 = it_8026DD5C(gobj); } else { - var_r3 = 0; + res2 = false; } - if (var_r3 != 0) { - arg1(gobj); + if (res2 != false) { + arg1((HSD_GObj*) gobj); } } } @@ -932,78 +1143,452 @@ void it_8026E15C(Item_GObj* gobj, HSD_GObjEvent arg1) void it_8026E248(Item_GObj* gobj, HSD_GObjEvent arg1) { - s32 var_r3; - bool res = it_8026DFB0(gobj); + bool res2; + bool res = it_8026E_inline(gobj); + PAD_STACK(18); + if (res) { - it_80276FC4(gobj); + it_80276FC4(gobj, res); if (res & 1) { - if ((it_8026DE98(gobj) != 0) && (it_8026DC24(gobj) != 0)) { - var_r3 = it_8026DD5C(gobj); + if (it_8026DE98(gobj) && it_8026DC24(gobj)) { + res2 = it_8026DD5C(gobj); } else { - var_r3 = 0; + res2 = false; } - if (var_r3 != 0) { - arg1(gobj); + if (res2 != false) { + arg1((HSD_GObj*) gobj); } } } } +#if 0 +bool it_8026E32C(Item_GObj* item_gobj, HSD_GObjEvent arg1) { + bool chk = it_8026DFB0(item_gobj); + bool chk2; + + if (chk) { + it_80276FC4(item_gobj, chk); + if (chk & 1) { + item_gobj->user_data->xD50_landNum += 1; + if (it_8026DC24(item_gobj)) { + chk2 = it_8026DD5C(item_gobj); + } else { + chk2 = false; + } + if (chk2) { + arg1((HSD_GObj*) item_gobj); + } + } + } + return chk; +} -/// #it_8026E32C +void it_8026E414(Item_GObj* item_gobj, HSD_GObjEvent arg1) { + bool chk = it_8026DF34(item_gobj); + + chk |= it_80276308(item_gobj); + chk |= it_802763E0(item_gobj); + if (chk & 0xE) { + it_80276FC4(item_gobj, chk); + } + if (chk & 1) { + it_80275DFC(item_gobj); + it_802762B0(item_gobj->user_data); + arg1((HSD_GObj*) item_gobj); + } +} -/// #it_8026E414 +void it_8026E4D0(Item_GObj* item_gobj, HSD_GObjEvent arg1) { + bool chk = it_8026DF34(item_gobj); -/// #it_8026E4D0 + chk |= it_80276308(item_gobj); + chk |= it_802763E0(item_gobj); + if (chk & 0xE) { + it_80276FC4(item_gobj, chk); + } + if (chk & 1) { + it_80275DFC(item_gobj); + it_802762B0(item_gobj->user_data); + arg1((HSD_GObj*) item_gobj); + it_80272F7C(item_gobj->hsd_obj, item_gobj->user_data->xCC_item_attr->x60_scale); + } +} -/// #it_8026E5A0 +void it_8026E5A0(Item_GObj* item_gobj, HSD_GObjEvent arg1) { + bool chk = it_8026DFB0(item_gobj); -/// #it_8026E664 + if (chk) { + it_80276FC4(item_gobj, chk); + if (chk & 1) { + it_80275DFC(item_gobj); + it_802762B0(item_gobj->user_data); + } + arg1((HSD_GObj*) item_gobj); + } +} -/// #it_8026E71C +void it_8026E664(Item_GObj* item_gobj, HSD_GObjEvent arg1) { + bool chk = it_8026E058(item_gobj); -/// #it_8026E7E0 + if (chk) { + if (chk & 0xC) { + it_80276FC4(item_gobj, chk); + } + if (chk & 1) { + it_80275DFC(item_gobj); + it_802762B0(item_gobj->user_data); + } + arg1((HSD_GObj*) item_gobj); + } +} + +void it_8026E71C(Item_GObj* item_gobj, HSD_GObjEvent arg1) { + bool chk = it_8026DFB0(item_gobj); + + if (chk) { + if (chk & 0xC) { + it_80276D9C(item_gobj, chk); + } + if (chk & 1) { + it_80275DFC(item_gobj); + it_802762B0(item_gobj->user_data); + } + arg1((HSD_GObj*) item_gobj); + } +} -/// #it_8026E8C4 +void it_8026E7E0(Item_GObj* item_gobj, HSD_GObjEvent arg1) { + bool chk = it_8026DF34(item_gobj); + bool chk2; -s32 it_8026E9A4(Item_GObj* arg0, Vec3* arg1, Vec3* arg2, Vec3* arg3) + chk |= it_80276308(item_gobj); + chk |= it_802763E0(item_gobj); + if (chk & 0xC) { + it_80276D9C(item_gobj, chk); + } + if (chk & 1) { + if (it_8026DE98(item_gobj) && it_8026DC24(item_gobj)) { + chk2 = it_8026DD5C(item_gobj); + } else { + chk2 = false; + } + if (chk2) { + arg1((HSD_GObj*) item_gobj); + } + } +} + +void it_8026E8C4(Item_GObj* item_gobj, HSD_GObjEvent arg1, HSD_GObjEvent arg2) { + Item* item; + bool chk = it_8026DF34(item_gobj); + + item = item_gobj->user_data; + if (chk == false) { + it_802762BC(item); + arg2((HSD_GObj*) item_gobj); + return; + } + it_80277040(item_gobj); + if (it_80276308(item_gobj)) { + item->xD5C = 0; + } + if (!(item->xDC8_word.flags.x17 & 1) || ((u32) item->xD5C == 0U)) { + it_80276CEC(item_gobj); + arg1((HSD_GObj*) item_gobj); + } +} +#else +bool it_8026E32C(Item_GObj* item_gobj, HSD_GObjEvent arg1) +{ + CollData* coll; + Item* item; + bool chk; + bool chk2; + PAD_STACK(38); + + item = item_gobj->user_data; + coll = &item->x378_itemColl; + it_80276214(item_gobj); + chk = mpColl_800471F8(coll); + item->pos = coll->cur_topn; + if (chk) { + item->xC30 = coll->floor.index; + } + chk = chk | it_80276308(item_gobj); + chk = chk | it_802763E0(item_gobj); + if (chk & 0xF) { + it_80276FC4(item_gobj, chk); + if (chk & 1) { + item = item_gobj->user_data; + item->xD50_landNum += 1; + if (it_8026DC24(item_gobj)) { + chk2 = it_8026DD5C(item_gobj); + } else { + chk2 = false; + } + if (chk2) { + arg1((HSD_GObj*) item_gobj); + } + } + } + return chk; +} + +void it_8026E414(Item_GObj* item_gobj, HSD_GObjEvent arg1) +{ + CollData* coll; + Item* item; + bool chk; + PAD_STACK(28); + + item = item_gobj->user_data; + coll = &item->x378_itemColl; + it_80276214(item_gobj); + chk = mpColl_800471F8(coll); + item->pos = coll->cur_topn; + if (chk) { + item->xC30 = coll->floor.index; + } + chk = chk | it_80276308(item_gobj); + chk = chk | it_802763E0(item_gobj); + if (chk & 0xE) { + it_80276FC4(item_gobj, chk); + } + if (chk & 1) { + it_80275DFC(item_gobj); + it_802762B0(item); + arg1((HSD_GObj*) item_gobj); + } +} + +void it_8026E4D0(Item_GObj* item_gobj, HSD_GObjEvent arg1) +{ + CollData* coll; + HSD_JObj* item_jobj; + Item* item; + bool chk; + PAD_STACK(34); + + item = item_gobj->user_data; + coll = &item->x378_itemColl; + it_80276214(item_gobj); + chk = mpColl_800471F8(coll); + item->pos = coll->cur_topn; + if (chk) { + item->xC30 = coll->floor.index; + } + chk = chk | it_80276308(item_gobj); + chk = chk | it_802763E0(item_gobj); + if (chk & 0xE) { + it_80276FC4(item_gobj, chk); + } + if (chk & 1) { + item_jobj = item_gobj->hsd_obj; + it_80275DFC(item_gobj); + it_802762B0(item); + arg1((HSD_GObj*) item_gobj); + it_80272F7C(item_jobj, item->xCC_item_attr->x60_scale); + } +} + +void it_8026E5A0(Item_GObj* item_gobj, HSD_GObjEvent arg1) +{ + CollData* coll; + Item* item; + bool chk; + PAD_STACK(28); + + item = item_gobj->user_data; + coll = &item->x378_itemColl; + it_80276214(item_gobj); + chk = mpColl_800471F8(coll); + item->pos = coll->cur_topn; + if (chk) { + item->xC30 = coll->floor.index; + } + chk = chk | it_80276308(item_gobj); + chk = chk | it_802763E0(item_gobj); + if (chk & 0xF) { + if (chk & 0xE) { + it_80276FC4(item_gobj, chk); + } + if (chk & 1) { + it_80275DFC(item_gobj); + it_802762B0(item); + } + arg1((HSD_GObj*) item_gobj); + } +} + +void it_8026E664(Item_GObj* item_gobj, HSD_GObjEvent arg1) +{ + CollData* coll; + Item* item; + bool chk; + PAD_STACK(28); + + item = item_gobj->user_data; + coll = &item->x378_itemColl; + it_80276214(item_gobj); + chk = mpColl_800471F8(coll); + item->pos = coll->cur_topn; + if (chk) { + item->xC30 = coll->floor.index; + } + chk = chk | it_80276308(item_gobj); + if (chk & 0xD) { + if (chk & 0xC) { + it_80276FC4(item_gobj, chk); + } + if (chk & 1) { + it_80275DFC(item_gobj); + it_802762B0(item); + } + arg1((HSD_GObj*) item_gobj); + } +} + +void it_8026E71C(Item_GObj* item_gobj, HSD_GObjEvent arg1) +{ + CollData* coll; + Item* item; + bool chk; + PAD_STACK(28); + + item = item_gobj->user_data; + coll = &item->x378_itemColl; + it_80276214(item_gobj); + chk = mpColl_800471F8(coll); + item->pos = coll->cur_topn; + if (chk) { + item->xC30 = coll->floor.index; + } + chk = chk | it_80276308(item_gobj); + chk = chk | it_802763E0(item_gobj); + if (chk & 0xF) { + if (chk & 0xC) { + it_80276D9C(item_gobj, chk); + } + if (chk & 1) { + it_80275DFC(item_gobj); + it_802762B0(item); + } + arg1((HSD_GObj*) item_gobj); + } +} + +void it_8026E7E0(Item_GObj* item_gobj, HSD_GObjEvent arg1) +{ + CollData* coll; + Item* item; + bool chk; + bool chk2; + PAD_STACK(30); + + item = item_gobj->user_data; + coll = &item->x378_itemColl; + it_80276214(item_gobj); + chk = mpColl_800471F8(coll); + item->pos = coll->cur_topn; + if (chk) { + item->xC30 = coll->floor.index; + } + chk = chk | it_80276308(item_gobj); + chk = chk | it_802763E0(item_gobj); + // chk &= 0xC; + if (chk & 0xC) { + it_80276D9C(item_gobj, chk); + } + if (chk & 1) { + if (it_8026DE98(item_gobj) && it_8026DC24(item_gobj)) { + chk2 = it_8026DD5C(item_gobj); + } else { + chk2 = false; + } + if (chk2) { + arg1((HSD_GObj*) item_gobj); + } + } +} + +void it_8026E8C4(Item_GObj* item_gobj, HSD_GObjEvent arg1, HSD_GObjEvent arg2) +{ + CollData* coll; + Item* item; + bool chk; + PAD_STACK(14); + + item = item_gobj->user_data; + coll = &item->x378_itemColl; + it_80276214(item_gobj); + chk = mpColl_8004B108(coll); + item->pos = coll->cur_topn; + if (chk) { + item->xC30 = coll->floor.index; + } + if (chk == false) { + it_802762BC(item); + arg2((HSD_GObj*) item_gobj); + return; + } + it_80277040(item_gobj); + if (it_80276308(item_gobj)) { + item->xD5C = 0; + } + if (!(item->xDC8_word.flags.x1F & 1) || (item->xD5C == 0U)) { + it_80276CEC(item_gobj); + arg1((HSD_GObj*) item_gobj); + } +} +#endif + +bool it_8026E9A4(HSD_GObj* gobj, Vec3* arg1, Vec3* arg2, Vec3* arg3) { Vec3 p; + // PAD_STACK(4); + PAD_STACK(8); + if (mpLib_800524DC(&p, 0, NULL, arg3, -1, -1, arg1->x, arg1->y, arg2->x, - arg2->y) == 1) + arg2->y) == true) { *arg2 = p; - return 1; + return true; } - return 0; + return false; } -s32 it_8026EA20(Item_GObj* arg0, Vec3* arg1, Vec3* arg2, Vec3* arg3, s32* arg4, - Vec3* arg5) +bool it_8026EA20(HSD_GObj* gobj, Vec3* arg1, Vec3* arg2, Vec3* arg3, s32* arg4, + Vec3* arg5) { Vec3 p; + // PAD_STACK(4); + PAD_STACK(8); + if (mpLib_800524DC(&p, *arg4, arg5, arg3, -1, -1, arg1->x, arg1->y, - arg2->x, arg2->y) == 1) + arg2->x, arg2->y) == true) { *arg2 = p; - return 1; + return true; } - return 0; + return false; } -s32 it_8026EA9C(Item_GObj* arg0, Vec3* arg1, Vec3* arg2, Vec3* arg3, s32 arg4, - Vec3* arg5, s32 arg6) +bool it_8026EA9C(HSD_GObj* gobj, Vec3* arg1, Vec3* arg2, Vec3* arg3, s32 arg4, + Vec3* arg5, s32 arg6) { Vec3 p; + PAD_STACK(4); + if (mpLib_800524DC(&p, arg4, arg5, arg3, -1, arg6, arg1->x, arg1->y, - arg2->x, arg2->y) == 1) + arg2->x, arg2->y) == true) { *arg2 = p; - return 1; + return true; } - return 0; + return false; } -void it_8026EB18(HSD_GObj* arg0, s32 arg1, Vec3* arg2) +void it_8026EB18(HSD_GObj* gobj, s32 arg1, Vec3* arg2) { Mtx m2; MtxPtr var_r30; @@ -1025,151 +1610,193 @@ void it_8026EB18(HSD_GObj* arg0, s32 arg1, Vec3* arg2) } else { var_r30 = NULL; } - HSD_JObjDispAll(GET_JOBJ(arg0), var_r30, HSD_GObj_80390EB8(arg1), 0U); + HSD_JObjDispAll(GET_JOBJ(gobj), var_r30, HSD_GObj_80390EB8(arg1), 0U); } void it_8026EBC8(HSD_GObj* gobj, u16 arg1, u8* arg2) { Item* ip = GET_ITEM(gobj); - u16 var_r29 = 0; - u8* var_r27 = arg2; - while (var_r29 < arg1) { - HSD_JObj* jobj = ip->xBBC_dynamicBoneTable->bones[*var_r27]; + u16 cnt = 0U; + u8* index = arg2; + while (cnt < arg1) { + HSD_JObj* jobj = ip->xBBC_dynamicBoneTable->bones[*index]; HSD_JObj* jobj_parent = HSD_JObjGetParent(jobj); if (!(HSD_JObjGetFlags(jobj_parent) & 0x10)) { it_80272A18(jobj); } - var_r29 += 1; - var_r27 += 1; + cnt++; + index++; } } void it_8026EC54(HSD_GObj* gobj, u16 arg1, u8* arg2) { Item* ip = GET_ITEM(gobj); - u16 var_r29 = 0; - u8* var_r27 = arg2; - while (var_r29 < arg1) { - HSD_JObj* jobj = ip->xBBC_dynamicBoneTable->bones[*var_r27]; + u16 cnt = 0U; + u8* index = arg2; + while (cnt < arg1) { + HSD_JObj* jobj = ip->xBBC_dynamicBoneTable->bones[*index]; HSD_JObj* jobj_parent = HSD_JObjGetParent(jobj); if (!(HSD_JObjGetFlags(jobj_parent) & 0x10)) { it_80272A3C(jobj); } - var_r29 += 1; - var_r27 += 1; + cnt++; + index++; } } -u32 it_8026ECE0(Item_GObj* gobj, u32 arg1) +// arg1 is some kind of enum type? It gets passed to functions that check if +// it's 0 or 2 to run +bool it_8026ECE0(Item_GObj* gobj, u32 arg1) { Item* ip; - u32 var_r27_2; - u32 var_r27_3; - u32 var_r30; - u8 temp_r3; - u8 temp_r3_2; - Item* var_r28_2; - Item* var_r28_3; - - var_r30 = 0; - ip = GET_ITEM(gobj); - if ((enum ItemKind) ip->kind == It_Kind_Unk4) { - if (((ip->xDAA_flag.b7) && (ip->xDD4_itemVar.it_266F.x18.b7 == 0)) || - (ip->xDD4_itemVar.it_266F.x18.b6 && - (lbColl_8000A10C(&ip->xDD4_itemVar.it_266F.x1C, arg1, ip->scl) != - 0))) + bool chk; + u32 idx; + + chk = false; + ip = GET_ITEM((HSD_GObj*) gobj); + if (ip->kind == It_Kind_Unk4) { + if (ip->xDAA_flag.b0 && + (ip->xDD4_itemVar.it_266F.x18.b0 || + ip->xDD4_itemVar.it_266F.x18.b1) && + lbColl_8000A10C(&ip->xDD4_itemVar.it_266F.x1C, arg1, ip->scl)) { - var_r30 = 1; + chk = true; } } else { - temp_r3_2 = ip->xDAA_flag.u8; if (ip->xDAA_flag.b6) { if (ip->xDAA_flag.b2) { - u32 idx = 0; - do { + idx = 0U; + while (idx < 4U) { if (lbColl_80009F54(&ip->x5D4_hitboxes[idx].hit, arg1, - ip->scl) != 0) + ip->scl) != false) { - var_r30 = 1; + chk = true; } - idx += 1; - } while (idx < 4U); + idx++; + } } - if (!ip->xDCC_flag.b2 && ip->xDAA_flag.b2) { - if ((s32) ip->xD0C == 0) { - u32 idx = 0; + if (!ip->xDC8_word.flags.x13 && ip->xDAA_flag.b1) { + if (ip->xD0C == 0) { + idx = 0U; while (idx < ip->xAC8_hurtboxNum) { if (lbColl_8000A244(&ip->xACC_itemHurtbox[idx], arg1, - NULL, 0.0f) != 0) + NULL, 0.0f) != false) { - var_r30 = 1; + chk = true; } - idx += 1; + idx++; } } else { - u32 idx = 0; + idx = 0U; while (idx < ip->xAC8_hurtboxNum) { if (lbColl_8000A584(&ip->xACC_itemHurtbox[idx], - (u32) ip->xD0C, arg1, NULL, - 0.0f) != 0) + ip->xD0C, arg1, NULL, + 0.0f) != false) { - var_r30 = 1; + chk = true; } - idx += 1; + idx++; } } } } - if (ip->xDAA_flag.b7 && ip->xDC8_word.flags.x8 && + if (ip->xDAA_flag.b4 && ip->xDC8_word.flags.x15 && (lbGx_8001E2F8((Vec4*) &ip->xBCC_unk, &ip->pos, &it_804D5168, arg1, - ip->facing_dir) != 0)) + ip->facing_dir) != false)) { - var_r30 = 1; + chk = true; } - if (ip->xDAA_flag.b4 && ip->xDD0_flag.b1 && - (lb_800149E0(&ip->xACC_itemHurtbox[1].b_pos.z, arg1) != 0)) + if (ip->xDAA_flag.b3 && ip->xDD0_flag.b0 && + (lb_800149E0(&ip->xACC_itemHurtbox[1].b_pos.z, arg1) != false)) { - var_r30 = 1; + chk = true; } } - return var_r30; + return chk; } -static inline void it_8026EC54_inline(HSD_GObj* gobj, Item* ip) -{ - it_8026EC54(gobj, ip->xDD4_itemVar.it_266F.x0, - ip->xDD4_itemVar.it_266F.x4); +#if 0 +static inline void it_8026EECC_inline_1(HSD_GObj* gobj, s32 arg1, Vec3* pos) { + Item* ip = gobj->user_data; + Vec3* new_pos = NULL; + it_266F_ItemVars* it_266F; + + ip->xDCF_flag.b4 = 1; + ip->xDCF_flag.b5 = 0; + it_266F = &ip->xDD4_itemVar.it_266F; + it_8026EC54(gobj, it_266F->x0, it_266F->x4); + it_8026EBC8(gobj, it_266F->x8, it_266F->xC); + if (ip->xDCF_flag.b7) { + new_pos = pos; + } + it_8026EB18(gobj, arg1, new_pos); + it_8026EBC8(gobj, it_266F->x0, it_266F->x4); + it_8026EC54(gobj, it_266F->x8, it_266F->xC); } -static inline void it_8026EBC8_inline(HSD_GObj* gobj, Item* ip) -{ - it_8026EBC8(gobj, ip->xDD4_itemVar.it_266F.x8, - ip->xDD4_itemVar.it_266F.xC); +static inline void it_8026EECC_inline_2(HSD_GObj* gobj, s32 arg1, Vec3* pos) { + Item* ip = gobj->user_data; + Vec3* new_pos = NULL; + + ip->xDCF_flag.b4 = 0; + ip->xDCF_flag.b5 = 0; + if (ip->xDCF_flag.b7) { + new_pos = pos; + } + it_8026EB18(gobj, arg1, new_pos); } +static inline void it_8026EECC_inline_3(HSD_GObj* gobj, s32 arg1, Vec3* pos) { + Item* ip = gobj->user_data; + Vec3* new_pos = NULL; + it_266F_ItemVars* it_266F; + + ip->xDCF_flag.b4 = 1; + ip->xDCF_flag.b5 = 1; + it_266F = &ip->xDD4_itemVar.it_266F; + it_8026EC54(gobj, it_266F->x0, it_266F->x4); + it_8026EBC8(gobj, it_266F->x8, it_266F->xC); + if (ip->xDCF_flag.b7) { + new_pos = pos; + } else { + new_pos = NULL; + } + + it_8026EB18(gobj, arg1, new_pos); + it_8026EBC8(gobj, it_266F->x0, it_266F->x4); + it_8026EC54(gobj, it_266F->x8, it_266F->xC); +} +#else static inline void it_8026EECC_inline_1(HSD_GObj* gobj, s32 arg1, Vec3* pos) { Item* ip = gobj->user_data; Vec3* new_pos = NULL; - ip->xDCF_flag.b2 = 1; - ip->xDCF_flag.b3 = 0; - it_8026EC54_inline(gobj, ip); - it_8026EBC8_inline(gobj, ip); - if (ip->xDCF_flag.b0) { + + ip->xDCF_flag.b4 = 1; + ip->xDCF_flag.b5 = 0; + it_8026EC54(gobj, ip->xDD4_itemVar.it_266F.x0, + ip->xDD4_itemVar.it_266F.x4); + it_8026EBC8(gobj, ip->xDD4_itemVar.it_266F.x8, + ip->xDD4_itemVar.it_266F.xC); + if (ip->xDCF_flag.b7) { new_pos = pos; } it_8026EB18(gobj, arg1, new_pos); - it_8026EBC8_inline(gobj, ip); - it_8026EC54_inline(gobj, ip); + it_8026EBC8(gobj, ip->xDD4_itemVar.it_266F.x0, + ip->xDD4_itemVar.it_266F.x4); + it_8026EC54(gobj, ip->xDD4_itemVar.it_266F.x8, + ip->xDD4_itemVar.it_266F.xC); } static inline void it_8026EECC_inline_2(HSD_GObj* gobj, s32 arg1, Vec3* pos) { Item* ip = gobj->user_data; Vec3* new_pos = NULL; - ip->xDCF_flag.b2 = 0; - ip->xDCF_flag.b3 = 0; - if (ip->xDCF_flag.b0) { + + ip->xDCF_flag.b4 = 0; + ip->xDCF_flag.b5 = 0; + if (ip->xDCF_flag.b7) { new_pos = pos; } it_8026EB18(gobj, arg1, new_pos); @@ -1179,83 +1806,87 @@ static inline void it_8026EECC_inline_3(HSD_GObj* gobj, s32 arg1, Vec3* pos) { Item* ip = gobj->user_data; Vec3* new_pos = NULL; - ip->xDCF_flag.b2 = 1; - ip->xDCF_flag.b3 = 1; - it_8026EC54_inline(gobj, ip); - it_8026EBC8_inline(gobj, ip); - if (ip->xDCF_flag.b0) { + + ip->xDCF_flag.b4 = 1; + ip->xDCF_flag.b5 = 1; + it_8026EC54(gobj, ip->xDD4_itemVar.it_266F.x0, + ip->xDD4_itemVar.it_266F.x4); + it_8026EBC8(gobj, ip->xDD4_itemVar.it_266F.x8, + ip->xDD4_itemVar.it_266F.xC); + if (ip->xDCF_flag.b7) { new_pos = pos; } else { new_pos = NULL; } + it_8026EB18(gobj, arg1, new_pos); - it_8026EBC8_inline(gobj, ip); - it_8026EC54_inline(gobj, ip); + it_8026EBC8(gobj, ip->xDD4_itemVar.it_266F.x0, + ip->xDD4_itemVar.it_266F.x4); + it_8026EC54(gobj, ip->xDD4_itemVar.it_266F.x8, + ip->xDD4_itemVar.it_266F.xC); } +#endif void it_8026EECC(HSD_GObj* gobj, int arg1) { Item* ip = gobj->user_data; Vec3 pos; - if (ip->xDAA_flag.b0) { + PAD_STACK(48); + + if (ip->xDAA_flag.b7) { pos.x = pos.y = pos.z = 0.0F; - if (ip->xDCC_flag.b0) { - if ((ip->owner == NULL) || (ftLib_80086960(ip->owner) == 0) || - (ftLib_800868D4(ip->owner, gobj) != 0)) + if (ip->xDC8_word.flags.x13) { + if ((ip->owner == NULL) || !ftLib_80086960(ip->owner) || + ftLib_800868D4(ip->owner, gobj)) { - { - Item* ip = gobj->user_data; - ip->xDCF_flag.b0 = 0; - if ((ip->owner != NULL) && - (ftLib_80086960(ip->owner) != 0)) - { - if (ftLib_80087074(ip->owner, &pos) != 0) { - ip->xDCF_flag.b0 = 1; - } - } else { - pos.x = pos.y = pos.z = 0.0F; + ip = gobj->user_data; + ip->xDCF_flag.b7 = 0; + if ((ip->owner != NULL) && ftLib_80086960(ip->owner)) { + if (ftLib_80087074(ip->owner, &pos)) { + ip->xDCF_flag.b7 = 1; } + } else { + pos.x = pos.y = pos.z = 0.0F; } + // @todo This could just be one big function call. - { - Item* ip = gobj->user_data; - switch (Camera_80031060()) { - case 1: - if (ip->xDCF_flag.b2) { - it_8026EECC_inline_1(gobj, arg1, &pos); - it_8026EECC_inline_2(gobj, arg1, &pos); - it_8026EECC_inline_3(gobj, arg1, &pos); - } - break; - case 0: - if (!ip->xDCF_flag.b2) { - it_8026EECC_inline_2(gobj, arg1, &pos); - } - break; - } - } - } - } else { - { - Item* ip = gobj->user_data; + ip = gobj->user_data; switch (Camera_80031060()) { case 1: - if (ip->xDCF_flag.b2) { + if (ip->xDCF_flag.b3) { it_8026EECC_inline_1(gobj, arg1, &pos); it_8026EECC_inline_2(gobj, arg1, &pos); it_8026EECC_inline_3(gobj, arg1, &pos); } break; case 0: - if (!ip->xDCF_flag.b2) { + if (!ip->xDCF_flag.b3) { it_8026EECC_inline_2(gobj, arg1, &pos); } break; } } + } else { + ip = gobj->user_data; + switch (Camera_80031060()) { + case 1: + if (ip->xDCF_flag.b3) { + it_8026EECC_inline_1(gobj, arg1, &pos); + it_8026EECC_inline_2(gobj, arg1, &pos); + it_8026EECC_inline_3(gobj, arg1, &pos); + } + break; + case 0: + if (!ip->xDCF_flag.b3) { + it_8026EECC_inline_2(gobj, arg1, &pos); + } + break; + } } } - if (it_8026ECE0(gobj, (u32) arg1) != 0U) { + // if (it_8026ECE0((Item_GObj*) gobj, arg1)) { + // if (it_8026ECE0((Item_GObj*) gobj, arg1) != false) { + if (it_8026ECE0((Item_GObj*) gobj, arg1) != 0U) { HSD_StateInvalidate(-1); HSD_StateInitTev(); HSD_ClearVtxDesc(); @@ -1267,17 +1898,191 @@ void it_8026F3AC(void) it_8026C75C(&it_804A0E50); } -/// #it_8026F3D4 +void it_8026F3D4(Item_GObj* item_gobj, struct it_8026F3D4_arg1_t* arg1, + s32 num, s32 arg3) +{ + // HSD_ObjAllocUnk6 sp30; + struct it_8026F3D4_body_t sp30; + s32 cnt2; + Vec3 sp24; + Item* item; + Item_GObj* spawned_item_gobj; + bool chk2; + s32 cnt; + bool chk1; + ItemKind it_kind; + PAD_STACK(120); + + spawned_item_gobj = NULL; + chk1 = false; + it_kind = -1; + cnt = 0; + item = item_gobj->user_data; + cnt2 = 0; + while (cnt < num) { + if (((arg3 & 1) == 0) || ((s32) it_kind == -1)) { + it_kind = it_8026C75C(&it_804A0E50); + } + if (((s32) it_kind == -1) || (it_kind >= It_Kind_L_Gun_Ray) || + ((it_kind == It_Kind_M_Ball) && it_8026C704())) + { + if ((s32) it_kind == -1) { + chk2 = false; + } + if (it_kind >= It_Kind_L_Gun_Ray) { + chk2 = true; + } + chk1 |= chk2; + break; + // goto block_3068; + } else { + spawned_item_gobj = it_8026F5C8(item_gobj, it_kind, &item->pos); + if (spawned_item_gobj != NULL) { + sp24.z = 0.0f; + sp24.y = 0.0f; + sp24.x = 0.0f; + it_8026F53C(spawned_item_gobj, &sp24, 0); + chk1 = false; + it_80274ED8(); + // (&sp30[0])[cnt2] = (s32) it_kind; + sp30.x0[(s8) cnt2 << 2] = it_kind; + + // sp30.x0[0] = it_kind; + cnt2++; + } + cnt++; + } + } + // block_3068: + if (ftLib_80086960(item->owner) && (cnt2 != 0)) { + ftLib_800874CC(item->owner, &sp30, cnt2); + } + if (arg1 != NULL) { + arg1->x0 = chk1; + arg1->x4 = it_kind; + arg1->x8 = spawned_item_gobj; + } +} + +void it_8026F53C(Item_GObj* item_gobj, Vec3* vel, bool chk) +{ + Item* item; + + item = item_gobj->user_data; + if (chk == false) { + vel->x = it_804D6D28->x54_float * (2.0f * (HSD_Randf() - 0.5f)); + vel->y = item->xCC_item_attr->x18; + vel->z = 0.0f; + } + item->x40_vel = *vel; +} + +Item_GObj* it_8026F5C8(Item_GObj* item_gobj, ItemKind kind, Vec3* pos) +{ + SpawnItem spawn; + Item_GObj* spawn_gobj; + PAD_STACK(12); -/// #it_8026F53C + spawn.kind = kind; + spawn.vel.z = 0.0f; + spawn.vel.y = 0.0f; + spawn.vel.x = 0.0f; + spawn.x3C_damage = 0; + spawn.x44_flag.b0 = 1; + spawn.prev_pos = *pos; + spawn.prev_pos.z = 0.0f; + spawn.x40 = 0; + spawn.facing_dir = it_8026B684(&spawn.prev_pos); + if (item_gobj != NULL) { + it_8026BB88(item_gobj, &spawn.pos); + spawn.x0_parent_gobj = NULL; + spawn.x4_parent_gobj2 = (HSD_GObj*) item_gobj; + } else { + spawn.pos = spawn.prev_pos; + spawn.x0_parent_gobj = NULL; + spawn.x4_parent_gobj2 = spawn.x0_parent_gobj; + } + spawn_gobj = Item_80268B18(&spawn); + if (spawn_gobj != NULL) { + it_80274658(spawn_gobj, it_804D6D28->x70_float); + } + return spawn_gobj; +} -/// #it_8026F5C8 +Item_GObj* it_8026F6BC(Item_GObj* item_gobj, Vec3* arg1, Vec3* vel, bool chk) +{ + Item* spawned_item; + Item_GObj* spawned_item_gobj; + PAD_STACK(80); + + if (Item_804A0C64.x2C >= Item_804A0C64.x30) { + return NULL; + } + if (HSD_Randi(it_804D6D28->x124) != 0) { + return NULL; + } + spawned_item_gobj = + it_8026F5C8(item_gobj, it_8026C65C(&it_804A0E60), arg1); + if (spawned_item_gobj != NULL) { + spawned_item = spawned_item_gobj->user_data; + if (chk == false) { + vel->x = it_804D6D28->x54_float * (2.0f * (HSD_Randf() - 0.5f)); + vel->y = spawned_item->xCC_item_attr->x18; + vel->z = 0.0f; + } + spawned_item->x40_vel = *vel; + } + return spawned_item_gobj; +} -/// #it_8026F6BC +Item_GObj* it_8026F7C8(Vec3* arg0, Vec3* vel, bool chk) +{ + Item* spawned_item; + Item_GObj* spawned_item_gobj; + ItemKind it_kind; + PAD_STACK(80); + + if (gm_8016B238()) { + return NULL; + } + it_kind = it_8026C75C(&it_804A0E50); + if ((s32) it_kind == -1) { + return NULL; + } + spawned_item_gobj = it_8026F5C8(NULL, it_kind, arg0); + if (spawned_item_gobj != NULL) { + spawned_item = spawned_item_gobj->user_data; + if (chk == false) { + vel->x = it_804D6D28->x54_float * (2.0f * (HSD_Randf() - 0.5f)); + vel->y = spawned_item->xCC_item_attr->x18; + vel->z = 0.0f; + } + spawned_item->x40_vel = *vel; + it_80274ED8(); + } + return spawned_item_gobj; +} -/// #it_8026F7C8 +bool it_8026F8B4(Item_GObj* item_gobj, Vec3* arg1, Vec3* arg2, bool chk) +{ + s32 rand_int; + PAD_STACK(20); -/// #it_8026F8B4 + if (gm_8016B0B4() == false) { + return false; + } + if (HSD_Randi(it_804D6D28->x138) != 0) { + return false; + } + rand_int = HSD_Randi(it_804D6D28->x13C) + it_804D6D28->x140; + if (chk == false) { + arg2->x = it_804D6D28->x54_float * (2.0f * (HSD_Randf() - 0.5f)); + arg2->y = it_804D6D28->x144; + arg2->z = 0.0f; + } + it_802E5F00(item_gobj, arg1, arg2, rand_int); + return true; +} void it_8026F9A0(void) { diff --git a/src/melee/it/it_266F.h b/src/melee/it/it_266F.h index 2e65694d0d..763370c310 100644 --- a/src/melee/it/it_266F.h +++ b/src/melee/it/it_266F.h @@ -11,102 +11,71 @@ #include "it/types.h" -/* 26C47C */ void it_8026C47C(struct it_8026C47C_arg0_t* arg0); -/* 26C530 */ s32 it_8026C530(s32, void*, s32, s32); +/* 26C47C */ void it_8026C47C(struct it_8026C47C_arg0_t*); +/* 26C530 */ s32 it_8026C530(s32, HSD_ObjAllocUnk6*, s32, s32); /* 26C65C */ u8 it_8026C65C(HSD_ObjAllocUnk6*); -/* 26C704 */ s32 it_8026C704(void); -/* 26C75C */ s8 it_8026C75C(HSD_ObjAllocUnk6*); +/* 26C704 */ bool it_8026C704(void); +/* 26C75C */ ItemKind it_8026C75C(HSD_ObjAllocUnk6*); /* 26C88C */ void fn_8026C88C(HSD_GObj*); /* 26CA4C */ void it_8026CA4C(u16*, s32*, u64, s32, f32); -/* 26CB3C */ s32 it_8026CB3C(Vec3*); -/* 26CB9C */ void it_8026CB9C(s32*, u64, u32, f32); +/* 26CB3C */ bool it_8026CB3C(Vec3*); +/* 26CB9C */ void it_8026CB9C(s32*, u64, f32); /* 26CD50 */ void it_8026CD50(s32*, u64, f32); /* 26CF04 */ void it_8026CF04(void); /* 26D018 */ void it_8026D018(void); -/* 26D258 */ s32 it_8026D258(void*, s32); -/* 26D324 */ bool it_8026D324(s32); -/* 26D3CC */ s32 it_8026D3CC(void); +/* 26D258 */ bool it_8026D258(Vec3*, ItemKind); +/* 26D324 */ bool it_8026D324(ItemKind); +/* 26D3CC */ bool it_8026D3CC(void); /* 26D564 */ void it_8026D564(Item_GObj*); /* 26D5CC */ void it_8026D5CC(Item_GObj*); -/* 26D604 */ s32 it_8026D604(HSD_GObj*); -/* 26D604 */ s32 it_8026D604(HSD_GObj* gobj); +/* 26D604 */ bool it_8026D604(Item_GObj*); /* 26D62C */ void it_8026D62C(Item_GObj*, HSD_GObjEvent); /* 26D6F4 */ void it_8026D6F4(Item_GObj*, HSD_GObjEvent); /* 26D78C */ void it_8026D78C(Item_GObj*, HSD_GObjEvent); /* 26D82C */ void it_8026D82C(Item_GObj*); -/* 26D8A4 */ s32 it_8026D8A4(Item_GObj*, HSD_GObjEvent); +/* 26D8A4 */ bool it_8026D8A4(Item_GObj*, HSD_GObjEvent); /* 26D938 */ void it_8026D938(Item_GObj*, HSD_GObjEvent); /* 26D9A0 */ bool it_8026D9A0(Item_GObj*); /* 26DA08 */ bool it_8026DA08(Item_GObj*); /* 26DA70 */ bool it_8026DA70(Item_GObj*); -/* 26DAA8 */ s32 it_8026DAA8(Item_GObj*); -/* 26DB40 */ s32 it_8026DB40(Item_GObj*); -/* 26DBC8 */ s32 it_8026DBC8(HSD_GObj*); -/* 26DC24 */ s32 it_8026DC24(HSD_GObj*); -/* 26DD5C */ s32 it_8026DD5C(Item_GObj*); -/* 26DDFC */ s32 it_8026DDFC(Item_GObj*); -/* 26DE98 */ s32 it_8026DE98(Item_GObj*); -/* 26DF34 */ s32 it_8026DF34(Item_GObj*); -/* 26DFB0 */ s32 it_8026DFB0(Item_GObj*); -/* 26E058 */ s32 it_8026E058(Item_GObj*); -/* 26E0F4 */ void it_8026E0F4(Item_GObj* gobj); +/* 26DAA8 */ bool it_8026DAA8(Item_GObj*); +/* 26DB40 */ bool it_8026DB40(Item_GObj*); +/* 26DBC8 */ bool it_8026DBC8(Item_GObj*); +/* 26DC24 */ bool it_8026DC24(Item_GObj*); +/* 26DD5C */ bool it_8026DD5C(Item_GObj*); +/* 26DDFC */ bool it_8026DDFC(Item_GObj*); +/* 26DE98 */ bool it_8026DE98(Item_GObj*); +/* 26DF34 */ bool it_8026DF34(Item_GObj*); +/* 26DFB0 */ bool it_8026DFB0(Item_GObj*); +/* 26E058 */ bool it_8026E058(Item_GObj*); +/* 26E0F4 */ void it_8026E0F4(Item_GObj*); /* 26E15C */ void it_8026E15C(Item_GObj*, HSD_GObjEvent); /* 26E248 */ void it_8026E248(Item_GObj*, HSD_GObjEvent); /* 26E248 */ void it_8026E248(Item_GObj*, HSD_GObjEvent); -/* 26E32C */ UNK_RET it_8026E32C(UNK_PARAMS); +/* 26E32C */ bool it_8026E32C(Item_GObj*, HSD_GObjEvent); /* 26E414 */ void it_8026E414(Item_GObj*, HSD_GObjEvent); -/* 26E4D0 */ UNK_RET it_8026E4D0(UNK_PARAMS); -/* 26E5A0 */ UNK_RET it_8026E5A0(UNK_PARAMS); -/* 26E664 */ UNK_RET it_8026E664(UNK_PARAMS); +/* 26E4D0 */ void it_8026E4D0(Item_GObj*, HSD_GObjEvent); +/* 26E5A0 */ void it_8026E5A0(Item_GObj*, HSD_GObjEvent); +/* 26E664 */ void it_8026E664(Item_GObj*, HSD_GObjEvent); /* 26E71C */ void it_8026E71C(Item_GObj*, HSD_GObjEvent); /* 26E7E0 */ void it_8026E7E0(Item_GObj*, HSD_GObjEvent); /* 26E8C4 */ void it_8026E8C4(Item_GObj*, HSD_GObjEvent, HSD_GObjEvent); -/* 26E9A4 */ s32 it_8026E9A4(Item_GObj*, Vec3*, Vec3*, Vec3*); -/* 26EA20 */ s32 it_8026EA20(Item_GObj*, Vec3*, Vec3*, Vec3*, s32*, Vec3*); -/* 26EA9C */ s32 it_8026EA9C(Item_GObj*, Vec3*, Vec3*, Vec3*, s32, Vec3*, s32); +/* 26E9A4 */ bool it_8026E9A4(HSD_GObj*, Vec3*, Vec3*, Vec3*); +/* 26EA20 */ bool it_8026EA20(HSD_GObj*, Vec3*, Vec3*, Vec3*, s32*, Vec3*); +/* 26EA9C */ bool it_8026EA9C(HSD_GObj*, Vec3*, Vec3*, Vec3*, s32, Vec3*, s32); /* 26EB18 */ void it_8026EB18(HSD_GObj*, s32, Vec3*); /* 26EBC8 */ void it_8026EBC8(HSD_GObj*, u16, u8*); /* 26EC54 */ void it_8026EC54(HSD_GObj*, u16, u8*); -/* 26ECE0 */ u32 it_8026ECE0(Item_GObj*, u32); +/* 26ECE0 */ bool it_8026ECE0(Item_GObj*, u32); /* 26EECC */ void it_8026EECC(HSD_GObj*, int); /* 26F3AC */ void it_8026F3AC(void); -/* 26F3D4 */ void it_8026F3D4(Item_GObj*, int, bool, int); -/* 26F53C */ UNK_RET it_8026F53C(UNK_PARAMS); -/* 26F5C8 */ UNK_RET it_8026F5C8(UNK_PARAMS); -/* 26F6BC */ UNK_RET it_8026F6BC(UNK_PARAMS); -/* 26F7C8 */ UNK_RET it_8026F7C8(UNK_PARAMS); -/* 26F8B4 */ bool it_8026F8B4(Item_GObj*, Vec3*, Vec3*, int); +/* 26F3D4 */ void it_8026F3D4(Item_GObj*, struct it_8026F3D4_arg1_t*, s32, + s32); +/* 26F53C */ void it_8026F53C(Item_GObj*, Vec3*, bool); +/* 26F5C8 */ Item_GObj* it_8026F5C8(Item_GObj*, ItemKind, Vec3*); +/* 26F6BC */ Item_GObj* it_8026F6BC(Item_GObj*, Vec3*, Vec3*, bool); +/* 26F7C8 */ Item_GObj* it_8026F7C8(Vec3*, Vec3*, bool); +/* 26F8B4 */ bool it_8026F8B4(Item_GObj*, Vec3*, Vec3*, bool); /* 26F9A0 */ void it_8026F9A0(void); -/* 26FAC4 */ void it_8026FAC4(Item*, HitCapsule*, s32, Fighter*, s32); -/* 26FC00 */ UNK_RET it_8026FC00(UNK_PARAMS); -/* 2701BC */ void it_802701BC(HSD_GObj* gobj); -/* 2703E8 */ void it_802703E8(HSD_GObj* gobj); -/* 2706D0 */ void it_802706D0(HSD_GObj* gobj); -/* 270E30 */ void it_80270E30(HSD_GObj* gobj); -/* 27137C */ void it_8027137C(HSD_GObj* gobj); -/* 27146C */ void it_8027146C(HSD_GObj* gobj); -/* 2714C0 */ void it_802714C0(HSD_GObj* gobj); -/* 271508 */ void it_80271508(HSD_GObj* gobj, s32 arg1); -/* 27163C */ void it_8027163C(HSD_GObj* gobj); -/* 271A58 */ void it_80271A58(HSD_GObj* gobj); -/* 2721B8 */ void it_802721B8(HSD_GObj* gobj); -/* 272280 */ void it_80272280(HSD_GObj* gobj); -/* 272298 */ void it_80272298(HSD_GObj* gobj); -/* 2722B0 */ void it_802722B0(HSD_GObj* gobj); -/* 272304 */ void it_80272304(HSD_GObj* gobj); -/* 272460 */ void it_80272460(HitCapsule* hitbox, s32 damage, HSD_GObj* gobj); -/* 4A0E30 */ extern HSD_ObjAllocUnk4 it_804A0E30; -/* 4A0E50 */ extern HSD_ObjAllocUnk6 it_804A0E50; -/* 4A0E60 */ extern HSD_ObjAllocUnk6 it_804A0E60; -/* 4A0F60 */ extern Article* it_804A0F60[]; -/* 4D6D00 */ extern s8 it_804D6D00; -/* 4D6D08 */ extern s32 it_804D6D08; -/* 4D6D0C */ extern s32 it_804D6D0C; -/* 4D6D10 */ extern u32 it_804D6D10; -/* 4D6D14 */ extern uint it_804D6D14; -/* 4D6D24 */ extern Article** it_804D6D24; -/* 4D6D28 */ extern ItemCommonData* it_804D6D28; -/* 4D6D30 */ extern Article** it_804D6D30; -/* 4D6D38 */ extern Article** it_804D6D38; #endif diff --git a/src/melee/it/it_2725.c b/src/melee/it/it_2725.c index 2fa14dca02..0853a57315 100644 --- a/src/melee/it/it_2725.c +++ b/src/melee/it/it_2725.c @@ -1,217 +1,475 @@ #include +#include "it/forward.h" + #include "it_2725.h" +#include "inlines.h" #include "it_266F.h" +#include "cm/camera.h" +#include "db/db_2253.h" +#include "ef/efasync.h" +#include "ef/efsync.h" +#include "ft/fighter.h" +#include "ft/ft_0892.h" +#include "ft/ft_0C31.h" +#include "ft/ftdevice.h" +#include "ft/ftlib.h" +#include "gm/gm_1601.h" +#include "gm/gm_1A36.h" +#include "gr/grlib.h" +#include "gr/ground.h" +#include "gr/grzakogenerator.h" +#include "it/it_26B1.h" +#include "it/itcoll.h" +#include "it/items/it_27CF.h" +#include "it/items/it_2ADA.h" +#include "it/items/it_2E5A.h" +#include "it/items/it_2E6A.h" +#include "it/items/it_2F28.h" +#include "it/items/itarwinglaser.h" +#include "it/items/itbat.h" +#include "it/items/itbombhei.h" +#include "it/items/itbox.h" +#include "it/items/itcapsule.h" +#include "it/items/itcerebi.h" +#include "it/items/itchicorita.h" +#include "it/items/itchicoritaleaf.h" +#include "it/items/itclimbersblizzard.h" +#include "it/items/itclimbersice.h" +#include "it/items/itclimbersstring.h" +#include "it/items/itclinkmilk.h" +#include "it/items/itcoin.h" +#include "it/items/itcrazyhandbomb.h" +#include "it/items/itdkinoko.h" +#include "it/items/itdosei.h" +#include "it/items/itdrmariopill.h" +#include "it/items/itegg.h" +#include "it/items/itentei.h" +#include "it/items/itevyoshiegg.h" +#include "it/items/itfflower.h" +#include "it/items/itfflowerflame.h" +#include "it/items/itfire.h" +#include "it/items/itflipper.h" +#include "it/items/itfoods.h" +#include "it/items/itfoxblaster.h" +#include "it/items/itfoxillusion.h" +#include "it/items/itfoxlaser.h" +#include "it/items/itfreeze.h" +#include "it/items/itfreezer.h" +#include "it/items/itfushigibana.h" +#include "it/items/itgamewatchbreath.h" +#include "it/items/itgamewatchchef.h" +#include "it/items/itgamewatchfire.h" +#include "it/items/itgamewatchgreenhouse.h" +#include "it/items/itgamewatchjudge.h" +#include "it/items/itgamewatchmanhole.h" +#include "it/items/itgamewatchpanic.h" +#include "it/items/itgamewatchparachute.h" +#include "it/items/itgamewatchrescue.h" +#include "it/items/itgamewatchturtle.h" +#include "it/items/itgreatfoxlaser.h" +#include "it/items/itgshell.h" +#include "it/items/ithammer.h" +#include "it/items/ithammerhead.h" +#include "it/items/itharisen.h" +#include "it/items/ithassam.h" +#include "it/items/itheart.h" +#include "it/items/itheiho.h" +#include "it/items/ithinoarashi.h" +#include "it/items/ithitodeman.h" +#include "it/items/ithouou.h" +#include "it/items/itkabigon.h" +#include "it/items/itkamex.h" +#include "it/items/itkinoko.h" +#include "it/items/itkirbycutterbeam.h" +#include "it/items/itkirbygamewatchchefpan.h" +#include "it/items/itkirbyhammer.h" +#include "it/items/itkireihana.h" +#include "it/items/itklap.h" +#include "it/items/itkoopaflame.h" +#include "it/items/itkusudama.h" +#include "it/items/itkyasarin.h" +#include "it/items/itkyasarinegg.h" +#include "it/items/itleadead.h" +#include "it/items/itlgun.h" +#include "it/items/itlgunbeam.h" +#include "it/items/itlgunray.h" +#include "it/items/itlikelike.h" +#include "it/items/itlinkarrow.h" +#include "it/items/itlinkbomb.h" +#include "it/items/itlinkboomerang.h" +#include "it/items/itlinkbow.h" +#include "it/items/itlinkhookshot.h" +#include "it/items/itlipstick.h" +#include "it/items/itlipstickspore.h" +#include "it/items/itlizardon.h" +#include "it/items/itlucky.h" +#include "it/items/itlugia.h" +#include "it/items/itluigifireball.h" +#include "it/items/itmaril.h" +#include "it/items/itmariocape.h" +#include "it/items/itmariofireball.h" +#include "it/items/itmarumine.h" +#include "it/items/itmasterhandbullet.h" +#include "it/items/itmasterhandlaser.h" +#include "it/items/itmatadogas.h" +#include "it/items/itmato.h" +#include "it/items/itmetalb.h" +#include "it/items/itmetamon.h" +#include "it/items/itmew.h" +#include "it/items/itmewtwodisable.h" +#include "it/items/itmewtwoshadowball.h" +#include "it/items/itmsbomb.h" +#include "it/items/itnessbat.h" +#include "it/items/itnessfirepillar.h" +#include "it/items/itnesspkfire.h" +#include "it/items/itnesspkflush.h" +#include "it/items/itnesspkflushexplode.h" +#include "it/items/itnesspkthunderball.h" +#include "it/items/itnesspkthundertrail.h" +#include "it/items/itnessyoyo.h" +#include "it/items/itnokonoko.h" +#include "it/items/itoctarock.h" +#include "it/items/itoctarockstone.h" +#include "it/items/itoldkuri.h" +#include "it/items/itoldottosea.h" +#include "it/items/itparasol.h" +#include "it/items/itpatapata.h" +#include "it/items/itpeachexplode.h" +#include "it/items/itpeachparasol.h" +#include "it/items/itpeachtoad.h" +#include "it/items/itpeachtoadspore.h" +#include "it/items/itpeachturnip.h" +#include "it/items/itpikachuthunder.h" +#include "it/items/itpikachutjoltair.h" +#include "it/items/itpikachutjoltground.h" +#include "it/items/itpippi.h" +#include "it/items/itporygon2.h" +#include "it/items/itrabbitc.h" +#include "it/items/itraikou.h" +#include "it/items/itrshell.h" +#include "it/items/itsamusbomb.h" +#include "it/items/itsamuschargeshot.h" +#include "it/items/itsamusgrapple.h" +#include "it/items/itsamusmissile.h" +#include "it/items/itscball.h" +#include "it/items/itseakchain.h" +#include "it/items/itseakneedleheld.h" +#include "it/items/itseakneedlethrown.h" +#include "it/items/itseakvanish.h" +#include "it/items/itsonans.h" +#include "it/items/itspycloak.h" +#include "it/items/itsscope.h" +#include "it/items/itsscopebeam.h" +#include "it/items/itstar.h" +#include "it/items/itstarrod.h" +#include "it/items/itstarrodstar.h" +#include "it/items/itsuikun.h" +#include "it/items/itsword.h" +#include "it/items/ittaru.h" +#include "it/items/ittarucann.h" +#include "it/items/itthunder.h" +#include "it/items/ittincle.h" +#include "it/items/ittogepy.h" +#include "it/items/ittomato.h" +#include "it/items/ittools.h" +#include "it/items/ittosakinto.h" +#include "it/items/itunknown.h" +#include "it/items/itwhispyapple.h" #include "it/items/itwhitebea.h" +#include "it/items/itwstar.h" +#include "it/items/ityoshieggthrow.h" +#include "it/items/ityoshistar.h" +#include "it/items/itzeldadinfire.h" +#include "it/items/itzeldadinfireexplode.h" +#include "it/items/itzgshell.h" +#include "it/items/itzrshell.h" #include "it/types.h" #include "items/it_27CF.h" -#include "items/it_2ADA.h" -#include "items/it_2E5A.h" -#include "items/it_2E6A.h" -#include "items/it_2F28.h" -#include "items/itcerebi.h" -#include "items/itchicorita.h" -#include "items/itchicoritaleaf.h" -#include "items/itclimbersblizzard.h" -#include "items/itclimbersice.h" -#include "items/itclimbersstring.h" -#include "items/itclinkmilk.h" +#include "items/itbat.h" +#include "items/itbombhei.h" +#include "items/itbox.h" +#include "items/itcapsule.h" #include "items/itcoin.h" -#include "items/itcrazyhandbomb.h" -#include "items/itdrmariopill.h" -#include "items/itentei.h" -#include "items/itfire.h" -#include "items/itfoxblaster.h" +#include "items/itdkinoko.h" +#include "items/itdosei.h" +#include "items/itegg.h" +#include "items/itevyoshiegg.h" +#include "items/itfflower.h" +#include "items/itfflowerflame.h" +#include "items/itflipper.h" +#include "items/itfoods.h" #include "items/itfoxillusion.h" -#include "items/itfoxlaser.h" -#include "items/itfreezer.h" -#include "items/itfushigibana.h" -#include "items/itgamewatchbreath.h" -#include "items/itgamewatchchef.h" -#include "items/itgamewatchfire.h" -#include "items/itgamewatchgreenhouse.h" -#include "items/itgamewatchjudge.h" -#include "items/itgamewatchmanhole.h" -#include "items/itgamewatchpanic.h" -#include "items/itgamewatchparachute.h" -#include "items/itgamewatchrescue.h" -#include "items/itgamewatchturtle.h" -#include "items/ithassam.h" -#include "items/ithinoarashi.h" -#include "items/ithitodeman.h" -#include "items/ithouou.h" -#include "items/itkabigon.h" -#include "items/itkamex.h" -#include "items/itkirbycutterbeam.h" -#include "items/itkirbygamewatchchefpan.h" -#include "items/itkirbyhammer.h" -#include "items/itkireihana.h" -#include "items/itkoopaflame.h" -#include "items/itleadead.h" +#include "items/itfreeze.h" +#include "items/itgshell.h" +#include "items/ithammer.h" +#include "items/ithammerhead.h" +#include "items/itharisen.h" +#include "items/itheart.h" +#include "items/itkinoko.h" +#include "items/itkusudama.h" +#include "items/itlgun.h" +#include "items/itlgunbeam.h" +#include "items/itlgunray.h" #include "items/itlinkarrow.h" -#include "items/itlinkbomb.h" #include "items/itlinkboomerang.h" -#include "items/itlinkbow.h" -#include "items/itlinkhookshot.h" -#include "items/itlizardon.h" -#include "items/itlucky.h" -#include "items/itlugia.h" -#include "items/itluigifireball.h" -#include "items/itmaril.h" -#include "items/itmariocape.h" -#include "items/itmariofireball.h" -#include "items/itmarumine.h" -#include "items/itmasterhandbullet.h" -#include "items/itmasterhandlaser.h" -#include "items/itmatadogas.h" -#include "items/itmetamon.h" -#include "items/itmew.h" -#include "items/itmewtwodisable.h" -#include "items/itmewtwoshadowball.h" -#include "items/itnessbat.h" -#include "items/itnessfirepillar.h" -#include "items/itnesspkfire.h" -#include "items/itnesspkflush.h" -#include "items/itnesspkflushexplode.h" -#include "items/itnesspkthunderball.h" -#include "items/itnesspkthundertrail.h" -#include "items/itnessyoyo.h" -#include "items/itoctarock.h" -#include "items/itoctarockstone.h" -#include "items/itoldkuri.h" -#include "items/itoldottosea.h" -#include "items/itpeachexplode.h" -#include "items/itpeachparasol.h" -#include "items/itpeachtoad.h" -#include "items/itpeachtoadspore.h" -#include "items/itpeachturnip.h" -#include "items/itpikachuthunder.h" -#include "items/itpikachutjoltair.h" -#include "items/itpikachutjoltground.h" -#include "items/itpippi.h" -#include "items/itporygon2.h" -#include "items/itraikou.h" -#include "items/itsamusbomb.h" -#include "items/itsamuschargeshot.h" -#include "items/itsamusgrapple.h" -#include "items/itsamusmissile.h" -#include "items/itseakchain.h" -#include "items/itseakneedleheld.h" -#include "items/itseakneedlethrown.h" -#include "items/itseakvanish.h" -#include "items/itsonans.h" -#include "items/itsuikun.h" -#include "items/itthunder.h" -#include "items/ittogepy.h" -#include "items/ittosakinto.h" -#include "items/itunknown.h" -#include "items/ityoshieggthrow.h" -#include "items/ityoshistar.h" -#include "items/itzeldadinfire.h" -#include "items/itzeldadinfireexplode.h" - -HSD_ObjAllocUnk4 it_804A0E30; -HSD_ObjAllocUnk6 it_804A0E50; -HSD_ObjAllocUnk6 it_804A0E60; -// u8 it_804A0E70[0xF0]; - -struct sdata_ItemGXLink it_803F2310[] = { - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, +#include "items/itlipstick.h" +#include "items/itlipstickspore.h" +#include "items/itmball.h" +#include "items/itmetalb.h" +#include "items/itmsbomb.h" +#include "items/itparasol.h" +#include "items/itrabbitc.h" +#include "items/itrshell.h" +#include "items/itscball.h" +#include "items/itspycloak.h" +#include "items/itsscope.h" +#include "items/itsscopebeam.h" +#include "items/itstar.h" +#include "items/itstarrod.h" +#include "items/itstarrodstar.h" +#include "items/itsword.h" +#include "items/ittaru.h" +#include "items/ittarucann.h" +#include "items/ittomato.h" +#include "items/itwstar.h" +#include "lb/lb_00B0.h" +#include "lb/lb_00F9.h" +#include "lb/lbaudio_ax.h" +#include "lb/lbcollision.h" +#include "lb/lbcommand.h" +#include "lb/lbvector.h" +#include "mp/mpcoll.h" +#include "mp/mplib.h" +#include "pl/pl_0371.h" +#include "pl/plattack.h" +#include "pl/plbonuslib.h" +#include "pl/plstale.h" +#include "pl/pltrick.h" +#include "ty/tydisplay.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern Vec3 it_803B8570; // { 0.0f, 0.0f, 0.0f } +extern Vec3 it_803B857C; // { 0.0f, 0.0f, 0.0f } +extern Quaternion it_803B8588; //{ 0.0f, 0.0f, 0.0f, 0.0f } +extern Quaternion it_803B8598; //{ 0.0f, 0.0f, 0.0f, 0.0f } +extern const Vec3 it_803B85A8[6]; +extern s32 it_803B85F0[4]; + +// Common items +struct sdata_ItemGXLink it_803F1418[43] = { it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_80284E10, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, }; -ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { +struct ItemLogicTable it_803F14C4[ARRAY_SIZE(it_803F1418)] = { { - // Tosakinto (Goldeen) - it_803F7A48, - it_802C8F4C, - it_802C9504, + // Capsule + it_803F5468, + it_8027CF00, NULL, + it_8027D1D4, + it_8027D208, + it_8027D230, + it_8027D338, + it_8027D414, + it_8027D450, + it_8027D4F4, + it_8027D4B8, NULL, + it_8027D614, + it_8027D530, + it_8027D650, + }, + { + // Box + it_803F5850, + it_802861CC, + it_80286208, + it_80286780, + it_80286964, + it_802867B4, + it_80286CB4, + it_80286F04, + it_80286FC8, + it_80286E70, + it_80286D48, NULL, NULL, + it_80286DDC, + it_80287084, + }, + { + // Taru + it_803F58E0, + it_80287458, NULL, + it_80287E68, + it_80287EA8, + it_80287EC8, + it_80288818, + it_80288A98, NULL, + it_802889F8, + it_802888B8, NULL, NULL, + it_80288958, + it_80288C68, + }, + { + // Egg + it_803F5988, + it_80288D98, NULL, + it_80288F88, + it_80288FBC, + it_80288FDC, + it_80289218, + it_802895A8, + it_80289644, + it_8028950C, + it_802893D4, NULL, NULL, - it_802C8FC4, + it_80289470, + it_802896AC, }, { - // Chicorita - it_803F7A98, - it_802C9588, - NULL, - NULL, + // Kusudama + it_803F59F8, + it_80289784, NULL, + it_8028A93C, + it_8028AB28, + it_8028A970, + it_8028AEA4, + it_8028AFC4, NULL, + it_8028AF8C, + it_8028AF1C, NULL, NULL, + it_8028AF54, + it_8028B06C, + }, + { + // TaruCann + it_803F63C0, + it_80296120, + it_802960E0, + it_8029683C, + it_802968D8, + it_80296930, + it_8029789C, NULL, NULL, + it_802978B4, + it_802978A4, NULL, NULL, + it_802978AC, + it_802978BC, + }, + { + // BombHei + it_803F54D8, + it_8027D76C, NULL, + it_8027E0B4, + it_8027E648, + it_80280380, + it_80280DF0, + it_80280E30, + it_80280E9C, + it_802810A4, + it_80281070, NULL, - it_802C961C, + it_80281104, + it_802810C4, + it_80281144, }, { - // Kabigon (Snorlax) - it_803F7AD8, - it_802C9D40, - it_802C9E00, - NULL, + // Dosei + it_803F55D0, + it_80281164, NULL, + it_8028218C, + it_802826F8, + it_802829FC, + it_802839BC, + it_80283588, + it_80282B14, + it_80283A3C, + it_80283A5C, NULL, + it_80283AA4, + it_80283A80, + it_80283AC4, + }, + { + // Heart + it_803F56C8, + it_80283BEC, + it_80283C48, + it_80283F28, + it_8028402C, NULL, NULL, NULL, + it_8028412C, NULL, NULL, NULL, NULL, NULL, - it_802C9E24, + it_80284194, }, { - // Kamex (Blastoise) - it_803F7B08, - it_802CA49C, - NULL, + // Tomato + it_803F5740, + it_802842A4, + it_80284324, + it_802844E4, + it_8028454C, NULL, NULL, NULL, + it_802845BC, NULL, NULL, NULL, NULL, NULL, - NULL, - NULL, - NULL, - it_802CA538, + it_80284624, }, { - // Matadogas (Weezing) - it_803F7B58, - it_802CAFD4, - NULL, + // Star + it_803F57A0, + it_80284644, NULL, NULL, NULL, NULL, + it_8028482C, NULL, NULL, NULL, @@ -219,107 +477,305 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802CB0F8, + it_80284834, }, { - // Lizardon (Charizard) - it_803F7BC0, - it_802CB8AC, - NULL, + // Bat + it_803F57B0, + it_80284910, NULL, + it_80284AAC, + it_80284B30, + it_80284BA0, + it_80284C78, NULL, + it_80284C10, + it_80284CAC, + it_80284CCC, NULL, + it_80284D14, + it_80284CF0, + it_80284D34, + }, + { + // Sword + it_803F5800, + it_80285338, NULL, + it_80285804, + it_80285B00, + it_80285C78, + it_80285FAC, NULL, + it_80285DF0, + it_80285FE0, + it_80286000, NULL, + itSword_BounceOffShield, + it_80286024, + it_80286068, + }, + { + // Parasol + it_803F5AB0, + it_8028B0B8, NULL, + it_8028B5E8, + it_8028B3C0, + it_8028B3E0, + it_8028B4D4, NULL, + it_8028B580, + it_8028B540, + it_8028B4F8, NULL, + it_8028B560, + it_8028B51C, + it_8028B8B8, + }, + { + // G Shell + it_803F5BA8, + it_8028BDAC, NULL, + it_8028C148, + it_8028C300, + it_8028C1AC, + it_8028CCA8, + it_8028CCCC, + it_8028CB24, + it_8028CD04, + it_8028CD3C, NULL, - it_802CB940, + it_8028CF2C, + it_8028CE1C, + it_8028CFC0, }, { - // Fire (Moltres) - it_803F7C10, - it_802CC6E4, - NULL, + // R Shell + it_803F5C48, + it_8028D59C, NULL, + it_8028D898, + it_8028D9F4, + it_8028D8E0, + it_8028E540, + it_8028E584, + it_8028E3CC, + it_8028E5C8, + it_8028E600, NULL, + it_8028E684, + it_8028E624, + it_8028E718, + }, + { + // L Gun + it_803F5CC8, + it_8028E738, NULL, + it_8028E904, + it_8028E9B8, + it_8028E9E0, + it_8028EA54, NULL, + it_8028EB00, + it_8028EAC0, + it_8028EA78, NULL, + it_8028EAE0, + it_8028EA9C, + it_8028EB68, + }, + { + // Freeze + it_803F5D28, + it_8028ED50, + it_8028ED10, + it_8028F2B4, + it_8028F318, + it_8028F340, + it_8028F3CC, + it_8028F42C, NULL, + it_8028F3EC, + it_8028F3D4, + it_8028F3E4, + it_8028F40C, + it_8028F3DC, + it_8028F8C4, + }, + { + // Foods + it_803F5DB0, + it_8028FBE4, NULL, + it_8028FD7C, + it_8028FDE4, NULL, NULL, NULL, NULL, - it_802CC744, - }, - { - // Thunder (Zapdos) - it_803F7C40, - it_802CCAB4, NULL, NULL, NULL, NULL, NULL, + it_8028FE70, + }, + { + // MSBomb + it_803F5E00, + it_8028FED4, NULL, + it_802900CC, + it_802900F4, + it_80290114, + it_802906E4, + it_80290738, + it_80290794, + it_80290830, + it_802907F0, NULL, + it_802908A4, + it_80290850, + it_80290918, + }, + { + // Flipper + it_803F5EA8, + it_80290A20, NULL, + it_80290F8C, + it_80290FC0, + it_80290FE0, + it_802915E8, + it_802919B8, + it_80291B58, + it_80291978, + it_802917C8, NULL, + it_80291998, + it_802918A0, + it_80291BC0, + }, + { + // S_Scope + it_803F5F40, + it_80291C98, NULL, + it_8029215C, + it_80292190, + it_802921B8, + it_8029222C, NULL, + it_802922D8, + it_80292298, + it_80292250, NULL, - it_802CCB14, + it_802922B8, + it_80292274, + it_80292340, }, { - // Freezer (Articuno) - it_803F7C70, - it_802CCF9C, + // StarRod + it_803F5F90, + it_80292360, NULL, + it_80292514, + it_80292548, + it_802925B4, + it_8029266C, NULL, + it_802926A8, + it_8029274C, + it_80292710, NULL, + it_802927A8, + it_8029276C, + it_802927C8, + }, + { + // LipStick + it_803F6310, + it_8029570C, NULL, + it_802958C8, + it_80295908, + it_80295974, + it_80295ACC, NULL, + it_80295B08, + it_80295BAC, + it_80295B70, NULL, + it_80295C08, + it_80295BCC, + it_80295C28, + }, + { + // Harisen + it_803F5FF0, + it_8029285C, NULL, + it_80292A5C, + it_80292A90, + it_80292B2C, + it_80292BCC, NULL, + it_80292C08, + it_80292CAC, + it_80292C70, NULL, + it_80292D08, + it_80292CCC, + it_80292D28, + }, + { + // F Flower + it_803F6090, + it_80292E04, NULL, + it_80293284, + it_802933C4, + it_802933EC, + it_80293488, NULL, + it_80293534, + it_802934F4, + it_802934AC, NULL, - it_802CD000, + it_80293514, + it_802934D0, + it_80293640, }, { - // Sonans (Wobbuffet) - it_803F7CA0, - it_802CD44C, + // Kinoko + it_803F6110, + it_8029367C, NULL, NULL, NULL, NULL, - it_802CD7B8, - it_802CD7D4, + it_802939E0, NULL, NULL, NULL, NULL, NULL, NULL, - it_802CD4DC, + NULL, + it_802939E8, }, { - // Hassam (Scizor) - it_803F7CF8, - it_802CDBE0, - NULL, + // DKinoko + it_803F6130, + it_80293A08, NULL, NULL, NULL, NULL, + it_80293D6C, NULL, NULL, NULL, @@ -327,175 +783,348 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802CDC60, + it_80293D74, }, { - // Unknown (Unown) - it_803F7D60, - it_802CE710, + // Hammer + it_803F6150, + it_80293F58, NULL, + it_802940FC, + it_802941F8, NULL, NULL, NULL, + it_802942B0, NULL, NULL, NULL, NULL, NULL, - NULL, - NULL, - NULL, - it_802CE7D0, + it_80294344, }, { - // Entei - it_803F7DC8, - it_802CF3E0, - NULL, + // WStar + it_803F61B0, + it_8029451C, NULL, + it_80294728, + it_80294790, NULL, NULL, NULL, + it_80294A28, NULL, NULL, NULL, NULL, NULL, - NULL, - NULL, - it_802CF450, + it_80294A90, }, { - // Raikou - it_803F7DE8, - it_802CF814, + // ScBall + it_803F6220, + it_80294AB0, NULL, + it_80294BE4, + it_80294C14, + it_80294C3C, + it_80294D4C, NULL, + it_80294CE4, + it_80294D5C, + it_80294D54, NULL, + it_80294DA0, + it_80294D7C, + it_80294A90, + }, + { + // RabbitC + it_803F6270, + it_80295118, NULL, + it_8029524C, + it_80295298, NULL, NULL, NULL, + it_80295340, NULL, NULL, NULL, NULL, NULL, - it_802CF884, + it_802953A8, }, { - // Suikun (Suicune) - it_803F7E08, - it_802CFC48, - NULL, - NULL, - NULL, - NULL, + // MetalB + it_803F62C0, + it_802953C8, NULL, + it_80295524, + it_80295554, NULL, NULL, + it_802955E0, + it_80295684, NULL, NULL, NULL, NULL, NULL, - it_802CFCB8, + it_802956EC, }, { - // Kireihana (Bellossom) - it_803F7E28, - it_802D007C, - NULL, + // Spycloak + it_803F6370, + it_80295C48, NULL, + it_80295D90, + it_80295DC0, NULL, NULL, NULL, + it_80295E4C, NULL, NULL, NULL, NULL, NULL, + it_80295EB4, + }, + { + // M Ball + it_803F6488, + it_80297904, + it_802978DC, + it_80297ABC, + it_80297AF0, + it_80297B18, + it_80297BB8, NULL, + it_80297BF8, + it_802980A0, + it_80298060, NULL, - it_802D0118, + it_80298114, + it_802980D4, + it_80298148, }, { - // Marumine (Electrode) - it_803F7E78, - it_802D0A0C, - NULL, - it_802D0D18, - it_802D0E30, - it_802D0E90, - it_802D0AD0, + // L Gun Ray + it_803F64F8, NULL, NULL, NULL, NULL, NULL, + it_80298634, NULL, NULL, - it_802D0AB0, + it_80298654, + it_8029863C, + it_8029864C, + it_80298828, + it_80298644, + it_802988C4, }, { - // Lugia - it_803F7EE8, - it_802D1438, + // Star Rod Star + it_803F6530, NULL, NULL, NULL, NULL, NULL, + it_80298BE4, NULL, NULL, + it_80298C04, + it_80298BEC, + it_80298BFC, + it_80298CE8, + it_80298BF4, + it_80298DCC, + }, + { + // LipStick Spore + it_803F6680, NULL, NULL, NULL, NULL, NULL, - it_802D14D4, + it_8029A600, + NULL, + NULL, + it_8029A620, + it_8029A608, + it_8029A618, + it_8029A704, + it_8029A610, + it_8029A728, }, { - // Houou (Ho-oh) - it_803F7F58, - it_802D251C, + // S Scope Beam + it_803F6568, NULL, NULL, NULL, NULL, NULL, + it_80299360, NULL, NULL, + it_802993A0, + it_80299368, + it_80299378, + it_80299380, + it_80299370, + it_802993C0, + }, + { + // L Gun Beam + it_803F6630, NULL, NULL, NULL, NULL, NULL, - it_802D25BC, + it_80299B6C, + NULL, + NULL, + it_80299B74, + it_80299C08, + it_80299C10, + it_80299C18, + it_80299C20, + it_80299C28, }, { - // Metamon (Ditto) - it_803F7FC8, - it_802D3008, + // Hammer Head + it_803F6640, + it_80299D4C, NULL, + it_80299DD0, + it_80299E28, + it_80299E48, + it_8029A0B0, + it_8029A0EC, NULL, + it_8029A0C8, + it_8029A0B8, NULL, NULL, + it_8029A0C0, + it_8029A0F4, + }, + { + // F Flower Flame + it_803F66C8, + it_8029A9FC, NULL, + it_8029AD1C, + it_8029AD94, NULL, NULL, NULL, + it_8029AF34, NULL, NULL, NULL, NULL, - it_802D3070, + NULL, + it_8029B0A8, }, { - // Pippi (Clefairy) - it_803F7FF8, - it_802D3260, + // EvYoshiEgg + it_803F6728, + it_8029B1AC, + it_8029B188, + it_8029B2F4, + it_8029B328, + it_8029B348, + it_8029B46C, + it_8029B56C, + it_8029B670, + it_8029B52C, + it_8029B4AC, + NULL, NULL, + it_8029B4EC, + it_8029B6D8, + }, +}; + +// static char it_803F1ED8[]; // unsure of type +// static char it_803F1EE4[]; // unsure of type +// static char it_803F1EF0[]; // unsure of type +// static char it_803F1F00[] = "!(jobj->flags & JOBJ_USE_QUATERNION)"; // ? +// "translate" static char it_803F1F0C[] = "!(jobj->flags & +// JOBJ_USE_QUATERNION)"; // ? + +// char it_803F1F38[]; +char* it_803F1F38; +// char it_803F1F58[]; +char* it_803F1F58; + +HSD_ClassInfo it_803F1F90; +// = { +// (struct _HSD_ClassInfoHead) { +// it_80277D08, // void (*info_init)(void); +// 0x00000000, // u32 flags; +// 0x00000000, // char* library_name; +// 0x00000000, // char* class_name; +// 0x00000000, // s16 obj_size; +// 0x00000000, // s16 info_size; +// 0x00000000, // struct _HSD_ClassInfo* parent; +// 0x00000000, // struct _HSD_ClassInfo* next; +// 0x00000000, // struct _HSD_ClassInfo* child; +// 0x00000000, // u32 nb_exist; +// 0x00000000, // u32 nb_peak; +// }, +// 0x00000000, // HSD_Class* (*alloc)(struct _HSD_ClassInfo* c); +// 0x00000000, // int (*init)(struct _HSD_Class* c); +// 0x00000000, // void (*release)(struct _HSD_Class* c); +// 0x00000000, // void (*destroy)(struct _HSD_Class* c); +// 0x00000000, // void (*amnesia)(struct _HSD_ClassInfo* c); +// // ... lots more data, but no other struct elements to put them in +// }; + +void* jumptable_803F20E0[114]; + +static ItCmd it_803F22A8[16] = { + // static void* it_803F22A8[16] = { + it_80278F2C, it_802790C0, it_80279544, it_802795EC, + it_80279680, it_802796C4, it_8027978C, it_802796FC, + it_80279720, it_80279744, it_80279768, it_80279888, + it_802798D4, it_8027990C, it_80279958, it_802799A8, +}; + +char it_803F22E8; +char it_803F2300; + +// Pokemon items +struct sdata_ItemGXLink it_803F2310[47] = { + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, +}; + +ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { + { + // Tosakinto (Goldeen) + it_803F7A48, + it_802C8F4C, + it_802C9504, NULL, NULL, NULL, @@ -507,12 +1136,12 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802D32DC, + it_802C8FC4, }, { - // Togepy - it_803F8058, - it_802D36B0, + // Chicorita + it_803F7A98, + it_802C9588, NULL, NULL, NULL, @@ -525,13 +1154,13 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802D372C, + it_802C961C, }, { - // Mew - it_803F80C8, - it_802D3B18, - NULL, + // Kabigon (Snorlax) + it_803F7AD8, + it_802C9D40, + it_802C9E00, NULL, NULL, NULL, @@ -543,12 +1172,12 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802D3B6C, + it_802C9E24, }, { - // Cerebi - it_803F80F8, - it_802D3EF8, + // Kamex (Blastoise) + it_803F7B08, + it_802CA49C, NULL, NULL, NULL, @@ -561,12 +1190,12 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802D3F4C, + it_802CA538, }, { - // Hitodeman (Staryu) - it_803F8128, - it_802D42C4, + // Matadogas (Weezing) + it_803F7B58, + it_802CAFD4, NULL, NULL, NULL, @@ -579,30 +1208,30 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802D43B0, + it_802CB0F8, }, { - // Lucky (Chansey) - it_803F8190, - it_802D5050, + // Lizardon (Charizard) + it_803F7BC0, + it_802CB8AC, NULL, NULL, NULL, NULL, NULL, - it_802D5648, NULL, NULL, NULL, NULL, NULL, NULL, - it_802D56F0, + NULL, + it_802CB940, }, { - // Porygon2 - it_803F8250, - it_802D5ABC, + // Fire (Moltres) + it_803F7C10, + it_802CC6E4, NULL, NULL, NULL, @@ -615,102 +1244,102 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802D5CD8, + it_802CC744, }, { - // Hinoarashi (Cyndaquil) - it_803F8270, - it_802D5CF8, + // Thunder (Zapdos) + it_803F7C40, + it_802CCAB4, NULL, NULL, NULL, NULL, NULL, - it_802D6100, NULL, NULL, NULL, NULL, NULL, NULL, - it_802D61A8, + NULL, + it_802CCB14, }, { - // Maril - it_803F82B0, - it_802D6870, + // Freezer (Articuno) + it_803F7C70, + it_802CCF9C, NULL, NULL, NULL, NULL, NULL, - it_802D6F00, NULL, NULL, NULL, NULL, NULL, NULL, - it_802D6FB0, + NULL, + it_802CD000, }, { - // Fushigibana (Venusaur) - it_803F82F0, - it_802D6FD0, - NULL, - NULL, + // Sonans (Wobbuffet) + it_803F7CA0, + it_802CD44C, NULL, NULL, NULL, NULL, + it_802CD7B8, + it_802CD7D4, NULL, NULL, NULL, NULL, NULL, NULL, - it_802D73D0, + it_802CD4DC, }, { - // Chicorita leaf - it_803F7AC8, - it_802C9C20, + // Hassam (Scizor) + it_803F7CF8, + it_802CDBE0, NULL, NULL, NULL, NULL, - it_802C9C78, NULL, NULL, - it_802C9CA0, - it_802C9C78, - it_802C9C78, NULL, - it_802C9C78, - it_802C9C80, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802CDC60, }, { - // Kamex hydro pump - it_803F7B48, - it_802CACD0, + // Unknown (Unown) + it_803F7D60, + it_802CE710, NULL, NULL, NULL, NULL, - it_802CADC8, NULL, NULL, NULL, NULL, NULL, NULL, - it_802CADC0, - it_802CADD0, + NULL, + NULL, + it_802CE7D0, }, { - // Matadogas gas 1 - it_803F7BB0, - it_802CB690, + // Entei + it_803F7DC8, + it_802CF3E0, NULL, NULL, NULL, @@ -723,12 +1352,12 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802CB778, + it_802CF450, }, { - // Matadogas gas 2 - it_803F7BB0, - it_802CB704, + // Raikou + it_803F7DE8, + it_802CF814, NULL, NULL, NULL, @@ -741,12 +1370,12 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802CB778, + it_802CF884, }, { - // Lizardon flame 1 - it_803F7C00, - it_802CC3D4, + // Suikun (Suicune) + it_803F7E08, + it_802CFC48, NULL, NULL, NULL, @@ -754,17 +1383,17 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802CC5A4, NULL, - it_802CC5CC, NULL, - it_802CC5C4, - it_802CC584, + NULL, + NULL, + NULL, + it_802CFCB8, }, { - // Lizardon flame 2 - it_803F7C00, - it_802CC440, + // Kireihana (Bellossom) + it_803F7E28, + it_802D007C, NULL, NULL, NULL, @@ -772,35 +1401,35 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802CC5A4, NULL, - it_802CC5CC, NULL, - it_802CC5C4, - it_802CC584, + NULL, + NULL, + NULL, + it_802D0118, }, { - // Lizardon flame 3 - it_803F7C00, - it_802CC4AC, - NULL, + // Marumine (Electrode) + it_803F7E78, + it_802D0A0C, NULL, + it_802D0D18, + it_802D0E30, + it_802D0E90, + it_802D0AD0, NULL, NULL, NULL, NULL, NULL, - it_802CC5A4, NULL, - it_802CC5CC, NULL, - it_802CC5C4, - it_802CC584, + it_802D0AB0, }, { - // Lizardon flame 4 - it_803F7C00, - it_802CC518, + // Lugia + it_803F7EE8, + it_802D1438, NULL, NULL, NULL, @@ -808,17 +1437,17 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802CC5A4, NULL, - it_802CC5CC, NULL, - it_802CC5C4, - it_802CC584, + NULL, + NULL, + NULL, + it_802D14D4, }, { - // Unknown swarm (mini-unowns) - it_803F7D90, - it_802CEEC8, + // Houou (Ho-oh) + it_803F7F58, + it_802D251C, NULL, NULL, NULL, @@ -831,12 +1460,12 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802CF0B4, + it_802D25BC, }, { - // Lugia aeroblast 1 - it_803F7F48, - it_802D2308, + // Metamon (Ditto) + it_803F7FC8, + it_802D3008, NULL, NULL, NULL, @@ -849,12 +1478,12 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802D23D4, + it_802D3070, }, { - // Lugia aeroblast 2 - it_803F7F48, - it_802D234C, + // Pippi (Clefairy) + it_803F7FF8, + it_802D3260, NULL, NULL, NULL, @@ -867,12 +1496,12 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802D23D4, + it_802D32DC, }, { - // Lugia aeroblast 3 - it_803F7F48, - it_802D2390, + // Togepy + it_803F8058, + it_802D36B0, NULL, NULL, NULL, @@ -885,12 +1514,12 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802D23D4, + it_802D372C, }, { - // Houou sacred fire - it_803F7FB8, - it_802D2E80, + // Mew + it_803F80C8, + it_802D3B18, NULL, NULL, NULL, @@ -903,93 +1532,71 @@ ItemLogicTable it_803F23CC[ARRAY_SIZE(it_803F2310)] = { NULL, NULL, NULL, - it_802D2ED0, + it_802D3B6C, }, { - // Hitodeman star - it_803F8180, - it_802D4DE0, + // Cerebi + it_803F80F8, + it_802D3EF8, NULL, NULL, NULL, NULL, - it_802D4EF4, NULL, NULL, - it_802D4F28, NULL, - it_802D4F48, - it_802D4F08, - it_802D4F50, - it_802D4F58, - }, - { - // Lucky egg - it_803F8200, - it_802D57D0, NULL, - it_802D59A8, - it_802D59DC, NULL, NULL, NULL, - it_802D5A04, NULL, + it_802D3F4C, + }, + { + // Hitodeman (Staryu) + it_803F8128, + it_802D42C4, NULL, NULL, NULL, NULL, - it_802D5A9C, - }, - { - // Hinoarashi flame - it_803F82A0, NULL, NULL, NULL, NULL, NULL, - it_802D6808, NULL, NULL, - it_802D6810, - it_802D6830, - it_802D6838, - it_802D6840, - it_802D6848, - it_802D6850, + NULL, + it_802D43B0, }, { + // Lucky (Chansey) + it_803F8190, + it_802D5050, NULL, NULL, NULL, NULL, NULL, + it_802D5648, NULL, NULL, NULL, NULL, NULL, NULL, + it_802D56F0, + }, + { + // Porygon2 + it_803F8250, + it_802D5ABC, NULL, NULL, NULL, NULL, - }, -}; - -// Character-specific items -struct ItemLogicTable it_803F3100[] = { - { - // Kuriboh - it_803F8320, - it_802D73F0, - it_8027C8B0, - it_802D7C14, - it_802D7CB4, - it_802D7D18, NULL, - it_802D7F38, NULL, NULL, NULL, @@ -997,154 +1604,102 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, + it_802D5CD8, }, { - // Leadead - it_803F8EB0, - it_802E8BCC, - it_802EA41C, - it_802EA0E0, - it_802EA154, - it_802EA1B4, + // Hinoarashi (Cyndaquil) + it_803F8270, + it_802D5CF8, NULL, - it_802E8CD8, NULL, NULL, NULL, NULL, - NULL, - NULL, - NULL, - }, - { - // Octarock - it_803F8B48, - it_802E4A44, - it_8027C8B0, - it_802E561C, - it_802E5690, - it_802E56E8, - NULL, - it_802E4B00, + it_802D6100, NULL, NULL, NULL, NULL, NULL, NULL, - it_802E5AA4, + it_802D61A8, }, { - // Ottosea - it_803F89C8, - it_802E2470, - it_802E34DC, - it_802E31F8, - it_802E32B4, - it_802E3314, - NULL, - it_802E257C, - NULL, + // Maril + it_803F82B0, + it_802D6870, NULL, NULL, NULL, NULL, NULL, - it_802E3784, - }, - { - // Octarock stone - it_803F8E90, - it_802E878C, + it_802D6F00, NULL, NULL, NULL, NULL, - it_802E87D8, NULL, NULL, - it_802E87F8, - it_802E87E0, - it_802E87F0, - it_802E881C, - it_802E87E8, - it_802E89B0, + it_802D6FB0, }, { - // Mario fireball - it_803F6788, - NULL, + // Fushigibana (Venusaur) + it_803F82F0, + it_802D6FD0, NULL, NULL, NULL, NULL, - it_8029BA38, NULL, NULL, - it_8029BA40, - it_8029BA60, - it_8029BA70, - it_8029BA78, - it_8029BA68, - it_8029BA98, - }, - { - // Dr Mario pill - it_803F75D0, NULL, NULL, - it_802C11E0, NULL, NULL, - it_802C1384, NULL, NULL, - it_802C13CC, - it_802C1400, - it_802C14B8, - it_802C1514, - it_802C145C, - it_802C1570, + it_802D73D0, }, { - // Kirby cutter beam - it_803F6798, + // Chicorita leaf + it_803F7AC8, + it_802C9C20, NULL, NULL, NULL, NULL, + it_802C9C78, NULL, - it_8029BFB4, NULL, + it_802C9CA0, + it_802C9C78, + it_802C9C78, NULL, - it_8029BFCC, - it_8029BFBC, - it_8029BFC4, - it_8029C208, - it_8029C4AC, - it_8029C4B4, + it_802C9C78, + it_802C9C80, }, { - // Kirby hammer - it_803F6C98, - NULL, - it_802ADC04, - it_802ADD88, + // Kamex hydro pump + it_803F7B48, + it_802CACD0, NULL, NULL, NULL, NULL, + it_802CADC8, NULL, NULL, NULL, NULL, NULL, NULL, - it_802ADDB0, + it_802CADC0, + it_802CADD0, }, { - it_803F6C88, - NULL, + // Matadogas gas 1 + it_803F7BB0, + it_802CB690, NULL, NULL, NULL, @@ -1157,11 +1712,12 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802ADBE4, + it_802CB778, }, { - it_803F9470, - NULL, + // Matadogas gas 2 + it_803F7BB0, + it_802CB704, NULL, NULL, NULL, @@ -1174,158 +1730,103 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802F2BDC, + it_802CB778, }, { - // Fox laser - it_803F67D0, + // Lizardon flame 1 + it_803F7C00, + it_802CC3D4, NULL, NULL, NULL, NULL, NULL, - it_8029CA78, NULL, NULL, - it_8029CA80, - it_8029CA78, - it_8029CC4C, - it_8029CC54, - it_8029CCF0, - it_8029CCF8, + it_802CC5A4, + NULL, + it_802CC5CC, + NULL, + it_802CC5C4, + it_802CC584, }, { - // Falco laser - it_803F67D0, + // Lizardon flame 2 + it_803F7C00, + it_802CC440, NULL, NULL, NULL, NULL, NULL, - it_8029CA78, NULL, NULL, - it_8029CA80, - it_8029CA78, - it_8029CC4C, - it_8029CC54, - it_8029CCF0, - it_8029CCF8, - }, - { - // Fox illusion - it_803F6818, + it_802CC5A4, NULL, - it_8029CFA0, + it_802CC5CC, NULL, + it_802CC5C4, + it_802CC584, + }, + { + // Lizardon flame 3 + it_803F7C00, + it_802CC4AC, NULL, NULL, - it_8029CF8C, NULL, NULL, NULL, NULL, NULL, + it_802CC5A4, NULL, + it_802CC5CC, NULL, - it_8029D948, + it_802CC5C4, + it_802CC584, }, { - // Falco phantasm - it_803F6818, - NULL, - it_8029CFA0, - NULL, + // Lizardon flame 4 + it_803F7C00, + it_802CC518, NULL, NULL, - it_8029CF8C, NULL, NULL, NULL, NULL, NULL, + it_802CC5A4, NULL, + it_802CC5CC, NULL, - it_8029D948, + it_802CC5C4, + it_802CC584, }, { - // Link bomb - it_803F6888, - NULL, - NULL, - it_8029DEB0, - it_8029EC34, - it_8029E5D0, - it_8029F960, - it_8029FA30, - it_8029FB24, - it_8029FD20, + // Unknown swarm (mini-unowns) + it_803F7D90, + it_802CEEC8, NULL, NULL, - it_8029FD64, - it_8029FD40, - it_8029FD84, - }, - { - // Young Link bomb - it_803F6888, NULL, NULL, - it_8029DEB0, - it_8029EC34, - it_8029E5D0, - it_8029F960, - it_8029FA30, - it_8029FB24, - it_8029FD20, NULL, NULL, - it_8029FD64, - it_8029FD40, - it_8029FD84, - }, - { - // Link boomerang - it_803F6920, NULL, - it_802A087C, - it_802A0E70, - it_802A0F84, - it_802A0F88, - it_802A1F08, NULL, NULL, - it_802A20E8, - it_802A1FA8, - it_802A2048, - it_802A2320, - it_802A2288, - it_802A23CC, - }, - { - // Young Link boomerang - it_803F6920, NULL, - it_802A087C, - it_802A0E70, - it_802A0F84, - it_802A0F88, - it_802A1F08, NULL, NULL, - it_802A20E8, - it_802A1FA8, - it_802A2048, - it_802A2320, - it_802A2288, - it_802A23CC, + it_802CF0B4, }, { - // Link hookshot - it_803F6998, - it_802A2418, + // Lugia aeroblast 1 + it_803F7F48, + it_802D2308, NULL, - it_802A7688, NULL, NULL, NULL, @@ -1336,14 +1837,15 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802A7D40, + NULL, + it_802D23D4, }, { - // Young Link hookshot - it_803F6998, + // Lugia aeroblast 2 + it_803F7F48, + it_802D234C, NULL, NULL, - it_802A7688, NULL, NULL, NULL, @@ -1354,119 +1856,100 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802A7D40, + it_802D23D4, }, { - // Link arrow - it_803F6A28, - NULL, - it_802A8984, - it_802A8AF8, - NULL, + // Lugia aeroblast 3 + it_803F7F48, + it_802D2390, NULL, - it_802A9A80, NULL, NULL, - it_802A9D4C, - it_802A9CE0, NULL, NULL, - it_802A9B08, - it_802AA034, - }, - { - // Young Link arrow - it_803F6A28, NULL, - it_802A8984, - it_802A8AF8, NULL, NULL, - it_802A9A80, NULL, NULL, - it_802A9D4C, - it_802A9CE0, NULL, NULL, - it_802A9B08, - it_802AA034, + it_802D23D4, }, { - // Ness PK fire - it_803F6B28, + // Houou sacred fire + it_803F7FB8, + it_802D2E80, NULL, NULL, NULL, NULL, NULL, - it_802AA284, NULL, NULL, - it_802AA35C, - it_802AA2E8, - it_802AA34C, - it_802AA37C, - it_802AA354, - it_802AA474, - }, - { - // Ness PK fire pillar - it_803F6B60, NULL, NULL, NULL, NULL, NULL, + it_802D2ED0, + }, + { + // Hitodeman star + it_803F8180, + it_802D4DE0, NULL, - it_802AA75C, NULL, NULL, NULL, + it_802D4EF4, NULL, NULL, + it_802D4F28, NULL, - it_802AA7C4, + it_802D4F48, + it_802D4F08, + it_802D4F50, + it_802D4F58, }, { - // Ness PK flash - it_803F6B70, + // Lucky egg + it_803F8200, + it_802D57D0, NULL, - it_802AA9CC, + it_802D59A8, + it_802D59DC, NULL, NULL, NULL, + it_802D5A04, NULL, NULL, NULL, - it_802AB2AC, - it_802AB3C0, - it_802AB3C8, NULL, NULL, - it_802AB3D0, + it_802D5A9C, }, { - // Ness PK thunder ball - it_803F6BC8, + // Hinoarashi flame + it_803F82A0, NULL, - it_802AB90C, NULL, NULL, NULL, - it_802AC050, NULL, + it_802D6808, NULL, - it_802AC098, - it_802AC074, - it_802AC338, - it_802AC35C, - it_802AC3F8, - it_802AC41C, + NULL, + it_802D6810, + it_802D6830, + it_802D6838, + it_802D6840, + it_802D6848, + it_802D6850, }, { - // Ness PK thunder trail 1 - it_803F6C08, + NULL, NULL, NULL, NULL, @@ -1482,9 +1965,79 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, }, +}; + +static ItemKind it_803F2ED0[22] = { + // Common Pokemon + Pokemon_Tosakinto, + Pokemon_Chicorita, + Pokemon_Kabigon, + Pokemon_Kamex, + Pokemon_Matadogas, + Pokemon_Lizardon, + Pokemon_Sonans, + Pokemon_Hassam, + Pokemon_Unknown, + Pokemon_Kireihana, + Pokemon_Marumine, + Pokemon_Metamon, + Pokemon_Pippi, + Pokemon_Togepy, + Pokemon_Hitodeman, + Pokemon_Lucky, + Pokemon_Porygon2, + Pokemon_Hinoarashi, + Pokemon_Maril, + Pokemon_Fushigibana, + 0xBC, // Pokemon_Chicorita_Leaf + 0x00, +}; + +// Character-specific items +struct sdata_ItemGXLink it_803F2F28[118] = { + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + + it_8026EECC, it_8026EECC, it_8026EECC, it_8029CD18, it_8029CD18, + + it_8026EECC, it_8026EECC, it_8029FDDC, it_8029FDDC, it_8026EECC, + it_8026EECC, it_802A7D8C, it_802A7D8C, it_8026EECC, it_8026EECC, + + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + + it_8026EECC, it_8026EECC, it_802A7D8C, it_802A7D8C, it_8026EECC, + + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + + it_8026EECC, it_802F13B4, it_8026EECC, +}; + +struct ItemLogicTable it_803F3100[ARRAY_SIZE(it_803F2F28)] = { { - // Ness PK thunder trail 2 - it_803F6C08, + // Kuriboh + it_803F8320, + it_802D73F0, + it_8027C8B0, + it_802D7C14, + it_802D7CB4, + it_802D7D18, + NULL, + it_802D7F38, NULL, NULL, NULL, @@ -1492,6 +2045,17 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, + }, + { + // Leadead + it_803F8EB0, + it_802E8BCC, + it_802EA41C, + it_802EA0E0, + it_802EA154, + it_802EA1B4, + NULL, + it_802E8CD8, NULL, NULL, NULL, @@ -1501,65 +2065,119 @@ struct ItemLogicTable it_803F3100[] = { NULL, }, { - // Ness PK thunder trail 3 - it_803F6C08, + // Octarock + it_803F8B48, + it_802E4A44, + it_8027C8B0, + it_802E561C, + it_802E5690, + it_802E56E8, NULL, + it_802E4B00, NULL, NULL, NULL, NULL, NULL, NULL, + it_802E5AA4, + }, + { + // Ottosea + it_803F89C8, + it_802E2470, + it_802E34DC, + it_802E31F8, + it_802E32B4, + it_802E3314, NULL, + it_802E257C, NULL, NULL, NULL, NULL, NULL, NULL, + it_802E3784, }, { - // Ness PK thunder trail 4 - it_803F6C08, - NULL, + // Octarock stone + it_803F8E90, + it_802E878C, NULL, NULL, NULL, NULL, + it_802E87D8, NULL, NULL, + it_802E87F8, + it_802E87E0, + it_802E87F0, + it_802E881C, + it_802E87E8, + it_802E89B0, + }, + { + // Mario fireball + it_803F6788, NULL, NULL, NULL, NULL, NULL, + it_8029BA38, NULL, NULL, + it_8029BA40, + it_8029BA60, + it_8029BA70, + it_8029BA78, + it_8029BA68, + it_8029BA98, }, { - // Fox blaster - it_803F6CA8, + // Dr Mario pill + it_803F75D0, NULL, NULL, - it_802AEB00, + it_802C11E0, + NULL, NULL, + it_802C1384, NULL, NULL, + it_802C13CC, + it_802C1400, + it_802C14B8, + it_802C1514, + it_802C145C, + it_802C1570, + }, + { + // Kirby cutter beam + it_803F6798, NULL, NULL, NULL, NULL, NULL, + it_8029BFB4, NULL, NULL, - it_802AF184, + it_8029BFCC, + it_8029BFBC, + it_8029BFC4, + it_8029C208, + it_8029C4AC, + it_8029C4B4, }, { - // Falco blaster - it_803F6CA8, - NULL, + // Kirby hammer + it_803F6C98, NULL, - it_802AEB00, + it_802ADC04, + it_802ADD88, NULL, NULL, NULL, @@ -1570,14 +2188,11 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802AF184, + it_802ADDB0, }, { - // Link bow - it_803F6E98, + it_803F6C88, NULL, - it_802AF298, - it_802AF434, NULL, NULL, NULL, @@ -1588,14 +2203,13 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802AF920, + NULL, + NULL, + it_802ADBE4, }, { - // Young Link bow - it_803F6E98, + it_803F9470, NULL, - it_802AF298, - it_802AF434, NULL, NULL, NULL, @@ -1606,53 +2220,55 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802AF920, + NULL, + NULL, + it_802F2BDC, }, { - // Ness PK flush explode - it_803F6F40, - NULL, - it_802AFA2C, + // Fox laser + it_803F67D0, NULL, NULL, NULL, NULL, NULL, + it_8029CA78, NULL, NULL, - it_802AFD4C, - it_802AFD54, - it_802AFD5C, - it_802AFD64, - it_802AFD6C, + it_8029CA80, + it_8029CA78, + it_8029CC4C, + it_8029CC54, + it_8029CCF0, + it_8029CCF8, }, { - // Sheik needle thrown - it_803F6F50, + // Falco laser + it_803F67D0, NULL, - it_802AFEF8, NULL, NULL, NULL, - it_802B0D84, - it_802B10E4, NULL, - it_802B1294, - it_802B0F34, + it_8029CA78, NULL, - it_802B14DC, - it_802B16E4, - it_802B1890, + NULL, + it_8029CA80, + it_8029CA78, + it_8029CC4C, + it_8029CC54, + it_8029CCF0, + it_8029CCF8, }, { - // Sheik needle held - it_803F70A8, - NULL, + // Fox illusion + it_803F6818, NULL, - it_802B1AAC, + it_8029CFA0, NULL, NULL, NULL, + it_8029CF8C, NULL, NULL, NULL, @@ -1660,68 +2276,104 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802B1C40, + it_8029D948, }, { - // Pikachu thunder - it_803F70C8, - NULL, - it_802B202C, + // Falco phantasm + it_803F6818, NULL, + it_8029CFA0, NULL, NULL, - it_802B2508, NULL, + it_8029CF8C, NULL, NULL, - it_802B2518, - it_802B2520, NULL, - it_802B2510, - it_802B2528, - }, - { - // Pichu thunder - it_803F70C8, NULL, - it_802B202C, NULL, NULL, NULL, - it_802B2508, + it_8029D948, + }, + { + // Link bomb + it_803F6888, NULL, NULL, + it_8029DEB0, + it_8029EC34, + it_8029E5D0, + it_8029F960, + it_8029FA30, + it_8029FB24, + it_8029FD20, NULL, - it_802B2518, - it_802B2520, NULL, - it_802B2510, - it_802B2528, + it_8029FD64, + it_8029FD40, + it_8029FD84, }, { - // Mario cape - it_803F70F8, - NULL, - it_802B2644, - it_802B2700, + // Young Link bomb + it_803F6888, NULL, NULL, + it_8029DEB0, + it_8029EC34, + it_8029E5D0, + it_8029F960, + it_8029FA30, + it_8029FB24, + it_8029FD20, NULL, NULL, + it_8029FD64, + it_8029FD40, + it_8029FD84, + }, + { + // Link boomerang + it_803F6920, NULL, + it_802A087C, + it_802A0E70, + it_802A0F84, + it_802A0F88, + it_802A1F08, NULL, NULL, + it_802A20E8, + it_802A1FA8, + it_802A2048, + it_802A2320, + it_802A2288, + it_802A23CC, + }, + { + // Young Link boomerang + it_803F6920, NULL, + it_802A087C, + it_802A0E70, + it_802A0F84, + it_802A0F88, + it_802A1F08, NULL, NULL, - it_802B2870, + it_802A20E8, + it_802A1FA8, + it_802A2048, + it_802A2320, + it_802A2288, + it_802A23CC, }, { - // Dr Mario cape - it_803F70F8, + // Link hookshot + it_803F6998, + it_802A2418, NULL, - it_802B2644, - it_802B2700, + it_802A7688, NULL, NULL, NULL, @@ -1732,17 +2384,17 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802B2870, + it_802A7D40, }, { - // Sheik vanish - it_803F70B8, + // Young Link hookshot + it_803F6998, NULL, NULL, + it_802A7688, NULL, NULL, NULL, - it_802B1D38, NULL, NULL, NULL, @@ -1750,194 +2402,159 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802B1DCC, + it_802A7D40, }, { - // Yoshi egg throw - it_803F7118, + // Link arrow + it_803F6A28, NULL, + it_802A8984, + it_802A8AF8, NULL, - it_802B2AE0, NULL, + it_802A9A80, NULL, - it_802B2C04, NULL, + it_802A9D4C, + it_802A9CE0, NULL, - it_802B2E5C, - it_802B2D50, NULL, - it_802B2F88, - it_802B2E7C, - it_802B2FA8, + it_802A9B08, + it_802AA034, }, { - // Yoshi egg lay - it_803F94A0, + // Young Link arrow + it_803F6A28, + NULL, + it_802A8984, + it_802A8AF8, NULL, NULL, + it_802A9A80, NULL, NULL, + it_802A9D4C, + it_802A9CE0, NULL, NULL, - it_802F3330, + it_802A9B08, + it_802AA034, + }, + { + // Ness PK fire + it_803F6B28, NULL, NULL, NULL, NULL, NULL, + it_802AA284, NULL, - it_802F3374, + NULL, + it_802AA35C, + it_802AA2E8, + it_802AA34C, + it_802AA37C, + it_802AA354, + it_802AA474, }, { - // Yoshi star - it_803F7158, - NULL, + // Ness PK fire pillar + it_803F6B60, NULL, NULL, NULL, NULL, - it_802B309C, NULL, NULL, - it_802B314C, - it_802B30C0, - it_802B3108, - it_802B312C, - it_802B30E4, - it_802B3348, - }, - { - // Pikachu tjolt ground - it_803F7190, + it_802AA75C, NULL, - it_802B34E4, NULL, NULL, NULL, - it_802B3A94, NULL, NULL, - it_802B3AF8, - it_802B3C44, - it_802B3CA8, - it_802B3D70, - it_802B3D0C, - it_802B3EDC, + it_802AA7C4, }, { - // Pikachu tjolt air - it_803F71D8, + // Ness PK flash + it_803F6B70, NULL, + it_802AA9CC, NULL, NULL, NULL, NULL, - it_802B45F0, NULL, NULL, - it_802B46C8, - it_802B4638, - it_802B4680, - it_802B4A60, - it_802B4A18, - it_802B4AA8, + it_802AB2AC, + it_802AB3C0, + it_802AB3C8, + NULL, + NULL, + it_802AB3D0, }, { - // Pichu tjolt ground - it_803F7190, + // Ness PK thunder ball + it_803F6BC8, NULL, - it_802B34E4, + it_802AB90C, NULL, NULL, NULL, - it_802B3A94, + it_802AC050, NULL, NULL, - it_802B3AF8, - it_802B3C44, - it_802B3CA8, - it_802B3D70, - it_802B3D0C, - it_802B3EDC, + it_802AC098, + it_802AC074, + it_802AC338, + it_802AC35C, + it_802AC3F8, + it_802AC41C, }, { - // Pichu tjolt air - it_803F71D8, + // Ness PK thunder trail 1 + it_803F6C08, NULL, NULL, NULL, NULL, NULL, - it_802B45F0, NULL, NULL, - it_802B46C8, - it_802B4638, - it_802B4680, - it_802B4A60, - it_802B4A18, - it_802B4AA8, - }, - { - // Samus bomb - it_803F7220, NULL, NULL, NULL, NULL, NULL, - it_802B52B8, NULL, - it_802B4F78, - it_802B5374, - it_802B52EC, NULL, - it_802B5354, - it_802B5320, - it_802B54E4, }, { - // Samus charge shot - it_803F7288, + // Ness PK thunder trail 2 + it_803F6C08, + NULL, NULL, - it_802B58D8, - it_802B59C4, NULL, NULL, - it_802B5FD8, NULL, NULL, - it_802B5FF0, - it_802B5FE0, - it_802B5FE8, - it_802B6144, - it_802B613C, - it_802B62B0, - }, - { - // Samus missile - it_803F7340, NULL, NULL, NULL, NULL, NULL, - it_802B6C28, NULL, NULL, - it_802B6E4C, - it_802B6C7C, NULL, - it_802B6D24, - it_802B6CD0, - it_802B7104, }, { - // Samus grapple beam - it_803F73A8, - it_802B7150, + // Ness PK thunder trail 3 + it_803F6C08, + NULL, + NULL, + NULL, NULL, - it_802BA97C, NULL, NULL, NULL, @@ -1948,14 +2565,14 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802BAEA0, }, { - // Sheik chain - it_803F7438, + // Ness PK thunder trail 4 + it_803F6C08, + NULL, + NULL, NULL, NULL, - it_802BCE94, NULL, NULL, NULL, @@ -1966,17 +2583,16 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802BD10C, }, { - // Peach explode - it_803F7488, + // Fox blaster + it_803F6CA8, NULL, NULL, + it_802AEB00, NULL, NULL, NULL, - it_802BD240, NULL, NULL, NULL, @@ -1984,50 +2600,32 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802BD30C, + it_802AF184, }, { - // Peach turnip - it_803F74A8, + // Falco blaster + it_803F6CA8, NULL, - it_802BD47C, - it_802BD628, - it_802BD8CC, - it_802BD748, - it_802BD938, NULL, + it_802AEB00, NULL, - it_802BD99C, - it_802BD978, NULL, - it_802BD9E4, - it_802BD9C0, - it_802BDA08, - }, - { - // Bowser flame - it_803F6C58, NULL, NULL, NULL, NULL, NULL, - it_802AD2E8, NULL, NULL, - it_802AD2F0, - it_802AD384, - it_802AD38C, - it_802AD3B0, - it_802AD450, - it_802AD458, + NULL, + it_802AF184, }, { - // Ness bat - it_803F6C68, - NULL, + // Link bow + it_803F6E98, NULL, - it_802AD6F0, + it_802AF298, + it_802AF434, NULL, NULL, NULL, @@ -2038,14 +2636,14 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802AD9FC, + it_802AF920, }, { - // Ness yo-yo - it_803F7558, - NULL, + // Young Link bow + it_803F6E98, NULL, - it_802BFE34, + it_802AF298, + it_802AF434, NULL, NULL, NULL, @@ -2056,32 +2654,50 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802C016C, + it_802AF920, }, { - // Peach parasol - it_803F74F8, + // Ness PK flush explode + it_803F6F40, + NULL, + it_802AFA2C, + NULL, NULL, - it_802BDB4C, - it_802BDC74, NULL, NULL, NULL, NULL, NULL, + it_802AFD4C, + it_802AFD54, + it_802AFD5C, + it_802AFD64, + it_802AFD6C, + }, + { + // Sheik needle thrown + it_803F6F50, + NULL, + it_802AFEF8, NULL, NULL, NULL, + it_802B0D84, + it_802B10E4, NULL, + it_802B1294, + it_802B0F34, NULL, - it_802BDDF8, + it_802B14DC, + it_802B16E4, + it_802B1890, }, { - // Peach toad - it_803F7528, + // Sheik needle held + it_803F70A8, NULL, - it_802BDEFC, - it_802BDFE0, + NULL, + it_802B1AAC, NULL, NULL, NULL, @@ -2092,248 +2708,284 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802BE1F4, + it_802B1C40, }, { - // Luigi fireball - it_803F75C0, + // Pikachu thunder + it_803F70C8, NULL, + it_802B202C, NULL, NULL, NULL, + it_802B2508, NULL, - it_802C0490, NULL, NULL, - it_802C0498, - it_802C04B8, - it_802C04C8, - it_802C04D0, - it_802C04C0, - it_802C04F0, + it_802B2518, + it_802B2520, + NULL, + it_802B2510, + it_802B2528, }, { - // Ice Climbers ice - it_803F7668, + // Pichu thunder + it_803F70C8, NULL, - it_802C17FC, + it_802B202C, NULL, NULL, NULL, - it_802C1FC8, + it_802B2508, NULL, NULL, - it_802C1FD0, - it_802C1FF0, - it_802C20E4, - it_802C20EC, - it_802C1FF8, - it_802C210C, + NULL, + it_802B2518, + it_802B2520, + NULL, + it_802B2510, + it_802B2528, }, { - // Ice Climbers blizzard - it_803F76A8, + // Mario cape + it_803F70F8, NULL, + it_802B2644, + it_802B2700, NULL, NULL, NULL, NULL, - it_802C2424, NULL, NULL, - it_802C242C, - it_802C244C, - it_802C245C, - it_802C2464, - it_802C2454, - it_802C246C, + NULL, + NULL, + NULL, + NULL, + it_802B2870, }, { - // Zelda din fire - it_803F76F8, + // Dr Mario cape + it_803F70F8, NULL, - it_802C3CBC, + it_802B2644, + it_802B2700, NULL, NULL, NULL, NULL, NULL, NULL, - it_802C443C, - it_802C4550, - it_802C4558, NULL, NULL, - it_802C4560, - }, - { - // Zelda din fire explode - it_803F7740, NULL, - it_802C4670, NULL, + it_802B2870, + }, + { + // Sheik vanish + it_803F70B8, NULL, NULL, NULL, NULL, NULL, + it_802B1D38, NULL, - it_802C49A0, - it_802C49A8, - it_802C49B0, - it_802C49B8, - it_802C49C0, - }, - { - // Mewtwo disable - it_803F7750, NULL, - it_802C4A00, NULL, NULL, NULL, - it_802C4C90, NULL, NULL, - it_802C4C98, - it_802C4CB8, - it_802C4CC8, - it_802C4CD0, - it_802C4CC0, - it_802C4CD8, + it_802B1DCC, }, { - // Peach toad spore - it_803F7548, + // Yoshi egg throw + it_803F7118, NULL, NULL, + it_802B2AE0, NULL, NULL, + it_802B2C04, NULL, - it_802BE488, NULL, + it_802B2E5C, + it_802B2D50, NULL, - it_802BE538, - it_802BE4AC, - it_802BE4F4, - it_802BE518, - it_802BE4D0, - it_802BE578, + it_802B2F88, + it_802B2E7C, + it_802B2FA8, }, { - // Mewtwo shadow ball - it_803F7760, + // Yoshi egg lay + it_803F94A0, NULL, - it_802C56A0, - it_802C578C, NULL, NULL, - it_802C60B4, NULL, NULL, - it_802C60CC, - it_802C60BC, - it_802C60C4, - it_802C6140, - it_802C6138, - it_802C61D4, - }, - { - // Ice Climbers string (belay) - it_803F76B8, + NULL, + it_802F3330, + NULL, NULL, NULL, - it_802C37BC, NULL, NULL, NULL, + it_802F3374, + }, + { + // Yoshi star + it_803F7158, NULL, NULL, NULL, NULL, NULL, + it_802B309C, NULL, NULL, - it_802C3AA4, + it_802B314C, + it_802B30C0, + it_802B3108, + it_802B312C, + it_802B30E4, + it_802B3348, }, { - // Game & Watch greenhouse (insecticide spray) - it_803F7898, + // Pikachu tjolt ground + it_803F7190, NULL, - it_802C62F8, - it_802C63B4, + it_802B34E4, NULL, NULL, NULL, + it_802B3A94, NULL, NULL, + it_802B3AF8, + it_802B3C44, + it_802B3CA8, + it_802B3D70, + it_802B3D0C, + it_802B3EDC, + }, + { + // Pikachu tjolt air + it_803F71D8, NULL, NULL, NULL, NULL, NULL, - it_802C65C4, + it_802B45F0, + NULL, + NULL, + it_802B46C8, + it_802B4638, + it_802B4680, + it_802B4A60, + it_802B4A18, + it_802B4AA8, }, { - // Game & Watch manhole - it_803F78D8, + // Pichu tjolt ground + it_803F7190, NULL, - it_802C66E8, - it_802C67A4, + it_802B34E4, NULL, NULL, NULL, + it_802B3A94, + NULL, + NULL, + it_802B3AF8, + it_802B3C44, + it_802B3CA8, + it_802B3D70, + it_802B3D0C, + it_802B3EDC, + }, + { + // Pichu tjolt air + it_803F71D8, NULL, NULL, NULL, NULL, NULL, + it_802B45F0, NULL, NULL, - it_802C68D8, + it_802B46C8, + it_802B4638, + it_802B4680, + it_802B4A60, + it_802B4A18, + it_802B4AA8, }, { - // Game & Watch fire - it_803F78E8, + // Samus bomb + it_803F7220, + NULL, NULL, - it_802C69FC, - it_802C6AB8, NULL, NULL, NULL, + it_802B52B8, NULL, + it_802B4F78, + it_802B5374, + it_802B52EC, NULL, + it_802B5354, + it_802B5320, + it_802B54E4, + }, + { + // Samus charge shot + it_803F7288, NULL, + it_802B58D8, + it_802B59C4, NULL, NULL, + it_802B5FD8, NULL, NULL, - it_802C6C18, + it_802B5FF0, + it_802B5FE0, + it_802B5FE8, + it_802B6144, + it_802B613C, + it_802B62B0, }, { - // Game & Watch parachute - it_803F78F8, - NULL, - it_802C6D3C, - it_802C6DF8, - NULL, - NULL, + // Samus missile + it_803F7340, NULL, NULL, NULL, NULL, NULL, + it_802B6C28, NULL, NULL, + it_802B6E4C, + it_802B6C7C, NULL, - it_802C6F20, + it_802B6D24, + it_802B6CD0, + it_802B7104, }, { - // Game & Watch turtle - it_803F7918, + // Samus grapple beam + it_803F73A8, + it_802B7150, NULL, - it_802C7044, - it_802C7100, + it_802BA97C, NULL, NULL, NULL, @@ -2344,14 +2996,14 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802C71EC, + it_802BAEA0, }, { - // Game & Watch breath - it_803F7938, + // Sheik chain + it_803F7438, NULL, - it_802C7310, - it_802C73CC, + NULL, + it_802BCE94, NULL, NULL, NULL, @@ -2362,17 +3014,17 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802C74B8, + it_802BD10C, }, { - // Game & Watch judge - it_803F7968, + // Peach explode + it_803F7488, + NULL, NULL, - it_802C7A54, - it_802C7B10, NULL, NULL, NULL, + it_802BD240, NULL, NULL, NULL, @@ -2380,50 +3032,68 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802C7D40, + it_802BD30C, }, { - // Game & Watch panic - it_803F79A0, + // Peach turnip + it_803F74A8, NULL, - it_802C7E64, - it_802C7F20, + it_802BD47C, + it_802BD628, + it_802BD8CC, + it_802BD748, + it_802BD938, NULL, NULL, + it_802BD99C, + it_802BD978, NULL, + it_802BD9E4, + it_802BD9C0, + it_802BDA08, + }, + { + // Bowser flame + it_803F6C58, NULL, NULL, NULL, NULL, NULL, + it_802AD2E8, NULL, NULL, - it_802C8018, + it_802AD2F0, + it_802AD384, + it_802AD38C, + it_802AD3B0, + it_802AD450, + it_802AD458, }, { - // Game & Watch chef - it_803F79E0, + // Ness bat + it_803F6C68, + NULL, NULL, + it_802AD6F0, NULL, NULL, NULL, NULL, - it_802C847C, NULL, NULL, - it_802C8A28, - it_802C88E4, - it_802C899C, - it_802C8A08, - it_802C8940, - it_802C8B08, + NULL, + NULL, + NULL, + NULL, + it_802AD9FC, }, { - // Young Link milk - it_803F7A28, + // Ness yo-yo + it_803F7558, NULL, NULL, - it_802C8C74, + it_802BFE34, NULL, NULL, NULL, @@ -2434,14 +3104,14 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802C8F2C, + it_802C016C, }, { - // Game & Watch rescue - it_803F79C0, - NULL, - NULL, + // Peach parasol + it_803F74F8, NULL, + it_802BDB4C, + it_802BDC74, NULL, NULL, NULL, @@ -2452,14 +3122,14 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802C835C, + it_802BDDF8, }, { - // Master Hand laser - it_803F9378, - NULL, - NULL, + // Peach toad + it_803F7528, NULL, + it_802BDEFC, + it_802BDFE0, NULL, NULL, NULL, @@ -2470,153 +3140,176 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802F044C, + it_802BE1F4, }, { - // Master Hand bullet - it_803F9388, + // Luigi fireball + it_803F75C0, NULL, NULL, NULL, NULL, NULL, - it_802F0F0C, + it_802C0490, NULL, NULL, - it_802F0F14, - it_802F0F34, - it_802F0F3C, - it_802F0F44, - it_802F0F64, - it_802F0BC8, + it_802C0498, + it_802C04B8, + it_802C04C8, + it_802C04D0, + it_802C04C0, + it_802C04F0, }, { - // Crazy Hand laser - it_803F9378, + // Ice Climbers ice + it_803F7668, NULL, + it_802C17FC, NULL, NULL, NULL, + it_802C1FC8, NULL, NULL, + it_802C1FD0, + it_802C1FF0, + it_802C20E4, + it_802C20EC, + it_802C1FF8, + it_802C210C, + }, + { + // Ice Climbers blizzard + it_803F76A8, NULL, NULL, NULL, NULL, NULL, + it_802C2424, NULL, NULL, - it_802F044C, + it_802C242C, + it_802C244C, + it_802C245C, + it_802C2464, + it_802C2454, + it_802C246C, }, { - // Crazy Hand bullet - it_803F9388, - NULL, + // Zelda din fire + it_803F76F8, NULL, + it_802C3CBC, NULL, NULL, NULL, NULL, NULL, NULL, + it_802C443C, + it_802C4550, + it_802C4558, NULL, NULL, + it_802C4560, + }, + { + // Zelda din fire explode + it_803F7740, NULL, + it_802C4670, NULL, NULL, - it_802F0BC8, - }, - { - // Crazy Hand bomb - it_803F93A8, NULL, NULL, NULL, NULL, NULL, - it_802F10B4, + it_802C49A0, + it_802C49A8, + it_802C49B0, + it_802C49B8, + it_802C49C0, + }, + { + // Mewtwo disable + it_803F7750, NULL, + it_802C4A00, NULL, - it_802F10D8, NULL, NULL, + it_802C4C90, NULL, NULL, - it_802F1094, + it_802C4C98, + it_802C4CB8, + it_802C4CC8, + it_802C4CD0, + it_802C4CC0, + it_802C4CD8, }, { - it_803F6788, + // Peach toad spore + it_803F7548, NULL, NULL, NULL, NULL, NULL, - it_8029BA38, + it_802BE488, NULL, NULL, - it_8029BA40, - it_8029BA60, - it_8029BA70, - it_8029BA78, - it_8029BA68, - it_8029BA98, + it_802BE538, + it_802BE4AC, + it_802BE4F4, + it_802BE518, + it_802BE4D0, + it_802BE578, }, { - it_803F75D0, - NULL, - NULL, + // Mewtwo shadow ball + it_803F7760, NULL, + it_802C56A0, + it_802C578C, NULL, NULL, - it_802C1384, + it_802C60B4, NULL, NULL, - it_802C13CC, - it_802C1400, - it_802C14B8, - it_802C1514, - it_802C145C, - it_802C1570, + it_802C60CC, + it_802C60BC, + it_802C60C4, + it_802C6140, + it_802C6138, + it_802C61D4, }, { - it_803F75C0, - NULL, + // Ice Climbers string (belay) + it_803F76B8, NULL, NULL, + it_802C37BC, NULL, NULL, - it_802C0490, NULL, NULL, - it_802C0498, - it_802C04B8, - it_802C04C8, - it_802C04D0, - it_802C04C0, - it_802C04F0, - }, - { - it_803F7668, NULL, - it_802C17FC, NULL, NULL, NULL, - it_802C1FC8, NULL, NULL, - it_802C1FD0, - it_802C1FF0, - it_802C20E4, - it_802C20EC, - it_802C1FF8, - it_802C210C, + it_802C3AA4, }, { - it_803F7528, + // Game & Watch greenhouse (insecticide spray) + it_803F7898, NULL, - it_802BDEFC, - it_802BDFE0, + it_802C62F8, + it_802C63B4, NULL, NULL, NULL, @@ -2627,16 +3320,17 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802BE1F4, + it_802C65C4, }, { - it_803F7548, - NULL, + // Game & Watch manhole + it_803F78D8, NULL, + it_802C66E8, + it_802C67A4, NULL, NULL, NULL, - it_802BE488, NULL, NULL, NULL, @@ -2644,47 +3338,32 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802BE578, + it_802C68D8, }, { - it_803F67D0, - NULL, - NULL, - NULL, + // Game & Watch fire + it_803F78E8, NULL, + it_802C69FC, + it_802C6AB8, NULL, - it_8029CA78, NULL, NULL, - it_8029CA80, - it_8029CA78, - it_8029CC4C, - it_8029CC54, - it_8029CCF0, - it_8029CCF8, - }, - { - it_803F67D0, NULL, NULL, NULL, NULL, NULL, - it_8029CA78, NULL, NULL, - it_8029CA80, - it_8029CA78, - it_8029CC4C, - it_8029CC54, - it_8029CCF0, - it_8029CCF8, + it_802C6C18, }, { - it_803F6CA8, - NULL, + // Game & Watch parachute + it_803F78F8, NULL, - it_802AEB00, + it_802C6D3C, + it_802C6DF8, NULL, NULL, NULL, @@ -2695,13 +3374,14 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802AF184, + it_802C6F20, }, { - it_803F6CA8, - NULL, + // Game & Watch turtle + it_803F7918, NULL, - it_802AEB00, + it_802C7044, + it_802C7100, NULL, NULL, NULL, @@ -2712,47 +3392,32 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802AF184, + it_802C71EC, }, { - it_803F6A28, - NULL, - it_802A8984, - it_802A8AF8, - NULL, - NULL, - it_802A9A80, + // Game & Watch breath + it_803F7938, NULL, + it_802C7310, + it_802C73CC, NULL, - it_802A9D4C, - it_802A9CE0, NULL, NULL, - it_802A9B08, - it_802AA034, - }, - { - it_803F6A28, NULL, - it_802A8984, - it_802A8AF8, NULL, NULL, - it_802A9A80, NULL, NULL, - it_802A9D4C, - it_802A9CE0, NULL, NULL, - it_802A9B08, - it_802AA034, + it_802C74B8, }, { - it_803F6E98, + // Game & Watch judge + it_803F7968, NULL, - it_802AF298, - it_802AF434, + it_802C7A54, + it_802C7B10, NULL, NULL, NULL, @@ -2763,13 +3428,14 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802AF920, + it_802C7D40, }, { - it_803F6E98, + // Game & Watch panic + it_803F79A0, NULL, - it_802AF298, - it_802AF434, + it_802C7E64, + it_802C7F20, NULL, NULL, NULL, @@ -2780,46 +3446,48 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802AF920, + it_802C8018, }, { - it_803F7760, + // Game & Watch chef + it_803F79E0, NULL, - it_802C56A0, - it_802C578C, NULL, NULL, - it_802C60B4, NULL, NULL, - it_802C60CC, - it_802C60BC, - it_802C60C4, - it_802C6140, - it_802C6138, - it_802C61D4, - }, + it_802C847C, + NULL, + NULL, + it_802C8A28, + it_802C88E4, + it_802C899C, + it_802C8A08, + it_802C8940, + it_802C8B08, + }, { - it_803F6B70, + // Young Link milk + it_803F7A28, NULL, - it_802AA9CC, NULL, + it_802C8C74, NULL, NULL, NULL, NULL, NULL, - it_802AB2AC, - it_802AB3C0, - it_802AB3C8, NULL, NULL, - it_802AB3D0, + NULL, + NULL, + NULL, + it_802C8F2C, }, { - it_803F6F40, + // Game & Watch rescue + it_803F79C0, NULL, - it_802AFA2C, NULL, NULL, NULL, @@ -2827,170 +3495,176 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802AFD4C, - it_802AFD54, - it_802AFD5C, - it_802AFD64, - it_802AFD6C, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802C835C, }, { - it_803F7190, + // Master Hand laser + it_803F9378, NULL, - it_802B34E4, NULL, NULL, NULL, - it_802B3A94, NULL, NULL, - it_802B3AF8, - it_802B3C44, - it_802B3CA8, - it_802B3D70, - it_802B3D0C, - it_802B3EDC, - }, - { - it_803F71D8, NULL, NULL, NULL, NULL, NULL, - it_802B45F0, NULL, NULL, - it_802B46C8, - it_802B4638, - it_802B4680, - it_802B4A60, - it_802B4A18, - it_802B4AA8, + it_802F044C, }, { - it_803F7190, + // Master Hand bullet + it_803F9388, NULL, - it_802B34E4, NULL, NULL, NULL, - it_802B3A94, NULL, + it_802F0F0C, NULL, - it_802B3AF8, - it_802B3C44, - it_802B3CA8, - it_802B3D70, - it_802B3D0C, - it_802B3EDC, + NULL, + it_802F0F14, + it_802F0F34, + it_802F0F3C, + it_802F0F44, + it_802F0F64, + it_802F0BC8, }, { - it_803F71D8, + // Crazy Hand laser + it_803F9378, NULL, NULL, NULL, NULL, NULL, - it_802B45F0, NULL, NULL, - it_802B46C8, - it_802B4638, - it_802B4680, - it_802B4A60, - it_802B4A18, - it_802B4AA8, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802F044C, }, { - it_803F7288, + // Crazy Hand bullet + it_803F9388, NULL, - it_802B58D8, - it_802B59C4, NULL, NULL, - it_802B5FD8, NULL, NULL, - it_802B5FF0, - it_802B5FE0, - it_802B5FE8, - it_802B6144, - it_802B613C, - it_802B62B0, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802F0BC8, }, { - it_803F6F50, + // Crazy Hand bomb + it_803F93A8, NULL, - it_802AFEF8, NULL, NULL, NULL, - it_802B0D84, - it_802B10E4, NULL, - it_802B1294, - it_802B0F34, + it_802F10B4, NULL, - it_802B14DC, - it_802B16E4, - it_802B1890, + NULL, + it_802F10D8, + NULL, + NULL, + NULL, + NULL, + it_802F1094, }, { - it_803F70A8, + it_803F6788, + NULL, NULL, NULL, - it_802B1AAC, NULL, NULL, + it_8029BA38, + NULL, NULL, + it_8029BA40, + it_8029BA60, + it_8029BA70, + it_8029BA78, + it_8029BA68, + it_8029BA98, + }, + { + it_803F75D0, NULL, NULL, NULL, NULL, NULL, + it_802C1384, NULL, NULL, - it_802B1C40, + it_802C13CC, + it_802C1400, + it_802C14B8, + it_802C1514, + it_802C145C, + it_802C1570, }, { - it_803F6C58, + it_803F75C0, NULL, NULL, NULL, NULL, NULL, - it_802AD2E8, + it_802C0490, NULL, NULL, - it_802AD2F0, - it_802AD384, - it_802AD38C, - it_802AD3B0, - it_802AD450, - it_802AD458, + it_802C0498, + it_802C04B8, + it_802C04C8, + it_802C04D0, + it_802C04C0, + it_802C04F0, }, { - it_803F79E0, - NULL, + it_803F7668, NULL, + it_802C17FC, NULL, NULL, NULL, - it_802C847C, + it_802C1FC8, NULL, NULL, - it_802C8A28, - it_802C88E4, - it_802C899C, - it_802C8A08, - it_802C8940, - it_802C8B08, + it_802C1FD0, + it_802C1FF0, + it_802C20E4, + it_802C20EC, + it_802C1FF8, + it_802C210C, }, { - it_803F7958, + it_803F7528, NULL, - it_802C75DC, - it_802C7698, + it_802BDEFC, + it_802BDFE0, NULL, NULL, NULL, @@ -3001,71 +3675,445 @@ struct ItemLogicTable it_803F3100[] = { NULL, NULL, NULL, - it_802C7754, + it_802BE1F4, }, { - it_803F94A0, + it_803F7548, NULL, NULL, NULL, NULL, NULL, + it_802BE488, NULL, - it_802F3330, NULL, NULL, NULL, NULL, NULL, NULL, - it_802F3374, + it_802BE578, }, { - // Unk4 - it_803F8BD8, + it_803F67D0, NULL, NULL, NULL, NULL, NULL, - it_802E6A40, + it_8029CA78, NULL, NULL, + it_8029CA80, + it_8029CA78, + it_8029CC4C, + it_8029CC54, + it_8029CCF0, + it_8029CCF8, + }, + { + it_803F67D0, + NULL, NULL, NULL, NULL, NULL, + it_8029CA78, NULL, - it_802E6ACC, + NULL, + it_8029CA80, + it_8029CA78, + it_8029CC4C, + it_8029CC54, + it_8029CCF0, + it_8029CCF8, }, { - // Coin - it_803F93C8, - it_802F14E4, - it_802F1518, - it_802F1888, - it_802F1CE0, - it_802F1CE0, + it_803F6CA8, NULL, - it_802F1910, - it_802F1F48, + NULL, + it_802AEB00, NULL, NULL, NULL, NULL, NULL, - it_802F18F0, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802AF184, }, { - // Pokemon random - it_803F8C8C, + it_803F6CA8, NULL, NULL, + it_802AEB00, NULL, NULL, NULL, - it_802E6F7C, - it_802E6FC0, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802AF184, + }, + { + it_803F6A28, + NULL, + it_802A8984, + it_802A8AF8, + NULL, + NULL, + it_802A9A80, + NULL, + NULL, + it_802A9D4C, + it_802A9CE0, + NULL, + NULL, + it_802A9B08, + it_802AA034, + }, + { + it_803F6A28, + NULL, + it_802A8984, + it_802A8AF8, + NULL, + NULL, + it_802A9A80, + NULL, + NULL, + it_802A9D4C, + it_802A9CE0, + NULL, + NULL, + it_802A9B08, + it_802AA034, + }, + { + it_803F6E98, + NULL, + it_802AF298, + it_802AF434, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802AF920, + }, + { + it_803F6E98, + NULL, + it_802AF298, + it_802AF434, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802AF920, + }, + { + it_803F7760, + NULL, + it_802C56A0, + it_802C578C, + NULL, + NULL, + it_802C60B4, + NULL, + NULL, + it_802C60CC, + it_802C60BC, + it_802C60C4, + it_802C6140, + it_802C6138, + it_802C61D4, + }, + { + it_803F6B70, + NULL, + it_802AA9CC, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802AB2AC, + it_802AB3C0, + it_802AB3C8, + NULL, + NULL, + it_802AB3D0, + }, + { + it_803F6F40, + NULL, + it_802AFA2C, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802AFD4C, + it_802AFD54, + it_802AFD5C, + it_802AFD64, + it_802AFD6C, + }, + { + it_803F7190, + NULL, + it_802B34E4, + NULL, + NULL, + NULL, + it_802B3A94, + NULL, + NULL, + it_802B3AF8, + it_802B3C44, + it_802B3CA8, + it_802B3D70, + it_802B3D0C, + it_802B3EDC, + }, + { + it_803F71D8, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802B45F0, + NULL, + NULL, + it_802B46C8, + it_802B4638, + it_802B4680, + it_802B4A60, + it_802B4A18, + it_802B4AA8, + }, + { + it_803F7190, + NULL, + it_802B34E4, + NULL, + NULL, + NULL, + it_802B3A94, + NULL, + NULL, + it_802B3AF8, + it_802B3C44, + it_802B3CA8, + it_802B3D70, + it_802B3D0C, + it_802B3EDC, + }, + { + it_803F71D8, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802B45F0, + NULL, + NULL, + it_802B46C8, + it_802B4638, + it_802B4680, + it_802B4A60, + it_802B4A18, + it_802B4AA8, + }, + { + it_803F7288, + NULL, + it_802B58D8, + it_802B59C4, + NULL, + NULL, + it_802B5FD8, + NULL, + NULL, + it_802B5FF0, + it_802B5FE0, + it_802B5FE8, + it_802B6144, + it_802B613C, + it_802B62B0, + }, + { + it_803F6F50, + NULL, + it_802AFEF8, + NULL, + NULL, + NULL, + it_802B0D84, + it_802B10E4, + NULL, + it_802B1294, + it_802B0F34, + NULL, + it_802B14DC, + it_802B16E4, + it_802B1890, + }, + { + it_803F70A8, + NULL, + NULL, + it_802B1AAC, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802B1C40, + }, + { + it_803F6C58, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802AD2E8, + NULL, + NULL, + it_802AD2F0, + it_802AD384, + it_802AD38C, + it_802AD3B0, + it_802AD450, + it_802AD458, + }, + { + it_803F79E0, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802C847C, + NULL, + NULL, + it_802C8A28, + it_802C88E4, + it_802C899C, + it_802C8A08, + it_802C8940, + it_802C8B08, + }, + { + it_803F7958, + NULL, + it_802C75DC, + it_802C7698, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802C7754, + }, + { + it_803F94A0, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802F3330, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802F3374, + }, + { + // Unk4 + it_803F8BD8, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802E6A40, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802E6ACC, + }, + { + // Coin + it_803F93C8, + it_802F14E4, + it_802F1518, + it_802F1888, + it_802F1CE0, + it_802F1CE0, + NULL, + it_802F1910, + it_802F1F48, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802F18F0, + }, + { + // Pokemon random + it_803F8C8C, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802E6F7C, + it_802E6FC0, NULL, NULL, NULL, @@ -3076,506 +4124,6587 @@ struct ItemLogicTable it_803F3100[] = { }, }; -/// #it_80272560 +// Monster and Stage-specific Items +struct sdata_ItemGXLink it_803F4CA8[30] = { + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, + it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, NULL, +}; + +struct ItemLogicTable it_803F4D20[ARRAY_SIZE(it_803F4CA8)] = { + { + // Old Goomba (old-Kuri) + it_803F8320, + it_802D73F0, + it_8027C8B0, + NULL, + NULL, + NULL, + NULL, + it_802D7F38, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802D84D8, + }, + { + // Target (Mato) + it_803F83E0, + it_802D84F8, + it_8027C8B0, + NULL, + NULL, + NULL, + NULL, + it_802D85F4, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Yoshi's Story Shy Guy (Heiho) + it_803F83F0, + it_802D8688, + it_8027C8B0, + NULL, + NULL, + NULL, + NULL, + it_802D8EC8, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802D9A0C, + }, + { + // Koopa Troopa (Green) (Nokonoko) + it_803F85F0, + it_802DC69C, + it_8027C8B0, + it_802DD4F4, + it_802DD59C, + it_802DD67C, + NULL, + it_802DC774, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802DD7D0, + }, + { + // Koopa Troopa (Red) (Patapata) + it_803F88C0, + it_802E05A0, + it_8027C8B0, + it_802E0F70, + it_802E0FE4, + it_802E10C8, + NULL, + it_802E0EE0, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802E16D8, + }, + { + // Like-Like (likelike) + it_803F8468, + it_802D9BA8, + it_802DC480, + it_802DBE90, + it_802DBF30, + it_802DC000, + NULL, + it_802D9CC4, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802E16D8, + }, + { + // Old Redead (old-lead) [invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Old Octorok (old-octa) [invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Old Ottosea (old-otto) + it_803F89C8, + it_802E2470, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802E257C, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Polar Bear (whitebea) + it_803F8A88, + it_802E37BC, + it_8027C8B0, + it_802E468C, + it_802E4700, + it_802E47C0, + NULL, + it_802E3884, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802E4A24, + }, + { + // Klaptrap (klap) + it_803F8940, + it_802E1820, + it_802E1874, + NULL, + NULL, + NULL, + NULL, + it_802E1E5C, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802E2450, + }, + { + // Green Shell (zgshell) + it_803F86C8, + it_802DE040, + it_802DFEF4, + it_802DE434, + it_802DE648, + it_802DE4FC, + it_802DFC34, + it_802DFC58, + it_802DEEF4, + it_802DFC90, + it_802DFCB0, + NULL, + it_802DFE40, + it_802DFD60, + it_802DFED4, + }, + { + // Red Shell (green act) (zrshell) + it_803F87F0, + it_802E02E8, + it_802E0388, + it_802E0308, + it_802E0348, + it_802E0328, + it_802E03A8, + it_802E03C8, + it_802E0368, + it_802E03E8, + it_802E0408, + NULL, + it_802E0448, + it_802E0428, + it_802E0468, + }, + { + // Tingle (Tincle) (on balloon) + it_803F9000, + it_802EB5C8, + NULL, + NULL, + NULL, + NULL, + it_802EB6A8, + it_802EB684, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802EC850, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Whispy Apple + it_803F91D0, + NULL, + NULL, + it_802EEA08, + it_802EEA70, + it_802EEB28, + it_802EEED0, + NULL, + it_802EEBB0, + it_802EEF10, + it_802EEED8, + NULL, + it_802EEF68, + it_802EEF30, + it_802EEF88, + }, + { + // Whispy's Healing Apple + it_803F91D0, + NULL, + NULL, + it_802EEA08, + it_802EEA70, + it_802EEB28, + it_802EEED0, + NULL, + it_802EEBB0, + it_802EEF10, + it_802EEED8, + NULL, + it_802EEF68, + it_802EEF30, + it_802EEF88, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Tool (Flatzone) + it_803F9260, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802EF074, + it_802EF700, + NULL, + it_802EF944, + it_802EF724, + it_802EF874, + it_802EF924, + it_802EF7CC, + it_802EFA24, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // [Invalid] + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, + { + // Birdo (Kyasarin) + it_803F90D0, + it_802ECE90, + it_802ECCDC, + NULL, + NULL, + NULL, + NULL, + it_802EDDC0, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + it_802EE1E0, + }, + { + // Arwing Laser + it_803F8DE8, + NULL, + it_802E79C8, + NULL, + NULL, + NULL, + it_802E838C, + NULL, + NULL, + it_802E8420, + it_802E838C, + it_802E8418, + it_802E85F4, + it_802E8784, + NULL, + }, + { + // Great Fox's Laser + it_803F8FD0, + it_802EB1EC, + NULL, + NULL, + NULL, + NULL, + it_802EB444, + NULL, + NULL, + it_802EB45C, + it_802EB44C, + it_802EB454, + NULL, + NULL, + it_802EB5A8, + }, + { + // Birdo's Egg + it_803F9328, + NULL, + NULL, + it_802EFBC0, + it_802EFBE8, + it_802EFC08, + it_802EFE28, + it_802F022C, + NULL, + it_802F0104, + it_802EFF1C, + NULL, + it_802F01F8, + it_802F0010, + it_802F0320, + }, + { + // NULL + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + }, +}; + +static char it_803F5428; +HSD_ObjAllocUnk4 it_804A0E30; +HSD_ObjAllocUnk6 it_804A0E50; +HSD_ObjAllocUnk6 it_804A0E60; +// u8 it_804A0E70[0xF0]; +// Article* it_804A0F60[30]; +// static char it_804D5188[] = "src/sysdolphin/baselib/jobj.h"; // ? +// static char it_804D5190[] = "jobj"; +static char it_804D5198; +// static char it_804D519C[]; // Not sure of type +// static char it_804D51A4[]; // Not sure of type +static char it_804D51B0; +static char it_804D51B8; +static char it_804D51C0; +static ItCmd it_804D51C8[2] = { + it_80279AF0, + it_80279B10, +}; +// static char it_804D51D0[]; // Not sure of type +// static char it_804D51D8[]; // Not sure of type +// static char it_804D51E0[]; +// static char it_804D51E8[]; + +// s8 it_804D6D00; // Not sure of type +struct r13_ColAnimStruct* it_804D6D04; +// s32 it_804D6D08; // Not sure of type +// s32 it_804D6D0C; // Not sure of type +// u32 it_804D6D10; // Not sure of type +// uint it_804D6D14; // Not sure of type +// u32 it_804D6D18; // Not sure of type +// u8 it_804D6D1C; // Not sure of type +// Article* it_804D6D20[]; // Not sure of type +// Article** it_804D6D24; +// ItemCommonData* it_804D6D28; // 8 bytes instead of 4 for some reason +// Article** it_804D6D30; // 8 bytes instead of 4 for some reason +// Article** it_804D6D38; // 8 bytes instead of 4 for some reason +f32** it_804D6D40; // Not sure of type. 8 bytes instead of 4 for some reason + +// static f32 it_804DC708 = 0.0f; +// static f32 it_804DC70C = 0.00001f; +// static f32 it_804DC710 = 1.0f; +// static f32 it_804DC714 = -1.0f; +// static f64 it_804DC718 = M_PI_2; +// static f64 const it_804DC720 = U32_TO_F32; +// static f32 it_804DC728 = 0.01f; +// static f32 it_804DC72C = deg_to_rad; +// static f32 it_804DC730 = 1.0f; +// static f32 it_804DC734 = 0.0f; +// static f32 it_804DC738 = 1.0f; +static f32 it_804DC73C = 0.0f; +// static f32 it_804DC740 = -1.0f; +static f32 it_804DC744 = 1.0f; +// static f64 const it_804DC748 = S32_TO_F32; +// static f32 it_804DC750 = 1.5f; +// static f32 it_804DC754 = 0.00001f; +// static f64 it_804DC758 = 0.5f; +// static f64 it_804DC760 = 3.0f; +// static f32 it_804DC768 = 0.85f; +static f32 it_804DC76C = 0.01f; +static f32 it_804DC770 = 0.0f; +// static f32 it_804DC774 = 1.0f; +// static f32 it_804DC778 = 2.0f; +// static f32 it_804DC77C = 0.5f; +// static f64 it_804DC780 = M_PI; +// static f64 it_804DC788 = 0.0f; +// static f32 it_804DC790 = 0.003906f; +// static f64 it_804DC798 = U32_TO_F32; +// static f64 it_804DC7A0 = S32_TO_F32; +// static f32 it_804DC7A8 = 1.0f; +// static f32 it_804DC7AC = 0.0f; +// static f32 it_804DC7B0 = F32_MAX; +// static f32 it_804DC7B8 = 0.0f; +// static f32 it_804DC7BC = -1.0f; +// static f32 it_804DC7C0 = 1.0f; +// static f32 it_804DC7C4 = 0.001f; +// static f64 it_804DC7C8 = M_PI_2; +// static f32 it_804DC7D0 = 0.0f; +// static f32 it_804DC7D4 = 1.0f; +// static f32 it_804DC7D8 = deg_to_rad; +// static f64 it_804DC7E0 = S32_TO_F32; +// static f32 it_804DC7E8 = M_PI_2; +// static f32 it_804DC7EC = 0.1f; +// static f64 it_804DC7F0 = 10.0f; +static f64 it_804DC7F8 = 0.5f; +// static f32 it_804DC800 = 30.0f; +// static f32 it_804DC804= 10.0f; +// static f64 it_804DC808 = M_PI_2; +// static f32 it_804DC810 = deg_to_rad; +// static f64 it_804DC818 = 3.0f; +// static f32 it_804DC820 = -1.0f; +// static f32 0.00000000680742f = 0.00000000680742f; +// static f32 it_804DC828 = 2.0f; +// static f32 it_804DC82C = 0.5f; + +typedef enum PokemonKind { + Pokemon_ID_Tosakinto, // Goldeen (Tosakinto) + Pokemon_ID_Chicorita, // Chikorita (Chicorita) + Pokemon_ID_Kabigon, // Snorlax (Kabigon) + Pokemon_ID_Kamex, // Blastoise (Kamex) + Pokemon_ID_Matadogas, // Weezing (Matadogas) + Pokemon_ID_Lizardon, // Charizard (Lizardon) + Pokemon_ID_Fire, // Moltres (Fire) + Pokemon_ID_Thunder, // Zapdos (Thunder) + Pokemon_ID_Freezer, // Articuno (Freezer) + Pokemon_ID_Sonans, // Wobbuffet (Sonans) + Pokemon_ID_Hassam, // Scizor (Hassam) + Pokemon_ID_Unknown, // Unown (Unknown) + Pokemon_ID_Entei, // Entei + Pokemon_ID_Raikou, // Raikou + Pokemon_ID_Suikun, // Suicune (Suikun) + Pokemon_ID_Kireihana, // Bellossom (Kireihana) + Pokemon_ID_Marumine, // Electrode (Marumine) + Pokemon_ID_Lugia, // Lugia + Pokemon_ID_Houou, // Ho-oh (Houou) + Pokemon_ID_Metamon, // Ditto (Metamon) + Pokemon_ID_Pippi, // Clefairy (Pippi) + Pokemon_ID_Togepy, // Togepi (Togepy) + Pokemon_ID_Mew, // Mew + Pokemon_ID_Cerebi, // Celebi (Cerebi) + Pokemon_ID_Hitodeman, // Staryu (Hitodeman) + Pokemon_ID_Lucky, // Chansey (Lucky) + Pokemon_ID_Porygon2, // Porygon2 + Pokemon_ID_Hinoarashi, // Cyndaquil (Hinoarashi) + Pokemon_ID_Maril, // Marill (Maril) + Pokemon_ID_Fushigibana, // Venusaur (Fushigibana) +} PokemonKind; + +static inline void it_8027129C_by_4(Item_GObj* item_gobj) +{ + u32 cnt; + + for (cnt = 0; cnt < 4; cnt++) { + it_8027129C(item_gobj, cnt); + } +} + +void it_80272560(Item_GObj* item_gobj, s32 idx) +{ + Item* item; + s32 stack[2]; + + item = item_gobj->user_data; + lbColl_80008428(&item->x5D4_hitboxes[idx].hit); + item->xDAA_flag.b2 = false; + + it_8027129C_by_4(item_gobj); +} + +void it_802725D4(Item_GObj* item_gobj) +{ + u32 i; + Item* item = item_gobj->user_data; + +#if 1 + u8* var_r31 = ((u8*) item); + + for (i = 0; i < 4; ++i) { + lbColl_80008428((HitCapsule*) (var_r31 + (i * 0x13c) + 0x5d4)); + } +#else + for (i = 0; i < 4; ++i) { + lbColl_80008428(&item->x5D4_hitboxes[i].hit); + } +#endif + + for (i = 0; i < 4; ++i) { + it_8027129C(item_gobj, i); + } + // lol. 0xDC8 should probably be split into 4 bitfields + item->xDC8_word.flags.x16 = 0; + item->xDAA_flag.b2 = 0; +} + +void it_80272674(Item_GObj* item_gobj, s32 idx) +{ + HitCapsuleState state; + Item* item = item_gobj->user_data; + HitCapsule* hitbox; + + lbColl_80008434(&item->x5D4_hitboxes[idx].hit); + item->xDC8_word.flags.x16 = 1; + + item = GET_ITEM((HSD_GObj*) item_gobj); + hitbox = &item->x5D4_hitboxes[idx].hit; + state = hitbox->state; + + switch (state) { + case HitCapsule_Enabled: + lb_8000B1CC(hitbox->jobj, &hitbox->b_offset, &hitbox->x4C); + hitbox->x58 = hitbox->x4C; + hitbox->state = 2; + item->xDAA_flag.b2 = 1; + return; + case HitCapsule_Unk2: + hitbox->state = 3; + /* fallthrough */ + case HitCapsule_Unk3: + hitbox->x58 = hitbox->x4C; + lb_8000B1CC(hitbox->jobj, &hitbox->b_offset, &hitbox->x4C); + /* fallthrough */ + case 4: // HitCapsule_Max + case HitCapsule_Disabled: + return; + } +} + +static inline void it_80272784_inline(Item_GObj* item_gobj) +{ + u32 i; + + for (i = 0; i < 4; ++i) { + it_8027129C(item_gobj, i); + } +} + +void it_80272784(Item_GObj* item_gobj) +{ + u32 i; + Item* item = GET_ITEM((HSD_GObj*) item_gobj); + +#if 1 + u8* var_r31 = ((u8*) item); + + for (i = 0; i < 4; ++i) { + lbColl_80008434((HitCapsule*) (var_r31 + (i * 0x13c) + 0x5d4)); + } +#else + for (i = 0; i < 4; ++i) { + lbColl_80008434(&item->x5D4_hitboxes[i].hit); + } +#endif + + item->xDC8_word.flags.x16 = 1; + it_80272784_inline(item_gobj); +} + +Fighter* it_80272818(Item* item) +{ + return ((it_2728_DatAttrs*) item->xC4_article_data->x4_specialAttributes) + ->fighter; +} + +// Returns Item_GObj of the specified kind if part of HSD_GObj_Entities->items +Item_GObj* it_80272828(ItemKind kind) +{ + Item_GObj* item_gobj_return; + Item_GObj* item_gobj_check; + + item_gobj_return = NULL; + item_gobj_check = (Item_GObj*) HSD_GObj_Entities->items; + while (item_gobj_check != NULL) { + if (((Item*) item_gobj_check->user_data)->kind == kind) { + item_gobj_return = item_gobj_check; + } + + item_gobj_check = item_gobj_check->next; + } + return item_gobj_return; +} + +void it_80272860(Item_GObj* item_gobj, f32 arg1, f32 arg2) +{ + Item* item; + f32 var_f3; + s32 var_r0; + s32 var_r3; + + item = item_gobj->user_data; + // if these aren't ternaries it allocates registers differently .-. + var_r0 = arg1 < 0.0f ? -1 : 1; + + var_f3 = item->x40_vel.y; + + var_r3 = var_f3 < 0.0f ? -1 : 1; + + if (var_r3 != var_r0) { + if (var_f3 < 0.0f) { + var_f3 = -var_f3; + } + if (var_f3 < arg2) { + label_1: + item->x40_vel.y -= arg1; + return; + } + return; + } + // big dumb + goto label_1; +} + +void it_802728C8(Item_GObj* item_gobj) +{ + u32 rem; + HSD_JObj* item_jobj2; + HSD_JObj* item_jobj1; + PAD_STACK(12); + + item_jobj1 = GET_JOBJ((HSD_GObj*) item_gobj); + item_jobj2 = item_jobj1 == NULL ? NULL : item_jobj1->child; + rem = (u32) (s32) ((Item*) item_gobj->user_data)->xD44_lifeTimer % + it_804D6D28->x44_float; + if (rem != 0) { + HSD_JObjClearFlagsAll(item_jobj2, 0x10U); + return; + } + HSD_JObjSetFlagsAll(item_jobj2, 0x10U); +} + +void it_80272940(Item_GObj* item_gobj) +{ + HSD_JObj* item_jobj2; + HSD_JObj* item_jobj1; + + item_jobj1 = GET_JOBJ((HSD_GObj*) item_gobj); + item_jobj2 = item_jobj1 == NULL ? NULL : item_jobj1->child; + HSD_JObjClearFlagsAll(item_jobj2, 0x10U); +} + +// void it_80272980(Item_GObj* item_gobj, f32 arg1) { +void it_80272980(Item_GObj* item_gobj) +{ + f32 dir; + f32 vel_x; + s32 int_dir; + Item* item; + + item = item_gobj->user_data; + vel_x = item->x40_vel.x; + if (vel_x < 0.0f) { + vel_x = -vel_x; + } + if (!(vel_x < 0.00001f) || (item->facing_dir == 0.0f)) { + if (item->x40_vel.x >= 0.0f) { + dir = 1.0f; + } else { + dir = -1.0f; + } + item->facing_dir = dir; + } + + if (-1.0f == item->facing_dir) { + int_dir = -1; + } else { + int_dir = 1; + } + mpColl_800436D8(&item->x378_itemColl, int_dir); +} + +void it_80272A18(HSD_JObj* item_jobj) +{ + HSD_JObjClearFlagsAll(item_jobj, 0x10U); +} + +void it_80272A3C(HSD_JObj* item_jobj) +{ + HSD_JObjSetFlagsAll(item_jobj, 0x10U); +} + +void it_80272A60(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + efSync_Spawn(0x40E, item_gobj, &item->pos); + Item_8026AE84(item, 0x74, 0x7F, 0x40); + it_80274C60(item_gobj); +} + +void it_80272AC4(Item_GObj* item_gobj, Vec3* arg1) +{ + Item* item; + Vec3* temp; + + item = item_gobj->user_data; + // mut add + return i guess? + temp = lbVector_Add(arg1, &item->pos); + efSync_Spawn(0x40C, item_gobj, arg1); + Item_8026AE84(item, 0x74, 0x7F, 0x40); + it_80274C60(item_gobj); +} + +void it_80272B40(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + efSync_Spawn(0x40C, item_gobj, &item->pos); + Item_8026AE84(item, 0x74, 0x7F, 0x40); + it_80274C60(item_gobj); +} + +void it_80272BA4(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + efSync_Spawn(0x411, item_gobj, &item->pos); + Item_8026AE84(item, 0x73, 0x7F, 0x40); + it_80274C60(item_gobj); +} + +void it_80272C08(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + efSync_Spawn(0x410, item_gobj, &item->pos); + Item_8026AE84(item, 0x74, 0x7F, 0x40); + it_80274C60(item_gobj); +} + +bool it_80272C6C(Item_GObj* item_gobj) +{ + return lb_8000B09C(item_gobj->hsd_obj); +} -/// #it_802725D4 +HSD_JObj* it_80272C90(Item_GObj* item_gobj) +{ + return it_80272CC0( + item_gobj, ((Item*) item_gobj->user_data) + ->xC4_article_data->x10_modelDesc->x8_bone_attach_id); +} -/// #it_80272674 +HSD_JObj* it_80272CC0(Item_GObj* item_gobj, enum_t idx) +{ + HSD_JObj* item_jobj2; + HSD_JObj* item_jobj1; + Item* item; + + item = item_gobj->user_data; + item_jobj1 = item_gobj->hsd_obj; + if (item->xC4_article_data->x10_modelDesc->x4_bone_count != 0) { + return item->xBBC_dynamicBoneTable->bones[idx]; + } + if (idx != 0) { + for (; idx > 0; --idx) { + item_jobj2 = item_jobj1 == NULL ? NULL : item_jobj1->child; + item_jobj1 = item_jobj2; + } + } + + return item_jobj1; +} -/// #it_80272784 +bool it_80272D1C(Item_GObj* item_gobj) +{ + if ((item_gobj != NULL) && (item_gobj->classifier == 6)) + { // ITEM_UNK_ENEMY? + return true; + } + return false; +} -s32 it_80272818(Item_GObj* gobj) +s32 it_80272D40(Item_GObj* item_gobj) { - /// @todo This seems to get #Item::xC4_article_data directly, - /// without #GET_ITEM - return *M2C_FIELD(M2C_FIELD(gobj, void**, 0xC4), s32**, 4); + bool chk; + + if (ftLib_80086960((HSD_GObj*) item_gobj)) { + return 0; + } + if ((item_gobj != NULL) && (item_gobj->classifier == 6)) + { // ITEM_UNK_ENEMY? + chk = true; + } else { + chk = false; + } + if (chk) { + return 1; + } + return 2; } -/// #it_80272828 +bool itColl_BounceOffVictim(Item_GObj* item_gobj) +{ + Item* item; + ItemCommonData* val; + + item = item_gobj->user_data; + // needs x58-x60 to be f32 type, otherwise requires pointer casting + item->x40_vel.x *= it_804D6D28->x58_float; + val = it_804D6D28; + item->x40_vel.y = (item->x40_vel.y * val->x5C_float) + val->x60_float; + return (bool) val; // i have no idea what this means +} -/// #it_80272860 +void it_80272DE4(HSD_JObj* jobj, f32 scale) +{ + HSD_JObjAddScaleX(jobj, scale); + HSD_JObjAddScaleY(jobj, scale); + HSD_JObjAddScaleZ(jobj, scale); +} -/// #it_802728C8 +void it_80272F7C(HSD_JObj* jobj, f32 scale) +{ + Vec3 temp; -/// #it_80272940 + temp.x = temp.y = temp.z = scale; + HSD_JObjSetScale(jobj, &temp); +} -/// #it_80272980 +bool it_80273030(Item_GObj* item_gobj) +{ + Item* item; -/// #it_80272A18 + item = item_gobj->user_data; + item->x40_vel.x = -item->x40_vel.x * item->xC70; + item->x40_vel.y = -item->x40_vel.y * item->xC70; + item->facing_dir = -item->facing_dir; + item->xD44_lifeTimer = item->xD48_halfLifeTimer; + return false; +} -/// #it_80272A3C +bool itColl_BounceOffShield(Item_GObj* item_gobj) +{ + Item* item; + f32 dir; + f32 vel_x; + s32 int_dir; + PAD_STACK(4); + + item = GET_ITEM((HSD_GObj*) item_gobj); + lbVector_Mirror(&item->x40_vel, &item->xC58); + item = item_gobj->user_data; + vel_x = item->x40_vel.x; + if (vel_x < 0.0f) { + vel_x = -vel_x; + } + if (!(vel_x < 0.00001f) || (item->facing_dir == 0.0f)) { + if (item->x40_vel.x >= 0.0f) { + dir = 1.0f; + } else { + dir = -1.0f; + } + item->facing_dir = dir; + } + if (-1.0f == item->facing_dir) { + int_dir = -1; + } else { + int_dir = 1; + } + mpColl_800436D8(&item->x378_itemColl, int_dir); + return false; +} -/// #it_80272A60 +bool it_80273130(Item_GObj* item_gobj) +{ + Item* item; -/// #it_80272AC4 + item = item_gobj->user_data; + item->xD44_lifeTimer--; + if (item->xD44_lifeTimer <= 0.0f) { + return true; + } + return false; +} -/// #it_80272B40 +void it_80273168(Item_GObj* item_gobj) +{ + Item* item; -/// #it_80272BA4 + item = item_gobj->user_data; + if (!(item->xDCD_flag.b2)) { + Item_8026AE84(item, item->xD70, 0x7F, 0x40); + } +} -/// #it_80272C08 +void it_802731A4(Item_GObj* item_gobj) +{ + Item* item; -/// #it_80272C6C + item = item_gobj->user_data; + if (!(item->xDCD_flag.b2)) { + Item_8026AE84(item, item->xD78, 0x7F, 0x40); + } +} -/// #it_80272C90 +void it_802731E0(Item_GObj* item_gobj) +{ + Item* item; -/// #it_80272CC0 + item = item_gobj->user_data; + if (!(item->xDCD_flag.b2)) { + Item_8026AE84(item, item->xD74, 0x7F, 0x40); + } +} -/// #it_80272D1C +void it_8027321C(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + if (!item->xDCD_flag.b2) { + if (item->kind == It_Kind_Unk4) { + lbAudioAx_80023870(item->xD84, 0x7F, 0x40, 0x9A); + return; + } + Item_8026AE84(item, item->xD84, 0x7F, 0x40); + } +} -/// #it_80272D40 +void it_8027327C(Item_GObj* item_gobj, enum_t ID1, enum_t ID2) +{ + Item* item; + + item = item_gobj->user_data; + if (ID1 != -1) { + it_802787B4(item_gobj, ID1); + } + if (!item->xDCD_flag.b2) { + it_802732E4(item, ID2); + if (ID2 == 0x12F) { + lbAudioAx_80024DC4(ID2); + } + } +} -/// #itColl_BounceOffVictim +void it_802732E4(Item* item, s32 arg1) +{ + if (!item->xDCD_flag.b2) { + Item_8026AE84(item, arg1, 0x7F, 0x40); + } +} -/// #it_80272DE4 +void it_80273318(Item_GObj* item_gobj, HSD_Joint* joint, s32 arg2) +{ + // void it_80273318(Item_GObj* item_gobj, HSD_Joint* joint) { + HSD_JObj* item_jobj; + Item* item; + + item = item_gobj->user_data; + item->xC8_joint = joint; + HSD_GObjObject_80390B0C((HSD_GObj*) item_gobj); + Item_802680CC((HSD_GObj*) item_gobj); + Item_8026849C((HSD_GObj*) item_gobj); + item_jobj = item_gobj->hsd_obj; + HSD_JObjSetTranslate(item_jobj, &item->pos); +} -/// #it_80272F7C +void it_80273408(Item_GObj* item_gobj) +{ + it_80273454(item_gobj); + it_8027346C(item_gobj); + it_80273484(item_gobj); + it_8027349C(item_gobj); + it_802734B4(item_gobj); +} -/// #it_80273030 +void it_80273454(Item_GObj* item_gobj) +{ + Item* item = item_gobj->user_data; -/// #itColl_BounceOffShield + item->x40_vel.x = item->x40_vel.y = item->x40_vel.z = 0.0f; +} -/// #it_80273130 +void it_8027346C(Item_GObj* item_gobj) +{ + Item* item = item_gobj->user_data; -/// #it_80273168 + item->x64_vec_unk2.x = item->x64_vec_unk2.y = item->x64_vec_unk2.z = 0.0f; +} -/// #it_802731A4 +void it_80273484(Item_GObj* item_gobj) +{ + Item* item = item_gobj->user_data; -/// #it_802731E0 + item->x58_vec_unk.x = item->x58_vec_unk.y = item->x58_vec_unk.z = 0.0f; +} -/// #it_8027321C +void it_8027349C(Item_GObj* item_gobj) +{ + Item* item = item_gobj->user_data; -/// #it_8027327C + item->x70_nudge.x = item->x70_nudge.y = item->x70_nudge.z = 0.0f; +} -/// #it_802732E4 +void it_802734B4(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->x7C.x = item->x7C.y = item->x7C.z = 0.0f; + item->x88.x = item->x88.y = item->x88.z = 0.0f; + item->x94.x = item->x94.y = item->x94.z = 0.0f; + item->xA0.x = item->xA0.y = item->xA0.z = 0.0f; + item->xAC_unk.x = item->xAC_unk.z = 0.0f; + item->xAC_unk.y = 1.0f; +} -/// #it_80273318 +void it_80273500(Item_GObj* item_gobj, Vec3* arg1) +{ + Item* item; + + item = item_gobj->user_data; + // assinging directly causes a memcopy instead of using float transfers + item->x40_vel.x = arg1->x; + item->x40_vel.y = arg1->y; + item->x40_vel.z = arg1->z; + // assuming these are inlines? + it_8027346C(item_gobj); + // item = item_gobj->user_data; + // item->x64_vec_unk2.x = item->x64_vec_unk2.y = item->x64_vec_unk2.z = 0; + it_80273484(item_gobj); + // item = item_gobj->user_data; + // item->x58_vec_unk.x = item->x58_vec_unk.y = item->x58_vec_unk.z = 0; + it_8027349C(item_gobj); + // item = item_gobj->user_data; + // item->x70_nudge.x = item->x70_nudge.y = item->x70_nudge.z = 0; + it_802734B4(item_gobj); + // item = item_gobj->user_data; + // item->x7C.x = item->x7C.y = item->x7C.z = 0.0f; + // item->x88.x = item->x88.y = item->x88.z = 0.0f; + // item->x94.x = item->x94.y = item->x94.z = 0.0f; + // item->xA0.x = item->xA0.y = item->xA0.z = 0.0f; + // item->xAC_unk.x = item->xAC_unk.z = 0.0f; + // item->xAC_unk.y = 1.0f; +} -/// #it_80273408 +void it_80273598(Item_GObj* item_gobj, s32 arg1, s32 arg2) +{ + HSD_GObj* temp_r3; + Item* item; + + item = item_gobj->user_data; + // storing owner causes incorrect register allocations + if ((item->owner != NULL) && (ftLib_80086960(item->owner))) { + ftLib_80086D40(item->owner, arg1, arg2); + } +} -/// #it_80273454 +void it_80273600(Item_GObj* item_gobj) +{ + Item* item; -/// #it_8027346C + item = item_gobj->user_data; + // storing owner causes incorrect register allocation + if ((item->owner != NULL) && (ftLib_80086960(item->owner) != 0)) { + ftLib_80086E68(item->owner); + } +} -/// #it_80273484 +void it_80273648(Item_GObj* item_gobj, s32 arg1, s32 arg2) +{ + ftLib_80086DC4(arg1, arg2); +} -/// #it_8027349C +void it_80273670(Item_GObj* item_gobj, int arg1, f32 arg8) +{ + HSD_JObj* item_jobj1; + HSD_JObj* item_jobj2; + Item* item; + HSD_Joint* joint; + ItemStateDesc* desc; + + item = GET_ITEM((HSD_GObj*) item_gobj); + item_jobj1 = GET_JOBJ((HSD_GObj*) item_gobj); + item->xD0_itemStateDesc = + &(item->xC4_article_data->xC_itemStates->x0_itemStateDesc[arg1]); + if (item->xD0_itemStateDesc != NULL) { + HSD_JObjRemoveAnimAll(item_jobj1); + joint = item->xC8_joint; + if (joint != NULL) { + if (item_jobj1 == NULL) { + item_jobj2 = NULL; + } else { + item_jobj2 = item_jobj1->child; + } + lb_8000B804(item_jobj2, joint->child); + } + desc = item->xD0_itemStateDesc; + HSD_JObjAddAnimAll(item_jobj1, desc->x0_anim_joint, + desc->x4_matanim_joint, + (HSD_ShapeAnimJoint*) desc->x8_parameters); + lb_8000BA0C(item_jobj1, item->x5D0_animFrameSpeed); + HSD_JObjReqAnimAll(item_jobj1, arg8); + } + HSD_JObjAnimAll(item_jobj1); + HSD_JObjRemoveAnimAll(item_jobj1); + item->x52C_item_script = NULL; +} -/// #it_802734B4 +void it_80273748(Item_GObj* item_gobj, Vec3* pos, Vec3* vel) +{ + // register allocations correct so long as vars are in exactly this order + HSD_JObj* jobj2; + f32 rotation; + f32 dir_radians; + f32 dir; + f32 vel_x; + s32 hold_kind; + s32 _filler; // this var does nothing but removing it fucks up the register + // allocations + s32 int_dir; + Vec3 sp54; + Vec3 sp48; + Vec3 sp3C; + HSD_JObj* jobj_2; + Item* item_2; + Item* item; + HSD_GObj* owner; + HSD_JObj* jobj; + PAD_STACK(32); + + // item = GET_ITEM((HSD_GObj*) item_gobj); + // jobj = GET_JOBJ((HSD_GObj*) item_gobj); + item = item_gobj->user_data; + jobj = item_gobj->hsd_obj; + owner = item->owner; + it_80275070(item_gobj, + item->xC4_article_data->x10_modelDesc->x8_bone_attach_id); + if (!it_8026B6C8(item_gobj)) { + it_8026B390(item_gobj); + } + it_802756E0(item_gobj); + item_2 = item_gobj->user_data; + jobj_2 = item_gobj->hsd_obj; + rotation = it_80274990(item_gobj); + lb_8000B804(jobj_2, item_2->xC8_joint); + Item_8026849C((HSD_GObj*) item_gobj); + it_80274658(item_gobj, rotation); + if (item->xDC8_word.flags.x0) { + owner = (HSD_GObj*) item->x51C; + } + item->x40_vel = *vel; + item->x40_vel.x *= item->xCC_item_attr->x4_throw_speed_mul; + item->x40_vel.y *= item->xCC_item_attr->x4_throw_speed_mul; + item->x40_vel.z *= item->xCC_item_attr->x4_throw_speed_mul; + item = item_gobj->user_data; + vel_x = item->x40_vel.x; + if (vel_x < 0.0f) { + vel_x = -vel_x; + } + if (!(vel_x < 0.00001f) || (item->facing_dir == 0.0f)) { + if (item->x40_vel.x >= 0.0f) { + dir = 1.0f; + } else { + dir = -1.0f; + } + item->facing_dir = dir; + } + if (-1.0f == item->facing_dir) { + int_dir = -1; + } else { + int_dir = 1; + } + mpColl_800436D8(&item->x378_itemColl, int_dir); + if (item->xDC8_word.flags.x19 == 1) { + dir_radians = M_PI_2 * item->facing_dir; + HSD_JObjSetRotationY(jobj, dir_radians); + } + if (((it_8026B2B4(item_gobj) == 1) && + (hold_kind = item->hold_kind, (hold_kind != 4)) && + (hold_kind != 6)) || + (item->hold_kind == 8)) + { + jobj2 = it_80272CC0( + item_gobj, + ((Item*) item_gobj->user_data) + ->xC4_article_data->x10_modelDesc->x8_bone_attach_id); + HSD_JObjGetTranslation(jobj2, &sp3C); + sp3C.x = -sp3C.x; + sp3C.y = -sp3C.y; + sp3C.z = -sp3C.z; + lb_8000B1CC(ftLib_80086630((Fighter_GObj*) owner, item->xDC4), &sp3C, + &sp54); + lb_8000B1CC(ftLib_80086630((Fighter_GObj*) owner, item->xDC4), NULL, + &sp48); + sp3C.x = sp54.x - sp48.x; + sp3C.y = sp54.y - sp48.y; + sp3C.z = 0.0f; + } else { + sp3C.x = sp3C.y = sp3C.z = 0.0f; + } + item->pos.x = pos->x + sp3C.x; + item->pos.y = pos->y + sp3C.y; + item->pos.z = 0.0f; + HSD_JObjSetTranslate(jobj, &item->pos); +} -/// #it_80273500 +void it_80273B50(Item_GObj* item_gobj, Vec3* vel) +{ + // register allocations are correct when vars declared in exactly this + // order + s32 stack_top[10]; + Item* item; + HSD_GObj* owner_gobj; + HSD_JObj* jobj; + f32 rotation; + f32 dir_radians; + f32 dir; + f32 vel_x; + s32 hold_kind; + Vec3 sp40; + Vec3 sp34; + s32 int_dir; + Vec3* pos; + HSD_JObj* item_jobj2; + HSD_JObj* item_jobj3; + HSD_JObj* item_jobj1; + Item* item2; + Item* item3; + PAD_STACK(32); + + item = item_gobj->user_data; + item_jobj1 = item_gobj->hsd_obj; + owner_gobj = item->owner; + it_80275070(item_gobj, + item->xC4_article_data->x10_modelDesc->x8_bone_attach_id); + if (!it_8026B6C8(item_gobj)) { + it_8026B390(item_gobj); + } + it_802756E0(item_gobj); + item = item_gobj->user_data; + item_jobj2 = item_gobj->hsd_obj; + rotation = it_80274990(item_gobj); + lb_8000B804(item_jobj2, item->xC8_joint); + Item_8026849C((HSD_GObj*) item_gobj); + it_80274658(item_gobj, rotation); + if (item->xDC8_word.flags.x0) { + owner_gobj = (HSD_GObj*) item->x51C; + } + item->x40_vel = *vel; + item->x40_vel.x *= item->xCC_item_attr->x4_throw_speed_mul; + item->x40_vel.y *= item->xCC_item_attr->x4_throw_speed_mul; + item->x40_vel.z *= item->xCC_item_attr->x4_throw_speed_mul; + item2 = item_gobj->user_data; + vel_x = item2->x40_vel.x; + if (vel_x < 0.0f) { + vel_x = -vel_x; + } + if (!(vel_x < 0.00001f) || (item2->facing_dir == 0.0f)) { + if (item2->x40_vel.x >= 0.0f) { + dir = 1.0f; + } else { + dir = -1.0f; + } + item2->facing_dir = dir; + } + if (-1.0f == item2->facing_dir) { + int_dir = -1; + } else { + int_dir = 1; + } + mpColl_800436D8(&item2->x378_itemColl, int_dir); + if (item->xDC8_word.flags.x19 == 1) { + dir_radians = M_PI_2 * item->facing_dir; + HSD_JObjSetRotationY(item_jobj1, dir_radians); + } + if (((it_8026B2B4(item_gobj) == 1) && + (hold_kind = item->hold_kind, (hold_kind != 4)) && + (hold_kind != 6)) || + (item->hold_kind == 8)) + { + jobj = it_80272CC0( + (Item_GObj*) item_gobj, + ((Item*) item_gobj->user_data) + ->xC4_article_data->x10_modelDesc->x8_bone_attach_id); + HSD_JObjGetTranslation(jobj, &sp40); + sp40.x = -sp40.x; + sp40.y = -sp40.y; + sp40.z = -sp40.z; + } else { + sp40.x = sp40.y = sp40.z = 0.0f; + } + item3 = item_gobj->user_data; + item_jobj3 = item_gobj->hsd_obj; + if (&sp40 != NULL) { + lb_8000B1CC(ftLib_80086630((Fighter_GObj*) owner_gobj, item3->xDC4), + &sp40, &sp34); + } else { + lb_8000B1CC(ftLib_80086630((Fighter_GObj*) owner_gobj, item3->xDC4), + NULL, &sp34); + } + pos = &item3->pos; + item3->pos.x = sp34.x; + item3->pos.y = sp34.y; + item3->pos.z = 0.0f; + HSD_JObjSetTranslate(item_jobj3, pos); +} -/// #it_80273598 +// i don't think this is right, but a 3rd arg somewhere is the only way that +// the compiler will "protect" r5. I'm not 100% sure on the types either -/// #it_80273600 +// https://decomp.me/scratch/Sjr7G supports 3rd arg existing +// https://decomp.me/scratch/AcQ55 does not -/// #it_80273648 +// i'm gonna investigate other call sites of this function, as well as +// it_80275bc8 and we'll see what turns up +void it_80273F34(Item_GObj* item_gobj, HSD_GObj* arg_gobj2, Item* arg_item) +{ + Item* item; + HSD_JObj* item_jobj; + f32 rotate; + s32 int_dir; + + // item = GET_ITEM((HSD_GObj*) item_gobj); + item = item_gobj->user_data; + // item_jobj = GET_JOBJ((HSD_GObj*) item_gobj); + item_jobj = item_gobj->hsd_obj; + item->xDC8_word.flags.x13 = 0; + item->xDC8_word.flags.x14 = 1; + item->xDC4 = 0; + item->xD54_throwNum++; + item->xD50_landNum = 0; + + it_80275BC8(item_gobj, arg_gobj2); // probably not a 3rd arg, though adding + // it results in a 99.80% match + it_80274DAC(item_gobj); // doesn't touch r5 + + if (item->xDC8_word.flags.x19 == 1) { + rotate = M_PI_2 * item->facing_dir; + HSD_JObjSetRotationY(item_jobj, rotate); + } + + if (ftLib_80086960(arg_gobj2)) { + Item_8026A848((HSD_GObj*) item_gobj, arg_gobj2); // probably not + it_8027B070(item_gobj, + (Fighter_GObj*) arg_gobj2); // immediately loads a value + // into r5 without saving it + } + + if (-1.0f == item->facing_dir) { + int_dir = -1; + } else { + int_dir = 1; + } + + mpColl_800436D8(&item->x378_itemColl, int_dir); + Item_8026B074(item); + it_802762BC(item); + HSD_JObjSetTranslate(item_jobj, &item->pos); + + it_8027B4A4((Fighter_GObj*) arg_gobj2, item_gobj); + it_8027B378((Fighter_GObj*) arg_gobj2, item_gobj, it_802758D4(item_gobj)); +} -/// #it_80273670 +void it_80274198(Item_GObj* item_gobj, bool chk) +{ + Item* item; + HSD_GObj* owner_gobj; + HSD_GObj* x51C_gobj; + + item = item_gobj->user_data; + owner_gobj = item->owner; + if (item->xDC8_word.flags.x0 != 0) { + if (chk == true) { + x51C_gobj = item->x51C; + item->owner = x51C_gobj; + owner_gobj = x51C_gobj; + item->x51C = NULL; + } else { + owner_gobj = item->x51C; + } + } + // it_80273F34(item_gobj, owner_gobj); + it_80273F34(item_gobj, owner_gobj, item); +} -/// #it_80273748 +void it_802741F4(Item_GObj* item_gobj, bool chk) +{ + HSD_GObj* x51C_gobj; + HSD_GObj* owner_gobj; + Item* item; + + item = item_gobj->user_data; + owner_gobj = item->owner; + if (item->xDC8_word.flags.x0) { + if (chk == true) { + x51C_gobj = item->x51C; + item->owner = x51C_gobj; + owner_gobj = x51C_gobj; + item->x51C = NULL; + } else { + owner_gobj = item->x51C; + } + } + it_80273F34(item_gobj, owner_gobj, item); +} -/// #it_80273B50 +void it_80274250(Item_GObj* item_gobj, Vec3* arg1) +{ + HSD_GObj* owner_gobj; + Item* item; + PAD_STACK(16); + + it_80273B50(item_gobj, arg1); + item = GET_ITEM((HSD_GObj*) item_gobj); + owner_gobj = item->owner; + if (item->xDC8_word.flags.x0) { + owner_gobj = item->x51C; + } + it_80273F34(item_gobj, owner_gobj, item); +} -/// #it_80273F34 +void it_8027429C(Item_GObj* item_gobj, Vec3* arg1) +{ + HSD_GObj* owner_gobj; + Item* item; + PAD_STACK(16); + + it_80273B50(item_gobj, arg1); + item = GET_ITEM((HSD_GObj*) item_gobj); + owner_gobj = item->owner; + if (item->xDC8_word.flags.x0) { + owner_gobj = item->x51C; + item->owner = owner_gobj; + item->x51C = NULL; + } + it_80273F34(item_gobj, owner_gobj, item); +} -/// #it_80274198 +void it_802742F4(Item_GObj* item_gobj, HSD_GObj* gobj, Fighter_Part ftpart) +{ + HSD_JObj* item_jobj1; + HSD_JObj* item_jobj2; + Item* item; + flag32 word; + u8 flag; + + item = item_gobj->user_data; + lb_8000B804(item_gobj->hsd_obj, item->xC8_joint); + Item_8026849C((HSD_GObj*) item_gobj); + if (ftLib_80086960(gobj)) { + // word = item->xDC8_word; + // item->xDC8_word.word = (word & ~0x1E000) | (((((word >> 0xDU) & 0xF) + // | (1 << ftLib_80086BE0(gobj))) << 0xD) & 0x1E000); + // item->xDC8_word.word = item->xDC8_word.word & ~0x1E000; + // item->xDC8_word.word = (item->xDC8_word.word >> 0xDU) & 0xF; + // item->xDC8_word.word = (((1 << ftLib_80086BE0(gobj))) << 0xD) & + // 0x1E000; item->xDC8_word.word |= (item->xDC8_word.word >> 0xDU) & + // 0xF; item->xDC8_word.word = item->xDC8_word.word & ~0x1E000 | + // (item->xDC8_word.word >> 0xDU) & 0xF | (((1 << + // ftLib_80086BE0(gobj))) << 0xD) & 0x1E000; + item->xDC8_word.word = + ((item->xDC8_word.word >> 0xDU) & 0xF) | + ((((1 << ftLib_80086BE0(gobj))) << 0xD) & 0x1E000); + // item->xDC8_word.word |= (item->xDC8_word.word >> 0xDU) & 0xF | (((1 + // << ftLib_80086BE0(gobj))) << 0xD) & 0x1E000; item->xDC8_word.word = + // ((item->xDC8_word.word | ((1 << ftLib_80086BE0(gobj)))) >> 0xDU) & + // 0xF | 0x1E000; item->xDC8_word.flags.x3 = 1; + // item->xDC8_word.flags.xF = 0; + + // if (!(((u8) item->xDC8_word.word >> 7U) & 1)) { + if (!item->xDC8_word.flags.x0) { + item->owner = gobj; + } else { + item->x51C = gobj; + } + item->xDC4 = ftpart; + item->x20_team_id = ftLib_80086EB4(gobj); + item_jobj2 = NULL; + item->xD50_landNum = 0; + // ((UnkFlagStruct*)((u8*)item + 0xDCA))->b6 |= 1; + item->xDC8_word.flags.x13 = 1; + item_jobj1 = item_gobj->hsd_obj; + if (item_jobj1 == NULL) { + } else { + item_jobj2 = item_jobj1->child; + } + HSD_JObjClearFlagsAll(item_jobj2, 16U); + it_802756D0(item_gobj); + it_8026B3A8(item_gobj); + db_80225DD8(item_gobj, (Fighter_GObj*) gobj); + } + if (item->xDD0_flag.b6) { + item->xDD0_flag.b6 = 0; + item->xD40 = 0.0f; + it_80279BBC(item); + } + if (item->kind < 0x23) { + it_80275158(item_gobj, it_804D6D28->x30); + } + it_80274F48(item_gobj, + item->xC4_article_data->x10_modelDesc->x8_bone_attach_id, gobj, + ftpart); + it_80274C88(item_gobj); +} -/// #it_802741F4 +void it_80274484(Item_GObj* item_gobj, HSD_JObj* jobj, f32 scale) +{ + Vec3 sp1C; + Item* item; + f32 unused; + + item = GET_ITEM((HSD_GObj*) item_gobj); + item->scl = scale; + sp1C.z = item->scl; + sp1C.y = item->scl; + sp1C.x = item->scl; + HSD_JObjSetScale(jobj, &sp1C); + it_80275534(item_gobj, item->x3C); + it_80274DFC(item_gobj); + it_80274E44(item_gobj); +} -/// #it_80274250 +void it_80274574(Item_GObj* item_gobj) +{ + it_80274594(item_gobj); +} -/// #it_8027429C +inline void HSD_JObjSetScale_2(HSD_JObj* jobj, Vec3* scale) +{ + ((jobj) ? ((void) 0) + : __assert("src/sysdolphin/baselib/jobj.h", 760, "jobj")); + jobj->scale = *scale; + if (!(jobj->flags & (1 << 25))) { + ftCo_800C6AFC(jobj); + } +} -/// #it_802742F4 +void it_80274594(Item_GObj* item_gobj) +{ + Vec3 sp18; + HSD_JObj* item_jobj; + Item* item; + PAD_STACK(8); + + item = GET_ITEM((HSD_GObj*) item_gobj); + item_jobj = item_gobj->hsd_obj; + item->scl *= ftLib_80086A0C(item->owner); + sp18.z = item->scl; + sp18.y = item->scl; + sp18.x = item->scl; + HSD_JObjSetScale_2(item_jobj, &sp18); + it_80275534(item_gobj, item->x3C); + it_80274DFC(item_gobj); + it_80274E44(item_gobj); +} -/// #it_80274484 +void it_80274658(Item_GObj* item_gobj, f32 arg1) +{ + Item* item; + f32 spin_speed1; + f32 spin_speed2; + s32 dir1; + s32 dir2; + + item = item_gobj->user_data; + spin_speed2 = 0.0f; + spin_speed1 = item->spin_spd; + if (spin_speed1 != spin_speed2) { + spin_speed2 = 0.01f * spin_speed1 * (0.0174533f * arg1); + } + item->xD3C_spinSpeed = spin_speed2; + if (item->facing_dir < 0.0f) { + dir1 = -1; + } else { + dir1 = 1; + } + if (item->x40_vel.x < 0.0f) { + dir2 = -1; + } else { + dir2 = 1; + } + if (dir2 != dir1) { + item->xD3C_spinSpeed = -item->xD3C_spinSpeed; + } + if (item->xDC8_word.flags.x19 != 1) { + item->xD3C_spinSpeed *= -item->facing_dir; + } +} -/// #it_80274574 +HSD_JObj* it_802746F8(Item_GObj* item_gobj) +{ + u32 bit_chk; + s32 var_ctr; + HSD_JObj* item_jobj2; + HSD_JObj* item_jobj1; + + item_jobj1 = item_gobj->hsd_obj; + bit_chk = (((Item*) item_gobj->user_data) + ->xC4_article_data->x10_modelDesc->xC_bit_field >> + 6U) & + 3; + if (bit_chk != 0) { + for (var_ctr = bit_chk; var_ctr > 0; var_ctr--) { + if (item_jobj1 == NULL) { + item_jobj2 = NULL; + } else { + item_jobj2 = item_jobj1->child; + } + item_jobj1 = item_jobj2; + } + } + return item_jobj1; +} -/// #it_80274594 +void it_80274740(Item_GObj* item_gobj) +{ + HSD_JObj* item_jobj; + Item* item; + u32 bit_chk; + s32 var_ctr; + PAD_STACK(24); + + item = item_gobj->user_data; + item_jobj = item_gobj->hsd_obj; + bit_chk = (item->xC4_article_data->x10_modelDesc->xC_bit_field >> 6U) & 3; + if (bit_chk != 0) { + for (var_ctr = bit_chk; var_ctr > 0; var_ctr--) { + if (item_jobj == NULL) { + item_jobj = NULL; + } else { + item_jobj = item_jobj->child; + } + } + } + item->xD3C_spinSpeed = 0.0f; + if (item->xDC8_word.flags.x17 == 0) { + HSD_JObjSetRotationZ(item_jobj, item->xD3C_spinSpeed); + } else if (item->xDC8_word.flags.x17 == 1) { + HSD_JObjSetRotationX(item_jobj, item->xD3C_spinSpeed); + } else { + HSD_JObjSetRotationY(item_jobj, item->xD3C_spinSpeed); + } +} -/// #it_80274658 +f32 it_80274990(Item_GObj* item_gobj) +{ + u32 bit_chk; + s32 var_ctr; + Item* item; + HSD_JObj* item_jobj; + PAD_STACK(48); + + item = item_gobj->user_data; + item_jobj = item_gobj->hsd_obj; + bit_chk = (item->xC4_article_data->x10_modelDesc->xC_bit_field >> 6U) & 3; + if (bit_chk != 0) { + for (var_ctr = bit_chk; var_ctr > 0; var_ctr--) { + if (item_jobj == NULL) { + item_jobj = NULL; + } else { + item_jobj = item_jobj->child; + } + } + } + if (item->xDC8_word.flags.x17 == 0) { + return HSD_JObjGetRotationZ(item_jobj); + } + if (item->xDC8_word.flags.x17 == 1) { + return HSD_JObjGetRotationX(item_jobj); + } + return HSD_JObjGetRotationY(item_jobj); +} -/// #it_802746F8 +void it_80274A64(Item_GObj* item_gobj) +{ + HSD_JObj* item_jobj; + Item* item; + u32 bit_chk; + s32 var_ctr; + PAD_STACK(24); + + item = item_gobj->user_data; + item_jobj = item_gobj->hsd_obj; + bit_chk = (item->xC4_article_data->x10_modelDesc->xC_bit_field >> 6U) & 3; + if (bit_chk != 0) { + for (var_ctr = bit_chk; var_ctr > 0; var_ctr--) { + if (item_jobj == NULL) { + item_jobj = NULL; + } else { + item_jobj = item_jobj->child; + } + } + } + if (item->xDC8_word.flags.x17 == 0) { + HSD_JObjAddRotationZ(item_jobj, item->xD3C_spinSpeed); + } else if (item->xDC8_word.flags.x17 == 1) { + HSD_JObjAddRotationX(item_jobj, item->xD3C_spinSpeed); + } else { + HSD_JObjAddRotationY(item_jobj, item->xD3C_spinSpeed); + } +} -/// #it_80274740 +void it_80274C60(Item_GObj* item_gobj) +{ + Item* item; -/// #it_80274990 + item = item_gobj->user_data; + item->xDC8_word.flags.xC = 0; +} -/// #it_80274A64 +bool it_80274C78(Item_GObj* item_gobj) +{ + Item* item; -/// #it_80274C60 + item = item_gobj->user_data; + return item->xDC8_word.flags.xC; +} -bool it_80274C78(Item_GObj* gobj) +void it_80274C88(Item_GObj* item_gobj) { - return GET_ITEM(gobj)->xDC8_word.flags.xC; + Item* item; + + item = item_gobj->user_data; + item->xDD0_flag.b0 = 0; + item->xDAA_flag.b3 = 0; } -/// #it_80274C88 +void it_80274CAC(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xDD0_flag.b0 = 1; + if (db_80225B0C() != 0) { + item->xDAA_flag.b3 = 1; + } +} -/// #it_80274CAC +void it_80274D04(Item_GObj* item_gobj, Vec3* pos) +{ + Vec3 sp20; + Vec3 sp14; + PAD_STACK(4); + + it_8026BB88(item_gobj, &sp20); + it_8026BBCC(item_gobj, &sp14); + pos->x = sp20.x - sp14.x; + pos->y = sp20.y - sp14.y; +} -/// #it_80274D04 +void it_80274D6C(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + // item->xACC_itemHurtbox[1].b_pos.x = + // item->x378_itemColl.xA4_ecbCurrCorrect.right.x + item->pos.x; + item->xACC_itemHurtbox[1].is_grabbable = + item->x378_itemColl.xA4_ecbCurrCorrect.right.x + item->pos.x; + item->xACC_itemHurtbox[1].kind = + item->x378_itemColl.xA4_ecbCurrCorrect.left.x + item->pos.x; + item->xB64 = item->x378_itemColl.xA4_ecbCurrCorrect.top.x + + item->x378_itemColl.xA4_ecbCurrCorrect.right.y + item->pos.y; +} -/// #it_80274D6C +void it_80274DAC(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xACC_itemHurtbox[1].b_pos.z = 0.0f; + item->xACC_itemHurtbox[1].bone_idx = 0.0f; + item = item_gobj->user_data; + item->xACC_itemHurtbox[1].is_grabbable = + item->x378_itemColl.xA4_ecbCurrCorrect.right.x + item->pos.x; + item->xACC_itemHurtbox[1].kind = + item->x378_itemColl.xA4_ecbCurrCorrect.left.x + item->pos.x; + item->xB64 = item->x378_itemColl.xA4_ecbCurrCorrect.top.y + + item->x378_itemColl.xA4_ecbCurrCorrect.right.y + item->pos.y; +} -/// #it_80274DAC +void it_80274DFC(Item_GObj* item_gobj) +{ + Item* item; -/// #it_80274DFC + item = item_gobj->user_data; + item->xBCC_unk.x *= item->scl; + item->xBCC_unk.y *= item->scl; + item->xBD4_grabRange.x *= item->scl; + item->xBD4_grabRange.y *= item->scl; +} -/// #it_80274E44 +void it_80274E44(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xBEC.top *= item->scl; + item->xBEC.bottom *= item->scl; + item->xBEC.right *= item->scl; + item->xBEC.left *= item->scl; + item->xBDC.top *= item->scl; + item->xBDC.bottom *= item->scl; + item->xBDC.right *= item->scl; + item->xBDC.left *= item->scl; +} -void it_80274ECC(Item_GObj* gobj, bool arg1) +void it_80274ECC(Item_GObj* item_gobj, bool arg1) { - GET_ITEM(gobj)->xD09 = arg1; + ((Item*) item_gobj->user_data)->xD09 = arg1; } void it_80274ED8(void) { - it_804D6D0C += 1; + it_804D6D0C++; } void it_80274EE8(u32 arg0) { - it_804D6D08 += 1; + it_804D6D08++; +} + +void it_80274EF8(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xDC8_word.flags.x2 = 0; +} + +void it_80274F10(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xDC8_word.flags.x2 = 1; +} + +void it_80274F28(Item* item, s8 arg1, HSD_GObjEvent arg2, + HSD_GObjInteraction arg3) +{ + item->xDD0_flag.b5 = 1; + item->xD08 = arg1; + item->grab_dealt = arg2; + item->grabbed_for_victim = arg3; +} + +void it_80274F48(Item_GObj* item_gobj, s32 bone_id, HSD_GObj* arg2_gobj, + Fighter_Part part_idx) +{ + s32 var_ctr; + HSD_JObj* item_jobj1 = item_gobj->hsd_obj; + HSD_JObj* item_jobj2; + PAD_STACK(20); + + if (((Item*) item_gobj->user_data) + ->xC4_article_data->x10_modelDesc->x4_bone_count) + { + item_jobj1 = ((Item*) item_gobj->user_data) + ->xBBC_dynamicBoneTable->bones[bone_id]; + } else if (bone_id != 0) { + for (var_ctr = bone_id; var_ctr > 0; var_ctr--) { + if (item_jobj1 == NULL) { + item_jobj1 = NULL; + } else { + item_jobj1 = item_jobj1->child; + } + } + } + item_jobj2 = item_jobj1; + lb_8000C2F8(item_jobj2, + ftLib_80086630((Fighter_GObj*) arg2_gobj, part_idx)); +} + +void it_80274FDC(Item_GObj* item_gobj, s32 bone_id, Fighter_GObj* arg2_gobj, + Fighter_Part part_idx) +{ + HSD_JObj* item_jobj1; + HSD_JObj* item_jobj2; + s32 var_ctr; + Item* item; + PAD_STACK(14); + + item = GET_ITEM((HSD_GObj*) item_gobj); + item_jobj1 = item_gobj->hsd_obj; + if (item->xC4_article_data->x10_modelDesc->x4_bone_count != 0U) { + item_jobj1 = item->xBBC_dynamicBoneTable->bones[bone_id]; + } else if (bone_id != 0) { + var_ctr = bone_id; + while (var_ctr > 0) { + if (item_jobj1 == NULL) { + item_jobj1 = NULL; + } else { + item_jobj1 = item_jobj1->child; + } + var_ctr--; + } + } + item_jobj2 = item_jobj1; + lb_8000C1C0(item_jobj2, ftLib_80086630(arg2_gobj, part_idx)); +} + +void it_80275070(Item_GObj* item_gobj, s32 bone_id) +{ + HSD_JObj* item_jobj1; + HSD_JObj* item_jobj2; + s32 var_ctr; + Item* item; + + item = item_gobj->user_data; + item_jobj1 = item_gobj->hsd_obj; + if (item->xC4_article_data->x10_modelDesc->x4_bone_count != 0U) { + item_jobj1 = item->xBBC_dynamicBoneTable->bones[bone_id]; + } else { + if (bone_id != 0) { + for (var_ctr = bone_id; var_ctr > 0; --var_ctr) { + if (item_jobj1 == NULL) { + item_jobj1 = NULL; + } else { + item_jobj1 = item_jobj1->child; + } + } + } + } + item_jobj2 = item_jobj1; + lb_8000C390(item_jobj2); +} + +bool it_802750E8(Item_GObj* item_gobj, s32 mask) +{ + return ((Item*) item_gobj->user_data)->xDC0.u8 & mask; +} + +void it_802750F8(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xDCC_flag.b3 = 0; + Item_802697D4((HSD_GObj*) item_gobj); + Item_80269978((HSD_GObj*) item_gobj); + item->xDCC_flag.b3 = 1; +} + +void it_80275158(Item_GObj* item_gobj, f32 lifetime) +{ + Item* item; + + item = GET_ITEM((HSD_GObj*) item_gobj); + item->xD44_lifeTimer = lifetime; + item->xD48_halfLifeTimer = lifetime * it_804D6D28->x4C_float; +} + +void it_80275174(Item_GObj* item_gobj, f32 lifetime) +{ + ((Item*) item_gobj->user_data)->xD48_halfLifeTimer = + lifetime * it_804D6D28->x4C_float; +} + +void it_8027518C(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xD44_lifeTimer = it_804D6D28->xF8; + item->xDCF_flag.b2 = 1; + item->xDD1_flag.b0 = 1; + it_8026BDB4(item_gobj); +} + +bool it_802751D8(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xD44_lifeTimer--; + if (item->xD44_lifeTimer <= 0.0f) { + return true; + } + return false; +} + +void it_80275210(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xDC8_word.flags.x1C = 1; +} + +void it_80275228(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xDC8_word.flags.x1C = 0; +} + +void it_80275240(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xDC8_word.flags.x1E = 0; +} + +void it_80275258(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xDD0_flag.b4 = 0; +} + +void it_80275270(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xDD0_flag.b4 = 1; +} + +void it_80275288(Item_GObj* item_gobj, s32 arg1, s32 arg2) +{ + Item* item; + + item = item_gobj->user_data; + Item_8026AE84(item, arg2 + HSD_Randi(arg1), 127, 64); +} + +void it_802752D8(Item_GObj* item_gobj, s32 arg1, s32 arg2) +{ + Item* item; + + item = item_gobj->user_data; + Item_8026AFA0(item, arg2 + HSD_Randi(arg1), 127, 64); +} + +void it_80275328(HSD_GObj* gobj, ItemLink* arg1) +{ + arg1->prev = NULL; + arg1->next = NULL; + arg1->x8_vel.z = 0.0f; + arg1->x8_vel.y = 0.0f; + arg1->x8_vel.x = 0.0f; + arg1->pos.z = 0.0f; + arg1->pos.y = 0.0f; + arg1->pos.x = 0.0f; + arg1->x20_vec.z = 0.0f; + arg1->x20_vec.y = 0.0f; + arg1->x20_vec.x = 0.0f; + arg1->flag0 = 0; + arg1->flag1 = 0; + arg1->flag2 = 0; + arg1->unk = 0; + arg1->x1D0_GObj = gobj; + arg1->x1D4_JObj = NULL; +} + +void it_80275390(Item_GObj* item_gobj) +{ + ((Item*) item_gobj->user_data)->owner = NULL; + it_8026B3A8(item_gobj); +} + +void it_802753BC(Item_GObj* item_gobj, s16 arg1) +{ + Item* item; + + item = item_gobj->user_data; + item->xC94 = 0; + item->xC9C = arg1; + item->xCA0 = 0; + item->xCA4 = 0; +} + +void it_802753DC(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xC34_damageDealt = 0; + item->xC40 = 1.0f; + item->xC44 = 1.0f; + item->xC3C = 1.0f; + item->xC48 = 0; + item->xC4C = 0; + item->xC50 = 0; + item->xDCE_flag.b6 = 0; } -/// #it_80274EF8 +void it_80275414(Item_GObj* item_gobj) +{ + Item* item; -/// #it_80274F10 + item = item_gobj->user_data; + item->xDCD_flag.b7 = 1; +} -/// #it_80274F28 +void it_8027542C(Item_GObj* item_gobj) +{ + Item* item; -/// #it_80274F48 + item = item_gobj->user_data; + item->xDCD_flag.b7 = 0; +} -/// #it_80274FDC +void it_80275444(Item_GObj* item_gobj) +{ + Item* item; -/// #it_80275070 + item = item_gobj->user_data; + item->xDCD_flag.b5 = 1; + item->xDCD_flag.b7 = 1; + item->xDCD_flag.b6 = 1; +} -s32 it_802750E8(Item_GObj* gobj, s32 mask) +void it_80275474(Item_GObj* item_gobj) { - Item* ip = GET_ITEM(gobj); - return ip->xDC0 & mask; + Item* item; + + item = item_gobj->user_data; + item->xDCD_flag.b5 = 0; + item->xDCD_flag.b7 = 0; + item->xDCD_flag.b6 = 0; } -/// #it_802750F8 +void it_802754A4(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xDCE_flag.b2 = 1; +} -/// #it_80275158 +void it_802754BC(Item_GObj* item_gobj) +{ + Item* item; -/// #it_80275174 + item = item_gobj->user_data; + item->xDCE_flag.b2 = 0; +} -/// #it_8027518C +void it_802754D4(Item_GObj* item_gobj) +{ + Item* item; -/// #it_802751D8 + item = item_gobj->user_data; + item->xDCE_flag.b0 = 1; + item->xDCE_flag.b2 = 1; + item->xDCE_flag.b1 = 1; +} -/// #it_80275210 +void it_80275504(Item_GObj* item_gobj) +{ + Item* item; -/// #it_80275228 + item = item_gobj->user_data; + item->xDCE_flag.b0 = 0; + item->xDCE_flag.b2 = 0; + item->xDCE_flag.b1 = 0; +} -/// #it_80275240 +void it_80275534(Item_GObj* item_gobj, f32 scale) +{ + Item* item; + HitCapsule* hitcapsule; + u32 var_ctr; + + item = item_gobj->user_data; + for (var_ctr = 0U; var_ctr < 4U; var_ctr++) { + hitcapsule = &item->x5D4_hitboxes[var_ctr].hit; + if (hitcapsule->state != HitCapsule_Disabled) { + hitcapsule->scale = scale; + } + } +} -/// #it_80275258 +void it_80275594(Item_GObj* item_gobj, s32 idx, f32 mult) +{ + Item* item; + HitCapsule* hitcapsule; + + item = item_gobj->user_data; + hitcapsule = &item->x5D4_hitboxes[idx].hit; + if (hitcapsule->state != HitCapsule_Disabled) { + hitcapsule->scale *= mult; + } +} -/// #it_80275270 +void it_802755C0(Item_GObj* item_gobj, f32 scale) +{ + Item* item; + HitCapsule* hitcapsule; + u32 var_ctr; + + item = item_gobj->user_data; + for (var_ctr = 0U; var_ctr < 4U; var_ctr++) { + hitcapsule = &item->x5D4_hitboxes[var_ctr].hit; + if (hitcapsule->state != HitCapsule_Disabled) { + hitcapsule->scale *= scale; + } + } +} -/// #it_80275288 +void it_80275640(Item_GObj* item_gobj, f32 arg1) +{ +#if 1 + Item* item; + HitCapsule* hitcapsule; + u32 var_ctr; + + item = item_gobj->user_data; + for (var_ctr = 0U; var_ctr < 4U; var_ctr++) { + hitcapsule = &item->x5D4_hitboxes[var_ctr].hit; + if (hitcapsule->state != HitCapsule_Disabled) { + it_80272460(hitcapsule, hitcapsule->damage * arg1, item_gobj); + } + } +#else + Item* item; + HitCapsule* hitcapsule; + u32 var_ctr; + Item_GObj* gobj = item_gobj; + + item = item_gobj->user_data; + for (var_ctr = 0U; var_ctr < 4U; var_ctr++) { + hitcapsule = &item->x5D4_hitboxes[var_ctr].hit; + if (hitcapsule->state != HitCapsule_Disabled) { + it_80272460(hitcapsule, hitcapsule->damage * arg1, item_gobj, + (HSD_GObj*) gobj); + } + } +#endif +} -/// #it_802752D8 +void it_802756D0(Item_GObj* item_gobj) +{ + ((Item*) item_gobj->user_data)->xD0C = 2; +} -/// #it_80275328 +void it_802756E0(Item_GObj* item_gobj) +{ + ((Item*) item_gobj->user_data)->xD0C = 0; + it_802714C0(item_gobj); +} -/// #it_80275390 +void it_8027570C(Item_GObj* item_gobj, s32 idx) +{ + Item* item; -/// #it_802753BC + item = item_gobj->user_data; + item->x5D4_hitboxes[idx].hit.x40_b0 = 0; +} -/// #it_802753DC +void it_8027572C(Item_GObj* item_gobj, s32 idx) +{ + Item* item; -/// #it_80275414 + item = item_gobj->user_data; + item->x5D4_hitboxes[idx].hit.x40_b0 = 1; +} -/// #it_8027542C +void it_8027574C(Item_GObj* item_gobj) +{ + Item* item; -/// #it_80275444 + item = item_gobj->user_data; + it_80274D04(item_gobj, &item->xACC_itemHurtbox[1].b_pos); + it_80274D6C(item_gobj); +} -/// #it_80275474 +void it_80275788(Item_GObj* item_gobj) +{ +#if 0 + Item* item; + HitCapsule* hitcapsule; + u32 var_ctr; + + item = item_gobj->user_data; + for (var_ctr = 0U; var_ctr < 4U; var_ctr++) { + hitcapsule = &item->x5D4_hitboxes[var_ctr].hit; + if (hitcapsule->state != HitCapsule_Disabled) { + hitcapsule->state = HitCapsule_Max; + item->xDAA_flag.b2 = 1; + } + } +#elif 1 + Item* item; + HitCapsule* hitcapsule; + u32 state; + u32 var_ctr; + + item = item_gobj->user_data; + state = 4; + for (var_ctr = 0U; var_ctr < 4U; var_ctr++) { + hitcapsule = &item->x5D4_hitboxes[var_ctr].hit; + if (hitcapsule->state != HitCapsule_Disabled) { + hitcapsule->state = state; + item->xDAA_flag.b2 = 1; + } + } +#else + Item* item; + HitCapsule* hitcapsule; + u32 state; + + item = item_gobj->user_data; + state = 4; + hitcapsule = &item->x5D4_hitboxes[0].hit; + if (hitcapsule->state != HitCapsule_Disabled) { + hitcapsule->state = state; + item->xDAA_flag.b2 = 1; + } + hitcapsule = &item->x5D4_hitboxes[1].hit; + if (hitcapsule->state != HitCapsule_Disabled) { + hitcapsule->state = state; + item->xDAA_flag.b2 = 1; + } + hitcapsule = &item->x5D4_hitboxes[2].hit; + if (hitcapsule->state != HitCapsule_Disabled) { + hitcapsule->state = state; + item->xDAA_flag.b2 = 1; + } + hitcapsule = &item->x5D4_hitboxes[3].hit; + if (hitcapsule->state != HitCapsule_Disabled) { + hitcapsule->state = state; + item->xDAA_flag.b2 = 1; + } +#endif +} -/// #it_802754A4 +void it_80275820(Item_GObj* item_gobj, Vec3* arg1, Vec3* arg2, s32 idx) +{ + Item* item; + HitCapsule* hitcapsule; + + item = item_gobj->user_data; + hitcapsule = &item->x5D4_hitboxes[idx].hit; + if (hitcapsule->state != HitCapsule_Disabled) { + hitcapsule->x58 = *arg2; + hitcapsule->x4C = *arg1; + } +} -/// #it_802754BC +bool it_80275870(Item_GObj* item_gobj) +{ + Item* item; + HitCapsule* hitcapsule; + u32 var_ctr; + + item = item_gobj->user_data; + for (var_ctr = 0U; var_ctr < 4U; var_ctr++) { + hitcapsule = &item->x5D4_hitboxes[var_ctr].hit; + if (hitcapsule->state != HitCapsule_Disabled) { + return true; + } + } + return false; +} -/// #it_802754D4 +f32 it_802758D4(Item_GObj* item_gobj) +{ + Item* item; + HitCapsule* hitcapsule; + u32 var_ctr; + f32 damage; + bool disable_chk; + + item = item_gobj->user_data; + damage = 0.0f; +#if 0 + for (var_ctr = 0U; var_ctr < 4U; var_ctr++) { + hitcapsule = &item->x5D4_hitboxes[var_ctr].hit; + if (hitcapsule->state != HitCapsule_Disabled) { + disable_chk = true; + } else { + disable_chk = false; + } + } +#else + if (item->x5D4_hitboxes[0].hit.state != HitCapsule_Disabled) { + disable_chk = true; + } else if (item->x5D4_hitboxes[1].hit.state != HitCapsule_Disabled) { + disable_chk = true; + } else if (item->x5D4_hitboxes[2].hit.state != HitCapsule_Disabled) { + disable_chk = true; + } else if (item->x5D4_hitboxes[3].hit.state != HitCapsule_Disabled) { + disable_chk = true; + } else { + disable_chk = false; + } +#endif + if (disable_chk) { + for (var_ctr = 0U; var_ctr < 4U; var_ctr++) { + hitcapsule = &item->x5D4_hitboxes[var_ctr].hit; + if (hitcapsule->state != HitCapsule_Disabled) { + if (hitcapsule->damage <= damage) { + damage = hitcapsule->damage; + } + } + } + } + return damage; +} -/// #it_80275504 +void it_802759DC(Item_GObj* item_gobj1, Item_GObj* item_gobj2) +{ + Vec3 sp44; + f32 sp40; + Vec3 sp34; + CollData* coll1; + CollData* coll2; + Item* item1; + f32 temp_f31; + s32 temp_r3_2; + bool chk; + Vec3 sp1C; + PAD_STACK(14); + + chk = false; + item1 = GET_ITEM((HSD_GObj*) item_gobj1); + sp44 = item1->pos; + coll2 = it_8026C100(item_gobj2); + coll1 = &item1->x378_itemColl; + if (coll2 != NULL) { + if (mpLib_80054ED8(coll2->floor.index)) { + temp_r3_2 = mpLib_8005199C(&sp44, -1, -1); + if ((temp_r3_2 != -1) && + mpLib_80054F68(temp_r3_2, coll2->floor.index)) + { + coll1->floor.index = temp_r3_2; + mpLib_8004DD90(temp_r3_2, &sp44.x, &sp40, 0, NULL); + // if (sp40 >= (f32) ((u8) it_804D6D28 + 0xF0)) { + // if (sp40 >= (f32) it_804D6D28->filler[12]) { + if (sp40 >= it_804D6D28->xF0) { + item1->pos.x = sp44.x; + item1->pos.y = sp44.y + sp40; + item1->pos.z = sp44.z; + mpColl_80043680(coll1, &item1->pos); + chk = true; + it_802762B0(item1); + } + } + } + if (!chk) { + temp_f31 = 0.5f * (coll2->xA4_ecbCurrCorrect.top.y + + coll2->xA4_ecbCurrCorrect.bottom.y); + it_8026BC90(item_gobj2, &sp1C); + sp34.x = sp1C.x + it_804DC73C; + // sp34.x = sp1C.x + 0.0f; + sp34.y = sp1C.y + temp_f31; + sp34.z = sp1C.z + it_804DC73C; + // sp34.z = sp1C.z + 0.0f; + coll1->prev_topn = sp34; + mpColl_80043670(coll1); + coll1->cur_topn = sp44; + if (mpColl_800471F8(coll1)) { + it_802762B0(item1); + item1->pos = coll1->cur_topn; + return; + } + it_802762BC(item1); + item1->pos = sp44; + } + } +} -/// #it_80275534 +void it_80275BC8(Item_GObj* item_gobj, HSD_GObj* arg_gobj) +{ + ECB sp24; + Item* item; + Vec3 sp14; + u8* it_comm_data_xE8; + PAD_STACK(4); + + item = GET_ITEM((HSD_GObj*) item_gobj); + sp24 = item->xBFC; + it_802762BC(item); + item->x378_itemColl.cur_topn = item->pos; + if (arg_gobj != NULL) { + switch (it_80272D40((Item_GObj*) arg_gobj)) { /* irregular */ + case 0: + it_8026BB68((Item_GObj*) arg_gobj, &sp14); + break; + case 1: + it_8026BB88((Item_GObj*) arg_gobj, &sp14); + break; + default: + OSReport(it_803F1F38); + __assert(it_803F1F58, 0x7FU, &it_804D5198); + break; + } + } else { + sp14 = item->pos; + } + + // it_comm_data_xE8 = &it_804D6D28->filler_1a[4]; + it_comm_data_xE8 = &it_804D6D28->xE8; + sp24.top *= *(f32*) it_comm_data_xE8; + sp24.bottom *= *(f32*) it_comm_data_xE8; + sp24.right *= *(f32*) it_comm_data_xE8; + sp24.left *= *(f32*) it_comm_data_xE8; + // temp_struct = it_804D6D28->xE8; + // scl = ((Vec2*) temp_struct)->x; + // sp24.top *= scl; + // sp24.bottom *= scl; + // sp24.right *= scl; + // sp24.left *= scl; + + item->xC0C = item->xC1C; + + if (item->xDCE_flag.b7 == 1) { + it_80275D5C(item_gobj, &sp24); + } + it_80276100(item_gobj, &sp14); +} -/// #it_80275594 +void it_80275D5C(Item_GObj* item_gobj, ECB* arg_ecb) +{ + f32 scale; + s32 int_dir; + Item* item; + PAD_STACK(8); + + item = GET_ITEM((HSD_GObj*) item_gobj); + scale = item->scl; + item->xC1C = *arg_ecb; + mpColl_8004220C(&item->x378_itemColl, (HSD_GObj*) item_gobj, + item->xC1C.top * scale, item->xC1C.bottom * scale, + item->xC1C.right * scale, item->xC1C.left * scale); + if (-1.0f == item->facing_dir) { + int_dir = -1; + } else { + int_dir = 1; + } + mpColl_800436D8(&item->x378_itemColl, int_dir); +} -/// #it_802755C0 +void it_80275DFC(Item_GObj* item_gobj) +{ + Item* item; + f32 scale; + s32 int_dir; + PAD_STACK(14); + + // item = GET_ITEM((HSD_GObj*) item_gobj); + item = item_gobj->user_data; + scale = item->scl; + item->xC1C = item->xC0C; + mpColl_8004220C(&item->x378_itemColl, (HSD_GObj*) item_gobj, + item->xC1C.top * scale, item->xC1C.bottom * scale, + item->xC1C.right * scale, item->xC1C.left * scale); + if (-1.0f == item->facing_dir) { + int_dir = -1; + } else { + int_dir = 1; + } + mpColl_800436D8(&item->x378_itemColl, int_dir); +} -/// #it_80275640 +void it_80275E98(Item_GObj* item_gobj, SpawnItem* spawn) +{ + CollData* coll; + Item* item2; + Item* item1; + ItemAttr* attr; + ItemKind kind; + f32 scale; + s32 int_dir; + PAD_STACK(18); + + item1 = item_gobj->user_data; + attr = item1->xCC_item_attr; + coll = &item1->x378_itemColl; + item1->x378_itemColl.cur_topn = item1->pos; + mpColl_80041EE4(coll); + kind = item1->kind; + if (kind < It_Kind_L_Gun_Ray) { + coll->x34_flags.b1234 = 2; + } else if (kind < It_Kind_Kuriboh) { + coll->x34_flags.b1234 = 4; + } else if (kind < It_Kind_Octarock_Stone) { + coll->x34_flags.b1234 = 3; + } else if (kind < It_Kind_Mario_Fire) { + coll->x34_flags.b1234 = 4; + } else if (kind < It_Kind_Unk4) { + coll->x34_flags.b1234 = 5; + } else if (kind < Pokemon_Random) { + coll->x34_flags.b1234 = 5; + } else if (kind < Pokemon_Tosakinto) { + coll->x34_flags.b1234 = 5; + } else if (kind < Pokemon_Chicorita_Leaf) { + coll->x34_flags.b1234 = 5; + } else if (kind < It_Kind_Old_Kuri) { + coll->x34_flags.b1234 = 4; + } else if (kind < It_Kind_Arwing_Laser) { + coll->x34_flags.b1234 = 3; + } else if (kind < 238) { + coll->x34_flags.b1234 = 4; + } + + item2 = item_gobj->user_data; + scale = item2->scl; + item2->xC1C = item1->xC1C; + mpColl_8004220C(&item2->x378_itemColl, (HSD_GObj*) item_gobj, + item2->xC1C.top * scale, item2->xC1C.bottom * scale, + item2->xC1C.right * scale, item2->xC1C.left * scale); + if (-1.0f == item2->facing_dir) { + int_dir = -1; + } else { + int_dir = 1; + } + mpColl_800436D8(&item2->x378_itemColl, int_dir); + coll->x50 = attr->x1C_damage_mul; + if (spawn->x44_flag.b0 == 1) { + if (spawn->x48_ground_or_air == GA_Air) { + it_80276100(item_gobj, &spawn->pos); + return; + } + it_80276174(item_gobj, &spawn->pos); + return; + } + coll->prev_topn = spawn->pos; + mpColl_80043670(coll); +} -void it_802756D0(HSD_GObj* gobj) +void it_80276100(Item_GObj* item_gobj, Vec3* pos) { - M2C_FIELD(gobj->user_data, s32*, 0xD0C) = 2; + CollData* coll; + Item* item; + PAD_STACK(4); + + item = item_gobj->user_data; + coll = &item->x378_itemColl; + coll->prev_topn = *pos; + mpColl_80043670(coll); + mpColl_800471F8(coll); + item->pos = coll->cur_topn; } -/// #it_802756E0 +void it_80276174(Item_GObj* item_gobj, Vec3* pos) +{ + f32 unused1; + f32 unused2; + Vec3 temp_pos; + Item* item; + + item = GET_ITEM((HSD_GObj*) item_gobj); + item->x378_itemColl.prev_topn = *pos; + mpColl_80043670(&item->x378_itemColl); + if (mpLib_80051EC8(&temp_pos, NULL, NULL, NULL, 1, -1, -1, item->pos.x, + item->pos.y, item->pos.x, + item->pos.y - it_804D6D28->xF4)) + { + item->pos = temp_pos; + } +} -/// #it_8027570C +// bool it_80276214(Item_GObj* item_gobj) {} +void it_80276214(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->x378_itemColl.prev_topn = item->x378_itemColl.cur_topn; + item->x378_itemColl.cur_topn = item->pos; + if (item->xDCE_flag.b7 == 1) { + it_80276278(item_gobj); + } +} -/// #it_8027572C +void it_80276278(Item_GObj* item_gobj) +{ + Item* item; + CollData* coll_data; -/// #it_8027574C + item = GET_ITEM((HSD_GObj*) item_gobj); + coll_data = &item->x378_itemColl; -/// #it_80275788 + mpColl_800436E4(coll_data, it_80274990(item_gobj)); +} -/// #it_80275820 +void it_802762B0(Item* item) +{ + item->ground_or_air = GA_Ground; +} -/// #it_80275870 +void it_802762BC(Item* item) +{ + item->ground_or_air = GA_Air; + item->xDC8_word.flags.x1F = 0; +} -/// #it_802758D4 +bool it_802762D8(Item_GObj* item_gobj) +{ + CollData* coll; + bool chk; + + chk = false; + coll = &((Item*) item_gobj->user_data)->x378_itemColl; + if (coll->env_flags & MPCOLL_FLAGS_B20) { + chk = true; + } + if (coll->env_flags & MPCOLL_FLAGS_B21) { + return true; + } + return chk; +} -/// #it_802759DC +s32 it_80276308(Item_GObj* item_gobj) +{ + Item* item; + CollData* coll; + s32 ret_val; + + item = item_gobj->user_data; + ret_val = 0; + coll = &item->x378_itemColl; + if (item->x378_itemColl.env_flags & MPCOLL_RIGHTWALL) { + ret_val = 8; + item->xC30 = coll->right_wall.index; + } + if (coll->env_flags & MPCOLL_LEFTWALL) { + item->xC30 = coll->left_wall.index; + ret_val = 4; + } + return ret_val; +} -/// #it_80275BC8 +s32 it_80276348(Item_GObj* item_gobj, Vec3* vec) +{ + s32 ret_val; + Item* item; + CollData* coll; + + item = item_gobj->user_data; + ret_val = 0; + coll = &item->x378_itemColl; + if (coll->env_flags & MPCOLL_RIGHTWALL) { + ret_val = 8; + item->xC30 = coll->right_wall.index; + *vec = coll->right_wall.normal; + } + if (coll->env_flags & MPCOLL_LEFTWALL) { + item->xC30 = coll->left_wall.index; + *vec = coll->left_wall.normal; + ret_val = 4; + } + return ret_val; +} -/// #it_80275D5C +bool it_802763B8(Item_GObj* item_gobj) +{ + Item* item; + CollData* coll; + bool chk = false; + + item = item_gobj->user_data; + coll = &item->x378_itemColl; + if (coll->env_flags & MPCOLL_UNK) { + item->xC30 = coll->floor.index; + chk = true; + } + return chk; +} -/// #it_80275DFC +s32 it_802763E0(Item_GObj* item_gobj) +{ + Item* item; + CollData* colldata; + + item = item_gobj->user_data; + colldata = &item->x378_itemColl; + if (!(item->x378_itemColl.env_flags & MPCOLL_CEIL)) { + // return; + return 0; + } + item->xC30 = colldata->ceiling.index; + return 2; +} -/// #it_80275E98 +void it_80276408(Item_GObj* item_gobj, CollData* coll, Vec3* vec) +{ + if (coll->env_flags & MPCOLL_RIGHTWALL) { + *vec = coll->right_wall.normal; + } + if (coll->env_flags & MPCOLL_LEFTWALL) { + *vec = coll->left_wall.normal; + } + if (coll->env_flags & MPCOLL_CEIL) { + *vec = coll->ceiling.normal; + } + if (coll->env_flags & MPCOLL_UNK) { + *vec = coll->floor.normal; + } +} -/// #it_80276100 +f32 it_8027649C(Item_GObj* item_gobj) +{ + Vec3 sp20; + Vec3 sp14; + f32 angle; + s32 int_dir; + Item* item; + CollData* coll; + PAD_STACK(4); + + item = GET_ITEM((HSD_GObj*) item_gobj); + coll = &item->x378_itemColl; + sp14.z = 0.0f; + sp14.x = 0.0f; + sp14.y = 1.0f; + if (coll->env_flags & MPCOLL_RIGHTWALL) { + sp20 = coll->right_wall.normal; + } + if (coll->env_flags & MPCOLL_LEFTWALL) { + sp20 = coll->left_wall.normal; + } + if (coll->env_flags & MPCOLL_CEIL) { + sp20 = coll->ceiling.normal; + } + if (coll->env_flags & MPCOLL_UNK) { + sp20 = coll->floor.normal; + } + angle = lbVector_Angle(&sp20, &sp14); + if (sp20.x < 0.0f) { + int_dir = -1; + } else { + int_dir = 1; + } + return item->facing_dir * (angle * int_dir); +} -/// #it_80276174 +void it_802765BC(Item_GObj* item_gobj, enum_t arg1) +{ + Vec3 sp74; + Vec3* sp68 = NULL; + Vec3 sp5C; + Vec3* sp50 = NULL; + Vec3 sp44; + Vec3* sp38 = NULL; + HSD_JObj* jobj; + Item* item1; + Item* item2; + Item* item3; + Item* item4; + f32 angle1; + f32 angle2; + f32 angle3; + f32 rotate_angle1; + f32 rotate_angle2; + f32 rotate_angle3; + s32 dir1; + s32 dir2; + s32 dir3; + u32 bit_chk; + PAD_STACK(80); + + item1 = item_gobj->user_data; + jobj = it_80272CC0(item_gobj, arg1); + bit_chk = (item1->xDC8_word.word >> 7U) & 3; + if (bit_chk == 0) { + item2 = item_gobj->user_data; + sp74.z = 0.0f; + sp74.x = 0.0f; + sp74.y = 1.0f; + it_80276408(item_gobj, &item2->x378_itemColl, sp68); + angle1 = lbVector_Angle(sp68, &sp74); + if (sp68->x < 0.0f) { + dir1 = -1; + } else { + dir1 = 1; + } + rotate_angle1 = + -item1->facing_dir * (item2->facing_dir * (angle1 * dir1)); + HSD_JObjSetRotationZ(jobj, rotate_angle1); + } else if (bit_chk == 1) { + item3 = item_gobj->user_data; + sp5C.z = 0.0f; + sp5C.x = 0.0f; + sp5C.y = 1.0f; + it_80276408(item_gobj, &item3->x378_itemColl, sp50); + angle2 = lbVector_Angle(sp50, &sp5C); + if (sp50->x < 0.0f) { + dir2 = -1; + } else { + dir2 = 1; + } + rotate_angle2 = item3->facing_dir * (angle2 * dir2); + HSD_JObjSetRotationX(jobj, rotate_angle2); + } else { + item4 = item_gobj->user_data; + sp44.z = 0.0f; + sp44.x = 0.0f; + sp44.y = 1.0f; + it_80276408(item_gobj, &item4->x378_itemColl, sp38); + angle3 = lbVector_Angle(sp38, &sp44); + if (sp38->x < 0.0f) { + dir3 = -1; + } else { + dir3 = 1; + } + rotate_angle3 = item4->facing_dir * (angle3 * dir3); + HSD_JObjSetRotationY(jobj, rotate_angle3); + } +} -/// #it_80276214 +void it_80276934(Item_GObj* item_gobj, enum_t arg1) +{ + Vec3 sp80; + Vec3 sp74; + Vec3 sp64; + Vec3 sp58; + Vec3 sp48; + Vec3 sp3C; + HSD_JObj* jobj; + Item* item1; + Item* item2; + Item* item3; + Item* item4; + f32 angle1; + f32 angle2; + f32 angle3; + f32 rotate_angle1; + f32 rotate_angle2; + f32 rotate_angle3; + s32 dir1; + s32 dir2; + s32 dir3; + u32 bit_chk; + PAD_STACK(48); + + item1 = item_gobj->user_data; + jobj = it_80272CC0(item_gobj, arg1); + bit_chk = (item1->xDC8_word.word >> 7U) & 3; + if (bit_chk == 0) { + item2 = item_gobj->user_data; + sp80.z = 0.0f; + sp80.x = 0.0f; + sp80.y = 1.0f; + mpLib_80054DFC(item2->xC30, &sp74); + angle1 = lbVector_Angle(&sp74, &sp80); + if (sp74.x < 0.0f) { + dir1 = -1; + } else { + dir1 = 1; + } + rotate_angle1 = + -item1->facing_dir * (item2->facing_dir * (angle1 * dir1)); + HSD_JObjSetRotationZ(jobj, rotate_angle1); + } else if (bit_chk == 1) { + item3 = item_gobj->user_data; + sp64.z = 0.0f; + sp64.x = 0.0f; + sp64.y = 1.0f; + mpLib_80054DFC(item3->xC30, &sp58); + angle2 = lbVector_Angle(&sp58, &sp64); + if (sp58.x < 0.0f) { + dir2 = -1; + } else { + dir2 = 1; + } + rotate_angle2 = item3->facing_dir * (angle2 * dir2); + HSD_JObjSetRotationX(jobj, rotate_angle2); + } else { + item4 = item_gobj->user_data; + sp48.z = 0.0f; + sp48.x = 0.0f; + sp48.y = 1.0f; + mpLib_80054DFC(item4->xC30, &sp3C); + angle3 = lbVector_Angle(&sp3C, &sp48); + if (sp3C.x < 0.0f) { + dir3 = -1; + } else { + dir3 = 1; + } + rotate_angle3 = item4->facing_dir * (angle3 * dir3); + HSD_JObjSetRotationY(jobj, rotate_angle3); + } +} -/// #it_80276278 +void it_80276CB8(Item_GObj* item_gobj) +{ + if (((Item*) item_gobj->user_data)->x378_itemColl.env_flags & MPCOLL_UNK) { + it_802765BC(item_gobj, 0); + } +} -void it_802762B0(Item* arg0) +void it_80276CEC(Item_GObj* item_gobj) { - arg0->ground_or_air = GA_Ground; + CollData* coll; + Item* item; + u32 coll_index; + + item = item_gobj->user_data; + coll = &item->x378_itemColl; + if (coll->env_flags & MPCOLL_RIGHTWALL) { + item->xAC_unk = coll->right_wall.normal; + coll_index = coll->right_wall.index; + } + if (coll->env_flags & MPCOLL_LEFTWALL) { + item->xAC_unk = coll->left_wall.normal; + coll_index = coll->left_wall.index; + } + if (coll->env_flags & MPCOLL_CEIL) { + item->xAC_unk = coll->ceiling.normal; + coll_index = coll->ceiling.index; + } + if (coll->env_flags & MPCOLL_UNK) { + item->xAC_unk = coll->floor.normal; + coll_index = coll->floor.index; + } + item->xC2C = coll_index; } -/// #it_802762BC +bool it_80276D9C(Item_GObj* item_gobj, enum_t arg1) +{ + ECB sp34; + CollData* coll; + Item* item; + f32 pos_x1; + f32 pos_x2; + f32 pos_x3; + f32 pos_x4; + s32 dir1; + s32 dir2; + bool ret_val; + PAD_STACK(34); + + ret_val = true; + item = item_gobj->user_data; + coll = &item->x378_itemColl; + if ((coll->env_flags & MPCOLL_RIGHTWALL) && + (coll->env_flags & MPCOLL_LEFTWALL)) + { + // if (coll->env_flags & MPCOLL_WALL) { + dir1 = 1; + } else { + dir1 = 0; + } + if (dir1 != 0) { + sp34 = item->xC1C; + if (coll->x36 == 1) { + pos_x1 = coll->xA4_ecbCurrCorrect.right.x - 1.0f; + if (pos_x1 < 0.0f) { + pos_x1 = -pos_x1; + } + sp34.right = pos_x1; + pos_x2 = 1.0f + coll->xA4_ecbCurrCorrect.left.x; + if (pos_x2 < 0.0f) { + pos_x2 = -pos_x2; + } + sp34.left = pos_x2; + } else { + pos_x3 = 1.0f + coll->xA4_ecbCurrCorrect.left.x; + if (pos_x3 < 0.0f) { + pos_x3 = -pos_x3; + } + sp34.right = pos_x3; + pos_x4 = coll->xA4_ecbCurrCorrect.right.x - 1.0f; + if (pos_x4 < 0.0f) { + pos_x4 = -pos_x4; + } + sp34.left = pos_x4; + } + item->xC1C = sp34; + mpColl_8004220C( + &item->x378_itemColl, (HSD_GObj*) item_gobj, + item->xC1C.top * it_804DC744, item->xC1C.bottom * it_804DC744, + item->xC1C.right * it_804DC744, item->xC1C.left * it_804DC744); + // mpColl_8004220C(&item->x378_itemColl, (HSD_GObj*) item_gobj, + // item->xC1C.top * 1.0f, item->xC1C.bottom * 1.0f, item->xC1C.right + // * 1.0f, item->xC1C.left * 1.0f); + if (-1.0f == item->facing_dir) { + dir2 = -1; + } else { + dir2 = 1; + } + mpColl_800436D8(&item->x378_itemColl, dir2); + return false; + } + if ((arg1 & 4) && (coll->prev_env_flags & MPCOLL_LEFTWALL)) { + ret_val = false; + item->pos.x += 1.5f; + } + if ((arg1 & 8) && (coll->prev_env_flags & MPCOLL_RIGHTWALL)) { + ret_val = false; + item->pos.x -= 1.5f; + } + if ((arg1 & 2) && (coll->prev_env_flags & MPCOLL_CEIL)) { + ret_val = false; + item->pos.y -= 1.5f; + } + if ((arg1 & 1) && (coll->prev_env_flags & MPCOLL_UNK)) { + ret_val = false; + item->pos.y += 1.5f; + } + return ret_val; +} -/// #it_802762D8 +void it_80276FC4(Item_GObj* item_gobj, s32 arg1) +{ + ItemAttr* attr; + + attr = GET_ITEM((HSD_GObj*) item_gobj)->xCC_item_attr; + it_8027781C(item_gobj); + if (it_80276D9C(item_gobj, arg1)) { + it_8027321C(item_gobj); + it_80277C40(item_gobj, arg1); + it_80275640(item_gobj, attr->x58); + } +} -/// #it_80276308 +bool it_80277040(Item_GObj* item_gobj) +{ + Vec3 sp5C; + Vec3 sp50; + Vec3 sp44; + Vec3 sp38; + Vec3 sp20; + Vec3 sp14; + CollData* coll; + Item* item2; + Item* item1; + f32 temp_f30; + f32 temp_f31; + f32 temp_f3; + f32 var_f1; + f32 angle1; + f32 angle2; + bool chk; + s32 int_dir1; + s32 int_dir3; + bool ret_val; + s32 int_dir2; + s32 int_dir4; + PAD_STACK(20); + + ret_val = true; + item1 = GET_ITEM((HSD_GObj*) item_gobj); + coll = &item1->x378_itemColl; + var_f1 = item1->xCC_item_attr->x50; + if (var_f1 < 0.0f) { + var_f1 = -var_f1; + } + if (var_f1 < 0.00001f) { + item1->x88.y = 0.0f; + item1->x88.x = 0.0f; + return false; + } + sp20.z = 0.0f; + sp20.x = 0.0f; + sp20.y = 1.0f; + if (coll->env_flags & MPCOLL_RIGHTWALL) { + sp5C = coll->right_wall.normal; + } + if (coll->env_flags & MPCOLL_LEFTWALL) { + sp5C = coll->left_wall.normal; + } + if (coll->env_flags & MPCOLL_CEIL) { + sp5C = coll->ceiling.normal; + } + if (coll->env_flags & MPCOLL_UNK) { + sp5C = coll->floor.normal; + } + item1->x94 = item1->x88; + // item1->x98 = item1->x8C; + // item1->x9C = item1->x90; + angle1 = lbVector_AngleXY(&sp5C, &sp20); + if (angle1 < 0.0f) { + angle1 = -angle1; + } + if (angle1 >= it_804D6D28->xC0) { + sp50.z = 0.0f; + sp50.x = 0.0f; + sp50.y = -1.0f; + lbVector_CrossprodNormalized(&sp5C, &sp50, &sp44); + lbVector_CrossprodNormalized(&sp44, &sp5C, &sp38); + temp_f3 = item1->xCC_item_attr->x50; + temp_f31 = item1->x94.x / temp_f3; + temp_f30 = item1->x94.y / temp_f3; + item1->x88.x = sp38.x * temp_f3; + item1->x88.y = sp38.y * temp_f3; + item2 = item_gobj->user_data; + it_80276408(item_gobj, &item2->x378_itemColl, &sp14); + angle2 = lbVector_Angle(&sp14, &item2->xAC_unk); + if (angle2 < 0.0f) { + angle2 = -angle2; + } + if ((angle2 >= it_804D6D28->xC4) && (item2->xC30 == item2->xC2C)) { + chk = true; + } else { + chk = false; + } + if (!chk) { + if ((item1->x94.x != 0.0f) || (item1->x94.y != 0.0f)) { + if (sp38.x < 0.0f) { + int_dir1 = -1; + } else { + int_dir1 = 1; + } + if (temp_f31 < 0.0f) { + int_dir2 = -1; + } else { + int_dir2 = 1; + } + if (int_dir2 == int_dir1) { + if (sp38.y < 0.0f) { + int_dir3 = -1; + } else { + int_dir3 = 1; + } + if (temp_f30 < 0.0f) { + int_dir4 = -1; + } else { + int_dir4 = 1; + } + if (int_dir4 != int_dir3) { + goto block_38; + } + } else { + block_38: + item1->xD58++; + if (item1->xD58 >= it_804D6D28->x38_float) { + item1->xD58 = 0; + ret_val = false; + item1->x88.y = 0.0f; + item1->x88.x = 0.0f; + } + } + } + } else { + item1->xD5C = 2; + } + } else { + ret_val = false; + item1->x88.y = 0.0f; + item1->x88.x = 0.0f; + } + return ret_val; +} -/// #it_80276348 +void it_8027737C(Item_GObj* item_gobj, Vec3* pos) +{ + Vec3 sp1C; + Item* item; + f32 temp_f1; + + item = GET_ITEM((HSD_GObj*) item_gobj); + if (item->xDC8_word.flags.x1F) { + if (item->xD5C == 0U) { + } else { + PSVECAdd(&item->x88, &item->x7C, &item->x7C); + item->x7C.x *= item->xCC_item_attr->x54; + item->x7C.y *= item->xCC_item_attr->x54; + if (sqrtf_accurate(SQ(item->x7C.x) + SQ(item->x7C.y)) > + it_804D6D28->xC8) + { + lbVector_NormalizeXY(&item->x7C); + temp_f1 = it_804D6D28->xC8; + item->x7C.x *= temp_f1; + item->x7C.y *= temp_f1; + } + if (SQ(item->x7C.x) + SQ(item->x7C.y) < it_804D6D28->xCC) { + item->xDC8_word.flags.x1F = 0; + item->x7C.y = 0.0f; + item->x7C.x = 0.0f; + return; + } + } + + it_802775F0(item_gobj, &item->x7C); + it_80274A64(item_gobj); + PSVECAdd(&item->x7C, pos, &sp1C); + *pos = sp1C; + } +} -/// #it_802763B8 +bool it_80277544(Item_GObj* item_gobj) +{ + Vec3 sp10; + Item* item; + bool ret_val; + + ret_val = false; + item = GET_ITEM((HSD_GObj*) item_gobj); + if (item->xD5C != 0U && it_80277040(item_gobj) != 0 && + ((PSVECAdd(&item->x40_vel, &item->x70_nudge, &sp10), + ((SQ(sp10.x) + SQ(sp10.y))) >= it_804D6D28->xCC) || + (item->xD5C == 2U))) + { + item->xDC8_word.flags.x1F = 1; + ret_val = true; + item->xD5C = 1; + } + return ret_val; +} -/// #it_802763E0 +void it_802775F0(Item_GObj* item_gobj, Vec3* arg1) +{ + Item* item; + f32 temp_sqrt; + s32 dir1; + s32 dir2; + + item = GET_ITEM((HSD_GObj*) item_gobj); + if (item->spin_spd != 0.0f) { + temp_sqrt = sqrtf_accurate(SQ(arg1->x) + SQ(arg1->y)); + item->xD3C_spinSpeed = 0.85f * (temp_sqrt / item->xC1C.bottom); + if (item->facing_dir < 0.0f) { + dir1 = -1; + } else { + dir1 = 1; + } + if (arg1->x < 0.0f) { + dir2 = -1; + } else { + dir2 = 1; + } + if (dir2 != dir1) { + item->xD3C_spinSpeed = -item->xD3C_spinSpeed; + } + if (item->xDC8_word.flags.x19 != 1) { + item->xD3C_spinSpeed *= -item->facing_dir; + } + } +} -/// #it_80276408 +bool it_8027770C(Item_GObj* item_gobj) +{ + Vec3 sp38; + f32 mult; + bool ret_val; + enum_t var_r5; + ItemAttr* attr; + Item* item; + CollData* coll; + PAD_STACK(44); + + var_r5 = 0; + item = item_gobj->user_data; + ret_val = false; + coll = &item->x378_itemColl; + attr = item->xCC_item_attr; + if (coll->env_flags & MPCOLL_RIGHTWALL) { + var_r5 = 8; + item->xC30 = coll->right_wall.index; + sp38 = coll->right_wall.normal; + } + if (coll->env_flags & MPCOLL_LEFTWALL) { + var_r5 = 4; + item->xC30 = coll->left_wall.index; + sp38 = coll->left_wall.normal; + } + if (var_r5 != 0) { + if (((item->x40_vel.z * sp38.z) + + ((item->x40_vel.x * sp38.x) + (item->x40_vel.y * sp38.y))) < 0.0f) + { + lbVector_Mirror(&item->x40_vel, &sp38); + } + mult = attr->x58; + ret_val = true; + item->x40_vel.x *= mult; + item->x40_vel.y *= mult; + item->x40_vel.z *= mult; + } + return ret_val; +} -/// #it_8027649C +static inline float product_xy(Vec3* a, Vec3* b) +{ + return (a->x * b->x + a->y * b->y); +} -/// #it_802765BC +static inline float return_sqrt_value(Vec3* v) +{ + return sqrtf_accurate(product_xy(v, v)); +} -/// #it_80276934 +bool it_8027781C(Item_GObj* item_gobj) +{ + Item* item; + CollData* coll; + ItemAttr* attr; + // PAD_STACK(8); + s32 stack[2]; + + f32 speed; + bool chk; + Vec3 sp48; + Vec3 sp3C; + Vec3 sp30; + + item = GET_ITEM((HSD_GObj*) item_gobj); + attr = item->xCC_item_attr; + coll = &item->x378_itemColl; + sp3C = it_803B8570; + // sp3C.x = sp3C.y = sp3C.z = 0.0f; + chk = false; + sp30 = it_803B857C; + + speed = return_sqrt_value(&item->x40_vel); + if ((coll->env_flags & MPCOLL_RIGHTWALL) && + product_xy(&item->x40_vel, &coll->right_wall.normal) < 0.0f) + { + sp48 = item->x40_vel; + lbVector_Mirror(&sp48, &coll->right_wall.normal); + lbVector_Add_xy(&sp30, &sp48); + if (mpColl_8004CAE8(coll, &sp48)) { + lbVector_Add_xy(&sp3C, &sp48); + } + chk = true; + } + if ((coll->env_flags & MPCOLL_LEFTWALL) && + product_xy(&item->x40_vel, &coll->left_wall.normal) < 0.0f) + { + sp48 = item->x40_vel; + lbVector_Mirror(&sp48, &coll->left_wall.normal); + lbVector_Add_xy(&sp30, &sp48); + if (mpColl_8004CB30(coll, &sp48)) { + lbVector_Add_xy(&sp3C, &sp48); + } + chk = true; + } + if ((coll->env_flags & MPCOLL_CEIL) && + product_xy(&item->x40_vel, &coll->ceiling.normal) < 0.0f) + { + sp48 = item->x40_vel; + lbVector_Mirror(&sp48, &coll->ceiling.normal); + lbVector_Add_xy(&sp30, &sp48); + if (mpColl_8004CAA0(coll, &sp48)) { + lbVector_Add_xy(&sp3C, &sp48); + } + chk = true; + } + if ((coll->env_flags & MPCOLL_UNK) && + product_xy(&item->x40_vel, &coll->floor.normal) < 0.0f) + { + sp48 = item->x40_vel; + lbVector_Mirror(&sp48, &coll->floor.normal); + lbVector_Add_xy(&sp30, &sp48); + if (mpColl_8004CB78(coll, &sp48)) { + lbVector_Add_xy(&sp3C, &sp48); + } + chk = true; + } + if (chk) { + if (return_sqrt_value(&sp30) < it_804DC76C) { + sp30.x = item->x40_vel.x; + sp30.y = -1.0f * item->x40_vel.y; + } + lbVector_NormalizeXY(&sp30); + speed *= attr->x58; + sp30.x *= speed; + sp30.y *= speed; + item->x64_vec_unk2 = sp3C; + item->x40_vel = sp30; + + return true; + } + return false; +} -/// #it_80276CB8 +void it_80277C40(Item_GObj* item_gobj, s32 arg1) +{ + Vec3 sp20; + Vec3 sp14; + CollData* coll; + Item* item; + + item = GET_ITEM((HSD_GObj*) item_gobj); + coll = &item->x378_itemColl; + sp14.z = 0.0f; + sp14.y = 0.0f; + sp14.x = 0.0f; + sp20.z = 0.0f; + sp20.y = 0.0f; + sp20.x = 0.0f; + if (arg1 & 8) { + sp20.x = coll->xA4_ecbCurrCorrect.right.x; + sp20.y = coll->xA4_ecbCurrCorrect.right.y; + } + if (arg1 & 4) { + sp20.x = coll->xA4_ecbCurrCorrect.left.x; + sp20.y = coll->xA4_ecbCurrCorrect.left.y; + } + if (arg1 & 2) { + sp20.x = coll->xA4_ecbCurrCorrect.top.x; + sp20.y = coll->xA4_ecbCurrCorrect.top.y; + } + if (arg1 & 1) { + sp20.x = coll->xA4_ecbCurrCorrect.bottom.x; + sp20.y = coll->xA4_ecbCurrCorrect.bottom.y; + } + if (!item->xDCF_flag.b0) { + it_80278800(item_gobj, 0x405, 0, &sp20, &sp14, 0U, 0.0f); + } +} -/// #it_80276CEC +void it_80277D08(void) +{ +#if 1 + HSD_MObjInfo* mobj = (HSD_MObjInfo*) &it_803F1F90; + hsdInitClassInfo(&it_803F1F90, &hsdMObj.parent, + (char*) ((s32) &it_803F1F90 + 0xDC), &it_804D51B0, 0x50, + 0x20); + mobj->parent.release = hsdMObj.parent.release; + mobj->parent.amnesia = hsdMObj.parent.amnesia; + mobj->setup = fn_80277D8C; + mobj->load = hsdMObj.load; + mobj->make_texp = hsdMObj.make_texp; +#else + hsdInitClassInfo(&it_803F1F90, &hsdMObj.parent, + (char*) ((s32) &it_803F1F90 + 0xDC), &it_804D51B0, 0x50, + 0x20); + it_803F1F90.release = hsdMObj.parent.release; + it_803F1F90.amnesia = hsdMObj.parent.amnesia; + // it_803F1F90.unk3C = fn_80277D8C; + it_803F1F90.destroy = (void (*)(struct _HSD_Class* c)) fn_80277D8C; + // it_803F1F90.alloc = (s32 (*)(HSD_MObj*, HSD_MObjDesc*)) hsdMObj.load; + // it_803F1F90.init = (HSD_TExp* (*)(HSD_MObj*, HSD_TObj*, HSD_TExp**)) + // hsdMObj.make_texp; +#endif +} -/// #it_80276D9C +void fn_80277D8C(HSD_MObj* mobj, u32 rendermode_arg) +{ + HSD_TObj* tobj2; + HSD_TExp sp38; + HSD_PEDesc pe_desc; + HSD_TObj** tobj1_ptr; + HSD_PEDesc* setup_render_arg; + Item* item; + u32 rendermode; + + item = GET_ITEM(HSD_GObj_804D7814); + HSD_StateInitTev(); + rendermode = mobj->rendermode; + HSD_SetMaterialColor(mobj->mat->ambient, mobj->mat->diffuse, + mobj->mat->specular, mobj->mat->alpha); + if (rendermode & 8) { + HSD_SetMaterialShininess(mobj->mat->shininess); + } + tobj1_ptr = NULL; + tobj2 = mobj->tobj; + if ((rendermode & 0x04000000) && tobj_shadows) { + tobj1_ptr = &tobj2; + while (*tobj1_ptr != NULL) { + tobj1_ptr = &(*tobj1_ptr)->next; + } + *tobj1_ptr = tobj_shadows; + } + if ((rendermode & 0x1000) && ((HSD_TObj*) tobj_toon != NULL) && + ((HSD_ImageDesc*) tobj_toon->imagedesc != NULL)) + { + tobj_toon->next = tobj2; + tobj2 = tobj_toon; + } + HSD_TObjSetup(tobj2); + HSD_TObjSetupTextureCoordGen(tobj2); + ((HSD_MObjInfo*) mobj->parent.class_info) + ->setup_tev(mobj, tobj2, rendermode); + it_80278108(item, mobj, it_80277F90(item, mobj, &sp38)); + if (item->x5C9 != 0xFF) { + rendermode |= 0x60000000; + } + if (item->xDCF_flag.b4 && !item->xDCF_flag.b5) { + rendermode |= 0x20000000; + } + if (item->xDCF_flag.b5 && (item->x5C9 == 0xFF)) { + pe_desc.flags = 0x38; + pe_desc.dst_alpha = 0; + pe_desc.type = 0; + pe_desc.src_factor = 4; + setup_render_arg = &pe_desc; + pe_desc.dst_factor = 5; + pe_desc.logic_op = 0xF; + pe_desc.z_comp = 3; + pe_desc.alpha_comp0 = 7; + pe_desc.ref0 = 0; + pe_desc.alpha_op = 0; + pe_desc.alpha_comp1 = 7; + pe_desc.ref1 = 0; + } else { + setup_render_arg = mobj->pe; + ; + } + HSD_SetupRenderModeWithCustomPE(rendermode, setup_render_arg); + if (tobj1_ptr != NULL) { + *tobj1_ptr = NULL; + } +} -/// #it_80276FC4 +HSD_TExp* it_80277F90(Item* item, HSD_MObj* mobj, HSD_TExp* arg2) +{ + s32 sp80; + s32 sp3C; + s32 sp38; + s32 sp34; + s32 sp30; + u32 sp28; + s32 sp1C; + HSD_TevDesc sp14; + Vec3 spC; + Vec3* var_r5; + // s32 temp_r3_2; + // s32 temp_r3_3; + s32 temp_ret; + s32 var_ctr; + bool chk; + // u8 temp_r3; + Vec3* var_r4; + + if (!item->xDCF_flag.b4) { + // temp_r3 = ; + if (item->x548_colorOverlay.x7C_flag2 && + item->x548_colorOverlay.x7C_light_enable) + { +#if 1 + arg2->cnst.type = (HSD_TExpType) ((s32) &it_803F1F90 + 0xC4); + arg2->cnst.next = (HSD_TExp*) ((s32) &it_803F1F90 + 0xC8); + arg2->cnst.val = (void*) ((s32) &it_803F1F90 + 0xCC); + arg2->cnst.comp = (HSD_TEInput) ((s32) &it_803F1F90 + 0xD0); + arg2->cnst.ctype = (HSD_TEType) ((s32) &it_803F1F90 + 0xD4); + arg2->cnst.reg = (u8) ((s32) &it_803F1F90 + 0xD8); +#else + // arg2->tev.type = (HSD_TExpType) ((s32) &it_803F1F90 + 0xC4); + // arg2->tev.next = (HSD_TExp*) ((s32) &it_803F1F90 + 0xC8); + // arg2->tev.c_ref = (s32) ((s32) &it_803F1F90 + 0xCC); + // arg2->tev.c_dst = (u8) ((s32) &it_803F1F90 + 0xD0); + // arg2->tev.c_scale = (u8) ((s32) &it_803F1F90 + 0xD4); + // arg2->tev.a_ref = (s32) ((s32) &it_803F1F90 + 0xD8); +#endif + temp_ret = lbGetFreeColorRegister(0, mobj, NULL); + // temp_r3_2 = temp_ret; + if (temp_ret == -1) { + // OSReport(&it_803F1F90 + 0xF4, (u32) (u64) temp_ret, (f32) + // temp_ret); + // __assert(&it_803F1F90 + 0x118, 0xDDU, &it_804D51B8); + HSD_ObjAllocGetFreed((HSD_ObjAllocData*) arg2); + } + arg2->cnst.reg = (s8) temp_ret; + arg2->cnst.val = &item->x548_colorOverlay.x50_light_color; + HSD_TExpSetReg(arg2); + var_ctr = 14; + var_r5 = &spC; + var_r4 = (Vec3*) ((s32) &it_803F1F90 + 0x48); + while (var_ctr != 0) { + // var_r4->x += 8; + // var_r5->x += 8; + var_r5 = var_r4; + // var_r5->z = var_r4->z; + // var_r5->y = var_r4->y; + var_ctr--; + } + var_r5->z = var_r4->z; + sp14.stage = HSD_StateAssignTev(); // type GXTevStageID? + sp14.color = 2; // (GXTevKColorSel) GX_TEV_KCSEL_3_4 ? + sp14.u.tevconf.clr_a = GX_CC_ZERO; + sp14.u.tevconf.clr_b = lb_8000CC8C(temp_ret); + sp14.u.tevconf.clr_c = GX_CC_RASA; + chk = false; + sp14.u.tevconf.clr_d = GX_CC_CPREV; + if (temp_ret < 4) { + chk = true; + } + if (chk) { + sp80 = lb_8000CCA4(temp_ret); + } + HSD_SetupTevStage((HSD_TevDesc*) &sp14); + return arg2; + } + } + return NULL; +} -/// #it_80277040 +void it_80278108(Item* item, HSD_MObj* mobj, HSD_TExp* arg2) +{ + GXColor sp168; /* compiler-managed */ + s32 sp110; /* compiler-managed */ + s32 sp10C; + s32 sp108; + GXColor* sp104; /* compiler-managed */ + HSD_TExp* sp100; /* compiler-managed */ + HSD_TExp* spFC = NULL; + // s32 spA4; /* compiler-managed */ + // s32 spA0; + // s32 sp9C; + // s32* sp98; + // HSD_TExp* sp94; + HSD_TExp* sp90 = NULL; + s32 sp8C; + s32 sp88; + s32 sp68; + s32 sp40; + s32 sp3C; + s32 sp24; + HSD_TevDesc sp1C; + // u8 sp1A; + // u8 sp19; + GXColor sp18; + Vec3 sp14; + Vec3* var_r5; + // Fighter_GObj* temp_r3_2; + ColorOverlay* var_r4; + // ftDeviceUnk2* var_r4; + s32 temp_r3_4; + s32 temp_r3_5; + s32 temp_r3_6; + s32 temp_r3_7; + s32 temp_r4; + s32 temp_r7; + s32 temp_r8_2; + s32 temp_ret; + s32 temp_ret_2; + s32 var_ctr; + s32 var_r0; + s32 var_r0_2; + s32 var_r0_3; + s32 var_r0_4; + bool chk1; + s32 var_r3; + u32 temp_r3_3; + // u8 temp_r3; + u8 temp_r5_2; + u8 temp_r8; + u8 temp_r8_3; + // void* temp_r5; + GXColor* color_hex; + Vec3* var_r4_2; + + // temp_r3 = item->unkDCF; + if (!item->xDCF_flag.b5) { + var_r4 = &item->x548_colorOverlay; + chk1 = false; + if (item->xDCF_flag.b3) { + // temp_r3_2 = item->owner; + if ((item->owner != NULL) && item->xDC8_word.flags.x13) { + var_r4 = + (ColorOverlay*) ftCo_800C0674((Fighter_GObj*) item->owner); + } + } + if (item->xDCF_flag.b4) { + chk1 = true; + sp168.r = item->xBC8; + } else if (item->x5C8) { + if (var_r4->x7C_color_enable) { + temp_r3_3 = ((0xFF - item->xBC7) * + (0xFF - (s32) ((s32) &it_803F1F90 + 0x2F))) / + 255; + // temp_r5 = item->xBC4; + color_hex = &var_r4->x2C_hex; + if ((s32) temp_r3_3 == 0xFF) { + sp168 = var_r4->x2C_hex; + } else { + // temp_r8 = temp_r5->unk0; + temp_r8 = item->xBC4; + temp_r3_4 = 0xFF - temp_r3_3; + temp_r8_2 = + temp_r8 + + ((color_hex->a * (color_hex->r - temp_r8)) / 255); + temp_r7 = temp_r8_2 * 0xFF; + temp_r4 = temp_r7 / temp_r3_4; + sp168.r = (u8) temp_r4; + if ((u32) temp_r4 != 0U) { + sp168.r = (s8) (temp_r7 / temp_r4); + } else { + sp168.r = ((temp_r3_4 - temp_r8_2) * 0xFF) / 255; + } + // temp_r8_3 = temp_r5->unk1; + temp_r8_3 = item->xBC5; + sp168.g = (s8) ((s32) ((temp_r8_3 + + ((color_hex->a * + (color_hex->g - temp_r8_3)) / + 255)) * + 0xFF) / + temp_r3_4); + // temp_r5_2 = temp_r5->unk2; + temp_r5_2 = item->xBC6; + sp168.b = (s8) ((s32) ((temp_r5_2 + + ((color_hex->a * + (color_hex->b - temp_r5_2)) / + 255)) * + 0xFF) / + temp_r3_4); + } + chk1 = true; + } else { + chk1 = true; + sp168.r = item->xBC4; + } + } else if (var_r4->x7C_flag2) { + chk1 = true; + sp168 = var_r4->x2C_hex; + } + if (chk1) { + spFC->cnst.type = (HSD_TExpType) ((s32) &it_803F1F90 + 0xC4); + spFC->cnst.next = (HSD_TExp*) ((s32) &it_803F1F90 + 0xC8); + spFC->cnst.val = (void*) ((s32) &it_803F1F90 + 0xCC); + spFC->cnst.comp = (HSD_TEInput) ((s32) &it_803F1F90 + 0xD0); + spFC->cnst.ctype = (HSD_TEType) ((s32) &it_803F1F90 + 0xD4); + spFC->cnst.reg = (u8) ((s32) &it_803F1F90 + 0xD4); + spFC->tev.a_dst = (u8) ((s32) &it_803F1F90 + 0xD8); + temp_ret = lbGetFreeColorRegister(0, mobj, arg2); + temp_r3_5 = temp_ret; + if (temp_r3_5 == -1) { + OSReport((char*) (&it_803F1F90 + 0xF4), (u32) (u64) temp_ret, + (f32) temp_ret); + __assert((char*) (&it_803F1F90 + 0x118), 0x144U, + (char*) &it_804D51B8); + } + sp110 = (s8) temp_r3_5; + sp104 = &sp168; + HSD_TExpSetReg((HSD_TExp*) &spFC); + sp100 = arg2; + if (temp_r3_5 < 4) { + var_r0 = 1; + } else { + var_r0 = 0; + } + if (var_r0 != 0) { + var_r3 = 4; + } else { + var_r3 = 0; + } + temp_ret_2 = + lbGetFreeColorRegister(var_r3, mobj, (HSD_TExp*) &spFC); + temp_r3_6 = temp_ret_2; + if (temp_r3_6 == -1) { + OSReport((char*) (&it_803F1F90 + 0x128), + (u32) (u64) temp_ret_2, (f32) temp_ret_2); + __assert((char*) (&it_803F1F90 + 0x118), 0x152U, + (char*) &it_804D51B8); + } + if ((u8) item->x5C9 != 0xFF) { + sp90->cnst.type = (HSD_TExpType) ((s32) &it_803F1F90 + 0xC4); + sp90->cnst.next = (HSD_TExp*) ((s32) &it_803F1F90 + 0xC8); + sp90->cnst.val = (void*) ((s32) &it_803F1F90 + 0xCC); + sp90->cnst.comp = (HSD_TEInput) ((s32) &it_803F1F90 + 0xD0); + sp90->cnst.ctype = (HSD_TEType) ((s32) &it_803F1F90 + 0xD4); + sp90->cnst.reg = (u8) ((s32) &it_803F1F90 + 0xD4); + sp90->tev.a_dst = (u8) ((s32) &it_803F1F90 + 0xD8); + sp90->tev.a_dst = (s8) temp_r3_6; + sp90->cnst.comp = 5; + sp90->cnst.idx = 3; + sp90->tev.c_ref = item->x5C9; + sp100 = sp90; + } else { + sp100 = NULL; + } + sp110 = (s8) temp_r3_6; + sp18.r = sp168.a; + sp18.g = sp168.a; + sp18.b = sp168.a; + sp104 = &sp18; + HSD_TExpSetReg((HSD_TExp*) &spFC); + var_ctr = 0xE; + var_r5 = &sp14; + var_r4_2 = (Vec3*) ((s32) &it_803F1F90 + 0x48); + do { + // temp_r3_7 = var_r4_2->z; + // var_r4_2->x += 8; + // var_r5->x += 8; + var_r5 = var_r4_2; + // var_r5->z = temp_r3_7; + // var_r5->y = (s32) var_r4_2->y; + var_ctr -= 1; + } while (var_ctr != 0); + // var_r5->z = (s32) var_r4_2->z; + sp1C.stage = HSD_StateAssignTev(); + sp1C.color = lb_8000CC8C(temp_r3_5); + sp1C.u.tevconf.clr_op = lb_8000CC8C(temp_r3_6); + if (temp_r3_5 < 4) { + var_r0_2 = 1; + } else { + var_r0_2 = 0; + } + if (var_r0_2 != 0) { + sp88 = lb_8000CCA4(temp_r3_5); + } else { + if (temp_r3_6 < 4) { + var_r0_3 = 1; + } else { + var_r0_3 = 0; + } + if (var_r0_3 != 0) { + sp88 = lb_8000CCA4(temp_r3_6); + } + } + if ((u8) item->x5C9 != 0xFF) { + sp68 = lb_8000CD90(temp_r3_6); + if (temp_r3_6 < 4) { + var_r0_4 = 1; + } else { + var_r0_4 = 0; + } + if (var_r0_4 != 0) { + sp8C = lb_8000CDA8(temp_r3_6); + } + } + HSD_SetupTevStage((HSD_TevDesc*) &sp1C); + } + } +} -/// #it_8027737C +void it_80278574(HSD_GObj* gobj, GXColor* arg1) +{ + HSD_DObj* var_r3; + HSD_JObj* var_r0; + HSD_JObj* var_r0_2; + HSD_JObj* var_r0_3; + HSD_JObj* var_r0_4; + HSD_JObj* var_r0_5; + HSD_JObj* var_r0_6; + HSD_JObj* var_r0_7; + HSD_JObj* var_r0_8; + HSD_JObj* var_r31; + HSD_JObj* var_r3_2; + HSD_JObj* var_r3_3; + HSD_MObj* temp_r4; + HSD_Material* temp_r4_2; + PAD_STACK(4); + + // var_r31 = GET_JOBJ(gobj->hsd_obj); + var_r31 = gobj->hsd_obj; + while (var_r31 != NULL) { + var_r3 = HSD_JObjGetDObj(var_r31); + while (var_r3 != NULL) { + temp_r4 = var_r3->mobj; + if (temp_r4 != NULL) { + temp_r4_2 = temp_r4->mat; + if (temp_r4_2 != NULL) { + temp_r4_2->diffuse = *arg1; + } + } + if (var_r3 != NULL) { + var_r3 = var_r3->next; + } else { + var_r3 = NULL; + } + } + if (var_r31 == NULL) { + var_r0 = NULL; + } else { + var_r0 = var_r31->child; + } + if (var_r0 != NULL) { + if (var_r31 == NULL) { + var_r0_2 = NULL; + } else { + var_r0_2 = var_r31->child; + } + var_r31 = var_r0_2; + } else { + if (var_r31 == NULL) { + var_r0_3 = NULL; + } else { + var_r0_3 = var_r31->next; + } + if (var_r0_3 != NULL) { + if (var_r31 == NULL) { + var_r0_4 = NULL; + } else { + var_r0_4 = var_r31->next; + } + var_r31 = var_r0_4; + } else { + loop_25: + if (var_r31 == NULL) { + var_r0_5 = NULL; + } else { + var_r0_5 = var_r31->parent; + } + if (var_r0_5 == NULL) { + var_r31 = NULL; + } else { + if (var_r31 == NULL) { + var_r3_2 = NULL; + } else { + var_r3_2 = var_r31->parent; + } + if (var_r3_2 == NULL) { + var_r0_6 = NULL; + } else { + var_r0_6 = var_r3_2->next; + } + if (var_r0_6 != NULL) { + if (var_r31 == NULL) { + var_r3_3 = NULL; + } else { + var_r3_3 = var_r31->parent; + } + if (var_r3_3 == NULL) { + var_r0_7 = NULL; + } else { + var_r0_7 = var_r3_3->next; + } + var_r31 = var_r0_7; + } else { + if (var_r31 == NULL) { + var_r0_8 = NULL; + } else { + var_r0_8 = var_r31->parent; + } + var_r31 = var_r0_8; + goto loop_25; + } + } + } + } + } +} -/// #it_80277544 +#if 0 +void it_8027870C(s32 arg0) { + if (lbLang_IsSettingUS() != 0) { + lbArchive_80017040(0, &it_803F1EE4, &it_804D6D20, &it_803F1EF0, 0); + } else { + lbArchive_80017040(0, &it_803F1ED8, &it_804D6D20, &it_803F1EF0, 0); + } + it_804D6D28 = it_804D6D20->unk0; + it_804D6D24 = it_804D6D20->unk4; + it_804D6D38 = it_804D6D20->unk8; + it_804D6D30 = it_804D6D20->unkC; + it_804D6D40 = it_804D6D20->unk10; + it_804D6D04 = it_804D6D20->unk14; +} +#endif -/// #it_802775F0 +void it_802787B4(Item_GObj* item_gobj, s32 arg1) +{ + Vec3 sp1C; + Vec3 sp10; + + sp1C.x = sp1C.y = sp1C.z = it_804DC770; + sp10.x = sp10.y = sp10.z = it_804DC770; + // void it_80278800(Item_GObj* item_gobj, s32 ef_id, s32 arg2, Vec3* arg3, + // Vec3* arg4, s32 arg5, f32 arg6) + it_80278800(NULL, arg1, 0, &sp1C, &sp10, 1, it_804DC770); +} -/// #it_8027770C +void it_80278800(Item_GObj* item_gobj, s32 ef_id, s32 arg2, Vec3* arg3, + Vec3* arg4, s32 arg5, f32 arg6) +{ + f32 sp88; + f32 sp84; + f32 sp80; + Vec3 sp74; + Vec3 sp68; + f32 sp64; + f32 sp60; + f32 sp5C; + HSD_JObj* jobj; + Item* item; + f32 temp_f1; + f64 var_f0; + PAD_STACK(52); + + item = item_gobj->user_data; + + // Not sure what to make of mixing this case statement with the if's below. + // Commenting out those cases did not affect the % match *shrug* + switch (ef_id) { + case 0x402: + // case 0x403: + // case 0x409: + // case 0x412: + // case 0x413: + // case 0x414: + // case 0x41B: + // case 0x422: + // case 0x433: + case 0x449: + case 0x473: + // block_50: + if (arg5 == 1) { + jobj = it_80272CC0(item_gobj, arg2); + efSync_Spawn(ef_id, item_gobj, jobj); + return; + } + jobj = it_80272CC0(item_gobj, arg2); + efAsync_Spawn((HSD_GObj*) item_gobj, + &((Item*) item_gobj->user_data)->xBC0, 0U, ef_id, jobj); + return; + case 0x446: + case 0x448: + if (arg5 == 1) { + jobj = it_80272CC0(item_gobj, arg2); + efSync_Spawn(ef_id, item_gobj, jobj, arg3); + return; + } + jobj = it_80272CC0(item_gobj, arg2); + efAsync_Spawn((HSD_GObj*) item_gobj, + &((Item*) item_gobj->user_data)->xBC0, 7U, ef_id, jobj, + arg3); + return; + // case 0x417: + // case 0x418: + // case 0x419: + case 0x41A: + jobj = it_80272CC0(item_gobj, arg2); + efSync_Spawn(ef_id, item_gobj, jobj, 0xF25959); + return; + case 0x415: + // case 0x41E: + // case 0x428: + // case 0x429: + case 0x42A: + // case 0x438: + case 0x439: + case 0x43E: + case 0x44D: + // case 0x45B: + case 0x45C: + // case 0x45F: + // case 0x460: + case 0x461: + // case 0x462: + // case 0x463: + // case 0x464: + // case 0x465: + // case 0x466: + // case 0x467: + // case 0x468: + // case 0x469: + // case 0x46A: + // case 0x46B: + // case 0x46C: + // case 0x46D: + // case 0x46E: + // case 0x46F: + // case 0x470: + // case 0x471: + // case 0x472: + sp88 = 1.0f; + if (arg5 == 1) { + jobj = it_80272CC0(item_gobj, arg2); + efSync_Spawn(ef_id, item_gobj, jobj, &sp88); + return; + } + jobj = it_80272CC0(item_gobj, arg2); + efAsync_Spawn((HSD_GObj*) item_gobj, + &((Item*) item_gobj->user_data)->xBC0, 3U, ef_id, jobj, + &sp88); + return; + case 0x44E: + // case 0x44F: + // case 0x450: + // case 0x451: + // case 0x452: + // case 0x457: + // case 0x458: + // case 0x459: + case 0x45A: + sp84 = 1.0f; + jobj = it_80272CC0(item_gobj, arg2); + efSync_Spawn(ef_id, item_gobj, jobj, &item->facing_dir, &sp84); + return; + // case 0x423: + case 0x424: + sp80 = 0.0f; + jobj = it_80272CC0(item_gobj, arg2); + efAsync_Spawn((HSD_GObj*) item_gobj, + &((Item*) item_gobj->user_data)->xBC0, 3U, ef_id, jobj, + &sp80); + return; + } + // default: + sp74 = *arg3; + sp74.x += 2.0f * arg4->x * (HSD_Randf() - 1.0f); + sp74.y += 2.0f * arg4->y * (HSD_Randf() - 1.0f); + sp74.z += 2.0f * arg4->z * (HSD_Randf() - 1.0f); + lb_8000B1CC(it_80272CC0(item_gobj, arg2), &sp74, &sp68); + if (ef_id < 0x250) { + if (arg5 == 1) { + efSync_Spawn(ef_id, item_gobj, &sp68); + return; + } + jobj = it_80272CC0(item_gobj, arg2); + efAsync_Spawn((HSD_GObj*) item_gobj, + &((Item*) item_gobj->user_data)->xBC0, 2U, ef_id, jobj, + &sp74); + return; + } else if (ef_id == 0x41E) { + return; + } else if (ef_id < 0x41E) { + if (ef_id == 0x3FF) { + goto block_558; + } else if (ef_id < 0x3FF) { + if (ef_id == 0x3F5) { + goto block_4FC; + } else if (ef_id < 0x3F5) { + if (ef_id == 0x3EE) { + goto block_4A8; + } else if (ef_id < 0x3EE) { + if (ef_id >= 0x3ED) { + goto block_4FC; + } else if (ef_id >= 0x3E9) { + goto block_4A8; + } else { + return; + } + } + if (ef_id >= 0x3F3) { + goto block_4A8; + } else { + goto block_4FC; + } + } else { + if (ef_id == 0x3FD) { + goto block_558; + } else if (ef_id >= 0x3FD) { + goto block_4FC; + } + if (ef_id >= 0x3FA) { + goto block_4A8; + } else if (ef_id >= 0x3F7) { + goto block_558; + } else { + goto block_4A8; + } + } + } + if (ef_id == 0x408) { + goto block_61C; + } else if (ef_id < 0x408) { + if (ef_id == 0x405) { + goto block_4A8; + } else if (ef_id < 0x405) { + if (ef_id >= 0x404) { + goto block_61C; + } else if (ef_id < 0x402) { + return; + } else { + goto block_4FC; + } + } + if (ef_id >= 0x407) { + goto block_4A8; + } else { + goto block_61C; + } + } + if (ef_id == 0x416) { + goto block_4A8; + } else if (ef_id < 0x416) { + if (ef_id >= 0x412) { + return; + } + if (ef_id >= 0x40C) { + goto block_4A8; + } else { + return; + } + } else if (ef_id >= 0x41C) { + goto block_4A8; + } else { + // goto block_50; + return; + } + } else if (ef_id == 0x440) { + goto block_59C; + } else if (ef_id < 0x440) { + if (ef_id < 0x432) { + if (ef_id < 0x428) { + if (ef_id >= 0x425) { + goto block_4A8; + } else if (ef_id < 0x422) { + return; + } else { + goto block_4A8; + } + } + if (ef_id == 0x42D) { + goto block_4A8; + } else if (ef_id >= 0x42D) { + goto block_4FC; + } else { + return; + } + } + if (ef_id < 0x438) { + if (ef_id == 0x434) { + goto block_4A8; + } else if (ef_id >= 0x434) { + goto block_59C; + } else { + return; + } + } + if (ef_id >= 0x43D) { + return; + } else if (ef_id >= 0x43A) { + goto block_4FC; + } else { + return; + } + } else if (ef_id == 0x4D0) { + goto block_4A8; + } else if (ef_id < 0x4D0) { + if (ef_id < 0x446) { + if (ef_id == 0x443) { + goto block_4FC; + } else { + goto block_4A8; + } + } else if (ef_id >= 0x44D) { + return; + } else if (ef_id >= 0x44A) { + goto block_4A8; + } else { + // goto block_50; + return; + } + } else if (ef_id == 0x514) { + goto block_6B4; + } else if (ef_id < 0x514) { + if (ef_id >= 0x513) { + goto block_680; + + } else { + return; + } + } else if (ef_id >= 0x516) { + return; + } else { + goto block_6E8; + } + +block_4A8: + if (arg5 == 1) { + efSync_Spawn(ef_id, item_gobj, &sp68); + return; + } + jobj = it_80272CC0(item_gobj, arg2); + efAsync_Spawn((HSD_GObj*) item_gobj, &((Item*) item_gobj->user_data)->xBC0, + 2U, ef_id, jobj, &sp74); + return; +block_4FC: + if (arg5 == 1) { + efSync_Spawn(ef_id, item_gobj, &sp68, &item->facing_dir); + return; + } + jobj = it_80272CC0(item_gobj, arg2); + efAsync_Spawn((HSD_GObj*) item_gobj, &((Item*) item_gobj->user_data)->xBC0, + 5U, ef_id, jobj, &sp74, &item->facing_dir); + return; +block_558: + sp64 = 0.0f; + jobj = it_80272CC0(item_gobj, arg2); + efAsync_Spawn((HSD_GObj*) item_gobj, &((Item*) item_gobj->user_data)->xBC0, + 6U, ef_id, jobj, &sp74, &item->facing_dir, &sp64); + return; +block_59C: + temp_f1 = item->facing_dir; + if (item->facing_dir < 0.0f) { + var_f0 = M_PI; + } else { + var_f0 = 0.0f; + } + sp60 = var_f0; + if (arg5 == 1) { + efSync_Spawn(ef_id, item_gobj, &sp68, &sp60); + return; + } + jobj = it_80272CC0(item_gobj, arg2); + efAsync_Spawn((HSD_GObj*) item_gobj, &((Item*) item_gobj->user_data)->xBC0, + 5U, ef_id, jobj, &sp74, &sp60); + return; +block_61C: + sp5C = 0.0f; + if (arg5 == 1) { + efSync_Spawn(ef_id, item_gobj, &sp68, &sp5C); + return; + } + jobj = it_80272CC0(item_gobj, arg2); + efAsync_Spawn((HSD_GObj*) item_gobj, &((Item*) item_gobj->user_data)->xBC0, + 5U, ef_id, jobj, &sp74, &sp5C); + return; +block_680: + jobj = it_80272CC0(item_gobj, arg2); + efAsync_Spawn((HSD_GObj*) item_gobj, &((Item*) item_gobj->user_data)->xBC0, + 8U, 2U, jobj, &sp74); + return; +block_6B4: + jobj = it_80272CC0(item_gobj, arg2); + efAsync_Spawn((HSD_GObj*) item_gobj, &((Item*) item_gobj->user_data)->xBC0, + 8U, 3U, jobj, &sp74); + return; +block_6E8: + jobj = it_80272CC0(item_gobj, arg2); + efAsync_Spawn((HSD_GObj*) item_gobj, &((Item*) item_gobj->user_data)->xBC0, + 8U, 4U, jobj, &sp74); + return; +} -/// #it_8027781C +void it_80278F2C(Item_GObj* item_gobj, FtCmdState* cmd) +{ + Vec3 sp20; + Vec3 sp14; + u16 temp_r9; + s32 temp_r5; + PAD_STACK(28); + + cmd->x8 += 4; + temp_r5 = cmd->x8_bits->x0 & 0x3FF; + temp_r9 = cmd->x8_bits->x0; + // cmd->x8 = (char*) (&cmd->x8 + 4); + cmd->x8 += 4; + sp20.x = 0.003906f * (f32) cmd->x8_bits->x0; + // sp20.x = 0.003906f * (((f32) cmd->x8_bits->x0 - it_804DC798) - + // it_804DC7A0); + sp20.y = 0.003906f * (f32) cmd->x8_bits->x2; + cmd->x8 += 4; + // cmd->x8 = (char*) (&cmd->x8 + 4); + sp20.z = 0.003906f * (f32) cmd->x8_bits->x0; + sp14.x = 0.003906f * (f32) cmd->x8_bits->x2; + cmd->x8 += 4; + // cmd->x8 = (char*) (&cmd->x8 + 4); + sp14.y = 0.003906f * (f32) cmd->x8_bits->x0; + sp14.z = 0.003906f * (f32) cmd->x8_bits->x2; + // cmd->x8 = (char*) (&cmd->x8 + 4); + cmd->x8 += 4; + + // void it_80278800(Item_GObj* item_gobj, s32 ef_id, s32 arg2, Vec3* arg3, + // Vec3* arg4, s32 arg5, f32 arg6) + // it_80278800((Item_GObj*) temp_r9, temp_r6->x0 & 0x3FF, &sp20, &sp14, 0, + // temp_r9, temp_r10_2, (f32) (s32) (f32) temp_r10->x2, 0.003906f); + it_80278800(item_gobj, temp_r9, temp_r5, &sp20, &sp14, 0, 0.003906f); +} -/// #it_80277C40 +void it_802790C0(Item_GObj* item_gobj, FtCmdState* cmd) +{ +#if 1 + HitCapsule* hitcapsule; + s32 temp_r31; + u32 temp_r28; + u32 temp_r5_2; + u32 var_r4; + Item* item; + PAD_STACK(12); + + item = GET_ITEM((HSD_GObj*) item_gobj); + var_r4 = ((u16) cmd->x8_bits->x0 >> 7U) & 7; + hitcapsule = &item->x5D4_hitboxes[var_r4].hit; + temp_r28 = var_r4; + temp_r5_2 = ((u8) cmd->x8_bits->x0 >> 4U) & 7; + if ((hitcapsule->state == HitCapsule_Disabled) || + (hitcapsule->x4 != temp_r5_2)) + { + hitcapsule->x4 = temp_r5_2; + hitcapsule->state = HitCapsule_Enabled; + item->xDC8_word.flags.x16 = 1; + item->xDAA_flag.b2 = 0; + it_8026FCF8(item, hitcapsule); + } + temp_r31 = ((u32) cmd->x8_bits->x0 >> 0xDU) & S8_MAX; + if (temp_r31 != 0U) { + if (!item->xBBC_dynamicBoneTable) { + OSReport((char*) &it_803F22E8); + __assert((char*) &it_803F2300, 0x8BU, (char*) &it_804D51C0); + } + hitcapsule->jobj = item->xBBC_dynamicBoneTable->bones[temp_r31]; + } else { + hitcapsule->jobj = item_gobj->hsd_obj; + } + it_80272460(hitcapsule, + item->xC3C * ((cmd->x8_bits->x2 & 0x1FFF) * item->xC40), + item_gobj); + cmd->x8 = cmd->x8 + 4; + hitcapsule->scale = 0.003906f * (f32) (u16) cmd->x8_bits->x0; + item->x3C = hitcapsule->scale; + // it_80275594(item_gobj, temp_r28, temp_r5, it_804DC7A8 / item->scl, + // 0.003906f); it_80275594(item_gobj, temp_r28, cmd->x8_bits, 1.0f / + // item->scl, 0.003906f); + it_80275594(item_gobj, temp_r28, 1.0f / item->scl); + hitcapsule->b_offset.x = 0.003906f * (f32) (s16) cmd->x8_bits->x2; + cmd->x8 = cmd->x8 + 4; + hitcapsule->b_offset.y = 0.003906f * (f32) (s16) cmd->x8_bits->x0; + hitcapsule->b_offset.z = 0.003906f * (f32) (s16) cmd->x8_bits->x2; + cmd->x8 = cmd->x8 + 4; + hitcapsule->kb_angle = ((u16) cmd->x8_bits->x0 >> 7U) & 0x1FF; + // hitcapsule->x24 = ((u32) cmd->x8_bits->x0 >> 14U) & 0x1FF; + hitcapsule->x24 = ((u32) cmd->x8_bits->x0 >> 14U) & 0x1FF; + hitcapsule->x28 = ((u16) cmd->x8_bits->x2 >> 5U) & 0x1FF; + hitcapsule->x43_b1 = 1; + cmd->x8 = cmd->x8 + 4; + hitcapsule->x2C = ((u16) cmd->x8_bits->x0 >> 7U) & 0x1FF; + hitcapsule->element = ((u8) cmd->x8_bits->x0 >> 2U) & 0x1F; + // hitcapsule->unk40 = (u8) ((hitcapsule->unk40 & ~0x80) | + // ((cmd->x8_bits->unk1 << 6) & 0x80)); + hitcapsule->x40_b0 = cmd->x8_bits->x0_b6; + hitcapsule->x40_b1 = 0; + hitcapsule->x34 = (s32) ((cmd->x8_bits->x0 << 0xF) & 0xFF800000) >> 0x18; + hitcapsule->sfx_severity = ((u16) cmd->x8_bits->x2 >> 6U) & 7; + // hitcapsule->sfx_kind = ((u8) cmd->x8[0]->unk3 >> 2U) & 0xF; + hitcapsule->sfx_kind = ((u8) cmd->x8_bits->x2 >> 2U) & 0xF; + // hitcapsule->sfx_kind = cmd->x8_bits->x3_b5; + // hitcapsule->x40_b2 = (u8) ((hitcapsule->x40_b2 & ~0x20) | + // ((cmd->x8_bits->unk3 << 5) & 0x20)); + hitcapsule->x40_b2 = cmd->x8_bits->x3_b7; + // hitcapsule->x40_b3 = (u8) ((hitcapsule->x40_b3 & ~0x10) | + // ((cmd->x8_bits->unk3 << 3) & 0x10)); + hitcapsule->x40_b3 = cmd->x8_bits->x3_b6; + cmd->x8 = cmd->x8 + 4; + hitcapsule->x40_b4 = ((u8) cmd->x8_bits->x0 << 4) & 0xFF0; + // hitcapsule->x41_b4 = cmd->x8_bits->x0_b7; + // hitcapsule->x41_b4 = (u8) ((hitcapsule->x41_b4 & ~8) | (((u8) + // cmd->x8_bits->unk1 >> 4U) & 8)); hitcapsule->x41_b4 = ((u8) + // cmd->x8_bits->x0 >> 4U) & 8; + hitcapsule->x41_b4 = cmd->x8_bits->x1_b0; + // hitcapsule->x41_b5 = (u8) ((hitcapsule->x41_b5 & ~4) | (((u8) + // cmd->x8[0]->unk1 >> 4U) & 4)); hitcapsule->x41_b5 = ((u8) + // cmd->x8_bits->x0 >> 4U) & 4; + hitcapsule->x41_b5 = cmd->x8_bits->x1_b1; + // hitcapsule->x41_b6 = (u8) ((hitcapsule->x41_b6 & ~2) | (((u8) + // cmd->x8[0]->unk1 >> 4U) & 2)); + hitcapsule->x41_b6 = cmd->x8_bits->x1_b2; + // hitcapsule->x41_b6 = cmd->x8_bits->x1_b6; + // hitcapsule->x41_b7 = (u8) ((hitcapsule->x41_b7 & ~1) | (((u8) + // cmd->x8[0]->unk1 >> 4U) & 1)); + hitcapsule->x41_b7 = cmd->x8_bits->x1_b3; + // hitcapsule->x41_b7 = cmd->x8_bits->x1_b7; + // hitcapsule->x42_b0 = (u8) ((hitcapsule->x42_b0 & ~0x80) | + // ((cmd->x8[0]->unk1 << 4) & 0x80)); + hitcapsule->x42_b0 = cmd->x8_bits->x1_b4; + // hitcapsule->x42_b0 = cmd->x8_bits->x1_b0; + // hitcapsule->x42_b1 = (u8) ((hitcapsule->x42_b1 & ~0x40) | + // ((cmd->x8[0]->unk1 << 4) & 0x40)); + hitcapsule->x42_b1 = cmd->x8_bits->x1_b5; + // hitcapsule->x42_b1 = cmd->x8_bits->x1_b1; + // hitcapsule->x42_b2 = (u8) ((hitcapsule->x42_b2 & ~0x20) | + // ((cmd->x8[0]->unk1 << 4) & 0x20)); + hitcapsule->x42_b2 = cmd->x8_bits->x1_b6; + // hitcapsule->x42_b2 = cmd->x8_bits->x1_b2; + // hitcapsule->x42_b3 = (u8) ((hitcapsule->x42_b3 & ~0x10) | + // ((cmd->x8[0]->unk1 << 4) & 0x10)); + hitcapsule->x42_b3 = cmd->x8_bits->x1_b7; + hitcapsule->x42_b4 = cmd->x8_bits->x2_b0; + hitcapsule->x42_b5 = cmd->x8_bits->x2_b1; + hitcapsule->x42_b6 = cmd->x8_bits->x2_b2; + hitcapsule->x42_b7 = cmd->x8_bits->x2_b3; + // hitcapsule->x43 = cmd->x8_bits->x2; + hitcapsule->x43_b0 = cmd->x8_bits->x2_b4; + // hitcapsule->hit_grabbed_victim_only = (u8) + // ((hitcapsule->hit_grabbed_victim_only & ~0x80) | (((u8) cmd->x8_bits->x0 + // << 5) & 0x80)); hitcapsule->hit_grabbed_victim_only = ((u8) + // cmd->x8_bits->x0 << 5) & 0x80; hitcapsule->hit_grabbed_victim_only = + // cmd->x8_bits->x2_b5; + // (&item->x5D4_hitboxes[var_r4])->x138 = cmd->x8_bits->x2_b5; + item->x5D4_hitboxes[var_r4].x138 = (u8) cmd->x8_bits->x2; + // cmd->unk8 = (void* ) (cmd->unk8 + 4); + // cmd->x8[0] = cmd->x8[1]; + cmd->x8 = cmd->x8 + 4; + hitcapsule->x43_b2 = 1; + if (HSD_GObj_804D7838 && ((u8) HSD_GObj_804D7838->s_link > 11U)) { + it_8027129C(item_gobj, temp_r28); + } +#endif +} -/// #it_80277D08 +void it_80279544(Item_GObj* item_gobj, FtCmdState* cmd) +{ + // struct it_278F_struct_1B* temp_r4; + Item* item; + // PAD_STACK(4); + + // temp_r4 = &((struct it_278F_struct_1A*) cmd)->x8[0]; + item = GET_ITEM((HSD_GObj*) item_gobj); + // item = item_gobj->user_data; + it_80272460( + &item->x5D4_hitboxes[(cmd->x8_bits->x0 >> 7U) & 7].hit, + (s32) (u32) (item->xC3C * + ((f32) ((u16) cmd->x8_bits->x2 & 0x1FFF) * item->xC40)), + item_gobj); + // cmd->unk8 = (void* ) (cmd->unk8 + 4); + // ((struct it_278F_struct_1A*) cmd)->x8[0] = ((struct it_278F_struct_1A*) + // cmd)->x8[1]; + cmd->x8 = cmd->x8 + 4; +} -/// #fn_80277D8C +void it_802795EC(Item_GObj* item_gobj, FtCmdState* cmd) +{ + s32 temp_r4_2; + HitCapsule* hitcapsule; + Item* item; + + temp_r4_2 = ((u16) cmd->x8_bits->x0 >> 7U) & 7; + item = GET_ITEM((HSD_GObj*) item_gobj); + hitcapsule = &item->x5D4_hitboxes[temp_r4_2].hit; + hitcapsule->scale = 0.003906f * (cmd->x8_bits->x0 & 0x7FFFFF); + item->x3C = hitcapsule->scale; + it_80275594(item_gobj, temp_r4_2, 1.0f / item->scl); + cmd->x8 = cmd->x8 + 4; +} -/// #it_80277F90 +void it_80279680(Item_GObj* item_gobj, FtCmdState* cmd) +{ + it_80272560(item_gobj, cmd->x8_bits->x0 & 0x03FFFFFF); + cmd->x8 = cmd->x8 + 4; +} -/// #it_80278108 +void it_802796C4(Item_GObj* item_gobj, FtCmdState* cmd) +{ + it_802725D4(item_gobj); + cmd->x8 = cmd->x8 + 4; +} -/// #it_80278574 +void it_802796FC(Item_GObj* item_gobj, FtCmdState* cmd) +{ + ((Item*) item_gobj->user_data)->xDAC_itcmd_var0 = + (s32) (cmd->x8_bits->x0 & 0x03FFFFFF); + cmd->x8 = cmd->x8 + 4; +} -/// #it_8027870C +void it_80279720(Item_GObj* item_gobj, FtCmdState* cmd) +{ + ((Item*) item_gobj->user_data)->xDB0_itcmd_var1 = + (s32) (cmd->x8_bits->x0 & 0x03FFFFFF); + cmd->x8 = cmd->x8 + 4; +} -/// #it_802787B4 +void it_80279744(Item_GObj* item_gobj, FtCmdState* cmd) +{ + ((Item*) item_gobj->user_data)->xDB4_itcmd_var2 = + (s32) (cmd->x8_bits->x0 & 0x03FFFFFF); + cmd->x8 = cmd->x8 + 4; +} -/// #it_80278800 +void it_80279768(Item_GObj* item_gobj, FtCmdState* cmd) +{ + Item* item; -/// #it_80278F2C + item = item_gobj->user_data; + item->xDBC_itcmd_var4 |= (item->xDBC_itcmd_var4 >> 24U & 0x80); + // item->xDBC_itcmd_var4 |= (item->xDBC_itcmd_var4 >> 25U & 0x80); + cmd->x8 = cmd->x8 + 4; +} -/// #it_802790C0 +void it_8027978C(Item_GObj* item_gobj, FtCmdState* cmd) +{ + Item* item; + s32 temp_r4_2; + u8 temp_r7; + u8 temp_r5_2; + u8 temp_r6_2; + + item = GET_ITEM((HSD_GObj*) item_gobj); + temp_r7 = ((u16) cmd->x8_bits->x0 >> 2U) & U8_MAX; + cmd->x8 = cmd->x8 + 4; +#if 1 + if (temp_r7 < 10U) { + if (temp_r7 < 3U) { + if (temp_r7 < 0U) { + } else { + temp_r4_2 = (s32) cmd->x8_bits->x0; + cmd->x8 = cmd->x8 + 4; + temp_r5_2 = cmd->x8_bits->x2; + // temp_r6_2 = (u8) ((u16) cmd->x8_bits->x2 >> 8U); + temp_r6_2 = cmd->x8_bits->x2; + switch (temp_r7) { + case 0: + Item_8026AE84(item, temp_r4_2, (s32) temp_r5_2, + (s32) temp_r6_2); + break; + case 1: + Item_8026AF0C(item, temp_r4_2, (s32) temp_r5_2, + (s32) temp_r6_2); + break; + case 2: + Item_8026AFA0(item, temp_r4_2, (s32) temp_r5_2, + (s32) temp_r6_2); + break; + } + } + } + } else if (temp_r7 >= 12U) { + } else { + cmd->x8 = cmd->x8 + 4; + switch (temp_r7) { + case 10: + Item_8026B034(item); + break; + case 11: + Item_8026B074(item); + break; + } + } +#else + temp_r4_2 = (s32) cmd->x8_bits->x0; + cmd->x8 = cmd->x8 + 4; + temp_r5_2 = cmd->x8_bits->x2; + // temp_r6_2 = (u8) ((u16) cmd->x8_bits->x2 >> 8U); + temp_r6_2 = cmd->x8_bits->x2; + switch (temp_r7) { + case 0: + Item_8026AE84(item, temp_r4_2, (s32) temp_r5_2, (s32) temp_r6_2); + break; + case 1: + Item_8026AF0C(item, temp_r4_2, (s32) temp_r5_2, (s32) temp_r6_2); + break; + case 2: + Item_8026AFA0(item, temp_r4_2, (s32) temp_r5_2, (s32) temp_r6_2); + break; + case 10: + Item_8026B034(item); + break; + case 11: + Item_8026B074(item); + break; + } +#endif + cmd->x8 = cmd->x8 + 4; +} -/// #it_80279544 +void it_80279888(Item_GObj* item_gobj, FtCmdState* cmd) +{ + PAD_STACK(4); + it_80273598(item_gobj, ((u32) cmd->x8_bits->x0 >> 13U) & 0x1FFF, + cmd->x8_bits->x2 & 0x1FFF); + cmd->x8 = cmd->x8 + 4; +} -/// #it_802795EC +void it_802798D4(Item_GObj* item_gobj, FtCmdState* cmd) +{ + PAD_STACK(4); + it_80273600(item_gobj); + cmd->x8 = cmd->x8 + 4; +} -/// #it_80279680 +void it_8027990C(Item_GObj* item_gobj, FtCmdState* cmd) +{ + PAD_STACK(4); + it_80273648(item_gobj, ((u32) cmd->x8_bits->x0 >> 13U) & 0x1FFF, + cmd->x8_bits->x2 & 0x1FFF); + cmd->x8 = cmd->x8 + 4; +} -/// #it_802796C4 +void it_80279958(Item_GObj* item_gobj, FtCmdState* cmd) +{ + PAD_STACK(4); + it_80279B88(item_gobj->user_data, + (s32) (s8) ((u16) cmd->x8_bits->x0 >> 2U) & 0xFF, + (s32) cmd->x8_bits->x0 & 0x3FFFF); + cmd->x8 = cmd->x8 + 4; +} -/// #it_802796FC +void it_802799A8(Item_GObj* item_gobj, FtCmdState* cmd) +{ + it_80279BBC(item_gobj->user_data); + cmd->x8 = cmd->x8 + 4; +} -/// #it_80279720 +void it_802799E4(Item_GObj* item_gobj) +{ +#if 1 + Item* item; + FtCmdState* temp_r29; + u32 temp_r28; + + item = item_gobj->user_data; + // temp_r29 = (FtCmdState*) item->x524_cmd; + temp_r29 = item->x524_cmd; + item->x528 = item->x5CC_currentAnimFrame; + item->xDBC_itcmd_var4 = 0; + if (item->x52C_item_script != NULL) { + if (F32_MAX != temp_r29->x0) { + temp_r29->x0 = temp_r29->x0 - item->x5D0_animFrameSpeed; + } + loop_4: + if (temp_r29->x8 != NULL) { + if (F32_MAX == temp_r29->x0) { + if (!(temp_r29->x4 >= item->x5D0_animFrameSpeed)) { + temp_r29->x0 = -temp_r29->x4; + goto block_9; + } + } else if (!(temp_r29->x0 > 0.0f)) { + block_9: + temp_r28 = ((u16) temp_r29->x8_bits->x0 >> 2U) & 0x3F; + if (Command_Execute((CommandInfo*) temp_r29, temp_r28) == 0) { + ((void (*)(Item_GObj*, ...)) * + (&it_803F22A8[temp_r28 - 10U]))(item_gobj, temp_r29); + } + goto loop_4; + } + } + } +#else + Item* item; + CommandInfo* temp_r29; + u32 temp_r28; + + item = item_gobj->user_data; + temp_r29 = (CommandInfo*) item->x524_cmd; + item->x528 = item->x5CC_currentAnimFrame; + item->xDBC_itcmd_var4 = 0; + if ((void*) item->x52C_item_script != NULL) { + if (F32_MAX != temp_r29->timer) { + temp_r29->timer = temp_r29->timer - item->x5D0_animFrameSpeed; + } + loop_4: + if ((u8*) temp_r29->u.data_position != NULL) { + if (F32_MAX == temp_r29->timer) { + if (!(temp_r29->frame_count >= item->x5D0_animFrameSpeed)) { + temp_r29->timer = -temp_r29->frame_count; + goto block_9; + } + } else if (!(temp_r29->timer > 0.0f)) { + block_9: + temp_r28 = ((u8) temp_r29->u.Command_09->param_2 >> 2U) & 0x3F; + if (Command_Execute((CommandInfo*) temp_r29, temp_r28) == 0) { + ((void (*)(...)) * + (&it_803F22A8[temp_r28 - 10U]))(item_gobj, temp_r29); + } + goto loop_4; + } + } + } +#endif +} -/// #it_80279744 +void it_80279AF0(Item_GObj* item_gobj, FtCmdState* cmd) +{ + it_80278F2C(item_gobj, (FtCmdState*) cmd); +} -/// #it_80279768 +void it_80279B10(Item_GObj* item_gobj, FtCmdState* cmd) +{ + it_8027978C(item_gobj, cmd); +} -/// #it_8027978C +void fn_80279B30(Item_GObj* item_gobj, FtCmdState* cmd) +{ + // void fn_80279B30(HSD_GObj* item_gobj, FtCmdState* cmd, u32 arg2) { + // *(&it_804D51C8 + ((M2C_ERROR(/* Read from unset register $r5 */) - 0x15) + // * 4))(&it_804D51C8); + ((void (*)(Item_GObj*, ...)) * (&it_804D51C8[-0x15]))(item_gobj, cmd); + // ((void (*)(...))*(&it_804D51C8[arg2 - 21U]))(item_gobj, cmd); +} -/// #it_80279888 +void it_80279B64(Item* item) +{ + lb_80014498(&item->x548_colorOverlay); +} -/// #it_802798D4 +void it_80279B88(Item* item, s32 arg1, s32 arg2) +{ + // void it_80279B88(Item* item, enum_t arg1, bool arg2) { + lb_800144C8(&item->x548_colorOverlay, &it_804D6D04, arg1, arg2); +} -/// #it_8027990C +void it_80279BBC(Item* item) +{ + lb_80014498(&item->x548_colorOverlay); +} -/// #it_80279958 +void it_80279BE0(Item_GObj* item_gobj) +{ + Item* item; -/// #it_802799A8 + item = item_gobj->user_data; + while (lb_80014258((HSD_GObj*) item_gobj, &item->x548_colorOverlay, + (void (*)(Fighter_GObj*, FtCmdState*)) fn_80279B30)) + { + lb_80014498(&item->x548_colorOverlay); + } +} -/// #it_802799E4 +void it_80279C48(Item_GObj* item_gobj, Article* arg1) +{ + Vec3 sp10; + HSD_GObj* gobj; + Item* item; + f32 dir; + + item = item_gobj->user_data; + gobj = ftLib_8008627C(&item->pos, item->owner); + if (gobj != NULL) { + ftLib_80086644(gobj, &sp10); + if ((item->pos.x - sp10.x) > 0.0f) { + item->facing_dir = -1.0f; + return; + } + item->facing_dir = 1.0f; + return; + } + if (HSD_Randi(2) != 0) { + dir = 1.0f; + } else { + dir = -1.0f; + } + item->facing_dir = dir; +} -/// #it_80279AF0 +void it_80279CDC(Item_GObj* item_gobj, f32 scale) +{ + it_8027A13C(item_gobj); + it_80279D5C(item_gobj, scale); + it_8026B3A8(item_gobj); + it_802756D0(item_gobj); + it_8026BDB4(item_gobj); +} -/// #it_80279B10 +void it_80279D38(Item_GObj* item_gobj) +{ + it_8027B964(item_gobj, false); +} -/// #fn_80279B30 +void it_80279D5C(Item_GObj* item_gobj, f32 scale) +{ + Vec3 sp18; + HSD_JObj* item_jobj; + u32 temp_r4; + Item* item; + + // item_jobj = GET_JOBJ((HSD_GObj*) item_gobj); + item_jobj = item_gobj->hsd_obj; + item = GET_ITEM((HSD_GObj*) item_gobj); + sp18.z = scale; + sp18.y = scale; + sp18.x = scale; + item->xDD4_itemVar.it_279D.x4C = scale; + item->xDD4_itemVar.it_279D.x5C = 0; + HSD_JObjSetScale(item_jobj, &sp18); +} -/// #it_80279B64 +void it_80279E24(Item_GObj* item_gobj) +{ + HSD_JObj* item_jobj; + f32 scale; + Item* item; + PAD_STACK(4); + + // item_jobj = GET_JOBJ((HSD_GObj*) item_gobj); + item_jobj = item_gobj->hsd_obj; + item = GET_ITEM((HSD_GObj*) item_gobj); + // item = item_gobj->user_data; + scale = HSD_JObjGetScaleX(item_jobj); + if (item->xDD4_itemVar.it_279D.x50 <= 0.0f) { + item->xDD4_itemVar.it_279D.x50 = item->xDD4_itemVar.it_279D.x44; + if (item->xDD4_itemVar.it_279D.x58 & 1) { + if (item->xDD4_itemVar.it_279D + .x2C[item->xDD4_itemVar.it_279D.x58] <= scale) + { + item_jobj = item_gobj->hsd_obj; + item = item_gobj->user_data; + scale = HSD_JObjGetScaleX(item_jobj); + it_80272F7C(item_jobj, + item->xDD4_itemVar.it_279D + .x2C[item->xDD4_itemVar.it_279D.x58]); + item->xDD4_itemVar.it_279D.x58++; + item->xDD4_itemVar.it_279D.x4C = + (item->xDD4_itemVar.it_279D + .x2C[item->xDD4_itemVar.it_279D.x58] - + scale) / + item->xDD4_itemVar.it_279D.x44; + } + } else { + if (item->xDD4_itemVar.it_279D + .x2C[item->xDD4_itemVar.it_279D.x58] >= scale) + { + item_jobj = item_gobj->hsd_obj; + item = item_gobj->user_data; + scale = HSD_JObjGetScaleX(item_jobj); + it_80272F7C(item_jobj, + item->xDD4_itemVar.it_279D + .x2C[item->xDD4_itemVar.it_279D.x58]); + item->xDD4_itemVar.it_279D.x58++; + item->xDD4_itemVar.it_279D.x4C = + (item->xDD4_itemVar.it_279D + .x2C[item->xDD4_itemVar.it_279D.x58] - + scale) / + item->xDD4_itemVar.it_279D.x44; + } + } + if ((s32) item->xDD4_itemVar.it_279D.x54 <= + (s32) item->xDD4_itemVar.it_279D.x58) + { + item->xDD4_itemVar.it_279D.x5C = 2; + return; + } + } + item->xDD4_itemVar.it_279D.x50 = + (f32) (item->xDD4_itemVar.it_279D.x50 - 1.0f); + it_80272DE4(item_jobj, item->xDD4_itemVar.it_279D.x4C); +} -/// #it_80279B88 +void it_80279FF8(Item_GObj* item_gobj) +{ + HSD_JObj* item_jobj; + Item* item; + PAD_STACK(8); + + item = GET_ITEM((HSD_GObj*) item_gobj); + if (item->xDD4_itemVar.it_279D.x5C == 0) { + item_jobj = GET_JOBJ((HSD_GObj*) item_gobj); + if (item->xCC_item_attr->x60_scale > + (item->xDD4_itemVar.it_279D.x48 + HSD_JObjGetScaleX(item_jobj))) + { + it_80272DE4(item_jobj, item->xCC_item_attr->x60_scale); + return; + } + it_80272F7C(item_jobj, item->xCC_item_attr->x60_scale); + item->xDD4_itemVar.it_279D.x5C = 1; + return; + } + if (item->xDD4_itemVar.it_279D.x5C != 2) { + it_80279E24(item_gobj); + } +} -/// #it_80279BBC +bool it_8027A09C(Item_GObj* item_gobj) +{ + Item* item; + PAD_STACK(8); + + item = item_gobj->user_data; + it_80272860(item_gobj, item->xDD4_itemVar.it_279D.x1C, + item->xDD4_itemVar.it_279D.x20); + if (item->xDD4_itemVar.it_279D.x24 <= 0.0f) { + it_80272F7C(item_gobj->hsd_obj, item->xCC_item_attr->x60_scale); + return true; + } + item->xDD4_itemVar.it_279D.x24 -= 1.0f; + return false; +} -/// #it_80279BE0 +bool it_8027A118(Item_GObj* item_gobj, HSD_GObjEvent arg1) +{ + it_8026E4D0(item_gobj, arg1); + return false; +} -/// #it_80279C48 +void it_8027A13C(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xDD4_itemVar.it_279D.x10.z = 0.0f; + item->xDD4_itemVar.it_279D.x10.y = 0.0f; + item->xDD4_itemVar.it_279D.x10.x = 0.0f; + item->xDD4_itemVar.it_279D.x4.z = 0.0f; + item->xDD4_itemVar.it_279D.x4.y = 0.0f; + item->xDD4_itemVar.it_279D.x4.x = 0.0f; +} -/// #it_80279CDC +void it_8027A160(HSD_JObj* bone, Item* item) +{ + Vec3 sp1C; + Vec3 sp10; + f32 var_f1; + f32 var_f1_2; + f32 var_f1_3; + + if (bone != NULL) { + sp1C.z = 0.0f; + sp1C.y = 0.0f; + sp1C.x = 0.0f; + HSD_JObjGetTranslation(bone, &sp10); + sp10.x *= item->xCC_item_attr->x60_scale; + sp10.y *= item->xCC_item_attr->x60_scale; + sp10.z *= item->xCC_item_attr->x60_scale; + var_f1 = sp10.x; + if (var_f1 < 0.0f) { + var_f1 = -var_f1; + } + if (var_f1 < 0.001f) { + sp10.x = 0.0f; + } + var_f1_2 = sp10.y; + if (var_f1_2 < 0.0f) { + var_f1_2 = -var_f1_2; + } + if (var_f1_2 < 0.001f) { + sp10.y = 0.0f; + } + var_f1_3 = sp10.z; + if (var_f1_3 < 0.0f) { + var_f1_3 = -var_f1_3; + } + if (var_f1_3 < 0.001f) { + sp10.z = 0.0f; + } + item->xDD4_itemVar.it_279D.x4.x = + sp10.x - item->xDD4_itemVar.it_279D.x10.x; + item->xDD4_itemVar.it_279D.x4.y = + sp10.y - item->xDD4_itemVar.it_279D.x10.y; + item->xDD4_itemVar.it_279D.x4.z = + sp10.z - item->xDD4_itemVar.it_279D.x10.z; + item->xDD4_itemVar.it_279D.x10 = sp10; + HSD_JObjSetTranslate(bone, &sp1C); + } +} -/// #it_80279D38 +void it_8027A344(Item_GObj* item_gobj) +{ + Item* item; -/// #it_80279D5C + item = item_gobj->user_data; + item->x40_vel.x = item->xDD4_itemVar.it_279D.x4.z * item->facing_dir; + item->x40_vel.y = item->xDD4_itemVar.it_279D.x4.y; +} -/// #it_80279E24 +s32 it_8027A364(Item* item) +{ +#if 0 + s32 var_ctr2; + s32 var_ctr1; + s32 index; + it_279D_DatAttrs* attr; + s32 ret_val; + + attr = item->xC4_article_data->x4_specialAttributes; + ret_val = 1U; + index = Pokemon_Tosakinto; + for (var_ctr1 = 3; var_ctr1 != 0; var_ctr1--) { + for (var_ctr2 = 0; var_ctr2 < 10; var_ctr2++) { + if ((Item_804A0E24.x != index) && (Item_804A0E24.y != index)) { + ret_val += attr->x3C[index - Pokemon_Tosakinto]; + } + index++; + } + } + return ret_val; +#else + s32 var_ctr2; + s32 var_ctr1; + s32 index; + it_279D_DatAttrs* attr; + s32 ret_val; + + attr = item->xC4_article_data->x4_specialAttributes; + var_ctr1 = 3; + ret_val = 1U; + index = Pokemon_Tosakinto; + while (var_ctr1 != 0) { + for (var_ctr2 = 0; var_ctr2 < 10; var_ctr2++) { + if ((Item_804A0E24.x != index) && (Item_804A0E24.y != index)) { + ret_val += attr->x3C[index - Pokemon_Tosakinto]; + } + index++; + } + var_ctr1--; + } + + return ret_val; +#endif +} -/// #it_80279FF8 +s32 it_8027A4D4(Item* item) +{ + s32 rand_int; + s32 var_ctr2; + s32 var_ctr1; + s32 var_r3; + it_279D_DatAttrs* attr; + s32 index2; + s32 index; + PAD_STACK(16); + + attr = item->xC4_article_data->x4_specialAttributes; + if ((HSD_Randi(251U) == 0) && (Item_804A0E24.z == 0) && gm_80165084()) { + Item_804A0E24.z = 1U; + gm_80172C04(); + return 23U; + } + if ((HSD_Randi(251U) == 0) && (Item_804A0E24.z == 0) && + gm_80164ABC((gmMainLib_8015ED8C_arg0_t*) &Item_804A0E24)) + { + Item_804A0E24.z = 1U; + gm_80172BC4(); + return 22U; + } + var_r3 = 1U; + index = Pokemon_Tosakinto; + attr = item->xC4_article_data->x4_specialAttributes; + for (var_ctr1 = 3; var_ctr1 != 0; var_ctr1--) { + for (var_ctr2 = 0; var_ctr2 < 10; var_ctr2++) { + if ((Item_804A0E24.x != index) && (Item_804A0E24.y != index)) { + var_r3 += attr->x3C[index - Pokemon_Tosakinto]; + } + index++; + } + } + rand_int = HSD_Randi(var_r3); + var_r3 = 0U; + index = Pokemon_Tosakinto; + for (var_ctr1 = 30U; var_ctr1 != 0; var_ctr1--) { + for (var_ctr2 = 0; var_ctr2 < 10; var_ctr2++) { + if ((Item_804A0E24.x != index) && (Item_804A0E24.y != index)) { + var_r3 += attr->x3C[index - Pokemon_Tosakinto]; + if (var_r3 >= rand_int) { + Item_804A0E24.y = Item_804A0E24.x; + Item_804A0E24.x = index; + return index - Pokemon_Tosakinto; + } + } + index++; + } + } + return 0; +} -/// #it_8027A09C +s32 it_8027A780(Item* item, void* arg1) +{ + S32Vec2 sp10; + S32Vec2* var_r4; + S32Vec2* var_r6; + s32 temp_r0; + s32 rand_int; + s32 chk; + s32 cnt; + s32 var_ctr2; + s32 var_ctr1; + it_279D_DatAttrs* attr; + s32 index; + s32 var_r3; + s32 var_r4_2; + s32 var_r5; + s32 var_r6_2; + + var_r4 = arg1; + var_r6 = &sp10; + cnt = 0; + attr = item->xC4_article_data->x4_specialAttributes; + var_r3 = 0; + chk = var_r4->x; + for (var_ctr1 = 6; var_ctr1 != 0; var_ctr1--) { + for (var_ctr2 = 0; var_ctr2 < 5; var_ctr2++) { + if (chk != Pokemon_Chicorita_Leaf) { + if ((Item_804A0E24.x != chk) && (Item_804A0E24.y != chk)) { + var_r6->x = chk; + cnt++; + var_r6->y = attr->x3C[var_r4->x - Pokemon_Tosakinto]; + var_r6->x += 2; + var_r3 += var_r6->y; + } + chk = var_r4->y; + var_r4->x++; + } + } + } + rand_int = HSD_Randi(var_r3); + var_ctr1 = cnt; + var_r6_2 = 0; + var_r5 = Pokemon_Sonans; + var_r4_2 = 0; + if (cnt > 0) { + for (var_ctr1 = cnt; var_ctr1 != 0; var_ctr1--) { + var_r6_2 += var_r6->y; + if (rand_int < var_r6_2) { + var_r5 = sp10.x + (var_r4_2 * 8); + } else { + var_r6->x += 2; + var_r4_2++; + } + } + } + Item_804A0E24.y = Item_804A0E24.x; + Item_804A0E24.x = var_r5; + return var_r5 - Pokemon_Tosakinto; +} -/// #it_8027A118 +s32 it_8027A9B8(Item* item) +{ + void* vec; + + vec = gm_801BEC54(); + if (vec == NULL) { + return Pokemon_Sonans; + } + if ((HSD_Randi(251U) == 0) && (Item_804A0E24.z == 0) && gm_80165084()) { + Item_804A0E24.z = 1; + gm_80172C04(); + return 23U; + } + if ((HSD_Randi(251U) == 0) && (Item_804A0E24.z == 0) && + gm_80164ABC((gmMainLib_8015ED8C_arg0_t*) &Item_804A0E24)) + { + Item_804A0E24.z = 1; + gm_80172BC4(); + return 22U; + } + return it_8027A780(item, vec); +} -/// #it_8027A13C +void it_8027AAA0(Item_GObj* item1_gobj, Item* item2, s32 arg2) +{ + Item* var_r6; + // f32 temp_f1; + s32 var_r8; + it_279D_DatAttrs* attr; + + attr = ((Item*) item1_gobj->user_data) + ->xC4_article_data->x4_specialAttributes; + if (arg2 == Pokemon_Marumine) { + item2->xDD4_itemVar.it_279D.x1C = 0.0f; + item2->xDD4_itemVar.it_279D.x20 = 0.0f; + } else { + item2->xDD4_itemVar.it_279D.x1C = attr->xC; + item2->xDD4_itemVar.it_279D.x20 = attr->x10; + } + item2->xDD4_itemVar.it_279D.x24 = attr->x14; + var_r6 = item2; + var_r8 = 0; + item2->xDD4_itemVar.it_279D.x28 = attr->x18; + item2->xDD4_itemVar.it_279D.x48 = + (item2->xCC_item_attr->x60_scale - item2->xDD4_itemVar.it_279D.x4C) / + item2->xDD4_itemVar.it_279D.x28; + item2->xDD4_itemVar.it_279D.x44 = attr->x34; + item2->xDD4_itemVar.it_279D.x54 = attr->x38; + item2->xDD4_itemVar.it_279D.x5C = 0.0f; + item2->xDD4_itemVar.it_279D.x58 = 0.0f; + item2->xDD4_itemVar.it_279D.x50 = 0.0f; + + while (var_r8 < attr->x38) { + item2->xDD4_itemVar.it_279D.x2C[var_r8] = + attr->x1C[var_r8] * item2->xCC_item_attr->x60_scale; + var_r8++; + } +} -/// #it_8027A160 +bool it_8027AB64(Item_GObj* item_gobj) +{ + PokemonKind pokemon_kind; + // Item_GObj* sp20; + SpawnItem spawn; + // Article* temp_r4; + // Item* temp_r28; + Item* item; + Item_GObj* spawn_gobj; + ItemKind it_kind; + s32 rand_int; + s32 var_ctr; + s32 var_r0; + s32 var_r3; + s32 var_r4; + s32 index1; + s32 index2; + u32 temp_r3; + // void* temp_r29; + it_279D_DatAttrs* attr; + // PAD_STACK(8); + + item = GET_ITEM((HSD_GObj*) item_gobj); + // item = item_gobj->user_data; + temp_r3 = gm_8016AEB8(); + if (temp_r3 != 0U) { + if (temp_r3 == 1U) { + pokemon_kind = it_8027A9B8(item); + } else { + pokemon_kind = temp_r3 - Pokemon_Tosakinto; + } + } else if (gm_8018841C()) { + if (&it_803F2ED0 == NULL) { + pokemon_kind = (PokemonKind) Pokemon_Sonans; + } else { + pokemon_kind = it_8027A780(item, &it_803F2ED0); + } + // pokemon_kind = var_r3; + } else if (gm_801A4310() == 0x18) { + // temp_r4 = item->xC4_article_data; + // temp_r29 = temp_r4->x4_specialAttributes; + attr = item->xC4_article_data->x4_specialAttributes; + + rand_int = HSD_Randi(it_8027A364(item)); + // var_ctr = 0x1E; + // var_r6 = temp_r29 + 0x284; + var_r4 = 0; + index1 = Pokemon_Tosakinto; + + index2 = Pokemon_Sonans; + for (var_ctr = 30; var_ctr != 0; var_ctr--) { + var_r4 += attr->x3C[index1 - Pokemon_Tosakinto]; + if ((Item_804A0E24.x != index2) && (Item_804A0E24.y != index2) && + ((var_r4 < rand_int) == 0)) + { + Item_804A0E24.y = Item_804A0E24.x; + var_r0 = index2 - Pokemon_Tosakinto; + Item_804A0E24.x = index2; + goto block_1; + } else { + index1++; + index2++; + } + } + var_r0 = 0; + block_1: + + // loop_11: + // if (((s32) Item_804A0E24.x != index2) && ((s32) + // Item_804A0E24.y != index2) && (var_r4 += var_r6->unk-248, + // ((var_r4 < rand_int) == 0))) { + // Item_804A0E24.y = Item_804A0E24.x; + // var_r0 = index2 - Pokemon_Tosakinto; + // Item_804A0E24.x = index2; + // } else { + // var_r6 += 4; + // index2 += 1; + // var_ctr -= 1; + // if (var_ctr == 0) { + // var_r0 = 0; + // } else { + // goto loop_11; + // } + // } + pokemon_kind = var_r0; + } else { + pokemon_kind = db_80225D1C(); + if (pokemon_kind == Pokemon_ID_Tosakinto) { + pokemon_kind = it_8027A4D4(item); + } else { + pokemon_kind--; + } + if ((pokemon_kind == Pokemon_ID_Metamon) && + ((it_8026B3C0(Pokemon_Metamon) != 0) || (ftLib_800860C4() == 4))) + { + pokemon_kind = Pokemon_ID_Tosakinto; + } + } + item = item_gobj->user_data; + spawn.vel.z = 0.0f; + spawn.vel.x = 0.0f; + spawn.vel.y = + ((it_279D_DatAttrs*) item->xC4_article_data->x4_specialAttributes)->x8; + spawn.prev_pos = item->pos; + spawn.prev_pos.z = 0.0f; + it_8026BB88(item_gobj, &spawn.pos); + spawn.x3C_damage = 0; + spawn.facing_dir = it_8026B6A8(&spawn.prev_pos, item->owner); + it_kind = pokemon_kind + Pokemon_Tosakinto; + spawn.kind = it_kind; + spawn.x0_parent_gobj = item->owner; + spawn.x4_parent_gobj2 = (HSD_GObj*) item_gobj; + spawn.x44_flag.b0 = 1; + spawn.x40 = 0; + if (spawn.kind == Pokemon_Cerebi) { + gm_80172C04(); + } + if (spawn.kind == Pokemon_Mew) { + gm_80172BC4(); + } + spawn_gobj = Item_80268B18(&spawn); + if (spawn_gobj != NULL) { + it_8027AAA0(item_gobj, spawn_gobj->user_data, spawn.kind); + pl_8003E70C(spawn_gobj); + db_80225DD8(spawn_gobj, (Fighter_GObj*) item->owner); + it_8027B288(spawn_gobj, (u32) 0x440060); + it_8027B564(spawn_gobj); + return true; + } + return false; +} -/// #it_8027A344 +void it_8027ADEC(int arg0, Item_GObj* item_gobj, HSD_JObj* arg2, f32 arg3) +{ + f32 sp1C; + f32 scale; + Item* item; + + // sp1C = 1.0f; + item = item_gobj->user_data; + scale = item->xCC_item_attr->x60_scale; + sp1C = scale * (1.0f / arg3); + efSync_Spawn(arg0, item_gobj, arg2, &sp1C, scale); +} -/// #it_8027A364 +bool it_8027AE34(Item_GObj* item_gobj) +{ + Quaternion rotate; + HSD_JObj* item_jobj; + Item* item; + PAD_STACK(4); + + item_jobj = item_gobj->hsd_obj; + item = GET_ITEM((HSD_GObj*) item_gobj); + rotate = it_803B8588; + item->x40_vel.x = -item->x40_vel.x * item->xC70; + item->facing_dir = -item->facing_dir; + item->xD44_lifeTimer = item->xD48_halfLifeTimer; + rotate.y = M_PI_2 * item->facing_dir; + HSD_JObjSetRotation(item_jobj, &rotate); + return false; +} -/// #it_8027A4D4 +bool it_8027AF50(Item_GObj* item_gobj) +{ + Quaternion rotate; + HSD_JObj* item_jobj; + Item* item; + PAD_STACK(4); + + item_jobj = item_gobj->hsd_obj; + item = GET_ITEM((HSD_GObj*) item_gobj); + rotate = it_803B8598; + lbVector_Mirror(&item->x40_vel, &item->xC58); + it_80272980(item_gobj); + rotate.y = M_PI_2 * item->facing_dir; + HSD_JObjSetRotation(item_jobj, &rotate); + return false; +} -/// #it_8027A780 +void it_8027B070(Item_GObj* item_gobj, Fighter_GObj* owner_gobj) +{ + Fighter* fighter; + Item* item; + + fighter = owner_gobj->user_data; + item = item_gobj->user_data; + item->xD88_attackID = fighter->x2068_attackID; + item->xD8C_attack_instance = fighter->x206C_attack_instance; + item->xD90 = fighter->x2070; + item->xD94 = fighter->x2074.x2074_vec; + item->xD9C = fighter->x2074.x207C; + item->xDA4_word = fighter->x2074.x2084; + item->xDA8_short = fighter->x2074.x2088; +} -/// #it_8027A9B8 +void it_8027B0C4(Item_GObj* item_gobj, SpawnItem* spawn) +{ + // s32 sp24; + Item* spawn_item; + Item* owner_item; + Fighter* owner_fighter; + PAD_STACK(28); + + if (ftLib_80086960(spawn->x0_parent_gobj)) { + if (ftLib_80086960(spawn->x4_parent_gobj2)) { + spawn_item = item_gobj->user_data; + owner_fighter = spawn->x4_parent_gobj2->user_data; + spawn_item->xD88_attackID = owner_fighter->x2068_attackID; + spawn_item->xD8C_attack_instance = + (s16) owner_fighter->x206C_attack_instance; + spawn_item->xD90 = owner_fighter->x2070; + spawn_item->xD94 = owner_fighter->x2074.x2074_vec; + spawn_item->xD9C = owner_fighter->x2074.x207C; + spawn_item->xDA4_word = owner_fighter->x2074.x2084; + spawn_item->xDA8_short = owner_fighter->x2074.x2088; + return; + } + spawn_item = item_gobj->user_data; + owner_item = spawn->x4_parent_gobj2->user_data; + spawn_item->xD88_attackID = owner_item->xD88_attackID; + spawn_item->xD8C_attack_instance = + (s16) owner_item->xD8C_attack_instance; + spawn_item->xD90 = owner_item->xD90; + spawn_item->xD94 = owner_item->xD94; + spawn_item->xD9C = owner_item->xD9C; + spawn_item->xDA4_word = owner_item->xDA4_word; + spawn_item->xDA8_short = owner_item->xDA8_short; + return; + } + spawn_item = item_gobj->user_data; + // sp24 = 0; + spawn_item->xD88_attackID = 1; + spawn_item->xD8C_attack_instance = 0; + // spawn_item->xD90.x2070_int = sp24; + // spawn_item->xD90.x2070_int = spawn_item->xD8C_attack_instance = 0; + spawn_item->xD90.x2070_int = 0; + ft_80089768(&spawn_item->xD94); + spawn_item->xDA8_short = 0; +} -/// #it_8027AAA0 +void it_8027B1F4(Item_GObj* item_gobj) +{ + // void it_8027B1F4(Item_GObj* item_gobj, int arg4) { + // s32 sp10; + Item* item; + struct Struct2074* temp_r3; + PAD_STACK(8); + + // item = GET_ITEM((HSD_GObj*) item_gobj); + item = item_gobj->user_data; + // sp10 = 0; + item->xD88_attackID = 1; + item->xD8C_attack_instance = 0; + // item->xD90.x2070_int = sp10; + item->xD90.x2070_int = 0; + item->xDA8_short = 0; + if (ftLib_80086960(item->owner)) { + temp_r3 = ft_800898A8((Fighter_GObj*) item->owner); + item->xD94 = temp_r3->x2074_vec; + item->xD9C = temp_r3->x207C; + item->xDA4_word = temp_r3->x2084; + return; + } + ft_80089768(&item->xD94); + // ft_80089768(&item->xD94, arg4); + // ft_80089768(item->xD94, temp_r3->x207C); +} -/// #it_8027AB64 +void it_8027B288(Item_GObj* item_gobj, u32 arg1) +{ + union Struct2070 sp14; + union Struct2070 spC; + Item* item; + struct Struct2074* temp_r3; + + spC.x2070_int = arg1; + item = item_gobj->user_data; + sp14 = spC; + // if ((sp14.flags.x0 == 0) || (sp14.flags.x0 != (u8) item->unkD93)) { + if ((sp14.x2073 == 0) || (sp14.x2073 != item->xD90.x2073)) { + item->xDA8_short = plAttack_80037B08(); + } + item->xD90 = sp14; + if (ftLib_80086960(item->owner)) { + temp_r3 = ft_800898A8((Fighter_GObj*) item->owner); + item->xD94 = temp_r3->x2074_vec; + item->xD9C = temp_r3->x207C; + item->xDA4_word = temp_r3->x2084; + return; + } + ft_80089768(&item->xD94); +} -/// #it_8027ADEC +void it_8027B330(Item_GObj* item_gobj, u32 arg1) +{ + Item* item; -/// #it_8027AE34 + item = GET_ITEM((HSD_GObj*) item_gobj); + if ((arg1 == 1U) || ((s32) arg1 != item->xD88_attackID)) { + item->xD88_attackID = arg1; + item->xD8C_attack_instance = plStale_IncrementAttackInstance(); + } +} -/// #it_8027AF50 +void it_8027B378(Fighter_GObj* fighter_gobj, Item_GObj* item_gobj, f32 arg2) +{ + s32 temp_r31; + u8 temp_r30; + u16 temp_r3; + PAD_STACK(4); + + if (it_8026B6C8(item_gobj)) { + temp_r30 = ft_80089884(fighter_gobj)->x2073; + temp_r31 = ftLib_800874BC((HSD_GObj*) fighter_gobj); + temp_r3 = ftLib_80086BE0((HSD_GObj*) fighter_gobj); + pl_8003EB30(arg2, temp_r3, temp_r31, 6, 0, temp_r30); + } +} -/// #it_8027B070 +void it_8027B408(Item_GObj* item_gobj1, Item_GObj* item_gobj2, f32 arg8) +{ + HSD_GObj* item1_owner_gobj; + s32 temp_r31; + u16 temp_r3; + Item* item1; + + if (it_8026B6C8(item_gobj2)) { + item1 = item_gobj1->user_data; + if (ftLib_80086960(item1->owner)) { + item1_owner_gobj = item1->owner; + temp_r31 = ftLib_800874BC(item1_owner_gobj); + temp_r3 = ftLib_80086BE0(item1_owner_gobj); + pl_8003EB30(arg8, temp_r3, temp_r31, 6, 0, item1->xD90.x2073); + } + } +} -/// #it_8027B0C4 +void it_8027B4A4(Fighter_GObj* item_gobj1, Item_GObj* item_gobj2) +{ + void* temp_r31; -/// #it_8027B1F4 + if (it_8026B6C8(item_gobj2)) { + temp_r31 = (void*) ft_800898A8(item_gobj1); + pl_800384DC((HSD_GObj*) item_gobj1, ft_80089884(item_gobj1)->x2073, + temp_r31); + } +} -/// #it_8027B288 +void it_8027B508(Item_GObj* item_gobj1, Item_GObj* item_gobj2) +{ + Item* item1; + + if (it_8026B6C8(item_gobj2)) { + item1 = item_gobj1->user_data; + if (ftLib_80086960(item1->owner)) { + pl_800384DC((HSD_GObj*) item1->owner, item1->xD90.x2073, + &item1->xD94); + } + } +} -/// #it_8027B330 +void it_8027B564(Item_GObj* item_gobj) +{ + union Struct2070 sp10; + Item* item; + + item = GET_ITEM((HSD_GObj*) item_gobj); + if (ftLib_80086960(item->owner)) { + sp10 = item->xD90; + pl_80037DF4(item->owner, &sp10); + } +} -/// #it_8027B378 +Item_GObj* it_8027B5B0(ItemKind kind, Vec3* pos, HSD_JObj* jobj, Vec3* vel, + bool chk) +{ + Item* spawn_item; + SpawnItem spawn; + Vec3 sp20; + Item_GObj* spawn_gobj; + PAD_STACK(4); + + spawn.kind = kind; + if (pos != NULL) { + spawn.prev_pos = *pos; + } else if (jobj != NULL) { + lb_8000B1CC(jobj, NULL, &sp20); + spawn.prev_pos = sp20; + } else { + OSReport(&it_803F5428); + loop_5: + goto loop_5; + } + spawn.pos = spawn.prev_pos; + spawn.facing_dir = it_8026B684(&spawn.prev_pos); + spawn.x3C_damage = 0; + spawn.x44_flag.b0 = 1; + if (vel != NULL) { + spawn.vel = *vel; + } else { + spawn.vel.x = spawn.vel.y = spawn.vel.z = 0.0f; + } + spawn.x0_parent_gobj = NULL; + spawn.x4_parent_gobj2 = spawn.x0_parent_gobj; + spawn.x40 = 0; + if (chk == true) { + spawn_gobj = Item_80268B18(&spawn); + } else { + spawn_gobj = Item_80268B5C(&spawn); + } + if (spawn_gobj != NULL) { + spawn_item = spawn_gobj->user_data; + spawn_item->xDD4_itemVar.it_27B5.x0 = jobj; + spawn_item->xDD4_itemVar.it_27B5.x4 = -1; + spawn_item->xDD4_itemVar.it_27B5.x14.z = 0.0f; + spawn_item->x378_itemColl.x34_flags.b1234 = 3; + } + return spawn_gobj; +} -/// #it_8027B408 +void it_8027B730(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xDD4_itemVar.it_27B5.x0 = 0; + item->xDD4_itemVar.it_27B5.x4 = -1; + item->xDD4_itemVar.it_27B5.x8.z = 0.0f; + item->xDD4_itemVar.it_27B5.x8.x = 0.0f; + item->xDD4_itemVar.it_27B5.x8.y = 1.0f; + item->xDD4_itemVar.it_27B5.x14.x = 0; + item->xDD4_itemVar.it_27B5.x14.y = 0; + item->xDD4_itemVar.it_27B5.x14.z = 0; + it_80275228(item_gobj); + it_80275240(item_gobj); +} -/// #it_8027B4A4 +bool it_8027B798(Item_GObj* item_gobj, Vec3* arg1) +{ + Vec3 sp14; + Item* item; + Vec3* temp_r31_2; + f32 temp_f1; + f32 temp_f2; + f32 temp_f30; + f32 temp_f31; + f32 temp_f3; + f32 temp_f4; + f32 temp_f5; + f32 angle; + s32 degree_angle; + bool ret_chk; + PAD_STACK(8); + + ret_chk = false; + item = item_gobj->user_data; + degree_angle = item->xCAC_angle; + temp_f1 = item->xCC8_knockback; + temp_f31 = temp_f1 * p_ftCommonData->x100; + if (degree_angle != 361) { + angle = 0.0174533f * (f32) degree_angle; + } else if (item->ground_or_air == GA_Air) { + angle = p_ftCommonData->x144; + } else { + temp_f3 = p_ftCommonData->x14C; + if (temp_f1 < temp_f3) { + angle = 0.0f; + } else { + temp_f4 = p_ftCommonData->x148; + temp_f5 = 0.0174533f * temp_f4; + angle = + 0.0174533f * ((temp_f4 * ((temp_f1 - temp_f3) / + (p_ftCommonData->x150 - temp_f3))) + + 1.0f); + if (angle > temp_f5) { + angle = temp_f5; + } + } + } + temp_f30 = temp_f31 * cosf(angle); + temp_f2 = temp_f31 * sinf(angle); + item->facing_dir = item->xCCC_incDamageDirection; + if (item->ground_or_air == GA_Air) { + arg1->x = -temp_f30 * item->facing_dir; + arg1->y = temp_f2; + arg1->z = 0.0f; + } else { + temp_r31_2 = &item->x378_itemColl.floor.normal; + sp14.x = -temp_f30 * item->facing_dir; + sp14.y = temp_f2; + sp14.z = 0.0f; + if (lbVector_Angle(temp_r31_2, &sp14) < 1.5708f) + { // Should this be M_PI_2? + ret_chk = true; + arg1->x = sp14.x; + arg1->y = sp14.y; + arg1->z = 0.0f; + } else { + arg1->x = temp_r31_2->y * sp14.x; + arg1->y = -temp_r31_2->x * sp14.x; + arg1->z = 0.0f; + } + } + return ret_chk; +} -/// #it_8027B508 +void it_8027B964(Item_GObj* item_gobj, bool chk) +{ + Vec3 sp14; + Item* item; + f32 scale; + + item = GET_ITEM((HSD_GObj*) item_gobj); + if (chk != 0) { + it_8027781C(item_gobj); + } else { + it_8027B798(item_gobj, &item->x40_vel); + if ((item->x40_vel.x == 0.0f) && (item->x40_vel.y == 0.0f)) { + item->x40_vel.x = 0.1f * -item->xCCC_incDamageDirection; + item->x40_vel.y = 0.1f; + } + if (item->x40_vel.y == 0.0f) { + item->x40_vel.y = 0.1f; + } + } + sp14 = item->x40_vel; + lbVector_Normalize(&sp14); + scale = + ((it_27B5_DatAttrs*) ((Article*) it_804D6D40)->x4_specialAttributes) + ->scale; + sp14.x *= scale; + sp14.y *= scale; + sp14.z *= scale; + item->x40_vel = sp14; +} -/// #it_8027B564 +// static inline u32 copy(u32 len, Vec3* src, Vec3* dst) { +// *dst = *src; +// return len; +// } -/// #it_8027B5B0 +void it_8027BA54(HSD_GObj* item_gobj, Vec3* arg1) +{ + Vec3 sp20; + Vec3 sp14; + Item* item; + + item = GET_ITEM((HSD_GObj*) item_gobj); + Camera_80030788(&sp20); + sp20.x = ((10.0f * (HSD_Randf() - it_804DC7F8)) + sp20.x); + sp20.y += 30.0f * HSD_Randf(); + lbVector_Diff(&sp20, &item->pos, &sp14); + lbVector_Normalize(&sp14); + sp14.x *= 10.0f; + sp14.y *= 10.0f; + sp14.z *= 10.0f; + // copy(3, &sp14, arg1); + *arg1 = sp14; +} -/// #it_8027B730 +void it_8027BB1C(Vec3* arg0, Vec3* arg1) +{ + f32 cos; + f32 sin; + f32 t1; + f32 t2; + + { + cos = cosf(arg1->x); + sin = sinf(arg1->x); + t1 = arg0->y; + t2 = arg0->z; + arg0->y = (t1 * cos) - (t2 * sin); + arg0->z = (t1 * sin) + (t2 * cos); + } + + { + cos = cosf(arg1->y); + sin = sinf(arg1->y); + t1 = arg0->x; + t2 = arg0->z; + arg0->x = (t1 * cos) + (t2 * sin); + arg0->z = (t2 * cos) - (t1 * sin); + } + + { + cos = cosf(arg1->z); + sin = sinf(arg1->z); + t1 = (arg0->x * cos) - (arg0->y * sin); + t2 = (arg0->x * sin) + (arg0->y * cos); + arg0->x = t1; + arg0->y = t2; + } +} -/// #it_8027B798 +void it_8027BBF4(Item_GObj* item_gobj, bool arg_chk, f64 arg8, f32 arg9) +{ + f32 temp_f1; + f32 temp_f30; + f32 var_f29; + f32 var_f28; + Vec3 sp74; + Vec3 sp68; + Vec3 sp5C; + Vec3 sp50; + Vec3 sp44; + Vec3 sp38; + HSD_JObj* item_jobj; + Item* item; + CollData* coll; + + item = GET_ITEM((HSD_GObj*) item_gobj); + item_jobj = item_gobj->hsd_obj; + coll = &item->x378_itemColl; + sp68 = it_803B85A8[2]; + sp5C = it_803B85A8[3]; + + if (!arg_chk) { + if (coll->env_flags & MPCOLL_UNK) { + sp68 = coll->floor.normal; + goto block_7; + } + return; + } else if (coll->env_flags & MPCOLL_CEIL) { + sp68 = coll->ceiling.normal; + goto block_7; + } + return; + +block_7: + + sp74.x = HSD_JObjGetRotationX(item_jobj); + sp74.y = HSD_JObjGetRotationY(item_jobj); + sp74.z = HSD_JObjGetRotationZ(item_jobj); + + it_8027BB1C(&sp5C, &sp74); + if (lbVector_AngleXY(&item->xDD4_itemVar.it_27B5.x8, &sp68) > deg_to_rad) { + item->xDD4_itemVar.it_27B5.x8 = sp68; + item->xDD4_itemVar.it_27B5.x14.x = (s32) arg9; + } + temp_f1 = lbVector_AngleXY(&sp5C, &item->xDD4_itemVar.it_27B5.x8); + if ((temp_f1 < deg_to_rad) || item->xDD4_itemVar.it_27B5.x14.x < 2) { + var_f29 = sp68.x; + var_f28 = sp68.y; + } else { + var_f29 = temp_f1 / (f32) item->xDD4_itemVar.it_27B5.x14.x; + item->xDD4_itemVar.it_27B5.x14.x--; + if (((sp5C.x * sp68.y) - (sp5C.y * sp68.x)) < 0) { + var_f29 = -var_f29; + } + temp_f30 = cosf(var_f29); + temp_f1 = sinf(var_f29); + var_f29 = (sp5C.x * temp_f30) - (sp5C.y * temp_f1); + var_f28 = (sp5C.x * temp_f1) + (sp5C.y * temp_f30); + } + + sp44 = it_803B85A8[0]; + sp50 = it_803B85A8[1]; + lbVector_Rotate(&sp50, 2, M_PI_2 * arg8); + lbVector_Rotate(&sp44, 2, M_PI_2 * arg8); + + sp38.x = var_f29; + sp38.y = var_f28; + sp38.z = 0.0f; + lbVector_CrossprodNormalized(&sp38, &sp50, &sp44); + lbVector_CrossprodNormalized(&sp44, &sp38, &sp50); + lbVector_EulerAnglesFromONB(&sp74, &sp50, &sp44, &sp38); + + HSD_JObjSetRotationX(item_jobj, sp74.x); + HSD_JObjSetRotationY(item_jobj, sp74.y); + HSD_JObjSetRotationZ(item_jobj, sp74.z); +} -/// #it_8027B964 +// Might take in and pass more vars +void it_8027C0A8(Item_GObj* item_gobj) +{ + it_8027BBF4(item_gobj, false, 0, 0); +} -/// #it_8027BA54 +// Might take in and pass more vars +void it_8027C0CC(Item_GObj* item_gobj) +{ + it_8027BBF4(item_gobj, true, 0, 0); +} -/// #it_8027BB1C +void it_8027C0F0(Item_GObj* item_gobj, Vec3* arg1, f64 arg8, f32 arg9) +{ + f32 temp_f1; + f32 temp_f30; + f32 var_f29; + f32 var_f28; + Vec3 sp74; + Vec3 sp68; + Vec3 sp5C; + Vec3 sp50; + Vec3 sp44; + Vec3 sp38; + Item* item = GET_ITEM((HSD_GObj*) item_gobj); + HSD_JObj* item_jobj = GET_JOBJ((HSD_GObj*) item_gobj); + PAD_STACK(4); + + sp68 = it_803B85A8[4]; + sp5C = it_803B85A8[5]; + + if (item->x378_itemColl.env_flags & MPCOLL_UNK) { + if (arg1 != NULL) { + sp68 = *arg1; + } + sp74.x = HSD_JObjGetRotationX(item_jobj); + sp74.y = HSD_JObjGetRotationY(item_jobj); + sp74.z = HSD_JObjGetRotationZ(item_jobj); + it_8027BB1C(&sp5C, &sp74); + + if (lbVector_AngleXY(&item->xDD4_itemVar.it_27B5.x8, &sp68) > + deg_to_rad) + { + item->xDD4_itemVar.it_27B5.x8 = sp68; + item->xDD4_itemVar.it_27B5.x14.x = (s32) arg9; + } + temp_f1 = lbVector_AngleXY(&sp5C, &item->xDD4_itemVar.it_27B5.x8); + if ((temp_f1 < deg_to_rad) || item->xDD4_itemVar.it_27B5.x14.x < 2) { + var_f29 = sp68.x; + var_f28 = sp68.y; + } else { + var_f29 = temp_f1 / (f32) item->xDD4_itemVar.it_27B5.x14.x; + item->xDD4_itemVar.it_27B5.x14.x--; + if (((sp5C.x * sp68.y) - (sp5C.y * sp68.x)) < 0) { + var_f29 = -var_f29; + } + temp_f30 = cosf(var_f29); + temp_f1 = sinf(var_f29); + var_f29 = (sp5C.x * temp_f30) - (sp5C.y * temp_f1); + var_f28 = (sp5C.x * temp_f1) + (sp5C.y * temp_f30); + } + + sp44 = it_803B85A8[0]; + sp50 = it_803B85A8[1]; + lbVector_Rotate(&sp50, 2, M_PI_2 * arg8); + lbVector_Rotate(&sp44, 2, M_PI_2 * arg8); + sp38.x = var_f29; + sp38.y = var_f28; + sp38.z = 0.0f; + lbVector_CrossprodNormalized(&sp38, &sp50, &sp44); + lbVector_CrossprodNormalized(&sp44, &sp38, &sp50); + lbVector_EulerAnglesFromONB(&sp74, &sp50, &sp44, &sp38); + + HSD_JObjSetRotationX(item_jobj, sp74.x); + HSD_JObjSetRotationY(item_jobj, sp74.y); + HSD_JObjSetRotationZ(item_jobj, sp74.z); + } +} -/// #it_8027BBF4 +void it_8027C56C(Item_GObj* item_gobj, f32 y_rot) +{ + Item* item; + HSD_JObj* item_jobj; + // char msg = it_803F5428; + + item_jobj = GET_JOBJ((HSD_GObj*) item_gobj); + item = GET_ITEM((HSD_GObj*) item_gobj); + HSD_JObjSetRotationX(item_jobj, 0.0f); + HSD_JObjSetRotationY(item_jobj, M_PI_2 * y_rot); + HSD_JObjSetRotationZ(item_jobj, 0.0f); + + item->xDD4_itemVar.it_27B5.x8.z = 0.0f; + item->xDD4_itemVar.it_27B5.x8.x = 0.0f; + item->xDD4_itemVar.it_27B5.x8.y = 1.0f; + item->xDD4_itemVar.it_27B5.x14.x = 0U; +} -/// #it_8027C0A8 +bool it_8027C794(void) +{ + return false; +} -/// #it_8027C0CC +bool it_8027C79C(Item_GObj* item_gobj) +{ + Item* item; + PAD_STACK(4); + + if (it_8026DAA8(item_gobj) & 0xF) { + item = GET_ITEM((HSD_GObj*) item_gobj); + it_8027C9D8(item); + it_8027B964(item_gobj, 1); + item->xDD4_itemVar.it_27B5.x14.y++; + // if (item->xDD4_itemVar.it_27B5.x14.y > (f32) (u8) &it_804D6D40) { + // if (item->xDD4_itemVar.it_27B5.x14.y > ((ItemAttr*) ((Article*) + // it_804D6D40)->x0_common_attr)->x0_is_heavy) { + if (item->xDD4_itemVar.it_27B5.x14.y > ((S32Vec3*) it_804D6D40)->x) { + it_8027CC88(item_gobj); + return true; + } + } + return false; +} -/// #it_8027C0F0 +bool it_8027C824(Item_GObj* item_gobj, s32 (*arg_func)(Item_GObj*)) +{ + s32 arg_func_ret_val; + + if (it_8026DAA8(item_gobj) & 0xF) { + it_8027CC88(item_gobj); + if (arg_func != NULL) { + arg_func_ret_val = arg_func(item_gobj); + if (arg_func_ret_val != 0) { + it_8027CE44(item_gobj); + } + return arg_func_ret_val; + } + it_8027CE44(item_gobj); + return true; + } + return false; +} -/// #it_8027C56C +void it_8027C8B0(Item_GObj* item_gobj) +{ + grZakoGenerator_801CAC14(); +} -bool it_8027C794(void) +static inline float product_xyz(Vec3* a, Vec3* b) { - return false; + return (a->x * b->x + a->y * b->y + a->z * b->z); } -/// #it_8027C79C +static inline float return_sqrt_value3(Vec3* v) +{ + return sqrtf(product_xyz(v, v)); +} -/// #it_8027C824 +void it_8027C8D0(Vec3* arg0, Vec3* arg1, f32 arg8) +{ + f32 dir; + f32 vec_mag; + f32 var_f6; + Vec3 sp1C; + + vec_mag = return_sqrt_value3(arg0); + sp1C = *arg1; + if (arg8 > 0.0f) { + dir = -1.0f; + var_f6 = 0.00000000680742f; + } else if (arg8 < 0.0f) { + dir = 1.0f; + var_f6 = 0.00000000680742f; + } else { + arg0->z = 0.0f; + arg0->y = 0.0f; + arg0->x = 0.0f; + return; + } + + arg0->x = vec_mag * ((sp1C.x * var_f6) - (sp1C.y * dir)); + arg0->y = vec_mag * ((sp1C.x * dir) + (sp1C.y * var_f6)); + arg0->z = 0.0f; +} -/// #it_8027C8B0 +void it_8027C9D8(Item* item) +{ + s32 spC[4]; + s32 var_r3; + + *(s64*) spC = *(s64*) it_803B85F0; + *((s64*) spC + 1) = *((s64*) it_803B85F0 + 1); + + var_r3 = spC[HSD_Randi(4)]; + while (var_r3 == item->xDD4_itemVar.it_27B5.x14.z) { + var_r3 = spC[HSD_Randi(4)]; + } + item->xDD4_itemVar.it_27B5.x14.z = var_r3; + Item_8026AE84(item, item->xDD4_itemVar.it_27B5.x14.z, 127, 64); +} -/// #it_8027C8D0 +bool it_8027CA7C(HSD_GObj* gobj) +{ + bool chk; + + chk = false; + if (ftLib_80086C0C(gobj) == 0x14E) { + chk = true; + } + if (ftLib_80086C0C(gobj) == 0x14D) { + chk = true; + } + return chk; +} -/// #it_8027C9D8 +void it_8027CAD8(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->x40_vel.y = 0.0f; + item->x40_vel.x = 0.0f; + it_8027542C(item_gobj); + it_80275444(item_gobj); + it_80274740(item_gobj); + item->owner = NULL; + it_80275270(item_gobj); +} -/// #it_8027CA7C +void it_8027CB3C(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + it_8026C220(item_gobj, item->owner); + item->facing_dir = ftLib_800865C0(item->owner); + it_80275414(item_gobj); + it_80275474(item_gobj); + it_802762BC(item); + it_8026B3A8(item_gobj); +} -/// #it_8027CAD8 +void it_8027CBA4(Item_GObj* item_gobj) +{ + Item* item; -/// #it_8027CB3C + item = item_gobj->user_data; + item->facing_dir = ftLib_800865C0(item->owner); + it_802762BC(item); + it_802754D4(item_gobj); + it_8026B3A8(item_gobj); +} -/// #it_8027CBA4 +f32 it_8027CBFC(Item_GObj* item_gobj) +{ + s32 ret_val; + PAD_STACK(4); + + ret_val = 0U; + switch (GET_ITEM((HSD_GObj*) item_gobj)->xCC4) { + case 6: + case 7: + ret_val = *(f32*) ((u8*) it_804D6D40 + 0xC); + // ret_val = *(f32*) &((Article*) it_804D6D40)->xC_itemStates; + break; + case 9: + ret_val = *(f32*) ((u8*) it_804D6D40 + 0x10); + // ret_val = *(f32*) &((Article*) it_804D6D40)->x10_modelDesc; + break; + case 4: + case 5: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + break; + } + return (f32) ret_val; +} -/// #it_8027CBFC +Item_GObj* it_8027CC88(Item_GObj* item_gobj_arg) +{ + s32 temp_r3; + s32 temp_r3_2; + s32 var_r30; + Item_GObj* item_gobj_var; + Item* var_item; + u32 pad[20]; + Vec3 sp44; + u32 sp1C[10]; + u32 pad2[4]; + + item_gobj_var = NULL; + if ((gm_8016B498() != 0) && + (HSD_Randi(*(f32*) ((u8*) it_804D6D40 + 0x14)) == 0)) + { + if ((u16) grLib_801C9E40() == 0U) { + var_r30 = Ground_801C5840(); + if (var_r30 != -1) { + temp_r3 = + un_8031C354(var_r30, (s32(*)[]) & sp1C[0], 0xA, 0x63); + temp_r3_2 = + temp_r3 + un_8031C354(var_r30, + (s32(*)[]) & (&sp1C[0])[temp_r3], + 0xA, 2); + if (temp_r3_2 != 0) { + var_r30 = (&sp1C[0])[HSD_Randi(temp_r3_2)]; + } + it_8026BB88(item_gobj_arg, &sp44); + item_gobj_var = it_802F2094(0, &sp44, var_r30, 0); + if (item_gobj_var != 0) { + var_item = item_gobj_var->user_data; + var_item->x40_vel.x = + ((2.0f * (HSD_Randf() - 0.5f)) * + (*((f32*) &it_804D6D28->x54_float))); + var_item->x40_vel.y = var_item->xCC_item_attr->x18; + var_item->x40_vel.z = 0.0f; + grLib_801C9E50(1); + } + } + } else if ((u16) grLib_801C9E40() >= + *((f32*) ((u8*) it_804D6D40 + 0x18))) + { + grLib_801C9E50(0); + } else { + grLib_801C9E50(grLib_801C9E40() + 1); + } + } + return item_gobj_var; +} -/// #it_8027CC88 +void it_8027CE18(Item_GObj* item_gobj) +{ + Item* item; -/// #it_8027CE18 + item = item_gobj->user_data; + pl_8004049C(item->xCB0_source_ply, item->kind); +} -/// #it_8027CE44 +void it_8027CE44(Item_GObj* item_gobj) +{ + grZakoGenerator_801CACB8((Ground_GObj*) item_gobj); +} -/// #it_8027CE64 +// Appears to be a function for Game&Watch items +void it_8027CE64(Item_GObj* item_gobj, HSD_GObj* fighter_gobj, void* arg_attr) +{ + Item* item; + GXColor sp18; + + item = item_gobj->user_data; + item->xDCF_flag.b3 = true; + ftLib_8008770C(fighter_gobj, (void*) &sp18); + it_80278574((HSD_GObj*) item_gobj, &sp18); + ftLib_80087744(fighter_gobj, &item->xBC8); + item->x5C8 = ftLib_800870BC(item->owner, (void**) &item->xBC4); + it_80274594(item_gobj); + item->xDD4_itemVar.it_27CE.attr = + arg_attr; // Or the first var gets set equal to the first attribute +} diff --git a/src/melee/it/it_2725.h b/src/melee/it/it_2725.h index 5a72137b88..27b84ed835 100644 --- a/src/melee/it/it_2725.h +++ b/src/melee/it/it_2725.h @@ -8,250 +8,270 @@ #include "it/forward.h" #include +#include "it/itCharItems.h" #include "it/items/types.h" #include "lb/types.h" -/* 272560 */ UNK_RET it_80272560(UNK_PARAMS); +#include + +/* 272560 */ void it_80272560(Item_GObj*, s32); /* 2725D4 */ void it_802725D4(Item_GObj*); -/* 272674 */ UNK_RET it_80272674(UNK_PARAMS); -/* 272784 */ void it_80272784(Item_GObj* gobj); -/* 272818 */ s32 it_80272818(Item_GObj* gobj); -/* 272828 */ s32 it_80272828(s32); +/* 272674 */ void it_80272674(Item_GObj*, s32); +/* 272784 */ void it_80272784(Item_GObj*); +/* 272818 */ Fighter* it_80272818(Item*); +/* 272828 */ Item_GObj* it_80272828(ItemKind); /* 272860 */ void it_80272860(Item_GObj*, f32, f32); -/* 2728C8 */ void it_802728C8(Item_GObj* gobj); -/* 272940 */ void it_80272940(Item_GObj* gobj); -/* 272980 */ void it_80272980(Item_GObj*, f32); +/* 2728C8 */ void it_802728C8(Item_GObj*); +/* 272940 */ void it_80272940(Item_GObj*); +// /* 272980 */ void it_80272980(Item_GObj*, f32); +/* 272980 */ void it_80272980(Item_GObj*); /* 272A18 */ void it_80272A18(HSD_JObj* item_jobj); /* 272A3C */ void it_80272A3C(HSD_JObj* item_jobj); /* 272A60 */ void it_80272A60(Item_GObj*); -/* 272AC4 */ UNK_RET it_80272AC4(UNK_PARAMS); -/* 272B40 */ UNK_RET it_80272B40(UNK_PARAMS); +/* 272AC4 */ void it_80272AC4(Item_GObj*, Vec3*); +/* 272B40 */ void it_80272B40(Item_GObj*); /* 272BA4 */ void it_80272BA4(Item_GObj*); /* 272C08 */ void it_80272C08(Item_GObj*); /* 272C6C */ bool it_80272C6C(Item_GObj*); -/* 272C90 */ HSD_JObj* it_80272C90(Item_GObj* gobj); +/* 272C90 */ HSD_JObj* it_80272C90(Item_GObj*); /* 272CC0 */ HSD_JObj* it_80272CC0(Item_GObj*, enum_t); -/* 272D1C */ bool it_80272D1C(Item_GObj* gobj); -/* 272D40 */ s32 it_80272D40(Item_GObj* gobj); -/* 272db0 */ bool itColl_BounceOffVictim(Item_GObj*); -/* 272DE4 */ UNK_RET it_80272DE4(UNK_PARAMS); +/* 272D1C */ bool it_80272D1C(Item_GObj*); +/* 272D40 */ s32 it_80272D40(Item_GObj*); +/* 272DB0 */ bool itColl_BounceOffVictim(Item_GObj*); +/* 272DE4 */ void it_80272DE4(HSD_JObj*, f32); /* 272F7C */ void it_80272F7C(HSD_JObj*, f32); /* 273030 */ bool it_80273030(Item_GObj*); /* 273078 */ bool itColl_BounceOffShield(Item_GObj*); -/* 273130 */ enum_t it_80273130(Item_GObj*); -/* 273168 */ void it_80273168(Item_GObj* gobj); +/* 273130 */ bool it_80273130(Item_GObj*); +/* 273168 */ void it_80273168(Item_GObj*); /* 2731A4 */ void it_802731A4(Item_GObj*); /* 2731E0 */ void it_802731E0(Item_GObj*); /* 27321C */ void it_8027321C(Item_GObj*); -/* 27327C */ void it_8027327C(Item_GObj* gobj, s32 ID1, s32 ID2); -/* 2732E4 */ UNK_RET it_802732E4(UNK_PARAMS); +/* 27327C */ void it_8027327C(Item_GObj*, enum_t ID1, enum_t ID2); +/* 2732E4 */ void it_802732E4(Item*, s32); /* 273318 */ void it_80273318(Item_GObj*, HSD_Joint*, s32); -/* 273408 */ void it_80273408(Item_GObj* gobj); +// /* 273318 */ void it_80273318(Item_GObj*, HSD_Joint*); +/* 273408 */ void it_80273408(Item_GObj*); /* 273454 */ void it_80273454(Item_GObj*); -/* 27346C */ void it_8027346C(Item_GObj* gobj); -/* 273484 */ void it_80273484(Item_GObj* gobj); -/* 27349C */ UNK_RET it_8027349C(UNK_PARAMS); +/* 27346C */ void it_8027346C(Item_GObj*); +/* 273484 */ void it_80273484(Item_GObj*); +/* 27349C */ void it_8027349C(Item_GObj*); /* 2734B4 */ void it_802734B4(Item_GObj*); /* 273500 */ void it_80273500(Item_GObj*, Vec3*); -/* 273598 */ UNK_RET it_80273598(UNK_PARAMS); -/* 273600 */ UNK_RET it_80273600(UNK_PARAMS); -/* 273648 */ UNK_RET it_80273648(UNK_PARAMS); +/* 273598 */ void it_80273598(Item_GObj*, s32, s32); +/* 273600 */ void it_80273600(Item_GObj*); +/* 273648 */ void it_80273648(Item_GObj*, s32, s32); /* 273670 */ void it_80273670(Item_GObj*, int, float); /* 273748 */ void it_80273748(Item_GObj*, Vec3*, Vec3*); /* 273B50 */ void it_80273B50(Item_GObj*, Vec3*); -/* 273F34 */ UNK_RET it_80273F34(UNK_PARAMS); -/* 274198 */ void it_80274198(Item_GObj*, s32); -/* 2741F4 */ void it_802741F4(Item_GObj*, s32); +/* 273F34 */ void it_80273F34(Item_GObj*, HSD_GObj*, Item*); +/* 274198 */ void it_80274198(Item_GObj*, bool); +/* 2741F4 */ void it_802741F4(Item_GObj*, bool); /* 274250 */ void it_80274250(Item_GObj*, Vec3*); /* 27429C */ void it_8027429C(Item_GObj*, Vec3*); /* 2742F4 */ void it_802742F4(Item_GObj*, HSD_GObj*, Fighter_Part); -/* 274484 */ UNK_RET it_80274484(UNK_PARAMS); -/* 274574 */ UNK_RET it_80274574(UNK_PARAMS); +/* 274484 */ void it_80274484(Item_GObj*, HSD_JObj*, f32); +/* 274574 */ void it_80274574(Item_GObj*); /* 274594 */ void it_80274594(Item_GObj*); /* 274658 */ void it_80274658(Item_GObj*, f32); -/* 2746F8 */ UNK_RET it_802746F8(UNK_PARAMS); -/* 274740 */ void it_80274740(Item_GObj* gobj); -/* 274990 */ UNK_RET it_80274990(UNK_PARAMS); -/* 274A64 */ void it_80274A64(Item_GObj* gobj); -/* 274C60 */ UNK_RET it_80274C60(UNK_PARAMS); -/* 274C78 */ bool it_80274C78(Item_GObj* gobj); -/* 274C88 */ void it_80274C88(Item_GObj* gobj); -/* 274CAC */ UNK_RET it_80274CAC(UNK_PARAMS); -/* 274D04 */ UNK_RET it_80274D04(UNK_PARAMS); -/* 274D6C */ UNK_RET it_80274D6C(UNK_PARAMS); +/* 2746F8 */ HSD_JObj* it_802746F8(Item_GObj*); +/* 274740 */ void it_80274740(Item_GObj*); +/* 274990 */ f32 it_80274990(Item_GObj*); +/* 274A64 */ void it_80274A64(Item_GObj*); +/* 274C60 */ void it_80274C60(Item_GObj*); +/* 274C78 */ bool it_80274C78(Item_GObj*); +/* 274C88 */ void it_80274C88(Item_GObj*); +/* 274CAC */ void it_80274CAC(Item_GObj*); +/* 274D04 */ void it_80274D04(Item_GObj*, Vec3*); +/* 274D6C */ void it_80274D6C(Item_GObj*); /* 274DAC */ void it_80274DAC(Item_GObj*); -/* 274DFC */ UNK_RET it_80274DFC(UNK_PARAMS); -/* 274E44 */ UNK_RET it_80274E44(UNK_PARAMS); -/* 274ECC */ void it_80274ECC(Item_GObj* gobj, bool); +/* 274DFC */ void it_80274DFC(Item_GObj*); +/* 274E44 */ void it_80274E44(Item_GObj*); +/* 274ECC */ void it_80274ECC(Item_GObj*, bool); /* 274ED8 */ void it_80274ED8(void); /* 274EE8 */ void it_80274EE8(u32); -/* 274EF8 */ void it_80274EF8(Item_GObj* gobj); -/* 274F10 */ void it_80274F10(Item_GObj* gobj); -/* 274F28 */ UNK_RET it_80274F28(UNK_PARAMS); -/* 274F48 */ void it_80274F48(Item_GObj*, s32, Item_GObj*, Fighter_Part); -/* 274FDC */ UNK_RET it_80274FDC(UNK_PARAMS); +/* 274EF8 */ void it_80274EF8(Item_GObj*); +/* 274F10 */ void it_80274F10(Item_GObj*); +/* 274F28 */ void it_80274F28(Item*, s8, HSD_GObjEvent, HSD_GObjInteraction); +/* 274F48 */ void it_80274F48(Item_GObj*, s32, HSD_GObj*, Fighter_Part); +/* 274FDC */ void it_80274FDC(Item_GObj*, s32, Fighter_GObj*, Fighter_Part); /* 275070 */ void it_80275070(Item_GObj*, s32); -/* 2750E8 */ s32 it_802750E8(Item_GObj* gobj, s32 mask); +/* 2750E8 */ bool it_802750E8(Item_GObj*, s32); /* 2750F8 */ void it_802750F8(Item_GObj*); -/* 275158 */ void it_80275158(Item_GObj* gobj, f32 lifetime); -/* 275174 */ UNK_RET it_80275174(UNK_PARAMS); +/* 275158 */ void it_80275158(Item_GObj*, f32); +/* 275174 */ void it_80275174(Item_GObj*, f32); /* 27518C */ void it_8027518C(Item_GObj*); /* 2751D8 */ bool it_802751D8(Item_GObj*); -/* 275210 */ UNK_RET it_80275210(UNK_PARAMS); -/* 275228 */ UNK_RET it_80275228(UNK_PARAMS); -/* 275240 */ UNK_RET it_80275240(UNK_PARAMS); -/* 275258 */ UNK_RET it_80275258(UNK_PARAMS); -/* 275270 */ UNK_RET it_80275270(UNK_PARAMS); -/* 275288 */ UNK_RET it_80275288(UNK_PARAMS); -/* 2752D8 */ UNK_RET it_802752D8(UNK_PARAMS); -/* 275328 */ UNK_RET it_80275328(UNK_PARAMS); +/* 275210 */ void it_80275210(Item_GObj*); +/* 275228 */ void it_80275228(Item_GObj*); +/* 275240 */ void it_80275240(Item_GObj*); +/* 275258 */ void it_80275258(Item_GObj*); +/* 275270 */ void it_80275270(Item_GObj*); +/* 275288 */ void it_80275288(Item_GObj*, s32, s32); +/* 2752D8 */ void it_802752D8(Item_GObj*, s32, s32); +/* 275328 */ void it_80275328(HSD_GObj*, ItemLink*); /* 275390 */ void it_80275390(Item_GObj*); /* 2753BC */ void it_802753BC(Item_GObj*, s16); /* 2753DC */ void it_802753DC(Item_GObj*); /* 275414 */ void it_80275414(Item_GObj*); -/* 27542C */ UNK_RET it_8027542C(UNK_PARAMS); +/* 27542C */ void it_8027542C(Item_GObj*); /* 275444 */ void it_80275444(Item_GObj*); -/* 275474 */ void it_80275474(Item_GObj* gobj); +/* 275474 */ void it_80275474(Item_GObj*); /* 2754A4 */ void it_802754A4(Item_GObj*); -/* 2754BC */ UNK_RET it_802754BC(UNK_PARAMS); +/* 2754BC */ void it_802754BC(Item_GObj*); /* 2754D4 */ void it_802754D4(Item_GObj*); -/* 275504 */ void it_80275504(Item_GObj* gobj); -/* 275534 */ UNK_RET it_80275534(UNK_PARAMS); -/* 275594 */ UNK_RET it_80275594(UNK_PARAMS); -/* 2755C0 */ UNK_RET it_802755C0(UNK_PARAMS); +/* 275504 */ void it_80275504(Item_GObj*); +/* 275534 */ void it_80275534(Item_GObj*, f32); +/* 275594 */ void it_80275594(Item_GObj*, s32, f32); +/* 2755C0 */ void it_802755C0(Item_GObj*, f32); /* 275640 */ void it_80275640(Item_GObj*, f32); -/* 2756D0 */ void it_802756D0(Item_GObj* gobj); -/* 2756E0 */ void it_802756E0(Item_GObj* gobj); -/* 27570C */ UNK_RET it_8027570C(UNK_PARAMS); -/* 27572C */ UNK_RET it_8027572C(UNK_PARAMS); -/* 27574C */ void it_8027574C(Item_GObj* gobj); -/* 275788 */ UNK_RET it_80275788(UNK_PARAMS); -/* 275820 */ UNK_RET it_80275820(UNK_PARAMS); -/* 275870 */ bool it_80275870(Item_GObj* gobj); -/* 2758D4 */ float it_802758D4(Item_GObj* gobj); -/* 2759DC */ UNK_RET it_802759DC(UNK_PARAMS); -/* 275BC8 */ UNK_RET it_80275BC8(UNK_PARAMS); +/* 2756D0 */ void it_802756D0(Item_GObj*); +/* 2756E0 */ void it_802756E0(Item_GObj*); +/* 27570C */ void it_8027570C(Item_GObj*, s32); +/* 27572C */ void it_8027572C(Item_GObj*, s32); +/* 27574C */ void it_8027574C(Item_GObj*); +/* 275788 */ void it_80275788(Item_GObj*); +/* 275820 */ void it_80275820(Item_GObj*, Vec3*, Vec3*, s32); +/* 275870 */ bool it_80275870(Item_GObj*); +/* 2758D4 */ float it_802758D4(Item_GObj*); +/* 2759DC */ void it_802759DC(Item_GObj*, Item_GObj*); +/* 275BC8 */ void it_80275BC8(Item_GObj*, HSD_GObj*); /* 275D5C */ void it_80275D5C(Item_GObj*, ECB*); /* 275DFC */ void it_80275DFC(Item_GObj*); /* 275E98 */ void it_80275E98(Item_GObj*, SpawnItem*); -/* 276100 */ UNK_RET it_80276100(UNK_PARAMS); -/* 276174 */ UNK_RET it_80276174(UNK_PARAMS); -/* 276214 */ bool it_80276214(Item_GObj*); -/* 276278 */ UNK_RET it_80276278(UNK_PARAMS); +/* 276100 */ void it_80276100(Item_GObj*, Vec3*); +/* 276174 */ void it_80276174(Item_GObj*, Vec3*); +/* 276214 */ void it_80276214(Item_GObj*); +/* 276278 */ void it_80276278(Item_GObj*); /* 2762B0 */ void it_802762B0(Item*); /* 2762BC */ void it_802762BC(Item*); /* 2762D8 */ bool it_802762D8(Item_GObj*); -/* 276308 */ bool it_80276308(Item_GObj*); -/* 276348 */ UNK_RET it_80276348(UNK_PARAMS); -/* 2763B8 */ UNK_RET it_802763B8(UNK_PARAMS); -/* 2763E0 */ bool it_802763E0(Item_GObj*); -/* 276408 */ void it_80276408(Item_GObj*, CollData*, f32*); -/* 27649C */ UNK_RET it_8027649C(UNK_PARAMS); -/* 2765BC */ UNK_RET it_802765BC(UNK_PARAMS); -/* 276934 */ UNK_RET it_80276934(UNK_PARAMS); -/* 276CB8 */ void it_80276CB8(Item_GObj* gobj); +/* 276308 */ s32 it_80276308(Item_GObj*); +/* 276348 */ s32 it_80276348(Item_GObj*, Vec3*); +/* 2763B8 */ bool it_802763B8(Item_GObj*); +/* 2763E0 */ s32 it_802763E0(Item_GObj*); +/* 276408 */ void it_80276408(Item_GObj*, CollData*, Vec3*); +/* 27649C */ f32 it_8027649C(Item_GObj*); +/* 2765BC */ void it_802765BC(Item_GObj*, enum_t); +/* 276934 */ void it_80276934(Item_GObj*, enum_t); +/* 276CB8 */ void it_80276CB8(Item_GObj*); /* 276CEC */ void it_80276CEC(Item_GObj*); -/* 276D9C */ bool it_80276D9C(Item_GObj*, s32); -/* 276FC4 */ void it_80276FC4(Item_GObj*); +/* 276D9C */ bool it_80276D9C(Item_GObj*, enum_t); +/* 276FC4 */ void it_80276FC4(Item_GObj*, s32); /* 277040 */ bool it_80277040(Item_GObj*); -/* 27737C */ void it_8027737C(Item_GObj* gobj, Vec3* pos); +/* 27737C */ void it_8027737C(Item_GObj*, Vec3*); /* 277544 */ bool it_80277544(Item_GObj*); -/* 2775F0 */ UNK_RET it_802775F0(UNK_PARAMS); -/* 27770C */ UNK_RET it_8027770C(UNK_PARAMS); +/* 2775F0 */ void it_802775F0(Item_GObj*, Vec3*); +/* 27770C */ bool it_8027770C(Item_GObj*); /* 27781C */ bool it_8027781C(Item_GObj*); /* 277C40 */ void it_80277C40(Item_GObj*, s32); -/* 277D08 */ UNK_RET it_80277D08(UNK_PARAMS); -/* 277D8C */ UNK_RET fn_80277D8C(UNK_PARAMS); -/* 277F90 */ UNK_RET it_80277F90(UNK_PARAMS); -/* 278108 */ UNK_RET it_80278108(UNK_PARAMS); -/* 278574 */ UNK_RET it_80278574(UNK_PARAMS); +/* 277D08 */ void it_80277D08(void); +/* 277D8C */ void fn_80277D8C(HSD_MObj*, u32); +/* 277F90 */ HSD_TExp* it_80277F90(Item*, HSD_MObj*, HSD_TExp*); +/* 278108 */ void it_80278108(Item*, HSD_MObj*, HSD_TExp*); +/* 278574 */ void it_80278574(HSD_GObj*, GXColor*); /* 27870C */ void it_8027870C(s32); /* 2787B4 */ void it_802787B4(Item_GObj*, s32); -/* 278800 */ UNK_RET it_80278800(UNK_PARAMS); -/* 278F2C */ UNK_RET it_80278F2C(UNK_PARAMS); -/* 2790C0 */ UNK_RET it_802790C0(UNK_PARAMS); -/* 279544 */ UNK_RET it_80279544(UNK_PARAMS); -/* 2795EC */ UNK_RET it_802795EC(UNK_PARAMS); -/* 279680 */ UNK_RET it_80279680(UNK_PARAMS); -/* 2796C4 */ UNK_RET it_802796C4(UNK_PARAMS); -/* 2796FC */ UNK_RET it_802796FC(UNK_PARAMS); -/* 279720 */ UNK_RET it_80279720(UNK_PARAMS); -/* 279744 */ UNK_RET it_80279744(UNK_PARAMS); -/* 279768 */ UNK_RET it_80279768(UNK_PARAMS); -/* 27978C */ UNK_RET it_8027978C(UNK_PARAMS); -/* 279888 */ UNK_RET it_80279888(UNK_PARAMS); -/* 2798D4 */ UNK_RET it_802798D4(UNK_PARAMS); -/* 27990C */ UNK_RET it_8027990C(UNK_PARAMS); -/* 279958 */ UNK_RET it_80279958(UNK_PARAMS); -/* 2799A8 */ UNK_RET it_802799A8(UNK_PARAMS); -/* 2799E4 */ void it_802799E4(Item_GObj* gobj); -/* 279AF0 */ UNK_RET it_80279AF0(UNK_PARAMS); -/* 279B10 */ UNK_RET it_80279B10(UNK_PARAMS); -/* 279B30 */ UNK_RET fn_80279B30(UNK_PARAMS); +/* 278800 */ void it_80278800(Item_GObj*, s32, s32, Vec3*, Vec3*, s32, f32); +/* 278F2C */ void it_80278F2C(Item_GObj*, FtCmdState*); +/* 2790C0 */ void it_802790C0(Item_GObj*, FtCmdState*); +/* 279544 */ void it_80279544(Item_GObj*, FtCmdState*); +/* 2795EC */ void it_802795EC(Item_GObj*, FtCmdState*); +/* 279680 */ void it_80279680(Item_GObj*, FtCmdState*); +/* 2796C4 */ void it_802796C4(Item_GObj*, FtCmdState*); +/* 2796FC */ void it_802796FC(Item_GObj*, FtCmdState*); +/* 279720 */ void it_80279720(Item_GObj*, FtCmdState*); +/* 279744 */ void it_80279744(Item_GObj*, FtCmdState*); +/* 279768 */ void it_80279768(Item_GObj*, FtCmdState*); +/* 27978C */ void it_8027978C(Item_GObj*, FtCmdState*); +/* 279888 */ void it_80279888(Item_GObj*, FtCmdState*); +/* 2798D4 */ void it_802798D4(Item_GObj*, FtCmdState*); +/* 27990C */ void it_8027990C(Item_GObj*, FtCmdState*); +/* 279958 */ void it_80279958(Item_GObj*, FtCmdState*); +/* 2799A8 */ void it_802799A8(Item_GObj*, FtCmdState*); +/* 2799E4 */ void it_802799E4(Item_GObj*); +/* 279AF0 */ void it_80279AF0(Item_GObj*, FtCmdState*); +/* 279B10 */ void it_80279B10(Item_GObj*, FtCmdState*); +/* 279B30 */ void fn_80279B30(Item_GObj*, FtCmdState*); +// /* 279B30 */ void fn_80279B30(Item_GObj*, FtCmdState*, u32); /* 279B64 */ void it_80279B64(Item*); -/* 279B88 */ void it_80279B88(Item* item_data, s32 arg1, s32 arg2); -/* 279BBC */ void it_80279BBC(Item* item_data); -/* 279BE0 */ void it_80279BE0(Item_GObj* gobj); +/* 279B88 */ void it_80279B88(Item*, s32, s32); +/* 279BBC */ void it_80279BBC(Item*); +/* 279BE0 */ void it_80279BE0(Item_GObj*); /* 279C48 */ void it_80279C48(Item_GObj*, Article*); /* 279CDC */ void it_80279CDC(Item_GObj*, f32); -/* 279D38 */ UNK_RET it_80279D38(UNK_PARAMS); -/* 279D5C */ UNK_RET it_80279D5C(UNK_PARAMS); -/* 279E24 */ UNK_RET it_80279E24(UNK_PARAMS); +/* 279D38 */ void it_80279D38(Item_GObj*); +/* 279D5C */ void it_80279D5C(Item_GObj*, f32); +/* 279E24 */ void it_80279E24(Item_GObj*); /* 279FF8 */ void it_80279FF8(Item_GObj*); /* 27A09C */ bool it_8027A09C(Item_GObj*); -/* 27A118 */ bool it_8027A118(Item_GObj*, void (*)(Item_GObj*)); +/* 27A118 */ bool it_8027A118(Item_GObj*, HSD_GObjEvent); /* 27A13C */ void it_8027A13C(Item_GObj*); -/* 27A160 */ void it_8027A160(HSD_JObj* bone, Item*); +/* 27A160 */ void it_8027A160(HSD_JObj*, Item*); /* 27A344 */ void it_8027A344(Item_GObj*); -/* 27A364 */ UNK_RET it_8027A364(UNK_PARAMS); -/* 27A4D4 */ UNK_RET it_8027A4D4(UNK_PARAMS); -/* 27A780 */ UNK_RET it_8027A780(UNK_PARAMS); -/* 27A9B8 */ UNK_RET it_8027A9B8(UNK_PARAMS); -/* 27AAA0 */ UNK_RET it_8027AAA0(UNK_PARAMS); -/* 27AB64 */ UNK_RET it_8027AB64(UNK_PARAMS); -/* 27ADEC */ UNK_T it_8027ADEC(int, Item_GObj*, HSD_JObj*, f32); -/* 27AE34 */ UNK_RET it_8027AE34(UNK_PARAMS); -/* 27AF50 */ UNK_RET it_8027AF50(UNK_PARAMS); -/* 27B070 */ void it_8027B070(Item_GObj* gobj, Fighter_GObj* owner_gobj); +/* 27A364 */ s32 it_8027A364(Item*); +/* 27A4D4 */ s32 it_8027A4D4(Item*); +/* 27A780 */ s32 it_8027A780(Item*, void*); +/* 27A9B8 */ s32 it_8027A9B8(Item*); +/* 27AAA0 */ void it_8027AAA0(Item_GObj*, Item*, s32); +/* 27AB64 */ bool it_8027AB64(Item_GObj*); +/* 27ADEC */ void it_8027ADEC(int, Item_GObj*, HSD_JObj*, f32); +/* 27AE34 */ bool it_8027AE34(Item_GObj*); +/* 27AF50 */ bool it_8027AF50(Item_GObj*); +/* 27B070 */ void it_8027B070(Item_GObj*, Fighter_GObj*); /* 27B0C4 */ void it_8027B0C4(Item_GObj*, SpawnItem*); -/* 27B1F4 */ UNK_RET it_8027B1F4(UNK_PARAMS); -/* 27B288 */ UNK_RET it_8027B288(UNK_PARAMS); -/* 27B330 */ UNK_RET it_8027B330(UNK_PARAMS); -/* 27B378 */ void it_8027B378(Fighter_GObj*, Item_GObj*, float); -/* 27B408 */ UNK_RET it_8027B408(UNK_PARAMS); +/* 27B1F4 */ void it_8027B1F4(Item_GObj*); +// /* 27B1F4 */ void it_8027B1F4(Item_GObj*, int); +/* 27B288 */ void it_8027B288(Item_GObj*, u32); +/* 27B330 */ void it_8027B330(Item_GObj*, u32); +/* 27B378 */ void it_8027B378(Fighter_GObj*, Item_GObj*, f32); +/* 27B408 */ void it_8027B408(Item_GObj*, Item_GObj*, f32); /* 27B4A4 */ void it_8027B4A4(Fighter_GObj*, Item_GObj*); -/* 27B508 */ UNK_RET it_8027B508(UNK_PARAMS); -/* 27B564 */ UNK_RET it_8027B564(UNK_PARAMS); -/* 27B5B0 */ Item_GObj* it_8027B5B0(s32, s32, HSD_JObj*, Vec3*, s32); -/* 27B730 */ void it_8027B730(void); -/* 27B798 */ s32 it_8027B798(Item_GObj*, Vec3*); -/* 27B964 */ UNK_RET it_8027B964(UNK_PARAMS); -/* 27BA54 */ UNK_RET it_8027BA54(UNK_PARAMS); -/* 27BB1C */ UNK_RET it_8027BB1C(UNK_PARAMS); -/* 27BBF4 */ UNK_RET it_8027BBF4(UNK_PARAMS); -/* 27C0A8 */ UNK_RET it_8027C0A8(UNK_PARAMS); -/* 27C0CC */ UNK_RET it_8027C0CC(UNK_PARAMS); -/* 27C0F0 */ UNK_RET it_8027C0F0(UNK_PARAMS); +/* 27B508 */ void it_8027B508(Item_GObj*, Item_GObj*); +/* 27B564 */ void it_8027B564(Item_GObj*); +/* 27B5B0 */ Item_GObj* it_8027B5B0(ItemKind, Vec3*, HSD_JObj*, Vec3*, bool); +/* 27B730 */ void it_8027B730(Item_GObj*); +/* 27B798 */ bool it_8027B798(Item_GObj*, Vec3*); +/* 27B964 */ void it_8027B964(Item_GObj*, bool); +/* 27BA54 */ void it_8027BA54(HSD_GObj*, Vec3*); +/* 27BB1C */ void it_8027BB1C(Vec3*, Vec3*); +/* 27BBF4 */ void it_8027BBF4(Item_GObj*, bool, f64, f32); +/* 27C0A8 */ void it_8027C0A8(Item_GObj*); +/* 27C0CC */ void it_8027C0CC(Item_GObj*); +/* 27C0F0 */ void it_8027C0F0(Item_GObj*, Vec3*, f64, f32); /* 27C56C */ void it_8027C56C(Item_GObj*, f32); /* 27C794 */ bool it_8027C794(void); -/* 27C79C */ UNK_RET it_8027C79C(UNK_PARAMS); -/* 27C824 */ UNK_RET it_8027C824(UNK_PARAMS); +/* 27C79C */ bool it_8027C79C(Item_GObj*); +/* 27C824 */ bool it_8027C824(Item_GObj*, s32 (*arg1)(Item_GObj*)); /* 27C8B0 */ void it_8027C8B0(Item_GObj*); -/* 27C8D0 */ UNK_RET it_8027C8D0(UNK_PARAMS); -/* 27C9D8 */ UNK_RET it_8027C9D8(UNK_PARAMS); -/* 27CA7C */ UNK_RET it_8027CA7C(UNK_PARAMS); -/* 27CAD8 */ UNK_RET it_8027CAD8(UNK_PARAMS); -/* 27CB3C */ UNK_RET it_8027CB3C(UNK_PARAMS); -/* 27CBA4 */ UNK_RET it_8027CBA4(UNK_PARAMS); +/* 27C8D0 */ void it_8027C8D0(Vec3*, Vec3*, f32); +/* 27C9D8 */ void it_8027C9D8(Item*); +/* 27CA7C */ bool it_8027CA7C(HSD_GObj*); +/* 27CAD8 */ void it_8027CAD8(Item_GObj*); +/* 27CB3C */ void it_8027CB3C(Item_GObj*); +/* 27CBA4 */ void it_8027CBA4(Item_GObj*); /* 27CBFC */ f32 it_8027CBFC(Item_GObj*); -/* 27CC88 */ UNK_RET it_8027CC88(UNK_PARAMS); -/* 27CE18 */ UNK_RET it_8027CE18(UNK_PARAMS); +/* 27CC88 */ Item_GObj* it_8027CC88(Item_GObj*); +/* 27CE18 */ void it_8027CE18(Item_GObj*); /* 27CE44 */ void it_8027CE44(Item_GObj*); -/* 27CE64 */ void it_8027CE64(Item_GObj*, Item_GObj*, s32); +/* 27CE64 */ void it_8027CE64(Item_GObj*, HSD_GObj*, void*); /* 3F14C4 */ extern struct ItemLogicTable it_803F14C4[43]; /* 3F23CC */ extern struct ItemLogicTable it_803F23CC[]; /* 3F3100 */ extern struct ItemLogicTable it_803F3100[118]; /* 3F4D20 */ extern struct ItemLogicTable it_803F4D20[]; -/* 4D6D18 */ extern s32 it_804D6D18; +/* 4A0E30 */ extern HSD_ObjAllocUnk4 it_804A0E30; +/* 4A0E50 */ extern HSD_ObjAllocUnk6 it_804A0E50; +/* 4A0E60 */ extern HSD_ObjAllocUnk6 it_804A0E60; +/* 4A0F60 */ extern Article* it_804A0F60[]; +/* 4D6D00 */ extern s8 it_804D6D00; +/* 4D6D08 */ extern s32 it_804D6D08; +/* 4D6D0C */ extern s32 it_804D6D0C; +/* 4D6D10 */ extern u32 it_804D6D10; +/* 4D6D14 */ extern uint it_804D6D14; +/* 4D6D18 */ extern u32 it_804D6D18; +/* 4D6D24 */ extern Article** it_804D6D24; +/* 4D6D28 */ extern ItemCommonData* it_804D6D28; +/* 4D6D30 */ extern Article** it_804D6D30; +/* 4D6D38 */ extern Article** it_804D6D38; #endif diff --git a/src/melee/it/it_3F14.c b/src/melee/it/it_3F14.c index 9026194473..24d5d36392 100644 --- a/src/melee/it/it_3F14.c +++ b/src/melee/it/it_3F14.c @@ -1,838 +1,838 @@ -#include +// #include -#include "it_266F.h" +// #include "it_266F.h" -#include "it/types.h" -#include "items/itbat.h" -#include "items/itbombhei.h" -#include "items/itbox.h" -#include "items/itcapsule.h" -#include "items/itdkinoko.h" -#include "items/itdosei.h" -#include "items/itegg.h" -#include "items/itevyoshiegg.h" -#include "items/itfflower.h" -#include "items/itfflowerflame.h" -#include "items/itflipper.h" -#include "items/itfoods.h" -#include "items/itfreeze.h" -#include "items/itgshell.h" -#include "items/ithammer.h" -#include "items/ithammerhead.h" -#include "items/itharisen.h" -#include "items/itheart.h" -#include "items/itkinoko.h" -#include "items/itkusudama.h" -#include "items/itlgun.h" -#include "items/itlgunbeam.h" -#include "items/itlgunray.h" -#include "items/itlipstick.h" -#include "items/itlipstickspore.h" -#include "items/itmball.h" -#include "items/itmetalb.h" -#include "items/itmsbomb.h" -#include "items/itparasol.h" -#include "items/itrabbitc.h" -#include "items/itrshell.h" -#include "items/itscball.h" -#include "items/itspycloak.h" -#include "items/itsscope.h" -#include "items/itsscopebeam.h" -#include "items/itstar.h" -#include "items/itstarrod.h" -#include "items/itstarrodstar.h" -#include "items/itsword.h" -#include "items/ittaru.h" -#include "items/ittarucann.h" -#include "items/ittomato.h" -#include "items/itwstar.h" +// #include "it/types.h" +// #include "items/itbat.h" +// #include "items/itbombhei.h" +// #include "items/itbox.h" +// #include "items/itcapsule.h" +// #include "items/itdkinoko.h" +// #include "items/itdosei.h" +// #include "items/itegg.h" +// #include "items/itevyoshiegg.h" +// #include "items/itfflower.h" +// #include "items/itfflowerflame.h" +// #include "items/itflipper.h" +// #include "items/itfoods.h" +// #include "items/itfreeze.h" +// #include "items/itgshell.h" +// #include "items/ithammer.h" +// #include "items/ithammerhead.h" +// #include "items/itharisen.h" +// #include "items/itheart.h" +// #include "items/itkinoko.h" +// #include "items/itkusudama.h" +// #include "items/itlgun.h" +// #include "items/itlgunbeam.h" +// #include "items/itlgunray.h" +// #include "items/itlipstick.h" +// #include "items/itlipstickspore.h" +// #include "items/itmball.h" +// #include "items/itmetalb.h" +// #include "items/itmsbomb.h" +// #include "items/itparasol.h" +// #include "items/itrabbitc.h" +// #include "items/itrshell.h" +// #include "items/itscball.h" +// #include "items/itspycloak.h" +// #include "items/itsscope.h" +// #include "items/itsscopebeam.h" +// #include "items/itstar.h" +// #include "items/itstarrod.h" +// #include "items/itstarrodstar.h" +// #include "items/itsword.h" +// #include "items/ittaru.h" +// #include "items/ittarucann.h" +// #include "items/ittomato.h" +// #include "items/itwstar.h" -struct sdata_ItemGXLink it_803F1418[] = { - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_80284E10, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, - it_8026EECC, it_8026EECC, it_8026EECC, -}; +// struct sdata_ItemGXLink it_803F1418[] = { +// it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, +// it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, +// it_8026EECC, it_80284E10, it_8026EECC, it_8026EECC, it_8026EECC, +// it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, +// it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, +// it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, +// it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, +// it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, it_8026EECC, +// it_8026EECC, it_8026EECC, it_8026EECC, +// }; -// Common items -struct ItemLogicTable it_803F14C4[ARRAY_SIZE(it_803F1418)] = { - { - // Capsule - it_803F5468, - it_8027CF00, - NULL, - it_8027D1D4, - it_8027D208, - it_8027D230, - it_8027D338, - it_8027D414, - it_8027D450, - it_8027D4F4, - it_8027D4B8, - NULL, - it_8027D614, - it_8027D530, - it_8027D650, - }, - { - // Box - it_803F5850, - it_802861CC, - it_80286208, - it_80286780, - it_80286964, - it_802867B4, - it_80286CB4, - it_80286F04, - it_80286FC8, - it_80286E70, - it_80286D48, - NULL, - NULL, - it_80286DDC, - it_80287084, - }, - { - // Taru - it_803F58E0, - it_80287458, - NULL, - it_80287E68, - it_80287EA8, - it_80287EC8, - it_80288818, - it_80288A98, - NULL, - it_802889F8, - it_802888B8, - NULL, - NULL, - it_80288958, - it_80288C68, - }, - { - // Egg - it_803F5988, - it_80288D98, - NULL, - it_80288F88, - it_80288FBC, - it_80288FDC, - it_80289218, - it_802895A8, - it_80289644, - it_8028950C, - it_802893D4, - NULL, - NULL, - it_80289470, - it_802896AC, - }, - { - // Kusudama - it_803F59F8, - it_80289784, - NULL, - it_8028A93C, - it_8028AB28, - it_8028A970, - it_8028AEA4, - it_8028AFC4, - NULL, - it_8028AF8C, - it_8028AF1C, - NULL, - NULL, - it_8028AF54, - it_8028B06C, - }, - { - // TaruCann - it_803F63C0, - it_80296120, - it_802960E0, - it_8029683C, - it_802968D8, - it_80296930, - it_8029789C, - NULL, - NULL, - it_802978B4, - it_802978A4, - NULL, - NULL, - it_802978AC, - it_802978BC, - }, - { - // BombHei - it_803F54D8, - it_8027D76C, - NULL, - it_8027E0B4, - it_8027E648, - it_80280380, - it_80280DF0, - it_80280E30, - it_80280E9C, - it_802810A4, - it_80281070, - NULL, - it_80281104, - it_802810C4, - it_80281144, - }, - { - // Dosei - it_803F55D0, - it_80281164, - NULL, - it_8028218C, - it_802826F8, - it_802829FC, - it_802839BC, - it_80283588, - it_80282B14, - it_80283A3C, - it_80283A5C, - NULL, - it_80283AA4, - it_80283A80, - it_80283AC4, - }, - { - // Heart - it_803F56C8, - it_80283BEC, - it_80283C48, - it_80283F28, - it_8028402C, - NULL, - NULL, - NULL, - it_8028412C, - NULL, - NULL, - NULL, - NULL, - NULL, - it_80284194, - }, - { - // Tomato - it_803F5740, - it_802842A4, - it_80284324, - it_802844E4, - it_8028454C, - NULL, - NULL, - NULL, - it_802845BC, - NULL, - NULL, - NULL, - NULL, - NULL, - it_80284624, - }, - { - // Star - it_803F57A0, - it_80284644, - NULL, - NULL, - NULL, - NULL, - it_8028482C, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_80284834, - }, - { - // Bat - it_803F57B0, - it_80284910, - NULL, - it_80284AAC, - it_80284B30, - it_80284BA0, - it_80284C78, - NULL, - it_80284C10, - it_80284CAC, - it_80284CCC, - NULL, - it_80284D14, - it_80284CF0, - it_80284D34, - }, - { - // Sword - it_803F5800, - it_80285338, - NULL, - it_80285804, - it_80285B00, - it_80285C78, - it_80285FAC, - NULL, - it_80285DF0, - it_80285FE0, - it_80286000, - NULL, - itSword_BounceOffShield, - it_80286024, - it_80286068, - }, - { - // Parasol - it_803F5AB0, - it_8028B0B8, - NULL, - it_8028B5E8, - it_8028B3C0, - it_8028B3E0, - it_8028B4D4, - NULL, - it_8028B580, - it_8028B540, - it_8028B4F8, - NULL, - it_8028B560, - it_8028B51C, - it_8028B8B8, - }, - { - // G Shell - it_803F5BA8, - it_8028BDAC, - NULL, - it_8028C148, - it_8028C300, - it_8028C1AC, - it_8028CCA8, - it_8028CCCC, - it_8028CB24, - it_8028CD04, - it_8028CD3C, - NULL, - it_8028CF2C, - it_8028CE1C, - it_8028CFC0, - }, - { - // R Shell - it_803F5C48, - it_8028D59C, - NULL, - it_8028D898, - it_8028D9F4, - it_8028D8E0, - it_8028E540, - it_8028E584, - it_8028E3CC, - it_8028E5C8, - it_8028E600, - NULL, - it_8028E684, - it_8028E624, - it_8028E718, - }, - { - // L Gun - it_803F5CC8, - it_8028E738, - NULL, - it_8028E904, - it_8028E9B8, - it_8028E9E0, - it_8028EA54, - NULL, - it_8028EB00, - it_8028EAC0, - it_8028EA78, - NULL, - it_8028EAE0, - it_8028EA9C, - it_8028EB68, - }, - { - // Freeze - it_803F5D28, - it_8028ED50, - it_8028ED10, - it_8028F2B4, - it_8028F318, - it_8028F340, - it_8028F3CC, - it_8028F42C, - NULL, - it_8028F3EC, - it_8028F3D4, - it_8028F3E4, - it_8028F40C, - it_8028F3DC, - it_8028F8C4, - }, - { - // Foods - it_803F5DB0, - it_8028FBE4, - NULL, - it_8028FD7C, - it_8028FDE4, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_8028FE70, - }, - { - // MSBomb - it_803F5E00, - it_8028FED4, - NULL, - it_802900CC, - it_802900F4, - it_80290114, - it_802906E4, - it_80290738, - it_80290794, - it_80290830, - it_802907F0, - NULL, - it_802908A4, - it_80290850, - it_80290918, - }, - { - // Flipper - it_803F5EA8, - it_80290A20, - NULL, - it_80290F8C, - it_80290FC0, - it_80290FE0, - it_802915E8, - it_802919B8, - it_80291B58, - it_80291978, - it_802917C8, - NULL, - it_80291998, - it_802918A0, - it_80291BC0, - }, - { - // S_Scope - it_803F5F40, - it_80291C98, - NULL, - it_8029215C, - it_80292190, - it_802921B8, - it_8029222C, - NULL, - it_802922D8, - it_80292298, - it_80292250, - NULL, - it_802922B8, - it_80292274, - it_80292340, - }, - { - // StarRod - it_803F5F90, - it_80292360, - NULL, - it_80292514, - it_80292548, - it_802925B4, - it_8029266C, - NULL, - it_802926A8, - it_8029274C, - it_80292710, - NULL, - it_802927A8, - it_8029276C, - it_802927C8, - }, - { - // LipStick - it_803F6310, - it_8029570C, - NULL, - it_802958C8, - it_80295908, - it_80295974, - it_80295ACC, - NULL, - it_80295B08, - it_80295BAC, - it_80295B70, - NULL, - it_80295C08, - it_80295BCC, - it_80295C28, - }, - { - // Harisen - it_803F5FF0, - it_8029285C, - NULL, - it_80292A5C, - it_80292A90, - it_80292B2C, - it_80292BCC, - NULL, - it_80292C08, - it_80292CAC, - it_80292C70, - NULL, - it_80292D08, - it_80292CCC, - it_80292D28, - }, - { - // F Flower - it_803F6090, - it_80292E04, - NULL, - it_80293284, - it_802933C4, - it_802933EC, - it_80293488, - NULL, - it_80293534, - it_802934F4, - it_802934AC, - NULL, - it_80293514, - it_802934D0, - it_80293640, - }, - { - // Kinoko - it_803F6110, - it_8029367C, - NULL, - NULL, - NULL, - NULL, - it_802939E0, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802939E8, - }, - { - // DKinoko - it_803F6130, - it_80293A08, - NULL, - NULL, - NULL, - NULL, - it_80293D6C, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - it_80293D74, - }, - { - // Hammer - it_803F6150, - it_80293F58, - NULL, - it_802940FC, - it_802941F8, - NULL, - NULL, - NULL, - it_802942B0, - NULL, - NULL, - NULL, - NULL, - NULL, - it_80294344, - }, - { - // WStar - it_803F61B0, - it_8029451C, - NULL, - it_80294728, - it_80294790, - NULL, - NULL, - NULL, - it_80294A28, - NULL, - NULL, - NULL, - NULL, - NULL, - it_80294A90, - }, - { - // ScBall - it_803F6220, - it_80294AB0, - NULL, - it_80294BE4, - it_80294C14, - it_80294C3C, - it_80294D4C, - NULL, - it_80294CE4, - it_80294D5C, - it_80294D54, - NULL, - it_80294DA0, - it_80294D7C, - it_80294A90, - }, - { - // RabbitC - it_803F6270, - it_80295118, - NULL, - it_8029524C, - it_80295298, - NULL, - NULL, - NULL, - it_80295340, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802953A8, - }, - { - // MetalB - it_803F62C0, - it_802953C8, - NULL, - it_80295524, - it_80295554, - NULL, - NULL, - it_802955E0, - it_80295684, - NULL, - NULL, - NULL, - NULL, - NULL, - it_802956EC, - }, - { - // Spycloak - it_803F6370, - it_80295C48, - NULL, - it_80295D90, - it_80295DC0, - NULL, - NULL, - NULL, - it_80295E4C, - NULL, - NULL, - NULL, - NULL, - NULL, - it_80295EB4, - }, - { - // M Ball - it_803F6488, - it_80297904, - it_802978DC, - it_80297ABC, - it_80297AF0, - it_80297B18, - it_80297BB8, - NULL, - it_80297BF8, - it_802980A0, - it_80298060, - NULL, - it_80298114, - it_802980D4, - it_80298148, - }, - { - // L Gun Ray - it_803F64F8, - NULL, - NULL, - NULL, - NULL, - NULL, - it_80298634, - NULL, - NULL, - it_80298654, - it_8029863C, - it_8029864C, - it_80298828, - it_80298644, - it_802988C4, - }, - { - // Star Rod Star - it_803F6530, - NULL, - NULL, - NULL, - NULL, - NULL, - it_80298BE4, - NULL, - NULL, - it_80298C04, - it_80298BEC, - it_80298BFC, - it_80298CE8, - it_80298BF4, - it_80298DCC, - }, - { - // LipStick Spore - it_803F6680, - NULL, - NULL, - NULL, - NULL, - NULL, - it_8029A600, - NULL, - NULL, - it_8029A620, - it_8029A608, - it_8029A618, - it_8029A704, - it_8029A610, - it_8029A728, - }, - { - // S Scope Beam - it_803F6568, - NULL, - NULL, - NULL, - NULL, - NULL, - it_80299360, - NULL, - NULL, - it_802993A0, - it_80299368, - it_80299378, - it_80299380, - it_80299370, - it_802993C0, - }, - { - // L Gun Beam - it_803F6630, - NULL, - NULL, - NULL, - NULL, - NULL, - it_80299B6C, - NULL, - NULL, - it_80299B74, - it_80299C08, - it_80299C10, - it_80299C18, - it_80299C20, - it_80299C28, - }, - { - // Hammer Head - it_803F6640, - it_80299D4C, - NULL, - it_80299DD0, - it_80299E28, - it_80299E48, - it_8029A0B0, - it_8029A0EC, - NULL, - it_8029A0C8, - it_8029A0B8, - NULL, - NULL, - it_8029A0C0, - it_8029A0F4, - }, - { - // F Flower Flame - it_803F66C8, - it_8029A9FC, - NULL, - it_8029AD1C, - it_8029AD94, - NULL, - NULL, - NULL, - it_8029AF34, - NULL, - NULL, - NULL, - NULL, - NULL, - it_8029B0A8, - }, - { - // EvYoshiEgg - it_803F6728, - it_8029B1AC, - it_8029B188, - it_8029B2F4, - it_8029B328, - it_8029B348, - it_8029B46C, - it_8029B56C, - it_8029B670, - it_8029B52C, - it_8029B4AC, - NULL, - NULL, - it_8029B4EC, - it_8029B6D8, - }, -}; +// // Common items +// struct ItemLogicTable it_803F14C4[ARRAY_SIZE(it_803F1418)] = { +// { +// // Capsule +// it_803F5468, +// it_8027CF00, +// NULL, +// it_8027D1D4, +// it_8027D208, +// it_8027D230, +// it_8027D338, +// it_8027D414, +// it_8027D450, +// it_8027D4F4, +// it_8027D4B8, +// NULL, +// it_8027D614, +// it_8027D530, +// it_8027D650, +// }, +// { +// // Box +// it_803F5850, +// it_802861CC, +// it_80286208, +// it_80286780, +// it_80286964, +// it_802867B4, +// it_80286CB4, +// it_80286F04, +// it_80286FC8, +// it_80286E70, +// it_80286D48, +// NULL, +// NULL, +// it_80286DDC, +// it_80287084, +// }, +// { +// // Taru +// it_803F58E0, +// it_80287458, +// NULL, +// it_80287E68, +// it_80287EA8, +// it_80287EC8, +// it_80288818, +// it_80288A98, +// NULL, +// it_802889F8, +// it_802888B8, +// NULL, +// NULL, +// it_80288958, +// it_80288C68, +// }, +// { +// // Egg +// it_803F5988, +// it_80288D98, +// NULL, +// it_80288F88, +// it_80288FBC, +// it_80288FDC, +// it_80289218, +// it_802895A8, +// it_80289644, +// it_8028950C, +// it_802893D4, +// NULL, +// NULL, +// it_80289470, +// it_802896AC, +// }, +// { +// // Kusudama +// it_803F59F8, +// it_80289784, +// NULL, +// it_8028A93C, +// it_8028AB28, +// it_8028A970, +// it_8028AEA4, +// it_8028AFC4, +// NULL, +// it_8028AF8C, +// it_8028AF1C, +// NULL, +// NULL, +// it_8028AF54, +// it_8028B06C, +// }, +// { +// // TaruCann +// it_803F63C0, +// it_80296120, +// it_802960E0, +// it_8029683C, +// it_802968D8, +// it_80296930, +// it_8029789C, +// NULL, +// NULL, +// it_802978B4, +// it_802978A4, +// NULL, +// NULL, +// it_802978AC, +// it_802978BC, +// }, +// { +// // BombHei +// it_803F54D8, +// it_8027D76C, +// NULL, +// it_8027E0B4, +// it_8027E648, +// it_80280380, +// it_80280DF0, +// it_80280E30, +// it_80280E9C, +// it_802810A4, +// it_80281070, +// NULL, +// it_80281104, +// it_802810C4, +// it_80281144, +// }, +// { +// // Dosei +// it_803F55D0, +// it_80281164, +// NULL, +// it_8028218C, +// it_802826F8, +// it_802829FC, +// it_802839BC, +// it_80283588, +// it_80282B14, +// it_80283A3C, +// it_80283A5C, +// NULL, +// it_80283AA4, +// it_80283A80, +// it_80283AC4, +// }, +// { +// // Heart +// it_803F56C8, +// it_80283BEC, +// it_80283C48, +// it_80283F28, +// it_8028402C, +// NULL, +// NULL, +// NULL, +// it_8028412C, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_80284194, +// }, +// { +// // Tomato +// it_803F5740, +// it_802842A4, +// it_80284324, +// it_802844E4, +// it_8028454C, +// NULL, +// NULL, +// NULL, +// it_802845BC, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_80284624, +// }, +// { +// // Star +// it_803F57A0, +// it_80284644, +// NULL, +// NULL, +// NULL, +// NULL, +// it_8028482C, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_80284834, +// }, +// { +// // Bat +// it_803F57B0, +// it_80284910, +// NULL, +// it_80284AAC, +// it_80284B30, +// it_80284BA0, +// it_80284C78, +// NULL, +// it_80284C10, +// it_80284CAC, +// it_80284CCC, +// NULL, +// it_80284D14, +// it_80284CF0, +// it_80284D34, +// }, +// { +// // Sword +// it_803F5800, +// it_80285338, +// NULL, +// it_80285804, +// it_80285B00, +// it_80285C78, +// it_80285FAC, +// NULL, +// it_80285DF0, +// it_80285FE0, +// it_80286000, +// NULL, +// itSword_BounceOffShield, +// it_80286024, +// it_80286068, +// }, +// { +// // Parasol +// it_803F5AB0, +// it_8028B0B8, +// NULL, +// it_8028B5E8, +// it_8028B3C0, +// it_8028B3E0, +// it_8028B4D4, +// NULL, +// it_8028B580, +// it_8028B540, +// it_8028B4F8, +// NULL, +// it_8028B560, +// it_8028B51C, +// it_8028B8B8, +// }, +// { +// // G Shell +// it_803F5BA8, +// it_8028BDAC, +// NULL, +// it_8028C148, +// it_8028C300, +// it_8028C1AC, +// it_8028CCA8, +// it_8028CCCC, +// it_8028CB24, +// it_8028CD04, +// it_8028CD3C, +// NULL, +// it_8028CF2C, +// it_8028CE1C, +// it_8028CFC0, +// }, +// { +// // R Shell +// it_803F5C48, +// it_8028D59C, +// NULL, +// it_8028D898, +// it_8028D9F4, +// it_8028D8E0, +// it_8028E540, +// it_8028E584, +// it_8028E3CC, +// it_8028E5C8, +// it_8028E600, +// NULL, +// it_8028E684, +// it_8028E624, +// it_8028E718, +// }, +// { +// // L Gun +// it_803F5CC8, +// it_8028E738, +// NULL, +// it_8028E904, +// it_8028E9B8, +// it_8028E9E0, +// it_8028EA54, +// NULL, +// it_8028EB00, +// it_8028EAC0, +// it_8028EA78, +// NULL, +// it_8028EAE0, +// it_8028EA9C, +// it_8028EB68, +// }, +// { +// // Freeze +// it_803F5D28, +// it_8028ED50, +// it_8028ED10, +// it_8028F2B4, +// it_8028F318, +// it_8028F340, +// it_8028F3CC, +// it_8028F42C, +// NULL, +// it_8028F3EC, +// it_8028F3D4, +// it_8028F3E4, +// it_8028F40C, +// it_8028F3DC, +// it_8028F8C4, +// }, +// { +// // Foods +// it_803F5DB0, +// it_8028FBE4, +// NULL, +// it_8028FD7C, +// it_8028FDE4, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_8028FE70, +// }, +// { +// // MSBomb +// it_803F5E00, +// it_8028FED4, +// NULL, +// it_802900CC, +// it_802900F4, +// it_80290114, +// it_802906E4, +// it_80290738, +// it_80290794, +// it_80290830, +// it_802907F0, +// NULL, +// it_802908A4, +// it_80290850, +// it_80290918, +// }, +// { +// // Flipper +// it_803F5EA8, +// it_80290A20, +// NULL, +// it_80290F8C, +// it_80290FC0, +// it_80290FE0, +// it_802915E8, +// it_802919B8, +// it_80291B58, +// it_80291978, +// it_802917C8, +// NULL, +// it_80291998, +// it_802918A0, +// it_80291BC0, +// }, +// { +// // S_Scope +// it_803F5F40, +// it_80291C98, +// NULL, +// it_8029215C, +// it_80292190, +// it_802921B8, +// it_8029222C, +// NULL, +// it_802922D8, +// it_80292298, +// it_80292250, +// NULL, +// it_802922B8, +// it_80292274, +// it_80292340, +// }, +// { +// // StarRod +// it_803F5F90, +// it_80292360, +// NULL, +// it_80292514, +// it_80292548, +// it_802925B4, +// it_8029266C, +// NULL, +// it_802926A8, +// it_8029274C, +// it_80292710, +// NULL, +// it_802927A8, +// it_8029276C, +// it_802927C8, +// }, +// { +// // LipStick +// it_803F6310, +// it_8029570C, +// NULL, +// it_802958C8, +// it_80295908, +// it_80295974, +// it_80295ACC, +// NULL, +// it_80295B08, +// it_80295BAC, +// it_80295B70, +// NULL, +// it_80295C08, +// it_80295BCC, +// it_80295C28, +// }, +// { +// // Harisen +// it_803F5FF0, +// it_8029285C, +// NULL, +// it_80292A5C, +// it_80292A90, +// it_80292B2C, +// it_80292BCC, +// NULL, +// it_80292C08, +// it_80292CAC, +// it_80292C70, +// NULL, +// it_80292D08, +// it_80292CCC, +// it_80292D28, +// }, +// { +// // F Flower +// it_803F6090, +// it_80292E04, +// NULL, +// it_80293284, +// it_802933C4, +// it_802933EC, +// it_80293488, +// NULL, +// it_80293534, +// it_802934F4, +// it_802934AC, +// NULL, +// it_80293514, +// it_802934D0, +// it_80293640, +// }, +// { +// // Kinoko +// it_803F6110, +// it_8029367C, +// NULL, +// NULL, +// NULL, +// NULL, +// it_802939E0, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_802939E8, +// }, +// { +// // DKinoko +// it_803F6130, +// it_80293A08, +// NULL, +// NULL, +// NULL, +// NULL, +// it_80293D6C, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_80293D74, +// }, +// { +// // Hammer +// it_803F6150, +// it_80293F58, +// NULL, +// it_802940FC, +// it_802941F8, +// NULL, +// NULL, +// NULL, +// it_802942B0, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_80294344, +// }, +// { +// // WStar +// it_803F61B0, +// it_8029451C, +// NULL, +// it_80294728, +// it_80294790, +// NULL, +// NULL, +// NULL, +// it_80294A28, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_80294A90, +// }, +// { +// // ScBall +// it_803F6220, +// it_80294AB0, +// NULL, +// it_80294BE4, +// it_80294C14, +// it_80294C3C, +// it_80294D4C, +// NULL, +// it_80294CE4, +// it_80294D5C, +// it_80294D54, +// NULL, +// it_80294DA0, +// it_80294D7C, +// it_80294A90, +// }, +// { +// // RabbitC +// it_803F6270, +// it_80295118, +// NULL, +// it_8029524C, +// it_80295298, +// NULL, +// NULL, +// NULL, +// it_80295340, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_802953A8, +// }, +// { +// // MetalB +// it_803F62C0, +// it_802953C8, +// NULL, +// it_80295524, +// it_80295554, +// NULL, +// NULL, +// it_802955E0, +// it_80295684, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_802956EC, +// }, +// { +// // Spycloak +// it_803F6370, +// it_80295C48, +// NULL, +// it_80295D90, +// it_80295DC0, +// NULL, +// NULL, +// NULL, +// it_80295E4C, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_80295EB4, +// }, +// { +// // M Ball +// it_803F6488, +// it_80297904, +// it_802978DC, +// it_80297ABC, +// it_80297AF0, +// it_80297B18, +// it_80297BB8, +// NULL, +// it_80297BF8, +// it_802980A0, +// it_80298060, +// NULL, +// it_80298114, +// it_802980D4, +// it_80298148, +// }, +// { +// // L Gun Ray +// it_803F64F8, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_80298634, +// NULL, +// NULL, +// it_80298654, +// it_8029863C, +// it_8029864C, +// it_80298828, +// it_80298644, +// it_802988C4, +// }, +// { +// // Star Rod Star +// it_803F6530, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_80298BE4, +// NULL, +// NULL, +// it_80298C04, +// it_80298BEC, +// it_80298BFC, +// it_80298CE8, +// it_80298BF4, +// it_80298DCC, +// }, +// { +// // LipStick Spore +// it_803F6680, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_8029A600, +// NULL, +// NULL, +// it_8029A620, +// it_8029A608, +// it_8029A618, +// it_8029A704, +// it_8029A610, +// it_8029A728, +// }, +// { +// // S Scope Beam +// it_803F6568, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_80299360, +// NULL, +// NULL, +// it_802993A0, +// it_80299368, +// it_80299378, +// it_80299380, +// it_80299370, +// it_802993C0, +// }, +// { +// // L Gun Beam +// it_803F6630, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_80299B6C, +// NULL, +// NULL, +// it_80299B74, +// it_80299C08, +// it_80299C10, +// it_80299C18, +// it_80299C20, +// it_80299C28, +// }, +// { +// // Hammer Head +// it_803F6640, +// it_80299D4C, +// NULL, +// it_80299DD0, +// it_80299E28, +// it_80299E48, +// it_8029A0B0, +// it_8029A0EC, +// NULL, +// it_8029A0C8, +// it_8029A0B8, +// NULL, +// NULL, +// it_8029A0C0, +// it_8029A0F4, +// }, +// { +// // F Flower Flame +// it_803F66C8, +// it_8029A9FC, +// NULL, +// it_8029AD1C, +// it_8029AD94, +// NULL, +// NULL, +// NULL, +// it_8029AF34, +// NULL, +// NULL, +// NULL, +// NULL, +// NULL, +// it_8029B0A8, +// }, +// { +// // EvYoshiEgg +// it_803F6728, +// it_8029B1AC, +// it_8029B188, +// it_8029B2F4, +// it_8029B328, +// it_8029B348, +// it_8029B46C, +// it_8029B56C, +// it_8029B670, +// it_8029B52C, +// it_8029B4AC, +// NULL, +// NULL, +// it_8029B4EC, +// it_8029B6D8, +// }, +// }; diff --git a/src/melee/it/itcoll.c b/src/melee/it/itcoll.c index 8b13789179..831aca7af0 100644 --- a/src/melee/it/itcoll.c +++ b/src/melee/it/itcoll.c @@ -1 +1,1849 @@ +#include +#include "it/itcoll.h" + +#include "inlines.h" +#include "types.h" + +#include "ef/efsync.h" +#include "ft/fighter.h" +#include "ft/ft_0881.h" +#include "ft/ftchangeparam.h" +#include "ft/ftcoll.h" +#include "ft/ftcommon.h" +#include "ft/ftlib.h" +#include "ft/inlines.h" +#include "ftCommon/ftCo_DownAttack.h" +#include "gm/gm_1601.h" +#include "it/it_266F.h" +#include "it/it_26B1.h" +#include "it/it_2725.h" +#include "it/item.h" +#include "lb/lb_00B0.h" +#include "lb/lbaudio_ax.h" +#include "lb/lbcollision.h" +#include "lb/lbvector.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// static s8 it_803F1360[0x16] = "damage log over %d!!\n"; +// static s8 it_803F1378[9] = "itcoll.c"; +static u32 it_803F1384[20] = { + /* unable to generate initializer: unknown type */ + 1000, // .4byte 0x000003E8 + 1002, // .4byte 0x000003EA + 1001, // .4byte 0x000003E9 + 1004, // .4byte 0x000003EC + 1145, // .4byte 0x00000479 + 1005, // .4byte 0x000003ED + 0, // .4byte 0xFFFFFFFF + 0, // .4byte 0xFFFFFFFF + 0, // .4byte 0xFFFFFFFF + 1000, // .4byte 0x000003E8 + 1000, // .4byte 0x000003E8 + 0, // .4byte 0xFFFFFFFF + 0, // .4byte 0xFFFFFFFF + 1046, // .4byte 0x00000416 + 0, // .4byte 0xFFFFFFFF + 0, // .4byte 0xFFFFFFFF + 0, // .4byte NULL + // "item hit num over!\n", // .asciz "item hit num over!\n" + // // .balign 4 + // "item can't init hit!\n", // .asciz "item can't init hit!\n" + // // .balign 4 + // "item dynamics hit num over!\n", // .asciz "item dynamics hit num + // over!\n" +}; + +// static s8 it_804D5170 = "0"; +// static s8 it_804D5174[7] = "jobj.h"; +// static s8 it_804D517C[5] = "jobj"; +// extern u32 it_804D6D18; +extern u8 it_804D6D1C; +// static f32 it_804DC6C8 = 0.0; +// static f32 it_804DC6D0[2] = { 176.0, -0.0 }; +// static f32 it_804DC6D8 = 0.5; +// static f32 it_804DC6DC = -1.0; +// static f32 it_804DC6E0 = 1.0; +// static f32 it_804DC6E4 = 0x7F7FFFFF; +// static f32 it_804DC6E8 = 0.01; +// static f32 it_804DC6F0[2] = { 176.0, 0.0 }; +// static f32 it_804DC6F8 = 2 * M_PI; +// static f32 it_804DC700 = 0.001; +// static f32 it_804DC704 = 0.999; + +// struct LogEntry { +// s32 x0, x4, x8, xC; +// }; +// static const int n_log_entries = 15; +// static const int it_804A0E70_entries = 15; +// extern struct LogEntry it_804A0E70[n_log_entries]; +extern struct HSD_ObjAllocUnk7 it_804A0E70[15]; + +void it_8026F9AC(s32 arg0, void* fighter, HitCapsule* hit, HurtCapsule* hurt) +{ + if (it_804D6D18 < 15U) { + // if (it_804D6D18 < HitElement_Lipstick) { // related? + it_804A0E70[it_804D6D18].x0 = arg0; + it_804A0E70[it_804D6D18].x4 = fighter; + it_804A0E70[it_804D6D18].x8 = hit; + it_804A0E70[it_804D6D18].xC = hurt; + it_804D6D18++; + return; + } + OSReport("damage log over %d!!\n", 15U); + __assert("itcoll.c", 105U, "0"); +} + +void it_8026FA2C(Item* arg_item0, HitCapsule* arg_hit, s32 arg2, + Item* arg_item3, bool arg_chk) +{ + HitCapsule* hit; + u32 index; + u8* cnt; + + index = 0U; + cnt = &it_804D6D1C; + while (index < 4U) { + hit = &arg_item0->x5D4_hitboxes[index].hit; + if ((hit->state != HitCapsule_Disabled) && (hit->x4 == arg_hit->x4) && + lbColl_80008688(hit, arg2, arg_item3) && (arg_chk)) + { + *cnt = 0U; + } + index++; + cnt++; + } +} + +void it_8026FAC4(Item* arg_item0, HitCapsule* arg_hit, s32 arg2, void* arg3, + bool chk) +{ + HSD_GObj* item_gobj; + HitCapsule* hit; + u32 index; + u8* cnt; + Item* item; + PAD_STACK(4); + + if (arg_item0->xAC4_ignoreItemID != 0) { + item_gobj = HSD_GObj_Entities->items; + while (item_gobj != NULL) { + item = GET_ITEM(item_gobj); + if (item->xAC4_ignoreItemID == arg_item0->xAC4_ignoreItemID) { + index = 0U; + // var_r24 = item; + cnt = &it_804D6D1C; + while (index < 4U) { + hit = &item->x5D4_hitboxes[index].hit; + if ((hit->state != HitCapsule_Disabled) && + (hit->x4 == arg_hit->x4) && + lbColl_80008688(hit, arg2, arg3) && chk) + { + *cnt = 0U; + } + index++; + cnt++; + } + } + item_gobj = item_gobj->next; + } + return; + } + index = 0U; + cnt = &it_804D6D1C; + while (index < 4U) { + hit = &arg_item0->x5D4_hitboxes[index].hit; + if ((hit->state != HitCapsule_Disabled) && (hit->x4 == arg_hit->x4) && + lbColl_80008688(hit, arg2, arg3) && chk) + { + *cnt = 0U; + } + index++; + cnt++; + } +} + +void it_8026FC00(Item* arg_item, HitCapsule* arg_hit, s32 arg2, Fighter* arg3) +{ + HSD_GObj* item_gobj; + HitCapsule* hit; + u32 index; + Item* item; + PAD_STACK(8); + + if (arg_item->xAC4_ignoreItemID != 0U) { + item_gobj = HSD_GObj_Entities->items; + while (item_gobj != NULL) { + item = GET_ITEM(item_gobj); + if (item->xAC4_ignoreItemID == arg_item->xAC4_ignoreItemID) { + index = 0U; + while (index < 4U) { + hit = &item->x5D4_hitboxes[index].hit; + if ((hit->state != HitCapsule_Disabled) && + (hit->x4 == arg_hit->x4)) + { + lbColl_80008820(hit, arg2, arg3); + } + index++; + } + } + item_gobj = item_gobj->next; + } + return; + } + index = 0U; + while (index < 4U) { + hit = &arg_item->x5D4_hitboxes[index].hit; + if ((hit->state != HitCapsule_Disabled) && (hit->x4 == arg_hit->x4)) { + lbColl_80008820(hit, arg2, arg3); + } + index++; + } +} + +void it_8026FCF8(Item* arg_item, HitCapsule* arg_hit) +{ + HSD_GObj* item_gobj; + HitCapsule* hit; + bool chk; + u32 index; + Item* item; + PAD_STACK(4); + +#if 0 + if (arg_item->xAC4_ignoreItemID != 0U) { + item_gobj = HSD_GObj_Entities->items; + while (item_gobj != NULL) { + item = GET_ITEM(item_gobj); + if (item->xAC4_ignoreItemID == arg_item->xAC4_ignoreItemID) { + index = 0U; + chk = false; + while (!chk && index < 4U) { + hit = &item->x5D4_hitboxes[index].hit; + if ((hit != arg_hit) && (hit->state != HitCapsule_Disabled) && (hit->x4 == arg_hit->x4)) { + lbColl_CopyHitCapsule(hit, arg_hit); + chk = true; + return; + } + index++; + } + if (chk) { + return; + } + } + item_gobj = item_gobj->next; + } + } + lbColl_80008440(arg_hit); + return; +#elif 0 + if (arg_item->xAC4_ignoreItemID != 0U) { + item_gobj = HSD_GObj_Entities->items; + while (item_gobj != NULL) { + item = GET_ITEM(item_gobj); + if (item->xAC4_ignoreItemID == arg_item->xAC4_ignoreItemID) { + chk = false; + for (index = 0U; index < 4U; index++) { + hit = &item->x5D4_hitboxes[index].hit; + if ((hit != arg_hit) && + (hit->state != HitCapsule_Disabled) && + (hit->x4 == arg_hit->x4)) + { + lbColl_CopyHitCapsule(hit, arg_hit); + return; + } + } + } + item_gobj = item_gobj->next; + } + } + lbColl_80008440(arg_hit); + return; +#else + if (arg_item->xAC4_ignoreItemID != 0U) { + item_gobj = HSD_GObj_Entities->items; + while (item_gobj != NULL) { + item = GET_ITEM(item_gobj); + if (item->xAC4_ignoreItemID == arg_item->xAC4_ignoreItemID) { + index = 0U; + hit = &item->x5D4_hitboxes[index].hit; + if ((hit != arg_hit) && (hit->state != HitCapsule_Disabled) && + (hit->x4 == arg_hit->x4)) + { + lbColl_CopyHitCapsule(hit, arg_hit); + chk = true; + } else { + index++; + hit = &item->x5D4_hitboxes[index].hit; + if ((hit != arg_hit) && + (hit->state != HitCapsule_Disabled) && + (hit->x4 == arg_hit->x4)) + { + lbColl_CopyHitCapsule(hit, arg_hit); + chk = true; + } else { + index++; + hit = &item->x5D4_hitboxes[index].hit; + if ((hit != arg_hit) && + (hit->state != HitCapsule_Disabled) && + (hit->x4 == arg_hit->x4)) + { + lbColl_CopyHitCapsule(hit, arg_hit); + chk = true; + } else { + index++; + hit = &item->x5D4_hitboxes[index].hit; + if ((hit != arg_hit) && + (hit->state != HitCapsule_Disabled) && + (hit->x4 == arg_hit->x4)) + { + lbColl_CopyHitCapsule(hit, arg_hit); + chk = true; + } else { + chk = false; + } + } + } + } + if (chk) { + return; + } + } + item_gobj = item_gobj->next; + } + } + lbColl_80008440(arg_hit); + return; +#endif +} + +void it_8026FE68(Item* arg_item0, HitCapsule* hit1, Item* arg_item2, + HitCapsule* hit3) +{ + Vec3 sp48; + s32 var_r26; + HSD_GObj* item_gobj; + f32 dmg3; + f32 dmg1; + f32 vel_x; + f32 vel_x_mag; + f32 pos_x = 0.0f; + f32 dir; + s32 dmg3_int; + s32 dmg1_int; + Item* item; + PAD_STACK(16); + + sp48.x = 0.5f * (hit1->hurt_coll_pos.x + hit3->hurt_coll_pos.x); + sp48.y = 0.5f * (hit1->hurt_coll_pos.y + hit3->hurt_coll_pos.y); + sp48.z = 0.5f * (hit1->hurt_coll_pos.z + hit3->hurt_coll_pos.z); + dmg3 = hit3->damage; + if (((s32) dmg3 - it_804D6D28->xB4) < (s32) hit1->damage) { + dmg3_int = dmg3; + if (hit3->x41_b5) { + var_r26 = 4; + } else { + var_r26 = 3; + } + if (arg_item2->xAC4_ignoreItemID != 0U) { + item_gobj = HSD_GObj_Entities->items; + while (item_gobj != NULL) { + item = GET_ITEM(item_gobj); + if (item->xAC4_ignoreItemID == arg_item2->xAC4_ignoreItemID) { + it_8026FA2C(item, hit3, var_r26, arg_item0, true); + } + item_gobj = item_gobj->next; + } + } else { + it_8026FA2C(arg_item2, hit3, var_r26, arg_item0, true); + } + if (dmg3_int > arg_item2->xC48) { + arg_item2->xC48 = dmg3_int; + arg_item2->xCF4_fighterGObjUnk = NULL; + arg_item2->xC38 = arg_item2->kind; + arg_item2->xCD4 = arg_item2->pos; + vel_x = arg_item2->x40_vel.x; + if (vel_x < 0.0f) { + vel_x_mag = -vel_x; + } else { + vel_x_mag = vel_x; + } + if (vel_x_mag < it_804D6D28->xD4) { + pos_x = arg_item2->pos.x; + if (pos_x > arg_item0->pos.x) { + dir = -1.0f; + } else { + dir = 1.0f; + } + } else if (vel_x < 0.0f) { + dir = -1.0f; + } else { + dir = 1.0f; + } + arg_item2->xCB8_outDamageDirection = dir; + } + // efSync_Spawn(0x41C, arg_item2->entity, &sp48, pos_x); + efSync_Spawn(0x41C, arg_item2->entity, &sp48, arg_item0); + } + dmg1 = hit1->damage; + if (((s32) dmg1 - it_804D6D28->xB4) < (s32) hit3->damage) { + dmg1_int = dmg1; + if (hit3->x41_b5) { + var_r26 = 4; + } else { + var_r26 = 3; + } + if (arg_item0->xAC4_ignoreItemID != 0U) { + item_gobj = HSD_GObj_Entities->items; + while (item_gobj != NULL) { + item = GET_ITEM(item_gobj); + if (item->xAC4_ignoreItemID == arg_item0->xAC4_ignoreItemID) { + it_8026FA2C(item_gobj->user_data, hit1, var_r26, arg_item2, + false); + } + item_gobj = item_gobj->next; + } + } else { + it_8026FA2C(arg_item0, hit1, var_r26, arg_item2, false); + } + if (dmg1_int > arg_item0->xC48) { + arg_item0->xC48 = dmg1_int; + arg_item0->xCF4_fighterGObjUnk = NULL; + arg_item0->xC38 = arg_item2->kind; + arg_item0->xCD4 = arg_item2->pos; + vel_x = arg_item0->x40_vel.x; + if (vel_x < 0.0f) { + vel_x_mag = -vel_x; + } else { + vel_x_mag = vel_x; + } + if (vel_x_mag < it_804D6D28->xD4) { + pos_x = arg_item0->pos.x; + if (pos_x > arg_item2->pos.x) { + dir = -1.0f; + } else { + dir = 1.0f; + } + } else if (vel_x < 0.0f) { + dir = -1.0f; + } else { + dir = 1.0f; + } + arg_item0->xCB8_outDamageDirection = dir; + } + // efSync_Spawn(0x41C, arg_item2->entity, &sp48, pos_x); + efSync_Spawn(0x41C, arg_item2->entity, &sp48, arg_item0); + } +} + +void it_802701BC(Item_GObj* arg_item_gobj) +{ + HSD_GObj* fighter_gobj; + HitCapsule* arg_hit; + HurtCapsule* hurt; + f32 pos_x; + Fighter* fighter; + Item* arg_item; + u32 it_hit_index; + u32 ft_hit_index; + // Vec2* str; + PAD_STACK(4); + + arg_item = GET_ITEM((HSD_GObj*) arg_item_gobj); + arg_item->grab_victim = 0; + arg_item->xD10 = 3.4028235e38f; + fighter_gobj = HSD_GObj_Entities->fighters; + while (fighter_gobj != NULL) { + fighter = GET_FIGHTER((HSD_GObj*) fighter_gobj); + if ((!ftLib_80086FD4(fighter_gobj, arg_item->owner) || + arg_item->xDCD_flag.b5) && + (!gm_8016B168() || gm_8016B0D4() || arg_item->xDCD_flag.b6 || + (arg_item->x20_team_id != fighter->team)) && + !fighter->x2219_b1 && !fighter->x222A_flag.b0 && + (fighter->x1988 == 0) && (fighter->x198C == 0) && + !fighter->x221D_b6 && !(fighter->x1A6A & arg_item->xD08)) + { + it_hit_index = 0U; + while (it_hit_index < 4U) { + arg_hit = &arg_item->x5D4_hitboxes[it_hit_index].hit; + // str = (Vec2*) &arg_item->x5D4_hitboxes[it_hit_index]; + // arg_hit = (HitCapsule*) &str->x; + if ((arg_hit->state != HitCapsule_Disabled) && + (arg_hit->element == HitElement_Catch) && + ((arg_hit->x40_b2 && (fighter->ground_or_air == GA_Air)) || + (arg_hit->x40_b3 && + (fighter->ground_or_air == GA_Ground))) && + !lbColl_8000ACFC(fighter, arg_hit)) + { + ft_hit_index = 0U; + while (ft_hit_index < fighter->hurt_capsules_len) { + hurt = &fighter->hurt_capsules[ft_hit_index]; + if (hurt->is_grabbable && + lbColl_80007ECC( + arg_hit, &fighter->hurt_capsules[ft_hit_index], + ftCommon_8007F804(fighter), arg_item->scl, + fighter->x34_scale.y, fighter->cur_pos.z)) + { + it_8026FAC4(arg_item, arg_hit, 0, fighter, 0); + pos_x = fighter->cur_pos.x - arg_item->pos.x; + if (pos_x < 0.0f) { + pos_x = -pos_x; + } + if (pos_x < arg_item->xD10) { + arg_item->grab_victim = arg_item->atk_victim = + fighter->gobj; + arg_item->xDD0_flag.b1 = 1; + arg_item->xD10 = pos_x; + } + return; + } + ft_hit_index++; + } + } + it_hit_index++; + } + } + fighter_gobj = fighter_gobj->next; + } +} + +void it_802703E8(Item_GObj* arg_item_gobj) +{ + // HSD_GObj* thrown_hitbox_owner_gobj; + HSD_GObj* fighter_gobj; + HitCapsule* hit; + HurtCapsule* hurt; + // s32 temp_r0_2; + // s32 temp_r0_3; + s32 dmg; + ItemKind kind; + HSD_GObj* arg_item_owner_gobj; + u32 hurt_index; + u32 hit_index; + u8 ft_team; + Item* arg_item; + Fighter* fighter; + + arg_item = arg_item_gobj->user_data; + if (arg_item->xAC8_hurtboxNum != 0) { + fighter_gobj = HSD_GObj_Entities->fighters; + while (fighter_gobj != NULL) { + arg_item_owner_gobj = arg_item->owner; + fighter = fighter_gobj->user_data; + // thrown_hitbox_owner_gobj = fighter->x1064_thrownHitbox.owner; + if (((arg_item_owner_gobj != fighter_gobj) || + arg_item->xDCE_flag.b0) && + ((fighter->x1064_thrownHitbox.owner != NULL) || + (fighter->x1064_thrownHitbox.owner != arg_item_owner_gobj) || + arg_item->xDCE_flag.b0)) + { + // thrown_hitbox_owner_gobj = + // fighter->x1064_thrownHitbox.owner; + if (fighter->x1064_thrownHitbox.owner != NULL) { + ft_team = + ftLib_80086EB4(fighter->x1064_thrownHitbox.owner); + } else { + ft_team = fighter->team; + } + if (!gm_8016B168() || gm_8016B0D4() || + arg_item->xDCE_flag.b1 || + (ft_team != arg_item->x20_team_id)) + { + hit_index = 0U; + // var_r31 = fighter; + while (hit_index < 4U) { + hit = &fighter->x914[hit_index]; + if ((hit->state != HitCapsule_Disabled) && + (hit->element != HitElement_Catch) && + (hit->x42_b7 == 1) && + ((hit->x40_b2 && + (arg_item->ground_or_air == GA_Air)) || + (hit->x40_b3 && + (arg_item->ground_or_air == GA_Ground))) && + !lbColl_8000ACFC(arg_item, hit) && + (arg_item->xD0C != 2)) + { + hurt_index = 0; + // var_r21_2 = arg_item + (0 * 0x44); + while (hurt_index < arg_item->xAC8_hurtboxNum) { + hurt = &arg_item->xACC_itemHurtbox[hurt_index]; + if (lbColl_8000805C(hit, hurt, NULL, 0, + fighter->x34_scale.y, + arg_item->scl, 0.0f)) + { + if (hit->element != HitElement_Inert) { + ftColl_80076808(fighter, hit, 0, + arg_item, 0); + dmg = hit->damage; + fighter->dmg.x1914 = dmg; + arg_item->xCA0 += dmg; + if (dmg > arg_item->xCA4) { + arg_item->xCA4 = dmg; + } + // it_8026F9AC(1, fighter, hit, + // arg_item, hurt); + it_8026F9AC(1, fighter, hit, hurt); + it_8027B378( + (Fighter_GObj*) fighter->gobj, + (Item_GObj*) arg_item->entity, + (f32) dmg); + kind = arg_item->kind; + if ((kind == Pokemon_Random) && + (arg_item->xDD4_itemVar.pokemon + .x0 == 7) && + ((hit->sfx_kind == 1U) || + (hit->sfx_kind == 2U))) + { + lbAudioAx_800237A8(0x61A87, 0x7FU, + 0x40U); + } else if ((kind != Pokemon_Random) || + (arg_item->xDD4_itemVar + .pokemon.x0 != 8) || + ((hit->sfx_kind != 1U) && + (hit->sfx_kind != 2U))) + { + lbColl_80005BB0(hit, -1); + } + } else { + fighter->unk_gobj = + (HSD_GObj*) arg_item_gobj; + } + goto block_cf0; + } else { + // var_r21_2 += 0x44; + hurt_index++; + } + } + } + block_cf0: + hit_index++; + // var_r31 += 0x138; + } + } + } + fighter_gobj = fighter_gobj->next; + } + } +} + +void it_802706D0(Item_GObj* arg_item_gobj) +{ + HSD_GObj* item_gobj; + HitCapsule* hit; + HitCapsule* arg_hit; + // HitCapsule* temp_r4; + f32 pos_x; + f32 dir; + f32 pos_x_mag; + // s32 sfx_kind; + // s32 temp_r0_2; + s32 dmg; + ItemKind kind; + bool chk2; // r17 + s32 var_r28; + bool chk; + s32 var_r5; + // u32 temp_r3_2; + // u32 hit_index; r18 + u32 arg_hurt_index; + u32 arg_hit_index; + u32 hit_index; + // u32 var_r22_3; + u8* cnt; + // u8* var_r22_2; + Item* item; + Item* arg_item; + // void* var_r16; + HurtCapsule* arg_hurt; + // void* var_r21; + // void* var_r23; + // void* var_r23_2; + + // var_r28 = saved_reg_r28; + chk = false; + arg_item = GET_ITEM((HSD_GObj*) arg_item_gobj); + item_gobj = HSD_GObj_Entities->items; + // loop_97: + while (item_gobj != NULL) { + item = item_gobj->user_data; + if ((HSD_GObj*) arg_item_gobj == item_gobj) { + chk = true; + } else if (((arg_item->owner != NULL) || (item->owner != NULL) || + item->xDCD_flag.b7 || arg_item->xDCE_flag.b2) && + (!ftLib_80086960(item->owner) || + !ftLib_80086960(arg_item->owner) || + !ftLib_80086FD4(arg_item->owner, item->owner) || + item->xDCD_flag.b7 || arg_item->xDCE_flag.b2) && + (!gm_8016B168() || gm_8016B0D4() || item->xDCD_flag.b6 || + arg_item->xDCE_flag.b1 || + (item->x20_team_id != arg_item->x20_team_id))) + { + if (chk && !arg_item->xDD0_flag.b1) { + // var_r23 = arg_item; + var_r28 = 0; + arg_hit_index = 0U; + cnt = &it_804D6D1C; + while (arg_hit_index < 4U) { + arg_hit = &arg_item->x5D4_hitboxes[arg_hit_index].hit; + if ((arg_hit->state != HitCapsule_Disabled) && + (arg_hit->element != HitElement_Catch) && + ((arg_hit->x40_b2 && + (item->ground_or_air == GA_Air)) || + (arg_hit->x40_b3 && + (item->ground_or_air == GA_Ground))) && + !lbColl_8000ACFC(item, arg_hit)) + { + *cnt = 1; + var_r28++; + } else { + *cnt = 0; + } + arg_hit_index++; + // arg_item += 0x13C; + cnt++; + } + } + hit_index = 0U; + // var_r21 = item; + while (hit_index < 4U) { + hit = &item->x5D4_hitboxes[hit_index].hit; + if ((hit->state != HitCapsule_Disabled) && + (hit->x42_b7 == 1) && + ((hit->x40_b2 && (arg_item->ground_or_air == GA_Air)) || + (hit->x40_b3 && + (arg_item->ground_or_air == GA_Ground))) && + !lbColl_8000ACFC(arg_item, hit)) + { + if (chk && !arg_item->xDD0_flag.b1 && (var_r28 != 0)) { + // var_r23_2 = arg_item; + chk2 = false; + arg_hit_index = 0U; + cnt = &it_804D6D1C; + // loop_42: + while (arg_hit_index < 4U) { + if (*cnt != 0) { + // temp_r3_2 = hit->element; + arg_hit = + &arg_item->x5D4_hitboxes[arg_hit_index] + .hit; + if ((hit->element == HitElement_Inert) || + (arg_hit->element == HitElement_Inert)) + { + if ((hit->element != arg_hit->element) && + lbColl_80007AFC(hit, arg_hit, + item->scl, + arg_item->scl)) + { + if (hit->element == HitElement_Inert) { + item->xDCE_flag.b6 = 1; + item->toucher = + (HSD_GObj*) arg_item_gobj; + } else { + item->xDCE_flag.b6 = 1; + arg_item->toucher = item->entity; + } + chk2 = true; + goto block_1080; + // } else { + // goto block_55; + } + } else if ((hit->x40_b0 == 1) && + (arg_hit->x40_b0 == 1) && + lbColl_80007AFC(hit, arg_hit, + item->scl, + arg_item->scl)) + { + it_8026FE68(item, hit, arg_item, arg_hit); + chk2 = true; + goto block_1080; + // } else { + // goto block_55; + } + // } else { + // block_55: + } + arg_hit_index++; + cnt++; + // arg_item += 0x13C; + } + // goto loop_42; + // } + // } + block_1080: + if (!chk2) { + goto block_57; + } + } else { + block_57: + if (arg_item->xAC8_hurtboxNum != 0) { + if (hit->element == HitElement_Inert) { + arg_hurt_index = 0U; + // loop_63: + while (arg_hurt_index < + arg_item->xAC8_hurtboxNum) + { + arg_hurt = &arg_item->xACC_itemHurtbox + [arg_hurt_index]; + if (lbColl_80008248(hit, arg_hurt, NULL, + item->scl, + arg_item->scl, 0.0f)) + { + item->xDCE_flag.b6 = 1; + item->toucher = + (HSD_GObj*) arg_item_gobj; + } + // arg_hurt += 0x44; + arg_hurt_index++; + // goto loop_63; + } + } else if (arg_item->xD0C != 2) { + arg_hurt_index = 0; + // var_r16 = arg_item + (0 * 0x44); + // loop_94: + while (arg_hurt_index < + arg_item->xAC8_hurtboxNum) + { + arg_hurt = &arg_item->xACC_itemHurtbox + [arg_hurt_index]; + if (lbColl_8000805C(hit, arg_hurt, NULL, 0, + item->scl, + arg_item->scl, 0.0f)) + { + if (hit->x41_b4) { + var_r5 = 8; + } else { + var_r5 = 0; + } + it_8026FAC4(item, hit, var_r5, + arg_item, 0); + pos_x = item->x40_vel.x; + if (pos_x < 0.0f) { + pos_x_mag = -pos_x; + } else { + pos_x_mag = pos_x; + } + if (pos_x_mag < it_804D6D28->xD4) { + if (item->pos.x > arg_item->pos.x) + { + dir = -1.0f; + } else { + dir = 1.0f; + } + } else if (pos_x < 0.0f) { + dir = -1.0f; + } else { + dir = 1.0f; + } + item->xCB8_outDamageDirection = dir; + dmg = hit->damage; + item->xC34_damageDealt = dmg; + item->xCF4_fighterGObjUnk = NULL; + item->xC38 = arg_item->kind; + item->xCD4 = arg_item->pos; + arg_item->xCA0 = arg_item->xCA0 + dmg; + if (dmg > arg_item->xCA4) { + arg_item->xCA4 = dmg; + } + // it_8026F9AC(2, item, hit, arg_item, + // arg_hurt); + it_8026F9AC(2, item, hit, arg_hurt); + it_8027B408( + (Item_GObj*) item->entity, + (Item_GObj*) arg_item->entity, + dmg); + kind = arg_item->kind; + // sfx_kind = hit->sfx_kind; + if ((kind == Pokemon_Random) && + (arg_item->xDD4_itemVar.pokemon + .x0 == 7) && + ((hit->sfx_kind == 1U) || + (hit->sfx_kind == 2U))) + { + lbAudioAx_800237A8(0x61A87, 0x7FU, + 0x40U); + } else if ((kind != Pokemon_Random) || + (arg_item->xDD4_itemVar + .pokemon.x0 != 8) || + ((hit->sfx_kind != 1U) && + (hit->sfx_kind != 2U))) + { + lbColl_80005BB0(hit, -1); + } + goto block_12f4; + } else { + // arg_hurt += 0x44; + arg_hurt_index++; + // goto loop_94; + } + // goto block_12f4; + } + } + } + } + } + block_12f4: + hit_index++; + // item += 0x13C; + } + } + item_gobj = item_gobj->next; + // goto loop_97; + } +} + +f32 it_80270CD8(Item* arg_item, HitCapsule* arg_hit) +{ + // f32 temp_f0; + // f32 temp_f2; + f32 temp_f4; + f32 ret_val; + ItemAttr* attr; + PAD_STACK(8); + + attr = arg_item->xCC_item_attr; + if (arg_hit->x28 != 0) { + // temp_f2 = it_804D6D28->x80_float[10]; + ret_val = + (0.01f * arg_hit->x24 * + ((it_804D6D28->x80_float[11] * + (attr->x1C_damage_mul * + ((it_804D6D28->x80_float[10] * it_804D6D28->x80_float[8]) + + (it_804D6D28->x80_float[9] * + (it_804D6D28->x80_float[10] * arg_hit->x28))))) + + it_804D6D28->x80_float[12])) + + arg_hit->x2C; + } else { + temp_f4 = arg_item->xC9C + (f32) arg_item->xCA0; + ret_val = + (0.01f * arg_hit->x24 * + ((it_804D6D28->x80_float[11] * + (attr->x1C_damage_mul * + ((it_804D6D28->x80_float[8] * temp_f4) + + (it_804D6D28->x80_float[9] * (arg_hit->damage * temp_f4))))) + + it_804D6D28->x80_float[12])) + + arg_hit->x2C; + } + // temp_f0 = it_804D6D28->x80_float[7]; + if (ret_val >= it_804D6D28->x80_float[7]) { + ret_val = it_804D6D28->x80_float[7]; + } + return ret_val; +} + +void it_80270E30(Item_GObj* arg_item_gobj) +{ + Vec3 sp2C; + f32 sp18; + HSD_ObjAllocUnk7* var_r29; + HSD_GObj* item_owner_gobj; + f32 temp_f0; + // f32 temp_f2; + f32 vel_x; + f32 temp_f7; + f32 dir; + f32 var_f1; + f32 vel_x_mag; + f32 var_f27; + f32 var_f28; + f32 var_f2; + f32 var_f3; + f32 var_f4; + s32 temp_r0_2; + s32 temp_r0_3; + s32 element; + // u32 temp_r0; + u32 index2; + u32 index; + Item* item; + Item* arg_item; + HSD_ObjAllocUnk7* temp_r29; + HitCapsule* hit2; + ItemAttr* attr; + Vec3* hurt_coll_pos; + Fighter* fighter; + HitCapsule* hit; + Item* arg_item2; + PAD_STACK(24); + + // var_r26 = saved_reg_r26; + if (it_804D6D18 != 0U) { + arg_item = arg_item_gobj->user_data; + var_f28 = -1.0f; + index = 0; + var_r29 = &it_804A0E70[index]; + while (index < it_804D6D18) { + hit = var_r29->x8; + attr = arg_item->xCC_item_attr; + // temp_r0 = hit->x28; + if (hit->x28 != 0) { + // temp_f2 = it_804D6D28->x80_float[10]; + var_f2 = + attr->x1C_damage_mul * + ((it_804D6D28->x80_float[10] * it_804D6D28->x80_float[8]) + + (it_804D6D28->x80_float[9] * + (it_804D6D28->x80_float[10] * hit->x28))); + var_f3 = it_804D6D28->x80_float[11]; + var_f4 = 0.01f * hit->x24; + var_f1 = (var_f3 * var_f2) + it_804D6D28->x80_float[0xC]; + var_f27 = (var_f4 * var_f1) + hit->x2C; + } else { + temp_f7 = arg_item->xC9C + (f32) arg_item->xCA0; + var_f3 = it_804D6D28->x80_float[8]; + var_f4 = attr->x1C_damage_mul; + var_f2 = + var_f4 * ((var_f3 * temp_f7) + (it_804D6D28->x80_float[9] * + (hit->damage * temp_f7))); + var_f1 = (it_804D6D28->x80_float[11] * var_f2) + + it_804D6D28->x80_float[12]; + var_f27 = (0.01f * hit->x24 * var_f1) + hit->x2C; + } + temp_f0 = it_804D6D28->x80_float[7]; + if (var_f27 >= temp_f0) { + var_f27 = temp_f0; + } + if (!arg_item->xDCF_flag.b1) { + // temp_r0_2 = arg_item->hold_kind; + if ((arg_item->hold_kind == 4) || (arg_item->hold_kind == 6)) { + sp18 = hit->damage; + hit2 = var_r29->x8; + arg_item2 = arg_item_gobj->user_data; + hurt_coll_pos = &hit2->hurt_coll_pos; + element = *(&it_803F1384[hit2->element]); + switch (element) { /* irregular */ + case 0x3ED: + efSync_Spawn(element, arg_item_gobj, hurt_coll_pos, + arg_item2->facing_dir, var_f1, var_f2, + var_f3, var_f4); + break; + case 0x3E8: + efSync_Spawn(0x3E8, arg_item_gobj, hurt_coll_pos, + &sp18, var_f1, var_f2, var_f3, var_f4); + break; + case 0x479: + case 0x416: + case 0x3EB: + efSync_Spawn(element, arg_item_gobj, hurt_coll_pos, + arg_item2, var_f1, var_f2, var_f3, + var_f4); + break; + } + } else { + sp2C = hit->hurt_coll_pos; + efSync_Spawn(0x3E8, arg_item_gobj, &sp2C, + var_r29->x8->damage, var_f1, var_f2, var_f3, + var_f4); + } + } + if (var_f27 > var_f28) { + var_f28 = var_f27; + index2 = index; + } + // var_r29 += 0x10; + index++; + } + temp_r29 = &it_804A0E70[index2]; + switch (temp_r29->x0) { /* switch 1; irregular */ + case 1: + fighter = temp_r29->x4; + arg_item->xCB0_source_ply = (s32) fighter->player_id; + arg_item->xCEC_fighterGObj = fighter->gobj; + arg_item->xCF0_itemGObj = NULL; + if (arg_item->pos.x > fighter->cur_pos.x) { + dir = -1.0f; + } else { + dir = 1.0f; + } + arg_item->xCCC_incDamageDirection = dir; + it_8027B4A4((Fighter_GObj*) fighter->gobj, arg_item_gobj); + break; + case 2: + item = temp_r29->x4; + item_owner_gobj = item->owner; + if ((item_owner_gobj != NULL) && ftLib_80086960(item_owner_gobj)) { + arg_item->xCB0_source_ply = + (s32) ((Fighter*) item_owner_gobj->user_data)->player_id; + arg_item->xCEC_fighterGObj = NULL; + arg_item->xCF0_itemGObj = item_owner_gobj; + } else { + arg_item->xCB0_source_ply = 6; + arg_item->xCEC_fighterGObj = NULL; + arg_item->xCF0_itemGObj = NULL; + } + arg_item->xCB4 = item->kind; + arg_item->xCE0 = item->pos; + vel_x = item->x40_vel.x; + if (vel_x < 0.0f) { + vel_x_mag = -vel_x; + } else { + vel_x_mag = vel_x; + } + if (vel_x_mag < it_804D6D28->x78_float) { + if (arg_item->pos.x > item->pos.x) { + dir = -1.0f; + } else { + dir = 1.0f; + } + } else if (vel_x < 0.0f) { + dir = 1.0f; + } else { + dir = -1.0f; + } + arg_item->xCCC_incDamageDirection = dir; + it_8027B508((Item_GObj*) item->entity, arg_item_gobj); + break; + } + arg_item->xCAC_angle = ((HitCapsule*) temp_r29->x8)->kb_angle; + arg_item->xCC8_knockback = var_f28; + arg_item->xCC4 = ((HitCapsule*) temp_r29->x8)->element; + arg_item->xDCF_flag.b6 = ((HitCapsule*) temp_r29->x8)->x43_b0; + } +} + +void it_8027129C(Item_GObj* arg_item_gobj, s32 index) +{ + s32 state; + HitCapsule* hit; + Item* item; + + item = arg_item_gobj->user_data; + hit = &item->x5D4_hitboxes[index].hit; + state = hit->state; + switch (state) { + case HitCapsule_Enabled: + lb_8000B1CC(hit->jobj, &hit->b_offset, &hit->x4C); + hit->x58 = hit->x4C; + hit->state = HitCapsule_Unk2; + item->xDAA_flag.b2 = 1; + return; + case HitCapsule_Unk2: + hit->state = HitCapsule_Unk3; + /* fallthrough */ + case HitCapsule_Unk3: + hit->x58 = hit->x4C; + lb_8000B1CC(hit->jobj, &hit->b_offset, &hit->x4C); + /* fallthrough */ + case 4: // HitCapsule_Max: + case HitCapsule_Disabled: + return; + } +} + +void it_8027137C(Item_GObj* arg_item_gobj) +{ + u32 index; + HitCapsule* hit; + Item* arg_item; + + index = 0U; + while (index < 4U) { + arg_item = arg_item_gobj->user_data; + hit = &arg_item->x5D4_hitboxes[index].hit; + switch (hit->state) { + case 4: // HitCapsule_Max: + case HitCapsule_Disabled: + break; + case HitCapsule_Enabled: + lb_8000B1CC(hit->jobj, &hit->b_offset, &hit->x4C); + hit->x58 = hit->x4C; + hit->state = HitCapsule_Unk2; + arg_item->xDAA_flag.b2 = 1; + break; + case HitCapsule_Unk2: + hit->state = HitCapsule_Unk3; + /* fallthrough */ + case HitCapsule_Unk3: + hit->x58 = hit->x4C; + lb_8000B1CC(hit->jobj, &hit->b_offset, &hit->x4C); + break; + } + index++; + } +} + +void it_8027146C(Item_GObj* item_gobj) +{ + u32 index; + Item* item; + HitCapsule* hit; + + item = item_gobj->user_data; + index = 0U; + while (index < 4U) { + hit = &item->x5D4_hitboxes[index].hit; + lbColl_80008A5C(hit); + index++; + } +} + +void it_802714C0(Item_GObj* item_gobj) +{ + u32 index; + Item* item; + HurtCapsule* hurt; + + item = item_gobj->user_data; + index = 0U; + while (index < item->xAC8_hurtboxNum) { + hurt = &item->xACC_itemHurtbox[index]; + hurt->skip_update_pos = 0; + index++; + } + item->xDAA_flag.b1 = 1; +} + +void it_80271508(Item_GObj* item_gobj, HurtCapsuleState state) +{ + u32 index; + Item* item; + HurtCapsule* hurt; + + item = item_gobj->user_data; + index = 0U; + while (index < item->xAC8_hurtboxNum) { + hurt = &item->xACC_itemHurtbox[index]; + hurt->state = state; + index++; + } +} + +void it_80271534(Item_GObj* item_gobj, s32 index, HurtCapsule* arg_hurt) +{ + HurtCapsule* hurt; + Item* item; + + item = item_gobj->user_data; + if (item->xC4_article_data->x8_hurtbox != 0U) { + hurt = &item->xACC_itemHurtbox[index]; + hurt->a_offset = arg_hurt->a_offset; + hurt->b_offset = arg_hurt->b_offset; + hurt->scale = arg_hurt->scale; + } +} + +void it_80271590(Item_GObj* item_gobj, s32 index, HurtCapsule* arg_hurt) +{ + Vec3 sp18; + HurtCapsule* hurt; + Item* item; + // PAD_STACK(8); + + item = GET_ITEM((HSD_GObj*) item_gobj); + if (item->xC4_article_data->x8_hurtbox != 0U) { + hurt = &item->xACC_itemHurtbox[index]; + arg_hurt->a_offset = hurt->a_offset; + arg_hurt->b_offset = hurt->b_offset; + arg_hurt->scale = hurt->scale; + return; + } + sp18.x = sp18.y = sp18.z = 0.0f; + arg_hurt->a_offset = sp18; + arg_hurt->b_offset = sp18; + arg_hurt->scale = 0.0f; +} + +void it_8027163C(Item_GObj* item_gobj) +{ + s32 bone_id; + // s32 var_r29; + s32 index; + BoneDynamicsDesc* bone_dyn_desc; + char* temp_r3; + u32 cnt; + // u32 var_r6; + // DynamicsDesc* dyn_desc; + HurtCapsule* hurt; + ItemDynamics* it_dynams; + ItemDynamics* it_hurtbox; + Article* article; + Item* item; + // void* var_r30; + // void* var_r4; + + item = item_gobj->user_data; + temp_r3 = "damage log over %d!!\n"; + article = item->xC4_article_data; + it_hurtbox = (ItemDynamics*) article->x8_hurtbox; + it_dynams = article->x14_dynamics; + if (it_hurtbox != NULL) { + if (it_hurtbox->count > 2) { + // OSReport(temp_r3 + 0x68, item); + OSReport(temp_r3 + 0x68, item_gobj->user_data); + __assert(temp_r3 + 0x18, 0x3F4U, "0"); + } + // var_r30 = item; + cnt = 0U; + item->xAC8_hurtboxNum = it_hurtbox->count; + // var_r29 = 0; + index = 0; + // loop_10: + while (cnt < (u32) it_hurtbox->count) { + hurt = &item->xACC_itemHurtbox[index]; + // var_r30->unkACC = 0; + item->xACC_itemHurtbox[index].state = HurtCapsule_Enabled; + // item->xACC_itemHurtbox[0] = NULL; + // temp_r23 = it_hurtbox->unk4 + var_r29; + bone_dyn_desc = + &it_hurtbox + ->dyn_descs[index]; // Code indicates that a larger struct + // is being iterated instead (size 32 + // bytes instead of 24) + if (bone_dyn_desc->bone_id != 0) { + if (item->xBBC_dynamicBoneTable == NULL) { + OSReport(temp_r3 + 0x7C); + __assert(temp_r3 + 0x18, 0x402U, "0"); + } + hurt->bone = + item->xBBC_dynamicBoneTable->bones[bone_dyn_desc->bone_id]; + } else { + hurt->bone = item_gobj->hsd_obj; + } + // var_r30 += 0x44; + index++; + // var_r29 += 0x20; + cnt++; + // hurt->a_offset = (s32) bone_dyn_desc->unk4; + // hurt->a_offset = (Vec3) ((u8) &bone_dyn_desc->dyn_desc.data->_4 + // + 0x0); + hurt->a_offset = + ((HurtCapsule*) bone_dyn_desc->dyn_desc.data)->a_offset; + // hurt->unk8 = (s32) bone_dyn_desc->unk8; + // hurt->unkC = (s32) bone_dyn_desc->unkC; + // hurt->b_offset = (s32) bone_dyn_desc->unk10; + hurt->b_offset = + ((HurtCapsule*) bone_dyn_desc->dyn_desc.data)->b_offset; + // hurt->unk14 = (s32) bone_dyn_desc->unk14; + // hurt->unk18 = (s32) bone_dyn_desc->unk18; + // hurt->scale = (f32) bone_dyn_desc->unk1C; + hurt->scale = ((HurtCapsule*) bone_dyn_desc->dyn_desc.data)->scale; + // goto loop_10; + } + } else { + item->xAC8_hurtboxNum = 0; + } + if (it_dynams != NULL) { + // if ((s32) it_dynams->unk8 > 2) { // ItemDynamics is only 8 bytes + // long? + if ((s32) it_dynams->count > 2) { + OSReport(temp_r3 + 0x94); + __assert(temp_r3 + 0x18, 0x415U, "0"); + } + cnt = 0U; + // var_r4 = item; + // item->xB68 = (s8) it_dynams->unk8; + item->xB68 = (s8) it_dynams->count; + index = 0; + // loop_18: + // if (cnt < (u32) it_dynams->unk8) { + while (cnt < (u32) it_dynams->count) { + cnt++; + // bone_dyn_desc = it_dynams->unkC + index; + bone_dyn_desc = &it_dynams->dyn_descs[index]; + bone_id = bone_dyn_desc->bone_id; + // index += 0x14; + index++; + item->xB6C_vars[cnt].xB90 = bone_id; + item->xB6C_vars[cnt].xB7C = + item->xBBC_dynamicBoneTable->bones[bone_id]; + item->xB6C_vars[cnt].xB6C = + ((AbsorbDesc*) bone_dyn_desc->dyn_desc.data)->x4_offset; + // item->xB6C_vars[cnt].xB70 = (s32) bone_dyn_desc->dyn_desc.count; + // var_r4->unkB74 = (s32) bone_dyn_desc->unkC; + // item->xB6C_vars[cnt].xB74 = (s32) bone_dyn_desc->dyn_desc.pos.x; + // var_r4->unkB78 = (f32) bone_dyn_desc->unk10; + item->xB6C_vars[cnt].xB78 = + ((AbsorbDesc*) bone_dyn_desc->dyn_desc.data)->x10_size; + // var_r4 += 0x28; + // goto loop_18; + } + } +} + +void it_80271830(Item* item, f32 arg_angle) +{ + Vec3 sp68; + Vec3 sp5C; + Vec3 sp50; + Vec3 sp44; + Vec3 sp20; + f32 left_pos; + f32 top_pos; + f32 right_pos; + f32 bottom_pos; + f32 angle; + PAD_STACK(40); + + angle = arg_angle; + sp20.x = 0.0f; + sp20.y = 0.0f; + sp20.z = 1.0f; + while (angle < 0.0f) { + // angle = (f32) ((f64) angle + 6.283185307179586); + angle += 2 * M_PI; + } + // while (angle > (f32) 6.283185307179586) { + while (angle > (2 * M_PI)) { + // angle = (f32) ((f64) angle - 6.283185307179586); + angle -= 2 * M_PI; + } + sp68.y = item->xBEC.top; + sp68.z = 0.0f; + sp68.x = 0.0f; + lbVector_RotateAboutUnitAxis(&sp68, &sp20, angle); + sp5C.y = item->xBEC.bottom; + sp5C.z = 0.0f; + sp5C.x = 0.0f; + lbVector_RotateAboutUnitAxis(&sp5C, &sp20, angle); + sp50.x = item->xBEC.right; + sp50.z = 0.0f; + sp50.y = 0.0f; + lbVector_RotateAboutUnitAxis(&sp50, &sp20, angle); + sp44.x = item->xBEC.left; + sp44.z = 0.0f; + sp44.y = 0.0f; + lbVector_RotateAboutUnitAxis(&sp44, &sp20, angle); + left_pos = sp68.x; + if (left_pos > sp5C.x) { + } else { + left_pos = sp5C.x; + } + if (left_pos > sp50.x) { + } else { + left_pos = sp50.x; + } + if (left_pos > sp44.x) { + } else { + left_pos = sp44.x; + } + item->xBEC.left = left_pos; + top_pos = sp68.y; + if (top_pos > sp5C.y) { + } else { + top_pos = sp5C.y; + } + if (top_pos > sp50.y) { + } else { + top_pos = sp50.y; + } + if (top_pos > sp44.y) { + } else { + top_pos = sp44.y; + } + item->xBEC.top = top_pos; + right_pos = sp68.x; + if (right_pos < sp5C.x) { + } else { + right_pos = sp5C.x; + } + if (right_pos < sp50.x) { + } else { + right_pos = sp50.x; + } + if (right_pos < sp44.x) { + } else { + right_pos = sp44.x; + } + item->xBEC.right = right_pos; + bottom_pos = sp68.y; + if (bottom_pos < sp5C.y) { + } else { + bottom_pos = sp5C.y; + } + if (bottom_pos < sp50.y) { + } else { + bottom_pos = sp50.y; + } + if (bottom_pos < sp44.y) { + } else { + bottom_pos = sp44.y; + } + item->xBEC.bottom = bottom_pos; +} + +void it_80271A58(Item_GObj* item_gobj) +{ + f32 rotate; + Item* item; + HSD_JObj* jobj; + + item = item_gobj->user_data; + item->xBEC = item->xBDC; + if ((item->facing_dir == 1.0f) && (item->xDC8_word.flags.x19 == 1)) { + item->xBEC.left = -item->xBEC.left; + item->xBEC.right = -item->xBEC.right; + } + jobj = it_802746F8(item_gobj); + if (item->xDC8_word.flags.x17 == 0) { + rotate = HSD_JObjGetRotationZ(jobj); + } else if (item->xDC8_word.flags.x17 == 1) { + rotate = HSD_JObjGetRotationX(jobj); + } else { + rotate = HSD_JObjGetRotationY(jobj); + } + it_80271830(item, rotate); +} + +void it_80271B60(Item_GObj* item_gobj) +{ + // s32 sp2C; + // f32 sp28; + Vec3 sp24; + HSD_ObjAllocUnk2* var_r29; + HSD_ObjAllocUnk2* var_r30; + f32 x_float; + f32 x_pos; + f32 y_pos; + f32 x_float_mag; + f32 dir; + bool chk; + u32 cnt; + HSD_JObj* item_jobj; + Item* item; + PAD_STACK(20); + + item_jobj = GET_JOBJ((HSD_GObj*) item_gobj); + item = GET_ITEM((HSD_GObj*) item_gobj); + if (Item_804A0CCC.x154.b0 != 1) { + HSD_JObjGetTranslation(item_jobj, &sp24); + var_r30 = &Item_804A0CCC; + var_r29 = &Item_804A0CCC; + cnt = 0U; + + while (cnt < Item_804A0CCC.x150) { + y_pos = var_r29->xC0_vec3_arr[cnt].y; + x_pos = var_r29->xC0_vec3_arr[cnt].x; + // M2C_ERROR(/* unknown instruction: cror 0x2, 0x1, 0x2 */); + if (((y_pos + (item->xBEC.top + var_r30->ecb_arr[cnt].top)) >= + sp24.y) && + ((y_pos + (item->xBEC.bottom + + var_r30->ecb_arr[cnt].bottom)) <= sp24.y) && + ((x_pos + (item->xBEC.right + var_r30->ecb_arr[cnt].right)) <= + sp24.x) && + ((x_pos + (item->xBEC.left + var_r30->ecb_arr[cnt].left)) >= + sp24.x)) + { + chk = true; + } else { + chk = false; + } + if (chk) { + x_float = sp24.x - x_pos; + if (x_float < 0.0f) { + x_float_mag = -x_float; + } else { + x_float_mag = x_float; + } + if (x_float_mag < 0.001f) { + if (HSD_Randi(2) != 0) { + dir = 1.0f; + } else { + dir = -1.0f; + } + } else if (x_float < 0.0f) { + dir = -1.0f; + } else { + dir = 1.0f; + } + item->x70_nudge.x = it_804D6D28->x7C_float * dir; + item->xDC0.u8 |= 1; + } + cnt++; + } + } +} + +void it_80271D2C(Item_GObj* arg_item_gobj) +{ + Vec3 sp34; + Vec3 sp28; + HSD_GObj* item_gobj; + f32 x_float; + f32 x_float_mag; + f32 dir; + bool chk; + HSD_JObj* item_jobj; + Item* item; + HSD_JObj* arg_item_jobj; + Item* arg_item; + PAD_STACK(24); + + arg_item_jobj = GET_JOBJ((HSD_GObj*) arg_item_gobj); + arg_item = GET_ITEM((HSD_GObj*) arg_item_gobj); + HSD_JObjGetTranslation(arg_item_jobj, &sp34); + item_gobj = HSD_GObj_Entities->items; + + while (item_gobj != NULL) { + item_jobj = GET_JOBJ((HSD_GObj*) item_gobj); + item = GET_ITEM((HSD_GObj*) item_gobj); + if (((HSD_GObj*) arg_item_gobj != item_gobj) && + !item->xDC8_word.flags.x13 && (item->ground_or_air == GA_Ground) && + !item->xDD1_flag.b0 && + ((item->hold_kind != 3) || + ((item->hold_kind == 3) && + item->xDC8_word.flags + .x1E)) // hold_kind 3 is open palm, facing down(?) + ) + { + HSD_JObjGetTranslation(item_jobj, &sp28); + if ((sp28.y + (arg_item->xBEC.top + item->xBEC.top) >= sp34.y) && + (sp28.y + (arg_item->xBEC.bottom + item->xBEC.bottom) <= + sp34.y) && + (sp28.x + (arg_item->xBEC.right + item->xBEC.right) <= + sp34.x) && + (sp28.x + (arg_item->xBEC.left + item->xBEC.left) >= sp34.x)) + { + chk = true; + } else { + chk = false; + } + if (chk) { + x_float = sp34.x - sp28.x; + if (x_float < 0.0f) { + x_float_mag = -x_float; + } else { + x_float_mag = x_float; + } + if (x_float_mag < 0.001f) { + if (!item->xDC8_word.flags.x1B) { + if (item->x70_nudge.x < 0.0f) { + dir = 1.0f; + } else { + dir = -1.0f; + } + } else if (HSD_Randi(2) != 0) { + dir = 1.0f; + } else { + dir = -1.0f; + } + } else if (x_float < 0.0f) { + dir = -1.0f; + } else { + dir = 1.0f; + } + arg_item->x70_nudge.x = it_804D6D28->x7C_float * dir; + arg_item->xDC0.u8 |= 2; + } + } + item_gobj = item_gobj->next; + } +} + +void it_80271F78(Item_GObj* arg_item_gobj) +{ + Vec3 sp34; + Vec3 sp28; + HSD_GObj* item_gobj; + f32 x_float; + f32 x_float_mag; + f32 dir; + bool chk; + HSD_JObj* item_jobj; + HSD_JObj* arg_item_jobj; + Item* item; + Item* arg_item; + PAD_STACK(24); + + arg_item_jobj = GET_JOBJ((HSD_GObj*) arg_item_gobj); + arg_item = GET_ITEM((HSD_GObj*) arg_item_gobj); + HSD_JObjGetTranslation(arg_item_jobj, &sp34); + item_gobj = HSD_GObj_Entities->items; + + while (item_gobj != NULL) { + item_jobj = GET_JOBJ((HSD_GObj*) item_gobj); + item = GET_ITEM((HSD_GObj*) item_gobj); + if (((HSD_GObj*) arg_item_gobj != item_gobj) && + !item->xDC8_word.flags.x13 && (item->ground_or_air == GA_Ground) && + !item->xDD1_flag.b0 && (it_8026B2B4((Item_GObj*) item_gobj) == 1)) + { + HSD_JObjGetTranslation(item_jobj, &sp28); + if ((sp28.y + (arg_item->xBEC.top + item->xBEC.top) == sp34.y) && + (sp28.y + (arg_item->xBEC.bottom + item->xBEC.bottom) <= + sp34.y) && + (sp28.x + (arg_item->xBEC.right + item->xBEC.right) <= + sp34.x) && + (sp28.x + (arg_item->xBEC.left + item->xBEC.left) >= sp34.x)) + { + chk = true; + } else { + chk = false; + } + if (chk) { + x_float = sp34.x - sp28.x; + if (x_float < 0.0f) { + x_float_mag = -x_float; + } else { + x_float_mag = x_float; + } + if (x_float_mag < 0.001f) { + if (!item->xDC8_word.flags.x1C) { + if (item->x70_nudge.x < 0.0f) { + dir = 1.0f; + } else { + dir = -1.0f; + } + } else if (HSD_Randi(2) != 0) { + dir = 1.0f; + } else { + dir = -1.0f; + } + } else if (x_float < 0.0f) { + dir = -1.0f; + } else { + dir = 1.0f; + } + arg_item->x70_nudge.x = it_804D6D28->x7C_float * dir; + arg_item->xDC0.u8 |= 2; + } + } + item_gobj = item_gobj->next; + } +} + +void it_802721B8(Item_GObj* item_gobj) +{ + u8 temp_r3; + Item* item; + + item = item_gobj->user_data; + item->x70_nudge.z = 0.0f; + item->x70_nudge.y = 0.0f; + item->x70_nudge.x = 0.0f; + item->xDC0.u8 = 0; + if (!item->xDC8_word.flags.x13) { + // temp_r3 = item->unkDCB; + if ((item->xDC8_word.flags.x1A == 1) && + (item->ground_or_air == GA_Ground)) + { + if (item->xDC8_word.flags.x1C) { + it_80271B60(item_gobj); + } + if (item->xDC8_word.flags.x1D) { + it_80271D2C(item_gobj); + } + } + } + if (!item->xDC8_word.flags.x13 && (item->ground_or_air == GA_Ground) && + (it_8026B2B4(item_gobj) == 1)) + { + it_80271F78(item_gobj); + } +} + +void it_80272280(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xDC8_word.flags.x1B = 0; +} + +void it_80272298(Item_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + item->xDC8_word.flags.x1B = 1; +} + +void it_802722B0(Item_GObj* item_gobj) +{ + if ((HSD_GObj*) item_gobj == HSD_GObj_Entities->items) { + ftCo_80098634(&Item_804A0CCC); + Item_804A0CCC.x154.b0 = 0; + } +} + +void it_80272304(Item_GObj* item_gobj) +{ + // void* temp_r4; + u32 cnt; + Item* item; + // void* vars; + + cnt = 0U; + item = item_gobj->user_data; + // vars = temp_r30; + while (cnt < item->xB68) { + // vars = vars + 0xB6C; + // vars = item->xB6C_vars[cnt]; + lb_8000B1CC(item->xB6C_vars[cnt].xB7C, &item->xB6C_vars[cnt].xB6C, + &item->xB6C_vars[cnt].xB84); + // vars += 0x28; + cnt++; + } +} + +HSD_GObj* it_8027236C(Item_GObj* arg_item_gobj) +{ + HSD_GObj* fighter_gobj; + HSD_GObj* unk_owner_gobj; + Item* arg_item; + + arg_item = arg_item_gobj->user_data; + fighter_gobj = arg_item->xCEC_fighterGObj; + if (fighter_gobj != NULL) { + arg_item->owner = fighter_gobj; + arg_item->x20_team_id = ftLib_80086EB4(arg_item->xCEC_fighterGObj); + } else { + unk_owner_gobj = arg_item->xCF0_itemGObj; + if (unk_owner_gobj != NULL) { + arg_item->owner = unk_owner_gobj; + arg_item->x20_team_id = ftLib_80086EB4(arg_item->xCF0_itemGObj); + } else { + arg_item->owner = NULL; + arg_item->x20_team_id = U8_MAX; + } + } + it_8027B1F4(arg_item_gobj); + return arg_item->owner; +} + +HSD_GObj* it_802723FC(Item_GObj* arg_item_gobj) +{ + Item* arg_item; + + arg_item = arg_item_gobj->user_data; + if (ftLib_80086960(arg_item->xCFC)) { + arg_item->owner = arg_item->xCFC; + arg_item->x20_team_id = ftLib_80086EB4(arg_item->owner); + } else { + arg_item->owner = NULL; + arg_item->x20_team_id = U8_MAX; + } + return arg_item->owner; +} + +void it_80272460(HitCapsule* hitbox, u32 damage, Item_GObj* arg_item_gobj) +{ + HSD_GObj* owner_gobj; + u32 dmg; + Item* arg_item; + Fighter* owner; + + dmg = damage; + arg_item = GET_ITEM((HSD_GObj*) arg_item_gobj); + owner_gobj = arg_item->owner; + if (ftLib_80086960(owner_gobj)) { + owner = GET_FIGHTER((HSD_GObj*) owner_gobj); + if (owner->x34_scale.y != 1.0f) { + dmg = (0.999f + ftCo_CalcYScaledKnockback( + Fighter_804D6524, dmg, owner->x34_scale.y, + ((Vec3*) Fighter_804D6524)->y)); + } + hitbox->unk_count = dmg; + hitbox->damage = + ft_80089228(owner, arg_item->xD88_attackID, + arg_item->xD8C_attack_instance, hitbox->unk_count); + return; + } + hitbox->unk_count = dmg; + hitbox->damage = dmg; +} diff --git a/src/melee/it/itcoll.h b/src/melee/it/itcoll.h index 2c79a1aba4..eb521b1663 100644 --- a/src/melee/it/itcoll.h +++ b/src/melee/it/itcoll.h @@ -5,6 +5,33 @@ #include "it/item.h" -HSD_GObj* it_8027236C(Item_GObj*); +/* 26F9AC */ void it_8026F9AC(s32, void*, HitCapsule*, HurtCapsule*); +/* 26FA2C */ void it_8026FA2C(Item*, HitCapsule*, s32, Item*, bool); +/* 26FAC4 */ void it_8026FAC4(Item*, HitCapsule*, s32, void*, bool); +/* 26FC00 */ void it_8026FC00(Item*, HitCapsule*, s32, Fighter*); +/* 26FCF8 */ void it_8026FCF8(Item*, HitCapsule*); +/* 26FE68 */ void it_8026FE68(Item*, HitCapsule*, Item*, HitCapsule*); +/* 2701BC */ void it_802701BC(Item_GObj*); +/* 2703E8 */ void it_802703E8(Item_GObj*); +/* 2706D0 */ void it_802706D0(Item_GObj*); +/* 270CD8 */ f32 it_80270CD8(Item*, HitCapsule*); +/* 270E30 */ void it_80270E30(Item_GObj*); +/* 27129C */ void it_8027129C(Item_GObj*, s32); +/* 27137C */ void it_8027137C(Item_GObj*); +/* 27146C */ void it_8027146C(Item_GObj*); +/* 2714C0 */ void it_802714C0(Item_GObj*); +/* 271508 */ void it_80271508(Item_GObj*, HurtCapsuleState); +/* 271534 */ void it_80271534(Item_GObj*, s32, HurtCapsule*); +/* 271590 */ void it_80271590(Item_GObj*, s32, HurtCapsule*); +/* 27163C */ void it_8027163C(Item_GObj*); +/* 271A58 */ void it_80271A58(Item_GObj*); +/* 2721B8 */ void it_802721B8(Item_GObj*); +/* 272280 */ void it_80272280(Item_GObj*); +/* 272298 */ void it_80272298(Item_GObj*); +/* 2722B0 */ void it_802722B0(Item_GObj*); +/* 272304 */ void it_80272304(Item_GObj*); +/* 27236C */ HSD_GObj* it_8027236C(Item_GObj*); +/* 2723FC */ HSD_GObj* it_802723FC(Item_GObj*); +/* 272460 */ void it_80272460(HitCapsule*, u32, Item_GObj*); #endif diff --git a/src/melee/it/item.c b/src/melee/it/item.c index 51e9dbc0cd..833a67f3b0 100644 --- a/src/melee/it/item.c +++ b/src/melee/it/item.c @@ -15,6 +15,7 @@ #include "gr/grlib.h" #include "gr/stage.h" #include "it/inlines.h" +#include "it/itcoll.h" #include "it/it_2725.h" #include "it/types.h" #include "lb/lb_00B0.h" @@ -578,12 +579,12 @@ static void Item_80267AA8(HSD_GObj* gobj, SpawnItem* spawnItem) item_data->xCB0_source_ply = 6; item_data->xCB4 = -1; item_data->xC38 = -1; - item_data->xCE8 = 0.0f; - item_data->xCE4 = 0.0f; - item_data->xCE0 = 0.0f; - item_data->xCDC = 0.0f; - item_data->xCD8 = 0.0f; - item_data->xCD4 = 0.0f; + item_data->xCE0.z = 0.0f; + item_data->xCE0.y = 0.0f; + item_data->xCE0.x = 0.0f; + item_data->xCD4.z = 0.0f; + item_data->xCD4.y = 0.0f; + item_data->xCD4.x = 0.0f; item_data->xDD0_flag.b1 = 0; item_data->xDC8_word.flags.x14 = 0; item_data->xDC8_word.flags.xE = 0; @@ -1154,7 +1155,7 @@ void Item_80268E40(Item* item_data, struct ItemStateDesc* itemStateDesc) { item_data->x52C_item_script = itemStateDesc->xC_script; item_data->x530 = 0; - item_data->x524 = 0.0f; + item_data->x524_cmd->x0 = 0.0f; } extern struct r13_ColAnimStruct* it_804D6D04; @@ -1253,11 +1254,11 @@ void Item_80268E5C(HSD_GObj* gobj, enum_t msid, Item_StateChangeFlags flags) item_data->x52C_item_script = temp_r29->xC_script; item_data->x530 = 0; - item_data->x524 = 0.0F; + item_data->x524_cmd->x0 = 0.0F; } else if (temp_r23 != NULL && (flags & ITEM_CMD_UPDATE)) { item_data->x52C_item_script = temp_r29->xC_script; item_data->x530 = 0U; - item_data->x524 = 0.0f; + item_data->x524_cmd->x0 = 0.0f; } HSD_JObjAnimAll(item_jobj); @@ -1556,12 +1557,12 @@ static void Item_80269CC4(HSD_GObj* gobj) temp_item->xCFC = 0; temp_item->xCB4 = -1; temp_item->xC38 = -1; - temp_item->xCE8 = 0.0f; - temp_item->xCE4 = 0.0f; - temp_item->xCE0 = 0.0f; - temp_item->xCDC = 0.0f; - temp_item->xCD8 = 0.0f; - temp_item->xCD4 = 0.0f; + temp_item->xCE0.z = 0.0f; + temp_item->xCE0.y = 0.0f; + temp_item->xCE0.x = 0.0f; + temp_item->xCD4.z = 0.0f; + temp_item->xCD4.y = 0.0f; + temp_item->xCD4.x = 0.0f; temp_item->xDCE_flag.b5 = false; temp_item->xDCE_flag.b4 = false; temp_item->xDCC_flag.b1 = false; @@ -1876,7 +1877,7 @@ static void Item_8026A788(HSD_GObj* gobj) it_80272304(gobj); for (i = 0; i < dynamicBonesNum; i++, dynamicBones++) { - lb_8001044C(&dynamicBones->dyn_desc, &item_data->xB6C, item_data->xB68, + lb_8001044C(&dynamicBones->dyn_desc, &item_data->xB6C_vars[0].xB6C.x, item_data->xB68, 0.0f, 0, dynamicBones->flags, 0, 1); } } @@ -2043,7 +2044,7 @@ void Item_8026ABD8(Item_GObj* gobj, Vec3* pos, f32 arg2) it_802731A4(gobj); it_80273B50(gobj, pos); RunCallback(gobj, item_data->xB8_itemLogicTable->dropped); - it_80274198(gobj, 1); + it_80274198(gobj, true); it_802754D4(gobj); if (it_8026B6C8(gobj)) { @@ -2058,7 +2059,7 @@ void Item_8026AC74(HSD_GObj* gobj, Vec3* arg1, Vec3* arg2, f32 arg3) it_802731A4(gobj); it_80273748(gobj, arg1, arg2); RunCallback(gobj, item_data->xB8_itemLogicTable->dropped); - it_802741F4(gobj, 1); + it_802741F4(gobj, true); it_802754D4(gobj); if (it_8026B6C8(gobj)) { @@ -2073,7 +2074,7 @@ void Item_8026AD20(HSD_GObj* gobj, Vec3* arg1, Vec3* arg2, f32 arg3) item_data->xC44 = arg3; it_80273748(gobj, arg1, arg2); RunCallback(gobj, item_data->xB8_itemLogicTable->thrown); - it_802741F4(gobj, 1); + it_802741F4(gobj, true); it_802754D4(gobj); } diff --git a/src/melee/it/items/it_2E5A.c b/src/melee/it/items/it_2E5A.c index bffe59ce8d..5dcc956982 100644 --- a/src/melee/it/items/it_2E5A.c +++ b/src/melee/it/items/it_2E5A.c @@ -3,6 +3,7 @@ #include "types.h" #include "db/db_2253.h" +#include "gm/gm_1601.h" #include "it/inlines.h" #include "it/it_266F.h" #include "it/it_26B1.h" @@ -11,6 +12,7 @@ #include "lb/lb_00B0.h" #include "lb/lbaudio_ax.h" #include "lb/lbvector.h" +#include "mp/mpcoll.h" #include #include @@ -20,19 +22,12 @@ #include #include -s32 gm_8016C6C0(Item_GObj*); /* extern */ -void it_8027321C(Item_GObj*); /* extern */ -void it_80275640(Item_GObj*, f32); /* extern */ -bool it_80276D9C(Item_GObj*, s32); /* extern */ -void it_80277C40(Item_GObj*, s32); /* extern */ -bool mpColl_80048844(CollData*, f32); /* extern */ -bool mpColl_8004CB78(CollData*, Vec3*); /* extern */ -static Vec3 it_803B8718 = { +const Vec3 it_803B8718 = { 0.0f, 0.0f, 0.0f -}; /* unable to generate initializer: unknown type; const */ -static Vec3 it_803B8724 = { +}; +const Vec3 it_803B8724 = { 0.0f, 0.0f, 0.0f -}; /* unable to generate initializer: unknown type; const */ +}; ItemStateTable it_803F8BD8[] = { { 0, it_802E67A8, it_802E67F4, it_802E6824 }, @@ -532,7 +527,7 @@ void it_802E6658(void) { if ((u32) Item_804A0C64.x50 >= it_804D6D28->x20 - 2) { // HSD_ObjAllocUnk.x50 >= ItemCommonData->x20 - 2 - Item_8026A8EC((Item_GObj*) it_80272828(158)); + Item_8026A8EC((Item_GObj*) it_80272828(It_Kind_Unk4)); } } diff --git a/src/melee/it/items/itarwinglaser.h b/src/melee/it/items/itarwinglaser.h index 8b13789179..0faa72c57a 100644 --- a/src/melee/it/items/itarwinglaser.h +++ b/src/melee/it/items/itarwinglaser.h @@ -1 +1,12 @@ +#include +#include "it/forward.h" +#include "it/items/types.h" +extern ItemStateTable it_803F8DE8[]; +void it_802E79C8(Item_GObj*); +bool it_802E838C(Item_GObj*); +bool it_802E8420(Item_GObj*); +bool it_802E838C(Item_GObj*); +bool it_802E8418(Item_GObj*); +bool it_802E85F4(Item_GObj*); +bool it_802E8784(Item_GObj*); diff --git a/src/melee/it/items/itcapsule.h b/src/melee/it/items/itcapsule.h index 1d3bfc7125..4fc0cc9a3b 100644 --- a/src/melee/it/items/itcapsule.h +++ b/src/melee/it/items/itcapsule.h @@ -40,7 +40,7 @@ /* 27D4F4 */ bool it_8027D4F4(Item_GObj*); /* 27D530 */ bool it_8027D530(Item_GObj*); /* 27D614 */ bool it_8027D614(Item_GObj*); -/* 27D650 */ void it_8027D650(Item_GObj* item_gobj, HSD_GObj* ref); +/* 27D650 */ void it_8027D650(Item_GObj*, HSD_GObj*); /* 3F5468 */ extern ItemStateTable it_803F5468[]; #endif diff --git a/src/melee/it/items/itchicorita.c b/src/melee/it/items/itchicorita.c index 74f52b090f..cefa9a36f1 100644 --- a/src/melee/it/items/itchicorita.c +++ b/src/melee/it/items/itchicorita.c @@ -1,33 +1,268 @@ -/// #it_802C9588 +#include "it/forward.h" -void it_802C9618(void) {} +#include "itchicorita.h" -/// #it_802C961C +#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/itchicoritaleaf.h" -/// #it_802C963C +ItemStateTable it_803F7A98[] = { + { 0, it_802C96CC, it_802C9798, it_802C9850 }, + { 1, it_802C990C, it_802C9970, it_802C9A28 }, + { -1, it_802C9AB4, it_802C9AD8, it_802C9AF8 }, +}; -/// #it_802C9670 +void it_802C9588(Item_GObj* item_gobj) +{ + Article* article; + Item* item; + itChicoritaAttr* attr; + PAD_STACK(12); -/// #it_802C96CC + item = GET_ITEM((HSD_GObj*) item_gobj); + article = item->xC4_article_data; + attr = article->x4_specialAttributes; + it_80279C48(item_gobj, article); + item->xDD4_itemVar.chicorita.x60 = -1; + // item->xDBC_itcmd_var4 &= ~0x80; + ((flag32*) item->xDBC_itcmd_var4)->flags.x0 = 0; + it_80279CDC(item_gobj, attr->scale); + item->xDD4_itemVar.chicorita.x64 = 0.0f; + it_802C9A74(item_gobj); + Item_8026AE84(item, 0x2711, 0x7F, 0x40); +} -/// #it_802C9798 +void it_802C9618(HSD_GObj* item_gobj) {} -/// #it_802C9850 +void it_802C961C(Item_GObj* item_gobj, HSD_GObj* ref_gobj) +{ + it_8026B894(item_gobj, ref_gobj); +} -/// #it_802C989C +void it_802C963C(HSD_GObj* item_gobj) +{ + PAD_STACK(8); -/// #it_802C98E4 + it_80273454((Item_GObj*) item_gobj); + it_802C9670((Item_GObj*) item_gobj); +} -/// #it_802C990C +void it_802C9670(Item_GObj* item_gobj) +{ + Item* item; + Article* article; + itChicoritaAttr* attr; -/// #it_802C9970 + item = item_gobj->user_data; + article = item->xC4_article_data; + attr = article->x4_specialAttributes; + if (item->xDD4_itemVar.chicorita.x60 == -1) { + item->xDD4_itemVar.chicorita.x60 = attr->x4; + } + Item_80268E5C((HSD_GObj*) item_gobj, 0, ITEM_ANIM_UPDATE); + item->on_accessory = it_802C989C; +} -/// #it_802C9A28 +bool it_802C96CC(HSD_GObj* item_gobj) +{ + HSD_JObj* item_jobj; + Item* item; + Article* article; + itChicoritaAttr* attr; -/// #it_802C9A74 + item_jobj = GET_JOBJ((HSD_GObj*) item_gobj); + item = GET_ITEM((HSD_GObj*) item_gobj); + if (item_jobj == NULL) { + item_jobj = NULL; + } else { + item_jobj = item_jobj->child; + } + it_8027A160(item_jobj, item); + if (it_80272C6C((Item_GObj*) item_gobj) == 0) { + if (item->xDD4_itemVar.chicorita.x60 <= 0) { + item->xDD4_itemVar.chicorita.x60 = 0; + it_802C98E4((Item_GObj*) item_gobj); + } else { + item->xDD4_itemVar.chicorita.x60--; + item = item_gobj->user_data; + article = item->xC4_article_data; + attr = article->x4_specialAttributes; + if (item->xDD4_itemVar.chicorita.x60 == -1) + { // This check will never succeed? + item->xDD4_itemVar.chicorita.x60 = attr->x4; + } + Item_80268E5C(item_gobj, 0, ITEM_ANIM_UPDATE); + item->on_accessory = it_802C989C; + } + } + return false; +} -/// #it_802C9AB4 +void it_802C9798(HSD_GObj* item_gobj) +{ + Item* item; + ItemAttr* attr; + f32 fall_speed; + s32 fall_speed_dir; + f32 item_vel_y; + s32 item_vel_y_dir; -/// #it_802C9AD8 + item = item_gobj->user_data; + it_8027A344((Item_GObj*) item_gobj); + if (item->ground_or_air == GA_Air) { + attr = item->xCC_item_attr; + fall_speed = attr->x10_fall_speed; + if (fall_speed < 0.0f) { + fall_speed_dir = -1; + } else { + fall_speed_dir = 1; + } + item_vel_y = item->xDD4_itemVar.chicorita.x64; + if (item_vel_y < 0.0f) { + item_vel_y_dir = -1; + } else { + item_vel_y_dir = 1; + } + if (item_vel_y_dir != fall_speed_dir) { + if (item_vel_y < 0.0f) { + item_vel_y = -item_vel_y; + } + if (item_vel_y < attr->x14_fall_speed_max) { + goto block_11; + } + } else { + block_11: + item->xDD4_itemVar.chicorita.x64 -= fall_speed; + } + item->x40_vel.y = item->xDD4_itemVar.chicorita.x64; + return; + } + item->xDD4_itemVar.chicorita.x64 = 0.0f; +} -/// #it_802C9AF8 +bool it_802C9850(HSD_GObj* item_gobj) +{ + if (((Item*) item_gobj->user_data)->ground_or_air == GA_Air) { + it_8026E15C((Item_GObj*) item_gobj, it_802C9618); + } else { + it_8026D62C((Item_GObj*) item_gobj, it_802C9618); + } + return false; +} + +void it_802C989C(HSD_GObj* item_gobj) +{ + Item* item; + + item = item_gobj->user_data; + // if (((u8) item->xDBC_itcmd_var4 >> 7U) & 1) { + // if ((((flag32*) item->xDBC_itcmd_var4)->word >> 7U) & 1) { + // if ((((UnkFlagStruct*) item->xDBC_itcmd_var4)->u8 >> 7U) & 1) { + if (((flag32*) item->xDBC_itcmd_var4)->flags.x0) { + it_802C9B20((Item_GObj*) item_gobj); + // item->xDBC_itcmd_var4 &= ~0x80; + ((flag32*) item->xDBC_itcmd_var4)->flags.x0 = 0; + } +} + +void it_802C98E4(Item_GObj* item_gobj) +{ + Item_80268E5C((HSD_GObj*) item_gobj, 1, ITEM_ANIM_UPDATE); +} + +bool it_802C990C(HSD_GObj* item_gobj) +{ + HSD_JObj* item_jobj; + Item* item; + + item_jobj = GET_JOBJ((HSD_GObj*) item_gobj); + item = GET_ITEM((HSD_GObj*) item_gobj); + if (item_jobj == NULL) { + item_jobj = NULL; + } else { + item_jobj = item_jobj->child; + } + it_8027A160(item_jobj, item); + if (!it_80272C6C((Item_GObj*) item_gobj)) { + return true; + } + return false; +} + +void it_802C9970(HSD_GObj* item_gobj) +{ + Item* item; + ItemAttr* attr; + f32 fall_speed; + s32 fall_speed_dir; + f32 item_vel_y; + s32 item_vel_y_dir; + + item = item_gobj->user_data; + it_8027A344((Item_GObj*) item_gobj); + if (item->ground_or_air == GA_Air) { + attr = item->xCC_item_attr; + fall_speed = attr->x10_fall_speed; + if (fall_speed < 0.0f) { + fall_speed_dir = -1; + } else { + fall_speed_dir = 1; + } + item_vel_y = item->xDD4_itemVar.chicorita.x64; + if (item_vel_y < 0.0f) { + item_vel_y_dir = -1; + } else { + item_vel_y_dir = 1; + } + if (item_vel_y_dir != fall_speed_dir) { + if (item_vel_y < 0.0f) { + item_vel_y = -item_vel_y; + } + if (item_vel_y < attr->x14_fall_speed_max) { + goto block_11; + } + } else { + block_11: + item->xDD4_itemVar.chicorita.x64 -= fall_speed; + } + item->x40_vel.y = item->xDD4_itemVar.chicorita.x64; + return; + } + item->xDD4_itemVar.chicorita.x64 = 0.0f; +} + +bool it_802C9A28(HSD_GObj* item_gobj) +{ + if (((Item*) item_gobj->user_data)->ground_or_air == GA_Air) { + it_8026E15C((Item_GObj*) item_gobj, it_802C9618); + } else { + it_8026D62C((Item_GObj*) item_gobj, it_802C9618); + } + return false; +} + +void it_802C9A74(Item_GObj* item_gobj) +{ + it_802762BC(item_gobj->user_data); + Item_80268E5C((HSD_GObj*) item_gobj, 2, ITEM_ANIM_UPDATE); +} + +bool it_802C9AB4(HSD_GObj* item_gobj) +{ + it_80279FF8((Item_GObj*) item_gobj); + return false; +} + +void it_802C9AD8(HSD_GObj* item_gobj) +{ + it_8027A09C((Item_GObj*) item_gobj); +} + +bool it_802C9AF8(HSD_GObj* item_gobj) +{ + return it_8027A118((Item_GObj*) item_gobj, it_802C963C); +} diff --git a/src/melee/it/items/itchicorita.h b/src/melee/it/items/itchicorita.h index 98983aa1f2..e3e77cf655 100644 --- a/src/melee/it/items/itchicorita.h +++ b/src/melee/it/items/itchicorita.h @@ -1,27 +1,30 @@ #ifndef GALE01_2C9588 #define GALE01_2C9588 +#include +#include + #include "it/forward.h" #include "it/items/types.h" /* 2C9588 */ void it_802C9588(Item_GObj*); -/* 2C9618 */ UNK_RET it_802C9618(UNK_PARAMS); -/* 2C961C */ void it_802C961C(Item_GObj*, Item_GObj*); -/* 2C963C */ UNK_RET it_802C963C(UNK_PARAMS); -/* 2C9670 */ UNK_RET it_802C9670(UNK_PARAMS); -/* 2C96CC */ UNK_RET it_802C96CC(UNK_PARAMS); -/* 2C9798 */ UNK_RET it_802C9798(UNK_PARAMS); -/* 2C9850 */ UNK_RET it_802C9850(UNK_PARAMS); -/* 2C989C */ UNK_RET it_802C989C(UNK_PARAMS); -/* 2C98E4 */ UNK_RET it_802C98E4(UNK_PARAMS); -/* 2C990C */ UNK_RET it_802C990C(UNK_PARAMS); -/* 2C9970 */ UNK_RET it_802C9970(UNK_PARAMS); -/* 2C9A28 */ UNK_RET it_802C9A28(UNK_PARAMS); -/* 2C9A74 */ UNK_RET it_802C9A74(UNK_PARAMS); -/* 2C9AB4 */ UNK_RET it_802C9AB4(UNK_PARAMS); -/* 2C9AD8 */ UNK_RET it_802C9AD8(UNK_PARAMS); -/* 2C9AF8 */ UNK_RET it_802C9AF8(UNK_PARAMS); +/* 2C9618 */ void it_802C9618(HSD_GObj*); +/* 2C961C */ void it_802C961C(Item_GObj*, HSD_GObj*); +/* 2C963C */ void it_802C963C(HSD_GObj*); +/* 2C9670 */ void it_802C9670(Item_GObj*); +/* 2C96CC */ bool it_802C96CC(HSD_GObj*); +/* 2C9798 */ void it_802C9798(HSD_GObj*); +/* 2C9850 */ bool it_802C9850(HSD_GObj*); +/* 2C989C */ void it_802C989C(HSD_GObj*); +/* 2C98E4 */ void it_802C98E4(Item_GObj*); +/* 2C990C */ bool it_802C990C(HSD_GObj*); +/* 2C9970 */ void it_802C9970(HSD_GObj*); +/* 2C9A28 */ bool it_802C9A28(HSD_GObj*); +/* 2C9A74 */ void it_802C9A74(Item_GObj*); +/* 2C9AB4 */ bool it_802C9AB4(HSD_GObj*); +/* 2C9AD8 */ void it_802C9AD8(HSD_GObj*); +/* 2C9AF8 */ bool it_802C9AF8(HSD_GObj*); /* 3F7A98 */ extern ItemStateTable it_803F7A98[]; #endif diff --git a/src/melee/it/items/itchicoritaleaf.c b/src/melee/it/items/itchicoritaleaf.c index 7773f4db0e..af4bb52157 100644 --- a/src/melee/it/items/itchicoritaleaf.c +++ b/src/melee/it/items/itchicoritaleaf.c @@ -1,25 +1,94 @@ -#include -#include - #include "it/forward.h" -/// #it_802C9B20 +#include "itchicoritaleaf.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" + +ItemStateTable it_803F7AC8[] = { + { 0, it_802C9CE8, it_802C9D1C, it_802C9D20 }, +}; -/// #it_802C9C20 +void it_802C9B20(Item_GObj* chicorita_gobj) +{ + SpawnItem spawn; + Item* chicorita; + itChicoritaLeafAttr* attr; + + chicorita = GET_ITEM((HSD_GObj*) chicorita_gobj); + attr = chicorita->xC4_article_data->x4_specialAttributes; + spawn.prev_pos = chicorita->pos; + spawn.prev_pos.x += attr->x8 * chicorita->facing_dir; + spawn.prev_pos.y += attr->xC; + it_8026BB88(chicorita_gobj, &spawn.pos); + spawn.facing_dir = chicorita->facing_dir; + spawn.x3C_damage = 0; + spawn.vel.x = attr->x10 * chicorita->facing_dir; + spawn.vel.z = spawn.vel.y = 0.0f; + spawn.x40 = 0; + spawn.kind = Pokemon_Chicorita_Leaf; + spawn.x0_parent_gobj = chicorita->owner; + spawn.x4_parent_gobj2 = (HSD_GObj*) chicorita_gobj; + spawn.x44_flag.b0 = 1; + if (Item_80268B18(&spawn)) { + Item_8026AE84(chicorita, 0x2710, 0x7F, 0x40); + } +} -bool it_802C9C78(Item_GObj* arg0) +void it_802C9C20(Item_GObj* item_gobj) +{ + Item* item; + PAD_STACK(12); + + item = GET_ITEM((HSD_GObj*) item_gobj); + item->xD44_lifeTimer = + ((itChicoritaLeafAttr*) item->xC4_article_data->x4_specialAttributes) + ->timer; + it_80274740(item_gobj); + it_802C9CC0(item_gobj); + it_8026B3A8(item_gobj); + it_80274C60(item_gobj); +} + +bool it_802C9C78(Item_GObj* item_gobj) { return false; } -/// #it_802C9C80 +void it_802C9C80(Item_GObj* item_gobj, HSD_GObj* ref_gobj) +{ + it_8026B894(item_gobj, ref_gobj); +} + +bool it_802C9CA0(Item_GObj* item_gobj) +{ + return it_80273030(item_gobj); +} -/// #it_802C9CA0 +void it_802C9CC0(Item_GObj* item_gobj) +{ + Item_80268E5C((HSD_GObj*) item_gobj, 0, ITEM_ANIM_UPDATE); +} -/// #it_802C9CC0 +bool it_802C9CE8(HSD_GObj* item_gobj) +{ + Item* item; -/// #it_802C9CE8 + item = item_gobj->user_data; + if (item->xD44_lifeTimer <= 0.0f) { + return true; + } + item->xD44_lifeTimer--; + return false; +} -void it_802C9D1C(void) {} +void it_802C9D1C(HSD_GObj* item_gobj) {} -/// #it_802C9D20 +bool it_802C9D20(HSD_GObj* item_gobj) +{ + return it_8026DFB0((Item_GObj*) item_gobj); +} diff --git a/src/melee/it/items/itchicoritaleaf.h b/src/melee/it/items/itchicoritaleaf.h index 0a6ef12254..6bfc366c10 100644 --- a/src/melee/it/items/itchicoritaleaf.h +++ b/src/melee/it/items/itchicoritaleaf.h @@ -2,20 +2,21 @@ #define GALE01_2C9B20 #include +#include #include "it/forward.h" #include "it/items/types.h" -/* 2C9B20 */ UNK_RET it_802C9B20(UNK_PARAMS); +/* 2C9B20 */ void it_802C9B20(Item_GObj*); /* 2C9C20 */ void it_802C9C20(Item_GObj*); /* 2C9C78 */ bool it_802C9C78(Item_GObj*); -/* 2C9C80 */ void it_802C9C80(Item_GObj*, Item_GObj*); +/* 2C9C80 */ void it_802C9C80(Item_GObj*, HSD_GObj*); /* 2C9CA0 */ bool it_802C9CA0(Item_GObj*); -/* 2C9CC0 */ UNK_RET it_802C9CC0(UNK_PARAMS); -/* 2C9CE8 */ UNK_RET it_802C9CE8(UNK_PARAMS); -/* 2C9D1C */ UNK_RET it_802C9D1C(UNK_PARAMS); -/* 2C9D20 */ UNK_RET it_802C9D20(UNK_PARAMS); +/* 2C9CC0 */ void it_802C9CC0(Item_GObj*); +/* 2C9CE8 */ bool it_802C9CE8(HSD_GObj*); +/* 2C9D1C */ void it_802C9D1C(HSD_GObj*); +/* 2C9D20 */ bool it_802C9D20(HSD_GObj*); /* 3F7AC8 */ extern ItemStateTable it_803F7AC8[]; #endif diff --git a/src/melee/it/items/itcoin.c b/src/melee/it/items/itcoin.c index d185f2457b..f60623d93a 100644 --- a/src/melee/it/items/itcoin.c +++ b/src/melee/it/items/itcoin.c @@ -314,7 +314,7 @@ void it_802F1F48(Item_GObj* gobj) ip = GET_ITEM(gobj); Item_80268E5C(gobj, 5, ITEM_ANIM_UPDATE); - if (ip->x40_vel.x + ip->x7C + ip->x88 >= 0.0F) { + if (ip->x40_vel.x + ip->x7C.x + ip->x88.x >= 0.0F) { item_dir = 1; } else { item_dir = -1; diff --git a/src/melee/it/items/itcoin.h b/src/melee/it/items/itcoin.h index 6628125e77..1f3213fd9b 100644 --- a/src/melee/it/items/itcoin.h +++ b/src/melee/it/items/itcoin.h @@ -8,7 +8,7 @@ #include "it/items/types.h" #include "it/types.h" -/* 2F13B4 */ void it_802F13B4(Item_GObj*, int); +/* 2F13B4 */ void it_802F13B4(HSD_GObj*, int); /* 2F14E4 */ void it_802F14E4(Item_GObj*); /* 2F1518 */ void it_802F1518(Item_GObj*); /* 2F1888 */ void it_802F1888(Item_GObj*); diff --git a/src/melee/it/items/itfoxillusion.h b/src/melee/it/items/itfoxillusion.h index 5c5d7ba7ea..0a7c5fea9e 100644 --- a/src/melee/it/items/itfoxillusion.h +++ b/src/melee/it/items/itfoxillusion.h @@ -9,10 +9,9 @@ #include "it/items/types.h" -/* 29CD18 */ void it_8029CD18(Item_GObj*, int arg1); +/* 29CD18 */ void it_8029CD18(HSD_GObj*, int); /* 29CD78 */ HSD_JObj* it_8029CD78(Item_GObj*); -/* 29CEB4 */ Item_GObj* it_8029CEB4(HSD_GObj* parent, Vec3* pos, ItemKind kind, - f32 dir); +/* 29CEB4 */ Item_GObj* it_8029CEB4(HSD_GObj*, Vec3*, ItemKind, f32); /* 29CF8C */ bool it_8029CF8C(Item_GObj*); /* 29CFA0 */ void it_8029CFA0(Item_GObj*); /* 29CFF0 */ void it_8029CFF0(Item_GObj*); @@ -26,7 +25,7 @@ /* 29D7EC */ bool it_8029D7EC(Item_GObj*); /* 29D870 */ void it_8029D870(Item_GObj*); /* 29D940 */ bool it_8029D940(Item_GObj*); -/* 29D948 */ void it_8029D948(Item_GObj*, HSD_GObj* ref); +/* 29D948 */ void it_8029D948(Item_GObj*, HSD_GObj*); /* 3F6818 */ extern ItemStateTable it_803F6818[]; #endif diff --git a/src/melee/it/items/itgreatfoxlaser.h b/src/melee/it/items/itgreatfoxlaser.h index 8421702fdd..9ad0a6bd42 100644 --- a/src/melee/it/items/itgreatfoxlaser.h +++ b/src/melee/it/items/itgreatfoxlaser.h @@ -4,17 +4,19 @@ #include #include "it/forward.h" +#include "it/items/types.h" /* 2EAF28 */ UNK_T it_802EAF28(Item_GObj* gobj); /* 2EAF34 */ UNK_RET it_802EAF34(UNK_PARAMS); -/* 2EB1EC */ UNK_RET it_802EB1EC(UNK_PARAMS); +/* 2EB1EC */ void it_802EB1EC(Item_GObj*); /* 2EB268 */ UNK_RET it_802EB268(UNK_PARAMS); /* 2EB2C0 */ UNK_RET it_802EB2C0(UNK_PARAMS); /* 2EB3C0 */ UNK_RET it_802EB3C0(UNK_PARAMS); -/* 2EB444 */ bool it_802EB444(void); -/* 2EB44C */ bool it_802EB44C(void); -/* 2EB454 */ bool it_802EB454(void); -/* 2EB45C */ UNK_RET it_802EB45C(UNK_PARAMS); -/* 2EB5A8 */ UNK_RET it_802EB5A8(UNK_PARAMS); +/* 2EB444 */ bool it_802EB444(Item_GObj*); +/* 2EB44C */ bool it_802EB44C(Item_GObj*); +/* 2EB454 */ bool it_802EB454(Item_GObj*); +/* 2EB45C */ bool it_802EB45C(Item_GObj*); +/* 2EB5A8 */ void it_802EB5A8(Item_GObj*, Item_GObj*); +extern ItemStateTable it_803F8FD0[]; #endif diff --git a/src/melee/it/items/ithassam.c b/src/melee/it/items/ithassam.c index b1d3f60651..158447f004 100644 --- a/src/melee/it/items/ithassam.c +++ b/src/melee/it/items/ithassam.c @@ -202,7 +202,8 @@ void it_802CDF28(Item_GObj* gobj) ip->x40_vel.x = ip->xDD4_itemVar.hassam.x5C.x; ip->x40_vel.y = ip->xDD4_itemVar.hassam.x5C.y; ip->x40_vel.z = ip->xDD4_itemVar.hassam.x5C.z; - it_80272980(gobj, temp_f1); + // it_80272980(gobj, temp_f1); + it_80272980(gobj); } void it_802CE008(Item_GObj* gobj) diff --git a/src/melee/it/items/itklap.h b/src/melee/it/items/itklap.h index 4ed4f9faa8..19f8dec483 100644 --- a/src/melee/it/items/itklap.h +++ b/src/melee/it/items/itklap.h @@ -4,9 +4,10 @@ #include #include "it/forward.h" +#include "it/items/types.h" -/* 2E1820 */ UNK_RET it_802E1820(UNK_PARAMS); -/* 2E1874 */ UNK_RET it_802E1874(UNK_PARAMS); +/* 2E1820 */ void it_802E1820(Item_GObj*); +/* 2E1874 */ void it_802E1874(Item_GObj*); /* 2E18B4 */ UNK_RET it_802E18B4(UNK_PARAMS); /* 2E1930 */ UNK_RET it_802E1930(UNK_PARAMS); /* 2E1968 */ UNK_RET it_802E1968(UNK_PARAMS); @@ -17,7 +18,7 @@ /* 2E1D24 */ UNK_RET it_802E1D24(UNK_PARAMS); /* 2E1D2C */ UNK_RET it_802E1D2C(UNK_PARAMS); /* 2E1E54 */ UNK_RET it_802E1E54(UNK_PARAMS); -/* 2E1E5C */ UNK_RET it_802E1E5C(UNK_PARAMS); +/* 2E1E5C */ bool it_802E1E5C(Item_GObj*); /* 2E1E94 */ UNK_RET it_802E1E94(UNK_PARAMS); /* 2E1F2C */ UNK_RET it_802E1F2C(UNK_PARAMS); /* 2E1F34 */ UNK_RET it_802E1F34(UNK_PARAMS); @@ -27,7 +28,8 @@ /* 2E2150 */ UNK_RET it_802E2150(UNK_PARAMS); /* 2E2154 */ UNK_RET it_802E2154(UNK_PARAMS); /* 2E215C */ UNK_RET it_802E215C(UNK_PARAMS); -/* 2E2330 */ UNK_RET it_802E2330(UNK_PARAMS); -/* 2E2450 */ UNK_RET it_802E2450(UNK_PARAMS); +/* 2E2330 */ void it_802E2330(Item_GObj*, Vec3*, s32, f32); +/* 2E2450 */ void it_802E2450(Item_GObj*, Item_GObj*); +extern ItemStateTable it_803F8940[]; #endif diff --git a/src/melee/it/items/itkyasarin.h b/src/melee/it/items/itkyasarin.h index 171dc56f68..9e5400373c 100644 --- a/src/melee/it/items/itkyasarin.h +++ b/src/melee/it/items/itkyasarin.h @@ -2,11 +2,13 @@ #define GALE01_2ECCDC #include +#include "it/forward.h" +#include "it/items/types.h" -/* 2ECCDC */ UNK_RET it_802ECCDC(UNK_PARAMS); +/* 2ECCDC */ void it_802ECCDC(Item_GObj*); /* 2ECD1C */ UNK_RET it_802ECD1C(UNK_PARAMS); /* 2ECD3C */ UNK_RET it_802ECD3C(UNK_PARAMS); -/* 2ECE90 */ UNK_RET it_802ECE90(UNK_PARAMS); +/* 2ECE90 */ void it_802ECE90(Item_GObj*); /* 2ECEB0 */ UNK_RET it_802ECEB0(UNK_PARAMS); /* 2ECF00 */ UNK_RET it_802ECF00(UNK_PARAMS); /* 2ECF70 */ UNK_RET it_802ECF70(UNK_PARAMS); @@ -32,7 +34,8 @@ /* 2EDD54 */ UNK_RET it_802EDD54(UNK_PARAMS); /* 2EDD9C */ UNK_RET it_802EDD9C(UNK_PARAMS); /* 2EDDA0 */ UNK_RET it_802EDDA0(UNK_PARAMS); -/* 2EDDC0 */ UNK_RET it_802EDDC0(UNK_PARAMS); -/* 2EE1E0 */ UNK_RET it_802EE1E0(UNK_PARAMS); +/* 2EDDC0 */ bool it_802EDDC0(Item_GObj*); +/* 2EE1E0 */ void it_802EE1E0(Item_GObj*, Item_GObj*); +extern ItemStateTable it_803F90D0[]; #endif diff --git a/src/melee/it/items/itkyasarinegg.h b/src/melee/it/items/itkyasarinegg.h index 8b13789179..c881fa3005 100644 --- a/src/melee/it/items/itkyasarinegg.h +++ b/src/melee/it/items/itkyasarinegg.h @@ -1 +1,17 @@ +#include + +#include "it/forward.h" +#include "it/items/types.h" + +extern ItemStateTable it_803F9328[]; +void it_802EFBC0(Item_GObj*); +UNK_RET it_802EFBE8(Item_GObj*); +UNK_RET it_802EFC08(Item_GObj*); +bool it_802EFE28(Item_GObj*); +bool it_802F022C(Item_GObj*); +bool it_802F0104(Item_GObj*); +bool it_802EFF1C(Item_GObj*); +bool it_802F01F8(Item_GObj*); +bool it_802F0010(Item_GObj*); +void it_802F0320(Item_GObj*, Item_GObj*); diff --git a/src/melee/it/items/itlikelike.h b/src/melee/it/items/itlikelike.h index 3d9b8d5999..e12bbf7ae9 100644 --- a/src/melee/it/items/itlikelike.h +++ b/src/melee/it/items/itlikelike.h @@ -4,11 +4,12 @@ #include #include "it/forward.h" +#include "it/items/types.h" /* 2D9A2C */ UNK_RET it_802D9A2C(UNK_PARAMS); /* 2D9B78 */ UNK_RET it_802D9B78(UNK_PARAMS); -/* 2D9BA8 */ UNK_RET it_802D9BA8(UNK_PARAMS); -/* 2D9CC4 */ UNK_RET it_802D9CC4(UNK_PARAMS); +/* 2D9BA8 */ void it_802D9BA8(Item_GObj*); +/* 2D9CC4 */ bool it_802D9CC4(Item_GObj*); /* 2D9DDC */ UNK_RET it_802D9DDC(UNK_PARAMS); /* 2D9E38 */ UNK_RET it_802D9E38(UNK_PARAMS); /* 2D9E80 */ UNK_RET it_802D9E80(UNK_PARAMS); @@ -73,11 +74,11 @@ /* 2DBD7C */ UNK_RET it_802DBD7C(UNK_PARAMS); /* 2DBE50 */ UNK_RET it_802DBE50(UNK_PARAMS); /* 2DBE54 */ UNK_RET it_802DBE54(UNK_PARAMS); -/* 2DBE90 */ UNK_RET it_802DBE90(UNK_PARAMS); +/* 2DBE90 */ void it_802DBE90(Item_GObj*); /* 2DBED4 */ UNK_RET it_802DBED4(UNK_PARAMS); /* 2DBF2C */ UNK_RET it_802DBF2C(UNK_PARAMS); -/* 2DBF30 */ UNK_RET it_802DBF30(UNK_PARAMS); -/* 2DC000 */ UNK_RET it_802DC000(UNK_PARAMS); +/* 2DBF30 */ void it_802DBF30(Item_GObj*); +/* 2DC000 */ void it_802DC000(Item_GObj*); /* 2DC050 */ UNK_RET it_802DC050(UNK_PARAMS); /* 2DC058 */ UNK_RET it_802DC058(UNK_PARAMS); /* 2DC088 */ UNK_RET it_802DC088(UNK_PARAMS); @@ -93,7 +94,8 @@ /* 2DC43C */ UNK_RET it_802DC43C(UNK_PARAMS); /* 2DC444 */ UNK_RET it_802DC444(UNK_PARAMS); /* 2DC460 */ UNK_RET it_802DC460(UNK_PARAMS); -/* 2DC480 */ UNK_RET it_802DC480(UNK_PARAMS); +/* 2DC480 */ void it_802DC480(Item_GObj*); /* 2DC4BC */ UNK_RET it_802DC4BC(UNK_PARAMS); +extern ItemStateTable it_803F8468[]; #endif diff --git a/src/melee/it/items/itlinkarrow.c b/src/melee/it/items/itlinkarrow.c index d6729759a3..cca43f8feb 100644 --- a/src/melee/it/items/itlinkarrow.c +++ b/src/melee/it/items/itlinkarrow.c @@ -13,6 +13,7 @@ #include "it/it_26B1.h" #include "it/it_2725.h" #include "it/itCharItems.h" +#include "it/itcoll.h" #include "it/item.h" #include "lb/lbrefract.h" #include "lb/lbvector.h" @@ -63,7 +64,7 @@ ItemStateTable it_803F6A28[5] = { f32 numbers[] = { 2, 4, 6, 8, 10, 12, 14, 16 }; f32 numbers_l[] = { 2, 3, 4, 5, 6, 7, 8, 9 }; -void it_802A7D8C(HSD_GObj* gobj, s32 arg1) +void it_802A7D8C(HSD_GObj* gobj, int arg1) { Item* item; diff --git a/src/melee/it/items/itlinkarrow.h b/src/melee/it/items/itlinkarrow.h index f4de3b33c5..c6bed669f1 100644 --- a/src/melee/it/items/itlinkarrow.h +++ b/src/melee/it/items/itlinkarrow.h @@ -6,11 +6,9 @@ #include "ft/forward.h" #include "it/forward.h" -#include "it/inlines.h" -#include "it/item.h" #include "it/items/types.h" -/* 2A7D8C */ void it_802A7D8C(HSD_GObj*, s32); +/* 2A7D8C */ void it_802A7D8C(HSD_GObj*, int); /* 2A7E40 */ void it_802A7E40(Item_GObj*); /* 2A81C4 */ void fn_802A81C4(HSD_GObj*); /* 2A8330 */ void it_802A8330(HSD_GObj*); diff --git a/src/melee/it/items/itlinkbomb.c b/src/melee/it/items/itlinkbomb.c index 7213a82af8..523b49f94d 100644 --- a/src/melee/it/items/itlinkbomb.c +++ b/src/melee/it/items/itlinkbomb.c @@ -648,7 +648,8 @@ int it_8029FA30(Item_GObj* gobj) } else { temp_f1 = 2.0f * (HSD_Randf() - 0.5f); item->x40_vel.x = sa->x14 * temp_f1; - it_80272980(gobj, temp_f1); + // it_80272980(gobj, temp_f1); + it_80272980(gobj); } item->x40_vel.y = sa->x18 * item->facing_dir; item->xDD4_itemVar.linkbomb.x0.b2 = true; diff --git a/src/melee/it/items/itlinkboomerang.h b/src/melee/it/items/itlinkboomerang.h index 36a73d1312..fd8e3bf33c 100644 --- a/src/melee/it/items/itlinkboomerang.h +++ b/src/melee/it/items/itlinkboomerang.h @@ -9,7 +9,7 @@ #include "it/items/types.h" /* 29FDBC */ bool it_8029FDBC(Item_GObj* gobj); -/* 29FDDC */ UNK_RET it_8029FDDC(UNK_PARAMS); +/* 29FDDC */ void it_8029FDDC(HSD_GObj*, int); /* 29FE64 */ UNK_RET it_8029FE64(UNK_PARAMS); /* 2A013C */ HSD_GObj* it_802A013C(float facing_dir, Fighter_GObj* owner_gobj, Vec3* pos, Fighter_Part, int); diff --git a/src/melee/it/items/itmato.h b/src/melee/it/items/itmato.h index f18a8901c9..0471144f8e 100644 --- a/src/melee/it/items/itmato.h +++ b/src/melee/it/items/itmato.h @@ -12,7 +12,7 @@ /* 2D858C */ bool it_802D858C(Item_GObj*); /* 2D8594 */ void it_802D8594(Item_GObj*); /* 2D85EC */ bool it_802D85EC(Item_GObj*); -/* 2D85F4 */ bool it_802D85F4(void); +/* 2D85F4 */ bool it_802D85F4(Item_GObj*); /* 3F83E0 */ extern ItemStateTable it_803F83E0[]; #endif diff --git a/src/melee/it/items/itnokonoko.h b/src/melee/it/items/itnokonoko.h index da2cc31efc..259fbea157 100644 --- a/src/melee/it/items/itnokonoko.h +++ b/src/melee/it/items/itnokonoko.h @@ -5,9 +5,11 @@ #include #include "it/forward.h" +#include "it/items/forward.h" +#include "it/items/types.h" -/* 2DC69C */ UNK_RET it_802DC69C(UNK_PARAMS); -/* 2DC774 */ UNK_RET it_802DC774(UNK_PARAMS); +/* 2DC69C */ void it_802DC69C(Item_GObj*); +/* 2DC774 */ int it_802DC774(Item_GObj*); /* 2DC83C */ UNK_RET it_802DC83C(UNK_PARAMS); /* 2DC8B8 */ UNK_RET fn_802DC8B8(UNK_PARAMS); /* 2DC910 */ UNK_RET it_802DC910(UNK_PARAMS); @@ -40,17 +42,18 @@ /* 2DD468 */ UNK_RET it_802DD468(UNK_PARAMS); /* 2DD46C */ UNK_RET it_802DD46C(UNK_PARAMS); /* 2DD4A8 */ UNK_RET it_802DD4A8(UNK_PARAMS); -/* 2DD4F4 */ UNK_RET it_802DD4F4(UNK_PARAMS); +/* 2DD4F4 */ void it_802DD4F4(Item_GObj*); /* 2DD53C */ UNK_RET it_802DD53C(UNK_PARAMS); /* 2DD598 */ UNK_RET it_802DD598(UNK_PARAMS); -/* 2DD59C */ UNK_RET it_802DD59C(UNK_PARAMS); -/* 2DD67C */ UNK_RET it_802DD67C(UNK_PARAMS); +/* 2DD59C */ void it_802DD59C(Item_GObj*); +/* 2DD67C */ void it_802DD67C(Item_GObj*); /* 2DD6D4 */ UNK_RET it_802DD6D4(UNK_PARAMS); /* 2DD71C */ UNK_RET it_802DD71C(UNK_PARAMS); /* 2DD74C */ UNK_RET it_802DD74C(UNK_PARAMS); /* 2DD78C */ UNK_RET it_802DD78C(UNK_PARAMS); -/* 2DD7D0 */ UNK_RET it_802DD7D0(UNK_PARAMS); +/* 2DD7D0 */ void it_802DD7D0(Item_GObj*, Item_GObj*); /* 2DD7F0 */ UNK_RET it_802DD7F0(UNK_PARAMS); /* 2DDA84 */ bool it_802DDA84(Item_GObj*); +extern ItemStateTable it_803F85F0[]; #endif diff --git a/src/melee/it/items/itoldkuri.h b/src/melee/it/items/itoldkuri.h index 1a62c8d372..72fc345f8d 100644 --- a/src/melee/it/items/itoldkuri.h +++ b/src/melee/it/items/itoldkuri.h @@ -58,7 +58,7 @@ /* 2D8450 */ UNK_RET it_802D8450(UNK_PARAMS); /* 2D846C */ UNK_RET it_802D846C(UNK_PARAMS); /* 2D848C */ UNK_RET it_802D848C(UNK_PARAMS); -/* 2D84D8 */ UNK_RET it_802D84D8(UNK_PARAMS); +/* 2D84D8 */ UNK_RET it_802D84D8(Item_GObj*, Item_GObj*); /* 3F8320 */ extern ItemStateTable it_803F8320[]; #endif diff --git a/src/melee/it/items/itpatapata.h b/src/melee/it/items/itpatapata.h index 453572e0de..a1fa0642f8 100644 --- a/src/melee/it/items/itpatapata.h +++ b/src/melee/it/items/itpatapata.h @@ -1,9 +1,10 @@ #ifndef GALE01_2E05A0 #define GALE01_2E05A0 -#include +#include "it/forward.h" +#include "it/items/types.h" -/* 2E05A0 */ UNK_RET it_802E05A0(UNK_PARAMS); +/* 2E05A0 */ void it_802E05A0(Item_GObj*); /* 2E0678 */ UNK_RET it_802E0678(UNK_PARAMS); /* 2E06B4 */ UNK_RET it_802E06B4(UNK_PARAMS); /* 2E06BC */ UNK_RET it_802E06BC(UNK_PARAMS); @@ -14,16 +15,16 @@ /* 2E0B78 */ UNK_RET it_802E0B78(UNK_PARAMS); /* 2E0D9C */ UNK_RET it_802E0D9C(UNK_PARAMS); /* 2E0E10 */ UNK_RET it_802E0E10(UNK_PARAMS); -/* 2E0EE0 */ UNK_RET it_802E0EE0(UNK_PARAMS); +/* 2E0EE0 */ bool it_802E0EE0(Item_GObj*); /* 2E0F1C */ UNK_RET it_802E0F1C(UNK_PARAMS); -/* 2E0F70 */ UNK_RET it_802E0F70(UNK_PARAMS); +/* 2E0F70 */ void it_802E0F70(Item_GObj*); /* 2E0F98 */ UNK_RET it_802E0F98(UNK_PARAMS); /* 2E0FE0 */ UNK_RET it_802E0FE0(UNK_PARAMS); -/* 2E0FE4 */ UNK_RET it_802E0FE4(UNK_PARAMS); +/* 2E0FE4 */ void it_802E0FE4(Item_GObj*); /* 2E1040 */ UNK_RET it_802E1040(UNK_PARAMS); /* 2E10A0 */ UNK_RET it_802E10A0(UNK_PARAMS); /* 2E10A4 */ UNK_RET it_802E10A4(UNK_PARAMS); -/* 2E10C8 */ UNK_RET it_802E10C8(UNK_PARAMS); +/* 2E10C8 */ void it_802E10C8(Item_GObj*); /* 2E1128 */ UNK_RET it_802E1128(UNK_PARAMS); /* 2E1170 */ UNK_RET it_802E1170(UNK_PARAMS); /* 2E11A0 */ UNK_RET it_802E11A0(UNK_PARAMS); @@ -34,7 +35,8 @@ /* 2E15B0 */ UNK_RET it_802E15B0(UNK_PARAMS); /* 2E1648 */ UNK_RET it_802E1648(UNK_PARAMS); /* 2E1694 */ UNK_RET it_802E1694(UNK_PARAMS); -/* 2E16D8 */ UNK_RET it_802E16D8(UNK_PARAMS); +/* 2E16D8 */ UNK_RET it_802E16D8(Item_GObj*, Item_GObj*); /* 2E16F8 */ UNK_RET it_802E16F8(UNK_PARAMS); +extern ItemStateTable it_803F88C0[]; #endif diff --git a/src/melee/it/items/ittincle.h b/src/melee/it/items/ittincle.h index d1a06bc6e4..40d68daca5 100644 --- a/src/melee/it/items/ittincle.h +++ b/src/melee/it/items/ittincle.h @@ -4,10 +4,11 @@ #include #include "it/forward.h" +#include "it/items/types.h" -/* 2EB5C8 */ UNK_RET it_802EB5C8(UNK_PARAMS); -/* 2EB684 */ UNK_RET it_802EB684(UNK_PARAMS); -/* 2EB6A8 */ UNK_RET it_802EB6A8(UNK_PARAMS); +/* 2EB5C8 */ void it_802EB5C8(Item_GObj*); +/* 2EB684 */ bool it_802EB684(Item_GObj*); +/* 2EB6A8 */ bool it_802EB6A8(Item_GObj*); /* 2EB6DC */ UNK_RET it_802EB6DC(UNK_PARAMS); /* 2EB808 */ bool it_802EB808(void); /* 2EB810 */ UNK_RET it_802EB810(UNK_PARAMS); @@ -58,12 +59,13 @@ /* 2EC7A8 */ UNK_RET it_802EC7A8(UNK_PARAMS); /* 2EC80C */ UNK_RET it_802EC80C(UNK_PARAMS); /* 2EC830 */ UNK_RET it_802EC830(UNK_PARAMS); -/* 2EC850 */ UNK_RET it_802EC850(UNK_PARAMS); +/* 2EC850 */ void it_802EC850(Item_GObj*, Item_GObj*); /* 2EC870 */ UNK_RET it_802EC870(UNK_PARAMS); /* 2EC9E8 */ UNK_RET it_802EC9E8(UNK_PARAMS); /* 2ECA70 */ UNK_RET it_802ECA70(UNK_PARAMS); /* 2ECC8C */ int it_802ECC8C(Item_GObj*); /* 2ECC98 */ void it_802ECC98(Item_GObj*, float); /* 2ECCA4 */ UNK_RET it_802ECCA4(UNK_PARAMS); +extern ItemStateTable it_803F9000[]; #endif diff --git a/src/melee/it/items/ittools.h b/src/melee/it/items/ittools.h index 68485afa59..82b6f6e469 100644 --- a/src/melee/it/items/ittools.h +++ b/src/melee/it/items/ittools.h @@ -2,9 +2,11 @@ #define GALE01_2EEFA8 #include +#include "it/forward.h" +#include "it/items/types.h" /* 2EEFA8 */ UNK_RET it_802EEFA8(UNK_PARAMS); -/* 2EF074 */ UNK_RET it_802EF074(UNK_PARAMS); +/* 2EF074 */ bool it_802EF074(Item_GObj*); /* 2EF098 */ UNK_RET it_802EF098(UNK_PARAMS); /* 2EF128 */ UNK_RET it_802EF128(UNK_PARAMS); /* 2EF27C */ UNK_RET it_802EF27C(UNK_PARAMS); @@ -14,12 +16,13 @@ /* 2EF468 */ UNK_RET it_802EF468(UNK_PARAMS); /* 2EF46C */ UNK_RET it_802EF46C(UNK_PARAMS); /* 2EF548 */ UNK_RET it_802EF548(UNK_PARAMS); -/* 2EF700 */ UNK_RET it_802EF700(UNK_PARAMS); -/* 2EF724 */ UNK_RET it_802EF724(UNK_PARAMS); -/* 2EF7CC */ UNK_RET it_802EF7CC(UNK_PARAMS); -/* 2EF874 */ UNK_RET it_802EF874(UNK_PARAMS); -/* 2EF924 */ UNK_RET it_802EF924(UNK_PARAMS); -/* 2EF944 */ UNK_RET it_802EF944(UNK_PARAMS); -/* 2EFA24 */ UNK_RET it_802EFA24(UNK_PARAMS); +/* 2EF700 */ bool it_802EF700(Item_GObj*); +/* 2EF724 */ bool it_802EF724(Item_GObj*); +/* 2EF7CC */ bool it_802EF7CC(Item_GObj*); +/* 2EF874 */ bool it_802EF874(Item_GObj*); +/* 2EF924 */ bool it_802EF924(Item_GObj*); +/* 2EF944 */ bool it_802EF944(Item_GObj*); +/* 2EFA24 */ void it_802EFA24(Item_GObj*, Item_GObj*); +extern ItemStateTable it_803F9260[]; #endif diff --git a/src/melee/it/items/itwhispyapple.h b/src/melee/it/items/itwhispyapple.h index a910cb2400..b2c2de165c 100644 --- a/src/melee/it/items/itwhispyapple.h +++ b/src/melee/it/items/itwhispyapple.h @@ -2,6 +2,8 @@ #define GALE01_2EE200 #include +#include "it/forward.h" +#include "it/items/types.h" /* 2EE200 */ UNK_RET it_802EE200(UNK_PARAMS); /* 2EE374 */ UNK_RET it_802EE374(UNK_PARAMS); @@ -16,24 +18,25 @@ /* 2EE824 */ UNK_RET it_802EE824(UNK_PARAMS); /* 2EE914 */ UNK_RET it_802EE914(UNK_PARAMS); /* 2EE944 */ UNK_RET it_802EE944(UNK_PARAMS); -/* 2EEA08 */ UNK_RET it_802EEA08(UNK_PARAMS); +/* 2EEA08 */ void it_802EEA08(Item_GObj*); /* 2EEA64 */ bool it_802EEA64(void); /* 2EEA6C */ UNK_RET it_802EEA6C(UNK_PARAMS); -/* 2EEA70 */ UNK_RET it_802EEA70(UNK_PARAMS); -/* 2EEB28 */ UNK_RET it_802EEB28(UNK_PARAMS); -/* 2EEBB0 */ UNK_RET it_802EEBB0(UNK_PARAMS); +/* 2EEA70 */ void it_802EEA70(Item_GObj*); +/* 2EEB28 */ void it_802EEB28(Item_GObj*); +/* 2EEBB0 */ void it_802EEBB0(Item_GObj*); /* 2EEBD8 */ UNK_RET it_802EEBD8(UNK_PARAMS); /* 2EECC8 */ UNK_RET it_802EECC8(UNK_PARAMS); /* 2EECCC */ UNK_RET it_802EECCC(UNK_PARAMS); /* 2EED00 */ UNK_RET it_802EED00(UNK_PARAMS); /* 2EEDD4 */ UNK_RET it_802EEDD4(UNK_PARAMS); /* 2EEEC4 */ UNK_RET it_802EEEC4(UNK_PARAMS); -/* 2EEEC8 */ bool it_802EEEC8(void); -/* 2EEED0 */ bool it_802EEED0(void); -/* 2EEED8 */ UNK_RET it_802EEED8(UNK_PARAMS); -/* 2EEF10 */ UNK_RET it_802EEF10(UNK_PARAMS); -/* 2EEF30 */ UNK_RET it_802EEF30(UNK_PARAMS); -/* 2EEF68 */ UNK_RET it_802EEF68(UNK_PARAMS); -/* 2EEF88 */ UNK_RET it_802EEF88(UNK_PARAMS); +/* 2EEEC8 */ bool it_802EEEC8(Item_GObj*); +/* 2EEED0 */ bool it_802EEED0(Item_GObj*); +/* 2EEED8 */ bool it_802EEED8(Item_GObj*); +/* 2EEF10 */ bool it_802EEF10(Item_GObj*); +/* 2EEF30 */ bool it_802EEF30(Item_GObj*); +/* 2EEF68 */ bool it_802EEF68(Item_GObj*); +/* 2EEF88 */ void it_802EEF88(Item_GObj*, Item_GObj*); +extern ItemStateTable it_803F91D0[]; #endif diff --git a/src/melee/it/items/itwhitebea.h b/src/melee/it/items/itwhitebea.h index 86125a70c4..51a41a5b5e 100644 --- a/src/melee/it/items/itwhitebea.h +++ b/src/melee/it/items/itwhitebea.h @@ -4,6 +4,7 @@ #include #include "it/forward.h" +#include "it/items/types.h" /* 2E31F8 */ void it_802E31F8(Item_GObj*); /* 2E324C */ UNK_RET it_802E324C(UNK_PARAMS); @@ -25,8 +26,8 @@ /* 2E35CC */ UNK_RET it_802E35CC(UNK_PARAMS); /* 2E3784 */ void it_802E3784(Item_GObj*, Item_GObj*); /* 2E37A4 */ UNK_RET it_802E37A4(UNK_PARAMS); -/* 2E37BC */ UNK_RET it_802E37BC(UNK_PARAMS); -/* 2E3884 */ UNK_RET it_802E3884(UNK_PARAMS); +/* 2E37BC */ void it_802E37BC(Item_GObj*); +/* 2E3884 */ bool it_802E3884(Item_GObj*); /* 2E398C */ UNK_RET fn_802E398C(UNK_PARAMS); /* 2E39C8 */ UNK_RET it_802E39C8(UNK_PARAMS); /* 2E3A10 */ UNK_RET it_802E3A10(UNK_PARAMS); @@ -60,11 +61,11 @@ /* 2E45D0 */ UNK_RET it_802E45D0(UNK_PARAMS); /* 2E464C */ UNK_RET it_802E464C(UNK_PARAMS); /* 2E4650 */ UNK_RET it_802E4650(UNK_PARAMS); -/* 2E468C */ UNK_RET it_802E468C(UNK_PARAMS); +/* 2E468C */ void it_802E468C(Item_GObj*); /* 2E46B4 */ UNK_RET it_802E46B4(UNK_PARAMS); /* 2E46FC */ UNK_RET it_802E46FC(UNK_PARAMS); -/* 2E4700 */ UNK_RET it_802E4700(UNK_PARAMS); -/* 2E47C0 */ UNK_RET it_802E47C0(UNK_PARAMS); +/* 2E4700 */ void it_802E4700(Item_GObj*); +/* 2E47C0 */ void it_802E47C0(Item_GObj*); /* 2E4818 */ UNK_RET it_802E4818(UNK_PARAMS); /* 2E4860 */ UNK_RET it_802E4860(UNK_PARAMS); /* 2E4890 */ UNK_RET it_802E4890(UNK_PARAMS); @@ -76,6 +77,7 @@ /* 2E49E0 */ bool it_802E49E0(void); /* 2E49E8 */ UNK_RET it_802E49E8(UNK_PARAMS); /* 2E4A04 */ UNK_RET it_802E4A04(UNK_PARAMS); -/* 2E4A24 */ UNK_RET it_802E4A24(UNK_PARAMS); +/* 2E4A24 */ void it_802E4A24(Item_GObj*, Item_GObj*); +extern ItemStateTable it_803F8A88[]; #endif diff --git a/src/melee/it/items/itzgshell.h b/src/melee/it/items/itzgshell.h index b0abff339a..0742b890b3 100644 --- a/src/melee/it/items/itzgshell.h +++ b/src/melee/it/items/itzgshell.h @@ -5,6 +5,7 @@ #include #include "it/forward.h" +#include "it/items/types.h" /* 2DDB38 */ UNK_RET it_802DDB38(UNK_PARAMS); /* 2DDBE8 */ UNK_RET it_802DDBE8(UNK_PARAMS); @@ -51,19 +52,20 @@ /* 2DFA68 */ bool it_802DFA68(Item_GObj*); /* 2DFB90 */ void it_802DFB90(Item_GObj*); /* 2DFBAC */ bool it_802DFBAC(Item_GObj*); -/* 2DFC34 */ void it_802DFC34(Item_GObj*); -/* 2DFC58 */ void it_802DFC58(Item_GObj*); -/* 2DFC90 */ void it_802DFC90(Item_GObj*); -/* 2DFCB0 */ void it_802DFCB0(Item_GObj*); -/* 2DFD60 */ void it_802DFD60(Item_GObj*); -/* 2DFE40 */ void it_802DFE40(Item_GObj*); +/* 2DFC34 */ bool it_802DFC34(Item_GObj*); +/* 2DFC58 */ bool it_802DFC58(Item_GObj*); +/* 2DFC90 */ bool it_802DFC90(Item_GObj*); +/* 2DFCB0 */ bool it_802DFCB0(Item_GObj*); +/* 2DFD60 */ bool it_802DFD60(Item_GObj*); +/* 2DFE40 */ bool it_802DFE40(Item_GObj*); /* 2DFE7C */ UNK_RET fn_802DFE7C(UNK_PARAMS); -/* 2DFED4 */ UNK_RET it_802DFED4(UNK_PARAMS); -/* 2DFEF4 */ UNK_RET it_802DFEF4(UNK_PARAMS); +/* 2DFED4 */ void it_802DFED4(Item_GObj*, Item_GObj*); +/* 2DFEF4 */ void it_802DFEF4(Item_GObj*); /* 2DFF14 */ UNK_RET it_802DFF14(UNK_PARAMS); /* 2DFFA0 */ UNK_RET it_802DFFA0(UNK_PARAMS); /* 2DFFB8 */ UNK_RET it_802DFFB8(UNK_PARAMS); /* 2E0100 */ UNK_RET it_802E0100(UNK_PARAMS); -/* 2E0408 */ void it_802E0408(Item_GObj*); +/* 2E0408 */ bool it_802E0408(Item_GObj*); +extern ItemStateTable it_803F86C8[]; #endif diff --git a/src/melee/it/items/itzrshell.h b/src/melee/it/items/itzrshell.h index 072ee40481..db53a7e94f 100644 --- a/src/melee/it/items/itzrshell.h +++ b/src/melee/it/items/itzrshell.h @@ -12,12 +12,11 @@ void it_802E0328(Item_GObj*); void it_802E0348(Item_GObj*); void it_802E0368(Item_GObj*); void it_802E0388(Item_GObj*); -void it_802E03A8(Item_GObj*); -void it_802E03C8(Item_GObj*); -void it_802E03E8(Item_GObj*); -void it_802E0408(Item_GObj*); -void it_802E0428(Item_GObj*); -void it_802E0448(Item_GObj*); +bool it_802E03A8(Item_GObj*); +bool it_802E03C8(Item_GObj*); +bool it_802E03E8(Item_GObj*); +bool it_802E0428(Item_GObj*); +bool it_802E0448(Item_GObj*); void it_802E0468(Item_GObj*, HSD_GObj*); Item_GObj* it_802E0488(s32, s32, s32); extern ItemStateTable it_803F87F0[]; diff --git a/src/melee/it/types.h b/src/melee/it/types.h index 7377eecde6..49b0c73002 100644 --- a/src/melee/it/types.h +++ b/src/melee/it/types.h @@ -10,6 +10,7 @@ #include #include +#include "ft/types.h" #include "it/itCharItems.h" #include "it/itCommonItems.h" #include "it/itPKFlash.h" @@ -111,8 +112,8 @@ struct ItemAttr { Vec2 x30_unk; // 0x34 Vec2 x38_grab_range; // 0x38 ECB x40; - s32 x50; // 0x50 - s32 x54; // 0x54 + f32 x50; // 0x50 + f32 x54; // 0x54 f32 x58; // 0x58 f32 x5c; // 0x5c f32 x60_scale; // 0x60, does not affect hitboxes @@ -143,6 +144,7 @@ struct ItemAttr { /// @sz{8} struct ItemDynamics { + /// @todo Combine with ftDynamics? Can see in it_8027163C that this struct does not work perfectly /// @at{0} @sz{4} int count; @@ -181,7 +183,7 @@ struct ItemModelDesc { s32 x8_bone_attach_id; /// @at{C} @sz{4} - int xC_bit_field; + u8 xC_bit_field; }; struct Article { @@ -267,13 +269,12 @@ struct Item { /// @at{70} @sz{C} Vec3 x70_nudge; - f32 x7C; - u8 padding_x80[8]; - f32 x88; - u8 padding_x8C[0xB8 - 0x8C]; - + Vec3 x7C; + Vec3 x88; // From it_80277040 + Vec3 x94; // From it_80277040 + Vec3 xA0; // From it_802734B4 + Vec3 xAC_unk; // From it_80276CEC ItemLogicTable* xB8_itemLogicTable; // Global item callbacks - ItemStateTable* xBC_itemStateContainer; GroundOrAir ground_or_air; Article* xC4_article_data; @@ -289,10 +290,10 @@ struct Item { /// @brief Item's current owner HSD_GObj* owner; - s32 x51C; + HSD_GObj* x51C; // Related to the owner gobj CameraBox* x520_cameraBox; // CameraBox - f32 x524; - s32 x528; + FtCmdState* x524_cmd; // should this be CommandInfo* instead? + f32 x528; void* x52C_item_script; // Script parse? u32 x530; u32 x534; @@ -302,7 +303,7 @@ struct Item { u32 x544; ColorOverlay x548_colorOverlay; u8 x5C8; - u8 x5C9; + u8 x5C9; // used heavily in it_80278108 u8 x5CA; u8 x5CB; f32 x5CC_currentAnimFrame; @@ -311,34 +312,38 @@ struct Item { HitCapsule hit; s32 x138; } x5D4_hitboxes[4]; - s32 xAC4_ignoreItemID; // Cannot hit items with this index? - u32 xAC8_hurtboxNum; // Number of hurtboxes this item has - HurtCapsule xACC_itemHurtbox[2]; - u32 xB64; - u8 xB68; + u32 xAC4_ignoreItemID; // Cannot hit items with this index? + u8 xAC8_hurtboxNum; // Number of hurtboxes this item has + HurtCapsule xACC_itemHurtbox[2]; // Are these really size 0x4C? Code in itcoll.c and it_266F.c adds 0x44 to iterate through. (Conversely can see adding 0x4C to iterate in ftcoll.c) + // Can see how vars don't line up in it_80274D6C and it_80274DAC + f32 xB64; + u8 xB68; // int for ItemDynamics->count? u8 xB69; u8 xB6A; u8 xB6B; - u32 xB6C; - u32 xB70; - u32 xB74; - u32 xB78; - u32 xB7C; - u32 xB80; - u32 xB84; - u32 xB88; - u32 xB8C; - u32 xB90; - u32 xB94; - u32 xB98; - u32 xB9C; - u32 xBA0; - u32 xBA4; - u32 xBA8; - u32 xBAC; - u32 xBB0; - u32 xBB4; - u32 xBB8; + struct { + Vec3 xB6C; + // u32 xB6C; // struct DynamicsData* for DynamicsDesc->data? + // u32 xB70; // int for DynamicsDesc->count? + // u32 xB74; // pos.x? + f32 xB78; // pos.y? scale? + HSD_JObj* xB7C; // HSD_JObj* for bone? + u32 xB80; + Vec3 xB84; + // u32 xB88; + // u32 xB8C; + u32 xB90; // enum_t for BoneDynamicsDesc->bone_id? + } xB6C_vars[2]; + // u32 xB94; + // u32 xB98; + // u32 xB9C; + // u32 xBA0; + // u32 xBA4; + // u32 xBA8; + // u32 xBAC; + // u32 xBB0; + // u32 xBB4; + // u32 xBB8; DynamicBoneTable* xBBC_dynamicBoneTable; UNK_T xBC0; u8 xBC4; @@ -353,11 +358,11 @@ struct Item { ECB xBFC; ECB xC0C; ECB xC1C; - u32 xC2C; - u32 xC30; + s32 xC2C; + s32 xC30; s32 xC34_damageDealt; // Rounded down - s32 xC38; // 0xc38 + s32 xC38; // 0xc38 - ItemKind? f32 xC3C; // 0xc3c f32 xC40; // 0xc40 f32 xC44; // 0xc44 @@ -389,16 +394,12 @@ struct Item { f32 xCB8_outDamageDirection; // 0xcb8, updated @ 80078184 f32 xCBC_hitlagFrames; // 0xcbc, hitlag frames remaining f32 xCC0; // 0xcc0 - s32 xCC4; // 0xcc4 + s32 xCC4; // 0xcc4, switch statement for this in it_8027CBFC f32 xCC8_knockback; // 0xcc8 f32 xCCC_incDamageDirection; // Direction from which damage was applied? f32 xCD0; // 0xcd0 - f32 xCD4; // 0xcd4 - f32 xCD8; // 0xcd8 - f32 xCDC; // 0xcdc - f32 xCE0; // 0xce0 - f32 xCE4; // 0xce4 - f32 xCE8; // 0xce8 + Vec3 xCD4; // 0xcd4 + Vec3 xCE0; // 0xce0 HSD_GObj* xCEC_fighterGObj; // 0xcec HSD_GObj* xCF0_itemGObj; // 0xcf0, is a fp GObj, but is the owner of the @@ -426,7 +427,7 @@ struct Item { /// @at{D0C} @sz{4} enum_t xD0C; - s32 xD10; + f32 xD10; /// @at{D14} @sz{4} HSD_GObjPredicate animated; @@ -478,7 +479,7 @@ struct Item { int xD4C; u32 xD50_landNum; // Number of times this item has landed s32 xD54_throwNum; // Number of times this item has been thrown - s32 xD58; + u32 xD58; s32 xD5C; /// @at{D60} @sz{4} @@ -502,9 +503,9 @@ struct Item { s32 xD80; s32 xD84; s32 xD88_attackID; - s16 xD8C_attack_instance; + u16 xD8C_attack_instance; s16 xD8E; - s32 xD90; + union Struct2070 xD90; // some bit struct/union Vec2 xD94; Vec2 xD9C; union { @@ -524,7 +525,7 @@ struct Item { u32 xDB4_itcmd_var2; u32 xDB8_itcmd_var3; u32 xDBC_itcmd_var4; - u32 xDC0; + UnkFlagStruct xDC0; u32 xDC4; flag32 xDC8_word; struct { @@ -543,6 +544,9 @@ struct Item { UnkFlagStruct xDD3_flag; union { it_266F_ItemVars it_266F; + it_279D_ItemVars it_279D; + it_27B5_ItemVars it_27B5; + it_27CE_ItemVars it_27CE; it_27CF_ItemVars it_27CF; it_2E5A_ItemVars it_2E5A; it_2E6A_ItemVars_1 it_2E6A_1; @@ -550,6 +554,7 @@ struct Item { it_2F28_ItemVars it_2F28; itBombHei_ItemVars bombhei; itCapsule_ItemVars capsule; + itChicorita_ItemVars chicorita; itCoin_ItemVars coin; itEgg_ItemVars egg; itFFlower_ItemVars fflower; @@ -565,6 +570,7 @@ struct Item { itHeiho_ItemVars heiho; itKinoko_ItemVars kinoko; itKirbyHammer_ItemVars kirbyhammer; + itKlap_ItemVars klap; itLGun_ItemVars lgun; itLGunBeam_ItemVars lgunbeam; itLGunRay_ItemVars lgunray; @@ -643,19 +649,19 @@ struct ItemCommonData { u32 x24; u32 x28; u32 x2C; - u32 x30; + u32 x30; // lifetime? u32 x34; - s32 x38_float; + u32 x38_float; s32 x3C_float; s32 x40_float; s32 x44_float; - s32 x48_float; - s32 x4C_float; + u32 x48_float; + f32 x4C_float; s32 x50_float; - s32 x54_float; - s32 x58_float; - s32 x5C_float; - s32 x60_float; + f32 x54_float; + f32 x58_float; + f32 x5C_float; + f32 x60_float; s32 x64_float; f32 x68_float; f32 x6C_float; @@ -676,12 +682,23 @@ struct ItemCommonData { uint xD8; s32 xDC; f32 unk_degrees; ///< @at{E0} - u8 filler[0x128 - 0xE4]; - s32 x128; - s32 x12C; - s32 x130; - s32 x134; - u8 filler_2[0x148 - 0x138]; + u8 filler_1a[0xE8 - 0xE4]; + u8 xE8; // struct that has a float (scale?) as the first member? See it_80275BC8 + u8 filler_1a_2[0xF0 - 0xEC]; + f32 xF0; + f32 xF4; + f32 xF8; + u8 filler_1b[0x124 - 0xFC]; + s32 x124; // max value for a random integer generation in it_8026F6BC + s32 x128; // used in it_8026CF04 + s32 x12C; // used in it_8026CF04 + s32 x130; // used in it_8026CF04 + s32 x134; // used in it_8026CF04 + // u8 filler_2[0x148 - 0x138]; - replaced with vars that are used for calc's in it_8026F8B4 + s32 x138; + s32 x13C; + s32 x140; + f32 x144; s32 x148; f32 x14C; f32 x150; @@ -700,20 +717,23 @@ struct Item_r13_Data { }; struct HSD_ObjAllocUnk2 { - float x0; - float x4; - float x8; - float xC; - u8 pad_10[0xB0 - 0x10]; + // float x0; + // float x4; + // float x8; + // float xC; + // u8 pad_10[0xB0 - 0x10]; + ECB ecb_arr[11]; int xB0; int xB4; int xB8; - UNK_T xBC; - Vec3 xC0; - u8 pad_CC[0x148 - 0xCC]; + M2C_UNK xBC; + // Vec3 xC0; + // u8 pad_CC[0x148 - 0xCC]; + Vec3 xC0_vec3_arr[11]; + u32 x144; u32 x148; u32 x14C; - u32 x150; + u32 x150; // num of ECB/Vec3's with data? UnkFlagStruct x154; }; @@ -733,8 +753,8 @@ struct HSD_ObjAllocUnk { s32 x20; s32 x24; s32 x28; - u32 x2C; - u32 x30; + s32 x2C; // u32 or s32? + s32 x30; // u32 or s32? s32 x34; s32 x38; s32 x3C; @@ -746,23 +766,23 @@ struct HSD_ObjAllocUnk { s32 x54; s32 x58; s32 x5C; - u32 x60; - u32 x64; + s32 x60; // u32 or s32? + s32 x64; // u32 or s32? }; struct HSD_ObjAllocUnk6 { - u8 x0; - u8* x4; - u16 x8; + u8 x0; // Gets incremented and decremented by 1 for various checks. Gets indexed into x4's struct + u8* x4; // Points to struct of ItemKinds (or array?) + u16 x8; // Max value for random integers u16 xA; - u16* xC; + u16* xC; // Points to struct of ??? }; struct HSD_ObjAllocUnk4 { u32 x0; HSD_ObjAllocUnk6 x4; s32 x14; - u64 x18; + u64 x18; // Gets set equal to gm_8016AEA4(), aka lbl_8046B6A0.unk_24D3 (which is an s8?) }; struct HSD_ObjAllocUnk5 { @@ -773,6 +793,13 @@ struct HSD_ObjAllocUnk5 { u16 xC; }; +typedef struct HSD_ObjAllocUnk7 { + s32 x0; + void* x4; + HitCapsule* x8; + void* xC; +} HSD_ObjAllocUnk7; + struct it_8026C47C_arg0_t { s32 unk0; s32 unk4; @@ -784,4 +811,14 @@ struct it_8026C47C_arg0_t { s32 unk1C; }; +struct it_8026F3D4_arg1_t { + bool x0; + ItemKind x4; + Item_GObj* x8; +}; + +struct it_8026F3D4_body_t { + u8 x0[32]; // This array length was a guess +}; + #endif diff --git a/src/melee/lb/lb_00B0.h b/src/melee/lb/lb_00B0.h index a66f870723..b0b38f778e 100644 --- a/src/melee/lb/lb_00B0.h +++ b/src/melee/lb/lb_00B0.h @@ -43,7 +43,7 @@ /* 00C7BC */ void lb_8000C7BC(HSD_JObj* src, HSD_JObj* dst); /* 00C868 */ void lb_8000C868(HSD_Joint*, HSD_JObj*, HSD_JObj*, float, float); /* 00CC5C */ s32 lbGetFreeColorRegister(s32 i0, HSD_MObj*, HSD_TExp*); -/* 00CC8C */ s32 lb_8000CC8C(s32 i); +/* 00CC8C */ s32 lb_8000CC8C(s32 i); // return type GXTevColorArg? /* 00CCA4 */ s32 lb_8000CCA4(s32 i); /* 00CD60 */ s32 lbGetFreeAlphaRegister(s32 i0, HSD_MObj*, HSD_TExp*); /* 00CD90 */ s32 lb_8000CD90(s32 i); diff --git a/src/melee/lb/lb_00F9.h b/src/melee/lb/lb_00F9.h index cb7c29f334..8ccc01204b 100644 --- a/src/melee/lb/lb_00F9.h +++ b/src/melee/lb/lb_00F9.h @@ -53,15 +53,15 @@ /* 014014 */ UNK_RET lb_80014014(UNK_PARAMS); /* 0140F8 */ UNK_RET lb_800140F8(UNK_PARAMS); /* 014234 */ UNK_RET lb_80014234(UNK_PARAMS); -/* 014258 */ bool lb_80014258(HSD_GObj* gobj, UNK_T arg1, FtCmd cmd); -/* 014498 */ void lb_80014498(UNK_T arg0); -/* 0144C8 */ bool lb_800144C8(ftDeviceUnk2*, void*, s32, s32); +/* 014258 */ bool lb_80014258(HSD_GObj* gobj, void* arg1, FtCmd cmd); +/* 014498 */ void lb_80014498(void* arg0); +/* 0144C8 */ bool lb_800144C8(void*, void*, s32, s32); /* 014534 */ UNK_RET lb_80014534(UNK_PARAMS); /* 014574 */ void lb_80014574(u8, int, int, int); /* 0145C0 */ void lb_800145C0(u8); /* 0145F4 */ UNK_RET lb_800145F4(UNK_PARAMS); /* 014638 */ bool lb_80014638(Vec3*, UNK_T); /* 014770 */ bool lb_80014770(Vec3*, int); -/* 0149E0 */ UNK_RET lb_800149E0(UNK_PARAMS); +/* 0149E0 */ bool lb_800149E0(f32*, u32); #endif diff --git a/src/melee/lb/lbaudio_ax.h b/src/melee/lb/lbaudio_ax.h index 07fd7da7d1..d316793757 100644 --- a/src/melee/lb/lbaudio_ax.h +++ b/src/melee/lb/lbaudio_ax.h @@ -52,7 +52,7 @@ /* 024C84 */ UNK_RET lbAudioAx_80024C84(UNK_PARAMS); /* 024D50 */ UNK_RET lbAudioAx_80024D50(UNK_PARAMS); /* 024D78 */ UNK_RET lbAudioAx_80024D78(UNK_PARAMS); -/* 024DC4 */ void lbAudioAx_80024DC4(void); +/* 024DC4 */ void lbAudioAx_80024DC4(s32); /* 024E50 */ UNK_RET lbAudioAx_80024E50(UNK_PARAMS); /* 024E84 */ UNK_RET lbAudioAx_80024E84(UNK_PARAMS); /* 024F08 */ UNK_RET lbAudioAx_80024F08(UNK_PARAMS); diff --git a/src/melee/lb/lbcollision.c b/src/melee/lb/lbcollision.c index 97d54e6669..96dc7f4695 100644 --- a/src/melee/lb/lbcollision.c +++ b/src/melee/lb/lbcollision.c @@ -1808,7 +1808,7 @@ void lbColl_CopyHitCapsule(HitCapsule* src, HitCapsule* dst) dst->x45 = src->x45; } -bool lbColl_80008688(HitCapsule* arg0, int arg1, Fighter* arg2) +bool lbColl_80008688(HitCapsule* arg0, int arg1, void* arg2) { HitCapsule* var_r6; HitCapsule* var_r6_2; @@ -1826,7 +1826,7 @@ bool lbColl_80008688(HitCapsule* arg0, int arg1, Fighter* arg2) var_r6 = arg0; var_r7 = 0; loop_1: - if ((Fighter*) var_r6->victims_1[0].victim == arg2) { + if (var_r6->victims_1[0].victim == arg2) { if (arg1 != 6) { if (arg1 < 6) { if (arg1 != 3) { diff --git a/src/melee/lb/lbcollision.h b/src/melee/lb/lbcollision.h index cfeeb1351a..2559985286 100644 --- a/src/melee/lb/lbcollision.h +++ b/src/melee/lb/lbcollision.h @@ -47,8 +47,8 @@ typedef struct { /* 008434 */ void lbColl_80008434(HitCapsule*); /* 008440 */ void lbColl_80008440(HitCapsule*); /* 0084FC */ void lbColl_CopyHitCapsule(HitCapsule* src, HitCapsule* dst); -/* 008688 */ bool lbColl_80008688(HitCapsule*, int, Fighter*); -/* 008820 */ bool lbColl_80008820(HitCapsule*, int, Fighter*); +/* 008688 */ bool lbColl_80008688(HitCapsule*, int, void*); +/* 008820 */ bool lbColl_80008820(HitCapsule*, int, void*); /* 0089B8 */ void lbColl_800089B8(HitCapsule* hit, UNK_T arg1); /* 008A5C */ void lbColl_80008A5C(HitCapsule* hit); /* 008D30 */ void lbColl_80008D30(HitCapsule*, UNK_T); @@ -71,7 +71,7 @@ typedef struct { float pos_z); /* 00AB2C */ bool lbColl_8000AB2C(HitResult* hit, u32 arg1, Mtx arg2, float pos_z); -/* 00ACFC */ bool lbColl_8000ACFC(UNK_T, HitCapsule*); +/* 00ACFC */ bool lbColl_8000ACFC(void*, HitCapsule*); static inline bool approximatelyZero(float x) { diff --git a/src/melee/lb/types.h b/src/melee/lb/types.h index 19561792a8..23192c2f34 100644 --- a/src/melee/lb/types.h +++ b/src/melee/lb/types.h @@ -45,14 +45,14 @@ struct HitVictim { struct HitCapsule { /* +0 */ HitCapsuleState state; /* +4 */ uint x4; - /* +8 */ int unk_count; + /* +8 */ u32 unk_count; /* +C */ float damage; /* +10 */ Vec3 b_offset; /* +1C */ float scale; /* +20 */ int kb_angle; - /* +24 */ int x24; - /* +28 */ int x28; - /* +2C */ int x2C; + /* +24 */ u32 x24; + /* +28 */ u32 x28; + /* +2C */ u32 x2C; /* +30 */ uint element; /* +34 */ int x34; /* +38 */ int sfx_severity; diff --git a/src/melee/mp/mpcoll.h b/src/melee/mp/mpcoll.h index a333692a0e..3092b26d9c 100644 --- a/src/melee/mp/mpcoll.h +++ b/src/melee/mp/mpcoll.h @@ -73,7 +73,7 @@ /* 048578 */ void mpColl_80048578(CollData*); /* 048654 */ void mpColl_80048654(CollData*); /* 048768 */ void mpColl_80048768(CollData*); -/* 048844 */ UNK_RET mpColl_80048844(UNK_PARAMS); +/* 048844 */ bool mpColl_80048844(CollData*, f32); /* 0488F4 */ UNK_RET mpColl_800488F4(UNK_PARAMS); /* 048AB0 */ UNK_RET mpColl_80048AB0(UNK_PARAMS); /* 0491C8 */ UNK_RET mpColl_800491C8(UNK_PARAMS); @@ -99,10 +99,10 @@ /* 04C864 */ void mpColl_8004C864(CollData*, s32, float, float); /* 04C91C */ void mpColl_8004C91C(CollData*, s32, float, float); /* 04CA6C */ void mpColl_8004CA6C(CollData*); -/* 04CAA0 */ UNK_RET mpColl_8004CAA0(UNK_PARAMS); -/* 04CAE8 */ UNK_RET mpColl_8004CAE8(UNK_PARAMS); -/* 04CB30 */ UNK_RET mpColl_8004CB30(UNK_PARAMS); -/* 04CB78 */ UNK_RET mpColl_8004CB78(UNK_PARAMS); +/* 04CAA0 */ bool mpColl_8004CAA0(CollData*, Vec3*); +/* 04CAE8 */ bool mpColl_8004CAE8(CollData*, Vec3*); +/* 04CB30 */ bool mpColl_8004CB30(CollData*, Vec3*); +/* 04CB78 */ bool mpColl_8004CB78(CollData*, Vec3*); /* 04CBC0 */ bool mpColl_8004CBC0(CollData*); /* 04CBE8 */ void mpColl_8004CBE8(CollData*); /* 04CBF4 */ void mpColl_8004CBF4(CollData*); diff --git a/src/melee/mp/mplib.h b/src/melee/mp/mplib.h index d67378a043..e4d36fecff 100644 --- a/src/melee/mp/mplib.h +++ b/src/melee/mp/mplib.h @@ -43,7 +43,7 @@ /* 050D68 */ UNK_RET mpLib_80050D68(UNK_PARAMS); /* 0511A4 */ UNK_RET mpLib_800511A4(UNK_PARAMS); /* 0515A0 */ UNK_RET mpLib_800515A0(UNK_PARAMS); -/* 05199C */ UNK_RET mpLib_8005199C(UNK_PARAMS); +/* 05199C */ s32 mpLib_8005199C(Vec3*, s32, s32); /* 051BA8 */ UNK_RET mpLib_80051BA8(UNK_PARAMS); /* 051EC8 */ s32 mpLib_80051EC8(Vec3*, s32*, s32*, Vec3*, s32, s32, s32, float, float, float, float); diff --git a/src/melee/pl/pl_0371.h b/src/melee/pl/pl_0371.h index 7345dcae3f..d1b5662054 100644 --- a/src/melee/pl/pl_0371.h +++ b/src/melee/pl/pl_0371.h @@ -17,13 +17,13 @@ /* 03E114 */ void pl_8003E114(u8, int, float); /* 03E150 */ void pl_8003E150(int slot, bool); /* 03E17C */ void pl_8003E17C(u8, int, Item_GObj*); -/* 03E4A4 */ void pl_8003E4A4(u8 slot, bool, s32, s32); +/* 03E4A4 */ void pl_8003E4A4(u8 slot, bool, void*, s32); /* 03E854 */ void pl_8003E854(u8, int, Item_GObj*); /* 03E978 */ void pl_8003E978(u8 slot, bool fp_x221F_b4, Item_GObj* item_gobj, float y0, float, float, float, float x1, float y1, float frame_speed_mul); /* 03EA08 */ void pl_8003EA08(u8 slot, bool); -/* 03EB30 */ void pl_8003EB30(void); +/* 03EB30 */ void pl_8003EB30(f32, u16, s32, s32, s32, u8); /* 03EC9C */ void pl_8003EC9C(s32, s32, f32, f32); /* 03FAA8 */ void pl_8003FAA8(s32 slot, s32 index, Vec3* pos, Vec3* prevPos); /* 03FC44 */ void pl_8003FC44(u8 slot, bool); diff --git a/src/melee/pl/plattack.h b/src/melee/pl/plattack.h index b1e7c59336..f816c49117 100644 --- a/src/melee/pl/plattack.h +++ b/src/melee/pl/plattack.h @@ -4,6 +4,6 @@ #include void plAttack_80037590(void); -u16 plStale_80037B08(void); +u16 plAttack_80037B08(void); #endif diff --git a/src/melee/pl/plbonuslib.h b/src/melee/pl/plbonuslib.h index 44468b0178..94bbd83f24 100644 --- a/src/melee/pl/plbonuslib.h +++ b/src/melee/pl/plbonuslib.h @@ -3,10 +3,13 @@ #include #include +#include "it/forward.h" +/* 03E70C */ void pl_8003E70C(Item_GObj*); /* 03EC30 */ void pl_8003EC30(u8, int, int, float); /* 03FDF4 */ void pl_8003FDF4(u8, int); /* 0402D0 */ void pl_800402D0(int slot, bool, bool); /* 0403C0 */ void pl_800403C0(u8, int); +/* 04049C */ void pl_8004049C(s32, ItemKind); #endif diff --git a/src/melee/pl/pltrick.h b/src/melee/pl/pltrick.h index 8b13789179..6e7647a7e4 100644 --- a/src/melee/pl/pltrick.h +++ b/src/melee/pl/pltrick.h @@ -1 +1,11 @@ +#include +#include + +#include "it/forward.h" + +#include "ft/types.h" + + +/* 037DF4 */ void pl_80037DF4(HSD_GObj*, union Struct2070*); +/* 0384DC */ void pl_800384DC(HSD_GObj*, u8, void*); diff --git a/src/melee/ty/tydisplay.h b/src/melee/ty/tydisplay.h index 8710ee385f..3f17347fc5 100644 --- a/src/melee/ty/tydisplay.h +++ b/src/melee/ty/tydisplay.h @@ -3,6 +3,7 @@ #include +s32 un_8031C354(s32, s32 (*)[], s32, s32); void* un_8031C5E4(s32); #endif diff --git a/src/sysdolphin/baselib/jobj.h b/src/sysdolphin/baselib/jobj.h index 3d1515fb63..c47b07e4e2 100644 --- a/src/sysdolphin/baselib/jobj.h +++ b/src/sysdolphin/baselib/jobj.h @@ -457,6 +457,51 @@ static inline void HSD_JObjAddRotationY(HSD_JObj* jobj, float y) } } +static inline void HSD_JObjAddRotationZ(HSD_JObj* jobj, float z) +{ + HSD_ASSERT(1053, jobj); + jobj->rotate.z += z; + if (!(jobj->flags & JOBJ_MTX_INDEP_SRT)) { + HSD_JObjSetMtxDirty(jobj); + } +} + +static inline void HSD_JObjAddScaleX(HSD_JObj* jobj, float x) +{ + // ((jobj) ? ((void) 0) : __assert("jobj.h", 1065, "jobj")); + HSD_ASSERT(1065, jobj); + jobj->scale.x += x; + // if (!(jobj->flags & (1 << 25))) { + if (!(jobj->flags & JOBJ_MTX_INDEP_SRT)) { + // { if (jobj != ((void*) 0) && !HSD_JObjMtxIsDirty(jobj)) { HSD_JObjSetMtxDirtySub(jobj); } }; + HSD_JObjSetMtxDirty(jobj); + } +} + +static inline void HSD_JObjAddScaleY(HSD_JObj* jobj, float y) +{ + // ((jobj) ? ((void) 0) : __assert("jobj.h", 1077, "jobj")); + HSD_ASSERT(1077, jobj); + jobj->scale.y += y; + // if (!(jobj->flags & (1 << 25))) { + if (!(jobj->flags & JOBJ_MTX_INDEP_SRT)) { + // { if (jobj != ((void*) 0) && !HSD_JObjMtxIsDirty(jobj)) { HSD_JObjSetMtxDirtySub(jobj); } }; + HSD_JObjSetMtxDirty(jobj); + } +} + +static inline void HSD_JObjAddScaleZ(HSD_JObj* jobj, float z) +{ + // ((jobj) ? ((void) 0) : __assert("jobj.h", 1089, "jobj")); + HSD_ASSERT(1089, jobj); + jobj->scale.z += z; + // if (!(jobj->flags & (1 << 25))) { + if (!(jobj->flags & JOBJ_MTX_INDEP_SRT)) { + // { if (jobj != ((void*) 0) && !HSD_JObjMtxIsDirty(jobj)) { HSD_JObjSetMtxDirtySub(jobj); } }; + HSD_JObjSetMtxDirty(jobj); + } +} + static inline void HSD_JObjAddTranslationY(HSD_JObj* jobj, float y) { HSD_ASSERT(1114, jobj); From b2c8bbcd1fe5742a5a957b97b8fe3d1034eac88f Mon Sep 17 00:00:00 2001 From: Aaron B Date: Mon, 13 Jan 2025 15:03:44 -0500 Subject: [PATCH 15/25] formatting --- src/common_structs.h | 4 +-- src/melee/ft/ftcoll.h | 3 +- src/melee/ft/types.h | 3 +- src/melee/gr/grzakogenerator.h | 1 - src/melee/it/itCommonItems.h | 4 +-- src/melee/it/it_266F.c | 8 ++--- src/melee/it/item.c | 6 ++-- src/melee/it/items/it_2E5A.c | 8 ++--- src/melee/it/items/itarwinglaser.h | 2 ++ src/melee/it/items/itgreatfoxlaser.h | 1 + src/melee/it/items/itklap.h | 1 + src/melee/it/items/itkyasarin.h | 2 ++ src/melee/it/items/itkyasarinegg.h | 2 +- src/melee/it/items/itlikelike.h | 1 + src/melee/it/items/itnokonoko.h | 1 + src/melee/it/items/itpatapata.h | 1 + src/melee/it/items/ittincle.h | 1 + src/melee/it/items/ittools.h | 2 ++ src/melee/it/items/itwhispyapple.h | 2 ++ src/melee/it/items/itwhitebea.h | 1 + src/melee/it/items/itzgshell.h | 1 + src/melee/it/types.h | 47 +++++++++++++++++----------- src/melee/pl/plbonuslib.h | 1 + src/melee/pl/pltrick.h | 1 - src/sysdolphin/baselib/jobj.h | 9 ++++-- 25 files changed, 67 insertions(+), 46 deletions(-) diff --git a/src/common_structs.h b/src/common_structs.h index 8e523d93be..3d828dfd40 100644 --- a/src/common_structs.h +++ b/src/common_structs.h @@ -59,8 +59,8 @@ typedef u32 HSD_Pad; #define MPCOLL_UNK 0x18000 // Floor?? #define MPCOLL_GRPUSH (1 << 15) #define MPCOLL_FLAGS_B16 (1 << 16) -#define MPCOLL_FLAGS_B20 (1 << 20) //0x100000 -#define MPCOLL_FLAGS_B21 (1 << 21) //0x200000 +#define MPCOLL_FLAGS_B20 (1 << 20) // 0x100000 +#define MPCOLL_FLAGS_B21 (1 << 21) // 0x200000 #define MPCOLL_FLAGS_B23 (1 << 23) #define MPCOLL_FLAGS_B24 (1 << 24) #define MPCOLL_FLAGS_B25 (1 << 25) diff --git a/src/melee/ft/ftcoll.h b/src/melee/ft/ftcoll.h index cf792414a3..e0c9be4cd3 100644 --- a/src/melee/ft/ftcoll.h +++ b/src/melee/ft/ftcoll.h @@ -55,7 +55,8 @@ /* 079AB0 */ UNK_RET ftColl_80079AB0(UNK_PARAMS); /* 079C70 */ float ftColl_80079C70(Fighter*, Fighter*, void*, int); /* 079EA8 */ float ftColl_80079EA8(Fighter*, HitCapsule*, int); -// /* 07A06C */ static void ftColl_8007A06C(float facing_dir, DmgLogEntry** log, +// /* 07A06C */ static void ftColl_8007A06C(float facing_dir, DmgLogEntry** +// log, // int idx, bool); /* 076808 */ static void ftColl_80076808(Fighter* fp, HitCapsule* hit, int, void* victim, bool); diff --git a/src/melee/ft/types.h b/src/melee/ft/types.h index 100f868196..9f9b8c5f3e 100644 --- a/src/melee/ft/types.h +++ b/src/melee/ft/types.h @@ -868,7 +868,8 @@ struct Fighter_DemoStrings { /* fp+2070 */ s32 x2070_int; }; -/// @todo See if this should likewise be instituted for item->xD94 thru xDA4_word/xDA8_short +/// @todo See if this should likewise be instituted for item->xD94 thru +/// xDA4_word/xDA8_short /* fp+2074 */ struct Struct2074 { /* fp+2074 */ Vec2 x2074_vec; /* fp+207C */ Vec2 x207C; diff --git a/src/melee/gr/grzakogenerator.h b/src/melee/gr/grzakogenerator.h index 4725e58ded..fcf7f8b51f 100644 --- a/src/melee/gr/grzakogenerator.h +++ b/src/melee/gr/grzakogenerator.h @@ -9,5 +9,4 @@ /* 1CACB8 */ void grZakoGenerator_801CACB8(Ground_GObj* gobj); /* 1CAE04 */ void grZakoGenerator_801CAE04(bool); - #endif diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index f3ad2c19ea..c3016dbc05 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -423,8 +423,8 @@ typedef struct itChicoritaAttr { typedef struct itChicoritaLeafAttr { f32 timer; f32 x4; - f32 x8; // x pos - f32 xC; // y pos + f32 x8; // x pos + f32 xC; // y pos f32 x10; // x vel } itChicoritaLeafAttr; diff --git a/src/melee/it/it_266F.c b/src/melee/it/it_266F.c index 741fa74ff6..e6bb4376cd 100644 --- a/src/melee/it/it_266F.c +++ b/src/melee/it/it_266F.c @@ -46,12 +46,8 @@ static Vec3 it_803B857C = { 0.0f, 0.0f, 0.0f }; static Quaternion it_803B8588 = { 0.0f, 0.0f, 0.0f, 0.0f }; static Quaternion it_803B8598 = { 0.0f, 0.0f, 0.0f, 0.0f }; static const Vec3 it_803B85A8[6] = { - { 1.0f, 0.0f, 0.0f }, - { 0.0f, 0.0f, 1.0f }, - { 0.0f, 1.0f, 0.0f }, - { 0.0f, 1.0f, 0.0f }, - { 0.0f, 1.0f, 0.0f }, - { 0.0f, 1.0f, 0.0f }, + { 1.0f, 0.0f, 0.0f }, { 0.0f, 0.0f, 1.0f }, { 0.0f, 1.0f, 0.0f }, + { 0.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, }; static s32 it_803B85F0[4]; diff --git a/src/melee/it/item.c b/src/melee/it/item.c index 833a67f3b0..19632092e4 100644 --- a/src/melee/it/item.c +++ b/src/melee/it/item.c @@ -15,8 +15,8 @@ #include "gr/grlib.h" #include "gr/stage.h" #include "it/inlines.h" -#include "it/itcoll.h" #include "it/it_2725.h" +#include "it/itcoll.h" #include "it/types.h" #include "lb/lb_00B0.h" #include "lb/lb_00F9.h" @@ -1877,8 +1877,8 @@ static void Item_8026A788(HSD_GObj* gobj) it_80272304(gobj); for (i = 0; i < dynamicBonesNum; i++, dynamicBones++) { - lb_8001044C(&dynamicBones->dyn_desc, &item_data->xB6C_vars[0].xB6C.x, item_data->xB68, - 0.0f, 0, dynamicBones->flags, 0, 1); + lb_8001044C(&dynamicBones->dyn_desc, &item_data->xB6C_vars[0].xB6C.x, + item_data->xB68, 0.0f, 0, dynamicBones->flags, 0, 1); } } diff --git a/src/melee/it/items/it_2E5A.c b/src/melee/it/items/it_2E5A.c index 5dcc956982..859dc90263 100644 --- a/src/melee/it/items/it_2E5A.c +++ b/src/melee/it/items/it_2E5A.c @@ -22,12 +22,8 @@ #include #include -const Vec3 it_803B8718 = { - 0.0f, 0.0f, 0.0f -}; -const Vec3 it_803B8724 = { - 0.0f, 0.0f, 0.0f -}; +const Vec3 it_803B8718 = { 0.0f, 0.0f, 0.0f }; +const Vec3 it_803B8724 = { 0.0f, 0.0f, 0.0f }; ItemStateTable it_803F8BD8[] = { { 0, it_802E67A8, it_802E67F4, it_802E6824 }, diff --git a/src/melee/it/items/itarwinglaser.h b/src/melee/it/items/itarwinglaser.h index 0faa72c57a..82be29315b 100644 --- a/src/melee/it/items/itarwinglaser.h +++ b/src/melee/it/items/itarwinglaser.h @@ -1,5 +1,7 @@ #include + #include "it/forward.h" + #include "it/items/types.h" extern ItemStateTable it_803F8DE8[]; diff --git a/src/melee/it/items/itgreatfoxlaser.h b/src/melee/it/items/itgreatfoxlaser.h index 9ad0a6bd42..fb07aaadaf 100644 --- a/src/melee/it/items/itgreatfoxlaser.h +++ b/src/melee/it/items/itgreatfoxlaser.h @@ -4,6 +4,7 @@ #include #include "it/forward.h" + #include "it/items/types.h" /* 2EAF28 */ UNK_T it_802EAF28(Item_GObj* gobj); diff --git a/src/melee/it/items/itklap.h b/src/melee/it/items/itklap.h index 19f8dec483..f620320692 100644 --- a/src/melee/it/items/itklap.h +++ b/src/melee/it/items/itklap.h @@ -4,6 +4,7 @@ #include #include "it/forward.h" + #include "it/items/types.h" /* 2E1820 */ void it_802E1820(Item_GObj*); diff --git a/src/melee/it/items/itkyasarin.h b/src/melee/it/items/itkyasarin.h index 9e5400373c..22a2c8c3da 100644 --- a/src/melee/it/items/itkyasarin.h +++ b/src/melee/it/items/itkyasarin.h @@ -2,7 +2,9 @@ #define GALE01_2ECCDC #include + #include "it/forward.h" + #include "it/items/types.h" /* 2ECCDC */ void it_802ECCDC(Item_GObj*); diff --git a/src/melee/it/items/itkyasarinegg.h b/src/melee/it/items/itkyasarinegg.h index c881fa3005..848a00ab70 100644 --- a/src/melee/it/items/itkyasarinegg.h +++ b/src/melee/it/items/itkyasarinegg.h @@ -1,6 +1,7 @@ #include #include "it/forward.h" + #include "it/items/types.h" extern ItemStateTable it_803F9328[]; @@ -14,4 +15,3 @@ bool it_802EFF1C(Item_GObj*); bool it_802F01F8(Item_GObj*); bool it_802F0010(Item_GObj*); void it_802F0320(Item_GObj*, Item_GObj*); - diff --git a/src/melee/it/items/itlikelike.h b/src/melee/it/items/itlikelike.h index e12bbf7ae9..1404c539c1 100644 --- a/src/melee/it/items/itlikelike.h +++ b/src/melee/it/items/itlikelike.h @@ -4,6 +4,7 @@ #include #include "it/forward.h" + #include "it/items/types.h" /* 2D9A2C */ UNK_RET it_802D9A2C(UNK_PARAMS); diff --git a/src/melee/it/items/itnokonoko.h b/src/melee/it/items/itnokonoko.h index 259fbea157..012e3f8f04 100644 --- a/src/melee/it/items/itnokonoko.h +++ b/src/melee/it/items/itnokonoko.h @@ -6,6 +6,7 @@ #include "it/forward.h" #include "it/items/forward.h" + #include "it/items/types.h" /* 2DC69C */ void it_802DC69C(Item_GObj*); diff --git a/src/melee/it/items/itpatapata.h b/src/melee/it/items/itpatapata.h index a1fa0642f8..ce7f5b59d0 100644 --- a/src/melee/it/items/itpatapata.h +++ b/src/melee/it/items/itpatapata.h @@ -2,6 +2,7 @@ #define GALE01_2E05A0 #include "it/forward.h" + #include "it/items/types.h" /* 2E05A0 */ void it_802E05A0(Item_GObj*); diff --git a/src/melee/it/items/ittincle.h b/src/melee/it/items/ittincle.h index 40d68daca5..e26e234112 100644 --- a/src/melee/it/items/ittincle.h +++ b/src/melee/it/items/ittincle.h @@ -4,6 +4,7 @@ #include #include "it/forward.h" + #include "it/items/types.h" /* 2EB5C8 */ void it_802EB5C8(Item_GObj*); diff --git a/src/melee/it/items/ittools.h b/src/melee/it/items/ittools.h index 82b6f6e469..403bf8a03b 100644 --- a/src/melee/it/items/ittools.h +++ b/src/melee/it/items/ittools.h @@ -2,7 +2,9 @@ #define GALE01_2EEFA8 #include + #include "it/forward.h" + #include "it/items/types.h" /* 2EEFA8 */ UNK_RET it_802EEFA8(UNK_PARAMS); diff --git a/src/melee/it/items/itwhispyapple.h b/src/melee/it/items/itwhispyapple.h index b2c2de165c..9dbca0cc78 100644 --- a/src/melee/it/items/itwhispyapple.h +++ b/src/melee/it/items/itwhispyapple.h @@ -2,7 +2,9 @@ #define GALE01_2EE200 #include + #include "it/forward.h" + #include "it/items/types.h" /* 2EE200 */ UNK_RET it_802EE200(UNK_PARAMS); diff --git a/src/melee/it/items/itwhitebea.h b/src/melee/it/items/itwhitebea.h index 51a41a5b5e..bc72a2fd2b 100644 --- a/src/melee/it/items/itwhitebea.h +++ b/src/melee/it/items/itwhitebea.h @@ -4,6 +4,7 @@ #include #include "it/forward.h" + #include "it/items/types.h" /* 2E31F8 */ void it_802E31F8(Item_GObj*); diff --git a/src/melee/it/items/itzgshell.h b/src/melee/it/items/itzgshell.h index 0742b890b3..d0961384db 100644 --- a/src/melee/it/items/itzgshell.h +++ b/src/melee/it/items/itzgshell.h @@ -5,6 +5,7 @@ #include #include "it/forward.h" + #include "it/items/types.h" /* 2DDB38 */ UNK_RET it_802DDB38(UNK_PARAMS); diff --git a/src/melee/it/types.h b/src/melee/it/types.h index 49b0c73002..3f8b96e724 100644 --- a/src/melee/it/types.h +++ b/src/melee/it/types.h @@ -144,7 +144,8 @@ struct ItemAttr { /// @sz{8} struct ItemDynamics { - /// @todo Combine with ftDynamics? Can see in it_8027163C that this struct does not work perfectly + /// @todo Combine with ftDynamics? Can see in it_8027163C that this struct + /// does not work perfectly /// @at{0} @sz{4} int count; @@ -270,10 +271,10 @@ struct Item { Vec3 x70_nudge; Vec3 x7C; - Vec3 x88; // From it_80277040 - Vec3 x94; // From it_80277040 - Vec3 xA0; // From it_802734B4 - Vec3 xAC_unk; // From it_80276CEC + Vec3 x88; // From it_80277040 + Vec3 x94; // From it_80277040 + Vec3 xA0; // From it_802734B4 + Vec3 xAC_unk; // From it_80276CEC ItemLogicTable* xB8_itemLogicTable; // Global item callbacks ItemStateTable* xBC_itemStateContainer; GroundOrAir ground_or_air; @@ -290,9 +291,9 @@ struct Item { /// @brief Item's current owner HSD_GObj* owner; - HSD_GObj* x51C; // Related to the owner gobj + HSD_GObj* x51C; // Related to the owner gobj CameraBox* x520_cameraBox; // CameraBox - FtCmdState* x524_cmd; // should this be CommandInfo* instead? + FtCmdState* x524_cmd; // should this be CommandInfo* instead? f32 x528; void* x52C_item_script; // Script parse? u32 x530; @@ -313,9 +314,13 @@ struct Item { s32 x138; } x5D4_hitboxes[4]; u32 xAC4_ignoreItemID; // Cannot hit items with this index? - u8 xAC8_hurtboxNum; // Number of hurtboxes this item has - HurtCapsule xACC_itemHurtbox[2]; // Are these really size 0x4C? Code in itcoll.c and it_266F.c adds 0x44 to iterate through. (Conversely can see adding 0x4C to iterate in ftcoll.c) - // Can see how vars don't line up in it_80274D6C and it_80274DAC + u8 xAC8_hurtboxNum; // Number of hurtboxes this item has + HurtCapsule + xACC_itemHurtbox[2]; // Are these really size 0x4C? Code in itcoll.c + // and it_266F.c adds 0x44 to iterate through. + // (Conversely can see adding 0x4C to iterate in + // ftcoll.c) Can see how vars don't line up in + // it_80274D6C and it_80274DAC f32 xB64; u8 xB68; // int for ItemDynamics->count? u8 xB69; @@ -326,7 +331,7 @@ struct Item { // u32 xB6C; // struct DynamicsData* for DynamicsDesc->data? // u32 xB70; // int for DynamicsDesc->count? // u32 xB74; // pos.x? - f32 xB78; // pos.y? scale? + f32 xB78; // pos.y? scale? HSD_JObj* xB7C; // HSD_JObj* for bone? u32 xB80; Vec3 xB84; @@ -394,12 +399,12 @@ struct Item { f32 xCB8_outDamageDirection; // 0xcb8, updated @ 80078184 f32 xCBC_hitlagFrames; // 0xcbc, hitlag frames remaining f32 xCC0; // 0xcc0 - s32 xCC4; // 0xcc4, switch statement for this in it_8027CBFC - f32 xCC8_knockback; // 0xcc8 + s32 xCC4; // 0xcc4, switch statement for this in it_8027CBFC + f32 xCC8_knockback; // 0xcc8 f32 xCCC_incDamageDirection; // Direction from which damage was applied? f32 xCD0; // 0xcd0 - Vec3 xCD4; // 0xcd4 - Vec3 xCE0; // 0xce0 + Vec3 xCD4; // 0xcd4 + Vec3 xCE0; // 0xce0 HSD_GObj* xCEC_fighterGObj; // 0xcec HSD_GObj* xCF0_itemGObj; // 0xcf0, is a fp GObj, but is the owner of the @@ -683,7 +688,8 @@ struct ItemCommonData { s32 xDC; f32 unk_degrees; ///< @at{E0} u8 filler_1a[0xE8 - 0xE4]; - u8 xE8; // struct that has a float (scale?) as the first member? See it_80275BC8 + u8 xE8; // struct that has a float (scale?) as the first member? See + // it_80275BC8 u8 filler_1a_2[0xF0 - 0xEC]; f32 xF0; f32 xF4; @@ -694,7 +700,8 @@ struct ItemCommonData { s32 x12C; // used in it_8026CF04 s32 x130; // used in it_8026CF04 s32 x134; // used in it_8026CF04 - // u8 filler_2[0x148 - 0x138]; - replaced with vars that are used for calc's in it_8026F8B4 + // u8 filler_2[0x148 - 0x138]; - replaced with vars that are used for + // calc's in it_8026F8B4 s32 x138; s32 x13C; s32 x140; @@ -771,7 +778,8 @@ struct HSD_ObjAllocUnk { }; struct HSD_ObjAllocUnk6 { - u8 x0; // Gets incremented and decremented by 1 for various checks. Gets indexed into x4's struct + u8 x0; // Gets incremented and decremented by 1 for various checks. Gets + // indexed into x4's struct u8* x4; // Points to struct of ItemKinds (or array?) u16 x8; // Max value for random integers u16 xA; @@ -782,7 +790,8 @@ struct HSD_ObjAllocUnk4 { u32 x0; HSD_ObjAllocUnk6 x4; s32 x14; - u64 x18; // Gets set equal to gm_8016AEA4(), aka lbl_8046B6A0.unk_24D3 (which is an s8?) + u64 x18; // Gets set equal to gm_8016AEA4(), aka lbl_8046B6A0.unk_24D3 + // (which is an s8?) }; struct HSD_ObjAllocUnk5 { diff --git a/src/melee/pl/plbonuslib.h b/src/melee/pl/plbonuslib.h index 94bbd83f24..f42ab29a1f 100644 --- a/src/melee/pl/plbonuslib.h +++ b/src/melee/pl/plbonuslib.h @@ -3,6 +3,7 @@ #include #include + #include "it/forward.h" /* 03E70C */ void pl_8003E70C(Item_GObj*); diff --git a/src/melee/pl/pltrick.h b/src/melee/pl/pltrick.h index 6e7647a7e4..6e47e6cd76 100644 --- a/src/melee/pl/pltrick.h +++ b/src/melee/pl/pltrick.h @@ -6,6 +6,5 @@ #include "ft/types.h" - /* 037DF4 */ void pl_80037DF4(HSD_GObj*, union Struct2070*); /* 0384DC */ void pl_800384DC(HSD_GObj*, u8, void*); diff --git a/src/sysdolphin/baselib/jobj.h b/src/sysdolphin/baselib/jobj.h index c47b07e4e2..dbbce06678 100644 --- a/src/sysdolphin/baselib/jobj.h +++ b/src/sysdolphin/baselib/jobj.h @@ -473,7 +473,8 @@ static inline void HSD_JObjAddScaleX(HSD_JObj* jobj, float x) jobj->scale.x += x; // if (!(jobj->flags & (1 << 25))) { if (!(jobj->flags & JOBJ_MTX_INDEP_SRT)) { - // { if (jobj != ((void*) 0) && !HSD_JObjMtxIsDirty(jobj)) { HSD_JObjSetMtxDirtySub(jobj); } }; + // { if (jobj != ((void*) 0) && !HSD_JObjMtxIsDirty(jobj)) { + // HSD_JObjSetMtxDirtySub(jobj); } }; HSD_JObjSetMtxDirty(jobj); } } @@ -485,7 +486,8 @@ static inline void HSD_JObjAddScaleY(HSD_JObj* jobj, float y) jobj->scale.y += y; // if (!(jobj->flags & (1 << 25))) { if (!(jobj->flags & JOBJ_MTX_INDEP_SRT)) { - // { if (jobj != ((void*) 0) && !HSD_JObjMtxIsDirty(jobj)) { HSD_JObjSetMtxDirtySub(jobj); } }; + // { if (jobj != ((void*) 0) && !HSD_JObjMtxIsDirty(jobj)) { + // HSD_JObjSetMtxDirtySub(jobj); } }; HSD_JObjSetMtxDirty(jobj); } } @@ -497,7 +499,8 @@ static inline void HSD_JObjAddScaleZ(HSD_JObj* jobj, float z) jobj->scale.z += z; // if (!(jobj->flags & (1 << 25))) { if (!(jobj->flags & JOBJ_MTX_INDEP_SRT)) { - // { if (jobj != ((void*) 0) && !HSD_JObjMtxIsDirty(jobj)) { HSD_JObjSetMtxDirtySub(jobj); } }; + // { if (jobj != ((void*) 0) && !HSD_JObjMtxIsDirty(jobj)) { + // HSD_JObjSetMtxDirtySub(jobj); } }; HSD_JObjSetMtxDirty(jobj); } } From 64fb76b9e8997be4a5390ccb93d6d40dbe29339f Mon Sep 17 00:00:00 2001 From: Aaron B Date: Mon, 13 Jan 2025 15:27:05 -0500 Subject: [PATCH 16/25] Update itnokonoko.h --- src/melee/it/items/itnokonoko.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/melee/it/items/itnokonoko.h b/src/melee/it/items/itnokonoko.h index dd1993ff2d..3ca429bbba 100644 --- a/src/melee/it/items/itnokonoko.h +++ b/src/melee/it/items/itnokonoko.h @@ -6,6 +6,7 @@ #include "it/forward.h" #include +#include "it/items/types.h" /* 2DC69C */ void it_802DC69C(Item_GObj*); /* 2DC774 */ bool it_802DC774(Item_GObj*); From 17ba1d54468285fdf8bd251320a2e4cdac20be71 Mon Sep 17 00:00:00 2001 From: Aaron B Date: Mon, 13 Jan 2025 15:27:10 -0500 Subject: [PATCH 17/25] Update itnokonoko.h --- src/melee/it/items/itnokonoko.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/melee/it/items/itnokonoko.h b/src/melee/it/items/itnokonoko.h index 3ca429bbba..6c1a7c6d72 100644 --- a/src/melee/it/items/itnokonoko.h +++ b/src/melee/it/items/itnokonoko.h @@ -6,6 +6,7 @@ #include "it/forward.h" #include + #include "it/items/types.h" /* 2DC69C */ void it_802DC69C(Item_GObj*); From 69bcd9dfcde01dba1b0fa9449dcfe6429f3c371f Mon Sep 17 00:00:00 2001 From: Aaron B Date: Mon, 13 Jan 2025 15:29:44 -0500 Subject: [PATCH 18/25] Removing unused includes --- src/melee/ft/ftcoll.c | 1 - src/melee/it/it_266F.h | 2 -- src/melee/it/itcoll.c | 1 - src/melee/it/itcoll.h | 3 ++- src/melee/lb/lbcollision.h | 1 - src/melee/pl/pltrick.h | 2 -- 6 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/melee/ft/ftcoll.c b/src/melee/ft/ftcoll.c index fcd35e61d6..833424ff9a 100644 --- a/src/melee/ft/ftcoll.c +++ b/src/melee/ft/ftcoll.c @@ -22,7 +22,6 @@ #include "ftCommon/ftCo_Guard.h" #include "ftCommon/types.h" #include "gm/gm_1601.h" -#include "it/it_266F.h" #include "it/it_26B1.h" #include "lb/lbcollision.h" #include "lb/types.h" diff --git a/src/melee/it/it_266F.h b/src/melee/it/it_266F.h index 763370c310..92e72730cb 100644 --- a/src/melee/it/it_266F.h +++ b/src/melee/it/it_266F.h @@ -4,8 +4,6 @@ #include #include -#include "ft/forward.h" -#include "lb/forward.h" #include #include diff --git a/src/melee/it/itcoll.c b/src/melee/it/itcoll.c index 831aca7af0..c8e4e6c0a9 100644 --- a/src/melee/it/itcoll.c +++ b/src/melee/it/itcoll.c @@ -15,7 +15,6 @@ #include "ft/inlines.h" #include "ftCommon/ftCo_DownAttack.h" #include "gm/gm_1601.h" -#include "it/it_266F.h" #include "it/it_26B1.h" #include "it/it_2725.h" #include "it/item.h" diff --git a/src/melee/it/itcoll.h b/src/melee/it/itcoll.h index eb521b1663..6422d076d4 100644 --- a/src/melee/it/itcoll.h +++ b/src/melee/it/itcoll.h @@ -3,7 +3,8 @@ #include -#include "it/item.h" +#include "it/forward.h" +#include "lb/types.h" /* 26F9AC */ void it_8026F9AC(s32, void*, HitCapsule*, HurtCapsule*); /* 26FA2C */ void it_8026FA2C(Item*, HitCapsule*, s32, Item*, bool); diff --git a/src/melee/lb/lbcollision.h b/src/melee/lb/lbcollision.h index 2559985286..fcf7f145bd 100644 --- a/src/melee/lb/lbcollision.h +++ b/src/melee/lb/lbcollision.h @@ -4,7 +4,6 @@ #include #include -#include "ft/forward.h" #include "lb/forward.h" #include diff --git a/src/melee/pl/pltrick.h b/src/melee/pl/pltrick.h index 6e47e6cd76..b53a9a090c 100644 --- a/src/melee/pl/pltrick.h +++ b/src/melee/pl/pltrick.h @@ -2,8 +2,6 @@ #include #include -#include "it/forward.h" - #include "ft/types.h" /* 037DF4 */ void pl_80037DF4(HSD_GObj*, union Struct2070*); From e5c536e3be374dbd2e62bb068fdef7c64ec1432e Mon Sep 17 00:00:00 2001 From: Aaron B Date: Mon, 13 Jan 2025 15:29:50 -0500 Subject: [PATCH 19/25] Formatting --- src/melee/it/itcoll.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/melee/it/itcoll.h b/src/melee/it/itcoll.h index 6422d076d4..ba57f27a0c 100644 --- a/src/melee/it/itcoll.h +++ b/src/melee/it/itcoll.h @@ -4,6 +4,7 @@ #include #include "it/forward.h" + #include "lb/types.h" /* 26F9AC */ void it_8026F9AC(s32, void*, HitCapsule*, HurtCapsule*); From 6c38d2d8b5f40a6e94c916eabb802b71c5f70117 Mon Sep 17 00:00:00 2001 From: Aaron B Date: Mon, 13 Jan 2025 16:02:16 -0500 Subject: [PATCH 20/25] Error fixes --- src/melee/ft/ft_0877.c | 3 +-- src/melee/ft/ftaction.c | 2 +- src/melee/it/itCommonItems.h | 6 +++--- src/melee/it/it_266F.c | 10 +++++----- src/melee/it/it_2725.c | 8 ++++---- src/melee/it/it_2725.h | 4 ++-- src/melee/it/item.c | 2 +- src/melee/it/items/itcoin.c | 1 + src/melee/it/items/itdkinoko.c | 13 +++++++------ src/melee/it/items/itgamewatchpanic.c | 2 +- src/melee/it/items/itgreatfoxlaser.c | 10 +++++----- src/melee/it/items/itheiho.c | 2 +- src/melee/it/items/itkinoko.c | 12 ++++++------ src/melee/it/items/itmato.c | 2 +- src/melee/it/items/itnokonoko.c | 5 +++-- src/melee/it/items/itwhispyapple.c | 4 ++-- src/melee/it/items/itzrshell.c | 25 +++++++++++++------------ src/melee/it/items/itzrshell.h | 2 +- 18 files changed, 58 insertions(+), 55 deletions(-) diff --git a/src/melee/ft/ft_0877.c b/src/melee/ft/ft_0877.c index eb47e3358b..ddb443dc23 100644 --- a/src/melee/ft/ft_0877.c +++ b/src/melee/ft/ft_0877.c @@ -431,8 +431,7 @@ s32 ft_80087D0C(Fighter* fighter, s32 sfx_id) void ft_8008805C(Fighter* arg0, s32 arg1) { - ft_80087D0C(arg0, arg1); - lbAudioAx_80024DC4(); + lbAudioAx_80024DC4(ft_80087D0C(arg0, arg1)); } void ft_80088080(Fighter* fp) diff --git a/src/melee/ft/ftaction.c b/src/melee/ft/ftaction.c index 832cafd1ea..790ad6a652 100644 --- a/src/melee/ft/ftaction.c +++ b/src/melee/ft/ftaction.c @@ -482,7 +482,7 @@ void ftAction_80071784(Fighter_GObj* gobj, FtCmdState* cmd) cmd->x8 += 4; } -void ftAction_800717C8(Fighter_GObj* gobj, *cmd) +void ftAction_800717C8(Fighter_GObj* gobj, FtCmdState* cmd) { cmd->x8 += 4; } diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index e16d83e5f2..60aba009f3 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -391,9 +391,9 @@ typedef struct itHassam_ItemVars { typedef struct itKinoko_ItemVars { f32 x0; - f32 x4; - f32 x8; - f32 xC; + Vec3 x4; + // f32 x8; + // f32 xC; } itKinoko_ItemVars; typedef struct itNokoNoko_ItemVars { diff --git a/src/melee/it/it_266F.c b/src/melee/it/it_266F.c index e6bb4376cd..c1f720ed18 100644 --- a/src/melee/it/it_266F.c +++ b/src/melee/it/it_266F.c @@ -1181,7 +1181,7 @@ bool it_8026E32C(Item_GObj* item_gobj, HSD_GObjEvent arg1) { void it_8026E414(Item_GObj* item_gobj, HSD_GObjEvent arg1) { bool chk = it_8026DF34(item_gobj); - + chk |= it_80276308(item_gobj); chk |= it_802763E0(item_gobj); if (chk & 0xE) { @@ -1717,7 +1717,7 @@ static inline void it_8026EECC_inline_1(HSD_GObj* gobj, s32 arg1, Vec3* pos) { Item* ip = gobj->user_data; Vec3* new_pos = NULL; it_266F_ItemVars* it_266F; - + ip->xDCF_flag.b4 = 1; ip->xDCF_flag.b5 = 0; it_266F = &ip->xDD4_itemVar.it_266F; @@ -1734,7 +1734,7 @@ static inline void it_8026EECC_inline_1(HSD_GObj* gobj, s32 arg1, Vec3* pos) { static inline void it_8026EECC_inline_2(HSD_GObj* gobj, s32 arg1, Vec3* pos) { Item* ip = gobj->user_data; Vec3* new_pos = NULL; - + ip->xDCF_flag.b4 = 0; ip->xDCF_flag.b5 = 0; if (ip->xDCF_flag.b7) { @@ -1747,7 +1747,7 @@ static inline void it_8026EECC_inline_3(HSD_GObj* gobj, s32 arg1, Vec3* pos) { Item* ip = gobj->user_data; Vec3* new_pos = NULL; it_266F_ItemVars* it_266F; - + ip->xDCF_flag.b4 = 1; ip->xDCF_flag.b5 = 1; it_266F = &ip->xDD4_itemVar.it_266F; @@ -1758,7 +1758,7 @@ static inline void it_8026EECC_inline_3(HSD_GObj* gobj, s32 arg1, Vec3* pos) { } else { new_pos = NULL; } - + it_8026EB18(gobj, arg1, new_pos); it_8026EBC8(gobj, it_266F->x0, it_266F->x4); it_8026EC54(gobj, it_266F->x8, it_266F->xC); diff --git a/src/melee/it/it_2725.c b/src/melee/it/it_2725.c index 623b2965cd..6be0a2aed9 100644 --- a/src/melee/it/it_2725.c +++ b/src/melee/it/it_2725.c @@ -10347,15 +10347,15 @@ void it_8027BBF4(Item_GObj* item_gobj, bool arg_chk, f64 arg8, f32 arg9) } // Might take in and pass more vars -void it_8027C0A8(Item_GObj* item_gobj) +void it_8027C0A8(Item_GObj* item_gobj, f32 arg4, f32 arg5) { - it_8027BBF4(item_gobj, false, 0, 0); + it_8027BBF4(item_gobj, false, arg4, arg5); } // Might take in and pass more vars -void it_8027C0CC(Item_GObj* item_gobj) +void it_8027C0CC(Item_GObj* item_gobj, f32 arg4, f32 arg5) { - it_8027BBF4(item_gobj, true, 0, 0); + it_8027BBF4(item_gobj, true, arg4, arg5); } void it_8027C0F0(Item_GObj* item_gobj, Vec3* arg1, f64 arg8, f32 arg9) diff --git a/src/melee/it/it_2725.h b/src/melee/it/it_2725.h index 9c7880bd88..1da6872be2 100644 --- a/src/melee/it/it_2725.h +++ b/src/melee/it/it_2725.h @@ -236,8 +236,8 @@ /* 27BA54 */ void it_8027BA54(HSD_GObj*, Vec3*); /* 27BB1C */ void it_8027BB1C(Vec3*, Vec3*); /* 27BBF4 */ void it_8027BBF4(Item_GObj*, bool, f64, f32); -/* 27C0A8 */ void it_8027C0A8(Item_GObj*); -/* 27C0CC */ void it_8027C0CC(Item_GObj*); +/* 27C0A8 */ void it_8027C0A8(Item_GObj*, f32, f32); +/* 27C0CC */ void it_8027C0CC(Item_GObj*, f32, f32); /* 27C0F0 */ void it_8027C0F0(Item_GObj*, Vec3*, f64, f32); /* 27C56C */ void it_8027C56C(Item_GObj*, f32); /* 27C794 */ bool it_8027C794(Item_GObj*); diff --git a/src/melee/it/item.c b/src/melee/it/item.c index 19632092e4..51a3aeb7c3 100644 --- a/src/melee/it/item.c +++ b/src/melee/it/item.c @@ -1638,7 +1638,7 @@ static bool Item_80269F14(HSD_GObj* gobj) } db_80225DD8(gobj, temp_item->owner); - temp_item->xD90 = temp_item->xC74; + temp_item->xD90.x2070_int = temp_item->xC74; temp_item->xD94 = temp_item->xC78; temp_item->xD9C = temp_item->xC80; temp_item->xDA4_word = temp_item->xC88; diff --git a/src/melee/it/items/itcoin.c b/src/melee/it/items/itcoin.c index f60623d93a..2457371d6a 100644 --- a/src/melee/it/items/itcoin.c +++ b/src/melee/it/items/itcoin.c @@ -12,6 +12,7 @@ #include "it/it_26B1.h" #include "it/it_2725.h" #include "it/itCommonItems.h" +#include "it/itcoll.h" #include "it/item.h" #include "lb/lbaudio_ax.h" #include "lb/lbvector.h" diff --git a/src/melee/it/items/itdkinoko.c b/src/melee/it/items/itdkinoko.c index 2826c4c69e..9c25deec64 100644 --- a/src/melee/it/items/itdkinoko.c +++ b/src/melee/it/items/itdkinoko.c @@ -4,6 +4,7 @@ #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/itkinoko.h" @@ -24,9 +25,9 @@ void it_80293A08(Item_GObj* gobj) } it->xD5C = 0; it->xDD4_itemVar.kinoko.x0 = 0.0f; - it->xDD4_itemVar.kinoko.x4 = 0.0f; - it->xDD4_itemVar.kinoko.x8 = 1.0f; - it->xDD4_itemVar.kinoko.xC = 0.0f; + it->xDD4_itemVar.kinoko.x4.x = 0.0f; + it->xDD4_itemVar.kinoko.x4.y = 1.0f; + it->xDD4_itemVar.kinoko.x4.z = 0.0f; it_80293BE8(gobj); } @@ -55,7 +56,7 @@ void it_80293AE8(Item_GObj* gobj) if (it->ground_or_air != GA_Air) { it->xDD4_itemVar.kinoko.x0 = attrs->x0 * it->facing_dir; it->x40_vel.x = - it->xDD4_itemVar.kinoko.x0 * it->xDD4_itemVar.kinoko.x8; + it->xDD4_itemVar.kinoko.x0 * it->xDD4_itemVar.kinoko.x4.y; } } @@ -70,7 +71,7 @@ bool it_80293B24(Item_GObj* gobj) if ((cd->env_flags & MPCOLL_UNK)) { it_80276408(gobj, cd, &it->xDD4_itemVar.kinoko.x4); } else { - it->xDD4_itemVar.kinoko.x4 = 0.0f; + it->xDD4_itemVar.kinoko.x4.x = 0.0f; } if ((cd->env_flags & MPCOLL_RIGHTWALL) || (cd->env_flags & MPCOLL_LEFTWALL)) @@ -78,7 +79,7 @@ bool it_80293B24(Item_GObj* gobj) it->facing_dir = -it->facing_dir; it->xDD4_itemVar.kinoko.x0 = -it->xDD4_itemVar.kinoko.x0; it->x40_vel.x = - it->xDD4_itemVar.kinoko.x0 * it->xDD4_itemVar.kinoko.x8; + it->xDD4_itemVar.kinoko.x0 * it->xDD4_itemVar.kinoko.x4.y; } } return 0; diff --git a/src/melee/it/items/itgamewatchpanic.c b/src/melee/it/items/itgamewatchpanic.c index 4ec6007b1d..b1beb86f8f 100644 --- a/src/melee/it/items/itgamewatchpanic.c +++ b/src/melee/it/items/itgamewatchpanic.c @@ -36,7 +36,7 @@ HSD_GObj* it_802C7D60(Item_GObj* parent, Vec3* pos, Fighter_Part arg2, f32 dir) attr = ip->xC4_article_data->x4_specialAttributes; Item_8026AB54(gobj, parent, arg2); db_80225DD8(gobj, parent); - it_8027CE64(gobj, parent, *attr); + it_8027CE64(gobj, parent, attr); return gobj; } return NULL; diff --git a/src/melee/it/items/itgreatfoxlaser.c b/src/melee/it/items/itgreatfoxlaser.c index 35df92071a..6161f5ecac 100644 --- a/src/melee/it/items/itgreatfoxlaser.c +++ b/src/melee/it/items/itgreatfoxlaser.c @@ -2,9 +2,9 @@ #include "it/inlines.h" -UNK_T it_802EAF28(Item_GObj* gobj) +UNK_T it_802EAF28(Item_GObj* item_gobj) { - return M2C_FIELD(&GET_ITEM(gobj)->xDD4_itemVar._, UNK_T*, 0x38); + return M2C_FIELD(&GET_ITEM(item_gobj)->xDD4_itemVar._, UNK_T*, 0x38); } /// #it_802EAF34 @@ -17,17 +17,17 @@ UNK_T it_802EAF28(Item_GObj* gobj) /// #it_802EB3C0 -bool it_802EB444(void) +bool it_802EB444(Item_GObj* item_gobj) { return false; } -bool it_802EB44C(void) +bool it_802EB44C(Item_GObj* item_gobj) { return false; } -bool it_802EB454(void) +bool it_802EB454(Item_GObj* item_gobj) { return false; } diff --git a/src/melee/it/items/itheiho.c b/src/melee/it/items/itheiho.c index 5554abdcc6..b48baf7a1d 100644 --- a/src/melee/it/items/itheiho.c +++ b/src/melee/it/items/itheiho.c @@ -58,7 +58,7 @@ void it_802D8688(Item_GObj* gobj) { Item* ip = GET_ITEM(gobj); PAD_STACK(4); - it_8027B730(); + it_8027B730(gobj); ip->xD5C = 0; ip->xDCC_flag.b3 = 0; ip->xDD4_itemVar.heiho.x54 = it_8028FAF4(NULL, &ip->pos); diff --git a/src/melee/it/items/itkinoko.c b/src/melee/it/items/itkinoko.c index a577f02d73..69d937edb2 100644 --- a/src/melee/it/items/itkinoko.c +++ b/src/melee/it/items/itkinoko.c @@ -29,9 +29,9 @@ void it_8029367C(Item_GObj* gobj) } it->xD5C = 0; it->xDD4_itemVar.kinoko.x0 = 0.0f; - it->xDD4_itemVar.kinoko.x4 = 0.0f; - it->xDD4_itemVar.kinoko.x8 = 1.0f; - it->xDD4_itemVar.kinoko.xC = 0.0f; + it->xDD4_itemVar.kinoko.x4.x = 0.0f; + it->xDD4_itemVar.kinoko.x4.y = 1.0f; + it->xDD4_itemVar.kinoko.x4.z = 0.0f; it_8029385C(gobj); } @@ -60,7 +60,7 @@ void it_8029375C(Item_GObj* gobj) if (it->ground_or_air != GA_Air) { it->xDD4_itemVar.kinoko.x0 = attrs->x0 * it->facing_dir; it->x40_vel.x = - it->xDD4_itemVar.kinoko.x0 * it->xDD4_itemVar.kinoko.x8; + it->xDD4_itemVar.kinoko.x0 * it->xDD4_itemVar.kinoko.x4.y; } } @@ -75,7 +75,7 @@ bool it_80293798(Item_GObj* gobj) if ((cd->env_flags & MPCOLL_UNK)) { it_80276408(gobj, cd, &it->xDD4_itemVar.kinoko.x4); } else { - it->xDD4_itemVar.kinoko.x4 = 0.0f; + it->xDD4_itemVar.kinoko.x4.x = 0.0f; } if ((cd->env_flags & MPCOLL_RIGHTWALL) || (cd->env_flags & MPCOLL_LEFTWALL)) @@ -83,7 +83,7 @@ bool it_80293798(Item_GObj* gobj) it->facing_dir = -it->facing_dir; it->xDD4_itemVar.kinoko.x0 = -it->xDD4_itemVar.kinoko.x0; it->x40_vel.x = - it->xDD4_itemVar.kinoko.x0 * it->xDD4_itemVar.kinoko.x8; + it->xDD4_itemVar.kinoko.x0 * it->xDD4_itemVar.kinoko.x4.y; } } return 0; diff --git a/src/melee/it/items/itmato.c b/src/melee/it/items/itmato.c index 483b16bf43..a52b361539 100644 --- a/src/melee/it/items/itmato.c +++ b/src/melee/it/items/itmato.c @@ -60,7 +60,7 @@ bool it_802D85EC(Item_GObj* item_gobj) return false; } -bool it_802D85F4(void) +bool it_802D85F4(Item_GObj* item_gobj) { Ground_801C4338(); return true; diff --git a/src/melee/it/items/itnokonoko.c b/src/melee/it/items/itnokonoko.c index 8ba603dc1f..a26967e874 100644 --- a/src/melee/it/items/itnokonoko.c +++ b/src/melee/it/items/itnokonoko.c @@ -6,6 +6,7 @@ #include "it/it_266F.h" #include "it/it_26B1.h" #include "it/it_2725.h" +#include "it/item.h" #include "it/items/itzgshell.h" #include "it/items/itzrshell.h" #include "mp/mpcoll.h" @@ -32,7 +33,7 @@ void static inline coll_inline(Item* ip) void it_802DC69C(Item_GObj* gobj) { Item* ip = GET_ITEM(gobj); - it_8027B730(); + it_8027B730(gobj); it_8027C56C(gobj, ip->facing_dir); coll_inline(ip); ip->xD5C = 0; @@ -458,7 +459,7 @@ void it_802DD59C(Item_GObj* gobj) void it_802DD67C(Item_GObj* gobj) { Item* ip = gobj->user_data; - it_8027CB3C(); + it_8027CB3C(gobj); it_80274C88(gobj); ip->xDD4_itemVar.nokonoko.x28 = 0.0f; Item_80268E5C(gobj, 0xA, ITEM_ANIM_UPDATE); diff --git a/src/melee/it/items/itwhispyapple.c b/src/melee/it/items/itwhispyapple.c index 4cb1b174fc..fcbfdc3988 100644 --- a/src/melee/it/items/itwhispyapple.c +++ b/src/melee/it/items/itwhispyapple.c @@ -53,12 +53,12 @@ void it_802EECC8(void) {} void it_802EEEC4(void) {} -bool it_802EEEC8(void) +bool it_802EEEC8(Item_GObj* item_gobj) { return false; } -bool it_802EEED0(void) +bool it_802EEED0(Item_GObj* item_gobj) { return true; } diff --git a/src/melee/it/items/itzrshell.c b/src/melee/it/items/itzrshell.c index a4a319d4af..5b66a81b72 100644 --- a/src/melee/it/items/itzrshell.c +++ b/src/melee/it/items/itzrshell.c @@ -6,6 +6,7 @@ #include "gr/grzakogenerator.h" #include "it/it_26B1.h" #include "it/it_2725.h" +#include "it/item.h" #include "it/types.h" #include @@ -54,34 +55,34 @@ void it_802E0388(Item_GObj* gobj) grZakoGenerator_801CACB8(gobj); } -void it_802E03A8(Item_GObj* gobj) +bool it_802E03A8(Item_GObj* gobj) { - it_802DFC34(gobj); + return it_802DFC34(gobj); } -void it_802E03C8(Item_GObj* gobj) +bool it_802E03C8(Item_GObj* gobj) { - it_802DFC58(gobj); + return it_802DFC58(gobj); } -void it_802E03E8(Item_GObj* gobj) +bool it_802E03E8(Item_GObj* gobj) { - it_802DFC90(gobj); + return it_802DFC90(gobj); } -void it_802E0408(Item_GObj* gobj) +bool it_802E0408(Item_GObj* gobj) { - it_802DFCB0(gobj); + return it_802DFCB0(gobj); } -void it_802E0428(Item_GObj* gobj) +bool it_802E0428(Item_GObj* gobj) { - it_802DFD60(gobj); + return it_802DFD60(gobj); } -void it_802E0448(Item_GObj* gobj) +bool it_802E0448(Item_GObj* gobj) { - it_802DFE40(gobj); + return it_802DFE40(gobj); } void it_802E0468(Item_GObj* gobj, HSD_GObj* ref_gobj) diff --git a/src/melee/it/items/itzrshell.h b/src/melee/it/items/itzrshell.h index 381bb41af0..04117c83c7 100644 --- a/src/melee/it/items/itzrshell.h +++ b/src/melee/it/items/itzrshell.h @@ -2,8 +2,8 @@ #define _itzrshell_h_ #include +#include "it/forward.h" -#include "it/item.h" #include "it/items/types.h" void it_802E02E8(Item_GObj*); From dcb1664ce935362e279ac5bce108d5b1eb45f420 Mon Sep 17 00:00:00 2001 From: Aaron B Date: Mon, 13 Jan 2025 16:02:24 -0500 Subject: [PATCH 21/25] Formatting --- src/melee/it/items/itcoin.c | 2 +- src/melee/it/items/itzrshell.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/melee/it/items/itcoin.c b/src/melee/it/items/itcoin.c index 2457371d6a..90f4306223 100644 --- a/src/melee/it/items/itcoin.c +++ b/src/melee/it/items/itcoin.c @@ -11,8 +11,8 @@ #include "it/it_266F.h" #include "it/it_26B1.h" #include "it/it_2725.h" -#include "it/itCommonItems.h" #include "it/itcoll.h" +#include "it/itCommonItems.h" #include "it/item.h" #include "lb/lbaudio_ax.h" #include "lb/lbvector.h" diff --git a/src/melee/it/items/itzrshell.h b/src/melee/it/items/itzrshell.h index 04117c83c7..469b57ea2d 100644 --- a/src/melee/it/items/itzrshell.h +++ b/src/melee/it/items/itzrshell.h @@ -2,6 +2,7 @@ #define _itzrshell_h_ #include + #include "it/forward.h" #include "it/items/types.h" From acaae5d08563c573154f389b728239a5c5e094d2 Mon Sep 17 00:00:00 2001 From: Aaron B Date: Mon, 13 Jan 2025 16:32:31 -0500 Subject: [PATCH 22/25] More fixes --- src/melee/gr/grmaterial.c | 2 +- src/melee/it/it_26B1.c | 4 ++-- src/melee/it/it_2725.c | 14 +++++++------- src/melee/it/it_2725.h | 2 +- src/melee/it/item.c | 20 ++++++++++---------- src/melee/it/items/itgamewatchpanic.c | 2 +- src/melee/it/items/ithassam.c | 5 +---- src/melee/it/types.h | 18 +++++++++--------- 8 files changed, 32 insertions(+), 35 deletions(-) diff --git a/src/melee/gr/grmaterial.c b/src/melee/gr/grmaterial.c index ddd066523a..cfe14a3eb3 100644 --- a/src/melee/gr/grmaterial.c +++ b/src/melee/gr/grmaterial.c @@ -196,7 +196,7 @@ void grMaterial_801C8E28(HSD_GObj* gobj) bool grMaterial_801C8E48(HSD_GObj* gobj) { Item* it = gobj->user_data; - if (it->x52C_item_script != NULL) { + if (it->x524_cmd.x8 != NULL) { return false; } return true; diff --git a/src/melee/it/it_26B1.c b/src/melee/it/it_26B1.c index 2e0edcbea4..8016ac0c49 100644 --- a/src/melee/it/it_26B1.c +++ b/src/melee/it/it_26B1.c @@ -634,7 +634,7 @@ static inline void What(HSD_GObj* gobj, struct ItemStateDesc* itemStateDesc, return; } HSD_JObjRemoveAnimAll(item_jobj2); - ip->x52C_item_script = NULL; + ip->x524_cmd.x8 = NULL; } /// Transfer item on character transformation (Zelda <-> Sheik) @@ -690,7 +690,7 @@ void it_8026B9A8(HSD_GObj* gobj, HSD_GObj* arg1, Fighter_Part arg2) } HSD_JObjRemoveAnimAll(jobj0); - ip->x52C_item_script = NULL; + ip->x524_cmd.x8 = NULL; } /// Multiply item's scale diff --git a/src/melee/it/it_2725.c b/src/melee/it/it_2725.c index 6be0a2aed9..b36455e029 100644 --- a/src/melee/it/it_2725.c +++ b/src/melee/it/it_2725.c @@ -5454,7 +5454,7 @@ void it_80273670(Item_GObj* item_gobj, int arg1, f32 arg8) } HSD_JObjAnimAll(item_jobj1); HSD_JObjRemoveAnimAll(item_jobj1); - item->x52C_item_script = NULL; + item->x524_cmd.x8 = NULL; } void it_80273748(Item_GObj* item_gobj, Vec3* pos, Vec3* vel) @@ -9112,10 +9112,10 @@ void it_802799E4(Item_GObj* item_gobj) item = item_gobj->user_data; // temp_r29 = (FtCmdState*) item->x524_cmd; - temp_r29 = item->x524_cmd; - item->x528 = item->x5CC_currentAnimFrame; + temp_r29 = &item->x524_cmd; + item->x524_cmd.x4 = item->x5CC_currentAnimFrame; item->xDBC_itcmd_var4 = 0; - if (item->x52C_item_script != NULL) { + if (item->x524_cmd.x8 != NULL) { if (F32_MAX != temp_r29->x0) { temp_r29->x0 = temp_r29->x0 - item->x5D0_animFrameSpeed; } @@ -9146,7 +9146,7 @@ void it_802799E4(Item_GObj* item_gobj) temp_r29 = (CommandInfo*) item->x524_cmd; item->x528 = item->x5CC_currentAnimFrame; item->xDBC_itcmd_var4 = 0; - if ((void*) item->x52C_item_script != NULL) { + if ((void*) item->x524_cmd.x8 != NULL) { if (F32_MAX != temp_r29->timer) { temp_r29->timer = temp_r29->timer - item->x5D0_animFrameSpeed; } @@ -10693,7 +10693,7 @@ void it_8027CE44(Item_GObj* item_gobj) } // Appears to be a function for Game&Watch items -void it_8027CE64(Item_GObj* item_gobj, HSD_GObj* fighter_gobj, void* arg_attr) +void it_8027CE64(Item_GObj* item_gobj, HSD_GObj* fighter_gobj, int arg_attr_address) { Item* item; GXColor sp18; @@ -10706,5 +10706,5 @@ void it_8027CE64(Item_GObj* item_gobj, HSD_GObj* fighter_gobj, void* arg_attr) item->x5C8 = ftLib_800870BC(item->owner, (void**) &item->xBC4); it_80274594(item_gobj); item->xDD4_itemVar.it_27CE.attr = - arg_attr; // Or the first var gets set equal to the first attribute + &arg_attr_address; // Or the first var gets set equal to the first attribute } diff --git a/src/melee/it/it_2725.h b/src/melee/it/it_2725.h index 1da6872be2..d85e863107 100644 --- a/src/melee/it/it_2725.h +++ b/src/melee/it/it_2725.h @@ -254,7 +254,7 @@ /* 27CC88 */ Item_GObj* it_8027CC88(Item_GObj*); /* 27CE18 */ void it_8027CE18(Item_GObj*); /* 27CE44 */ void it_8027CE44(Item_GObj*); -/* 27CE64 */ void it_8027CE64(Item_GObj*, HSD_GObj*, void*); +/* 27CE64 */ void it_8027CE64(Item_GObj*, HSD_GObj*, int); /* 3F14C4 */ extern struct ItemLogicTable it_803F14C4[43]; /* 3F23CC */ extern struct ItemLogicTable it_803F23CC[]; /* 3F3100 */ extern struct ItemLogicTable it_803F3100[118]; diff --git a/src/melee/it/item.c b/src/melee/it/item.c index 51a3aeb7c3..b44864a38f 100644 --- a/src/melee/it/item.c +++ b/src/melee/it/item.c @@ -1153,9 +1153,9 @@ void Item_80268DD4(HSD_GObj* gobj, f32 frame) /// Copy item script void Item_80268E40(Item* item_data, struct ItemStateDesc* itemStateDesc) { - item_data->x52C_item_script = itemStateDesc->xC_script; - item_data->x530 = 0; - item_data->x524_cmd->x0 = 0.0f; + item_data->x524_cmd.x8 = itemStateDesc->xC_script; + item_data->x524_cmd.xC = 0; + item_data->x524_cmd.x0 = 0.0f; } extern struct r13_ColAnimStruct* it_804D6D04; @@ -1252,13 +1252,13 @@ void Item_80268E5C(HSD_GObj* gobj, enum_t msid, Item_StateChangeFlags flags) HSD_JObjSetScaleItem(gobj->user_data, gobj->hsd_obj, &scl); } - item_data->x52C_item_script = temp_r29->xC_script; - item_data->x530 = 0; - item_data->x524_cmd->x0 = 0.0F; + item_data->x524_cmd.x8 = temp_r29->xC_script; + item_data->x524_cmd.xC = 0; + item_data->x524_cmd.x0 = 0.0F; } else if (temp_r23 != NULL && (flags & ITEM_CMD_UPDATE)) { - item_data->x52C_item_script = temp_r29->xC_script; - item_data->x530 = 0U; - item_data->x524_cmd->x0 = 0.0f; + item_data->x524_cmd.x8 = temp_r29->xC_script; + item_data->x524_cmd.xC = 0U; + item_data->x524_cmd.x0 = 0.0f; } HSD_JObjAnimAll(item_jobj); @@ -1266,7 +1266,7 @@ void Item_80268E5C(HSD_GObj* gobj, enum_t msid, Item_StateChangeFlags flags) it_802799E4(gobj); } else { HSD_JObjRemoveAnimAll(item_jobj); - item_data->x52C_item_script = NULL; + item_data->x524_cmd.x8 = NULL; } item_data->animated = temp_r30->animated; diff --git a/src/melee/it/items/itgamewatchpanic.c b/src/melee/it/items/itgamewatchpanic.c index b1beb86f8f..4ec6007b1d 100644 --- a/src/melee/it/items/itgamewatchpanic.c +++ b/src/melee/it/items/itgamewatchpanic.c @@ -36,7 +36,7 @@ HSD_GObj* it_802C7D60(Item_GObj* parent, Vec3* pos, Fighter_Part arg2, f32 dir) attr = ip->xC4_article_data->x4_specialAttributes; Item_8026AB54(gobj, parent, arg2); db_80225DD8(gobj, parent); - it_8027CE64(gobj, parent, attr); + it_8027CE64(gobj, parent, *attr); return gobj; } return NULL; diff --git a/src/melee/it/items/ithassam.c b/src/melee/it/items/ithassam.c index 158447f004..f58c675b22 100644 --- a/src/melee/it/items/ithassam.c +++ b/src/melee/it/items/ithassam.c @@ -181,7 +181,6 @@ void it_802CDF28(Item_GObj* gobj) Vec3 sp1C; Vec3 sp10; Fighter_GObj* var_r3; - f32 temp_f1; Item* ip = GET_ITEM(gobj); itHassam_ItemVars* attr = ip->xC4_article_data->x4_specialAttributes; @@ -197,12 +196,10 @@ void it_802CDF28(Item_GObj* gobj) ip->xDD4_itemVar.hassam.x5C.y = 0.0F; ip->xDD4_itemVar.hassam.x5C.z = 0.0F; lbVector_Rotate(&ip->xDD4_itemVar.hassam.x5C, 4, atan2f(sp10.y, sp10.x)); - temp_f1 = ip->xDD4_itemVar.hassam.x5C.y; - ip->xDD4_itemVar.hassam.x5C.y = temp_f1 + attr->xC; + ip->xDD4_itemVar.hassam.x5C.y += attr->xC; ip->x40_vel.x = ip->xDD4_itemVar.hassam.x5C.x; ip->x40_vel.y = ip->xDD4_itemVar.hassam.x5C.y; ip->x40_vel.z = ip->xDD4_itemVar.hassam.x5C.z; - // it_80272980(gobj, temp_f1); it_80272980(gobj); } diff --git a/src/melee/it/types.h b/src/melee/it/types.h index f9cf9359ec..0b7f47b89b 100644 --- a/src/melee/it/types.h +++ b/src/melee/it/types.h @@ -286,15 +286,15 @@ struct Item { HSD_GObj* x51C; // Related to the owner gobj CameraBox* x520_cameraBox; // CameraBox - FtCmdState* x524_cmd; // should this be CommandInfo* instead? - f32 x528; - void* x52C_item_script; // Script parse? - u32 x530; - u32 x534; - u32 x538; - u32 x53C; - u32 x540; - u32 x544; + FtCmdState x524_cmd; // should this be CommandInfo* instead? + // f32 x528; + // void* x52C_item_script; // Script parse? + // u32 x530; + // u32 x534; + // u32 x538; + // u32 x53C; + // u32 x540; + // u32 x544; ColorOverlay x548_colorOverlay; u8 x5C8; u8 x5C9; // used heavily in it_80278108 From bf0db496cd8e35842fe9cea38a001b47eaaed33c Mon Sep 17 00:00:00 2001 From: Aaron B Date: Mon, 13 Jan 2025 16:32:37 -0500 Subject: [PATCH 23/25] Formatting --- src/melee/it/it_2725.c | 6 ++++-- src/melee/it/types.h | 18 +++++++++--------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/melee/it/it_2725.c b/src/melee/it/it_2725.c index b36455e029..71fc52072d 100644 --- a/src/melee/it/it_2725.c +++ b/src/melee/it/it_2725.c @@ -10693,7 +10693,8 @@ void it_8027CE44(Item_GObj* item_gobj) } // Appears to be a function for Game&Watch items -void it_8027CE64(Item_GObj* item_gobj, HSD_GObj* fighter_gobj, int arg_attr_address) +void it_8027CE64(Item_GObj* item_gobj, HSD_GObj* fighter_gobj, + int arg_attr_address) { Item* item; GXColor sp18; @@ -10706,5 +10707,6 @@ void it_8027CE64(Item_GObj* item_gobj, HSD_GObj* fighter_gobj, int arg_attr_addr item->x5C8 = ftLib_800870BC(item->owner, (void**) &item->xBC4); it_80274594(item_gobj); item->xDD4_itemVar.it_27CE.attr = - &arg_attr_address; // Or the first var gets set equal to the first attribute + &arg_attr_address; // Or the first var gets set equal to the first + // attribute } diff --git a/src/melee/it/types.h b/src/melee/it/types.h index 0b7f47b89b..c1bd9ae08c 100644 --- a/src/melee/it/types.h +++ b/src/melee/it/types.h @@ -286,15 +286,15 @@ struct Item { HSD_GObj* x51C; // Related to the owner gobj CameraBox* x520_cameraBox; // CameraBox - FtCmdState x524_cmd; // should this be CommandInfo* instead? - // f32 x528; - // void* x52C_item_script; // Script parse? - // u32 x530; - // u32 x534; - // u32 x538; - // u32 x53C; - // u32 x540; - // u32 x544; + FtCmdState x524_cmd; // should this be CommandInfo* instead? + // f32 x528; + // void* x52C_item_script; // Script parse? + // u32 x530; + // u32 x534; + // u32 x538; + // u32 x53C; + // u32 x540; + // u32 x544; ColorOverlay x548_colorOverlay; u8 x5C8; u8 x5C9; // used heavily in it_80278108 From c8576834b28d1f4175aa769ce3655a0e3a935a41 Mon Sep 17 00:00:00 2001 From: Aaron B Date: Mon, 13 Jan 2025 16:32:48 -0500 Subject: [PATCH 24/25] Formatting --- src/melee/it/types.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/melee/it/types.h b/src/melee/it/types.h index c1bd9ae08c..c380565b69 100644 --- a/src/melee/it/types.h +++ b/src/melee/it/types.h @@ -287,14 +287,14 @@ struct Item { HSD_GObj* x51C; // Related to the owner gobj CameraBox* x520_cameraBox; // CameraBox FtCmdState x524_cmd; // should this be CommandInfo* instead? - // f32 x528; - // void* x52C_item_script; // Script parse? - // u32 x530; - // u32 x534; - // u32 x538; - // u32 x53C; - // u32 x540; - // u32 x544; + // f32 x528; + // void* x52C_item_script; // Script parse? + // u32 x530; + // u32 x534; + // u32 x538; + // u32 x53C; + // u32 x540; + // u32 x544; ColorOverlay x548_colorOverlay; u8 x5C8; u8 x5C9; // used heavily in it_80278108 From 960f61e4b517ea418c08d40e108068a0977e07fc Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Tue, 14 Jan 2025 13:09:45 -0500 Subject: [PATCH 25/25] make `xDC0` a word --- src/melee/it/it_2725.c | 3 ++- src/melee/it/itcoll.c | 8 ++++---- src/melee/it/types.h | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/melee/it/it_2725.c b/src/melee/it/it_2725.c index 71fc52072d..c13c3f098c 100644 --- a/src/melee/it/it_2725.c +++ b/src/melee/it/it_2725.c @@ -6279,7 +6279,8 @@ void it_80275070(Item_GObj* item_gobj, s32 bone_id) bool it_802750E8(Item_GObj* item_gobj, s32 mask) { - return ((Item*) item_gobj->user_data)->xDC0.u8 & mask; + Item* item = GET_ITEM(item_gobj); + return item->xDC0.word & mask; } void it_802750F8(Item_GObj* item_gobj) diff --git a/src/melee/it/itcoll.c b/src/melee/it/itcoll.c index c8e4e6c0a9..eb9f32c606 100644 --- a/src/melee/it/itcoll.c +++ b/src/melee/it/itcoll.c @@ -1552,7 +1552,7 @@ void it_80271B60(Item_GObj* item_gobj) dir = 1.0f; } item->x70_nudge.x = it_804D6D28->x7C_float * dir; - item->xDC0.u8 |= 1; + item->xDC0.word |= 1; } cnt++; } @@ -1628,7 +1628,7 @@ void it_80271D2C(Item_GObj* arg_item_gobj) dir = 1.0f; } arg_item->x70_nudge.x = it_804D6D28->x7C_float * dir; - arg_item->xDC0.u8 |= 2; + arg_item->xDC0.word |= 2; } } item_gobj = item_gobj->next; @@ -1699,7 +1699,7 @@ void it_80271F78(Item_GObj* arg_item_gobj) dir = 1.0f; } arg_item->x70_nudge.x = it_804D6D28->x7C_float * dir; - arg_item->xDC0.u8 |= 2; + arg_item->xDC0.word |= 2; } } item_gobj = item_gobj->next; @@ -1715,7 +1715,7 @@ void it_802721B8(Item_GObj* item_gobj) item->x70_nudge.z = 0.0f; item->x70_nudge.y = 0.0f; item->x70_nudge.x = 0.0f; - item->xDC0.u8 = 0; + item->xDC0.word = 0; if (!item->xDC8_word.flags.x13) { // temp_r3 = item->unkDCB; if ((item->xDC8_word.flags.x1A == 1) && diff --git a/src/melee/it/types.h b/src/melee/it/types.h index c380565b69..b5b16a668d 100644 --- a/src/melee/it/types.h +++ b/src/melee/it/types.h @@ -523,7 +523,7 @@ struct Item { u32 xDB4_itcmd_var2; u32 xDB8_itcmd_var3; u32 xDBC_itcmd_var4; - UnkFlagStruct xDC0; + flag32 xDC0; u32 xDC4; flag32 xDC8_word; struct {