the rest of the portal types (2 unknown to me)

This commit is contained in:
Reinmmar 2023-09-17 22:00:45 +02:00
parent 4c37e6cf5e
commit 203f691dff
6 changed files with 31 additions and 26 deletions

View File

@ -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 {

View File

@ -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;
}

View File

@ -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:

View File

@ -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)) {

View File

@ -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;

View File

@ -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;