diff --git a/src/melee/cm/camera.c b/src/melee/cm/camera.c index 98735fa6f7..e53a37d66e 100644 --- a/src/melee/cm/camera.c +++ b/src/melee/cm/camera.c @@ -1805,7 +1805,172 @@ void Camera_8002C010(f32 farg0, f32 farg1) } } -/// #Camera_8002C1A8 +void Camera_8002C1A8(void) +{ + s8 slot; + struct { + u8 pad[8]; + CameraInputs inputs; + } stack_inputs; + f32 zoom_dir; + f32 move_x; + f32 move_y; + f32 rotate_x; + f32 rotate_y; + f32 abs_value; + f32 stick_x; + f32 stick_y; + f32 substick_x; + f32 substick_y; + f32 pause_cam_z_pos_init; + u64 input_x18; + u64 input_x10; + s32 dir; + Camera* camera; + s8* slot_ptr; + + camera = &cm_80452C68; + slot = camera->x305; + + if (slot == 5) { + return; + } + + Camera_8002B694(&stack_inputs.inputs, slot); + + zoom_dir = move_x = move_y = rotate_x = rotate_y = 0.0f; + stick_x = stack_inputs.inputs.stick_x; + stick_y = stack_inputs.inputs.stick_y; + substick_x = stack_inputs.inputs.substick_x; + substick_y = stack_inputs.inputs.substick_y; + input_x18 = stack_inputs.inputs.x18._u64; + input_x10 = stack_inputs.inputs.x10._u64; + dir = 0; + if ((input_x18 & 0x20ULL) != 0) { + dir = 1; + } else if ((input_x18 & 0x40ULL) != 0) { + dir = -1; + } + + if ((input_x10 & 0x8ULL) != 0) { + move_y = 1.0f; + } else if ((input_x10 & 0x4ULL) != 0) { + move_y = -1.0f; + } + + if ((input_x10 & 0x1ULL) != 0) { + move_x = -1.0f; + } else if ((input_x10 & 0x2ULL) != 0) { + move_x = 1.0f; + } + + if ((input_x10 & 0x400ULL) != 0) { + zoom_dir = 1.0f; + } else if ((input_x10 & 0x800ULL) != 0) { + zoom_dir = -1.0f; + } + + if ((input_x18 & 0x100ULL) != 0) { + if (stick_x < 0.0f) { + abs_value = -stick_x; + } else { + abs_value = stick_x; + } + if (abs_value > 0.125) { + move_x = stick_x; + } + if (stick_y < 0.0f) { + abs_value = -stick_y; + } else { + abs_value = stick_y; + } + if (abs_value > 0.125) { + move_y = stick_y; + } + stick_y = 0.0f; + } + + if (stick_y < 0.0f) { + abs_value = -stick_y; + } else { + abs_value = stick_y; + } + if (abs_value > 0.125) { + zoom_dir = -stick_y; + } + + if (substick_x < 0.0f) { + abs_value = -substick_x; + } else { + abs_value = substick_x; + } + if (abs_value > 0.125) { + rotate_x = substick_x; + } + + if (substick_y < 0.0f) { + abs_value = -substick_y; + } else { + abs_value = substick_y; + } + if (abs_value > 0.125) { + rotate_y = substick_y; + } + + if (dir != 0) { + pause_cam_z_pos_init = + camera->x32C * cm_803BCCA0.x8C + cm_803BCCA0.x90; + slot_ptr = &camera->x304; + *slot_ptr = Camera_8002BA00((s8) *slot_ptr, dir); + slot = *slot_ptr; + camera->x314.z = 0.0f; + camera->x314.y = 0.0f; + camera->x314.x = 0.0f; + camera->pause_eye_offset.x = 0.0f; + camera->pause_eye_offset.y = 5.0f; + camera->pause_eye_offset.z = 20.0f; + camera->pause_up.x = 0.0f; + camera->pause_up.y = 1.0f; + camera->pause_up.z = 0.0f; + + if (slot == 10) { + camera->pause_eye_distance = 3.0f * pause_cam_z_pos_init; + } else { + camera->pause_eye_distance = pause_cam_z_pos_init; + } + + Camera_8002BAA8(0.0f); + } + + if (zoom_dir != 0.0f) { + Camera_8002BAA8(zoom_dir); + } + + if (move_x != 0.0f || move_y != 0.0f) { + if (camera->x304 == 10) { + if (sqrtf__Ff( + (camera->pause_eye_offset.x * camera->pause_eye_offset.x) + + (camera->pause_eye_offset.y * camera->pause_eye_offset.y) + + (camera->pause_eye_offset.z * + camera->pause_eye_offset.z)) < 1.0f) + { + camera->pause_eye_distance = 1.0f; + } + if (move_y != 0.0f) { + camera->x314.y += move_y; + } + if (move_x != 0.0f) { + camera->x314.x += move_x; + } + } else { + Camera_8002C010(move_x, move_y); + } + } + + if (rotate_x != 0.0f || rotate_y != 0.0f) { + Camera_8002BD88(rotate_x, rotate_y); + } +} /// #Camera_8002C5B4 diff --git a/src/melee/cm/camera.h b/src/melee/cm/camera.h index 37ffcca76c..e44cf11bd5 100644 --- a/src/melee/cm/camera.h +++ b/src/melee/cm/camera.h @@ -41,7 +41,7 @@ /* 02BC78 */ s32 Camera_8002BC78(Vec3*, Vec3*, Vec3*); /* 02BD88 */ void Camera_8002BD88(f32, f32); /* 02C010 */ void Camera_8002C010(f32, f32); -/* 02C1A8 */ UNK_RET Camera_8002C1A8(UNK_PARAMS); +/* 02C1A8 */ void Camera_8002C1A8(void); /* 02C5B4 */ void Camera_8002C5B4(void*); /* 02C908 */ void Camera_8002C908(void*); /* 02CB0C */ void Camera_8002CB0C(CameraBounds*); diff --git a/src/melee/ft/chara/ftCommon/ftCo_Attack100.c b/src/melee/ft/chara/ftCommon/ftCo_Attack100.c index 39c34fab30..fdacb2ad5a 100644 --- a/src/melee/ft/chara/ftCommon/ftCo_Attack100.c +++ b/src/melee/ft/chara/ftCommon/ftCo_Attack100.c @@ -20,16 +20,14 @@ #include "ftCommon/forward.h" -#include "ftCommon/types.h" - #include "ftCommon/ftCo_CaptureCut.h" #include "ftCommon/ftCo_ItemThrow.h" #include "ftCommon/ftCo_Throw.h" -#include "it/items/itsamusgrapple.h" -#include "it/items/itsscope.h" +#include "ftCommon/types.h" +#include "it/inlines.h" #include "it/items/itlinkhookshot.h" #include "it/items/itsamusgrapple.h" -#include "it/inlines.h" +#include "it/items/itsscope.h" #include "mp/mplib.h" #include @@ -92,7 +90,7 @@ /* 0DA054 */ void fn_800DA054(Fighter_GObj* gobj); /* 0DAADC */ static void fn_800DAADC(Fighter_GObj* arg0, Fighter_GObj* arg1); /* 0DAECC */ static void fn_800DAECC(Fighter_GObj* gobj); -/* 0DAEEC */ void fn_800DAEEC(Fighter_GObj* gobj); +/* 0DAEEC */ void ftCo_CapturePulledHi_Coll(Fighter_GObj* gobj); /* 0DB230 */ static void fn_800DB230(Fighter_GObj* gobj); /* 0DB230 */ static inline void fn_800DB230_inline(Fighter_GObj* gobj); /* 0DBBF8 */ void fn_800DBBF8(Fighter_GObj* gobj); @@ -501,10 +499,9 @@ void ft_800D76B8(Fighter_GObj* gobj) extern int ftCo_804D9024; if (it_8026B594(fp->item_gobj) == false) { - Fighter_ChangeMotionState(gobj, ftCo_MS_ItemScopeStart, Ft_MF_None, - *(f32*) &ftCo_804D9020, - *(f32*) &ftCo_804D9024, - *(f32*) &ftCo_804D9020, NULL); + Fighter_ChangeMotionState( + gobj, ftCo_MS_ItemScopeStart, Ft_MF_None, *(f32*) &ftCo_804D9020, + *(f32*) &ftCo_804D9024, *(f32*) &ftCo_804D9020, NULL); } else { Fighter_ChangeMotionState(gobj, ftCo_MS_ItemScopeStartEmpty, Ft_MF_None, *(f32*) &ftCo_804D9020, @@ -603,15 +600,15 @@ void fn_800D7938(Fighter_GObj* gobj) Fighter_GObj* temp_r30; Fighter* temp_r31; s32 temp_r4; + extern void it_80291F14(Item_GObj*, s32); temp_r30 = gobj; temp_r31 = GET_FIGHTER(temp_r30); if (temp_r31->item_gobj != NULL) { - temp_r4 = - it_80291DAC(temp_r31->item_gobj, (s32) ((FighterOverlay*) temp_r31)->x2340); + temp_r4 = it_80291DAC(temp_r31->item_gobj, + (s32) ((FighterOverlay*) temp_r31)->x2340); if (temp_r4 != -1) { - ((void (*)(Item_GObj*, s32)) it_80291F14)(temp_r31->item_gobj, - temp_r4); + it_80291F14(temp_r31->item_gobj, temp_r4); } ftCommon_8007E7E4(temp_r30, 1); } @@ -739,8 +736,6 @@ void fn_800D7BDC(Fighter_GObj* gobj) fp->take_dmg_cb = fn_800D8378; } - - #pragma pop #pragma push @@ -790,7 +785,8 @@ void ftCo_ItemScopeRapid_Anim(Fighter_GObj* gobj) PAD_STACK(8); - if (fp->cur_anim_frame >= 0.0F && fp->cur_anim_frame < fp->frame_speed_mul) { + if (fp->cur_anim_frame >= 0.0F && fp->cur_anim_frame < fp->frame_speed_mul) + { ft_800892A0(gobj); ft_80089824(gobj); fp->mv.co.common.x0--; @@ -805,8 +801,7 @@ void ftCo_ItemScopeRapid_Anim(Fighter_GObj* gobj) 0x0C4C5080, fp->cur_anim_frame, fp->frame_speed_mul, 0.0F, NULL); } else { - Fighter_ChangeMotionState(gobj, - ftCo_MS_ItemScopeAirRapidEmpty, + Fighter_ChangeMotionState(gobj, ftCo_MS_ItemScopeAirRapidEmpty, 0x0C4C5080, fp->cur_anim_frame, fp->frame_speed_mul, 0.0F, NULL); } @@ -822,7 +817,8 @@ void ftCo_ItemScopeAirRapid_Anim(Fighter_GObj* gobj) PAD_STACK(8); - if (fp->cur_anim_frame >= 0.0F && fp->cur_anim_frame < fp->frame_speed_mul) { + if (fp->cur_anim_frame >= 0.0F && fp->cur_anim_frame < fp->frame_speed_mul) + { ft_800892A0(gobj); ft_80089824(gobj); fp->mv.co.common.x0--; @@ -837,8 +833,7 @@ void ftCo_ItemScopeAirRapid_Anim(Fighter_GObj* gobj) 0x0C4C5080, fp->cur_anim_frame, fp->frame_speed_mul, 0.0F, NULL); } else { - Fighter_ChangeMotionState(gobj, - ftCo_MS_ItemScopeAirRapidEmpty, + Fighter_ChangeMotionState(gobj, ftCo_MS_ItemScopeAirRapidEmpty, 0x0C4C5080, fp->cur_anim_frame, fp->frame_speed_mul, 0.0F, NULL); } @@ -910,10 +905,9 @@ void fn_800D8140(Fighter_GObj* gobj, int arg1) { HSD_GObj* gobj2 = gobj; - Fighter_ChangeMotionState(gobj2, msid, Ft_MF_None, - *(f32*) &ftCo_804D9030, - *(f32*) &ftCo_804D9034, - *(f32*) &ftCo_804D9030, NULL); + Fighter_ChangeMotionState( + gobj2, msid, Ft_MF_None, *(f32*) &ftCo_804D9030, + *(f32*) &ftCo_804D9034, *(f32*) &ftCo_804D9030, NULL); } fp->mv.co.common.x0 = arg1; fp->accessory4_cb = fn_800D86B8; @@ -1288,8 +1282,6 @@ bool fn_800D8E94(Fighter_GObj* gobj) return true; } - - bool fn_800D9228(Fighter_GObj* gobj) { Fighter* fp = GET_FIGHTER(gobj); @@ -1379,8 +1371,6 @@ bool fn_800D952C(Fighter_GObj* gobj) return true; } - - /// #fn_800D9930 void fn_800D9C64(Fighter_GObj* gobj) @@ -1431,7 +1421,6 @@ void fn_800DA004(Fighter_GObj* gobj) ftCo_Fall_Enter(victim); } - void fn_800DA190(Fighter_GObj* gobj) { Fighter* fp = GET_FIGHTER(gobj); @@ -1646,6 +1635,8 @@ float ftCo_800DA824(Fighter* fp) /// #fn_800DA8E4 +#pragma push +#pragma dont_inline on void fn_800DAA40(Fighter_GObj* arg0, Fighter_GObj* arg1) { Vec3 sp18; @@ -1661,6 +1652,7 @@ void fn_800DAA40(Fighter_GObj* arg0, Fighter_GObj* arg1) temp_r31->cur_pos.z += sp18.z; } } +#pragma pop void fn_800DAADC(Fighter_GObj* arg0, Fighter_GObj* arg1) { @@ -1689,6 +1681,8 @@ void fn_800DAC78(Fighter_GObj* gobj, Vec3* arg1) arg1->z = sp2C.z - sp20.z; } +#pragma push +#pragma dont_inline on static bool fn_800DAD18(Fighter_GObj* gobj) { Fighter* temp_r31; @@ -1721,23 +1715,57 @@ static bool fn_800DAD18(Fighter_GObj* gobj) temp_r31->cur_pos.z += tmp.z; return var_r3; } +#pragma pop void ftCo_CapturePulledHi_Coll(Fighter_GObj* gobj) { - Fighter* fp = GET_FIGHTER(gobj); - if (!fp->x2226_b2) { - ft_80083C00(gobj, fn_800DAECC); + register Fighter* temp_r31; + register Fighter_GObj* temp_r30; + Fighter* fp; + Fighter* victim_fp; + f32 dz; + f32 dy; + f32 dx; + volatile u8 pad10[0x10]; + Vec3 sp34; + Vec3 sp28; + + temp_r30 = gobj; + temp_r31 = GET_FIGHTER(temp_r30); + + ftCommon_8007D7FC(temp_r31); + Fighter_ChangeMotionState(temp_r30, ftCo_MS_CapturePulledLw, + Ft_MF_UpdateCmd, temp_r31->cur_anim_frame, 1.0F, + 0.0F, NULL); + + fp = GET_FIGHTER(temp_r30); + victim_fp = GET_FIGHTER(temp_r31->victim_gobj); + + lb_8000B1CC(GET_FIGHTER(fp->victim_gobj)->mv.co.capturedamage.x18, NULL, + &sp28); + lb_8000B1CC(fp->parts[ftParts_GetBoneIndex(fp, FtPart_XRotN)].joint, NULL, + &sp34); + + dx = sp28.x - sp34.x; + dy = sp28.y - sp34.y; + dz = sp28.z - sp34.z; + + if (fp->ground_or_air == GA_Ground) { + victim_fp->x2170 = dy + fp->cur_pos.y - victim_fp->cur_pos.y; + } else { + victim_fp->x2170 = 0.0F; + fp->cur_pos.x += dx; + fp->cur_pos.y += dy; + fp->cur_pos.z += dz; } } static void fn_800DAECC(Fighter_GObj* gobj) { - fn_800DAEEC(gobj); + ftCo_CapturePulledHi_Coll(gobj); } - - -void fn_800DAEEC(Fighter_GObj* gobj) +void ftCo_CapturePulledHi_Coll(Fighter_GObj* gobj) { register Fighter* temp_r31; register Fighter_GObj* temp_r30; @@ -1779,7 +1807,6 @@ void fn_800DAEEC(Fighter_GObj* gobj) fp->cur_pos.z += dz; } } - void ftCo_CapturePulledLw_Anim(Fighter_GObj* gobj) {} void ftCo_CapturePulledLw_IASA(Fighter_GObj* gobj) {} @@ -1817,8 +1844,8 @@ void ftCo_CapturePulledLw_Phys(Fighter_GObj* gobj) temp_r30 = gobj; temp_r31 = GET_FIGHTER(temp_r30); - lb_8000B1CC(GET_FIGHTER(temp_r31->victim_gobj)->mv.co.capturedamage.x18, NULL, - &sp20); + lb_8000B1CC(GET_FIGHTER(temp_r31->victim_gobj)->mv.co.capturedamage.x18, + NULL, &sp20); lb_8000B1CC( temp_r31->parts[ftParts_GetBoneIndex(temp_r31, FtPart_XRotN)].joint, NULL, &sp2C); @@ -1908,6 +1935,8 @@ void ftCo_800DB500(Fighter_GObj* gobj) } } +#pragma push +#pragma dont_inline on static void fn_800DB5D8(Fighter_GObj* gobj) { ftHurtboxInit sp18; @@ -1928,8 +1957,7 @@ static void fn_800DB5D8(Fighter_GObj* gobj) } ftCommon_8007E2F4(fp, 0x1FF); } - - +#pragma pop void fn_800DB790(Fighter_GObj* gobj) { @@ -1951,7 +1979,8 @@ void fn_800DB790(Fighter_GObj* gobj) hurt.is_grabbable = false; hurt.a_offset.x = hurt.a_offset.y = hurt.a_offset.z = 0.0F; hurt.b_offset.x = hurt.b_offset.y = hurt.b_offset.z = 0.0F; - hurt.scale = ftYs_Init_8012BAC0(victim_fp) / ftCommon_GetModelScale(fp); + hurt.scale = + ftYs_Init_8012BAC0(victim_fp) / ftCommon_GetModelScale(fp); ftColl_HurtboxInit(fp, fp->hurt_capsules, &hurt); } @@ -2052,7 +2081,8 @@ void fn_800DBAE4(Fighter_GObj* gobj) hurt.is_grabbable = false; hurt.a_offset.x = hurt.a_offset.y = hurt.a_offset.z = 0.0F; hurt.b_offset.x = hurt.b_offset.y = hurt.b_offset.z = 0.0F; - hurt.scale = ftYs_Init_8012BAC0(victim_fp) / ftCommon_GetModelScale(fp); + hurt.scale = + ftYs_Init_8012BAC0(victim_fp) / ftCommon_GetModelScale(fp); ftColl_HurtboxInit(fp, fp->hurt_capsules, &hurt); } @@ -2155,8 +2185,7 @@ static inline void fn_800DBED4_inline(Fighter_GObj* gobj) HSD_JObjSetTranslate(GET_JOBJ(gobj), &temp_r31->cur_pos); } -void fn_800DBED4(gobj) -Fighter_GObj* gobj; +void fn_800DBED4(Fighter_GObj* gobj) { PAD_STACK(4); fn_800DBED4_inline(gobj); diff --git a/src/melee/ft/chara/ftKirby/ftKb_SpecialN.c b/src/melee/ft/chara/ftKirby/ftKb_SpecialN.c index c276b0d26b..a264cd5353 100644 --- a/src/melee/ft/chara/ftKirby/ftKb_SpecialN.c +++ b/src/melee/ft/chara/ftKirby/ftKb_SpecialN.c @@ -405,8 +405,8 @@ void ftKb_SpecialAirHi3_Phys(Fighter_GObj* gobj) /// FAKE MATCH: comma operator required for regalloc ftCommon_8007D3A8(fp, 0.0f, - ((0, fp->co_attrs.air_drift_stick_mul)) *dat_attr - ->specialhi_horizontal_momentum, + ((0, fp->co_attrs.air_drift_stick_mul)) * + dat_attr->specialhi_horizontal_momentum, fp->co_attrs.air_drift_max); } @@ -1611,8 +1611,7 @@ static void fn_800F6318(HSD_GObj* gobj) void ftKb_SpecialN_800F6388(Fighter_GObj* gobj) { Fighter* fp = GET_FIGHTER(gobj); - Fighter_ChangeMotionState(gobj, ftKb_MS_EatWait, 0x10, 0.0F, 1.0F, 0.0F, - NULL); + Fighter_ChangeMotionState(gobj, ftKb_MS_Eat, 0x10, 0.0F, 1.0F, 0.0F, NULL); ftAnim_8006EBA4(gobj); ftCommon_8007E2F4(fp, 0x1FF); } @@ -1620,7 +1619,7 @@ void ftKb_SpecialN_800F6388(Fighter_GObj* gobj) void ftKb_SpecialN_800F63EC(Fighter_GObj* gobj) { Fighter* fp = GET_FIGHTER(gobj); - Fighter_ChangeMotionState(gobj, ftKb_MS_EatFall, 0x10, 0.0F, 1.0F, 0.0F, + Fighter_ChangeMotionState(gobj, ftKb_MS_EatAir, 0x10, 0.0F, 1.0F, 0.0F, NULL); ftAnim_8006EBA4(gobj); ftCommon_8007E2F4(fp, 0x1FF); diff --git a/src/melee/ft/chara/ftKirby/ftKb_SpecialNZd.c b/src/melee/ft/chara/ftKirby/ftKb_SpecialNZd.c index 097bc4a198..d8f9c102ad 100644 --- a/src/melee/ft/chara/ftKirby/ftKb_SpecialNZd.c +++ b/src/melee/ft/chara/ftKirby/ftKb_SpecialNZd.c @@ -620,6 +620,10 @@ s32 ftKb_SpecialNMt_80106F44(Fighter_GObj* gobj, s32* out_charge, s32* out_max) /// #ftKb_SpecialNMt_80106F9C +/// #ftKb_SpecialNMt_80106F9C + +/// #ftKb_SpecialNMt_80106FEC + /// #ftKb_SpecialNMt_80106FEC /// @brief Clears Mewtwo copy ability state and effects. diff --git a/src/melee/ft/chara/ftPopo/ftPp_SpecialS.c b/src/melee/ft/chara/ftPopo/ftPp_SpecialS.c index 04e085cbb9..c5bbc4ef41 100644 --- a/src/melee/ft/chara/ftPopo/ftPp_SpecialS.c +++ b/src/melee/ft/chara/ftPopo/ftPp_SpecialS.c @@ -819,6 +819,34 @@ void ftPp_SpecialHi_Enter(Fighter_GObj* gobj) } /// #ftPp_SpecialAirHi_Enter +typedef struct ftPpAirHiEnterAttrs { + u8 pad0[0x84]; + f32 x84; + f32 x88; +} ftPpAirHiEnterAttrs; + +void ftPp_SpecialAirHi_Enter(Fighter_GObj* gobj) +{ + Fighter* fp = GET_FIGHTER(gobj); + ftPpAirHiEnterAttrs* da = fp->dat_attrs; + + fp->self_vel.x /= da->x84; + fp->self_vel.y /= da->x88; + + ftPp_SpecialHi_801218F8(gobj); + + fp = GET_FIGHTER(gobj); + fp->x1968_jumpsUsed = fp->co_attrs.max_jumps; + fp->cmd_vars[2] = 0; + fp->cmd_vars[1] = 0; + fp->cmd_vars[0] = 0; + fp->mv.pp.unk_80123954.x0 = 1; + fp->fv.pp.x223C = 0; + fp->fv.pp.x2240.z = 0.0f; + fp->fv.pp.x2240.y = 0.0f; + fp->fv.pp.x2240.x = 0.0f; +} + /// #ftPp_SpecialHiStart_0_Anim /// #ftPp_SpecialAirHiStart_0_Anim @@ -827,6 +855,15 @@ void ftPp_SpecialHi_Enter(Fighter_GObj* gobj) /// #ftPp_SpecialAirHiStart_0_IASA +typedef struct ftPpAirHiPhysAttrs { + u8 pad[0x8C]; + f32 x8C; + f32 x90; + u8 pad2[0xA8 - 0x94]; + f32 xA8; + f32 xAC; +} ftPpAirHiPhysAttrs; + void ftPp_SpecialHiStart_0_Phys(Fighter_GObj* gobj) { Fighter* fp; @@ -853,7 +890,34 @@ void ftPp_SpecialHiStart_0_Phys(Fighter_GObj* gobj) fp->fv.pp.x2240 = sp; } -/// #ftPp_SpecialAirHiStart_0_Phys +void ftPp_SpecialAirHiStart_0_Phys(Fighter_GObj* gobj) +{ + Fighter* fp; + Vec3 sp; + u8 _[0xC]; + + fp = GET_FIGHTER(gobj); + ftCommon_Fall(fp, ((ftPpAirHiPhysAttrs*) fp->dat_attrs)->x8C, + ((ftPpAirHiPhysAttrs*) fp->dat_attrs)->x90); + ftCommon_8007CEF4(fp); + fp = GET_FIGHTER(gobj); + sp.x = sp.y = sp.z = 0.0f; + + { + Fighter_GObj* nn_gobj = + Player_GetEntityAtIndex(GET_FIGHTER(gobj)->player_id, 1); + if (nn_gobj != NULL) { + Fighter* nn_fp = GET_FIGHTER(nn_gobj); + if (nn_fp->motion_id >= ftPp_MS_SpecialHi_0 && + nn_fp->motion_id <= ftPp_MS_SpecialHi_5) + { + lb_8000B1CC(nn_fp->parts[FtPart_L4thNb].joint, NULL, &sp); + } + } + } + + fp->fv.pp.x2240 = sp; +} void ftPp_SpecialHiStart_0_Coll(Fighter_GObj* gobj) { @@ -944,7 +1008,34 @@ void ftPp_SpecialHiThrow_0_Phys(Fighter_GObj* gobj) fp->fv.pp.x2240 = sp; } -/// #ftPp_SpecialAirHiThrow_0_Phys +void ftPp_SpecialAirHiThrow_0_Phys(Fighter_GObj* gobj) +{ + Fighter* fp; + Vec3 sp; + u8 _[0xC]; + + fp = GET_FIGHTER(gobj); + ftCommon_Fall(fp, ((ftPpAirHiPhysAttrs*) fp->dat_attrs)->x8C, + ((ftPpAirHiPhysAttrs*) fp->dat_attrs)->x90); + ftCommon_8007CEF4(fp); + fp = GET_FIGHTER(gobj); + sp.x = sp.y = sp.z = 0.0f; + + { + Fighter_GObj* nn_gobj = + Player_GetEntityAtIndex(GET_FIGHTER(gobj)->player_id, 1); + if (nn_gobj != NULL) { + Fighter* nn_fp = GET_FIGHTER(nn_gobj); + if (nn_fp->motion_id >= ftPp_MS_SpecialHi_0 && + nn_fp->motion_id <= ftPp_MS_SpecialHi_5) + { + lb_8000B1CC(nn_fp->parts[FtPart_L4thNb].joint, NULL, &sp); + } + } + } + + fp->fv.pp.x2240 = sp; +} void ftPp_SpecialHiThrow_0_Coll(Fighter_GObj* gobj) { @@ -1030,6 +1121,18 @@ void ftPp_SpecialHiStart_1_Phys(Fighter_GObj* gobj) /// #ftPp_SpecialAirHiStart_1_Phys +void ftPp_SpecialAirHiStart_1_Phys(Fighter_GObj* gobj) +{ + Fighter* fp = GET_FIGHTER(gobj); + u8 _[8]; + + ftCommon_Fall(fp, ((ftPpAirHiPhysAttrs*) fp->dat_attrs)->xA8, + ((ftPpAirHiPhysAttrs*) fp->dat_attrs)->xAC); + if (fp->self_vel.y < 0.0f) { + ftCommon_8007CEF4(fp); + } +} + void ftPp_SpecialHiStart_1_Coll(Fighter_GObj* gobj) { if (!ft_800827A0(gobj)) { @@ -1114,6 +1217,18 @@ void ftPp_SpecialHiThrow_1_Phys(Fighter_GObj* gobj) /// #ftPp_SpecialAirHiThrow_1_Phys +void ftPp_SpecialAirHiThrow_1_Phys(Fighter_GObj* gobj) +{ + Fighter* fp = GET_FIGHTER(gobj); + u8 _[8]; + + ftCommon_Fall(fp, ((ftPpAirHiPhysAttrs*) fp->dat_attrs)->xA8, + ((ftPpAirHiPhysAttrs*) fp->dat_attrs)->xAC); + if (fp->self_vel.y < 0.0f) { + ftCommon_8007CEF4(fp); + } +} + void ftPp_SpecialHiThrow_1_Coll(Fighter_GObj* gobj) { if (!ft_800827A0(gobj)) { diff --git a/src/melee/ft/chara/ftYoshi/ftYs_SpecialHi.c b/src/melee/ft/chara/ftYoshi/ftYs_SpecialHi.c index e8e6783b08..b2f282b938 100644 --- a/src/melee/ft/chara/ftYoshi/ftYs_SpecialHi.c +++ b/src/melee/ft/chara/ftYoshi/ftYs_SpecialHi.c @@ -86,9 +86,37 @@ void ftYs_SpecialS_8012E270(Fighter_GObj* gobj) fp->death2_cb = NULL; } -/// #ftYs_SpecialHi_Enter +void ftYs_SpecialHi_Enter(Fighter_GObj* gobj) +{ + Fighter* fp = GET_FIGHTER(gobj); + u8 _[0x18]; + + fp->mv.ys.specialhi.x0 = 0; + fp->mv.ys.specialhi.x4 = 0; + fp->fv.ys.x2238 = NULL; + fp->throw_flags = 0; + fp->cmd_vars[0] = 0; + Fighter_ChangeMotionState(gobj, ftYs_MS_SpecialHi, 0, 0.0F, 1.0F, 0.0F, + NULL); + ((Fighter*) gobj->user_data)->accessory4_cb = fn_8012E110; + ftAnim_8006EBA4(gobj); +} -/// #ftYs_SpecialAirHi_Enter +void ftYs_SpecialAirHi_Enter(Fighter_GObj* gobj) +{ + Fighter* fp = GET_FIGHTER(gobj); + u8 _[0x18]; + + fp->mv.ys.specialhi.x0 = 0; + fp->mv.ys.specialhi.x4 = 0; + fp->fv.ys.x2238 = NULL; + fp->throw_flags = 0; + fp->cmd_vars[0] = 0; + Fighter_ChangeMotionState(gobj, ftYs_MS_SpecialAirHi, 0, 0.0F, 1.0F, 0.0F, + NULL); + ((Fighter*) gobj->user_data)->accessory4_cb = fn_8012E110; + ftAnim_8006EBA4(gobj); +} static void setAccessory4Callback(Fighter_GObj* gobj) { diff --git a/src/melee/ft/ft_0892.c b/src/melee/ft/ft_0892.c index 20838adb28..563c2ded45 100644 --- a/src/melee/ft/ft_0892.c +++ b/src/melee/ft/ft_0892.c @@ -81,8 +81,8 @@ void ft_80089824(Fighter_GObj* gobj) s32 temp; fp = GET_FIGHTER(gobj); - ((s32*)&temp)[0] = fp->x2070.x2070_int; - fp->x2070.x2070_int = ((s32*)&temp)[0]; + ((s32*) &temp)[0] = fp->x2070.x2070_int; + fp->x2070.x2070_int = ((s32*) &temp)[0]; ft_80089460(fp); fp->x2074.x2088 = plAttack_80037B08(); pl_80037C60(gobj, 0); diff --git a/src/melee/ft/ft_0C31.c b/src/melee/ft/ft_0C31.c index 66bd99bbb8..e97408c344 100644 --- a/src/melee/ft/ft_0C31.c +++ b/src/melee/ft/ft_0C31.c @@ -642,11 +642,11 @@ void ftCo_CaptureLikelike_Anim(Fighter_GObj* gobj) fp->grab_timer -= p_ftCommonData->x758; ftCommon_GrabMash(fp, p_ftCommonData->x75C); - if (*(int*)&fp->mv.co.mushroom.x4 == 0) { + if (*(int*) &fp->mv.co.mushroom.x4 == 0) { if (fp->grab_timer <= 0.0f) { void it_802DB9F4(Item_GObj*); it_802DB9F4(fp->mv.co.capturelikelike.x0); - *(int*)&fp->mv.co.mushroom.x4 = 1; + *(int*) &fp->mv.co.mushroom.x4 = 1; } } } diff --git a/src/melee/ft/ft_0D31.c b/src/melee/ft/ft_0D31.c index c05681f2a0..0eae779bc3 100644 --- a/src/melee/ft/ft_0D31.c +++ b/src/melee/ft/ft_0D31.c @@ -483,7 +483,16 @@ void ftCo_800D4F24(Fighter_GObj* gobj, int index) /// #ftCo_800D4FF4 -/// #ftCo_Rebirth_Anim +void ftCo_Rebirth_Anim(Fighter_GObj* gobj) +{ + Fighter* fp = GET_FIGHTER(gobj); + + ftCo_8008A7A8(gobj, fp->ft_data->x24); + fp->mv.co.common.x0 -= 1; + if (fp->mv.co.common.x0 == 0) { + ftCo_800D5600(gobj); + } +} void ftCo_Rebirth_IASA(Fighter_GObj* gobj) {} @@ -537,3 +546,26 @@ void fn_800D5A30(Fighter_GObj* gobj) ft_8008A2BC(gobj); } /// #ftCo_Rebirth_Cam + +typedef struct ftCoRebirthCamVars { + s32 x0; + f32 x4; + f32 x8; + f32 xC; +} ftCoRebirthCamVars; + +void ftCo_Rebirth_Cam(Fighter_GObj* gobj) +{ + Fighter* fp = GET_FIGHTER(gobj); + CmSubject* cam = fp->x890_cameraBox; + UnkFloat6_Camera cam_floats; + + ftCamera_80076018(fp->ft_data->x3C, &cam_floats, fp->x34_scale.y); + cam->x10.x = ((ftCoRebirthCamVars*) &fp->mv.co.common)->x4; + cam->x10.y = + ((ftCoRebirthCamVars*) &fp->mv.co.common)->x8 + cam_floats.x0.x; + cam->x10.z = 0.0f; + ftLib_800866DC(gobj, &cam->x1C); +} + +/// #ftCo_Rebirth_Cam diff --git a/src/melee/ft/ft_0D31.h b/src/melee/ft/ft_0D31.h index 956ed099db..1d72678bc2 100644 --- a/src/melee/ft/ft_0D31.h +++ b/src/melee/ft/ft_0D31.h @@ -39,7 +39,7 @@ /* 0D535C */ void ftCo_Rebirth_Phys(Fighter_GObj* gobj); /* 0D5470 */ void ftCo_Rebirth_Coll(Fighter_GObj* gobj); /* 0D55B4 */ void fn_800D55B4(Fighter_GObj* gobj); -/* 0D5600 */ UNK_RET ftCo_800D5600(UNK_PARAMS); +/* 0D5600 */ void ftCo_800D5600(Fighter_GObj* gobj); /* 0D56EC */ void ftCo_RebirthWait_Anim(Fighter_GObj* gobj); /* 0D575C */ void ftCo_RebirthWait_IASA(Fighter_GObj* gobj); /* 0D58F4 */ void ftCo_RebirthWait_Phys(Fighter_GObj* gobj); diff --git a/src/melee/ft/ftmaterial.c b/src/melee/ft/ftmaterial.c index 62a4a6b7bb..1536547c54 100644 --- a/src/melee/ft/ftmaterial.c +++ b/src/melee/ft/ftmaterial.c @@ -31,7 +31,8 @@ void ftMaterial_800BF260(void) { - hsdInitClassInfo(&ftMObj.parent, &hsdMObj.parent, (char*)&ftMObj + 0xDC, (char*)&ftCo_804D3C00, 0x50, 0x20); + hsdInitClassInfo(&ftMObj.parent, &hsdMObj.parent, (char*) &ftMObj + 0xDC, + (char*) &ftCo_804D3C00, 0x50, 0x20); ftMObj.setup = ftMaterial_800BF2B8; } diff --git a/src/melee/gm/gm_16F1.c b/src/melee/gm/gm_16F1.c index 3258fd43e4..7ab0b9ad3b 100644 --- a/src/melee/gm/gm_16F1.c +++ b/src/melee/gm/gm_16F1.c @@ -194,8 +194,6 @@ int fn_80171A88(void) return result; } -/// #fn_80171AD4 - bool fn_80171B00(int arg0) { if (lbl_8046DBC8.x2[arg0].x0 != 0) { diff --git a/src/melee/gm/gm_16F1.h b/src/melee/gm/gm_16F1.h index 9116283858..3e71f134e2 100644 --- a/src/melee/gm/gm_16F1.h +++ b/src/melee/gm/gm_16F1.h @@ -34,7 +34,7 @@ struct lbl_804D65A8_t; /* 1701B8 */ int fn_801701B8(void); /* 1701C0 */ UNK_RET fn_801701C0(UNK_PARAMS); /* 171A88 */ int fn_80171A88(void); -/* 171AD4 */ UNK_RET fn_80171AD4(UNK_PARAMS); +/* 171AD4 */ void fn_80171AD4(void); /* 171B00 */ bool fn_80171B00(int); /* 171B2C */ bool fn_80171B2C(int); /* 171B64 */ void fn_80171B64(struct lbl_804D65A8_t*); diff --git a/src/melee/gm/gm_18A5.c b/src/melee/gm/gm_18A5.c index 1010b63f5b..ca0a759ea2 100644 --- a/src/melee/gm/gm_18A5.c +++ b/src/melee/gm/gm_18A5.c @@ -300,11 +300,13 @@ int fn_8018F3D0(int arg0) int fn_8018F410(void) { int temp_r3; + u8* base; int* temp_r30; int* temp_r29; - temp_r30 = &lbl_803D9F0C.x8; - temp_r29 = &lbl_803D9F0C.x4; + base = (u8*) &lbl_803D9D20; + temp_r30 = (int*) &base[0x1F4]; + temp_r29 = (int*) &base[0x1F0]; do { temp_r3 = HSD_Randi(0x19); } while (lbl_803D9D20.x72[temp_r3] == 0 || lbl_803D9F0C.x0 == temp_r3 || diff --git a/src/melee/gr/grcastle.c b/src/melee/gr/grcastle.c index de4ace0f59..0a02edd774 100644 --- a/src/melee/gr/grcastle.c +++ b/src/melee/gr/grcastle.c @@ -93,7 +93,15 @@ bool grCastle_801CD8A0(Ground_GObj* gobj) /// #grCastle_801CD8A8 -/// #grCastle_801CD960 +void grCastle_801CD960(Ground_GObj* gobj) +{ + Ground* gp = GET_GROUND(gobj); + s32 i; + + for (i = 0; i < 12; i++) { + grLib_801C9B6C((u8*) gp + 0xE0 + i * 0x14); + } +} void grCastle_801CD9B4(Ground_GObj* gobj) { @@ -217,7 +225,21 @@ bool grCastle_801CE858(Ground_GObj* gobj) return false; } -/// #grCastle_801CE860 +void grCastle_801CE860(Ground_GObj* gobj) +{ + Ground* gp = GET_GROUND(gobj); + + if (gp->gv.castle.xC4 < 3) { + gp->gv.castle.xC8--; + if (gp->gv.castle.xC8 < 0) { + gp->gv.castle.xC4++; + grAnime_801C8138(gobj, gp->map_id, gp->gv.castle.xC4); + gp->gv.castle.xC8 = + *(s16*) ((u8*) grCs_804D6970 + gp->gv.castle.xC4 * 2 + 0x12C); + } + } + Camera_80030E44(1, 0); +} void grCastle_801CE8E4(Ground_GObj* gobj) {} @@ -264,8 +286,32 @@ void grCastle_801CF74C(Ground_GObj* gobj) {} /// #fn_801CFAFC +typedef struct grCastleRespawnParams { + u8 pad[4]; + s16 x4; +} grCastleRespawnParams; + +void fn_801CFAFC(HSD_GObj* item_gobj, Ground* gp, Vec3* pos, + HSD_GObj* fighter_gobj, f32 arg4) +{ + *(s16*) ((u8*) gp + 0xC4) = 4; + if (ftLib_80086960(fighter_gobj)) { + ftLib_80086A4C(fighter_gobj, + ((grCastleRespawnParams*) grCs_804D6970)->x4); + } +} + /// #fn_801CFB68 +void fn_801CFB68(HSD_GObj* item_gobj, Ground* gp, HSD_GObj* fighter_gobj) +{ + *(s16*) ((u8*) gp + 0xC4) = 4; + if (ftLib_80086960(fighter_gobj)) { + ftLib_80086A4C(fighter_gobj, + ((grCastleRespawnParams*) grCs_804D6970)->x4); + } +} + /// #grCastle_801CFBD4 /// #grCastle_801D0298 diff --git a/src/melee/gr/grcastle.h b/src/melee/gr/grcastle.h index 8b40461828..aae3c0d8d8 100644 --- a/src/melee/gr/grcastle.h +++ b/src/melee/gr/grcastle.h @@ -68,10 +68,10 @@ struct unkCastle { mpLib_GroundEnum, f32); /* 1CF7B0 */ void grCastle_801CF7B0(Ground_GObj*); /* 1CF868 */ UNK_RET grCastle_801CF868(UNK_PARAMS); -/* 1CFAFC */ UNK_RET fn_801CFAFC(UNK_PARAMS); -/* 1CFB68 */ UNK_RET fn_801CFB68(UNK_PARAMS); +/* 1CFAFC */ void fn_801CFAFC(HSD_GObj*, Ground*, Vec3*, HSD_GObj*, f32); +/* 1CFB68 */ void fn_801CFB68(HSD_GObj*, Ground*, HSD_GObj*); /* 1CFBD4 */ UNK_RET grCastle_801CFBD4(UNK_PARAMS); -/* 1D0298 */ UNK_RET grCastle_801D0298(UNK_PARAMS); +/* 1D0298 */ void grCastle_801D0298(void); /* 1D02B8 */ UNK_RET grCastle_801D02B8(UNK_PARAMS); /* 1D0520 */ void grCastle_801D0520(Ground_GObj*, int); /* 1D0550 */ void grCastle_801D0550(UNK_T, unkCastle*); diff --git a/src/melee/gr/grfourside.c b/src/melee/gr/grfourside.c index ab90abc89c..d69ba44fc4 100644 --- a/src/melee/gr/grfourside.c +++ b/src/melee/gr/grfourside.c @@ -196,7 +196,7 @@ void grFourside_801F2F34(Ground_GObj* gobj) } else { gp->gv.fourside.x8 = NULL; } - mpJointSetCb1(0, gp, grFourside_801F30A0); + mpJointSetCb1(0, (Ground*) gobj, grFourside_801F30A0); gp->x10_flags.b5 = 1; gp->x11_flags.b012 = 1; } @@ -460,11 +460,11 @@ void grFourside_801F3B70(Ground_GObj* gobj) Ground* gp = GET_GROUND(gobj); HSD_JObj* jobj = Ground_801C3FA4(gobj, 1); CmSubject* cam; - float fVar2; lb_8000B1CC(jobj, NULL, &local18); if (gp->gv.foursideUfo.xC != 0) { - fVar2 = Stage_GetCamBoundsTopOffset(); - if (local18.y <= fVar2 + grFs_804D69D8->ufo_cs_offs) { + if (local18.y <= + Stage_GetCamBoundsTopOffset() + grFs_804D69D8->ufo_cs_offs) + { if (gp->gv.foursideUfo.x3 == 0) { gp->gv.foursideUfo.x3 = 1; } diff --git a/src/melee/gr/grheal.c b/src/melee/gr/grheal.c index 2b44fd7978..48cece45ad 100644 --- a/src/melee/gr/grheal.c +++ b/src/melee/gr/grheal.c @@ -11,6 +11,7 @@ #include "baselib/gobjproc.h" #include "baselib/jobj.h" #include "dolphin/types.h" +#include "gm/gm_1832.h" #include "gr/forward.h" @@ -18,12 +19,19 @@ #include "gr/grdisplay.h" #include "gr/ground.h" #include "gr/grzakogenerator.h" +#include "gr/inlines.h" #include "gr/stage.h" #include "it/it_26B1.h" #include "it/types.h" #include "lb/lb_00B0.h" #include "lb/lb_00F9.h" +extern s16 grHeal_804D49D8[]; +struct yaku { + int x0; + int x4; +}; + void grHeal_8021EF38(bool arg0) {} void grHeal_8021EF3C(void) @@ -55,7 +63,9 @@ bool grHeal_8021EFE4(void) Ground_GObj* grHeal_8021EFEC(u32 idx) { HSD_GObj* gobj; - StageCallbacks* callbacks = &grHeal_803E8454[idx]; + StageCallbacks* callbacks = + (StageCallbacks*) ((u8*) grHeal_803E83B8 + 0x9C); + callbacks += idx; gobj = Ground_801C14D0(idx); @@ -84,7 +94,18 @@ Ground_GObj* grHeal_8021EFEC(u32 idx) return gobj; } -/// #grHeal_8021F0D8 +void grHeal_8021F0D8(Ground_GObj* gobj) +{ + s32 i; + Ground* gp = gobj->user_data; + + grAnime_801C8138(gobj, gp->map_id, 0); + for (i = 0; i < grHeal_804D6AF0->x0; i++) { + if (gm_80473A18.x90[i] != 0) { + grHeal_8021F79C(8, grHeal_804D49D8[i], i); + } + } +} bool grHeal_8021F170(Ground_GObj* gobj) { diff --git a/src/melee/gr/gricemt.c b/src/melee/gr/gricemt.c index 97eb7aa003..c3df736dc5 100644 --- a/src/melee/gr/gricemt.c +++ b/src/melee/gr/gricemt.c @@ -384,7 +384,6 @@ extern char grIm_804D4720; void grIceMt_801F72D4(Ground_GObj* arg0) { - Vec3 sp3C; u32 sp38; u32 sp34; u32 sp30; @@ -401,23 +400,19 @@ void grIceMt_801F72D4(Ground_GObj* arg0) grAnime_801C8138(arg0, gp->map_id, 0); jobj = Ground_801C3FA4(arg0, 0x12); if (jobj != 0) { - sp3C = grIm_803B8220[1]; - HSD_JObjSetTranslate(jobj, &sp3C); + HSD_JObjSetTranslate(jobj, &grIm_803B8220[1]); } jobj = Ground_801C3FA4(arg0, 0x13); if (jobj != 0) { - sp3C = grIm_803B8220[2]; - HSD_JObjSetTranslate(jobj, &sp3C); + HSD_JObjSetTranslate(jobj, &grIm_803B8220[2]); } jobj = Ground_801C3FA4(arg0, 0x14); if (jobj != 0) { - sp3C = grIm_803B8220[3]; - HSD_JObjSetTranslate(jobj, &sp3C); + HSD_JObjSetTranslate(jobj, &grIm_803B8220[3]); } jobj = Ground_801C3FA4(arg0, 0x15); if (jobj != 0) { - sp3C = grIm_803B8220[4]; - HSD_JObjSetTranslate(jobj, &sp3C); + HSD_JObjSetTranslate(jobj, &grIm_803B8220[4]); } Ground_801C39C0(); Ground_801C3BB4(); diff --git a/src/melee/gr/grkongo.c b/src/melee/gr/grkongo.c index 4dc53dfd55..0e2785bf02 100644 --- a/src/melee/gr/grkongo.c +++ b/src/melee/gr/grkongo.c @@ -453,10 +453,11 @@ void grKongo_801D577C(Ground_GObj* arg0) void grKongo_801D5FA4(Ground_GObj* arg) {} +/// #grKongo_801D5FA8 + void grKongo_801D5FA8(Ground_GObj* arg0) { - Ground* temp_r3 = arg0->user_data; - grAnime_801C8138(arg0, temp_r3->map_id, 0); + grAnime_801C8138(arg0, GET_GROUND(arg0)->map_id, 0); } bool grKongo_801D5FD4(Ground_GObj* arg) @@ -486,10 +487,11 @@ void grKongo_801D6030(Ground_GObj* arg) {} void grKongo_801D6034(Ground_GObj* arg) {} +/// #grKongo_801D6038 + void grKongo_801D6038(Ground_GObj* arg0) { - Ground* temp_r3 = arg0->user_data; - grAnime_801C8138(arg0, temp_r3->map_id, 0); + grAnime_801C8138(arg0, GET_GROUND(arg0)->map_id, 0); } bool grKongo_801D6064(Ground_GObj* arg) diff --git a/src/melee/gr/grmaterial.c b/src/melee/gr/grmaterial.c index 7cb7300de1..6568735501 100644 --- a/src/melee/gr/grmaterial.c +++ b/src/melee/gr/grmaterial.c @@ -25,7 +25,15 @@ grMaterial_801C8D44(int arg0, int arg1, Ground* arg2, Vec3* arg3, int arg4, /* 1C8E48 */ static bool grMaterial_801C8E48(HSD_GObj* gobj); /* 1C8E74 */ static void grMaterial_801C8E74(void); /* 1C8EF8 */ static void fn_801C8EF8(HSD_MObj* mobj, u32 rendermode); -/* 1C9490 */ void grMaterial_801C9490(HSD_JObj* jobj); +/* 1C9490 */ void grMaterial_801C9490(Ground_GObj* gobj, + ColorOverlay* overlay); + +struct grMaterial_801C9490_cmd { + u16 pad0 : 6; + u16 value : 8; + u16 pad1 : 2; +}; + /* 3E0A20 */ static HSD_MObjInfo grMaterial_803E0A20 = { 0 }; /* 4D456C */ static ItCmd grMaterial_804D456C[1]; @@ -247,12 +255,19 @@ void grMaterial_801C8E74(void) /// #grMaterial_801C92C0 -void grMaterial_801C9470(HSD_JObj* jobj) +void grMaterial_801C9470(Ground_GObj* gobj, ColorOverlay* overlay) { - grMaterial_801C9490(jobj); + grMaterial_801C9490(gobj, overlay); } -/// #grMaterial_801C9490 +void grMaterial_801C9490(Ground_GObj* gobj, ColorOverlay* overlay) +{ + Ground* gp = gobj->user_data; + u32 color = ((struct grMaterial_801C9490_cmd*) overlay->x8_ptr1)->value; + + gp->xC0 = color; + gp->x10_flags.b6 = true; +} void grMaterial_801C94D8(void* obj) { @@ -310,7 +325,28 @@ void grMaterial_801C95C4(HSD_GObj* gobj) gp->x10_flags.b4 = 1; } -/// #grMaterial_801C9604 +typedef struct grMaterial_801C9604_raw { + s32 x40; + s32 x44; + s32 x48; + s32 x4C; +} grMaterial_801C9604_raw; + +void grMaterial_801C9604(HSD_GObj* bg, int arg1, bool arg2) +{ + Ground* gp = bg->user_data; + grMaterial_801C9604_raw* raw = + (grMaterial_801C9604_raw*) ((u8*) gp + 0x40); + ColorOverlay* overlay = (ColorOverlay*) raw; + + raw->x44 = arg2; + raw->x48 = arg1; + raw->x40 = 0; + raw->x4C = 0; + overlay->x7C_color_enable = overlay->x7C_flag2 = false; + gp->x10_flags.b4 = false; + grMaterial_801C9698(bg); +} void fn_801C9664(Item_GObj* gobj, CommandInfo* cmd, int arg2) { @@ -318,4 +354,12 @@ void fn_801C9664(Item_GObj* gobj, CommandInfo* cmd, int arg2) grMaterial_804D456C[idx](gobj, cmd); } -/// #grMaterial_801C9698 +void grMaterial_801C9698(HSD_GObj* gobj) +{ + Ground* gp = gobj->user_data; + + if (lb_80014258(gobj, (ColorOverlay*) ((u8*) gp + 0x40), fn_801C9664) != 0) + { + gp->x10_flags.b4 = 1; + } +} diff --git a/src/melee/gr/grmaterial.h b/src/melee/gr/grmaterial.h index c9e9300039..21e3ca6b95 100644 --- a/src/melee/gr/grmaterial.h +++ b/src/melee/gr/grmaterial.h @@ -28,7 +28,10 @@ grMaterial_801C8CFC(int, int, Ground*, HSD_JObj*, /* 1C8E28 */ void grMaterial_801C8E28(HSD_GObj*); /* 1C8E68 */ void grMaterial_801C8E68(HSD_GObj*, GroundOrAir); /* 1C92C0 */ void grMaterial_801C92C0(HSD_JObj*); -/* 1C9470 */ void grMaterial_801C9470(HSD_JObj* jobj); +/* 1C9470 */ void grMaterial_801C9470(Ground_GObj* gobj, + ColorOverlay* overlay); +/* 1C9490 */ void grMaterial_801C9490(Ground_GObj* gobj, + ColorOverlay* overlay); /* 1C94D8 */ void grMaterial_801C94D8(UNK_T hsd_obj); /* 1C95C4 */ void grMaterial_801C95C4(HSD_GObj*); /* 1C9604 */ void grMaterial_801C9604(HSD_GObj* bg, int, bool); diff --git a/src/melee/gr/grmutecity.c b/src/melee/gr/grmutecity.c index edcbc6a8b6..49a0de7934 100644 --- a/src/melee/gr/grmutecity.c +++ b/src/melee/gr/grmutecity.c @@ -322,9 +322,16 @@ StageData grMc_803E33DC = { 3, }; -static struct { +struct grMuteCityLookupData { int x0; -}* grMc_804D69D0; + u8 pad_x4[4]; + DynamicsDesc* x8; + DynamicsDesc* xC; +}; + +struct grMuteCityLookupData* grMc_804D69D0; + +s32 grMc_804D69D4; static f32 light_ref_br = 40000.0f; static f32 light_ref_dist = 0.99f; @@ -686,6 +693,17 @@ void grMuteCity_801F2AB0(s32 arg0, HSD_JObj* arg1) /// #fn_801F2B58 -/// #grMuteCity_801F2BBC +DynamicsDesc* grMuteCity_801F2BBC(enum_t arg) +{ + if (grMc_804D69D4 == 1) { + if (arg == 0x31 || arg == 0x35) { + return grMc_804D69D0->x8; + } + if ((u32) (arg - 0x32) <= 2) { + return grMc_804D69D0->xC; + } + } + return NULL; +} /// #grMuteCity_801F2C10 diff --git a/src/melee/gr/gronett.c b/src/melee/gr/gronett.c index 5fceaa65c0..b02f89782f 100644 --- a/src/melee/gr/gronett.c +++ b/src/melee/gr/gronett.c @@ -28,7 +28,7 @@ #include #include -StageCallbacks grOt_803E27E0[2] = { +static StageCallbacks grOt_803E27E0[2] = { { NULL, NULL, NULL, NULL, NULL }, { NULL, NULL, NULL, NULL, NULL }, }; @@ -38,6 +38,9 @@ static struct grOnett_StageParam { /* 0x00 */ float awning_initial; /* 0x04 */ u8 pad04[0x1C]; /* 0x20 */ float awning_delta; + /* 0x24 */ u8 pad24[0x10]; + /* 0x34 */ float x34; + /* 0x38 */ float x38; }* grOt_804D69C0; void grOnett_801E3734(bool arg) {} @@ -165,7 +168,30 @@ void grOnett_801E3C60(Ground_GObj* gobj) void grOnett_801E3CE0(Ground_GObj* gobj) {} -/// #grOnett_801E3CE4 +typedef struct grOnett_801E3CE4_vars { + s16 xC4; + s16 xC6; + s32 xC8; + s32 xCC; +} grOnett_801E3CE4_vars; + +void grOnett_801E3CE4(Ground_GObj* gobj) +{ + Ground* gp = GET_GROUND(gobj); + u8 _[8]; + + Ground_801C2ED0(GET_JOBJ(gobj), gp->map_id); + grAnime_801C7FF8(gobj, 0, 7, 0, 0.0f, 0.0f); + ((grOnett_801E3CE4_vars*) &gp->gv.onett)->xC4 = -1; + ((grOnett_801E3CE4_vars*) &gp->gv.onett)->xC6 = 0; + ((grOnett_801E3CE4_vars*) &gp->gv.onett)->xC8 = 0; + ((grOnett_801E3CE4_vars*) &gp->gv.onett)->xCC = 0; + gp->x8_callback = NULL; + gp->xC_callback = NULL; + gp->x10_flags.b5 = true; + mpJointSetCb1(3, gp, (mpLib_Callback) grOnett_801E40E4); + mpJointSetCb1(4, gp, (mpLib_Callback) grOnett_801E40E4); +} bool grOnett_801E3D98(Ground_GObj* gobj) { diff --git a/src/melee/gr/grpura.c b/src/melee/gr/grpura.c index 29e8f9d5de..ee333e4542 100644 --- a/src/melee/gr/grpura.c +++ b/src/melee/gr/grpura.c @@ -99,8 +99,11 @@ const f32 grPu_804DBA7C = -30.0; void grPura_80211D00(void) { - Vec3 cam_offset; - f32 fVar1; + struct { + f32 x; + f32 y; + f32 z; + } cam_offset; grPu_804D6AA0 = Ground_801C49F8(); stage_info.unk8C.b4 = 0; @@ -112,15 +115,15 @@ void grPura_80211D00(void) // grAnime_801C8780(r3, 3, 0, 0.0f, 1.0f); Ground_801C39C0(); Ground_801C3BB4(); - Stage_UnkSetVec3TCam_Offset(&cam_offset); - fVar1 = Stage_GetCamBoundsTopOffset(); - Ground_801C3880(grPu_804DBA58 * (fVar1 - cam_offset.y)); - fVar1 = Stage_GetCamBoundsBottomOffset(); - Ground_801C3890(grPu_804DBA58 * (fVar1 - cam_offset.y)); - fVar1 = Stage_GetCamBoundsLeftOffset(); - Ground_801C38A0(grPu_804DBA58 * (fVar1 - cam_offset.x)); - fVar1 = Stage_GetCamBoundsRightOffset(); - Ground_801C38AC(grPu_804DBA58 * (fVar1 - cam_offset.x)); + Stage_UnkSetVec3TCam_Offset((Vec3*) &cam_offset); + Ground_801C3880(grPu_804DBA58 * + (Stage_GetCamBoundsTopOffset() - cam_offset.y)); + Ground_801C3890(grPu_804DBA58 * + (Stage_GetCamBoundsBottomOffset() - cam_offset.y)); + Ground_801C38A0(grPu_804DBA58 * + (Stage_GetCamBoundsLeftOffset() - cam_offset.x)); + Ground_801C38AC(grPu_804DBA58 * + (Stage_GetCamBoundsRightOffset() - cam_offset.x)); } void grPura_80211DD8(void) {} diff --git a/src/melee/gr/grpushon.c b/src/melee/gr/grpushon.c index e3c2dff81a..b82576208c 100644 --- a/src/melee/gr/grpushon.c +++ b/src/melee/gr/grpushon.c @@ -2,11 +2,11 @@ #include +#include "cm/camera.h" +#include "ft/ftlib.h" #include "gr/ground.h" #include "gr/grzakogenerator.h" #include "lb/types.h" -#include "cm/camera.h" -#include "ft/ftlib.h" #include @@ -80,7 +80,17 @@ bool grPushOn_80218670(Ground_GObj* arg) return false; } -/// #fn_80218678 +bool fn_80218678(void) +{ + HSD_GObj* gobj = Ground_801C2BA4(1); + + if (gobj != NULL && gobj->user_data != NULL) { + Ground* gp = gobj->user_data; + + return gp->x11_flags.b012 & 1; + } + return false; +} /// #grPushOn_802186C8 diff --git a/src/melee/gr/grpushon.h b/src/melee/gr/grpushon.h index 024f603a3f..f0faa0264a 100644 --- a/src/melee/gr/grpushon.h +++ b/src/melee/gr/grpushon.h @@ -19,7 +19,7 @@ /* 21859C */ void grPushOn_8021859C(Ground_GObj*); /* 2185A0 */ void grPushOn_802185A0(Ground_GObj*); /* 218670 */ bool grPushOn_80218670(Ground_GObj*); -/* 218678 */ UNK_RET fn_80218678(UNK_PARAMS); +/* 218678 */ bool fn_80218678(void); /* 2186C8 */ void grPushOn_802186C8(Ground_GObj*); /* 2187A4 */ void grPushOn_802187A4(Ground_GObj*); /* 2187A8 */ void grPushOn_802187A8(Ground_GObj*); diff --git a/src/melee/gr/grrcruise.c b/src/melee/gr/grrcruise.c index 4af3bd4627..f84c34fe7f 100644 --- a/src/melee/gr/grrcruise.c +++ b/src/melee/gr/grrcruise.c @@ -178,7 +178,7 @@ void grRCruise_80201918(Vec3* vec) if (gobj != NULL) { Ground* gp = gobj->user_data; if (gp != NULL) { - *vec = *(Vec3*)((u8*)gp + 0xE0); + *vec = *(Vec3*) ((u8*) gp + 0xE0); return; } } diff --git a/src/melee/gr/grzakogenerator.c b/src/melee/gr/grzakogenerator.c index 0f15173fa6..2bcf5f36c0 100644 --- a/src/melee/gr/grzakogenerator.c +++ b/src/melee/gr/grzakogenerator.c @@ -3,9 +3,19 @@ #include "grzakogenerator.static.h" #include "it/it_26B1.h" +#include "it/it_2725.h" +#include "it/item.h" +#include "it/types.h" #include #include +#include +#include + +HSD_GObjProc* HSD_GObjProc_8038FD54(HSD_GObj*, HSD_GObjEvent, u8); +void it_8027CE18(HSD_GObj*); +void lb_8000B1CC(void*, void*, void*); +void grLib_801C9874(void*); int grZakoGenerator_801CA394(void* arg0, int arg1, void* arg2, f32 arg3) { @@ -31,16 +41,263 @@ int grZakoGenerator_801CA394(void* arg0, int arg1, void* arg2, f32 arg3) return (int) result; } -/// #grZakoGenerator_801CA43C +int grZakoGenerator_801CA43C(struct ZakoConfig* config, void* arg1_ptr, + f32 arg1_f) +{ + int i; + int count = 0; + struct ConfigElement { + f32 x0, x4, x8, xC, x10, x14; + } *src, *dst; + + if (config == NULL || config->x4 == NULL) { + return 0; + } + + src = config->x0; + dst = config->x4; + for (i = 0; i < config->x8; i++) { + lb_8000B1CC(arg1_ptr, src, dst); + lb_8000B1CC(arg1_ptr, (u8*) src + 0xC, (u8*) dst + 0xC); + src++; + dst++; + } + + dst = config->x4; + for (i = 0; i < config->x8; i++) { + if ((dst->x4 > arg1_f && dst->x10 > arg1_f) || + (dst->x4 < arg1_f && dst->x10 < arg1_f)) + { + if (config->x10 > 0.0f) { + if (HSD_Randf() < config->x10) { + continue; + } + } + } else { + f32 diff = dst->x10 - dst->x4; + f32 results[3]; + if (diff < 0.0f) { + diff = -diff; + } + if (diff > 0.0001f) { + f32 t = (arg1_f - dst->x4) / (dst->x10 - dst->x4); + results[0] = t * (dst->xC - dst->x0) + dst->x0; + results[1] = arg1_f; + results[2] = t * (dst->x14 - dst->x8) + dst->x8; + } else { + f32 t = HSD_Randf(); + results[0] = t * (dst->xC - dst->x0) + dst->x0; + results[1] = arg1_f; + results[2] = t * (dst->x14 - dst->x8) + dst->x8; + } + ((void (*)(f32*, int)) config->xC)(results, i); + count++; + continue; + } + + if (config->x10 > 0.0f) { + if (config->x14 != 0) { + grLib_801C9874((void*) config->x14); + config->x14 = 0; + } + } + } + return count; +} + +void* grZakoGenerator_801CA67C(void) +{ + struct grZakoGenerator_Data* data; + int i; + + data = HSD_MemAlloc(0x3CC); + if (data == NULL) { + __assert("grzakogenerator.c", 82, "data"); + } + for (i = 0; i < 80; i++) { + data->entries[i].x0 = -1; + data->entries[i].x2 = 0; + data->entries[i].x4 = NULL; + } + data->x3C0 = -1; + data->x3C2 = 0; + data->x3C4 = NULL; + data->x3C8 = 0; + + lbl_8049F030.xA_b0 = 1; + lbl_8049F030.x8 = 0; + return data; +} + +HSD_GObj* Ground_801C58E0(void*, int, void*); +HSD_GObj* it_802EA9FC(void*, int); +HSD_GObj* it_802DD7F0(int, void*, int, int); +HSD_GObj* it_802E16F8(int, void*, int); +HSD_GObj* it_802DC4BC(int, void*, int); + +s32 grZakoGenerator_801CA8B4(int arg1) +{ + struct StageZakoEntry { + u8 x0, x1, x2, x3; + }* stage_entries; + struct grZakoGenerator_Data* data; + int i, j; + int idx; + int max_idx; + + if (!lbl_8049F030.xA_b0) { + return 0; + } + + data = lbl_8049F030.x4; + stage_entries = lbl_8049F030.x0; + idx = lbl_8049F030.x8; + max_idx = arg1 ? 81 : 80; + + for (j = 0; j < max_idx; j++) { + if (idx < 80) { + struct grZakoGenerator_Entry* element = &data->entries[idx]; + if (element->x4 == NULL) { + if (element->x2 > 0) { + element->x2--; + } else { + if (element->x0 == -1) { + if (arg1 == 1) { + element->x0 = idx; + } + } + if (element->x0 != -1) { + struct StageZakoEntry* entry = + &stage_entries[element->x0 - 0x20]; + u8 kind = entry->x0; + HSD_GObj* spawned = NULL; + Vec3 pos; -/// #grZakoGenerator_801CA67C + pos.x = 0; + pos.y = 0; + pos.z = 0; // Placeholder -/// #grZakoGenerator_801CA8B4 + if (kind >= 0xDC && kind <= 0xFB) { + if (element->x8 != -1) { + spawned = Ground_801C58E0(lbl_8049F030.x0, + element->x8, NULL); + } + } else { + switch (kind) { + case 0x2B: + spawned = + it_8027B5B0(0x2B, &pos, NULL, NULL, 1); + break; + case 0x2D: + spawned = + it_8027B5B0(0x2D, &pos, NULL, NULL, 1); + break; + case 0x2E: + spawned = + it_8027B5B0(0x2E, &pos, NULL, NULL, 1); + break; + case 0xD3: + spawned = it_802DD7F0(entry->x2, &pos, 0, -1); + break; + case 0xD5: + spawned = it_802DC4BC(entry->x2, &pos, -1); + break; + case 0xD9: + spawned = + it_8027B5B0(0xD9, &pos, NULL, NULL, 1); + break; + } + if (spawned == NULL && kind < 0x2F) { + spawned = it_802EA9FC(&pos, -1); + } + if (spawned == NULL) { + spawned = it_802E16F8(entry->x2, &pos, -1); + } + } + + if (spawned != NULL) { + element->x4 = spawned; + *(s32*) ((u8*) spawned->user_data + 0xDD8) = idx; + } + } + } + } + } else if (idx == 80 && arg1) { + if (data->x3C4 == NULL) { + if (data->x3C2 > 0) { + data->x3C2--; + } else { + if (data->x3C0 != -1) { + struct StageZakoEntry* entry = + &stage_entries[data->x3C0 - 0x20]; + u8 kind = entry->x0; + HSD_GObj* spawned = NULL; + Vec3 pos; + pos.x = 0; + pos.y = 0; + pos.z = 0; + + if (kind >= 0xDC && kind <= 0xFB) { + if (data->x3C8 != -1) { + spawned = Ground_801C58E0(lbl_8049F030.x0, + data->x3C8, NULL); + } + } else { + switch (kind) { + case 0x2B: + spawned = + it_8027B5B0(0x2B, &pos, NULL, NULL, 1); + break; + case 0x2D: + spawned = + it_8027B5B0(0x2D, &pos, NULL, NULL, 1); + break; + case 0x2E: + spawned = + it_8027B5B0(0x2E, &pos, NULL, NULL, 1); + break; + case 0xD3: + spawned = it_802DD7F0(entry->x2, &pos, 0, -1); + break; + case 0xD5: + spawned = it_802DC4BC(entry->x2, &pos, -1); + break; + case 0xD9: + spawned = + it_8027B5B0(0xD9, &pos, NULL, NULL, 1); + break; + } + if (spawned == NULL && kind < 0x2F) { + spawned = it_802EA9FC(&pos, -1); + } + if (spawned == NULL) { + spawned = it_802E16F8(entry->x2, &pos, -1); + } + } + if (spawned != NULL) { + data->x3C4 = spawned; + *(s32*) ((u8*) spawned->user_data + 0xDD8) = 80; + } + } + } + } + } + idx++; + if (idx >= 81) { + idx = 0; + } + if (idx == lbl_8049F030.x8) { + break; + } + } + lbl_8049F030.x8 = idx; + return 0; +} void grZakoGenerator_801CAC14(HSD_GObj* gobj) { void* ip = gobj->user_data; - s32 kind = itGetKind(gobj); + enum_t kind = itGetKind(gobj); if (kind == 0x9F) { struct grZakoGenerator_Data* data = lbl_8049F030.x4; @@ -50,15 +307,47 @@ void grZakoGenerator_801CAC14(HSD_GObj* gobj) } else { s32 idx = *(s32*) ((u8*) ip + 0xDD8); if (idx != -1) { - lbl_8049F030.x4->entries[idx].x4 = 0; + lbl_8049F030.x4->entries[idx].x4 = NULL; lbl_8049F030.x4->entries[idx].x2 = 2; } } } -/// #grZakoGenerator_801CACB8 +void grZakoGenerator_801CACB8(HSD_GObj* item_gobj) +{ + Item* item_data = item_gobj->user_data; + enum_t kind = itGetKind(item_gobj); + struct StageZakoEntry { + u8 x0, x1, x2, x3; + }* stage_entries; + + it_8027CE18(item_gobj); + + if (kind == 0x9F) { + struct grZakoGenerator_Data* data = lbl_8049F030.x4; + if (data->x3C4 == item_gobj) { + data->x3C0 = -1; + data->x3C4 = NULL; + } + } else { + s32 unk_idx = *(s32*) ((u8*) item_data + 0xDD8); + if (unk_idx != -1) { + struct grZakoGenerator_Data* data = lbl_8049F030.x4; + s16 x0; + data->entries[unk_idx].x4 = NULL; + x0 = data->entries[unk_idx].x0; + stage_entries = lbl_8049F030.x0; + if (stage_entries[x0 - 0x20].x3 == 1) { + data->entries[unk_idx].x2 = 0x708; + } else { + data->entries[unk_idx].x2 = -1; + } + *(s32*) ((u8*) item_data + 0xDD8) = -1; + } + } +} -s32 fn_801CADBC(void) +s32 fn_801CADBC(HSD_GObj* gobj) { return grZakoGenerator_801CA8B4(0); } @@ -68,7 +357,22 @@ s32 grZakoGenerator_801CADE0(void) return grZakoGenerator_801CA8B4(1); } -/// #grZakoGenerator_801CAE04 +HSD_GObj* grZakoGenerator_801CAE04(void* arg0) +{ + HSD_GObj* gobj; + struct grZakoGenerator_Data* data = + (struct grZakoGenerator_Data*) grZakoGenerator_801CA67C(); + gobj = GObj_Create(2, 4, 0); + if (gobj == NULL) { + OSReport("%s(%d): error: create gobj\n", "grzakogenerator.c", 358); + HSD_Free(data); + return NULL; + } + HSD_GObjProc_8038FD54(gobj, (HSD_GObjEvent) fn_801CADBC, 0); + lbl_8049F030.x0 = arg0; + lbl_8049F030.x4 = data; + return gobj; +} void grZakoGenerator_801CAEB0(int arg0, int arg1) { @@ -88,4 +392,23 @@ void grZakoGenerator_801CAEF0(bool arg0) lbl_8049F030.xA_b0 = arg0; } -/// #grZakoGenerator_801CAF08 +void grZakoGenerator_801CAF08(void) +{ + HSD_GObj* next; + HSD_GObj* item_gobj; + + for (item_gobj = HSD_GObj_Entities->items; item_gobj != NULL; + item_gobj = next) + { + enum_t kind; + next = item_gobj->next; + kind = itGetKind(item_gobj); + if ((kind >= 0x2b && kind < 0x30) || (kind >= 0xd0 && kind < 0xe8)) { + if (it_8026C1E8(item_gobj)) { + Item_8026A8EC(item_gobj); + } + } else if (kind == 0x9f) { + Item_8026A8EC(item_gobj); + } + } +} diff --git a/src/melee/gr/grzakogenerator.h b/src/melee/gr/grzakogenerator.h index e5b6b9cac7..a80e3ff5d1 100644 --- a/src/melee/gr/grzakogenerator.h +++ b/src/melee/gr/grzakogenerator.h @@ -5,17 +5,18 @@ #include "gr/types.h" -/* 1CA394 */ int grZakoGenerator_801CA394(UNK_T, int, UNK_T, f32); -/* 1CA43C */ UNK_RET grZakoGenerator_801CA43C(UNK_PARAMS); -/* 1CA67C */ UNK_RET grZakoGenerator_801CA67C(UNK_PARAMS); -/* 1CA8B4 */ long grZakoGenerator_801CA8B4(int); -/* 1CAC14 */ void grZakoGenerator_801CAC14(HSD_GObj* gobj); -/* 1CACB8 */ void grZakoGenerator_801CACB8(Ground_GObj* gobj); -/* 1CADBC */ s32 fn_801CADBC(void); +struct ZakoConfig; +/* 1CA394 */ int grZakoGenerator_801CA394(void*, int, void*, f32); +/* 1CA43C */ int grZakoGenerator_801CA43C(struct ZakoConfig*, void*, f32); +/* 1CA67C */ void* grZakoGenerator_801CA67C(void); +/* 1CA8B4 */ s32 grZakoGenerator_801CA8B4(int); +/* 1CAC14 */ void grZakoGenerator_801CAC14(HSD_GObj*); +/* 1CACB8 */ void grZakoGenerator_801CACB8(HSD_GObj*); +/* 1CADBC */ s32 fn_801CADBC(HSD_GObj* gobj); /* 1CADE0 */ s32 grZakoGenerator_801CADE0(void); -/* 1CAE04 */ void grZakoGenerator_801CAE04(UNK_T); +/* 1CAE04 */ HSD_GObj* grZakoGenerator_801CAE04(void*); /* 1CAEB0 */ void grZakoGenerator_801CAEB0(int, int); -/* 1CAEF0 */ UNK_RET grZakoGenerator_801CAEF0(bool); -/* 1CAF08 */ UNK_RET grZakoGenerator_801CAF08(UNK_PARAMS); +/* 1CAEF0 */ void grZakoGenerator_801CAEF0(bool); +/* 1CAF08 */ void grZakoGenerator_801CAF08(void); #endif diff --git a/src/melee/gr/grzakogenerator.static.h b/src/melee/gr/grzakogenerator.static.h index 4508a49637..91f826d2be 100644 --- a/src/melee/gr/grzakogenerator.static.h +++ b/src/melee/gr/grzakogenerator.static.h @@ -5,10 +5,20 @@ #include "baselib/forward.h" +struct ZakoConfig { + /* +0 */ void* x0; + /* +4 */ void* x4; + /* +8 */ s32 x8; + /* +C */ void* xC; + /* +10 */ f32 x10; + /* +14 */ s32 x14; + /* +18 */ s32 x18; +}; + struct grZakoGenerator_Entry { /* +0x0 */ s16 x0; /* +0x2 */ s16 x2; - /* +0x4 */ s32 x4; + /* +0x4 */ HSD_GObj* x4; /* +0x8 */ s32 x8; }; diff --git a/src/melee/gr/types.h b/src/melee/gr/types.h index 9d50e9d5d0..d85193ba6c 100644 --- a/src/melee/gr/types.h +++ b/src/melee/gr/types.h @@ -989,7 +989,8 @@ struct Ground { int x68; int x6C; int x70; - char pad_40[0xC4 - 0x74]; + char x74_pad[0xC0 - 0x74]; + f32 xC0; union { /// @todo This union is named 'u', from assert statements diff --git a/src/melee/if/soundtest.c b/src/melee/if/soundtest.c index b9bb558a42..9ca2316504 100644 --- a/src/melee/if/soundtest.c +++ b/src/melee/if/soundtest.c @@ -1,5 +1,7 @@ #include "soundtest.h" +#include "placeholder.h" + #include "gm/forward.h" #include "gm/gm_unsplit.h" @@ -12,7 +14,6 @@ #include "lb/lbcardnew.h" #include "lb/lblanguage.h" #include "lb/lbsnap.h" -#include "placeholder.h" #include "ty/toy.h" #include "ty/tylist.h" diff --git a/src/melee/it/itCommonItems.h b/src/melee/it/itCommonItems.h index 238eebbd04..06bd315ae4 100644 --- a/src/melee/it/itCommonItems.h +++ b/src/melee/it/itCommonItems.h @@ -495,7 +495,8 @@ typedef struct itTincle_ItemVars { /* +2C ip+E00 */ s32 x2C; /* +30 ip+E04 */ u8 pad1b[0x8]; /* +38 ip+E0C */ f32 x38; - /* +3C ip+E10 */ u8 pad1c[0x14]; + /* +3C ip+E10 */ u8 pad1c[0x10]; + /* +4C ip+E20 */ f32 x4C; /* +50 ip+E24 */ f32 x50; /* +54 ip+E28 */ f32 x54; /* +58 ip+E2C */ u8 pad2[0x4]; @@ -1210,6 +1211,7 @@ typedef struct itWhiteBea_ItemVars { /* +2C ip+E00 */ char pad_2C[0x10]; /* +3C ip+E10 */ s32 x3C; /* +40 ip+E14 */ s32 x40; + /* +44 ip+E18 */ s32 x44; } itWhiteBea_ItemVars; typedef struct itWhiteBeaAttributes { @@ -1323,9 +1325,10 @@ typedef struct itOctarockAttributes { typedef struct itOldottosea_ItemVars { /* 0x00 */ u8 pad[0x20]; - /* 0x20 */ s32 x20; - /* 0x24 */ u8 pad1[0x4]; + /* 0x20 */ HSD_GObj* x20; + /* 0x24 */ s32 x24; /* 0x28 */ s32 x28; + /* 0x2C */ s16 x2C; } itOldottosea_ItemVars; typedef struct itPatapata_ItemVars { @@ -1462,8 +1465,15 @@ typedef struct itCrazyHandBombAttributes { } itCrazyHandBombAttributes; typedef struct itLugia_ItemVars { - /* +00 ip+DD4 */ u8 x0_pad[0x7C]; + /* +00 ip+DD4 */ u8 x0_pad[0x60]; + /* +60 ip+E34 */ s32 x60; + /* +64 ip+E38 */ Vec3 x64; + /* +70 ip+E44 */ Vec3 x70; /* +7C ip+E50 */ Vec3 xE50; + /* +88 ip+E5C */ f32 x88; + /* +8C ip+E60 */ Vec3 x8C; + /* +98 ip+E6C */ u8 x98_pad[0xC]; + /* +A4 ip+E78 */ s32 xA4; } itLugia_ItemVars; typedef struct itGreatFoxLaser_ItemVars { diff --git a/src/melee/it/items/itclimbersice.c b/src/melee/it/items/itclimbersice.c index 3d67cda4da..7d5c53efb3 100644 --- a/src/melee/it/items/itclimbersice.c +++ b/src/melee/it/items/itclimbersice.c @@ -16,16 +16,57 @@ /* 2C23D4 */ static bool itClimbersBlizzard_UnkMotion0_Coll(Item_GObj* gobj); +typedef struct itClimbersiceSetupAttrs { + /* +00 */ f32 x0; + /* +04 */ u8 pad_4[0xC]; + /* +10 */ f32 x10; +} itClimbersiceSetupAttrs; + /// #it_802C1590 -/// #it_802C16F8 +void it_802C16F8(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itClimbersiceSetupAttrs* attrs = + ip->xC4_article_data->x4_specialAttributes; + HSD_JObj* child = NULL; + + ip->x40_vel.x = attrs->x10 * ip->facing_dir; + ip->x40_vel.z = 0.0f; + ip->x40_vel.y = 0.0f; + it_80275158(gobj, attrs->x0); + ip->xDCC_flag.b3 = true; + it_80272980(gobj); + if (gobj->hsd_obj != NULL) { + child = ((HSD_JObj*) gobj->hsd_obj)->child; + } + if (ip->kind == 0x6A) { + efAsync_Spawn(gobj, &ip->xBC0, 3, 0x4EA, child, &ip->pos); + } else { + efAsync_Spawn(gobj, &ip->xBC0, 3, 0x4AF, child, &ip->pos); + } + it_802C1AE4(gobj); +} void it_802C17DC(Item_GObj* gobj) { Item_8026A8EC(gobj); } -/// #it_2725_Logic90_Destroyed +void it_2725_Logic90_Destroyed(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + Item_GObj* owner = ip->xDD4_itemVar.climbersice.x0; + + if (owner != NULL) { + if (ip->kind == 0x6A) { + ftPp_Init_8011F16C(owner); + } else { + ftKb_SpecialNIc_80108CE8(owner); + } + } + ip->xDD4_itemVar.climbersice.x0 = NULL; +} /// #it_802C1854 @@ -109,9 +150,46 @@ bool itClimbersice_UnkMotion2_Anim(Item_GObj* gobj) return false; } -/// #itClimbersice_UnkMotion2_Phys +void itClimbersice_UnkMotion2_Phys(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + if (it_802C1854(gobj)) { + itClimbersBlizzardAttributes* attrs = + ip->xC4_article_data->x4_specialAttributes; + f32 speed = ip->x40_vel.x * attrs->x10; + + if (speed < 0.0f) { + speed = -speed; + } + it_80272460(&ip->x5D4_hitboxes[0].hit, (u32) speed + attrs->xC, gobj); + } +} + +bool itClimbersice_UnkMotion2_Coll(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); -/// #itClimbersice_UnkMotion2_Coll + it_8026D62C(gobj, fn_802C1D44); + it_80276CB8(gobj); + if (it_80276308(gobj) != 0) { + itClimbersBlizzardAttributes* attrs = + ip->xC4_article_data->x4_specialAttributes; + f32 speed = ip->x40_vel.x; + + if (speed < 0.0f) { + speed = -speed; + } + if (speed < attrs->xC) { + it_8027770C(gobj); + it_80272980(gobj); + ip->xD44_lifeTimer -= attrs->x4; + } else { + return true; + } + } + return false; +} void fn_802C1D44(Item_GObj* gobj) { @@ -138,9 +216,9 @@ bool itClimbersIce_Logic90_DmgDealt(Item_GObj* arg0) return true; } -bool itClimbersIce_Logic90_Reflected(Item_GObj* gobj) +void itClimbersIce_Logic90_Reflected(Item_GObj* gobj) { - return it_80273030(gobj); + it_80273030(gobj); } bool itClimbersIce_Logic90_Clanked(Item_GObj* arg0) @@ -148,16 +226,40 @@ bool itClimbersIce_Logic90_Clanked(Item_GObj* arg0) return true; } -/// #it_2725_Logic90_HitShield +bool it_2725_Logic90_HitShield(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + ItemAttr* item_attr = ip->xCC_item_attr; + itClimbersBlizzardAttributes* attrs = + ip->xC4_article_data->x4_specialAttributes; + f32 abs_vel_x = ip->x40_vel.x; + + if (abs_vel_x < 0.0f) { + abs_vel_x = -abs_vel_x; + } + if (abs_vel_x >= attrs->xC) { + itColl_BounceOffVictim(gobj); + it_80272980(gobj); + ip->x40_vel.x *= item_attr->x58; + ip->x40_vel.y *= item_attr->x58; + ip->x40_vel.z *= item_attr->x58; + ip->xD44_lifeTimer -= attrs->x4; + if (ip->xD44_lifeTimer < attrs->x8) { + return true; + } + return false; + } + return true; +} bool itClimbersIce_Logic90_Absorbed(Item_GObj* arg0) { return true; } -bool itClimbersIce_Logic90_ShieldBounced(Item_GObj* gobj) +void itClimbersIce_Logic90_ShieldBounced(Item_GObj* gobj) { - return itColl_BounceOffShield(gobj); + itColl_BounceOffShield(gobj); } void itClimbersIce_Logic90_EvtUnk(Item_GObj* gobj, Item_GObj* ref_gobj) diff --git a/src/melee/it/items/itclimbersice.h b/src/melee/it/items/itclimbersice.h index 574a869dd7..6bfae4918c 100644 --- a/src/melee/it/items/itclimbersice.h +++ b/src/melee/it/items/itclimbersice.h @@ -14,7 +14,7 @@ /* 2C16F8 */ void it_802C16F8(Item_GObj*); /* 2C17DC */ void it_802C17DC(Item_GObj*); /* 2C17FC */ void it_2725_Logic90_Destroyed(Item_GObj*); -/* 2C1854 */ UNK_RET it_802C1854(UNK_PARAMS); +/* 2C1854 */ bool it_802C1854(Item_GObj* gobj); /* 2C1950 */ void it_802C1950(Item_GObj*); /* 2C198C */ bool itClimbersice_UnkMotion0_Anim(Item_GObj* gobj); /* 2C1A14 */ void itClimbersice_UnkMotion0_Phys(Item_GObj* gobj); @@ -32,11 +32,11 @@ /* 2C1DB4 */ void itClimbersice_UnkMotion3_Phys(Item_GObj* gobj); /* 2C1E94 */ bool itClimbersice_UnkMotion3_Coll(Item_GObj* gobj); /* 2C1FC8 */ bool itClimbersIce_Logic90_DmgDealt(Item_GObj*); -/* 2C1FD0 */ bool itClimbersIce_Logic90_Reflected(Item_GObj*); +/* 2C1FD0 */ void itClimbersIce_Logic90_Reflected(Item_GObj*); /* 2C1FF0 */ bool itClimbersIce_Logic90_Clanked(Item_GObj*); /* 2C1FF8 */ bool it_2725_Logic90_HitShield(Item_GObj*); /* 2C20E4 */ bool itClimbersIce_Logic90_Absorbed(Item_GObj*); -/* 2C20EC */ bool itClimbersIce_Logic90_ShieldBounced(Item_GObj*); +/* 2C20EC */ void itClimbersIce_Logic90_ShieldBounced(Item_GObj*); /* 2C210C */ void itClimbersIce_Logic90_EvtUnk(Item_GObj*, Item_GObj*); /* 3F7668 */ extern ItemStateTable it_803F7668[]; diff --git a/src/melee/it/items/itclinkmilk.c b/src/melee/it/items/itclinkmilk.c index a707d8beed..a75242c339 100644 --- a/src/melee/it/items/itclinkmilk.c +++ b/src/melee/it/items/itclinkmilk.c @@ -3,13 +3,81 @@ #include #include +#include "it/inlines.h" #include "it/it_26B1.h" +#include "it/item.h" -/// #it_802C8B28 +typedef struct itClinkmilkVars { + /* +00 ip+DD4 */ HSD_GObj* x0; +} itClinkmilkVars; -/// #it_802C8C34 +typedef struct itClinkmilkLink { + /* +000 */ u8 pad_0[0x518]; + /* +518 */ HSD_GObj* x518; +} itClinkmilkLink; -/// #it_2725_Logic80_PickedUp +HSD_GObj* it_802C8B28(Item_GObj* parent_gobj, Vec3* pos, u32 kind, f32 facing) +{ + SpawnItem spawn; + Item_GObj* gobj; + u8 _[4]; + + if (parent_gobj != NULL) { + spawn.kind = 0x7B; + spawn.prev_pos = *pos; + spawn.prev_pos.z = it_804DD310; + spawn.pos = spawn.prev_pos; + spawn.facing_dir = facing; + spawn.x3C_damage = 0; + spawn.vel.z = it_804DD310; + spawn.vel.y = it_804DD310; + spawn.vel.x = it_804DD310; + spawn.x0_parent_gobj = parent_gobj; + spawn.x4_parent_gobj2 = spawn.x0_parent_gobj; + spawn.x44_flag.b0 = false; + spawn.x40 = 0; + gobj = Item_80268B18(&spawn); + if (gobj != NULL) { + Item* ip = GET_ITEM(gobj); + + ip->xDB8_itcmd_var3 = 0; + ip->xDB4_itcmd_var2 = 0; + ip->xDB0_itcmd_var1 = 0; + ip->xDAC_itcmd_var0 = 0; + ip->xDCC_flag.b3 = false; + ((itClinkmilkVars*) &ip->xDD4_itemVar)->x0 = parent_gobj; + Item_8026AB54(gobj, parent_gobj, kind); + } + } else { + gobj = NULL; + } + return gobj; +} + +void it_802C8C34(Item_GObj* gobj) +{ + if (gobj != NULL) { + Item* ip = GET_ITEM(gobj); + + if (ip != NULL) { + ((itClinkmilkVars*) &ip->xDD4_itemVar)->x0 = NULL; + ((itClinkmilkLink*) ip)->x518 = NULL; + Item_8026A8EC(gobj); + } + } +} + +void it_2725_Logic80_PickedUp(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + if (ip->facing_dir == -1.0f) { + Item_80268E5C(gobj, 0, ITEM_ANIM_UPDATE); + } else { + Item_80268E5C(gobj, 1, ITEM_ANIM_UPDATE); + } + Item_802694CC(gobj); +} /// #itClinkmilk_UnkMotion1_Anim diff --git a/src/melee/it/items/itclinkmilk.h b/src/melee/it/items/itclinkmilk.h index 2d29ed50fa..acbeb93444 100644 --- a/src/melee/it/items/itclinkmilk.h +++ b/src/melee/it/items/itclinkmilk.h @@ -14,6 +14,7 @@ /* 2C8F20 */ void itClinkmilk_UnkMotion1_Phys(Item_GObj* gobj); /* 2C8F24 */ bool itClinkmilk_UnkMotion1_Coll(Item_GObj* gobj); /* 2C8F2C */ void itCLinkMilk_Logic80_EvtUnk(Item_GObj*, Item_GObj*); +extern f32 it_804DD310; /* 3F7A28 */ extern ItemStateTable it_803F7A28[]; #endif diff --git a/src/melee/it/items/itflipper.c b/src/melee/it/items/itflipper.c index 6b39322934..3ec9ffecc5 100644 --- a/src/melee/it/items/itflipper.c +++ b/src/melee/it/items/itflipper.c @@ -159,9 +159,25 @@ void it_8029131C(Item_GObj* gobj) /// #it_80291344 -/// #itFlipper_UnkMotion5_Anim +bool itFlipper_UnkMotion5_Anim(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + if (ip->xDD4_itemVar.flipper.xDE4 != 0.0f) { + Item_80268E5C(gobj, 6, 0x12); + } + return it_80291344(gobj); +} -/// #itFlipper_UnkMotion6_Anim +bool itFlipper_UnkMotion6_Anim(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + if (ip->xDD4_itemVar.flipper.xDE4 == 0.0f) { + Item_80268E5C(gobj, 5, 0x12); + } + return it_80291344(gobj); +} void itFlipper_UnkMotion6_Phys(Item_GObj* gobj) { diff --git a/src/melee/it/items/itflipper.h b/src/melee/it/items/itflipper.h index ac43b26753..797973f630 100644 --- a/src/melee/it/items/itflipper.h +++ b/src/melee/it/items/itflipper.h @@ -31,7 +31,7 @@ /* 291188 */ bool itFlipper_UnkMotion3_Coll(Item_GObj* gobj); /* 291254 */ void it_80291254(Item_GObj*); /* 29131C */ void it_8029131C(Item_GObj* gobj); -/* 291344 */ UNK_RET it_80291344(UNK_PARAMS); +/* 291344 */ bool it_80291344(Item_GObj* gobj); /* 2914C8 */ bool itFlipper_UnkMotion5_Anim(Item_GObj* gobj); /* 29151C */ bool itFlipper_UnkMotion6_Anim(Item_GObj* gobj); /* 291570 */ void itFlipper_UnkMotion6_Phys(Item_GObj* gobj); diff --git a/src/melee/it/items/itgamewatchchef.c b/src/melee/it/items/itgamewatchchef.c index 1cc0a9cb0e..fa1658334f 100644 --- a/src/melee/it/items/itgamewatchchef.c +++ b/src/melee/it/items/itgamewatchchef.c @@ -44,11 +44,48 @@ void it_802C875C(Item_GObj* gobj) Item_80268E5C(gobj, 1, ITEM_ANIM_UPDATE); } -/// #itGamewatchchef_UnkMotion1_Anim +bool itGamewatchchef_UnkMotion1_Anim(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + ip->xD44_lifeTimer -= 1.0f; + if (ip->xD44_lifeTimer <= 0.0f) { + ip->xD44_lifeTimer = 0.0f; + return true; + } + if ((s32) ip->xD44_lifeTimer & 2) { + it_8026BB20(gobj); + } else { + it_8026BB44(gobj); + } + return false; +} void itGamewatchchef_UnkMotion1_Phys(Item_GObj* gobj) {} -/// #itGamewatchchef_UnkMotion1_Coll +bool itGamewatchchef_UnkMotion1_Coll(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itGamewatchchefAttributes* attrs = + ip->xC4_article_data->x4_specialAttributes; + itGamewatchchefAttrEntry* entry = + &attrs->entries[ip->xDD4_itemVar.gamewatchchef.x4]; + + if (ip->x40_vel.x != 0.0f) { + u32 flags = it_8026DAA8(gobj); + + if (flags & 0xC) { + ip->x40_vel.x *= -entry->x4; + } + if (flags & 3) { + ip->x40_vel.y = 0.0f; + ip->x40_vel.x = 0.0f; + it_80275158(gobj, attrs->xC); + Item_80268E5C(gobj, 1, ITEM_ANIM_UPDATE); + } + } + return false; +} bool it_2725_Logic112_Clanked(Item_GObj* gobj) { diff --git a/src/melee/it/items/ithitodeman.c b/src/melee/it/items/ithitodeman.c index 8253feadc7..81be27dc12 100644 --- a/src/melee/it/items/ithitodeman.c +++ b/src/melee/it/items/ithitodeman.c @@ -17,7 +17,7 @@ #include typedef struct { - UNK_T x0; + f32 x0; float x4; float x8; float xC; @@ -136,7 +136,17 @@ bool itHitodeman_UnkMotion2_Anim(Item_GObj* gobj) return false; } -/// #itHitodeman_UnkMotion2_Phys +void itHitodeman_UnkMotion2_Phys(Item_GObj* gobj) +{ + if (it_8027A09C(gobj) != 0) { + Item* ip = GET_ITEM(gobj); + + it_80273454(gobj); + Item_80268E5C(gobj, 0, 2); + ip->entered_hitlag = efLib_PauseAll; + ip->exited_hitlag = efLib_ResumeAll; + } +} bool itHitodeman_UnkMotion2_Coll(Item_GObj* gobj) { diff --git a/src/melee/it/items/ithouou.c b/src/melee/it/items/ithouou.c index f0814f2216..d7c234d409 100644 --- a/src/melee/it/items/ithouou.c +++ b/src/melee/it/items/ithouou.c @@ -163,7 +163,7 @@ void itHouou_UnkMotion4_Phys(Item_GObj* gobj) ip->xDD4_itemVar.pokemon.xE44 += attr->x1C; ip->x40_vel.y += ip->xDD4_itemVar.pokemon.xE44; - if (ip->pos.y < (*(f32*)((u8*)ip + 0xE3C)) - 1.0f) { + if (ip->pos.y < (*(f32*) ((u8*) ip + 0xE3C)) - 1.0f) { ip->x40_vel.y = 0.0f; } } diff --git a/src/melee/it/items/itkabigon.c b/src/melee/it/items/itkabigon.c index 2b5a236f5a..c7905f6241 100644 --- a/src/melee/it/items/itkabigon.c +++ b/src/melee/it/items/itkabigon.c @@ -52,7 +52,8 @@ void itKabigon_UnkMotion0_Phys(Item_GObj* gobj) if (ip->xDB0_itcmd_var1 == 0) { if (ip->ground_or_air == 1) { ItemAttr* attrs = ip->xCC_item_attr; - it_80272860(gobj, attrs->x10_fall_speed, attrs->x14_fall_speed_max); + it_80272860(gobj, attrs->x10_fall_speed, + attrs->x14_fall_speed_max); } } } diff --git a/src/melee/it/items/itkamex.c b/src/melee/it/items/itkamex.c index fb8701d735..c147b5fbf2 100644 --- a/src/melee/it/items/itkamex.c +++ b/src/melee/it/items/itkamex.c @@ -64,7 +64,37 @@ bool it_802CA654(Item_GObj* gobj) return false; } -/// #it_802CA6A0 +typedef struct itKamexState1Vars { + s32 xE34; + f32 xE38; + f32 xE3C; + f32 xE40; +} itKamexState1Vars; + +typedef struct itKamexState1Attrs { + f32 x0; + s32 x4; + u8 pad_8[0x10]; + f32 x18; + f32 x1C; +} itKamexState1Attrs; + +void it_802CA6A0(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itKamexState1Vars* vars = (itKamexState1Vars*) &ip->xDD4_itemVar; + itKamexState1Attrs* attrs = ip->xC4_article_data->x4_specialAttributes; + + if (vars->xE34 == -1) { + vars->xE34 = attrs->x4; + vars->xE3C = attrs->x18; + vars->xE40 = attrs->x1C; + } + Item_80268E5C(gobj, 1, 2); + ip->entered_hitlag = efLib_PauseAll; + ip->exited_hitlag = efLib_ResumeAll; + ip->on_accessory = it_802CA8DC; +} /// #itKamex_UnkMotion1_Anim diff --git a/src/melee/it/items/itkamex.h b/src/melee/it/items/itkamex.h index 834e5fd5bb..420549b82c 100644 --- a/src/melee/it/items/itkamex.h +++ b/src/melee/it/items/itkamex.h @@ -20,7 +20,7 @@ /* 2CA724 */ bool itKamex_UnkMotion1_Anim(Item_GObj* gobj); /* 2CA7FC */ void itKamex_UnkMotion1_Phys(Item_GObj* gobj); /* 2CA890 */ bool itKamex_UnkMotion1_Coll(Item_GObj* gobj); -/* 2CA8DC */ UNK_RET it_802CA8DC(UNK_PARAMS); +/* 2CA8DC */ void it_802CA8DC(Item_GObj* gobj); /* 2CA938 */ void it_802CA938(Item_GObj* gobj); /* 2CA984 */ bool itKamex_UnkMotion2_Anim(Item_GObj* gobj); /* 2CA9B8 */ void itKamex_UnkMotion2_Phys(Item_GObj* gobj); @@ -29,7 +29,7 @@ /* 2CAAA4 */ bool itKamex_UnkMotion3_Anim(Item_GObj* gobj); /* 2CAAC8 */ void itKamex_UnkMotion3_Phys(Item_GObj* gobj); /* 2CAAE8 */ bool itKamex_UnkMotion3_Coll(Item_GObj* gobj); -/* 2CAB10 */ UNK_RET it_802CAB10(UNK_PARAMS); +/* 2CAB10 */ void it_802CAB10(Item_GObj* gobj); /* 2CACD0 */ void it_2725_Logic31_Spawned(Item_GObj*); /* 2CADC0 */ bool itKamex_Logic31_HitShield(Item_GObj*); /* 2CADC8 */ bool itKamex_Logic31_DmgDealt(Item_GObj*); diff --git a/src/melee/it/items/itkirby_2F23.c b/src/melee/it/items/itkirby_2F23.c index 8b0be0eb97..3e1731e36d 100644 --- a/src/melee/it/items/itkirby_2F23.c +++ b/src/melee/it/items/itkirby_2F23.c @@ -47,7 +47,18 @@ bool itKirby_2F23_UnkMotion0_Coll(Item_GObj* gobj) /// #it_802F258C -/// #it_802F2810 +void it_802F2810(HSD_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + Item_80268E5C(gobj, 1, 0); + ip->on_accessory = it_802F289C; + it_8026BB44(gobj); + it_802756D0(gobj); + it_802762BC(ip); + it_80274ECC(gobj, true); + it_80273408(gobj); +} bool itKirby_2F23_UnkMotion1_Anim(Item_GObj* gobj) { diff --git a/src/melee/it/items/itkyasarin.c b/src/melee/it/items/itkyasarin.c index 3357128107..5e1c4cd148 100644 --- a/src/melee/it/items/itkyasarin.c +++ b/src/melee/it/items/itkyasarin.c @@ -7,6 +7,24 @@ #include "it/itCommonItems.h" #include "it/item.h" +typedef struct itKyasarinColAnimAttrs { + /* +00 */ s32* x0; + /* +04 */ f32 x4; + /* +08 */ f32 x8; + /* +0C */ f32 xC; + /* +10 */ f32 x10; + /* +14 */ f32 x14; + /* +18 */ f32 x18; + /* +1C */ f32 x1C; + /* +20 */ u8 pad_20[0x28 - 0x20]; + /* +28 */ f32 x28; + /* +2C */ f32 x2C; + /* +30 */ f32 x30; + /* +34 */ f32 x34; + /* +38 */ u8 pad_38[0x48 - 0x38]; + /* +48 */ s32 x48; +} itKyasarinColAnimAttrs; + void itKyasarin_Logic25_Destroyed(Item_GObj* gobj) { Item* ip = GET_ITEM(gobj); @@ -38,9 +56,36 @@ void it_802ECEB0(Item_GObj* gobj) Item_80268E5C(gobj, 0, ITEM_ANIM_UPDATE); } -/// #itKyasarin_UnkMotion0_Anim +bool itKyasarin_UnkMotion0_Anim(Item_GObj* gobj) +{ + Item* ip; + itKyasarinAttributes* attr; -/// #itKyasarin_UnkMotion0_Coll + if (!it_80272C6C(gobj)) { + ip = GET_ITEM(gobj); + attr = ip->xC4_article_data->x4_specialAttributes; + ip->x40_vel.x = attr->x4 * ip->facing_dir; + ip->x40_vel.z = 0.0F; + ip->x40_vel.y = 0.0F; + Item_80268E5C(gobj, 0, ITEM_ANIM_UPDATE); + } + return false; +} + +bool itKyasarin_UnkMotion0_Coll(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itKyasarinColAnimAttrs* attr = ip->xC4_article_data->x4_specialAttributes; + + if (ip->facing_dir == 0.0F) { + if (ip->pos.x >= attr->x2C) { + it_802ECFE0(gobj); + } + } else if (ip->pos.x <= attr->x28) { + it_802ECFE0(gobj); + } + return false; +} void it_802ECFE0(Item_GObj* gobj) { @@ -81,9 +126,41 @@ void it_802ED0D0(Item_GObj* gobj) Item_80268E5C(gobj, 2, ITEM_ANIM_UPDATE); } -/// #itKyasarin_UnkMotion2_Anim +bool itKyasarin_UnkMotion2_Anim(Item_GObj* gobj) +{ + Item* ip; + itKyasarinAttributes* attr; -/// #itKyasarin_UnkMotion2_Coll + if (!it_80272C6C(gobj)) { + ip = GET_ITEM(gobj); + attr = ip->xC4_article_data->x4_specialAttributes; + ip->x40_vel.x = -attr->x4 * ip->facing_dir; + ip->x40_vel.z = 0.0F; + ip->x40_vel.y = 0.0F; + Item_80268E5C(gobj, 2, ITEM_ANIM_UPDATE); + } + return false; +} + +bool itKyasarin_UnkMotion2_Coll(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itKyasarinColAnimAttrs* attr = ip->xC4_article_data->x4_specialAttributes; + u8 _[8]; + + if (ip->facing_dir == 0.0F) { + if (ip->pos.x <= attr->x34) { + Item_80268E5C(gobj, 3, ITEM_ANIM_UPDATE); + it_80273454(gobj); + ip->xDD4_itemVar.kyasarin.x24 = attr->xC; + } + } else if (ip->pos.x >= attr->x30) { + Item_80268E5C(gobj, 3, ITEM_ANIM_UPDATE); + it_80273454(gobj); + ip->xDD4_itemVar.kyasarin.x24 = attr->xC; + } + return false; +} void it_802ED25C(Item_GObj* gobj) { @@ -95,7 +172,21 @@ void it_802ED25C(Item_GObj* gobj) Item_80268E5C(gobj, 4, ITEM_ANIM_UPDATE); } -/// #itKyasarin_UnkMotion4_Anim +bool itKyasarin_UnkMotion4_Anim(Item_GObj* gobj) +{ + Item* ip; + itKyasarinAttributes* attr; + + if (!it_80272C6C(gobj)) { + ip = GET_ITEM(gobj); + attr = ip->xC4_article_data->x4_specialAttributes; + ip->x40_vel.x = attr->x4 * ip->facing_dir; + ip->x40_vel.z = 0.0F; + ip->x40_vel.y = 0.0F; + Item_80268E5C(gobj, 4, ITEM_ANIM_UPDATE); + } + return false; +} /// #itKyasarin_UnkMotion4_Coll diff --git a/src/melee/it/items/itlugia.c b/src/melee/it/items/itlugia.c index 36d57e6172..51553b47fa 100644 --- a/src/melee/it/items/itlugia.c +++ b/src/melee/it/items/itlugia.c @@ -9,6 +9,43 @@ #include "it/it_26B1.h" #include "it/it_2725.h" #include "it/item.h" +#include "lb/lb_00B0.h" + +#include + +typedef struct itLugiaMotionPhysAttrs { + /* +00 */ f32 x0; + /* +04 */ f32 x4; + /* +08 */ f32 x8; + /* +0C */ f32 xC; + /* +10 */ f32 x10; + /* +14 */ f32 x14; + /* +18 */ f32 x18; +} itLugiaMotionPhysAttrs; + +typedef struct itLugiaTransitionAttrs { + /* +00 */ f32 x0; + /* +04 */ f32 x4; + /* +08 */ u8 x8_pad[0x38]; + /* +40 */ f32 x40; +} itLugiaTransitionAttrs; + +static inline f32 it_802D1830_sqrt(f32 x) +{ + f64 half = 0.5; + + if (x > 0.0f) { + vf32 y; + f64 guess = __frsqrte(x); + + guess = half * guess * (3.0 - guess * guess * x); + guess = half * guess * (3.0 - guess * guess * x); + guess = half * guess * (3.0 - guess * guess * x); + y = x * guess; + return y; + } + return x; +} /// #it_2725_Logic17_Spawned @@ -112,14 +149,43 @@ bool itLugia_UnkMotion3_Anim(Item_GObj* gobj) return false; } -/// #itLugia_UnkMotion3_Phys +void itLugia_UnkMotion3_Phys(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itLugiaMotionPhysAttrs* attrs = ip->xC4_article_data->x4_specialAttributes; + s32 temp; + + it_8027A344(gobj); + temp = ip->xDD4_itemVar.lugia.x60; + ip->xDD4_itemVar.lugia.x60 = temp - 1; + if (temp != 0) { + ip->x40_vel.z = attrs->x10; + } else { + ip->x40_vel.z = 0.0f; + it_802D1830(gobj); + } +} bool itLugia_UnkMotion3_Coll(Item_GObj* gobj) { return false; } -/// #it_802D1830 +void it_802D1830(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itLugiaMotionPhysAttrs* attrs = ip->xC4_article_data->x4_specialAttributes; + f32 root; + + Item_80268E5C(gobj, 4, 2); + ip->entered_hitlag = efLib_PauseAll; + ip->exited_hitlag = efLib_ResumeAll; + root = attrs->x18 * attrs->x18 - + (it_804DD454 * attrs->x18) * + -(ip->pos.y - ip->xDD4_itemVar.lugia.x64.y); + root = it_802D1830_sqrt(root); + ip->xDD4_itemVar.lugia.xE50.x = -((-attrs->x18 + root) * it_804DD468); +} bool itLugia_UnkMotion4_Anim(Item_GObj* gobj) { @@ -144,14 +210,45 @@ bool itLugia_UnkMotion4_Anim(Item_GObj* gobj) return false; } -/// #itLugia_UnkMotion4_Phys +void itLugia_UnkMotion4_Phys(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itLugiaMotionPhysAttrs* attrs = ip->xC4_article_data->x4_specialAttributes; + + it_8027A344(gobj); + ip->xDD4_itemVar.lugia.xE50.x += attrs->x18; + ip->x40_vel.y = ip->xDD4_itemVar.lugia.xE50.x; + if (ip->x40_vel.y > 0.0f) { + ip->x40_vel.y = 0.0f; + it_802D1A44(gobj); + } +} bool itLugia_UnkMotion4_Coll(Item_GObj* gobj) { return false; } -/// #it_802D1A44 +void it_802D1A44(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itLugiaTransitionAttrs* attrs = ip->xC4_article_data->x4_specialAttributes; + Vec3 sp; + + Item_80268E5C(gobj, 5, 2); + ip->entered_hitlag = efLib_PauseAll; + ip->exited_hitlag = efLib_ResumeAll; + ip->xDD4_itemVar.lugia.xE50.y = it_804DD46C; + ip->xDD4_itemVar.lugia.xE50.z = it_804DD470; + ip->xDD4_itemVar.lugia.x88 = it_804DD474; + lb_8000B1CC(ip->xBBC_dynamicBoneTable->bones[25], NULL, &sp); + ip->xDD4_itemVar.lugia.x8C = ip->xDD4_itemVar.lugia.x64; + ip->xDD4_itemVar.lugia.x8C.y += attrs->x40; + ip->xDD4_itemVar.lugia.x70 = sp; + ip->xDD4_itemVar.lugia.xA4 = 0; + ip->on_accessory = (HSD_GObjEvent) it_802D1BBC; + ip->xDCC_flag.b3 = true; +} bool itLugia_UnkMotion5_Anim(Item_GObj* gobj) { @@ -198,7 +295,18 @@ bool it_802D1DB4(Item_GObj* gobj) return false; } -/// #it_802D1DD8 +void it_802D1DD8(Item_GObj* gobj) +{ + if (it_8027A09C(gobj) != 0) { + Item* ip = GET_ITEM(gobj); + + it_80273454(gobj); + Item_80268E5C(gobj, 1, ITEM_ANIM_UPDATE); + ip->entered_hitlag = efLib_PauseAll; + ip->exited_hitlag = efLib_ResumeAll; + ip->xDD1_flag.b6 = 1; + } +} bool it_802D1E64(Item_GObj* gobj) { @@ -234,7 +342,18 @@ void it_802D23D4(Item_GObj* gobj, Item_GObj* ref_gobj) it_8026B894(gobj, ref_gobj); } -/// #it_802D23F4 +void it_802D23F4(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itLugiaMotionPhysAttrs* attrs = ip->xC4_article_data->x4_specialAttributes; + + ip->xD44_lifeTimer = attrs->x0; + it_80274740(gobj); + Item_80268E5C(gobj, 0, ITEM_ANIM_UPDATE); + ip->entered_hitlag = efLib_PauseAll; + ip->exited_hitlag = efLib_ResumeAll; + it_8026B3A8(gobj); +} bool it_802D246C(Item_GObj* gobj) { diff --git a/src/melee/it/items/itlugia.h b/src/melee/it/items/itlugia.h index e9f37883a0..c5e0775f1b 100644 --- a/src/melee/it/items/itlugia.h +++ b/src/melee/it/items/itlugia.h @@ -21,11 +21,11 @@ /* 2D1720 */ bool itLugia_UnkMotion3_Anim(Item_GObj* gobj); /* 2D17B0 */ void itLugia_UnkMotion3_Phys(Item_GObj* gobj); /* 2D1828 */ bool itLugia_UnkMotion3_Coll(Item_GObj* gobj); -/* 2D1830 */ UNK_RET it_802D1830(UNK_PARAMS); +/* 2D1830 */ void it_802D1830(Item_GObj* gobj); /* 2D1930 */ bool itLugia_UnkMotion4_Anim(Item_GObj* gobj); /* 2D19C0 */ void itLugia_UnkMotion4_Phys(Item_GObj* gobj); /* 2D1A3C */ bool itLugia_UnkMotion4_Coll(Item_GObj* gobj); -/* 2D1A44 */ UNK_RET it_802D1A44(UNK_PARAMS); +/* 2D1A44 */ void it_802D1A44(Item_GObj* gobj); /* 2D1B30 */ bool itLugia_UnkMotion5_Anim(Item_GObj* gobj); /* 2D1B94 */ void itLugia_UnkMotion5_Phys(Item_GObj* gobj); /* 2D1BB4 */ bool itLugia_UnkMotion5_Coll(Item_GObj* gobj); @@ -49,5 +49,11 @@ /* 3F7F48 */ extern ItemStateTable it_803F7F48[]; extern f32 it_804DD490; +extern f32 it_804DD450; +extern f32 it_804DD454; +extern f32 it_804DD468; +extern f32 it_804DD46C; +extern f32 it_804DD470; +extern f32 it_804DD474; #endif diff --git a/src/melee/it/items/itmatadogas.c b/src/melee/it/items/itmatadogas.c index fe5bc9b3c0..f48d306978 100644 --- a/src/melee/it/items/itmatadogas.c +++ b/src/melee/it/items/itmatadogas.c @@ -4,6 +4,8 @@ #include #include "ef/eflib.h" +#include "ef/efsync.h" +#include "ft/ft_0C31.h" #include "it/inlines.h" #include "it/it_266F.h" #include "it/it_26B1.h" @@ -65,7 +67,7 @@ bool itMatadogas_UnkMotion1_Coll(Item_GObj* gobj) void it_802CB2B0(Item_GObj* gobj) { Item* ip = GET_ITEM(gobj); - PAD_STACK(8); + PAD_STACK(4); if (ip->xDAC_itcmd_var0 != 0) { itMatadogasAttributes* attrs = ip->xC4_article_data->x4_specialAttributes; @@ -104,16 +106,47 @@ bool itMatadogas_UnkMotion2_Coll(Item_GObj* gobj) /// #it_802CB4F0 -/// #it_2725_Logic32_Spawned +void it_2725_Logic32_Spawned(Item_GObj* gobj) +{ + HSD_JObj* jobj = gobj->hsd_obj; + f32 scale = 1.0f; + + PAD_STACK(4); + + efSync_Spawn(0x45B, gobj, jobj, &scale); + efSync_Spawn(0x45D, gobj, jobj, &scale); + it_802CB798(gobj); +} + +void it_2725_Logic33_Spawned(Item_GObj* gobj) +{ + HSD_JObj* jobj = gobj->hsd_obj; + f32 scale = 1.0f; + + PAD_STACK(4); -/// #it_2725_Logic33_Spawned + efSync_Spawn(0x45C, gobj, jobj, &scale); + efSync_Spawn(0x45E, gobj, jobj, &scale); + it_802CB798(gobj); +} void itMatadogas_Logic33_EvtUnk(Item_GObj* gobj, Item_GObj* ref_gobj) { it_8026B894(gobj, ref_gobj); } -/// #it_802CB798 +void it_802CB798(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itMatadogasAttributes* attrs = ip->xC4_article_data->x4_specialAttributes; + + ip->xD44_lifeTimer = attrs->x0; + it_80274740(gobj); + Item_80268E5C(gobj, 0, ITEM_ANIM_UPDATE); + ip->entered_hitlag = efLib_PauseAll; + ip->exited_hitlag = efLib_ResumeAll; + it_8026B3A8(gobj); +} bool it_802CB810(Item_GObj* gobj) { diff --git a/src/melee/it/items/itmatadogas.h b/src/melee/it/items/itmatadogas.h index 9dc68f3f9e..685add7279 100644 --- a/src/melee/it/items/itmatadogas.h +++ b/src/melee/it/items/itmatadogas.h @@ -23,7 +23,7 @@ /* 2CB690 */ void it_2725_Logic32_Spawned(Item_GObj*); /* 2CB704 */ void it_2725_Logic33_Spawned(Item_GObj*); /* 2CB778 */ void itMatadogas_Logic33_EvtUnk(Item_GObj*, Item_GObj*); -/* 2CB798 */ UNK_RET it_802CB798(UNK_PARAMS); +/* 2CB798 */ void it_802CB798(Item_GObj* gobj); /* 2CB810 */ bool it_802CB810(Item_GObj* gobj); /* 2CB844 */ void it_802CB844(Item_GObj* gobj); /* 2CB8A4 */ bool it_802CB8A4(Item_GObj* gobj); diff --git a/src/melee/it/items/itmewtwoshadowball.c b/src/melee/it/items/itmewtwoshadowball.c index 101a4a54a9..b5b2b6028b 100644 --- a/src/melee/it/items/itmewtwoshadowball.c +++ b/src/melee/it/items/itmewtwoshadowball.c @@ -38,7 +38,16 @@ bool it_802C4F50(Item_GObj* gobj, CollData* cd) /// #it_2725_Logic101_Destroyed -/// #it_802C573C +void it_802C573C(Item_GObj* gobj) +{ + if (gobj != NULL) { + Item* ip = GET_ITEM(gobj); + + efLib_DestroyAll(gobj); + ip->xDD4_itemVar.mewtwoshadowball.x28 = 0; + Item_8026A8EC(gobj); + } +} void it_2725_Logic101_PickedUp(Item_GObj* gobj) { diff --git a/src/melee/it/items/itoldkuri.c b/src/melee/it/items/itoldkuri.c index c71cc0f09b..7daee29979 100644 --- a/src/melee/it/items/itoldkuri.c +++ b/src/melee/it/items/itoldkuri.c @@ -23,16 +23,52 @@ void itOldKuri_Logic29_EvtUnk(Item_GObj* gobj, Item_GObj* ref_gobj) it_8026B894(gobj, ref_gobj); } -/// #it_802D73F0 +void it_802D73F0(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); -void it_802D747C(Item_GObj* gobj) {} + it_8027B730(gobj); + ip->facing_dir = it_8026B684(&ip->pos); + ip->xD5C = 0; + ip->xDC8_word.flags.x15 = 0; + it_8027542C(gobj); + it_80275270(gobj); + it_80274740(gobj); + ip->xDD4_itemVar.oldkuri.xDF8 = 0; + ip->xDD4_itemVar.oldkuri.xDF4 = 0.0f; + it_802D747C(gobj); +} + +void it_802D747C(Item_GObj* gobj) +{ + u8 _[8]; + + it_8027CAD8(gobj); + it_8027C0A8(gobj, 0.0f, 1.0f); + it_802756E0(gobj); + it_802D848C(gobj, 0, ITEM_ANIM_UPDATE); +} bool itOldkuri_UnkMotion0_Anim(Item_GObj* gobj) { return false; } -/// #itOldkuri_UnkMotion0_Phys +void itOldkuri_UnkMotion0_Phys(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + if (ip->xDD4_itemVar.oldkuri.xDF8 == 0) { + if (ip->facing_dir == 0.0f) { + it_802D775C(gobj); + } else { + it_802D758C(gobj); + } + } else { + ip->xDD4_itemVar.oldkuri.xDF8 -= 1; + } + it_8027C0A8(gobj, 0.0f, 1.0f); +} bool itOldkuri_UnkMotion0_Coll(Item_GObj* gobj) { @@ -68,9 +104,31 @@ bool itOldkuri_UnkMotion1_Anim(Item_GObj* gobj) return false; } -/// #itOldkuri_UnkMotion1_Phys +void itOldkuri_UnkMotion1_Phys(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + u8 _[8]; + + if (ip->xDD4_itemVar.oldkuri.xDFC != 0) { + if (it_802750E8(gobj, 2) != 0) { + it_802D775C(gobj); + } + } + it_8027C8D0(&ip->x40_vel, &ip->x378_itemColl.floor.normal, ip->facing_dir); + it_8027C0A8(gobj, 0.0f, 1.0f); +} + +bool itOldkuri_UnkMotion1_Coll(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + u8 _[8]; -/// #itOldkuri_UnkMotion1_Coll + it_8026D62C(gobj, it_802D7AF0); + if (it_80276308(gobj) == 4 && ip->xDD4_itemVar.oldkuri.xDFC != 0) { + it_802D775C(gobj); + } + return it_8027C794(gobj); +} void it_802D775C(Item_GObj* gobj) { @@ -85,11 +143,76 @@ void it_802D775C(Item_GObj* gobj) it_802D848C(gobj, 2, ITEM_ANIM_UPDATE); } -/// #itOldkuri_UnkMotion2_Anim +bool itOldkuri_UnkMotion2_Anim(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); -/// #itOldkuri_UnkMotion2_Phys + if (!it_80272C6C(gobj)) { + if (ip->facing_dir == 1.0f) { + ip->xDD4_itemVar.oldkuri.xDFC = 1; + it_802D848C(gobj, 2, 0x12); + } else { + Item* ip = GET_ITEM(gobj); + itOldkuriAttributes* attr = + ip->xC4_article_data->x4_specialAttributes; + + ip->xDD4_itemVar.oldkuri.xDF4 = + ip->facing_dir * ((f32*) attr->x0)[1]; + ip->x40_vel.x = ip->xDD4_itemVar.oldkuri.xDF4; + ip->x40_vel.z = 0.0f; + ip->x40_vel.y = 0.0f; + ip->facing_dir = -1.0f; + ip->xDD4_itemVar.oldkuri.xDFC = 0; + it_802D848C(gobj, 1, 2); + } + } + return false; +} -/// #itOldkuri_UnkMotion2_Coll +void itOldkuri_UnkMotion2_Phys(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + u8 _[8]; + + if (ip->xDD4_itemVar.oldkuri.xDFC != 0) { + if (it_802750E8(gobj, 2) != 0) { + Item* ip = GET_ITEM(gobj); + itOldkuriAttributes* attr = + ip->xC4_article_data->x4_specialAttributes; + ip->xDD4_itemVar.oldkuri.xDF4 = + ip->facing_dir * ((f32*) attr->x0)[1]; + ip->x40_vel.x = ip->xDD4_itemVar.oldkuri.xDF4; + ip->x40_vel.z = 0.0f; + ip->x40_vel.y = 0.0f; + ip->facing_dir = -1.0f; + ip->xDD4_itemVar.oldkuri.xDFC = 0; + it_802D848C(gobj, 1, ITEM_ANIM_UPDATE); + } + } + ip->x40_vel.x = ip->xDD4_itemVar.oldkuri.xDF4; + it_8027C8D0(&ip->x40_vel, &ip->x378_itemColl.floor.normal, ip->facing_dir); + it_8027C0A8(gobj, 0.0f, 1.0f); +} + +bool itOldkuri_UnkMotion2_Coll(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + u8 _[8]; + + it_8026D62C(gobj, it_802D7AF0); + if (it_80276308(gobj) == 8 && ip->xDD4_itemVar.oldkuri.xDFC != 0) { + Item* ip = GET_ITEM(gobj); + itOldkuriAttributes* attr = ip->xC4_article_data->x4_specialAttributes; + ip->xDD4_itemVar.oldkuri.xDF4 = ip->facing_dir * ((f32*) attr->x0)[1]; + ip->x40_vel.x = ip->xDD4_itemVar.oldkuri.xDF4; + ip->x40_vel.z = 0.0f; + ip->x40_vel.y = 0.0f; + ip->facing_dir = -1.0f; + ip->xDD4_itemVar.oldkuri.xDFC = 0; + it_802D848C(gobj, 1, ITEM_ANIM_UPDATE); + } + return it_8027C794(gobj); +} bool itOldkuri_UnkMotion3_Anim(Item_GObj* gobj) { @@ -211,7 +334,23 @@ bool itOldkuri_UnkMotion6_Coll(Item_GObj* gobj) return it_8027C824(gobj, NULL); } -/// #itOldkuri_UnkMotion9_Anim +bool itOldkuri_UnkMotion9_Anim(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + u8 _[8]; + + if (!it_80272C6C(gobj)) { + if (ip->ground_or_air == GA_Air) { + Item_80268E5C(gobj, 9, ITEM_ANIM_UPDATE); + } else { + it_8027CAD8(gobj); + it_8027C0A8(gobj, 0.0f, 1.0f); + it_802756E0(gobj); + it_802D848C(gobj, 0, ITEM_ANIM_UPDATE); + } + } + return false; +} void itOldkuri_UnkMotion9_Phys(Item_GObj* gobj) { diff --git a/src/melee/it/items/itoldottosea.c b/src/melee/it/items/itoldottosea.c index 5640271476..fb64a8e4a7 100644 --- a/src/melee/it/items/itoldottosea.c +++ b/src/melee/it/items/itoldottosea.c @@ -13,7 +13,48 @@ #include "lb/lblanguage.h" #include "mp/mpcoll.h" -/// #it_802E2470 +s32 gm_8016AE80(void); + +typedef struct itOldottoseaInitAttrs { + u8 pad[0x28]; + s8 x28; +} itOldottoseaInitAttrs; + +void it_802E2470(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itOldottoseaInitAttrs* attr = ip->xC4_article_data->x4_specialAttributes; + s32 facing; + u8 _[4]; + + it_8027B730(gobj); + ip->facing_dir = it_8026B684(&ip->pos); + it_8027C56C(gobj, ip->facing_dir); + if (ip->facing_dir == -1.0f) { + facing = -1; + } else { + facing = 1; + } + mpCollSetFacingDir(&ip->x378_itemColl, facing); + ip->xD5C = 0; + ip->xDCC_flag.b3 = false; + ip->xDC8_word.flags.x15 = 0; + it_8027542C(gobj); + it_80275270(gobj); + ip->xDC8_word.flags.x19 = true; + ip->xDD4_itemVar.oldottosea.x28 = 1; + ip->xDD4_itemVar.oldottosea.x20 = NULL; + if (gm_8016AE80() == -1) { + ip->xDD4_itemVar.oldottosea.x2C = 0; + } else { + if (it_8026D324(0x11) != 0 && HSD_Randi(attr->x28) == 0) { + ip->xDD4_itemVar.oldottosea.x2C = 1; + } else { + ip->xDD4_itemVar.oldottosea.x2C = 0; + } + } + it_802E269C(gobj); +} /// #it_2725_Logic8_DmgReceived @@ -25,6 +66,16 @@ void it_802E269C(Item_GObj* gobj) Item_80268E5C(gobj, 0, ITEM_ANIM_UPDATE); } +typedef struct itOldottoseaMotionAttrs { + /* +00 */ s32* x0; + /* +04 */ f32 x4; + /* +08 */ f32 x8; + /* +0C */ f32 xC; + /* +10 */ s8 x10; +} itOldottoseaMotionAttrs; + +/// #it_2725_Logic8_DmgReceived + bool itOldottosea_UnkMotion0_Anim(Item_GObj* gobj) { if (!it_80272C6C(gobj)) { @@ -51,7 +102,58 @@ bool itOldottosea_UnkMotion0_Coll(Item_GObj* gobj) /// #it_802E27B4 -/// #itOldottosea_UnkMotion2_Anim +bool itOldottosea_UnkMotion2_Anim(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itOldottoseaMotionAttrs* attr = ip->xC4_article_data->x4_specialAttributes; + s32 limit; + u8 _[0x10]; + + if (lbLang_IsSettingUS()) { + if (lbLang_IsSettingJP()) { + limit = 0x2A; + } else { + limit = 0x50; + } + if (ip->xDD4_itemVar.oldottosea.x24 >= limit) { + if (HSD_Randi(attr->x10) == 0) { + it_802E2E30(gobj); + } else { + ip->x40_vel.x = 0.0f; + ip->xDD4_itemVar.oldottosea.x28 = 0; + ip->xDD4_itemVar.oldottosea.x24 = 0; + if (!it_80272C6C(gobj)) { + if ((u32) ip->xDD4_itemVar.oldottosea.x20 != 0U) { + Item_80268E5C(gobj, 2, ITEM_ANIM_UPDATE); + } else { + Item_80268E5C(gobj, 1, ITEM_ANIM_UPDATE); + } + } + } + } + } else { + if (lbLang_IsSettingJP()) { + limit = 0x2A; + } else { + limit = 0x50; + } + if (ip->xDD4_itemVar.oldottosea.x24 >= limit) { + if (HSD_Randi(attr->x10) == 0) { + it_802E2E30(gobj); + } else { + ip->x40_vel.x = 0.0f; + ip->xDD4_itemVar.oldottosea.x28 = 0; + ip->xDD4_itemVar.oldottosea.x24 = 0; + if ((u32) ip->xDD4_itemVar.oldottosea.x20 != 0U) { + Item_80268E5C(gobj, 2, ITEM_ANIM_UPDATE); + } else { + Item_80268E5C(gobj, 1, 0x12); + } + } + } + } + return false; +} /// #itOldottosea_UnkMotion2_Phys @@ -143,9 +245,34 @@ void it_802E2DF4(Item_GObj* gobj) it_802E27B4(gobj); } -/// #it_802E2E30 +void it_802E2E30(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + ip->x40_vel.z = 0.0f; + ip->x40_vel.y = 0.0f; + ip->x40_vel.x = 0.0f; + ip->xDD4_itemVar.oldottosea.x24 = 0; + if ((u32) ip->xDD4_itemVar.oldottosea.x20 != 0U) { + Item_80268E5C(gobj, 7, ITEM_ANIM_UPDATE); + } else { + Item_80268E5C(gobj, 6, ITEM_ANIM_UPDATE); + } +} + +bool itOldottosea_UnkMotion7_Anim(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); -/// #itOldottosea_UnkMotion7_Anim + if (!it_80272C6C(gobj)) { + ip->xDD4_itemVar.oldottosea.x28 = 0; + ip = GET_ITEM(gobj); + it_8027CAD8(gobj); + it_8027C0A8(gobj, ip->facing_dir, 1.0f); + Item_80268E5C(gobj, 0, ITEM_ANIM_UPDATE); + } + return false; +} /// #itOldottosea_UnkMotion7_Phys diff --git a/src/melee/it/items/itoldottosea.h b/src/melee/it/items/itoldottosea.h index fcd019b082..ea44a8e42b 100644 --- a/src/melee/it/items/itoldottosea.h +++ b/src/melee/it/items/itoldottosea.h @@ -24,7 +24,7 @@ /* 2E2D68 */ void itOldottosea_UnkMotion5_Phys(Item_GObj* gobj); /* 2E2D90 */ bool itOldottosea_UnkMotion5_Coll(Item_GObj* gobj); /* 2E2DF4 */ void it_802E2DF4(Item_GObj*); -/* 2E2E30 */ UNK_RET it_802E2E30(UNK_PARAMS); +/* 2E2E30 */ void it_802E2E30(Item_GObj* gobj); /* 2E2E90 */ bool itOldottosea_UnkMotion7_Anim(Item_GObj* gobj); /* 2E2F08 */ void itOldottosea_UnkMotion7_Phys(Item_GObj* gobj); /* 2E3024 */ bool itOldottosea_UnkMotion7_Coll(Item_GObj* gobj); diff --git a/src/melee/it/items/itpatapata.c b/src/melee/it/items/itpatapata.c index 8cb041e1e5..6e17e93a36 100644 --- a/src/melee/it/items/itpatapata.c +++ b/src/melee/it/items/itpatapata.c @@ -10,8 +10,25 @@ #include "it/it_2725.h" #include "it/itCommonItems.h" #include "it/item.h" +#include "it/items/itnokonoko.h" #include "mp/mpcoll.h" +typedef struct itPatapataSpawnVars { + u8 pad[0x4]; + s32 x4; + u8 pad2[0x3C]; + s32 x40; +} itPatapataSpawnVars; + +typedef struct itNokonokoSpawnVars { + u8 pad[0x4]; + s32 x4; + u8 pad2[0x2C]; + f32 x34; + f32 x38; + s32 x3C; +} itNokonokoSpawnVars; + void it_802E05A0(Item_GObj* gobj) { Item* ip = GET_ITEM(gobj); @@ -87,9 +104,37 @@ bool itPatapata_UnkMotion2_Anim(Item_GObj* gobj) /// #itPatapata_UnkMotion3_Coll -/// #it_802E0D9C +void it_802E0D9C(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itPatapataAttributes* attrs = ip->xC4_article_data->x4_specialAttributes; -/// #itPatapata_UnkMotion3_Anim + if (ip->xDD4_itemVar.patapata.x40 == 0) { + ip->x40_vel.x = -ip->facing_dir * attrs->x0->x4; + } + it_802E1648(gobj, 3, 2); + ip->facing_dir = -ip->facing_dir; +} + +bool itPatapata_UnkMotion3_Anim(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + if (!it_80272C6C(gobj)) { + mpCollSetFacingDir(&ip->x378_itemColl, + ip->facing_dir == -1.0f ? -1 : 1); + it_8027C56C(gobj, ip->facing_dir); + if ((ip->x40_vel.x < 0.0f && ip->facing_dir == 1.0f) || + (ip->x40_vel.x > 0.0f && ip->facing_dir == -1.0f)) + { + ip->x40_vel.x *= -1.0f; + } + it_802E1648(gobj, 2, 2); + } + return false; +} + +/// #itPatapata_UnkMotion3_Phys bool it_2725_Logic4_DmgReceived(Item_GObj* gobj) { @@ -138,7 +183,20 @@ void it_2725_Logic4_Dropped(Item_GObj* gobj) Item_80268E5C(gobj, 7, ITEM_ANIM_UPDATE); } -/// #itPatapata_UnkMotion7_Anim +bool itPatapata_UnkMotion7_Anim(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + PAD_STACK(8); + + if (ip->xDD4_itemVar.patapata.x28 <= 0) { + it_8027CAD8(gobj); + it_802E1648(gobj, 1, 2); + } else { + ip->xDD4_itemVar.patapata.x28 -= 1; + } + return false; +} void itPatapata_UnkMotion7_Phys(Item_GObj* gobj) {} diff --git a/src/melee/it/items/itpatapata.h b/src/melee/it/items/itpatapata.h index 26564c85e8..0b4c7418c8 100644 --- a/src/melee/it/items/itpatapata.h +++ b/src/melee/it/items/itpatapata.h @@ -14,7 +14,7 @@ /* 2E0974 */ bool itPatapata_UnkMotion2_Anim(Item_GObj* gobj); /* 2E09BC */ void itPatapata_UnkMotion3_Phys(Item_GObj* gobj); /* 2E0B78 */ bool itPatapata_UnkMotion3_Coll(Item_GObj* gobj); -/* 2E0D9C */ UNK_RET it_802E0D9C(UNK_PARAMS); +/* 2E0D9C */ void it_802E0D9C(Item_GObj* gobj); /* 2E0E10 */ bool itPatapata_UnkMotion3_Anim(Item_GObj* gobj); /* 2E0EE0 */ bool it_2725_Logic4_DmgReceived(Item_GObj*); /* 2E0F1C */ bool it_802E0F1C(Item_GObj*); @@ -33,7 +33,7 @@ /* 2E13EC */ bool itPatapata_UnkMotion4_Anim(Item_GObj* gobj); /* 2E1498 */ void itPatapata_UnkMotion4_Phys(Item_GObj* gobj); /* 2E1578 */ bool itPatapata_UnkMotion4_Coll(Item_GObj* gobj); -/* 2E15B0 */ UNK_RET it_802E15B0(UNK_PARAMS); +/* 2E15B0 */ void it_802E15B0(Item_GObj* gobj); /* 2E1648 */ void it_802E1648(Item_GObj*, int, int); /* 2E1694 */ void it_802E1694(Item_GObj*); /* 2E16D8 */ void it_802E16D8(Item_GObj*, Item_GObj*); diff --git a/src/melee/it/items/itpikachuthunder.c b/src/melee/it/items/itpikachuthunder.c index 738d734ea3..7a618372c8 100644 --- a/src/melee/it/items/itpikachuthunder.c +++ b/src/melee/it/items/itpikachuthunder.c @@ -33,7 +33,20 @@ void it_802B1FE8(Item_GObj* gobj, Vec3* pos) pos->y += offset; } -/// #it_2725_Logic39_Destroyed +void it_2725_Logic39_Destroyed(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + if (ip->xDD4_itemVar.pikachuthunder.x0 == 0 && + ip->xDD4_itemVar.pikachuthunder.x38 != NULL) + { + if (ftPk_SpecialLw_CheckProperty( + ip->xDD4_itemVar.pikachuthunder.x38) == 0) + { + ftPk_SpecialLw_SetState_Unk0(ip->xDD4_itemVar.pikachuthunder.x38); + } + } +} void it_802B2080(Item_GObj* gobj) { @@ -70,7 +83,21 @@ bool itPikachuthunder_UnkMotion1_Anim(Item_GObj* gobj) /// #itPikachuthunder_UnkMotion1_Coll -/// #it_802B22B8 +s32 it_802B22B8(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + Item_80268E5C(gobj, 2, 0x11); + ip->xD44_lifeTimer = ip->xDD4_itemVar.pikachuthunder.x14; + ip->xDD4_itemVar.pikachuthunder.x4 = 1; + if (ip->xDD4_itemVar.pikachuthunder.x34 != NULL && + ip->xDD4_itemVar.pikachuthunder.x34->user_data != NULL) + { + Item* linked = ip->xDD4_itemVar.pikachuthunder.x34->user_data; + linked->xDD4_itemVar.pikachuthunder.x28 = ip->x40_vel; + linked->xDD4_itemVar.pikachuthunder.x4 = 1; + } +} /// #itPikachuthunder_UnkMotion2_Anim diff --git a/src/melee/it/items/itsamuschargeshot.c b/src/melee/it/items/itsamuschargeshot.c index e2a623dde8..4b31350d4e 100644 --- a/src/melee/it/items/itsamuschargeshot.c +++ b/src/melee/it/items/itsamuschargeshot.c @@ -218,7 +218,6 @@ bool itSamuschargeshot_UnkMotion8_Anim(Item_GObj* gobj) HSD_JObj* grandchild = itGetJObjGrandchild(gobj); scale.x = scale.y = scale.z = ip->xDD4_itemVar.samuschargeshot.xDE4; - HSD_JObjSetScale(grandchild, &scale); return it_80273130(gobj); } diff --git a/src/melee/it/items/itseakneedlethrown.c b/src/melee/it/items/itseakneedlethrown.c index 01d32ba338..f0e8d9bf0e 100644 --- a/src/melee/it/items/itseakneedlethrown.c +++ b/src/melee/it/items/itseakneedlethrown.c @@ -5,10 +5,31 @@ #include "it/inlines.h" #include "it/it_26B1.h" #include "it/it_2725.h" +#include "sysdolphin/baselib/jobj.h" + +typedef struct itSeakNeedleThrownAnimVars { + /* +00 */ f32 xDD4; + /* +04 */ f32 xDD8; + /* +08 */ f32 xDDC; + /* +0C */ f32 xDE0; + /* +10 */ Vec3 xDE4; + /* +1C */ f32 xDF0; +} itSeakNeedleThrownAnimVars; /// #it_802AFD8C -/// #it_802AFEA8 +Item_GObj* it_802AFEA8(Item_GObj* gobj, Fighter_GObj* owner_gobj, u32 mode) +{ + if (gobj != NULL && owner_gobj != NULL) { + if (mode == 0) { + return it_802AFF08(gobj, owner_gobj); + } + if (mode == 1) { + return it_802B00F4(gobj, owner_gobj); + } + } + return gobj; +} void itSeakNeedleThrown_Logic109_Destroyed(Item_GObj* gobj) { @@ -26,7 +47,24 @@ bool itSeakneedlethrown_UnkMotion0_Anim(Item_GObj* gobj) return it_80273130(gobj); } -/// #itSeakneedlethrown_UnkMotion1_Anim +bool itSeakneedlethrown_UnkMotion1_Anim(Item_GObj* gobj) +{ + HSD_JObj* owner_jobj = HSD_GObjGetHSDObj(gobj); + Item* ip = GET_ITEM(gobj); + itSeakNeedleThrownAnimVars* vars = + (itSeakNeedleThrownAnimVars*) &ip->xDD4_itemVar; + + if (owner_jobj != NULL) { + owner_jobj = owner_jobj->child; + } + vars->xDE4 = ip->pos; + HSD_ASSERT(0x405, owner_jobj != NULL); + owner_jobj->rotate.x += vars->xDD4; + if (!(owner_jobj->flags & JOBJ_MTX_DIRTY)) { + HSD_JObjSetMtxDirtySub(owner_jobj); + } + return it_80273130(gobj); +} /// #itSeakneedlethrown_UnkMotion2_Anim diff --git a/src/melee/it/items/itseakneedlethrown.h b/src/melee/it/items/itseakneedlethrown.h index d9597d28a6..5d4538720f 100644 --- a/src/melee/it/items/itseakneedlethrown.h +++ b/src/melee/it/items/itseakneedlethrown.h @@ -14,8 +14,8 @@ /* 2AFEA8 */ Item_GObj* it_802AFEA8(Item_GObj* gobj, Fighter_GObj* owner_gobj, u32); /* 2AFEF8 */ void itSeakNeedleThrown_Logic109_Destroyed(Item_GObj*); -/* 2AFF08 */ UNK_RET it_802AFF08(UNK_PARAMS); -/* 2B00F4 */ UNK_RET it_802B00F4(UNK_PARAMS); +/* 2AFF08 */ Item_GObj* it_802AFF08(Item_GObj*, Fighter_GObj*); +/* 2B00F4 */ Item_GObj* it_802B00F4(Item_GObj*, Fighter_GObj*); /* 2B0210 */ bool itSeakneedlethrown_UnkMotion0_Anim(Item_GObj* gobj); /* 2B024C */ bool itSeakneedlethrown_UnkMotion1_Anim(Item_GObj* gobj); /* 2B033C */ bool itSeakneedlethrown_UnkMotion2_Anim(Item_GObj* gobj); diff --git a/src/melee/it/items/itsscope.c b/src/melee/it/items/itsscope.c index ea4f89fccf..69885ff4af 100644 --- a/src/melee/it/items/itsscope.c +++ b/src/melee/it/items/itsscope.c @@ -11,6 +11,7 @@ #include "it/it_2725.h" #include "it/itCommonItems.h" #include "it/item.h" +#include "it/items/itsscopebeam.h" #define GET_ATTRS(ip) \ ((itSScopeAttributes*) (ip)->xC4_article_data->x4_specialAttributes) @@ -169,16 +170,16 @@ bool itSScope_Logic21_HitShield(Item_GObj* gobj) /// #itSScope_Logic21_Reflected -bool itSScope_Logic21_Reflected(Item_GObj* gobj) +void itSScope_Logic21_Reflected(Item_GObj* gobj) { - return it_80273030(gobj); + it_80273030(gobj); } /// #itSScope_Logic21_ShieldBounced -bool itSScope_Logic21_ShieldBounced(Item_GObj* gobj) +void itSScope_Logic21_ShieldBounced(Item_GObj* gobj) { - return itColl_BounceOffShield(gobj); + itColl_BounceOffShield(gobj); } void itSScope_Logic21_EnteredAir(Item_GObj* gobj) diff --git a/src/melee/it/items/itsscope.h b/src/melee/it/items/itsscope.h index 728e2165da..767ff8a8ad 100644 --- a/src/melee/it/items/itsscope.h +++ b/src/melee/it/items/itsscope.h @@ -35,8 +35,8 @@ /* 29222C */ bool itSScope_Logic21_DmgDealt(Item_GObj*); /* 292250 */ bool itSScope_Logic21_Clanked(Item_GObj*); /* 292274 */ bool itSScope_Logic21_HitShield(Item_GObj*); -/* 292298 */ bool itSScope_Logic21_Reflected(Item_GObj*); -/* 2922B8 */ bool itSScope_Logic21_ShieldBounced(Item_GObj*); +/* 292298 */ void itSScope_Logic21_Reflected(Item_GObj*); +/* 2922B8 */ void itSScope_Logic21_ShieldBounced(Item_GObj*); /* 2922D8 */ void itSScope_Logic21_EnteredAir(Item_GObj*); /* 292300 */ bool itSscope_UnkMotion4_Anim(Item_GObj* gobj); /* 292308 */ void itSscope_UnkMotion4_Phys(Item_GObj* gobj); diff --git a/src/melee/it/items/ittincle.c b/src/melee/it/items/ittincle.c index b904de9779..5b59ea6997 100644 --- a/src/melee/it/items/ittincle.c +++ b/src/melee/it/items/ittincle.c @@ -7,6 +7,8 @@ #include "it/itCommonItems.h" #include "it/item.h" +extern f32 it_804DD8C8; + /* 2EC870 */ static void it_802EC870(Item_GObj*, int); /// #it_802EB5C8 @@ -100,7 +102,19 @@ bool itTincle_UnkMotion3_Anim(Item_GObj* gobj) return false; } -/// #itTincle_UnkMotion3_Phys +void itTincle_UnkMotion3_Phys(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + if (ip->xDD4_itemVar.tincle.x20 == 0) { + ip->pos.y = ip->xDD4_itemVar.tincle.x4C; + ip->x40_vel.y = 0.0f; + it_802EBE5C(gobj); + } else { + ip->x40_vel.y += ip->xDD4_itemVar.tincle.x38; + ip->xDD4_itemVar.tincle.x20 -= 1; + } +} bool itTincle_UnkMotion3_Coll(Item_GObj* gobj) { @@ -178,11 +192,41 @@ void it_802EC1F4(Item_GObj* gobj) it_802EC9E8(gobj); } -/// #itTincle_UnkMotion7_Anim +bool itTincle_UnkMotion7_Anim(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + u8 _[8]; + + if (ip->xDD4_itemVar.tincle.x20 == 0) { + ip->xDD4_itemVar.tincle.x20 = -1; + if (ip->msid == 6) { + Item_80268E5C(gobj, 7, 1); + } + } else if (ip->xDD4_itemVar.tincle.x20 > 0) { + ip->xDD4_itemVar.tincle.x20 -= 1; + } + if (!it_80272C6C(gobj)) { + it_802EC35C(gobj); + } + return false; +} void itTincle_UnkMotion7_Phys(Item_GObj* gobj) {} -/// #itTincle_UnkMotion7_Coll +bool itTincle_UnkMotion7_Coll(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + if (ip->ground_or_air == GA_Air) { + it_8026E414(gobj, it_802EC3F4); + } else { + if (ip->xDD4_itemVar.tincle.x20 < 0) { + it_802EC3F4(gobj); + } + it_8026D6F4(gobj, it_802EC35C); + } + return false; +} void it_802EC35C(Item_GObj* gobj) { @@ -230,6 +274,8 @@ bool itTincle_UnkMotion9_Coll(Item_GObj* gobj) /// #it_802EC4D0 +/// #it_802EC4D0 + /// #itTincle_UnkMotion10_Anim bool itTincle_UnkMotion10_Anim(Item_GObj* gobj) diff --git a/src/melee/it/items/ittincle.h b/src/melee/it/items/ittincle.h index 8c053b3799..1897899992 100644 --- a/src/melee/it/items/ittincle.h +++ b/src/melee/it/items/ittincle.h @@ -26,7 +26,7 @@ /* 2EBDC8 */ bool itTincle_UnkMotion3_Anim(Item_GObj* gobj); /* 2EBDD0 */ void itTincle_UnkMotion3_Phys(Item_GObj* gobj); /* 2EBE30 */ bool itTincle_UnkMotion3_Coll(Item_GObj* gobj); -/* 2EBE5C */ UNK_RET it_802EBE5C(UNK_PARAMS); +/* 2EBE5C */ void it_802EBE5C(Item_GObj* gobj); /* 2EBF00 */ bool itTincle_UnkMotion4_Anim(Item_GObj* gobj); /* 2EBF08 */ void itTincle_UnkMotion4_Phys(Item_GObj* gobj); /* 2EBF80 */ bool itTincle_UnkMotion4_Coll(Item_GObj* gobj); diff --git a/src/melee/it/items/itwhitebea.c b/src/melee/it/items/itwhitebea.c index 8832528746..03134f7bf4 100644 --- a/src/melee/it/items/itwhitebea.c +++ b/src/melee/it/items/itwhitebea.c @@ -8,9 +8,27 @@ #include "it/item.h" #include "it/items/itfreeze.h" #include "it/types.h" +#include "mp/mplib.h" #include "sysdolphin/baselib/random.h" -/// #it_802E31F8 +void grIceMt_801FA6D8(void); + +typedef struct itWhiteBeaAnim7Attrs { + /* +00 */ u8 pad_0[0x10]; + /* +10 */ f32 x10; + /* +14 */ s16 x14; +} itWhiteBeaAnim7Attrs; + +void it_802E31F8(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + if ((u32) ip->xDD4_itemVar.whitebea.x20 != 0U) { + it_8028ECE0((HSD_GObj*) ip->xDD4_itemVar.whitebea.x20); + it_802E37A4(gobj); + } + Item_80268E5C(gobj, 8, ITEM_ANIM_UPDATE); +} bool itOldottosea_UnkMotion8_Anim(Item_GObj* gobj) { @@ -137,6 +155,31 @@ void it_802E37A4(Item_GObj* gobj) /// #it_802E37BC +void it_802E37BC(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + s32 facing; + + it_8027B730(gobj); + ip->facing_dir = it_8026B684(&ip->pos); + it_8027C56C(gobj, ip->facing_dir); + if (ip->facing_dir == -1.0f) { + facing = -1; + } else { + facing = 1; + } + mpCollSetFacingDir(&ip->x378_itemColl, facing); + ip->xD5C = 0; + ip->xDC8_word.flags.x15 = 0; + it_8027542C(gobj); + it_80275270(gobj); + it_80274740(gobj); + ip->xDC8_word.flags.x19 = 1; + ip->xDD4_itemVar.whitebea.x3C = 1; + ip->xDD4_itemVar.whitebea.x40 = 0; + it_802E3DA0(gobj); +} + bool it_802E3884(Item_GObj* gobj) { Item* ip = GET_ITEM(gobj); @@ -170,7 +213,8 @@ void fn_802E398C(Item_GObj* gobj) bool itWhitebea_UnkMotion0_Anim(Item_GObj* gobj) { - PAD_STACK(8); + u8 _[8]; + if (!it_80272C6C(gobj)) { Item_80268E5C(gobj, 0, ITEM_ANIM_UPDATE); } @@ -180,7 +224,7 @@ bool itWhitebea_UnkMotion0_Anim(Item_GObj* gobj) void itWhitebea_UnkMotion0_Phys(Item_GObj* gobj) { Item* ip = GET_ITEM(gobj); - PAD_STACK(8); + u8 _[8]; if (ip->xDD4_itemVar.whitebea.x40 == 0) { int rand = HSD_Randi(2); @@ -202,7 +246,29 @@ bool itWhitebea_UnkMotion0_Coll(Item_GObj* gobj) /// #it_802E3AC8 -/// #itWhitebea_UnkMotion1_Anim +bool itWhitebea_UnkMotion1_Anim(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + int line_arg; + int* line_info; + + PAD_STACK(8); + + if (!it_80272C6C(gobj)) { + Item_80268E5C(gobj, 1, 0x12); + } + if (ip->xDD4_itemVar.whitebea.x44 <= 0) { + line_info = mpLib_80056A1C(mpLineGetFlags(ip->xC30), &line_arg); + ip->xDD4_itemVar.whitebea.x44 = 0xE; + Item_8026AE84(ip, 0x13C, 0x7F, 0x40); + if (line_info[0] != -1) { + Item_8026AE84(ip, line_info[0], 0x7F, 0x40); + } + } else { + ip->xDD4_itemVar.whitebea.x44--; + } + return false; +} /// #itWhitebea_UnkMotion1_Phys @@ -219,7 +285,24 @@ bool itWhitebea_UnkMotion1_Coll(Item_GObj* gobj) return it_8027C794(gobj); } -/// #it_802E3DA0 +void it_802E3DA0(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itWhiteBeaAttributes* attr = ip->xC4_article_data->x4_specialAttributes; + + PAD_STACK(8); + + ip->xDD4_itemVar.whitebea.x40 = 0; + ip->x40_vel.x *= attr->x4; + if ((ip->facing_dir > 0.0f && ip->x70_nudge.x < 0.0f) || + (ip->facing_dir < 0.0f && ip->x70_nudge.x > 0.0f)) + { + ip->facing_dir = -ip->facing_dir; + mpCollSetFacingDir(&ip->x378_itemColl, + ip->facing_dir == -1.0f ? -1 : 1); + } + Item_80268E5C(gobj, 3, ITEM_ANIM_UPDATE); +} bool itWhitebea_UnkMotion3_Anim(Item_GObj* gobj) { @@ -286,6 +369,28 @@ void it_802E4190(Item_GObj* gobj) Item_80268E5C(gobj, 2, ITEM_ANIM_UPDATE); } +void it_802E3ED0(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + u8 _[8]; + + it_802762BC(ip); + if (it_8027B798(gobj, &ip->x40_vel) != 0) { + if (ip->x40_vel.y <= 0.2) { + ip->x40_vel.y = 0.2f; + } else { + ip->x40_vel.y *= 0.2f; + } + it_802762BC(ip); + } else { + it_802762B0(ip); + ip->x40_vel.x *= 0.2f; + } + ip->facing_dir = ip->init_facing_dir; + mpCollSetFacingDir(&ip->x378_itemColl, ip->facing_dir == -1.0f ? -1 : 1); + Item_80268E5C(gobj, 4, 3); +} + /// #itWhitebea_UnkMotion2_Anim void itWhitebea_UnkMotion2_Phys(Item_GObj* gobj) {} @@ -323,7 +428,18 @@ bool itWhitebea_UnkMotion5_Coll(Item_GObj* gobj) return it_8027C794(gobj); } -/// #it_802E4464 +void it_802E4464(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itWhiteBeaAnim7Attrs* attr = ip->xC4_article_data->x4_specialAttributes; + u8 _[8]; + + it_802762BC(ip); + ip->x40_vel.y = attr->x10; + it_80275258(gobj); + Item_8026AE84(ip, 0x4A, 0x7F, 0x40); + Item_80268E5C(gobj, 6, ITEM_ANIM_UPDATE); +} bool itWhitebea_UnkMotion6_Anim(Item_GObj* gobj) { @@ -344,9 +460,31 @@ bool itWhitebea_UnkMotion6_Coll(Item_GObj* gobj) return it_8027C794(gobj); } -/// #it_802E4558 +void it_802E4558(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + + it_802762B0(ip); + Item_8026AE84(ip, 0x46, 0x7F, 0x40); + Item_8026AE84(ip, 0x13C, 0x7F, 0x40); + Item_80268E5C(gobj, 7, ITEM_ANIM_UPDATE); + grIceMt_801FA6D8(); +} -/// #itWhitebea_UnkMotion7_Anim +bool itWhitebea_UnkMotion7_Anim(Item_GObj* gobj) +{ + Item* ip = GET_ITEM(gobj); + itWhiteBeaAnim7Attrs* attr = ip->xC4_article_data->x4_specialAttributes; + u8 _[0x10]; + + if (!it_80272C6C(gobj)) { + ip->xDD4_itemVar.whitebea.x3C = 1; + ip->xDD4_itemVar.whitebea.x40 = attr->x14; + it_8027CAD8(gobj); + Item_80268E5C(gobj, 0, ITEM_ANIM_UPDATE); + } + return false; +} void itWhitebea_UnkMotion7_Phys(Item_GObj* gobj) {} diff --git a/src/melee/it/items/ityoshieggthrow.c b/src/melee/it/items/ityoshieggthrow.c index d64ad30779..7dad500890 100644 --- a/src/melee/it/items/ityoshieggthrow.c +++ b/src/melee/it/items/ityoshieggthrow.c @@ -30,12 +30,12 @@ void it_802B2B08(Item_GObj* item_gobj) bool itYoshieggthrow_UnkMotion1_Anim(Item_GObj* gobj) { Item* ip = GET_ITEM(gobj); - f32* base = (f32*)ip; + f32* base = (f32*) ip; - if (base[0xD44/4] <= 0.0f) { + if (base[0xD44 / 4] <= 0.0f) { it_802B2C38(gobj); } else { - base[0xD44/4] -= 1.0f; + base[0xD44 / 4] -= 1.0f; } return false; diff --git a/src/melee/lb/lbrefract.c b/src/melee/lb/lbrefract.c index 2e5084b81c..12caef8205 100644 --- a/src/melee/lb/lbrefract.c +++ b/src/melee/lb/lbrefract.c @@ -25,7 +25,9 @@ extern HSD_DObjInfo hsdDObj; lbRefract_WriteTexCoordIA4(lbRefract_CallbackData* data, s32 row, u32 col, u32 arg3, u8 arg4, u8 intensity, u8 alpha); /* 021F70 */ static UNK_RET fn_80021F70(UNK_PARAMS); -/* 021FB4 */ static void fn_80021FB4(lbRefract_CallbackData* data, s32 row, u32 col, u8 arg3, u8 arg4, u8 arg5, u8 arg6); +/* 021FB4 */ static void fn_80021FB4(lbRefract_CallbackData* data, s32 row, + u32 col, u8 arg3, u8 arg4, u8 arg5, + u8 arg6); /* 021FF8 */ static UNK_RET fn_80021FF8(UNK_PARAMS); /* 02206C */ static UNK_RET fn_8002206C(UNK_PARAMS); /// @brief Display DObj then reset TEV/indirect stages for refraction cleanup. @@ -72,12 +74,14 @@ static void lbRefract_WriteTexCoordIA4(lbRefract_CallbackData* data, s32 row, base[1] = intensity; } -static void fn_80021FB4(lbRefract_CallbackData* data, s32 row, u32 col, u8 arg6, u8 arg7, u8 arg8, u8 arg9) +static void fn_80021FB4(lbRefract_CallbackData* data, s32 row, u32 col, + u8 arg6, u8 arg7, u8 arg8, u8 arg9) { u8* base; s32 offset; - base = (u8*) data->buffer + ((col >> 2) * data->row_stride) + ((row << 4) & 0xFFFFFFC0); + base = (u8*) data->buffer + ((col >> 2) * data->row_stride) + + ((row << 4) & 0xFFFFFFC0); row &= 3; offset = (row + ((col << 2) & 0xC)) * 2; base[offset] = arg9; @@ -99,16 +103,16 @@ static void lbRefract_ReadTexCoordRGBA8(lbRefract_CallbackData* data, s32 row, offset = ((row & 3) + ((col & 3) << 2)) << 1; if (out_a != NULL) { - *(u32*)out_a = base[offset]; + *(u32*) out_a = base[offset]; } if (out_r != NULL) { - *(u32*)out_r = (base + offset)[1]; + *(u32*) out_r = (base + offset)[1]; } if (out_g != NULL) { - *(u32*)out_g = (base + offset)[0x20]; + *(u32*) out_g = (base + offset)[0x20]; } if (out_b != NULL) { - *(u32*)out_b = (base + offset)[0x21]; + *(u32*) out_b = (base + offset)[0x21]; } } diff --git a/src/melee/mn/mngallery.c b/src/melee/mn/mngallery.c index 0a5dbc201a..912b6b3350 100644 --- a/src/melee/mn/mngallery.c +++ b/src/melee/mn/mngallery.c @@ -1,14 +1,15 @@ #include "mngallery.h" -#include #include +#include + #include #include #include #include -#include -#include #include +#include +#include static void* mnGallery_804D6C8C; diff --git a/src/melee/mn/mnname.c b/src/melee/mn/mnname.c index 850a92c321..692ee29e96 100644 --- a/src/melee/mn/mnname.c +++ b/src/melee/mn/mnname.c @@ -55,7 +55,9 @@ void fn_802377A4(void) {} bool IsNameValid(int slot) { - if (mnName_StringTerminator == (s8) GetPersistentNameData((u8) slot)->namedata[0]) { + if (mnName_StringTerminator == + (s8) GetPersistentNameData((u8) slot)->namedata[0]) + { return false; } return true;