Prevent crashes when executing an unimplemented action

This commit is contained in:
MysterD 2022-04-15 18:36:45 -07:00
parent fbce5f23c6
commit c996f7b481
7 changed files with 28 additions and 7 deletions

View file

@ -2239,7 +2239,10 @@ s32 mario_execute_airborne_action(struct MarioState *m) {
case ACT_RIDING_HOOT: cancel = act_riding_hoot(m); break;
case ACT_TOP_OF_POLE_JUMP: cancel = act_top_of_pole_jump(m); break;
case ACT_VERTICAL_WIND: cancel = act_vertical_wind(m); break;
default: LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action); return true;
default:
LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action);
set_mario_action(m, ACT_FREEFALL, 0);
return false;
}
/* clang-format on */
}

View file

@ -1088,7 +1088,10 @@ s32 mario_execute_automatic_action(struct MarioState *m) {
case ACT_IN_CANNON: cancel = act_in_cannon(m); break;
case ACT_TORNADO_TWIRLING: cancel = act_tornado_twirling(m); break;
case ACT_BUBBLED: cancel = act_bubbled(m); break;
default: LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action); return true;
default:
LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action);
set_mario_action(m, ACT_IDLE, 0);
return false;
}
/* clang-format on */
}

View file

@ -2962,7 +2962,10 @@ s32 mario_execute_cutscene_action(struct MarioState *m) {
case ACT_BUTT_STUCK_IN_GROUND: cancel = act_butt_stuck_in_ground(m); break;
case ACT_FEET_STUCK_IN_GROUND: cancel = act_feet_stuck_in_ground(m); break;
case ACT_PUTTING_ON_CAP: cancel = act_putting_on_cap(m); break;
default: LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action); return true;
default:
LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action);
set_mario_action(m, ACT_IDLE, 0);
return false;
}
/* clang-format on */
}

View file

@ -2043,7 +2043,10 @@ s32 mario_execute_moving_action(struct MarioState *m) {
case ACT_QUICKSAND_JUMP_LAND: cancel = act_quicksand_jump_land(m); break;
case ACT_HOLD_QUICKSAND_JUMP_LAND: cancel = act_hold_quicksand_jump_land(m); break;
case ACT_LONG_JUMP_LAND: cancel = act_long_jump_land(m); break;
default: LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action); return true;
default:
LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action);
set_mario_action(m, ACT_IDLE, 0);
return false;
}
/* clang-format on */
}

View file

@ -506,7 +506,10 @@ s32 mario_execute_object_action(struct MarioState *m) {
case ACT_PICKING_UP_BOWSER: cancel = act_picking_up_bowser(m); break;
case ACT_HOLDING_BOWSER: cancel = act_holding_bowser(m); break;
case ACT_RELEASING_BOWSER: cancel = act_releasing_bowser(m); break;
default: LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action); return true;
default:
LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action);
set_mario_action(m, ACT_IDLE, 0);
return false;
}
/* clang-format on */
}

View file

@ -1169,7 +1169,10 @@ s32 mario_execute_stationary_action(struct MarioState *m) {
case ACT_BRAKING_STOP: cancel = act_braking_stop(m); break;
case ACT_BUTT_SLIDE_STOP: cancel = act_butt_slide_stop(m); break;
case ACT_HOLD_BUTT_SLIDE_STOP: cancel = act_hold_butt_slide_stop(m); break;
default: LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action); return true;
default:
LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action);
set_mario_action(m, ACT_IDLE, 0);
return false;
}
/* clang-format on */
}

View file

@ -1609,7 +1609,10 @@ s32 mario_execute_submerged_action(struct MarioState *m) {
case ACT_HOLD_METAL_WATER_FALL_LAND: cancel = act_hold_metal_water_fall_land(m); break;
case ACT_HOLD_METAL_WATER_JUMP: cancel = act_hold_metal_water_jump(m); break;
case ACT_HOLD_METAL_WATER_JUMP_LAND: cancel = act_hold_metal_water_jump_land(m); break;
default: LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action); return true;
default:
LOG_ERROR("Attempted to execute unimplemented action '%04X'", m->action);
set_mario_action(m, ACT_WATER_IDLE, 0);
return false;
}
/* clang-format on */
}