Dive Slide

From Ukikipedia
Revision as of 23:09, 18 February 2023 by Icecream17 (talk | contribs) (Attempt to summarize code but give up)
Jump to navigation Jump to search
Not to be confused with: Dive, Dive Picking Up
Dive Slide
Properties
Hex 0x00880456
Action Flags Moving, Diving, Attacking
Action Group Moving
ID 0x56
  1. If not(m->input & INPUT_ABOVE_SLIDE) and A or B is pressed:
    1. If mario's forwardVel > 0, Forward Rollout, else, Backward Rollout.
  2. Update sliding.
  3. If Mario's new floor is not a slope, and Mario's forward velocity squared < 64, and the animation is at an end, Stomach Slide Stop.
  4. Object grab ????
  5. Common slide action ????
s32 act_dive_slide(struct MarioState *m) {
    if (!(m->input & INPUT_ABOVE_SLIDE) && (m->input & (INPUT_A_PRESSED | INPUT_B_PRESSED))) {
#if ENABLE_RUMBLE
        queue_rumble_data(5, 80);
#endif
        return set_mario_action(m, m->forwardVel > 0.0f ? ACT_FORWARD_ROLLOUT : ACT_BACKWARD_ROLLOUT,
                                0);
    }

    play_mario_landing_sound_once(m, SOUND_ACTION_TERRAIN_BODY_HIT_GROUND);

    //! If the dive slide ends on the same frame that we pick up on object,
    // Mario will not be in the dive slide action for the call to
    // mario_check_object_grab, and so will end up in the regular picking action,
    // rather than the picking up after dive action.

    if (update_sliding(m, 8.0f) && is_anim_at_end(m)) {
        mario_set_forward_vel(m, 0.0f);
        set_mario_action(m, ACT_STOMACH_SLIDE_STOP, 0);
    }

    if (mario_check_object_grab(m)) {
        mario_grab_used_object(m);
        m->marioBodyState->grabPos = GRAB_POS_LIGHT_OBJ;
        return TRUE;
    }

    common_slide_action(m, ACT_STOMACH_SLIDE_STOP, ACT_FREEFALL, MARIO_ANIM_DIVE);
    return FALSE;
}