Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added fox item attr and some small fixes #1459

Closed
wants to merge 53 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
9d0f47f
Foxblaster decomp work
AaronB-Hub Aug 12, 2024
0abaa8b
Update .pre-commit-config.yaml
AaronB-Hub Aug 12, 2024
dc0d972
formatting
AaronB-Hub Aug 12, 2024
e16541a
More formatting
AaronB-Hub Aug 12, 2024
50672d5
Merge branch 'upstream-master' into AaronB-Hub/master
ribbanya Aug 12, 2024
afb7dae
Fix newline
ribbanya Aug 12, 2024
a1ce72c
Merge branch 'doldecomp:master' into master
AaronB-Hub Aug 12, 2024
69e51ad
Merge branch 'doldecomp:master' into master
AaronB-Hub Aug 12, 2024
753ea33
Fox blaster demystification work
AaronB-Hub Aug 18, 2024
bfcb083
formatting previous commit
AaronB-Hub Aug 18, 2024
2c6a9a4
Update itCharItems.h
AaronB-Hub Aug 18, 2024
ccf5397
Merge branch 'doldecomp:master' into master
AaronB-Hub Aug 18, 2024
c47668c
clarifying fox blaster vars' uses
AaronB-Hub Aug 19, 2024
2944063
Update itfoxblaster.c
AaronB-Hub Aug 19, 2024
666eedb
Demystified blaster subaction flags
AaronB-Hub Aug 20, 2024
66cec7e
Fixed
AaronB-Hub Aug 23, 2024
af30713
Lgun ray decomp
AaronB-Hub Aug 23, 2024
7b00ff7
Formatting
AaronB-Hub Aug 23, 2024
ef010b9
Rolling back some function type changes so that I can make that all i…
AaronB-Hub Aug 23, 2024
b670b9a
Fix line endings
ribbanya Aug 23, 2024
e21fa22
Merge branch 'doldecomp:master' into master
AaronB-Hub Aug 23, 2024
3c3332c
Compatibility with item functions as they are now
AaronB-Hub Aug 23, 2024
69aed04
formatting
AaronB-Hub Aug 23, 2024
dfee783
lgun item work
AaronB-Hub Sep 21, 2024
b396c3a
formatting
AaronB-Hub Sep 21, 2024
6f605e6
Merge branch 'doldecomp:master' into master
AaronB-Hub Sep 21, 2024
34eaa21
formatting
AaronB-Hub Aug 23, 2024
ebab875
lgun item work
AaronB-Hub Sep 21, 2024
2c0f2fe
formatting
AaronB-Hub Sep 21, 2024
23a547b
Regenerate asm
ribbanya Sep 22, 2024
59a74b2
Fix issues
ribbanya Sep 22, 2024
eb65baa
Merge branch 'doldecomp:master' into master
AaronB-Hub Sep 22, 2024
582bf34
Merge branch 'master' of https://github.com/AaronB-Hub/doldecomp-melee
AaronB-Hub Sep 22, 2024
c7ecf71
Variable documentation
AaronB-Hub Sep 22, 2024
1280e71
Squashed commit of the following:
AaronB-Hub Sep 22, 2024
fde35bd
Variable documentation
AaronB-Hub Sep 22, 2024
54b9591
Variable documentation
AaronB-Hub Sep 22, 2024
c7e8b05
Fix `ItLGunBeamAttr`
ribbanya Sep 22, 2024
8f63b83
Fix struct offsets and names
ribbanya Sep 22, 2024
e5613d4
Fix callback names and comment
ribbanya Sep 22, 2024
64559fb
Fix build
ribbanya Sep 22, 2024
3f19cff
Fix assignment
ribbanya Sep 22, 2024
499f40f
Merge branch 'doldecomp:master' into master
AaronB-Hub Sep 22, 2024
ebf1fb2
Merge branch 'master' of https://github.com/AaronB-Hub/doldecomp-melee
AaronB-Hub Sep 22, 2024
7f26544
fox item attributes
AaronB-Hub Sep 22, 2024
185c42d
Added attr values and cleaned up formatting
AaronB-Hub Sep 22, 2024
e801ede
Fixed symbols.txt merge issue
AaronB-Hub Sep 22, 2024
27950e4
Fix other sync issue
AaronB-Hub Sep 22, 2024
8125ce4
Merge branch 'master' into master
AaronB-Hub Sep 22, 2024
0ecb818
attr var name changes
AaronB-Hub Sep 22, 2024
0769869
formatting
AaronB-Hub Sep 22, 2024
9d19f1c
Fixed some common item attr vs var issues
AaronB-Hub Sep 22, 2024
0be0719
formatting
AaronB-Hub Sep 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 38 additions & 7 deletions src/melee/it/itCharItems.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,50 @@ typedef struct {
/* x108 */ HSD_GObj* owner; // xE7C
} FoxBlasterVars;

typedef struct FoxBlasterAttr {
/* +0 */ float x0;
/* +4 */ float x4;
/* +8 */ float x8;
/* +C */ float xC;
/* +10 */ float x10;
/* +14 */ float x14;
/* +18 */ float x18; // [1]
/* +1C */ float x1C;
/* +20 */ float x20; // [2]
/* +24 */ float x24;
} FoxBlasterAttr;

typedef struct {
float xDD4;
float xDD8;
float xDDC;
Vec3 xDE0;
/* +0 ip+DD4 */ float scale;
/* +4 ip+DD8 */ float angle;
/* +8 ip+DDC */ float speed;
/* +C ip+DE0 */ Vec3 pos;
} FoxLaserVars;

typedef struct FoxLaserAttr {
/* +0 */ float lifetime; // [35]
/* +4 */ float scale; // [3]
/* +8 */ float x8;
/* +C */ float xC;
/* +10 */ float x10;
/* +14 */ float x14;
/* +18 */ float x18;
/* +1C */ float x1C;
/* +20 */ float x20;
/* +24 */ float x24; // [1]
} FoxLaserAttr;

typedef struct {
HSD_Joint* xDD4;
float xDD8;
HSD_JObj* xDDC;
/* +0 ip+DD4 */ HSD_Joint* xDD4;
/* +4 ip+DD8 */ float xDD8;
/* +8 ip+DDC */ HSD_JObj* xDDC;
} FoxIllusionVars;

typedef struct FoxIllusionAttr {
float x0; // [5]
float x4; // [2]
} FoxIllusionAttr;

typedef struct {
u32 x0;
} itKirbyHammerVars;
Expand Down
86 changes: 61 additions & 25 deletions src/melee/it/itCommonItems.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@
typedef struct {
bool x0;
bool x4;
} ItCapsuleAttrs;
} ItCapsuleVars;

typedef struct {
bool x0; // [1 or true]
s32 x4; // [8]
} ItCapsuleAttr;

typedef struct {
/* ip+DD4 */ float dir;
Expand Down Expand Up @@ -88,6 +93,28 @@ typedef struct HeartContainerVars {
f32 xDEC;
} HeartContainerVars;

typedef struct HeartContainerAttr {
s32 x0_heal; // [100]
union {
struct {
u8 b0 : 1;
u8 b1 : 1;
u8 b2 : 1;
u8 b3 : 1;
u8 b4 : 1;
u8 b5 : 1;
u8 b6 : 1;
u8 b7 : 1;
} bits;
u32 flags;
} x4; // [999]
s32 x8; // [1200]
u8 xC; // [1140]
u8 x10; // [120]
f32 x14; // y velocity? [1.5]
f32 x18; // y rotation? [0.0349066]
} HeartContainerAttr;

typedef struct MaximTomatoVars {
s32 heal_amount;
union {
Expand Down Expand Up @@ -120,22 +147,27 @@ typedef struct FoodVars {
s32 xDD8_heal;
} FoodVars;

typedef struct ItLGunVars {
/* +0 ip+DD4 */ int timer;
} ItLGunVars;

typedef struct ItLGunAttr {
int x0;
Vec3 pos;
int x0; // [16]
Vec3 pos; // [0, 2.128, 6.668]
} ItLGunAttr;

typedef struct ItLGunVars {
int timer;
} ItLGunVars;
typedef struct ItLGunRayVars {
/* +0 ip+DD4 */ float scale;
/* +4 ip+DD8 */ float angle;
/* +8 ip+DDC */ float speed;
/* +C ip+DE0 */ Vec3 pos;
} ItLGunRayVars;

typedef struct ItLGunBeamAttr {
float x0; // lifetime
float x4; // related to position calcs for var xDFC
float x8; // related to position calcs for var xDFC
float xC; // related to position calcs for var xDF8
float x10; // related to position calcs for var xDF8
} ItLGunBeamAttr;
typedef struct ItLGunRayAttr {
/* +0 */ float speed; // [5]
/* +4 */ float lifetime; // [80]
/* +8 */ float max_scale; // [3]
} ItLGunRayAttr;

typedef struct ItLGunBeamVars {
/* +0 ip+DD4 */ Vec3 position0;
Expand All @@ -147,18 +179,13 @@ typedef struct ItLGunBeamVars {
/* +30 ip+E04 */ int xE04;
} ItLGunBeamVars;

typedef struct ItLGunRayAttr {
/* +0 */ float speed;
/* +4 */ float lifetime;
/* +8 */ float max_scale;
} ItLGunRayAttr;

typedef struct ItLGunRayVars {
/* ip+DD4 */ float scale;
/* ip+DD8 */ float angle;
/* ip+DDC */ float speed;
/* ip+DE0 */ Vec3 pos;
} ItLGunRayVars;
typedef struct ItLGunBeamAttr {
float lifetime; // lifetime - [18]
float x4; // related to position calcs for var angle1 - [1]
float x8; // related to position calcs for var angle1 - [2]
float xC; // related to position calcs for var angle0 - [1.22173]
float x10; // related to position calcs for var angle0 - [2/3 * pi]
} ItLGunBeamAttr;

/// Eggs spawned on Yoshi stages / by Chansey
typedef struct EggVars {
Expand Down Expand Up @@ -308,6 +335,15 @@ typedef struct FFlowerVars {
uint x4;
} FFlowerVars;

typedef struct FFlowerAttr {
int x0; // [120]
int x4; // [1200]
int x8; // [1140]
int xC; // [120]
float x10; // [1.5]
float x14;
} FFlowerAttr;

typedef struct FFlowerFlameVars {
/* +0 */ Vec3 pos;
/* +C */ f32 unk;
Expand Down
6 changes: 3 additions & 3 deletions src/melee/it/items/itcapsule.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ void it_8027CF30(Item_GObj* gobj)
u8 _[8] = { 0 };

Item* it = GET_ITEM(gobj);
ItCapsuleAttrs* capsule = it->xC4_article_data->x4_specialAttributes;
ItCapsuleAttr* attr = it->xC4_article_data->x4_specialAttributes;

sp18.x = sp18.y = sp18.z = 0.0F;
if (!it_8026F8B4(gobj, &it->pos, &sp18, 0)) {
if (!HSD_Randi(capsule->x4)) {
if (!HSD_Randi(attr->x4)) {
it_8027D2DC(gobj);
it->xDD4_itemVar.capsule.x0 = false;
} else {
it_8026F3D4(gobj, 0, capsule->x0, 0);
it_8026F3D4(gobj, 0, attr->x0, 0);
it->xDD4_itemVar.capsule.x0 = true;
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/melee/it/items/itegg.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Item_GObj* it_80288C88(Item_GObj* gobj, Vec3* pos, Vec3* vel, float dir)

void it_80288D98(Item_GObj* gobj)
{
GET_ITEM(gobj)->xDD4_itemVar.capsule.x0 = false;
GET_ITEM(gobj)->xDD4_itemVar.egg.x0 = false;
it_80288EFC(gobj);
}

Expand Down Expand Up @@ -259,7 +259,7 @@ bool it_80289218(Item_GObj* gobj)
{
Item* ip = gobj->user_data;

if (ip->xDD4_itemVar.capsule.x0) {
if (ip->xDD4_itemVar.egg.x0) {
return false;
}
if (it_80288DC4(gobj)) {
Expand Down
6 changes: 3 additions & 3 deletions src/melee/it/items/itfflower.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ void it_80292E04(Item_GObj* gobj)
{
Item* ip = GET_ITEM(gobj);

FFlowerVars* attr = ip->xC4_article_data->x4_specialAttributes;
FFlowerAttr* attr = ip->xC4_article_data->x4_specialAttributes;

ip->xD4C = attr->x0;
ip->xAC4_ignoreItemID = Item_8026AE60();
ip->xDD4_itemVar.capsule.x0 = 0;
ip->xDD4_itemVar.capsule.x4 = 0;
ip->xDD4_itemVar.fflower.x0 = 0;
ip->xDD4_itemVar.fflower.x4 = 0;
it_8029313C(gobj);
}

Expand Down
57 changes: 29 additions & 28 deletions src/melee/it/items/itfoxlaser.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ inline void* getFoxLaser(Item* item)
bool it_8029C4D4(Item_GObj* item_gobj, CollData* arg1)
{
Item* item = GET_ITEM(item_gobj);
return it_8026E9A4(item_gobj, &item->xDD4_itemVar.foxlaser.xDE0,
&item->pos, 0);
return it_8026E9A4(item_gobj, &item->xDD4_itemVar.foxlaser.pos, &item->pos,
0);
}

static inline void normalizeAngle(f32* angle)
Expand All @@ -46,11 +46,12 @@ static inline void normalizeAngle(f32* angle)
}

void it_8029C504(HSD_GObj* parent, Vec3* pos, enum_t msid, int kind, f32 angle,
f32 arg9)
f32 speed)
{
SpawnItem spawn;
Item_GObj* item_gobj;
bool right_facing;
FoxLaserAttr* attr;

normalizeAngle(&angle);
spawn.kind = kind;
Expand All @@ -71,13 +72,13 @@ void it_8029C504(HSD_GObj* parent, Vec3* pos, enum_t msid, int kind, f32 angle,
item_gobj = Item_80268B18(&spawn);
if (item_gobj != NULL) {
Item* item = GET_ITEM(item_gobj);
FoxLaserVars* attr = item->xC4_article_data->x4_specialAttributes;
attr = item->xC4_article_data->x4_specialAttributes;
Item_80268E5C(item_gobj, msid, ITEM_ANIM_UPDATE);
it_80275158(item_gobj, attr->xDD4);
item->xDD4_itemVar.foxlaser.xDD4 = 0.0F;
item->xDD4_itemVar.foxlaser.xDD8 = angle;
item->xDD4_itemVar.foxlaser.xDDC = arg9;
item->xDD4_itemVar.foxlaser.xDE0 = spawn.pos;
it_80275158(item_gobj, attr->lifetime);
item->xDD4_itemVar.foxlaser.scale = 0.0F;
item->xDD4_itemVar.foxlaser.angle = angle;
item->xDD4_itemVar.foxlaser.speed = speed;
item->xDD4_itemVar.foxlaser.pos = spawn.pos;
db_80225DD8(item_gobj, parent);
}
}
Expand Down Expand Up @@ -105,7 +106,7 @@ bool it_8029C6F4(Item_GObj* item_gobj)
{
Article* article;
Item* item;
FoxLaserVars* attr;
FoxLaserAttr* attr;
HSD_JObj* jobj;
f32 dir;
f32 vel_x;
Expand All @@ -114,10 +115,10 @@ bool it_8029C6F4(Item_GObj* item_gobj)
jobj = GET_JOBJ(item_gobj);
article = item->xC4_article_data;
attr = article->x4_specialAttributes;
item->x40_vel.x = item->xDD4_itemVar.foxlaser.xDDC *
cosf(item->xDD4_itemVar.foxlaser.xDD8);
item->x40_vel.y = item->xDD4_itemVar.foxlaser.xDDC *
sinf(item->xDD4_itemVar.foxlaser.xDD8);
item->x40_vel.x = item->xDD4_itemVar.foxlaser.speed *
cosf(item->xDD4_itemVar.foxlaser.angle);
item->x40_vel.y = item->xDD4_itemVar.foxlaser.speed *
sinf(item->xDD4_itemVar.foxlaser.angle);
item->x40_vel.z = 0.0F;
if (item->x40_vel.x > 0.0F) {
dir = +1.0F;
Expand All @@ -132,22 +133,22 @@ bool it_8029C6F4(Item_GObj* item_gobj)
vel_x = +item->x40_vel.x;
}
HSD_JObjSetRotationX(jobj, M_PI + atan2f(item->x40_vel.y, vel_x));
item->xDD4_itemVar.foxlaser.xDD4 +=
fabsf(item->xDD4_itemVar.foxlaser.xDDC) / 11.25F;
if (item->xDD4_itemVar.foxlaser.xDD4 > attr->xDD8) {
item->xDD4_itemVar.foxlaser.xDD4 = attr->xDD8;
item->xDD4_itemVar.foxlaser.scale +=
fabsf(item->xDD4_itemVar.foxlaser.speed) / 11.25F;
if (item->xDD4_itemVar.foxlaser.scale > attr->scale) {
item->xDD4_itemVar.foxlaser.scale = attr->scale;
}
if (item->xDD4_itemVar.foxlaser.xDD4 < 1e-5F) {
item->xDD4_itemVar.foxlaser.xDD4 = 1e-3;
if (item->xDD4_itemVar.foxlaser.scale < 1e-5F) {
item->xDD4_itemVar.foxlaser.scale = 1e-3;
}
HSD_JObjSetScaleZ(jobj, item->xDD4_itemVar.foxlaser.xDD4);
HSD_JObjSetScaleZ(jobj, item->xDD4_itemVar.foxlaser.scale);
return it_80273130(item_gobj);
}

void it_8029C9CC(Item_GObj* item_gobj)
{
Item* item = GET_ITEM(item_gobj);
item->xDD4_itemVar.foxlaser.xDE0 = item->pos;
item->xDD4_itemVar.foxlaser.pos = item->pos;
}

bool it_8029C9EC(Item_GObj* item_gobj)
Expand Down Expand Up @@ -175,9 +176,9 @@ bool it_8029CA80(Item_GObj* item_gobj)
item->facing_dir = item->xC68;
HSD_JObjSetRotationY(jobj, (M_PI / 2) * item->facing_dir);
}
HSD_JObjSetScaleZ(jobj, item->xDD4_itemVar.foxlaser.xDD4 = 1e-3);
item->xDD4_itemVar.foxlaser.xDD8 += M_PI;
normalizeAngle(&item->xDD4_itemVar.foxlaser.xDD8);
HSD_JObjSetScaleZ(jobj, item->xDD4_itemVar.foxlaser.scale = 1e-3);
item->xDD4_itemVar.foxlaser.angle += M_PI;
normalizeAngle(&item->xDD4_itemVar.foxlaser.angle);
return false;
}

Expand All @@ -191,10 +192,10 @@ bool it_8029CC54(Item_GObj* item_gobj)
Item* item = GET_ITEM(item_gobj);
u8 _[4] = { 0 };
lbVector_Mirror(&item->x40_vel, &item->xC58);
item->xDD4_itemVar.foxlaser.xDD4 = 1e-3;
item->xDD4_itemVar.foxlaser.xDD8 =
item->xDD4_itemVar.foxlaser.scale = 1e-3;
item->xDD4_itemVar.foxlaser.angle =
atan2f(item->x40_vel.y, item->x40_vel.x);
normalizeAngle(&item->xDD4_itemVar.foxlaser.xDD8);
normalizeAngle(&item->xDD4_itemVar.foxlaser.angle);
return false;
}

Expand Down
4 changes: 2 additions & 2 deletions src/melee/it/items/itfoxlaser.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

/* 29C4D4 */ bool it_8029C4D4(Item_GObj*, CollData*);
/* 29C504 */ void it_8029C504(HSD_GObj* parent, Vec3* pos, enum_t msid,
int kind, f32 angle, f32 arg9);
int kind, f32 angle, f32 speed);
/* 29C6A4 */ void it_8029C6A4(f32 angle, f32 vel, HSD_GObj* parent, Vec3* vec,
int kind);
/* 29C6CC */ void it_8029C6CC(f32 angle, f32 vel, HSD_GObj* parent, Vec3* vec,
Expand All @@ -24,7 +24,7 @@
/* 29CC4C */ bool it_8029CC4C(Item_GObj*);
/* 29CC54 */ bool it_8029CC54(Item_GObj*);
/* 29CCF0 */ bool it_8029CCF0(Item_GObj*);
/* 29CCF8 */ void it_8029CCF8(Item_GObj*, HSD_GObj* ref);
/* 29CCF8 */ void it_8029CCF8(Item_GObj*, HSD_GObj*);
/* 3F67D0 */ extern ItemStateTable it_803F67D0[];

#endif
Loading
Loading