diff --git a/src/melee/it/itCharItems.h b/src/melee/it/itCharItems.h index 409366bbbc..5d12ec63b1 100644 --- a/src/melee/it/itCharItems.h +++ b/src/melee/it/itCharItems.h @@ -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; diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index 61d95f9244..e5302f8f98 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -120,22 +120,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; @@ -147,18 +152,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 x0; // lifetime - [18] + float x4; // related to position calcs for var xDFC - [1] + float x8; // related to position calcs for var xDFC - [2] + float xC; // related to position calcs for var xDF8 - [1.22173] + float x10; // related to position calcs for var xDF8 - [2/3 * pi] +} ItLGunBeamAttr; /// Eggs spawned on Yoshi stages / by Chansey typedef struct EggVars { diff --git a/src/melee/it/items/itfoxblaster.c b/src/melee/it/items/itfoxblaster.c index 239b4053c3..37b446b1c7 100644 --- a/src/melee/it/items/itfoxblaster.c +++ b/src/melee/it/items/itfoxblaster.c @@ -1131,4 +1131,4 @@ void it_802AF184(Item_GObj* item_gobj, HSD_GObj* ref_gobj) // Remove all GObj interaction references from item // Returns whether or not the referenced_gobj was the #Item::owner. it_8026B894(item_gobj, ref_gobj); -} +} \ No newline at end of file diff --git a/src/melee/it/items/itfoxlaser.c b/src/melee/it/items/itfoxlaser.c index e53556fe8a..4f1d8dfaed 100644 --- a/src/melee/it/items/itfoxlaser.c +++ b/src/melee/it/items/itfoxlaser.c @@ -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,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; @@ -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); } } @@ -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; @@ -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; @@ -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) @@ -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; } @@ -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; } diff --git a/src/melee/it/items/itfoxlaser.h b/src/melee/it/items/itfoxlaser.h index cc51f0220c..05903d7dd5 100644 --- a/src/melee/it/items/itfoxlaser.h +++ b/src/melee/it/items/itfoxlaser.h @@ -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 diff --git a/src/melee/it/types.h b/src/melee/it/types.h index edf4ceb42f..82e03029d7 100644 --- a/src/melee/it/types.h +++ b/src/melee/it/types.h @@ -542,7 +542,6 @@ struct Item { UnkFlagStruct xDD2_flag; UnkFlagStruct xDD3_flag; union { - ItCapsuleAttrs capsule; ItPokemonVars pokemon; ItStarVars star; itSword_ItemVars sword;