From 2cc16edcfd16c1170e57ef72dc173e9524a08c78 Mon Sep 17 00:00:00 2001 From: wyatt Date: Thu, 14 Mar 2024 22:13:30 -0700 Subject: [PATCH] Partially match `itcoin` (#1380) * dump all functions and clean matches + table. * create `CoinVars` and add to `xDD4_itemVar` in `struct Item` * match `it_802F14E4` * match `it_802F1518`. also declaration changes for externed functions * match `it_802F15B8` * match `it_802F1888` * match `it_802F2020` * match the logic for `it_802F202C`. maybe missing global/exeterned float * match `it_802F1F48` and modify `padding_x7C` in `struct Item` * match `it_802F1C70` and add `itCoinAttributes` * replace M2C fields with `attr` access in `it_802F1910` * float replacement in `it_802F1910` * 99% of `it_802F1910` * match `it_802F13B4` * use `GET_JOBJ` in `it_802F1888` * match 77% of `it_802F1CE0` using inlines * match 77% of `it_802F1630`. same issues as `it_802F1CE0` * clean `it_802F2094` with inlines * remove externed floats * 98% of `it_802F2094`. register allocation moment * function declarations * remove `M2C_FIELD` in `it_802F13B4` * change declaration for `it_802F2094` in `it_27CF.h` * fix usages for `it_802F2094` * scopes in `symbols.txt` * 92% of `it_802F202C` * fix floats in `it_802F1F48` * match `it_802F2094` * match `it_802F202C` * remove `M2C_FIELD` in `it_802F13B4` * if statement clarity in `it_802F1910` * fix comment for `un_8031C5E4` * update `grfigureget.h` * update `gm_1601.h` * update `grfigureget.h` again * update `it_2725.h` * update `tydisplay.h` * fix typo functions and update declaration for `un_8031C5E4` * float scopes * revert scope for `it_804DD9B0 ` * declaration fix in `grfigureget.h` * run `gen_header` for `tydisplay.h` * proper type usage * Update src/melee/ty/tydisplay.h --- config/GALE01/symbols.txt | 50 ++-- src/melee/gm/gm_1601.h | 1 + src/melee/gr/grfigureget.h | 7 + src/melee/gr/ground.c | 4 +- src/melee/gr/ground.h | 2 +- src/melee/it/itCommonItems.h | 31 +++ src/melee/it/it_2725.h | 2 + src/melee/it/items/it_27CF.h | 2 +- src/melee/it/items/itcoin.c | 428 +++++++++++++++++++++++++++++++++++ src/melee/it/items/itcoin.h | 6 + src/melee/it/types.h | 6 +- src/melee/ty/tydisplay.h | 7 + 12 files changed, 516 insertions(+), 30 deletions(-) diff --git a/config/GALE01/symbols.txt b/config/GALE01/symbols.txt index 37485bde3d..819cf54e8e 100644 --- a/config/GALE01/symbols.txt +++ b/config/GALE01/symbols.txt @@ -17376,30 +17376,30 @@ it_802F13B0 = .text:0x802F13B0; // type:function size:0x4 scope:global it_802F13B4 = .text:0x802F13B4; // type:function size:0x130 scope:global it_802F14E4 = .text:0x802F14E4; // type:function size:0x34 scope:global it_802F1518 = .text:0x802F1518; // type:function size:0x70 scope:global -it_802F1588 = .text:0x802F1588; // type:function size:0x28 scope:global -it_802F15B0 = .text:0x802F15B0; // type:function size:0x8 scope:global -it_802F15B8 = .text:0x802F15B8; // type:function size:0x4C scope:global -it_802F1604 = .text:0x802F1604; // type:function size:0x2C scope:global -it_802F1630 = .text:0x802F1630; // type:function size:0x220 scope:global -it_802F1850 = .text:0x802F1850; // type:function size:0x8 scope:global -it_802F1858 = .text:0x802F1858; // type:function size:0x4 scope:global -it_802F185C = .text:0x802F185C; // type:function size:0x2C scope:global +it_802F1588 = .text:0x802F1588; // type:function size:0x28 scope:local +it_802F15B0 = .text:0x802F15B0; // type:function size:0x8 scope:local +it_802F15B8 = .text:0x802F15B8; // type:function size:0x4C scope:local +it_802F1604 = .text:0x802F1604; // type:function size:0x2C scope:local +it_802F1630 = .text:0x802F1630; // type:function size:0x220 scope:local +it_802F1850 = .text:0x802F1850; // type:function size:0x8 scope:local +it_802F1858 = .text:0x802F1858; // type:function size:0x4 scope:local +it_802F185C = .text:0x802F185C; // type:function size:0x2C scope:local it_802F1888 = .text:0x802F1888; // type:function size:0x5C scope:global -it_802F18E4 = .text:0x802F18E4; // type:function size:0x8 scope:global -it_802F18EC = .text:0x802F18EC; // type:function size:0x4 scope:global +it_802F18E4 = .text:0x802F18E4; // type:function size:0x8 scope:local +it_802F18EC = .text:0x802F18EC; // type:function size:0x4 scope:local it_802F18F0 = .text:0x802F18F0; // type:function size:0x20 scope:global it_802F1910 = .text:0x802F1910; // type:function size:0x358 scope:global -it_802F1C68 = .text:0x802F1C68; // type:function size:0x8 scope:global -it_802F1C70 = .text:0x802F1C70; // type:function size:0x44 scope:global -it_802F1CB4 = .text:0x802F1CB4; // type:function size:0x2C scope:global +it_802F1C68 = .text:0x802F1C68; // type:function size:0x8 scope:local +it_802F1C70 = .text:0x802F1C70; // type:function size:0x44 scope:local +it_802F1CB4 = .text:0x802F1CB4; // type:function size:0x2C scope:local it_802F1CE0 = .text:0x802F1CE0; // type:function size:0x204 scope:global -it_802F1EE4 = .text:0x802F1EE4; // type:function size:0x8 scope:global -it_802F1EEC = .text:0x802F1EEC; // type:function size:0x30 scope:global -it_802F1F1C = .text:0x802F1F1C; // type:function size:0x2C scope:global +it_802F1EE4 = .text:0x802F1EE4; // type:function size:0x8 scope:local +it_802F1EEC = .text:0x802F1EEC; // type:function size:0x30 scope:local +it_802F1F1C = .text:0x802F1F1C; // type:function size:0x2C scope:local it_802F1F48 = .text:0x802F1F48; // type:function size:0x8C scope:global -it_802F1FD4 = .text:0x802F1FD4; // type:function size:0x8 scope:global -it_802F1FDC = .text:0x802F1FDC; // type:function size:0x4 scope:global -it_802F1FE0 = .text:0x802F1FE0; // type:function size:0x34 scope:global +it_802F1FD4 = .text:0x802F1FD4; // type:function size:0x8 scope:local +it_802F1FDC = .text:0x802F1FDC; // type:function size:0x4 scope:local +it_802F1FE0 = .text:0x802F1FE0; // type:function size:0x34 scope:local it_802F2014 = .text:0x802F2014; // type:function size:0xC scope:global it_802F2020 = .text:0x802F2020; // type:function size:0xC scope:global it_802F202C = .text:0x802F202C; // type:function size:0x68 scope:global @@ -33044,12 +33044,12 @@ it_804DD9A0 = .sdata2:0x804DD9A0; // type:object size:0x4 scope:global data:floa it_804DD9A8 = .sdata2:0x804DD9A8; // type:object size:0x4 scope:global data:float it_804DD9AC = .sdata2:0x804DD9AC; // type:object size:0x4 scope:global data:float it_804DD9B0 = .sdata2:0x804DD9B0; // type:object size:0x4 scope:global data:float -it_804DD9B8 = .sdata2:0x804DD9B8; // type:object size:0x4 scope:global data:float -it_804DD9BC = .sdata2:0x804DD9BC; // type:object size:0x4 scope:global data:float -it_804DD9C0 = .sdata2:0x804DD9C0; // type:object size:0x4 scope:global data:float -it_804DD9C4 = .sdata2:0x804DD9C4; // type:object size:0x4 scope:global data:float -it_804DD9C8 = .sdata2:0x804DD9C8; // type:object size:0x8 scope:global data:double -it_804DD9D0 = .sdata2:0x804DD9D0; // type:object size:0x4 scope:global data:float +it_804DD9B8 = .sdata2:0x804DD9B8; // type:object size:0x4 scope:local data:float +it_804DD9BC = .sdata2:0x804DD9BC; // type:object size:0x4 scope:local data:float +it_804DD9C0 = .sdata2:0x804DD9C0; // type:object size:0x4 scope:local data:float +it_804DD9C4 = .sdata2:0x804DD9C4; // type:object size:0x4 scope:local data:float +it_804DD9C8 = .sdata2:0x804DD9C8; // type:object size:0x8 scope:local data:double +it_804DD9D0 = .sdata2:0x804DD9D0; // type:object size:0x4 scope:local data:float it_804DD9D8 = .sdata2:0x804DD9D8; // type:object size:0x4 scope:global data:float it_804DD9DC = .sdata2:0x804DD9DC; // type:object size:0x4 scope:global data:float it_804DD9E0 = .sdata2:0x804DD9E0; // type:object size:0x8 scope:global data:double diff --git a/src/melee/gm/gm_1601.h b/src/melee/gm/gm_1601.h index 4ba7d3af38..8b8177dfef 100644 --- a/src/melee/gm/gm_1601.h +++ b/src/melee/gm/gm_1601.h @@ -38,6 +38,7 @@ /* 16C6C0 */ /* static */ UNK_RET gm_8016C6C0(UNK_PARAMS); /* 16C75C */ /* static */ UNK_RET gm_8016C75C(UNK_PARAMS); /* 17E068 */ bool gm_8017E068(void); +/* 17E280 */ UNK_T gm_8017E280(u16, M2C_UNK); /* 18841C */ bool gm_8018841C(void); /* 473A18 */ extern UNK_T gm_80473A18; diff --git a/src/melee/gr/grfigureget.h b/src/melee/gr/grfigureget.h index 7aa45ca30e..5b7f200149 100644 --- a/src/melee/gr/grfigureget.h +++ b/src/melee/gr/grfigureget.h @@ -1,4 +1,11 @@ #ifndef GALE01_219530 #define GALE01_219530 +#include + +#include + +int grFigureGet_80219C50(s32); +UNK_T grFigureGet_80219C34(s32); + #endif diff --git a/src/melee/gr/ground.c b/src/melee/gr/ground.c index d946d69e8f..78c5c369a0 100644 --- a/src/melee/gr/ground.c +++ b/src/melee/gr/ground.c @@ -2755,10 +2755,10 @@ void Ground_801C5878(void) } } -s32 Ground_801C58E0(s32 arg0, s32 arg1) +Item_GObj* Ground_801C58E0(s32 arg0, s32 arg1) { s32 tmp = arg0; - s32 result; + Item_GObj* result; Vec3 sp10; Ground_801C2D24(arg1, &sp10); result = it_802F2094(0, &sp10, tmp, 0); diff --git a/src/melee/gr/ground.h b/src/melee/gr/ground.h index 496d3becc4..46d0c49a67 100644 --- a/src/melee/gr/ground.h +++ b/src/melee/gr/ground.h @@ -145,7 +145,7 @@ /* 1C57F0 */ f32 Ground_801C57F0(void); /* 1C5800 */ void Ground_801C5800(void); /* 1C5840 */ s32 Ground_801C5840(void); -/* 1C58E0 */ s32 Ground_801C58E0(s32, s32); +/* 1C58E0 */ Item_GObj* Ground_801C58E0(s32, s32); /* 1C5940 */ int Ground_801C5940(void); /* 1C5A28 */ void Ground_801C5A28(void); /* 1C5A60 */ void Ground_801C5A60(void); diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index df38b41e57..6266fe7dd2 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -185,4 +185,35 @@ typedef struct MewVars { f32 xC; } MewVars; +typedef struct itCoinAttributes { + f32 x0; + f32 x4; + f32 x8; + f32 xC; + f32 x10; + f32 x14; + f32 x18; + f32 x1C; + f32 x20; + f32 x24; + f32 x28; + f32 x2C; + f32 x30; + f32 x34; + f32 x38; + f32 x3C; + f32 x40; + f32 x44; + f32 x48; +} itCoinAttributes; + +typedef struct CoinVars { + int x0; + int x4; + f32 x8; + f32 xC; + int x10; + int x14; +} CoinVars; + #endif diff --git a/src/melee/it/it_2725.h b/src/melee/it/it_2725.h index 94063233d7..cdbbfad8e0 100644 --- a/src/melee/it/it_2725.h +++ b/src/melee/it/it_2725.h @@ -30,8 +30,10 @@ /* 27ADEC */ M2C_UNK it_8027ADEC(M2C_UNK, Item_GObj*, HSD_JObj*, f32); /* 27B070 */ void it_8027B070(Item_GObj* gobj, Fighter_GObj* owner_gobj); /* 27B378 */ void it_8027B378(Fighter_GObj*, Item_GObj*, float); +/* 27B798 */ UNK_T it_8027B798(Item_GObj*, Vec3*); /* 27C56C */ void it_8027C56C(Item_GObj*, f32); /* 27C8B0 */ void it_8027C8B0(Item_GObj*); +/* 27CBFC */ f32 it_8027CBFC(Item_GObj*); /* 27CE44 */ void it_8027CE44(Item_GObj*); /* 3F14C4 */ extern struct ItemLogicTable it_803F14C4[43]; /* 3F23CC */ extern struct ItemLogicTable it_803F23CC[]; diff --git a/src/melee/it/items/it_27CF.h b/src/melee/it/items/it_27CF.h index 8f95834de2..6353615675 100644 --- a/src/melee/it/items/it_27CF.h +++ b/src/melee/it/items/it_27CF.h @@ -177,7 +177,7 @@ /* 2F046C */ void it_802F046C(s32); /* 2F0AE0 */ void it_802F0AE0(Item_GObj* fighter_gobj, Vec3*, Vec3*, enum_t, bool, float facing_dir, float, float); -/* 2F2094 */ s32 it_802F2094(s32, Vec3*, s32, s32); +/* 2F2094 */ Item_GObj* it_802F2094(int, Vec3*, int, int); /* 2F3330 */ bool it_802F3330(Item_GObj*); /* 2F3374 */ void it_802F3374(Item_GObj*, Item_GObj*); /* 3F94A0 */ extern ItemStateTable it_803F94A0[]; diff --git a/src/melee/it/items/itcoin.c b/src/melee/it/items/itcoin.c index 8b13789179..a73d2f44bc 100644 --- a/src/melee/it/items/itcoin.c +++ b/src/melee/it/items/itcoin.c @@ -1 +1,429 @@ +#include "it/forward.h" +#include "itcoin.h" + +#include "cm/camera.h" +#include "gm/gm_1601.h" +#include "gm/gm_1A36.h" +#include "gr/grfigureget.h" +#include "gr/ground.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 "lb/lbaudio_ax.h" +#include "lb/lbvector.h" +#include "mp/mpcoll.h" +#include "ty/tydisplay.h" + +#include +#include +#include + +/* 2F1588 */ static void it_802F1588(Item_GObj* gobj); +/* 2F15B0 */ static bool it_802F15B0(Item_GObj* gobj); +/* 2F15B8 */ static void it_802F15B8(Item_GObj* gobj); +/* 2F1604 */ static bool it_802F1604(Item_GObj* gobj); +/* 2F1630 */ static void it_802F1630(Item_GObj* gobj); +/* 2F1850 */ static bool it_802F1850(Item_GObj* gobj); +/* 2F1858 */ static void it_802F1858(Item_GObj* gobj); +/* 2F185C */ static bool it_802F185C(Item_GObj* gobj); +/* 2F18E4 */ static bool it_802F18E4(Item_GObj* gobj); +/* 2F18EC */ static void it_802F18EC(Item_GObj* gobj); +/* 2F1C68 */ static bool it_802F1C68(Item_GObj* gobj); +/* 2F1C70 */ static void it_802F1C70(Item_GObj* gobj); +/* 2F1CB4 */ static bool it_802F1CB4(Item_GObj* gobj); +/* 2F1EE4 */ static bool it_802F1EE4(Item_GObj* gobj); +/* 2F1EEC */ static void it_802F1EEC(Item_GObj* gobj); +/* 2F1F1C */ static bool it_802F1F1C(Item_GObj* gobj); +/* 2F1FD4 */ static bool it_802F1FD4(Item_GObj* gobj); +/* 2F1FDC */ static void it_802F1FDC(Item_GObj* gobj); +/* 2F1FE0 */ static bool it_802F1FE0(Item_GObj* gobj); + +ItemStateTable it_803F93C8[] = { + { -1, it_802F15B0, it_802F15B8, it_802F1604 }, + { -1, it_802F1850, it_802F1858, it_802F185C }, + { -1, it_802F18E4, it_802F18EC, NULL }, + { -1, it_802F1C68, it_802F1C70, it_802F1CB4 }, + { -1, it_802F1EE4, it_802F1EEC, it_802F1F1C }, + { -1, it_802F1FD4, it_802F1FDC, it_802F1FE0 }, +}; + +void it_802F13B4(Item_GObj* gobj, int arg1) +{ + Item* ip = GET_ITEM(gobj); + itCoinAttributes* attr = ip->xC4_article_data->x4_specialAttributes; + HSD_JObj* jobj = GET_JOBJ(gobj)->child; + + if (ip->xDD4_itemVar.coin.x4 != 0) { + if (((gm_801A45E8(1) != false) && + (grFigureGet_80219C50(ip->xDD4_itemVar.coin.x14) == 0)) || + ((Camera_80031144() < attr->x48) && + (grFigureGet_80219C50(ip->xDD4_itemVar.coin.x14) == 0))) + { + HSD_JObjSetFlagsAll(jobj, 0x10); + HSD_JObjClearFlagsAll(jobj->next, 0x10); + } else { + HSD_JObjSetFlagsAll(jobj->next, 0x10); + HSD_JObjClearFlagsAll(jobj, 0x10); + } + } else if (((gm_801A45E8(1) != 0) && (Ground_801C1D84() == 0)) || + (Camera_80031144() < attr->x48)) + { + HSD_JObjSetFlagsAll(jobj, 0x10); + HSD_JObjClearFlagsAll(jobj->next, 0x10); + } else { + HSD_JObjSetFlagsAll(jobj->next, 0x10); + HSD_JObjClearFlagsAll(jobj, 0x10); + } + it_8026EECC(gobj, arg1); +} + +void it_802F14E4(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + ip->xDD4_itemVar.coin.x4 = 0; + ip->xDD4_itemVar.coin.x0 = 0; + ip->xDD4_itemVar.coin.x10 = 0; + it_802F1588(gobj); +} + +void it_802F1518(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + if (ip->xDD4_itemVar.coin.x4 != 0) { + grFigureGet_80219C34(ip->xDD4_itemVar.coin.x14); + } else if (ip->xDC8_word.flags.x13 != false) { + gm_8017E280(ip->xDD4_itemVar.coin.x0, 1); + it_8027CE44(gobj); + } + it_8027C8B0(gobj); +} + +void it_802F1588(Item_GObj* gobj) +{ + Item_80268E5C(gobj, 0, ITEM_UNK_0x1); +} + +bool it_802F15B0(Item_GObj* gobj) +{ + return false; +} + +void it_802F15B8(Item_GObj* gobj) +{ + ItemAttr* attr; + Item* ip = GET_ITEM(gobj); + + if (ip->xDD4_itemVar.coin.x4 == 0) { + attr = ip->xCC_item_attr; + it_80272860(gobj, attr->x10_fall_speed, attr->x14_fall_speed_max); + return; + } + it_80272860(gobj, ip->xDD4_itemVar.coin.x8, ip->xDD4_itemVar.coin.xC); +} + +bool it_802F1604(Item_GObj* gobj) +{ + it_8026E414(gobj, it_802F1630); + return false; +} + +void it_802F1630(Item_GObj* gobj) +{ + Item* ip; + HSD_JObj* jobj; + + PAD_STACK(16); + + ip = GET_ITEM(gobj); + ip->x40_vel.z = 0.0F; + ip->x40_vel.y = 0.0F; + ip->x40_vel.x = 0.0F; + jobj = GET_JOBJ(gobj); + + HSD_JObjSetRotationX(jobj, 0.0F); + HSD_JObjSetRotationY(jobj, 0.0F); + HSD_JObjSetRotationZ(jobj, 0.0F); + + Item_80268E5C(gobj, 1, ITEM_UNK_0x1); + it_802756D0(gobj); +} + +bool it_802F1850(Item_GObj* gobj) +{ + return false; +} + +void it_802F1858(Item_GObj* gobj) {} + +bool it_802F185C(Item_GObj* gobj) +{ + it_8026D62C(gobj, it_802F1588); + return false; +} + +void it_802F1888(Item_GObj* gobj) +{ + HSD_JObj* jobj = GET_JOBJ(gobj); + HSD_JObj* child = HSD_JObjGetChild(jobj); + + HSD_JObjClearFlagsAll(child, 0x10); + Item_80268E5C(gobj, 2, ITEM_UNK_0x1); +} + +bool it_802F18E4(Item_GObj* gobj) +{ + return false; +} + +void it_802F18EC(Item_GObj* gobj) {} + +void it_802F18F0(Item_GObj* gobj, Item_GObj* ref) +{ + it_8026B894(gobj, ref); +} + +bool it_802F1910(Item_GObj* gobj) +{ + Item* ip; + itCoinAttributes* attr; + + PAD_STACK(20); + + ip = GET_ITEM(gobj); + attr = ip->xC4_article_data->x4_specialAttributes; + it_802762BC(ip); + ip->xC9C = ip->xC9C + it_8027CBFC(gobj); + it_8027B798(gobj, &ip->x40_vel); + if ((ip->x40_vel.x == 0.0F) && (ip->x40_vel.y == 0.0F)) { + ip->x40_vel.x = 0.1F * -ip->xCCC_incDamageDirection; + ip->x40_vel.y = 0.1F; + } + lbVector_Normalize(&ip->x40_vel); + if ((ip->pos.x > 0.0F) && (-1 == ip->xCCC_incDamageDirection)) { + ip->x40_vel.x *= -1; + } + if ((ip->pos.x < 0.0F) && (1 == ip->xCCC_incDamageDirection)) { + ip->x40_vel.x *= -1; + } + if (ip->pos.x > 0.0F) { + if (ip->xCCC_incDamageDirection == -1) { + ip->x40_vel.x *= attr->x30 * (attr->x24 + ip->xC9C); + } else { + ip->x40_vel.x *= attr->x2C * (attr->x24 + ip->xC9C); + } + if (ip->x40_vel.x <= -attr->x3C) { + ip->x40_vel.x = -attr->x3C; + } + } else { + if (-1 == ip->xCCC_incDamageDirection) { + ip->x40_vel.x *= attr->x2C * (attr->x24 + ip->xC9C); + } else { + ip->x40_vel.x *= attr->x30 * (attr->x24 + ip->xC9C); + } + if (ip->x40_vel.x >= attr->x3C) { + ip->x40_vel.x = attr->x3C; + } + } + ip->x40_vel.y *= attr->x38 * (attr->x28 + ip->xC9C); + if (ip->x40_vel.y >= attr->x40) { + ip->x40_vel.y = attr->x40; + } + ip->x40_vel.z = 0.0F; + ip->xC9C = 0; + switch (ip->xDD4_itemVar.coin.x4) { + case 2: + ip->xDD4_itemVar.coin.x8 += attr->x14; + break; + case 3: + ip->xDD4_itemVar.coin.x8 += attr->x20; + break; + default: + ip->xDD4_itemVar.coin.x8 += attr->x8; + break; + } + Item_80268E5C(gobj, 3, ITEM_UNK_0x1); + return false; +} + +bool it_802F1C68(Item_GObj* gobj) +{ + return false; +} + +void it_802F1C70(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itCoinAttributes* attr = ip->xC4_article_data->x4_specialAttributes; + + ip->x40_vel.x *= attr->x34; + it_80272860(gobj, ip->xDD4_itemVar.coin.x8, ip->xDD4_itemVar.coin.xC); +} + +bool it_802F1CB4(Item_GObj* gobj) +{ + it_8026E15C(gobj, it_802F1630); + return false; +} + +void it_802F1CE0(Item_GObj* gobj) +{ + HSD_JObj* jobj = GET_JOBJ(gobj); + PAD_STACK(24); + + HSD_JObjSetRotationX(jobj, 0.0F); + HSD_JObjSetRotationY(jobj, 0.0F); + HSD_JObjSetRotationZ(jobj, 0.0F); + + Item_80268E5C(gobj, 4, ITEM_UNK_0x1); +} + +bool it_802F1EE4(Item_GObj* gobj) +{ + return false; +} + +void it_802F1EEC(Item_GObj* gobj) +{ + ItemAttr* attr = GET_ITEM(gobj)->xCC_item_attr; + + it_80272860(gobj, attr->x10_fall_speed, attr->x14_fall_speed_max); +} + +bool it_802F1F1C(Item_GObj* gobj) +{ + it_8026E414(gobj, it_802F1630); + return false; +} + +void it_802F1F48(Item_GObj* gobj) +{ + Item* ip; + f32 item_dir; + int coll_dir; + + ip = GET_ITEM(gobj); + Item_80268E5C(gobj, 5, ITEM_ANIM_UPDATE); + + if (ip->x40_vel.x + ip->x7C + ip->x88 >= 0.0F) { + item_dir = 1; + } else { + item_dir = -1; + } + + ip->facing_dir = item_dir; + if (ip->facing_dir == -1) { + coll_dir = -1; + } else { + coll_dir = 1; + } + mpColl_800436D8(&ip->x378_itemColl, coll_dir); +} + +bool it_802F1FD4(Item_GObj* gobj) +{ + return false; +} + +void it_802F1FDC(Item_GObj* gobj) {} + +bool it_802F1FE0(Item_GObj* gobj) +{ + it_8026E8C4(gobj, it_802F1630, it_802F1588); + return false; +} + +void it_802F2014(Item_GObj* gobj, int arg1) +{ + GET_ITEM(gobj)->x378_itemColl.x4C = arg1; +} + +int it_802F2020(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + return ip->xDD4_itemVar.coin.x0; +} + +void it_802F202C(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + lbAudioAx_800237A8(0xAA, 0x7F, 0x40); + ip->x40_vel.x = 0.0F; + if (ip->x40_vel.y < -1.5F) { + ip->x40_vel.y = -1.5F; + } + it_802756D0(gobj); +} + +Item_GObj* it_802F2094(int arg0, Vec3* pos, int arg2, int arg3) +{ + SpawnItem spawn; + Item_GObj* gobj; + itCoinAttributes* attr; + Item* ip; + void* var_r29; + + spawn.kind = It_Kind_Coin; + spawn.prev_pos = *pos; + spawn.pos = spawn.prev_pos; + spawn.facing_dir = 0.0F; + spawn.vel.z = 0.0F; + spawn.vel.y = 0.0F; + spawn.vel.x = 0.0F; + spawn.x3C_damage = 0; + spawn.x0_parent_gobj = NULL; + spawn.x4_parent_gobj2 = NULL; + spawn.x44_flag.bits.b0 = true; + spawn.x40 = 0.0F; + + gobj = Item_80268B18(&spawn); + if (gobj != NULL) { + ip = GET_ITEM(gobj); + attr = ip->xC4_article_data->x4_specialAttributes; + ip->xDD4_itemVar.coin.x0 = arg2; + ip->xDD4_itemVar.coin.x4 = arg3; + ip->xDD4_itemVar.coin.x14 = arg0; + if (ip->xDD4_itemVar.coin.x4 != 0) { + it_802756E0(gobj); + it_8026B3A8(gobj); + switch (arg3) { + case 2: + ip->xDD4_itemVar.coin.x8 = attr->xC; + ip->xDD4_itemVar.coin.xC = attr->x10; + break; + case 3: + ip->xDD4_itemVar.coin.x8 = attr->x18; + ip->xDD4_itemVar.coin.xC = attr->x1C; + break; + default: + ip->xDD4_itemVar.coin.x8 = attr->x0; + ip->xDD4_itemVar.coin.xC = attr->x4; + break; + } + var_r29 = un_8031C5E4(arg2); + } else { + Item_80267454(gobj); + it_802756D0(gobj); + it_8026B390(gobj); + ip->xD5C = 0; + var_r29 = un_8031C5E4(arg2); + } + HSD_GObjObject_80390B0C(gobj); + HSD_GObjObject_80390A70(gobj, HSD_GObj_804D7849, var_r29); + it_8027163C(gobj); + ip->scl = Ground_801C0498(); + ip->scl *= attr->x44; + + HSD_JObjSetScaleX(gobj->hsd_obj, ip->scl); + HSD_JObjSetScaleY(gobj->hsd_obj, ip->scl); + HSD_JObjSetScaleZ(gobj->hsd_obj, ip->scl); + } + return gobj; +} diff --git a/src/melee/it/items/itcoin.h b/src/melee/it/items/itcoin.h index 2a7a023d5c..3d0fcae0aa 100644 --- a/src/melee/it/items/itcoin.h +++ b/src/melee/it/items/itcoin.h @@ -5,7 +5,9 @@ #include "it/forward.h" #include "it/items/types.h" +#include "it/types.h" +/* 2F13B4 */ void it_802F13B4(Item_GObj*, int); /* 2F14E4 */ void it_802F14E4(Item_GObj*); /* 2F1518 */ void it_802F1518(Item_GObj*); /* 2F1888 */ void it_802F1888(Item_GObj*); @@ -13,6 +15,10 @@ /* 2F1910 */ bool it_802F1910(Item_GObj*); /* 2F1CE0 */ void it_802F1CE0(Item_GObj*); /* 2F1F48 */ void it_802F1F48(Item_GObj*); +/* 2F2014 */ void it_802F2014(Item_GObj*, int); +/* 2F2020 */ int it_802F2020(Item_GObj*); +/* 2F202C */ void it_802F202C(Item_GObj*); +/* 2F2094 */ Item_GObj* it_802F2094(int, Vec3*, int, int); /* 3F93C8 */ extern ItemStateTable it_803F93C8[]; #endif diff --git a/src/melee/it/types.h b/src/melee/it/types.h index f9882b8e04..158c45016f 100644 --- a/src/melee/it/types.h +++ b/src/melee/it/types.h @@ -269,7 +269,10 @@ struct Item { /// @at{70} @sz{C} Vec3 x70_nudge; - u8 padding_x7C[0xB8 - 0x7C]; + f32 x7C; + u8 padding_x80[8]; + f32 x88; + u8 padding_x8C[0xB8 - 0x8C]; ItemLogicTable* xB8_itemLogicTable; // Global item callbacks @@ -559,6 +562,7 @@ struct Item { itKirbyHammerVars kirbyhammer; itShellVars shell; itTargetVars target; + CoinVars coin; u8 padding[0xFCC - 0xDD4]; } xDD4_itemVar; }; diff --git a/src/melee/ty/tydisplay.h b/src/melee/ty/tydisplay.h index 8b13789179..8710ee385f 100644 --- a/src/melee/ty/tydisplay.h +++ b/src/melee/ty/tydisplay.h @@ -1 +1,8 @@ +#ifndef __TYDISPLAY_H +#define __TYDISPLAY_H +#include + +void* un_8031C5E4(s32); + +#endif