From 1e46ed136ac3dd19eddb0365a224c1eb22da8a6f Mon Sep 17 00:00:00 2001 From: MysterD Date: Tue, 8 Sep 2020 13:53:46 -0700 Subject: [PATCH] Prevent extra death for bubbled player on area change --- src/game/level_update.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/game/level_update.c b/src/game/level_update.c index b30fa5eb..652602ca 100644 --- a/src/game/level_update.c +++ b/src/game/level_update.c @@ -382,25 +382,28 @@ void init_mario_after_warp(void) { // set to a minimum of two lives on level change if (sWarpDest.type == WARP_TYPE_CHANGE_LEVEL) { gMarioStates[i].numLives = max(gMarioStates[i].numLives, 2); - gMarioStates[i].health = 0x880; - gMarioStates[i].healCounter = 0; - gMarioStates[i].hurtCounter = 0; } if (sWarpDest.type == WARP_TYPE_CHANGE_LEVEL || sWarpDest.type == WARP_TYPE_CHANGE_AREA) { gPlayerSpawnInfos[i].areaIndex = sWarpDest.areaIdx; + // reset health + gMarioStates[i].health = 0x880; + gMarioStates[i].healCounter = 0; + gMarioStates[i].hurtCounter = 0; + if (i == 0) { load_mario_area(); } } + + // enforce bubble on area change + if (i == 0 && gMarioStates[i].numLives == -1) { + mario_set_bubbled(&gMarioStates[i]); + gMarioStates[i].health = 0xFF; + } } init_mario(); set_mario_initial_action(gMarioState, marioSpawnType, sWarpDest.arg); - // enforce bubble on area change - if (gMarioState->playerIndex == 0 && gMarioState->numLives == -1) { - mario_set_bubbled(gMarioState); - } - gMarioState->interactObj = spawnNode->object; gMarioState->usedObj = spawnNode->object; }