Return -1 instead of crashing if no floor under mario on create

This commit is contained in:
jaburns
2021-07-22 21:25:02 -06:00
parent 8144865975
commit be84cd333a
3 changed files with 13 additions and 8 deletions
+7 -1
View File
@@ -158,7 +158,13 @@ SM64_LIB_FN int32_t sm64_mario_create( int16_t x, int16_t y, int16_t z )
gMarioSpawnInfoVal.next = NULL;
init_mario_from_save_file();
init_mario();
if( init_mario() < 0 )
{
sm64_mario_delete( marioIndex );
return -1;
}
set_mario_action( gMarioState, ACT_SPAWN_SPIN_AIRBORNE, 0);
find_floor( x, y, z, &gMarioState->floor );