Add fox item attr and some small fixes (#1460)

This commit is contained in:
Aaron B 2024-09-23 00:38:04 -04:00 committed by GitHub
parent 0443d4508a
commit 8b105fcc96
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 153 additions and 86 deletions

View File

@ -96,19 +96,50 @@ typedef struct {
/* x108 */ HSD_GObj* owner; // xE7C
} FoxBlasterVars;
typedef struct {
float xDD4;
float xDD8;
float xDDC;
Vec3 xDE0;
} FoxLaserVars;
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 {
HSD_Joint* xDD4;
float xDD8;
HSD_JObj* xDDC;
/* +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 {
/* +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;

View File

@ -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;
@ -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]
s32 xC; // [1140]
s32 x10; // [120]
f32 x14; // y velocity? [1.5]
f32 x18; // y rotation? [0.0349066]
} HeartContainerAttr;
typedef struct MaximTomatoVars {
s32 heal_amount;
union {
@ -120,22 +147,27 @@ typedef struct FoodVars {
s32 xDD8_heal;
} FoodVars;
typedef struct ItLGunAttr {
int x0;
Vec3 pos;
} ItLGunAttr;
typedef struct ItLGunVars {
int timer;
/* +0 ip+DD4 */ int timer;
} ItLGunVars;
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 ItLGunAttr {
int x0; // [16]
Vec3 pos; // [0, 2.128, 6.668]
} ItLGunAttr;
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 ItLGunRayAttr {
/* +0 */ float speed; // [5]
/* +4 */ float lifetime; // [80]
/* +8 */ float max_scale; // [3]
} ItLGunRayAttr;
typedef struct ItLGunBeamVars {
/* +0 ip+DD4 */ Vec3 position0;
@ -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 {
@ -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;

View File

@ -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 {

View File

@ -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);
}
@ -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)) {

View File

@ -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);
}

View File

@ -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)
@ -46,7 +46,7 @@ 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;
@ -71,13 +71,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;
FoxLaserAttr* 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);
}
}
@ -105,7 +105,7 @@ bool it_8029C6F4(Item_GObj* item_gobj)
{
Article* article;
Item* item;
FoxLaserVars* attr;
FoxLaserAttr* attr;
HSD_JObj* jobj;
f32 dir;
f32 vel_x;
@ -114,10 +114,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;
@ -132,22 +132,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)
@ -175,9 +175,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;
}
@ -191,10 +191,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;
}

View File

@ -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,
@ -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

View File

@ -64,20 +64,20 @@ Item_GObj* it_80283AE4(Item_GObj* gobj, Vec3* pos, s32 arg2)
void it_80283BD4(Item_GObj* gobj)
{
Item* ip = GET_ITEM(gobj);
HeartContainerVars* vars = ip->xC4_article_data->x4_specialAttributes;
HeartContainerAttr* vars = ip->xC4_article_data->x4_specialAttributes;
ip->xDD4_itemVar.capsule.x0 = vars->xDD8.flags;
ip->xDD4_itemVar.HeartContainer.xDD4_heal = vars->x4.flags;
}
void it_80283BEC(Item_GObj* gobj)
{
Item* ip = GET_ITEM(gobj);
HeartContainerVars* vars = ip->xC4_article_data->x4_specialAttributes;
HeartContainerAttr* vars = ip->xC4_article_data->x4_specialAttributes;
ip->x40_vel.x = 0.0F;
ip->x40_vel.y = vars->xDE8_float;
ip->x40_vel.y = vars->x14;
ip->x40_vel.z = 0.0F;
ip->xDD4_itemVar.HeartContainer.xDD4_heal = vars->xDD4_heal;
ip->xDD4_itemVar.HeartContainer.xDD4_heal = vars->x0_heal;
ip->xDD4_itemVar.HeartContainer.xDD8.bits.b0 = false;
ip->xDD4_itemVar.HeartContainer.xDDC = 0;
it_80283DD4(gobj);
@ -109,9 +109,9 @@ void it_80283C7C(Item_GObj* gobj)
bool it_80283CD4(Item_GObj* gobj)
{
HSD_JObj* child = HSD_JObjGetChild(GET_JOBJ(gobj));
HeartContainerVars* attrs =
HeartContainerAttr* attrs =
GET_ITEM(gobj)->xC4_article_data->x4_specialAttributes;
HSD_JObjAddRotationY(child, attrs->xDEC);
HSD_JObjAddRotationY(child, attrs->x18);
return false;
}
@ -131,9 +131,9 @@ void it_80283DD4(Item_GObj* gobj)
bool it_80283DFC(Item_GObj* gobj)
{
HSD_JObj* child = HSD_JObjGetChild(GET_JOBJ(gobj));
HeartContainerVars* attrs =
HeartContainerAttr* attrs =
GET_ITEM(gobj)->xC4_article_data->x4_specialAttributes;
HSD_JObjAddRotationY(child, attrs->xDEC);
HSD_JObjAddRotationY(child, attrs->x18);
return false;
}

View File

@ -137,8 +137,8 @@ void it_802996D0(HSD_GObj* owner_gobj, Vec3* pos, u32 arg2, f32 facing_dir)
item->xC4_article_data->x4_specialAttributes;
item->xDAC_itcmd_var0 = item->xDB0_itcmd_var1 =
item->xDB4_itcmd_var2 = item->xDB8_itcmd_var3 = 0;
item->xDD4_itemVar.lgunbeam.lifetime = item_spec_attr->x0;
it_80275158(gobj, item_spec_attr->x0);
item->xDD4_itemVar.lgunbeam.lifetime = item_spec_attr->lifetime;
it_80275158(gobj, item_spec_attr->lifetime);
item->xDD4_itemVar.lgunbeam.position0 = *pos;
{
float temp = item_spec_attr->x4;

View File

@ -68,7 +68,7 @@ Item_GObj* it_802841B4(Item_GObj* gobj, Vec3* pos, s32 arg2)
void it_8028428C(Item_GObj* gobj)
{
Item* ip = GET_ITEM(gobj);
ip->xDD4_itemVar.capsule.x0 =
ip->xDD4_itemVar.MaximTomato.heal_amount =
M2C_FIELD(ip->xC4_article_data->x4_specialAttributes, s32*, 4);
}

View File

@ -542,7 +542,7 @@ struct Item {
UnkFlagStruct xDD2_flag;
UnkFlagStruct xDD3_flag;
union {
ItCapsuleAttrs capsule;
ItCapsuleVars capsule;
ItPokemonVars pokemon;
ItStarVars star;
itSword_ItemVars sword;