Skip to content

Commit

Permalink
Match itkirbyhammer (#1255)
Browse files Browse the repository at this point in the history
* Match it_802ADC04

* Match most of itkirbyhammer

* Match it_802ADC54

* Remove assignment in PAD_STACK and mark itkirbyhammer as matching

* Address issues

* Add func proto, remove usage of forward, detete .s file, use .c for make compilation

* Add baselib/forward.h for consistency

* Adjust include guards on itkirbyhammer

* Remove extra comma
  • Loading branch information
PsiLupan authored Feb 19, 2024
1 parent 4f036d4 commit d7785dd
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 163 deletions.
154 changes: 0 additions & 154 deletions asm/melee/it/items/itkirbyhammer.s

This file was deleted.

2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ def RuntimeLib(lib_name: str, objects: Objects) -> LibDict:
Object(NonMatching, "melee/it/items/itkoopaflame.c"),
Object(NonMatching, "melee/it/items/itnessbat.c"),
Object(Matching, "melee/it/items/it_2ADA.c"),
Object(NonMatching, "melee/it/items/itkirbyhammer.c"),
Object(Matching, "melee/it/items/itkirbyhammer.c"),
Object(NonMatching, "melee/it/items/itfoxblaster.c"),
Object(NonMatching, "melee/it/items/itlinkbow.c"),
Object(NonMatching, "melee/it/items/itnesspkflushexplode.c"),
Expand Down
2 changes: 1 addition & 1 deletion obj_files.mk
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ TEXT_O_FILES +=\
$(BUILD_DIR)/asm/melee/it/items/itkoopaflame.s.o\
$(BUILD_DIR)/asm/melee/it/items/itnessbat.s.o\
$(BUILD_DIR)/src/melee/it/items/it_2ADA.c.o\
$(BUILD_DIR)/asm/melee/it/items/itkirbyhammer.s.o\
$(BUILD_DIR)/src/melee/it/items/itkirbyhammer.c.o\
$(BUILD_DIR)/asm/melee/it/items/itfoxblaster.s.o\
$(BUILD_DIR)/asm/melee/it/items/itlinkbow.s.o\
$(BUILD_DIR)/asm/melee/it/items/itnesspkflushexplode.s.o\
Expand Down
4 changes: 4 additions & 0 deletions src/melee/it/itCharItems.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ typedef struct {
HSD_JObj* xDDC;
} FoxIllusionVars;

typedef struct {
u32 x0;
} itKirbyHammerVars;

#endif
81 changes: 81 additions & 0 deletions src/melee/it/items/itkirbyhammer.c
Original file line number Diff line number Diff line change
@@ -1 +1,82 @@
#include "itkirbyhammer.h"

#include "db/db_2253.h"
#include "ef/efasync.h"
#include "ft/chara/ftKirby/ftKb_Init.h"
#include "it/inlines.h"
#include "it/it_266F.h"
#include "it/it_26B1.h"
#include "it/item.h"

ItemStateTable it_803F6C98[] = {
{ 0, NULL, NULL, NULL },
};

void it_802ADC04(Item_GObj* gobj)
{
Item* it = GET_ITEM((HSD_GObj*) gobj);

if (it->owner == NULL) {
return;
}
ftKb_SpecialAirLw_800F539C((ftKb_GObj*) it->owner);
}

void it_802ADC34(Item_GObj* gobj)
{
Item_8026A8EC(gobj);
}

static void setupHammerParticles(HSD_GObj* parent, Item_GObj* item_gobj,
u8 sfx, u32 vars)
{
HSD_JObj* jobj;
u32 particle_id;
Item* it = GET_ITEM((HSD_GObj*) item_gobj);

it->xDD4_itemVar.kirbyhammer.x0 = vars;
db_80225DD8((HSD_GObj*) item_gobj, parent);
Item_8026AB54((HSD_GObj*) item_gobj, parent, sfx);
if (((Item*) item_gobj->user_data)->xDD4_itemVar.kirbyhammer.x0 == 1) {
particle_id = 1177;
} else {
particle_id = 1176;
}
jobj = it_80272C90(item_gobj);
efAsync_Spawn((HSD_GObj*) item_gobj, &((Item*) item_gobj->user_data)->xBC0,
0, particle_id, jobj);
}

Item_GObj* it_802ADC54(HSD_GObj* parent, Vec3* pos, u8 sfx, u32 vars, f32 dir)
{
Item_GObj* item_gobj;
SpawnItem spawn;
PAD_STACK(12);

spawn.kind = It_Kind_Kirby_Hammer;
spawn.prev_pos = *pos;
it_8026BB68((Item_GObj*) parent, &spawn.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 = true;
spawn.x40 = 0;

item_gobj = Item_80268B18(&spawn);
if (item_gobj != NULL) {
setupHammerParticles(parent, item_gobj, sfx, vars);
}
return item_gobj;
}

void it_802ADD88(Item_GObj* gobj)
{
Item_80268E5C(gobj, 0, ITEM_ANIM_UPDATE);
}

void it_802ADDB0(Item_GObj* gobj, HSD_GObj* ref_gobj)
{
it_8026B894(gobj, ref_gobj);
}
17 changes: 11 additions & 6 deletions src/melee/it/items/itkirbyhammer.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
#ifndef GALE01_2ADC04
#define GALE01_2ADC04
#ifndef _itkirbyhammer_h_
#define _itkirbyhammer_h_

#include <platform.h>
#include <baselib/forward.h>

#include "it/types.h"

/* 2ADC04 */ void it_802ADC04(Item_GObj*);
/* 2ADD88 */ void it_802ADD88(Item_GObj*);
/* 2ADDB0 */ void it_802ADDB0(Item_GObj*, Item_GObj*);
/* 3F6C98 */ extern ItemStateTable it_803F6C98[];
void it_802ADC04(Item_GObj* gobj);
void it_802ADC34(Item_GObj* gobj);
Item_GObj* it_802ADC54(HSD_GObj* parent, Vec3* pos, u8 sfx, u32 vars, f32 dir);
void it_802ADD88(Item_GObj* gobj);
void it_802ADDB0(Item_GObj* gobj, HSD_GObj* ref_gobj);
extern ItemStateTable it_803F6C98[];

#endif
1 change: 1 addition & 0 deletions src/melee/it/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ struct Item {
PKThunderVars PKThunderVars;
FoxLaserVars foxlaser;
FoxIllusionVars foxillusion;
itKirbyHammerVars kirbyhammer;
u8 padding[0xFCC - 0xDD4];
} xDD4_itemVar;
};
Expand Down
2 changes: 1 addition & 1 deletion src/placeholder.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ OSPanic(__FILE__, __LINE__, "Function is not implemented!")

#define PAD_STACK(bytes) \
do { \
UNUSED unsigned char _[(bytes)] = { 0 }; \
UNUSED unsigned char _[(bytes)]; \
} while (0)

#endif

0 comments on commit d7785dd

Please sign in to comment.