diff --git a/include/area.h b/include/area.h index 66e7c016..a21ee5b0 100644 --- a/include/area.h +++ b/include/area.h @@ -7,7 +7,13 @@ #define MAX_ROOMS 64 typedef enum { - PT_POT = 4, + PT_TREESTUMP, + PT_ROCK, + PT_2, + PT_DUNGEON, + PT_JAR, + PT_5, + PT_TOD, } PortalTypes; typedef struct { diff --git a/src/enterPortalSubtask.c b/src/enterPortalSubtask.c index fbb94ccc..3bac0702 100644 --- a/src/enterPortalSubtask.c +++ b/src/enterPortalSubtask.c @@ -179,8 +179,8 @@ void Subtask_PortalCutscene_0(void) { gScreen.bg1.yOffset = 0; controls->scroll_y = 0; portalId = gArea.portal_type; - if ((portalId == 2) && (gUI.roomControls.area != 2)) { - portalId = 3; + if ((portalId == PT_2) && (gUI.roomControls.area != 2)) { + portalId = PT_DUNGEON; } ptr = &gUnk_080D4138[portalId]; LoadPaletteGroup(ptr->paletteGroup); @@ -247,19 +247,19 @@ void RespawnAsMinish(void) { bool32 sub_0804AD18(void) { switch (gArea.portal_type) { - case 0: - case 1: - case 2: + case PT_TREESTUMP: + case PT_ROCK: + case PT_2: if (!CheckGlobalFlag(ENTRANCE_0 + gArea.portal_type)) { return FALSE; } // else: return TRUE implicitely, because it's stored in r0. But does not match if returning explicitely. break; - case 6: + case PT_TOD: return FALSE; - case 3: - case PT_POT: - case 5: + case PT_DUNGEON: + case PT_JAR: + case PT_5: default: return FALSE; } diff --git a/src/manager/minishPortalManager.c b/src/manager/minishPortalManager.c index 47307dea..21855b00 100644 --- a/src/manager/minishPortalManager.c +++ b/src/manager/minishPortalManager.c @@ -34,7 +34,7 @@ void MinishPortalManager_Main(MinishPortalManager* this) { gArea.portal_type = super->type; if (!CheckGlobalFlag(EZERO_1ST)) { gArea.portal_mode = 1; - gArea.portal_type = 5; + gArea.portal_type = PT_5; } else { if ((gPlayerState.flags & PL_USE_PORTAL) && gPlayerState.jump_status == 0) { gArea.portal_mode = 2; @@ -83,7 +83,7 @@ void CreateMagicSparkles(u32 baseX, u32 baseY, u32 layer) { } bool32 PortalReadyForMinish(void) { - if ((gPlayerState.flags & PL_MINISH) && gPlayerState.attachedBeetleCount == 0 && (gArea.portal_type != 0x6) && + if ((gPlayerState.flags & PL_MINISH) && gPlayerState.attachedBeetleCount == 0 && (gArea.portal_type != PT_TOD) && (gPlayerState.heldObject == 0)) { switch (gPlayerState.framestate) { case PL_STATE_IDLE: diff --git a/src/object/jarPortal.c b/src/object/jarPortal.c index 19c05a57..90aaf6a0 100644 --- a/src/object/jarPortal.c +++ b/src/object/jarPortal.c @@ -122,9 +122,9 @@ void sub_0808C01C(JarPortalEntity* this, u32 r1) { gArea.portal_x = super->x.HALF.HI; gArea.portal_y = super->y.HALF.HI; gArea.portal_exit_dir = 2; - type = PT_POT; + type = PT_JAR; if (r1 != 0) - type = 2; + type = PT_2; gArea.portal_type = type; if (r1 == 1) { if ((gPlayerState.flags & PL_USE_PORTAL) && (gPlayerState.jump_status == 0)) { diff --git a/src/player.c b/src/player.c index baaca605..420b0429 100644 --- a/src/player.c +++ b/src/player.c @@ -1015,7 +1015,7 @@ static void PlayerUsePortal(Entity* this) { if ((gInput.newKeys & (B_BUTTON | R_BUTTON)) == 0) return; - if (AreaIsDungeon() || gArea.portal_type == 3) { + if (AreaIsDungeon() || gArea.portal_type == PT_DUNGEON) { this->subAction = 7; this->timer = 30; SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 16); @@ -1031,7 +1031,6 @@ static void PortalJumpOnUpdate(Entity* this) { COLLISION_OFF(this); this->knockbackDuration = 0; - x = gArea.portal_x; y = gArea.portal_y; @@ -1049,22 +1048,22 @@ static void PortalJumpOnUpdate(Entity* this) { this->subAction = 1; this->animationState = IdleSouth; this->spriteSettings.flipX = FALSE; - if (gArea.portal_type == PT_POT) { + if (gArea.portal_type == PT_JAR) { gPlayerState.animation = ANIM_ENTER_POT; } } this->timer = 8; - if (gArea.portal_type != 3) { + if (gArea.portal_type != PT_DUNGEON) { this->spritePriority.b0 = 3; } } static void PortalStandUpdate(Entity* this) { switch (gArea.portal_type) { - case 4: - case 5: + case PT_JAR: + case PT_5: sub_0806F948(&gPlayerEntity); break; } @@ -1090,7 +1089,7 @@ static void PortalStandUpdate(Entity* this) { this->timer = 8; } - if (gArea.portal_type == PT_POT) { + if (gArea.portal_type == PT_JAR) { if (this->frame == 0) { UpdateAnimationSingleFrame(this); return; @@ -1217,12 +1216,12 @@ static void PortalEnterUpdate(Entity* this) { this->spriteSettings.draw = FALSE; - if (gArea.portal_type == 3) { + if (gArea.portal_type == PT_DUNGEON) { if (--this->subtimer == 0) sub_080717F8(this); return; } - if (gArea.portal_type == 6) + if (gArea.portal_type == PT_TOD) DoExitTransition(&gUnk_0813AB58); else gArea.portal_in_use = TRUE; diff --git a/src/playerUtils.c b/src/playerUtils.c index f88af901..4fb789f3 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -1972,10 +1972,10 @@ void ResolvePlayerAnimation(void) { } if ((gPlayerState.flags & PL_USE_PORTAL) != 0) { switch (gArea.portal_type) { - case 5: + case PT_5: anim = ANIM_DEFAULT_NOCAP; break; - case PT_POT: + case PT_JAR: anim = ANIM_DEFAULT; break; default: @@ -2016,7 +2016,7 @@ void ResolvePlayerAnimation(void) { return; } if ((gPlayerState.flags & PL_USE_PORTAL) != 0) { - anim = (gArea.portal_type == PT_POT) ? ANIM_IN_POT : ANIM_PORTAL; + anim = (gArea.portal_type == PT_JAR) ? ANIM_IN_POT : ANIM_PORTAL; } else { if (gPlayerState.sword_state != 0) { anim = ANIM_SWORD_CHARGE_END;