Refactor verify_warp

This commit is contained in:
Agent X 2024-03-25 19:03:59 -04:00
parent 9fde4dc1b7
commit c8bf12754f
1 changed files with 17 additions and 18 deletions

View File

@ -834,28 +834,27 @@ void initiate_painting_warp(s16 paintingIndex) {
void verify_warp(struct MarioState *m, bool killMario) {
if (area_get_warp_node(sSourceWarpNodeId) == NULL) {
if (area_get_warp_node(WARP_NODE_DEATH) != NULL) {
if (killMario) {
m->numLives--;
if (m->numLives <= -1) {
sDelayedWarpOp = WARP_OP_GAME_OVER;
} else {
sSourceWarpNodeId = WARP_NODE_DEATH;
}
}
else {
sSourceWarpNodeId = WARP_NODE_DEATH;
}
}
else {
dynos_warp_to_start_level();
}
if (area_get_warp_node(sSourceWarpNodeId) != NULL) { return; }
if (area_get_warp_node(WARP_NODE_DEATH) == NULL) {
dynos_warp_to_start_level();
return;
}
if (!killMario) {
sSourceWarpNodeId = WARP_NODE_DEATH;
return;
}
m->numLives--;
if (m->numLives < 0) {
sDelayedWarpOp = WARP_OP_GAME_OVER;
} else {
sSourceWarpNodeId = WARP_NODE_DEATH;
}
}
/**
* If there is not already a delayed warp, schedule one. The source node is
* based on the warp operation and sometimes Mario's used object.