From ae3fdab2a92a296101b80cf0f61cab9e106b852c Mon Sep 17 00:00:00 2001 From: Ryan Burns <52847440+r-burns@users.noreply.github.com> Date: Fri, 30 Jun 2023 20:10:59 -0700 Subject: [PATCH] Match itseakvanish (#947) --- asm/melee/it/items/itseakvanish.s | 138 ------------------------------ obj_files.mk | 2 +- src/melee/it/it_266F.h | 2 + src/melee/it/it_803F3100.c | 4 +- src/melee/it/items/itcapsule.c | 1 - src/melee/it/items/itseakvanish.c | 68 +++++++++++++++ src/melee/it/items/itseakvanish.h | 16 ++++ 7 files changed, 88 insertions(+), 143 deletions(-) delete mode 100644 asm/melee/it/items/itseakvanish.s create mode 100644 src/melee/it/items/itseakvanish.c create mode 100644 src/melee/it/items/itseakvanish.h diff --git a/asm/melee/it/items/itseakvanish.s b/asm/melee/it/items/itseakvanish.s deleted file mode 100644 index 40e9f9b8ac..0000000000 --- a/asm/melee/it/items/itseakvanish.s +++ /dev/null @@ -1,138 +0,0 @@ -.include "macros.inc" - -.section .text - -.global it_802B1C60 -it_802B1C60: -/* 802B1C60 002AE840 7C 08 02 A6 */ mflr r0 -/* 802B1C64 002AE844 38 C0 00 00 */ li r6, 0 -/* 802B1C68 002AE848 90 01 00 04 */ stw r0, 4(r1) -/* 802B1C6C 002AE84C 38 00 00 55 */ li r0, 0x55 -/* 802B1C70 002AE850 38 A0 00 01 */ li r5, 1 -/* 802B1C74 002AE854 94 21 FF 98 */ stwu r1, -0x68(r1) -/* 802B1C78 002AE858 93 E1 00 64 */ stw r31, 0x64(r1) -/* 802B1C7C 002AE85C 93 C1 00 60 */ stw r30, 0x60(r1) -/* 802B1C80 002AE860 3B C3 00 00 */ addi r30, r3, 0 -/* 802B1C84 002AE864 38 61 00 14 */ addi r3, r1, 0x14 -/* 802B1C88 002AE868 90 01 00 1C */ stw r0, 0x1c(r1) -/* 802B1C8C 002AE86C 80 E4 00 00 */ lwz r7, 0(r4) -/* 802B1C90 002AE870 80 04 00 04 */ lwz r0, 4(r4) -/* 802B1C94 002AE874 90 E1 00 34 */ stw r7, 0x34(r1) -/* 802B1C98 002AE878 90 01 00 38 */ stw r0, 0x38(r1) -/* 802B1C9C 002AE87C 80 04 00 08 */ lwz r0, 8(r4) -/* 802B1CA0 002AE880 90 01 00 3C */ stw r0, 0x3c(r1) -/* 802B1CA4 002AE884 80 81 00 34 */ lwz r4, 0x34(r1) -/* 802B1CA8 002AE888 80 01 00 38 */ lwz r0, 0x38(r1) -/* 802B1CAC 002AE88C C0 02 D5 B0 */ lfs f0, it_804DCF90@sda21(r2) -/* 802B1CB0 002AE890 90 81 00 28 */ stw r4, 0x28(r1) -/* 802B1CB4 002AE894 90 01 00 2C */ stw r0, 0x2c(r1) -/* 802B1CB8 002AE898 80 01 00 3C */ lwz r0, 0x3c(r1) -/* 802B1CBC 002AE89C 90 01 00 30 */ stw r0, 0x30(r1) -/* 802B1CC0 002AE8A0 D0 21 00 4C */ stfs f1, 0x4c(r1) -/* 802B1CC4 002AE8A4 B0 C1 00 50 */ sth r6, 0x50(r1) -/* 802B1CC8 002AE8A8 D0 01 00 48 */ stfs f0, 0x48(r1) -/* 802B1CCC 002AE8AC D0 01 00 44 */ stfs f0, 0x44(r1) -/* 802B1CD0 002AE8B0 D0 01 00 40 */ stfs f0, 0x40(r1) -/* 802B1CD4 002AE8B4 93 C1 00 14 */ stw r30, 0x14(r1) -/* 802B1CD8 002AE8B8 80 01 00 14 */ lwz r0, 0x14(r1) -/* 802B1CDC 002AE8BC 90 01 00 18 */ stw r0, 0x18(r1) -/* 802B1CE0 002AE8C0 88 01 00 58 */ lbz r0, 0x58(r1) -/* 802B1CE4 002AE8C4 50 A0 3E 30 */ rlwimi r0, r5, 7, 0x18, 0x18 -/* 802B1CE8 002AE8C8 98 01 00 58 */ stb r0, 0x58(r1) -/* 802B1CEC 002AE8CC 90 C1 00 54 */ stw r6, 0x54(r1) -/* 802B1CF0 002AE8D0 4B FB 6E 29 */ bl Item_80268B18 -/* 802B1CF4 002AE8D4 7C 7F 1B 79 */ or. r31, r3, r3 -/* 802B1CF8 002AE8D8 41 82 00 24 */ beq .L_802B1D1C -/* 802B1CFC 002AE8DC 38 7F 00 00 */ addi r3, r31, 0 -/* 802B1D00 002AE8E0 38 9E 00 00 */ addi r4, r30, 0 -/* 802B1D04 002AE8E4 48 00 00 3D */ bl it_802B1D40 -/* 802B1D08 002AE8E8 38 7F 00 00 */ addi r3, r31, 0 -/* 802B1D0C 002AE8EC 38 9E 00 00 */ addi r4, r30, 0 -/* 802B1D10 002AE8F0 4B F7 40 C9 */ bl db_80225DD8 -/* 802B1D14 002AE8F4 7F E3 FB 78 */ mr r3, r31 -/* 802B1D18 002AE8F8 48 00 00 08 */ b .L_802B1D20 -.L_802B1D1C: -/* 802B1D1C 002AE8FC 38 60 00 00 */ li r3, 0 -.L_802B1D20: -/* 802B1D20 002AE900 80 01 00 6C */ lwz r0, 0x6c(r1) -/* 802B1D24 002AE904 83 E1 00 64 */ lwz r31, 0x64(r1) -/* 802B1D28 002AE908 83 C1 00 60 */ lwz r30, 0x60(r1) -/* 802B1D2C 002AE90C 38 21 00 68 */ addi r1, r1, 0x68 -/* 802B1D30 002AE910 7C 08 03 A6 */ mtlr r0 -/* 802B1D34 002AE914 4E 80 00 20 */ blr - -.global it_802B1D38 -it_802B1D38: -/* 802B1D38 002AE918 38 60 00 00 */ li r3, 0 -/* 802B1D3C 002AE91C 4E 80 00 20 */ blr - -.global it_802B1D40 -it_802B1D40: -/* 802B1D40 002AE920 7C 08 02 A6 */ mflr r0 -/* 802B1D44 002AE924 90 01 00 04 */ stw r0, 4(r1) -/* 802B1D48 002AE928 38 00 00 00 */ li r0, 0 -/* 802B1D4C 002AE92C 94 21 FF E0 */ stwu r1, -0x20(r1) -/* 802B1D50 002AE930 93 E1 00 1C */ stw r31, 0x1c(r1) -/* 802B1D54 002AE934 7C 7F 1B 78 */ mr r31, r3 -/* 802B1D58 002AE938 80 A3 00 2C */ lwz r5, 0x2c(r3) -/* 802B1D5C 002AE93C 90 85 05 18 */ stw r4, 0x518(r5) -/* 802B1D60 002AE940 C0 02 D5 B4 */ lfs f0, it_804DCF94@sda21(r2) -/* 802B1D64 002AE944 D0 05 0D 44 */ stfs f0, 0xd44(r5) -/* 802B1D68 002AE948 90 05 0D AC */ stw r0, 0xdac(r5) -/* 802B1D6C 002AE94C 4B FB 9D D9 */ bl it_8026BB44 -/* 802B1D70 002AE950 7F E3 FB 78 */ mr r3, r31 -/* 802B1D74 002AE954 4B FB 96 35 */ bl it_8026B3A8 -/* 802B1D78 002AE958 7F E3 FB 78 */ mr r3, r31 -/* 802B1D7C 002AE95C 4B FB 9F A9 */ bl it_8026BD24 -/* 802B1D80 002AE960 7F E3 FB 78 */ mr r3, r31 -/* 802B1D84 002AE964 4B FC 34 09 */ bl it_8027518C -/* 802B1D88 002AE968 38 7F 00 00 */ addi r3, r31, 0 -/* 802B1D8C 002AE96C 38 80 00 00 */ li r4, 0 -/* 802B1D90 002AE970 38 A0 00 02 */ li r5, 2 -/* 802B1D94 002AE974 4B FB 70 C9 */ bl Item_80268E5C -/* 802B1D98 002AE978 80 01 00 24 */ lwz r0, 0x24(r1) -/* 802B1D9C 002AE97C 83 E1 00 1C */ lwz r31, 0x1c(r1) -/* 802B1DA0 002AE980 38 21 00 20 */ addi r1, r1, 0x20 -/* 802B1DA4 002AE984 7C 08 03 A6 */ mtlr r0 -/* 802B1DA8 002AE988 4E 80 00 20 */ blr -.global it_802B1DAC -it_802B1DAC: -/* 802B1DAC 002AE98C 7C 08 02 A6 */ mflr r0 -/* 802B1DB0 002AE990 90 01 00 04 */ stw r0, 4(r1) -/* 802B1DB4 002AE994 94 21 FF F8 */ stwu r1, -8(r1) -/* 802B1DB8 002AE998 4B FC 34 21 */ bl it_802751D8 -/* 802B1DBC 002AE99C 80 01 00 0C */ lwz r0, 0xc(r1) -/* 802B1DC0 002AE9A0 38 21 00 08 */ addi r1, r1, 8 -/* 802B1DC4 002AE9A4 7C 08 03 A6 */ mtlr r0 -/* 802B1DC8 002AE9A8 4E 80 00 20 */ blr - -.global it_802B1DCC -it_802B1DCC: -/* 802B1DCC 002AE9AC 7C 08 02 A6 */ mflr r0 -/* 802B1DD0 002AE9B0 90 01 00 04 */ stw r0, 4(r1) -/* 802B1DD4 002AE9B4 94 21 FF F8 */ stwu r1, -8(r1) -/* 802B1DD8 002AE9B8 4B FB 9A BD */ bl it_8026B894 -/* 802B1DDC 002AE9BC 80 01 00 0C */ lwz r0, 0xc(r1) -/* 802B1DE0 002AE9C0 38 21 00 08 */ addi r1, r1, 8 -/* 802B1DE4 002AE9C4 7C 08 03 A6 */ mtlr r0 -/* 802B1DE8 002AE9C8 4E 80 00 20 */ blr - - -.section .data - .balign 8 -.global it_803F70B8 -it_803F70B8: - .4byte 0 - .4byte it_802B1DAC - .4byte NULL - .4byte NULL - - -.section .sdata2 - .balign 8 -.global it_804DCF90 -it_804DCF90: - .4byte 0x00000000 -.global it_804DCF94 -it_804DCF94: - .4byte 0x42700000 diff --git a/obj_files.mk b/obj_files.mk index 0041c0cbca..5eda37fa69 100644 --- a/obj_files.mk +++ b/obj_files.mk @@ -636,7 +636,7 @@ TEXT_O_FILES +=\ $(BUILD_DIR)/asm/melee/it/items/itnesspkflushexplode.s.o\ $(BUILD_DIR)/asm/melee/it/items/itseakneedlethrown.s.o\ $(BUILD_DIR)/asm/melee/it/items/itseakneedleheld.s.o\ - $(BUILD_DIR)/asm/melee/it/items/itseakvanish.s.o\ + $(BUILD_DIR)/src/melee/it/items/itseakvanish.c.o\ $(BUILD_DIR)/asm/melee/it/items/itpikachuthunder.s.o\ $(BUILD_DIR)/asm/melee/it/items/itmariocape.s.o\ $(BUILD_DIR)/asm/melee/it/items/ityoshieggthrow.s.o\ diff --git a/src/melee/it/it_266F.h b/src/melee/it/it_266F.h index 7f8f115b15..3d0cc297c4 100644 --- a/src/melee/it/it_266F.h +++ b/src/melee/it/it_266F.h @@ -137,5 +137,7 @@ bool it_8026DA08(Item_GObj*); bool it_80276308(Item_GObj*); bool it_802763E0(Item_GObj*); void it_80272860(Item_GObj*, f32, f32); +void it_8027518C(Item_GObj*); +bool it_802751D8(Item_GObj*); #endif diff --git a/src/melee/it/it_803F3100.c b/src/melee/it/it_803F3100.c index b19747d213..772c9e0663 100644 --- a/src/melee/it/it_803F3100.c +++ b/src/melee/it/it_803F3100.c @@ -1,6 +1,7 @@ #include #include #include +#include void it_8027C8B0(); bool it_8029BA38(); @@ -104,8 +105,6 @@ bool it_802B16E4(); void it_802B1890(); void it_802B1AAC(); void it_802B1C40(); -bool it_802B1D38(); -void it_802B1DCC(); void it_802B202C(); bool it_802B2508(); bool it_802B2510(); @@ -373,7 +372,6 @@ extern ItemStateTable it_803F6E98[]; extern ItemStateTable it_803F6F40[]; extern ItemStateTable it_803F6F50[]; extern ItemStateTable it_803F70A8[]; -extern ItemStateTable it_803F70B8[]; extern ItemStateTable it_803F70C8[]; extern ItemStateTable it_803F70F8[]; extern ItemStateTable it_803F7118[]; diff --git a/src/melee/it/items/itcapsule.c b/src/melee/it/items/itcapsule.c index 3fd5a5a28b..cf6d66f2e5 100644 --- a/src/melee/it/items/itcapsule.c +++ b/src/melee/it/items/itcapsule.c @@ -16,7 +16,6 @@ void it_80272C08(); void it_80273454(); void it_80274658(Item_GObj*, f32); void it_8027518C(); -bool it_802751D8(Item_GObj*); void it_80275444(); void it_802756D0(); void it_8027D258(Item_GObj*); diff --git a/src/melee/it/items/itseakvanish.c b/src/melee/it/items/itseakvanish.c new file mode 100644 index 0000000000..5318c85096 --- /dev/null +++ b/src/melee/it/items/itseakvanish.c @@ -0,0 +1,68 @@ +#include "itseakvanish.h" + +#include +#include +#include +#include +#include + +ItemStateTable it_803F70B8[] = { + { + 0, + it_802B1DAC, + NULL, + NULL, + }, +}; + +Item_GObj* it_802B1C60(HSD_GObj* parent, Vec3* pos, f32 dir) +{ + SpawnItem spawn; + Item_GObj* item_gobj; + + spawn.kind = 0x55; + spawn.prev_pos = *pos; + spawn.pos = spawn.prev_pos; + spawn.facing_dir = dir; + spawn.x3C_damage = 0; + spawn.vel.x = spawn.vel.y = spawn.vel.z = 0.0F; + spawn.x0_parent_gobj = parent; + spawn.x4_parent_gobj2 = spawn.x0_parent_gobj; + spawn.x44_flag.bits.b0 = 1; + spawn.x40 = 0; + item_gobj = Item_80268B18(&spawn); + if (item_gobj != NULL) { + it_802B1D40(item_gobj, parent); + db_80225DD8(item_gobj, parent); + return item_gobj; + } + return NULL; +} + +bool it_802B1D38(Item_GObj* item_gobj) +{ + return false; +} + +void it_802B1D40(Item_GObj* item_gobj, HSD_GObj* owner) +{ + Item* item = GET_ITEM(item_gobj); + item->owner = owner; + item->xD44_lifeTimer = 60.0F; + item->xDAC_itcmd_var0 = 0; + it_8026BB44(item_gobj); + it_8026B3A8(item_gobj); + it_8026BD24(item_gobj); + it_8027518C(item_gobj); + Item_80268E5C(item_gobj, 0, ITEM_ANIM_UPDATE); +} + +bool it_802B1DAC(Item_GObj* item_gobj) +{ + return it_802751D8(item_gobj); +} + +void it_802B1DCC(Item_GObj* item_gobj, HSD_GObj* gobj) +{ + it_8026B894(item_gobj, gobj); +} diff --git a/src/melee/it/items/itseakvanish.h b/src/melee/it/items/itseakvanish.h new file mode 100644 index 0000000000..9b0f97b2d2 --- /dev/null +++ b/src/melee/it/items/itseakvanish.h @@ -0,0 +1,16 @@ +#ifndef MELEE_IT_ITSEAKVANISH_H +#define MELEE_IT_ITSEAKVANISH_H + +#include +#include +#include + +extern ItemStateTable it_803F70B8[]; + +Item_GObj* it_802B1C60(HSD_GObj* parent, Vec3* pos, f32 dir); +bool it_802B1D38(Item_GObj*); +void it_802B1D40(Item_GObj*, HSD_GObj*); +bool it_802B1DAC(Item_GObj*); +void it_802B1DCC(Item_GObj*, HSD_GObj*); + +#endif