Skip to content

Commit d7785dd

Browse files
authored
Match itkirbyhammer (#1255)
* 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
1 parent 4f036d4 commit d7785dd

File tree

8 files changed

+100
-163
lines changed

8 files changed

+100
-163
lines changed

asm/melee/it/items/itkirbyhammer.s

-154
This file was deleted.

configure.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ def RuntimeLib(lib_name: str, objects: Objects) -> LibDict:
921921
Object(NonMatching, "melee/it/items/itkoopaflame.c"),
922922
Object(NonMatching, "melee/it/items/itnessbat.c"),
923923
Object(Matching, "melee/it/items/it_2ADA.c"),
924-
Object(NonMatching, "melee/it/items/itkirbyhammer.c"),
924+
Object(Matching, "melee/it/items/itkirbyhammer.c"),
925925
Object(NonMatching, "melee/it/items/itfoxblaster.c"),
926926
Object(NonMatching, "melee/it/items/itlinkbow.c"),
927927
Object(NonMatching, "melee/it/items/itnesspkflushexplode.c"),

obj_files.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ TEXT_O_FILES +=\
620620
$(BUILD_DIR)/asm/melee/it/items/itkoopaflame.s.o\
621621
$(BUILD_DIR)/asm/melee/it/items/itnessbat.s.o\
622622
$(BUILD_DIR)/src/melee/it/items/it_2ADA.c.o\
623-
$(BUILD_DIR)/asm/melee/it/items/itkirbyhammer.s.o\
623+
$(BUILD_DIR)/src/melee/it/items/itkirbyhammer.c.o\
624624
$(BUILD_DIR)/asm/melee/it/items/itfoxblaster.s.o\
625625
$(BUILD_DIR)/asm/melee/it/items/itlinkbow.s.o\
626626
$(BUILD_DIR)/asm/melee/it/items/itnesspkflushexplode.s.o\

src/melee/it/itCharItems.h

+4
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@ typedef struct {
1919
HSD_JObj* xDDC;
2020
} FoxIllusionVars;
2121

22+
typedef struct {
23+
u32 x0;
24+
} itKirbyHammerVars;
25+
2226
#endif

src/melee/it/items/itkirbyhammer.c

+81
Original file line numberDiff line numberDiff line change
@@ -1 +1,82 @@
1+
#include "itkirbyhammer.h"
12

3+
#include "db/db_2253.h"
4+
#include "ef/efasync.h"
5+
#include "ft/chara/ftKirby/ftKb_Init.h"
6+
#include "it/inlines.h"
7+
#include "it/it_266F.h"
8+
#include "it/it_26B1.h"
9+
#include "it/item.h"
10+
11+
ItemStateTable it_803F6C98[] = {
12+
{ 0, NULL, NULL, NULL },
13+
};
14+
15+
void it_802ADC04(Item_GObj* gobj)
16+
{
17+
Item* it = GET_ITEM((HSD_GObj*) gobj);
18+
19+
if (it->owner == NULL) {
20+
return;
21+
}
22+
ftKb_SpecialAirLw_800F539C((ftKb_GObj*) it->owner);
23+
}
24+
25+
void it_802ADC34(Item_GObj* gobj)
26+
{
27+
Item_8026A8EC(gobj);
28+
}
29+
30+
static void setupHammerParticles(HSD_GObj* parent, Item_GObj* item_gobj,
31+
u8 sfx, u32 vars)
32+
{
33+
HSD_JObj* jobj;
34+
u32 particle_id;
35+
Item* it = GET_ITEM((HSD_GObj*) item_gobj);
36+
37+
it->xDD4_itemVar.kirbyhammer.x0 = vars;
38+
db_80225DD8((HSD_GObj*) item_gobj, parent);
39+
Item_8026AB54((HSD_GObj*) item_gobj, parent, sfx);
40+
if (((Item*) item_gobj->user_data)->xDD4_itemVar.kirbyhammer.x0 == 1) {
41+
particle_id = 1177;
42+
} else {
43+
particle_id = 1176;
44+
}
45+
jobj = it_80272C90(item_gobj);
46+
efAsync_Spawn((HSD_GObj*) item_gobj, &((Item*) item_gobj->user_data)->xBC0,
47+
0, particle_id, jobj);
48+
}
49+
50+
Item_GObj* it_802ADC54(HSD_GObj* parent, Vec3* pos, u8 sfx, u32 vars, f32 dir)
51+
{
52+
Item_GObj* item_gobj;
53+
SpawnItem spawn;
54+
PAD_STACK(12);
55+
56+
spawn.kind = It_Kind_Kirby_Hammer;
57+
spawn.prev_pos = *pos;
58+
it_8026BB68((Item_GObj*) parent, &spawn.pos);
59+
spawn.facing_dir = dir;
60+
spawn.x3C_damage = 0;
61+
spawn.vel.x = spawn.vel.y = spawn.vel.z = 0.0F;
62+
spawn.x0_parent_gobj = parent;
63+
spawn.x4_parent_gobj2 = spawn.x0_parent_gobj;
64+
spawn.x44_flag.bits.b0 = true;
65+
spawn.x40 = 0;
66+
67+
item_gobj = Item_80268B18(&spawn);
68+
if (item_gobj != NULL) {
69+
setupHammerParticles(parent, item_gobj, sfx, vars);
70+
}
71+
return item_gobj;
72+
}
73+
74+
void it_802ADD88(Item_GObj* gobj)
75+
{
76+
Item_80268E5C(gobj, 0, ITEM_ANIM_UPDATE);
77+
}
78+
79+
void it_802ADDB0(Item_GObj* gobj, HSD_GObj* ref_gobj)
80+
{
81+
it_8026B894(gobj, ref_gobj);
82+
}

src/melee/it/items/itkirbyhammer.h

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
#ifndef GALE01_2ADC04
2-
#define GALE01_2ADC04
1+
#ifndef _itkirbyhammer_h_
2+
#define _itkirbyhammer_h_
3+
4+
#include <platform.h>
5+
#include <baselib/forward.h>
36

47
#include "it/types.h"
58

6-
/* 2ADC04 */ void it_802ADC04(Item_GObj*);
7-
/* 2ADD88 */ void it_802ADD88(Item_GObj*);
8-
/* 2ADDB0 */ void it_802ADDB0(Item_GObj*, Item_GObj*);
9-
/* 3F6C98 */ extern ItemStateTable it_803F6C98[];
9+
void it_802ADC04(Item_GObj* gobj);
10+
void it_802ADC34(Item_GObj* gobj);
11+
Item_GObj* it_802ADC54(HSD_GObj* parent, Vec3* pos, u8 sfx, u32 vars, f32 dir);
12+
void it_802ADD88(Item_GObj* gobj);
13+
void it_802ADDB0(Item_GObj* gobj, HSD_GObj* ref_gobj);
14+
extern ItemStateTable it_803F6C98[];
1015

1116
#endif

src/melee/it/types.h

+1
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@ struct Item {
616616
PKThunderVars PKThunderVars;
617617
FoxLaserVars foxlaser;
618618
FoxIllusionVars foxillusion;
619+
itKirbyHammerVars kirbyhammer;
619620
u8 padding[0xFCC - 0xDD4];
620621
} xDD4_itemVar;
621622
};

src/placeholder.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ OSPanic(__FILE__, __LINE__, "Function is not implemented!")
7474

7575
#define PAD_STACK(bytes) \
7676
do { \
77-
UNUSED unsigned char _[(bytes)] = { 0 }; \
77+
UNUSED unsigned char _[(bytes)]; \
7878
} while (0)
7979

8080
#endif

0 commit comments

Comments
 (0)