From 2784bbebf6ddfdb37aa14f97280c6f91bda23834 Mon Sep 17 00:00:00 2001 From: Aaron B Date: Mon, 30 Sep 2024 15:53:34 -0400 Subject: [PATCH] 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;