summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoroctorock <79596758+octorock@users.noreply.github.com>2022-04-10 23:42:14 +0200
committeroctorock <79596758+octorock@users.noreply.github.com>2022-04-11 18:55:07 +0200
commit4fd8048c3cc36065e15faee67e50365dead51784 (patch)
tree87fcf28ac319e2df885df618f81843790daccffa /src
parent02cec8ca8d9b8f7373286fcd1c4c88c42beeeeb1 (diff)
Decompile some functions
Diffstat (limited to 'src')
-rw-r--r--src/beanstalkSubtask.c12
-rw-r--r--src/code_08049DF4.c10
-rw-r--r--src/common.c40
-rw-r--r--src/enemy/enemy64.c2
-rw-r--r--src/enemy/ghini.c2
-rw-r--r--src/game.c124
-rw-r--r--src/interrupts.c2
-rw-r--r--src/item/itemTryPickupObject.c28
-rw-r--r--src/menu/kinstone_menu.c12
-rw-r--r--src/npc/gorman.c38
-rw-r--r--src/npc/minishEzlo.c27
-rw-r--r--src/object/beanstalk.c4
-rw-r--r--src/object/ladderUp.c2
-rw-r--r--src/object/object42.c7
-rw-r--r--src/object/object70.c2
-rw-r--r--src/object/object96.c2
-rw-r--r--src/object/pushableFurniture.c8
-rw-r--r--src/playerItem/playerItemSword.c2
-rw-r--r--src/playerUtils.c209
-rw-r--r--src/projectile/gyorgTail.c30
-rw-r--r--src/scroll.c27
-rw-r--r--src/subtask2.c6
22 files changed, 535 insertions, 61 deletions
diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c
index 2f1f1044..6ed3af67 100644
--- a/src/beanstalkSubtask.c
+++ b/src/beanstalkSubtask.c
@@ -255,10 +255,8 @@ bool32 sub_0801A458(LayerStruct* layer, u32 position, u32 collisionType) {
return FALSE;
}
-NONMATCH("asm/non_matching/beanstalkSubtask/sub_0801A4F8.inc", bool32 sub_0801A4F8(void)) {
- u32 uVar1;
- u32 uVar3;
-
+bool32 sub_0801A4F8(void) {
+ u32 tmp;
if ((gPlayerState.flags & PL_MINISH) != 0) {
if (GetInventoryValue(ITEM_POWER_BRACELETS) != 1) {
return FALSE;
@@ -269,7 +267,8 @@ NONMATCH("asm/non_matching/beanstalkSubtask/sub_0801A4F8.inc", bool32 sub_0801A4
if (gPlayerState.field_0xd != gPlayerEntity.direction) {
return FALSE;
}
- if ((gPlayerEntity.collisions & gUnk_080B44A0[(((gPlayerEntity.direction + 4) & 0x18) >> 2)]) == 0) {
+ tmp = (((gPlayerEntity.direction + 4) & 0x18) >> 3);
+ if ((gUnk_080B44A0[tmp] & gPlayerEntity.collisions) == 0) {
return FALSE;
}
} else {
@@ -282,7 +281,6 @@ NONMATCH("asm/non_matching/beanstalkSubtask/sub_0801A4F8.inc", bool32 sub_0801A4
}
return TRUE;
}
-END_NONMATCH
ASM_FUNC("asm/non_matching/beanstalkSubtask/sub_0801A570.inc", void sub_0801A570())
@@ -387,7 +385,7 @@ NONMATCH("asm/non_matching/beanstalkSubtask/sub_0801AA58.inc",
object->collisionLayer = this->collisionLayer;
gPlayerState.pushedObject = 0xa0;
gPlayerState.queued_action = 5;
- gPlayerState.flags |= 1;
+ gPlayerState.flags |= PL_BUSY;
this->x.HALF.LO = 0;
this->y.HALF.LO = 0;
this->direction = param_3;
diff --git a/src/code_08049DF4.c b/src/code_08049DF4.c
index 91029146..01063df0 100644
--- a/src/code_08049DF4.c
+++ b/src/code_08049DF4.c
@@ -21,7 +21,10 @@ Entity* sub_08049DF4(u32 arg0) {
}
Entity* sub_08049E18(void) {
- if ((gPlayerState.field_0x3c[0] == 0) && !(gPlayerState.flags & 0x22189b75)) {
+ if ((gPlayerState.field_0x3c[0] == 0) &&
+ !(gPlayerState.flags &
+ (PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_DISABLE_ITEMS | PL_FALLING | PL_FROZEN |
+ PL_IN_MINECART | PL_PIT_IS_EXIT | PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_FLAGS2000000 | PL_CLIMBING))) {
gUnk_020000B0 = &gPlayerEntity;
return &gPlayerEntity;
}
@@ -29,7 +32,10 @@ Entity* sub_08049E18(void) {
}
Entity* sub_08049E4C(void) {
- if ((gPlayerState.field_0x3c[0] == 0) && !(gPlayerState.flags & 0x22189bf5)) {
+ if ((gPlayerState.field_0x3c[0] == 0) &&
+ !(gPlayerState.flags & (PL_BUSY | PL_DROWNING | PL_CAPTURED | PL_USE_PORTAL | PL_HIDDEN | PL_MINISH |
+ PL_DISABLE_ITEMS | PL_FALLING | PL_FROZEN | PL_IN_MINECART | PL_PIT_IS_EXIT |
+ PL_MOLDWORM_CAPTURED | PL_IN_HOLE | PL_FLAGS2000000 | PL_CLIMBING))) {
gUnk_020000B0 = &gPlayerEntity;
return &gPlayerEntity;
}
diff --git a/src/common.c b/src/common.c
index 71f9eb8b..3e9cc7c4 100644
--- a/src/common.c
+++ b/src/common.c
@@ -22,7 +22,7 @@ typedef struct {
extern u8 gUnk_03003DE0;
extern u8 gzHeap[0x1000];
-extern u8 gUnk_0201AEE0[0x2000];
+extern u32 gUnk_0201AEE0[0x800];
extern u8 gUnk_080CA11C[];
extern void (*gUnk_080C9CAC[])(void);
@@ -67,6 +67,10 @@ extern u32 gUsedPalettes;
extern u16 gPaletteBuffer[];
extern const GfxItem* gGfxGroups[];
+extern const u32 gUnk_080C9460[];
+
+void sub_0801E82C(void);
+
u32 DecToHex(u32 value) {
u32 result;
register u32 r1 asm("r1");
@@ -382,8 +386,14 @@ u32 sub_0801DF10(DungeonLayout* lyt) {
return offset;
}
-ASM_FUNC("asm/non_matching/common/sub_0801DF28.inc", void sub_0801DF28(u32 a1, u32 a2, u32 a3));
-
+void sub_0801DF28(u32 x, u32 y, s32 color) {
+ u32* ptr;
+ u32 tmp;
+ ptr = &gUnk_0201AEE0[(((y >> 3) * 0x10 + (x >> 3)) * 8)];
+ ptr = &ptr[(y & 7)];
+ tmp = (color << ((x & 7) * 4));
+ ptr[0] = (ptr[0] & gUnk_080C9460[x & 7]) | tmp;
+}
u32 sub_0801DF60(u32 a1, u8* p) {
return (p[a1 >> 2] >> (2 * (~a1 & 3))) & 3;
}
@@ -531,7 +541,29 @@ ASM_FUNC("asm/non_matching/common/sub_0801E64C.inc", void sub_0801E64C(u32 a1, u
ASM_FUNC("asm/non_matching/common/sub_0801E6C8.inc", void sub_0801E6C8(u32 a1));
-ASM_FUNC("asm/non_matching/common/sub_0801E738.inc", void sub_0801E738(u32 a1));
+void sub_0801E738(u32 param_1) {
+ s32 index;
+ s32 tmp;
+
+ sub_0801E82C();
+ if (param_1 - 0x65 < 0x11) {
+ index = sub_0801E8B0(param_1);
+ if (index < 0) {
+ index = 0;
+ while (gSave.unk118[index] != 0) {
+ index++;
+ }
+ }
+ if ((u32)index < 0x12) {
+ gSave.unk118[index] = param_1;
+ tmp = gSave.unk12B[index] + 1;
+ if (tmp > 99) {
+ tmp = 99;
+ }
+ gSave.unk12B[index] = tmp;
+ }
+ }
+}
void sub_0801E798(u32 a1) {
s32 idx = sub_0801E8B0(a1);
diff --git a/src/enemy/enemy64.c b/src/enemy/enemy64.c
index 5017f1b4..bbcecf30 100644
--- a/src/enemy/enemy64.c
+++ b/src/enemy/enemy64.c
@@ -423,7 +423,7 @@ void sub_08049944(Enemy64Entity* this) {
if (EntityWithinDistance(super, gPlayerEntity.x.HALF.HI, gPlayerEntity.y.HALF.HI, 0x20)) {
gPlayerState.field_0x14 = 1;
if (gPlayerEntity.z.HALF.HI == 0) {
- gPlayerState.flags |= 2;
+ gPlayerState.flags |= PL_FLAGS2;
this->unk_7c |= 1;
}
}
diff --git a/src/enemy/ghini.c b/src/enemy/ghini.c
index 1fb426b7..80d63819 100644
--- a/src/enemy/ghini.c
+++ b/src/enemy/ghini.c
@@ -386,7 +386,7 @@ void sub_0803F6EC(GhiniEntity* this) {
gPlayerEntity.iframes = -0x3c;
gPlayerState.jump_status = 0x41;
}
- gPlayerState.flags &= 0xffffffef;
+ gPlayerState.flags &= ~PL_CAPTURED;
}
void sub_0803F738(GhiniEntity* this) {
diff --git a/src/game.c b/src/game.c
index 325b71c9..f594f02f 100644
--- a/src/game.c
+++ b/src/game.c
@@ -33,6 +33,7 @@
#include "transitions.h"
#include "roomid.h"
#include "ui.h"
+#include "kinstone.h"
// Game task
@@ -234,9 +235,17 @@ extern const EntityData* gUnk_080FCFB8[];
extern void (*const gUnk_080FD138[])(void);
extern const u16 gUnk_080FD964[];
+extern const u8 gUnk_080FCF04[];
extern void ClearBgAnimations(void);
+void sub_08054974(s32, s32);
+void sub_080548E8(void);
+
+extern void sub_0806F38C(void);
+
+extern void sub_08018710(u32);
+
void GameTask(void) {
static GameState* const sStates[] = {
GameTask_Transition,
@@ -1277,8 +1286,8 @@ bool32 CanDispEzloMessage(void) {
gPauseMenuOptions.disabled || gUnk_0200AF00.unk_1)
return 0;
- if ((gPlayerState.flags & (PL_NO_CAP | 0x110)) || (gPlayerState.framestate_last > tmp) || gPlayerState.item ||
- gPlayerEntity.field_0x7a.HWORD)
+ if ((gPlayerState.flags & (PL_NO_CAP | PL_CAPTURED | PL_DISABLE_ITEMS)) || (gPlayerState.framestate_last > tmp) ||
+ gPlayerState.item || gPlayerEntity.field_0x7a.HWORD)
return 0;
if ((gPlayerEntity.z.HALF.HI & 0x8000) && !gPlayerState.field_0xa)
@@ -1885,9 +1894,43 @@ void sub_08053758(void) {
ASM_FUNC("asm/non_matching/game/sub_08053800.inc", void sub_08053800())
-ASM_FUNC("asm/non_matching/game/sub_08053894.inc", void sub_08053894())
+void sub_08053894(void) {
+ u32 tmp;
+ if (gFadeControl.active == 0) {
+ gMenu.transitionTimer--;
+ if (gMenu.field_0xa != 0) {
+ gMenu.field_0xa--;
+ } else {
+ if (((gRoomTransition.frameCount & 1) == 0) && (gMenu.storyPanelIndex < 0x10)) {
+ tmp = ++gMenu.storyPanelIndex << 0x18;
+ gScreen.controls.alphaBlend = (tmp >> 0x10) | (0x10 - ((tmp) >> 0x19));
+ }
+ }
+ if (gMenu.transitionTimer == 0) {
+ gMenu.overlayType++;
+ SetFade(FADE_IN_OUT | FADE_INSTANT, 8);
+ }
+ }
+}
-ASM_FUNC("asm/non_matching/game/sub_08053904.inc", void sub_08053904())
+void sub_08053904(void) {
+ u32 tmp;
+ if (gFadeControl.active == 0) {
+ gMenu.transitionTimer--;
+ if (gMenu.field_0xa != 0) {
+ gMenu.field_0xa--;
+ } else {
+ if (((gRoomTransition.frameCount & 1) == 0) && (gMenu.storyPanelIndex < 0x10)) {
+ tmp = ++gMenu.storyPanelIndex << 0x18;
+ gScreen.controls.alphaBlend = (tmp >> 0x10) | (0x10 - (tmp >> 0x19));
+ }
+ }
+ if (gMenu.transitionTimer == 0) {
+ gMenu.overlayType++;
+ SetFade(FADE_IN_OUT | FADE_INSTANT, 1);
+ }
+ }
+}
void sub_08053974(void) {
if (gFadeControl.active == 0) {
@@ -2043,7 +2086,21 @@ void sub_08053CAC(void) {
gUnk_080FCFA4[gMenu.overlayType]();
}
-ASM_FUNC("asm/non_matching/game/sub_08053CC8.inc", void sub_08053CC8())
+void sub_08053CC8(void) {
+ const u8* ptr;
+ ptr = gUnk_080FCF04 + gMenu.field_0x3 * 0x10;
+ gMenu.field_0xc = (void*)&ptr[8];
+ LoadRoomEntityList(*(EntityData**)(&ptr[0]));
+ LoadRoomEntityList(GetRoomProperty(ptr[4], ptr[5], 1));
+ LoadRoomEntityList(GetRoomProperty(ptr[4], ptr[5], 2));
+ gMenu.overlayType = 1;
+ gScreen.lcd.displayControl &= 0xfeff;
+ gUpdateVisibleTiles = 1;
+ SetFade(FADE_INSTANT, 0x10);
+ if (ptr[5] == 0x1d) {
+ gMenu.field_0xa = 1;
+ }
+}
void sub_08053D34(void) {
if (gMenu.field_0xa != 0) {
@@ -2581,7 +2638,21 @@ void Subtask_WorldEvent(void) {
#endif
}
-ASM_FUNC("asm/non_matching/game/sub_0805488C.inc", void sub_0805488C())
+void sub_0805488C(void) {
+ const struct_080FE320* ptr = &gUnk_080FE320[gUI.field_0x3];
+ gMenu.field_0x0 = ptr->evt_type;
+ gMenu.field_0x3 = ptr->entity_idx;
+ gMenu.field_0x4 = gUI.field_0x3;
+ gMenu.field_0xc = (u8*)ptr;
+ gMenu.menuType++;
+ gMenu.overlayType = 0;
+ gMenu.transitionTimer = 300;
+ DispReset(0);
+ sub_08054974(gUI.field_0x3, 1);
+ sub_0806F364();
+ ClearRoomFlag(0xff);
+ sub_080548E8();
+}
void sub_080548E8(void) {
gUnk_080FE2AC[gMenu.field_0x0]();
@@ -2594,12 +2665,47 @@ void sub_080548E8(void) {
UpdateScrollVram();
}
-ASM_FUNC("asm/non_matching/game/sub_08054920.inc", void sub_08054920())
+void sub_08054920(void) {
+ MessageInitialize();
+ sub_0806F38C();
+ if (gUnk_080C9CBC[gFuseInfo._3]._5[1] != 0) {
+ MenuFadeIn(10, gUI.field_0x3);
+ } else {
+ gUI.nextToLoad = 3;
+ SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 0x10);
+ }
+}
void sub_08054968(void) {
gMenu.menuType = 2;
}
-ASM_FUNC("asm/non_matching/game/sub_08054974.inc", void sub_08054974())
+void sub_08054974(s32 param_1, s32 param_2) {
+ struct_080FE320* ptr = &gUnk_080FE320[param_1];
+ SetCurrentRoomPropertyList(ptr->_2, ptr->_3);
+ gRoomControls.area = ptr->_2;
+ gRoomControls.room = ptr->_3;
+ LoadGfxGroups();
+ gArea.localFlagOffset = GetFlagBankOffset(gRoomControls.area);
+ if (param_2 != 0) {
+ LoadAuxiliaryRoom(ptr->_2, ptr->_3);
+ } else {
+ sub_08052FF4(ptr->_2, ptr->_3);
+ InitializeCamera();
+ gUpdateVisibleTiles = 1;
+ }
+ gScreen.lcd.displayControl &= 0x1fff;
+ gRoomControls.scroll_x = gRoomControls.origin_x + ptr->_4;
+ gRoomControls.scroll_y = gRoomControls.origin_y + ptr->_6;
+ if (ptr->_2 == 2) {
+ TryLoadPrologueHyruleTown();
+ }
+ sub_08018710(gUI.field_0x3);
+}
-ASM_FUNC("asm/non_matching/game/sub_08054A14.inc", void sub_08054A14())
+void sub_08054A14(s32 param_1) {
+ struct_080FE320* ptr = &gUnk_080FE320[param_1];
+ if (ptr->_11 < 0xe) {
+ SetLocalFlagByBank(gLocalFlagBanks[ptr->_11], ptr->flag);
+ }
+}
diff --git a/src/interrupts.c b/src/interrupts.c
index e9d6e7e9..760ec0df 100644
--- a/src/interrupts.c
+++ b/src/interrupts.c
@@ -236,7 +236,7 @@ static void HandlePlayerLife(Entity* this) {
if ((gPlayerEntity.contactFlags & 0x80) && (gPlayerEntity.iframes > 0))
SoundReq(SFX_86);
- gPlayerState.flags &= ~(0x2000000 | PL_FALLING);
+ gPlayerState.flags &= ~(PL_FALLING | PL_FLAGS2000000);
if (gPlayerState.flags & PL_BURNING)
ResetPlayerItem();
if ((gPlayerState.flags & PL_CLONING) && gPlayerState.chargeState.action == 0)
diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c
index 4f5f7228..440f8075 100644
--- a/src/item/itemTryPickupObject.c
+++ b/src/item/itemTryPickupObject.c
@@ -95,7 +95,33 @@ void sub_08076488(ItemBehavior* this, u32 idx) {
gPlayerState.framestate = PL_STATE_HOLD;
}
-ASM_FUNC("asm/non_matching/itemTryPickupObject/sub_08076518.inc", void sub_08076518(ItemBehavior* this, u32 idx))
+void sub_08076518(ItemBehavior* this, u32 index) {
+ if (PlayerTryDropObject(this, index)) {
+ gPlayerState.framestate = 4;
+ if ((gPlayerState.jump_status & 0x80) == 0 && gPlayerState.field_0x1f[0] == 0) {
+ if (gPlayerEntity.knockbackDuration != 0) {
+ PlayerCancelHoldItem(this, index);
+ } else {
+ if ((gPlayerState.field_0x92 & 0x8018) != 0) {
+ sub_0806F948(&gPlayerEntity);
+ gPlayerState.heldObject = 5;
+ this->field_0x18->subAction = 2;
+ this->field_0x18->direction = (gPlayerEntity.animationState & 0xe) << 2;
+ this->field_0x18 = NULL;
+ this->stateID++;
+ this->field_0xf = 0x0f;
+ if ((gPlayerState.flags & PL_NO_CAP) != 0) {
+ sub_08077DF4(this, 0x930);
+ } else {
+ sub_08077DF4(this, 0x344);
+ }
+ gPlayerState.field_0xa |= 8 >> index;
+ gPlayerState.keepFacing |= 8 >> index;
+ }
+ }
+ }
+ }
+}
void sub_080765E0(ItemBehavior* this, u32 idx) {
if (PlayerTryDropObject(this, idx) != 0) {
diff --git a/src/menu/kinstone_menu.c b/src/menu/kinstone_menu.c
index 1a7816c1..6956a86e 100644
--- a/src/menu/kinstone_menu.c
+++ b/src/menu/kinstone_menu.c
@@ -18,7 +18,7 @@
extern u32 sub_08000E44(u32);
extern void sub_080A3B74(void);
-extern s32 sub_080A3B48(void);
+extern u32 sub_080A3B48(void);
extern void sub_0805ECEC(u32, u32, u32, u32);
extern void sub_0801E6C8(u32);
extern void sub_0801E798(u32);
@@ -65,7 +65,15 @@ Subtask KinstoneMenu_Type3;
Subtask KinstoneMenu_Type4;
Subtask KinstoneMenu_Type5;
-ASM_FUNC("asm/non_matching/menu/kinstone_menu/sub_080A3B48.inc", s32 sub_080A3B48(void))
+u32 sub_080A3B48(void) {
+ u32 index;
+ for (index = 0; index <= 0x12; index++) {
+ if (gSave.unk12B[index] == 0) {
+ break;
+ }
+ }
+ return index;
+}
void sub_080A3B74(void) {
gKinstoneMenu.unk2f = 0;
diff --git a/src/npc/gorman.c b/src/npc/gorman.c
index 90266bf1..c4294df9 100644
--- a/src/npc/gorman.c
+++ b/src/npc/gorman.c
@@ -20,6 +20,12 @@ void sub_08069888(Entity* this);
extern u16 gUnk_08111C50[];
+extern const s16 gUnk_08111C5C[];
+extern const u8 gUnk_08111C74[];
+
+extern const s16 gUnk_08111C84[];
+extern const u8 gUnk_08111C8C[];
+
void Gorman(Entity* this) {
if ((this->flags & ENT_SCRIPTED) != 0) {
sub_08069838(this);
@@ -98,9 +104,37 @@ void sub_08069888(Entity* this) {
MessageNoOverlap(gUnk_08111C50[index], this);
}
-ASM_FUNC("asm/non_matching/gorman/sub_0806991C.inc", void sub_0806991C(Entity* this, ScriptExecutionContext* context))
+void sub_0806991C(Entity* this, ScriptExecutionContext* context) {
+ u32 tmp;
+ const s16* ptr;
+ this->field_0x68.HALF.LO = (Random() & 0x1f) + 0x3c;
+ ptr = &gUnk_08111C5C[*(s8*)&this->field_0x68.HALF.HI * 2];
+ context->x.HALF.HI = gRoomControls.origin_x + ptr[0];
+ context->y.HALF.HI = gRoomControls.origin_y + ptr[1];
+ context->unk_19 = 8;
+ context->postScriptActions |= 2;
+ context->condition = 0;
+ tmp = sub_080045DA(context->x.HALF.HI - this->x.HALF.HI, context->y.HALF.HI - this->y.HALF.HI);
+ this->direction = tmp;
+ this->animationState = (this->animationState & 0x80) | gUnk_08111C74[(tmp << 0x18) >> 0x1c];
+ gActiveScriptInfo.flags |= 1;
+}
-ASM_FUNC("asm/non_matching/gorman/sub_080699AC.inc", void sub_080699AC(Entity* this, ScriptExecutionContext* context))
+void sub_080699AC(Entity* this, ScriptExecutionContext* context) {
+ u32 tmp;
+ const s16* ptr;
+ this->field_0x68.HALF.LO = (Random() & 0x1f) + 0x3c;
+ ptr = &gUnk_08111C84[*(s8*)&this->field_0x68.HALF.HI * 2];
+ context->x.HALF.HI = gRoomControls.origin_x + ptr[0];
+ context->y.HALF.HI = gRoomControls.origin_y + ptr[1];
+ context->unk_19 = 8;
+ context->postScriptActions |= 2;
+ context->condition = 0;
+ tmp = sub_080045DA(context->x.HALF.HI - this->x.HALF.HI, context->y.HALF.HI - this->y.HALF.HI);
+ this->direction = tmp;
+ this->animationState = (this->animationState & 0x80) | gUnk_08111C8C[(tmp << 0x18) >> 0x1c];
+ gActiveScriptInfo.flags |= 1;
+}
void sub_08069A3C(Entity* this) {
this->field_0x68.HALF.HI = gUnk_08111C9C[(Random() & 1) + (s8)this->field_0x68.HALF.HI * 2];
diff --git a/src/npc/minishEzlo.c b/src/npc/minishEzlo.c
index 130c58c9..561ac4d6 100644
--- a/src/npc/minishEzlo.c
+++ b/src/npc/minishEzlo.c
@@ -1,9 +1,12 @@
#include "entity.h"
#include "sound.h"
#include "script.h"
+#include "npc.h"
extern SpriteLoadData gUnk_0810C48C;
+extern void sub_0806FF10(Entity* this, u32 param_2, u32 param_3);
+
void MinishEzlo(Entity* this) {
if (this->action == 0) {
if (LoadExtraSpriteData(this, &gUnk_0810C48C) == 0) {
@@ -27,7 +30,29 @@ void MinishEzlo(Entity* this) {
}
}
-ASM_FUNC("asm/non_matching/minishEzlo/MinishEzlo_Head.inc", void MinishEzlo_Head(Entity* this))
+void MinishEzlo_Head(Entity* this) {
+ u32 uVar1;
+ u32 uVar2;
+ u32 uVar3;
+ if ((this->frameSpriteSettings & 4) != 0) {
+ uVar2 = 1;
+ uVar1 = 0;
+ } else {
+ uVar2 = 0;
+ uVar1 = 1;
+ }
+
+ if ((this->frameSpriteSettings & 8) != 0) {
+ uVar3 = 0x16;
+ } else {
+ uVar3 = 0x11c;
+ }
+ SetExtraSpriteFrame(this, uVar2, (this->frame & 0xffffff7f) - 1);
+ SetExtraSpriteFrame(this, uVar1, this->frameIndex);
+ sub_0806FF10(this, uVar1, uVar3);
+ SetSpriteSubEntryOffsetData1(this, uVar1, uVar2);
+ sub_0807000C(this);
+}
void sub_0806305C(Entity* this) {
this->spritePriority.b1 = 0;
diff --git a/src/object/beanstalk.c b/src/object/beanstalk.c
index ee4a6ab0..8328945a 100644
--- a/src/object/beanstalk.c
+++ b/src/object/beanstalk.c
@@ -277,7 +277,7 @@ void Beanstalk_Action1Type7(BeanstalkEntity* this) {
case 2:
case 3:
case 4:
- if (gPlayerState.floor_type == 0x1e) {
+ if (gPlayerState.floor_type == SURFACE_LADDER) {
if (EntityInRectRadius(super, &gPlayerEntity, 0, 8)) {
if ((super->animIndex == (super->type2 - 1) * 3 + 1) && (super->timer == 0)) {
super->timer = 1;
@@ -339,7 +339,7 @@ void Beanstalk_Action1Type9(BeanstalkEntity* this) {
}
super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY;
super->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3;
- if (gPlayerState.floor_type == 0x1e) {
+ if (gPlayerState.floor_type == SURFACE_LADDER) {
super->spritePriority.b0 = 0;
if (sub_080B1A0C(super, 0, -0x18) != 0x4014) {
SetTile(0x4014, COORD_TO_TILE_OFFSET(super, 0, 0x18), 1);
diff --git a/src/object/ladderUp.c b/src/object/ladderUp.c
index b173b5f6..99f459ed 100644
--- a/src/object/ladderUp.c
+++ b/src/object/ladderUp.c
@@ -59,7 +59,7 @@ void LadderUp(Entity* this) {
default:
if (this->type2 == 0) {
if (gPlayerEntity.y.HALF.HI < this->y.HALF.HI) {
- if (gPlayerState.floor_type != 0x1e && (GetTileTypeByEntity(this) == 0x4017)) {
+ if (gPlayerState.floor_type != SURFACE_LADDER && (GetTileTypeByEntity(this) == 0x4017)) {
SetTile(0x4023, COORD_TO_TILE(this), this->collisionLayer);
RestorePrevTileEntity(COORD_TO_TILE_OFFSET(this, 0, 0x10), this->collisionLayer);
}
diff --git a/src/object/object42.c b/src/object/object42.c
index 5fa85943..9f32164e 100644
--- a/src/object/object42.c
+++ b/src/object/object42.c
@@ -57,8 +57,9 @@ void sub_0808DDE8(Object42Entity* this) {
if (sub_0807953C()) {
super->subtimer++;
}
- if (((0x1e < super->subtimer) || ((gPlayerState.flags & 0x1810) != 0)) || (this->unk_6c == 0)) {
- gPlayerState.flags &= 0xfffffbff;
+ if (((0x1e < super->subtimer) || ((gPlayerState.flags & (PL_CAPTURED | PL_FROZEN | PL_IN_MINECART)) != 0)) ||
+ (this->unk_6c == 0)) {
+ gPlayerState.flags &= ~PL_BURNING;
DeleteThisEntity();
}
player = &gPlayerEntity;
@@ -68,7 +69,7 @@ void sub_0808DDE8(Object42Entity* this) {
super->collisionLayer = gPlayerEntity.collisionLayer;
super->spriteRendering.b3 = gPlayerEntity.spriteRendering.b3;
super->spriteOrientation.flipY = gPlayerEntity.spriteOrientation.flipY;
- if ((gPlayerState.flags & 0x400) != 0) {
+ if ((gPlayerState.flags & PL_BURNING) != 0) {
GetNextFrame(super);
} else {
DeleteThisEntity();
diff --git a/src/object/object70.c b/src/object/object70.c
index fa0a4bb4..7cc2664f 100644
--- a/src/object/object70.c
+++ b/src/object/object70.c
@@ -41,7 +41,7 @@ void Object70_Action1(Entity* this) {
if (this->type == 0) {
if (gPlayerEntity.z.WORD == 0) {
- if ((((gPlayerState.dash_state & 0x40) == 0) && (gPlayerState.floor_type == 0x11)) &&
+ if ((((gPlayerState.dash_state & 0x40) == 0) && (gPlayerState.floor_type == SURFACE_SWAMP)) &&
((gPlayerEntity.action == 1 || ((gPlayerEntity.action == 0x18 || (gPlayerEntity.action == 4)))))) {
goto _080974FA;
} else {
diff --git a/src/object/object96.c b/src/object/object96.c
index 114b748e..0a7f96d7 100644
--- a/src/object/object96.c
+++ b/src/object/object96.c
@@ -137,7 +137,7 @@ void Object96_Action2(Entity* this, const struct_gUnk_08123FB0* param_2) {
void Object96_Action3(Entity* this, const struct_gUnk_08123FB0* param_2) {
u8 type;
- if (gPlayerState.flags & 0x80) {
+ if (gPlayerState.flags & PL_MINISH) {
sub_0800445C(this);
} else {
if (IsCollidingPlayer(this)) {
diff --git a/src/object/pushableFurniture.c b/src/object/pushableFurniture.c
index 4b9c269c..c7f05ffe 100644
--- a/src/object/pushableFurniture.c
+++ b/src/object/pushableFurniture.c
@@ -191,7 +191,7 @@ bool32 sub_0808FC5C(PushableFurnitureEntity* this) {
} else {
super->timer = 0x18;
}
- if ((gPlayerState.flags & 0x80) == 0) {
+ if ((gPlayerState.flags & PL_MINISH) == 0) {
super->timer += 0x10;
}
sub_0808FF50(this);
@@ -213,7 +213,7 @@ void sub_0808FD44(PushableFurnitureEntity* this, u32 param_2) {
} else {
tmp = this->unk_70;
}
- if ((gPlayerState.flags & 0x80) != 0) {
+ if ((gPlayerState.flags & PL_MINISH) != 0) {
super->speed = 0x40;
super->timer = 0x20;
} else {
@@ -222,7 +222,7 @@ void sub_0808FD44(PushableFurnitureEntity* this, u32 param_2) {
}
} else {
tmp = this->unk_7c;
- if ((gPlayerState.flags & 0x80) != 0) {
+ if ((gPlayerState.flags & PL_MINISH) != 0) {
super->speed = 0x40;
super->timer = 0x40;
} else {
@@ -271,7 +271,7 @@ void sub_0808FDE8(PushableFurnitureEntity* this) {
bool32 sub_0808FECC(PushableFurnitureEntity* this) {
bool32 result = TRUE;
- if (!((gPlayerState.flags & 0x80) == 0 && (gPlayerEntity.action == 6) && (gPlayerEntity.animationState == 0) &&
+ if (!((gPlayerState.flags & PL_MINISH) == 0 && (gPlayerEntity.action == 6) && (gPlayerEntity.animationState == 0) &&
(gPlayerEntity.y.HALF.HI - super->y.HALF.HI < 0x14) && (super->x.HALF.HI + 0xc > gPlayerEntity.x.HALF.HI) &&
(super->x.HALF.HI - 12 < gPlayerEntity.x.HALF.HI))) {
result = FALSE;
diff --git a/src/playerItem/playerItemSword.c b/src/playerItem/playerItemSword.c
index 21b2ee13..6a0bd260 100644
--- a/src/playerItem/playerItemSword.c
+++ b/src/playerItem/playerItemSword.c
@@ -98,7 +98,7 @@ void sub_080A78B8(PlayerItemSwordEntity* this, Entity* param_2) {
super->knockbackDirection = 0;
super->iframes = 0;
}
- if ((gPlayerState.flags & 0x8000000) != 0) {
+ if ((gPlayerState.flags & PL_SWORD_THRUST) != 0) {
gPlayerState.sword_state |= 0x80;
} else if (gPlayerState.sword_state != 0) {
switch (super->contactFlags & 0x7f) {
diff --git a/src/playerUtils.c b/src/playerUtils.c
index c8af20b5..2e5da41e 100644
--- a/src/playerUtils.c
+++ b/src/playerUtils.c
@@ -51,7 +51,7 @@ void* sub_08077C54(ItemBehavior*);
u32 sub_08079FD4(Entity*, u32);
void LoadRoomGfx(void);
u32 sub_0807A094(u32);
-u32 GetSurfaceCalcType(Entity*, u32, u32);
+u32 GetSurfaceCalcType(Entity*, s32, s32);
void sub_0807AAF8(Entity*, u32);
extern struct_0811BE48 gUnk_0811BE48[];
@@ -78,6 +78,20 @@ bool32 sub_0807BF88(u32, u32, RoomResInfo*);
void sub_0807BFD0(void);
+void ForceSetPlayerState(u32 framestate);
+struct_03003DF8* sub_080784E4(void);
+
+extern const u16 gUnk_0811C0F8[];
+
+u32 sub_08079778(void);
+u32 sub_0807A500(void);
+
+extern const u16 gUnk_0811C108[];
+
+extern const u16 gUnk_0811C110[];
+
+extern const u16 gUnk_08007CAC[];
+
void sub_08077698(PlayerEntity* this) {
ItemBehavior* puVar2;
u32 idx;
@@ -140,7 +154,7 @@ NONMATCH("asm/non_matching/playerUtils/sub_080777A0.inc", bool32 sub_080777A0(vo
return TRUE;
}
} else if ((((gUnk_0200AF00.unk_2c == 0xc) && (gPlayerState.field_0x1c == 0)) &&
- (gPlayerState.floor_type != 0x11)) &&
+ (gPlayerState.floor_type != SURFACE_SWAMP)) &&
((((gPlayerState.field_0x90 & 0xf00) != 0 &&
((gPlayerState.flags & (PL_BURNING | PL_ROLLING)) == 0)) &&
((gPlayerState.jump_status == 0 && (gPlayerState.field_0x3[1] == 0)))))) {
@@ -209,7 +223,7 @@ ItemBehavior* sub_0807794C(u32 param_1) {
(((gPlayerState.flags & (PL_ROLLING | PL_CLONING)) != 0 && (6 < param_1)))) ||
((((gPlayerState.jump_status != 0 || (gPlayerEntity.z.WORD != 0)) && (6 < param_1)) ||
(((gPlayerState.flags & PL_MINISH) != 0 && (gUnk_0811BE48[param_1].unk6[2] == 0)))))) ||
- ((gPlayerState.floor_type == 0x11 && ((gPlayerState.field_0x37 != 0 && (1 < param_1 - 0x14)))))) {
+ ((gPlayerState.floor_type == SURFACE_SWAMP && ((gPlayerState.field_0x37 != 0 && (1 < param_1 - 0x14)))))) {
return NULL;
} else {
u32 tmp = gUnk_0811BE48[param_1].unk0[2];
@@ -701,14 +715,103 @@ void ForceSetPlayerState(u32 framestate) {
ASM_FUNC("asm/non_matching/playerUtils/sub_08078180.inc", void sub_08078180())
-ASM_FUNC("asm/non_matching/playerUtils/sub_080782C0.inc", u32 sub_080782C0())
+bool32 sub_080782C0(void) {
+ u8 tmp;
+ Entity* entity;
+
+ if (gPlayerState.framestate == 0) {
+ tmp = gPlayerState.framestate_last;
+ } else {
+ tmp = gPlayerState.framestate;
+ }
+ switch (tmp) {
+ case 2:
+ case 3:
+ case 0xc:
+ case 0x12:
+ case 0x15:
+ case 0x16:
+ return FALSE;
+ }
+ if ((gPlayerState.field_0x27[0] | gPlayerState.swim_state) != 0) {
+ return FALSE;
+ }
+ if (gPlayerState.floor_type == SURFACE_PIT) {
+ if (gPlayerState.field_0x14 == 0) {
+ return FALSE;
+ }
+ if (CanDispEzloMessage()) {
+ return TRUE;
+ }
+ return FALSE;
+ }
+ if ((gPlayerState.flags & PL_DRUGGED) != 0) {
+ return FALSE;
+ }
+ if (CanDispEzloMessage()) {
+ return TRUE;
+ }
+ entity = sub_080784E4()->entity;
+ if (entity == NULL) {
+ return FALSE;
+ }
+ if (gPlayerState.heldObject != 0) {
+ if (gPlayerState.heldObject != 4) {
+ return FALSE;
+ }
+ if ((gNewPlayerEntity.unk_74)->child->kind != OBJECT || (gNewPlayerEntity.unk_74)->child->id != SHOP_ITEM) {
+ return FALSE;
+ }
+ }
+ if (((gPlayerState.field_0x92 & 0x1000) != 0) && ((u8)(gUnk_03003DF0.unk_4[3] - 1) < 100)) {
+ sub_0801E738(0);
+ if (gSave.unk12B[0] != 0) {
+ gUnk_03003DF0.unk_2 = gUnk_03003DF0.unk_4[3];
+ *(u8*)(*(int*)(gUnk_03003DF0.unk_4 + 8) + 0x39) = 2;
+ gPlayerState.queued_action = 7;
+ } else {
+ CreateEzloHint(0xb65, 0);
+ }
+ ForceSetPlayerState(0x13);
+ return TRUE;
+ }
+ if ((gPlayerState.field_0x92 & 0x88) == 0) {
+ return FALSE;
+ }
+ switch (gUnk_03003DF0.unk_4[1]) {
+ default:
+ case 0:
+ return TRUE;
+ case 1:
+ case 6:
+ case 9:
+ case 0xa:
+ gPlayerState.queued_action = 7;
+ ForceSetPlayerState(0x13);
+ case 3:
+ case 5:
+ case 7:
+ entity->interactType = 1;
+ gUnk_03003DF0.unk_2 = 0;
+ return TRUE;
+ case 8:
+ if (gRoomVars.shopItemType == 0) {
+ entity->interactType = 1;
+ gRoomVars.shopItemType = entity->type;
+ gRoomVars.shopItemType2 = entity->type2;
+ return TRUE;
+ }
+ return FALSE;
+ }
+ return TRUE;
+}
void sub_080784C8(void) {
MemClear(&gUnk_03003DF0, 0x188);
gUnk_03003DF0.unk_4 = (u8*)gUnk_0811C000;
}
-ASM_FUNC("asm/non_matching/playerUtils/sub_080784E4.inc", void sub_080784E4())
+ASM_FUNC("asm/non_matching/playerUtils/sub_080784E4.inc", struct_03003DF8* sub_080784E4(void))
void sub_08078778(Entity* ent) {
sub_0807887C(ent, 1, 0);
@@ -927,7 +1030,7 @@ void ClearPlayerState(void) {
gPlayerState.field_0xd = 0;
gPlayerState.field_0xe = 0;
gPlayerState.field_0x11 = 0;
- gPlayerState.floor_type = 0;
+ gPlayerState.floor_type = SURFACE_NORMAL;
gPlayerState.floor_type_last = 0;
gPlayerState.field_0x14 = 0;
gPlayerState.sword_state = 0;
@@ -1129,7 +1232,24 @@ void sub_080792BC(s32 speed, u32 direction, u32 field_0x38) {
ASM_FUNC("asm/non_matching/playerUtils/sub_080792D8.inc", void sub_080792D8())
-ASM_FUNC("asm/non_matching/playerUtils/sub_080793E4.inc", bool32 sub_080793E4(u32 a))
+bool32 sub_080793E4(u32 param_1) {
+ u32 tmp;
+ if (gPlayerState.swim_state == 0) {
+ tmp = gUnk_0811C0F8[gPlayerEntity.animationState >> 1];
+ } else {
+ tmp = gUnk_0811C0F8[gPlayerEntity.direction >> 2];
+ }
+ if (sub_08079778() && ((gPlayerState.field_0x90 & tmp) != 0)) {
+ if (param_1 != 0) {
+ if (!sub_080B1BA4(sub_0807A500(), gPlayerEntity.collisionLayer, param_1)) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
ASM_FUNC("asm/non_matching/playerUtils/RespawnPlayer.inc", void RespawnPlayer())
@@ -1181,15 +1301,59 @@ void sub_08079744(Entity* this) {
}
}
-ASM_FUNC("asm/non_matching/playerUtils/sub_08079778.inc", void sub_08079778())
+bool32 sub_08079778(void) {
+ u32 tmp;
+ if (gPlayerState.swim_state == 0) {
+ tmp = gUnk_0811C108[gPlayerEntity.animationState >> 1];
+ } else {
+ tmp = gUnk_0811C108[gPlayerEntity.direction >> 2];
+ }
+ return tmp == (gPlayerEntity.collisions & tmp);
+}
-ASM_FUNC("asm/non_matching/playerUtils/sub_080797C4.inc", u32 sub_080797C4(void))
+u32 sub_080797C4(void) {
+ u32 tmp = gUnk_0811C110[gPlayerEntity.direction >> 3];
+ return tmp == (gPlayerEntity.collisions & tmp);
+}
ASM_FUNC("asm/non_matching/playerUtils/sub_080797EC.inc", void sub_080797EC())
ASM_FUNC("asm/non_matching/playerUtils/ResolvePlayerAnimation.inc", void ResolvePlayerAnimation())
-ASM_FUNC("asm/non_matching/playerUtils/sub_08079B24.inc", u32 sub_08079B24())
+bool32 sub_08079B24(void) {
+ if ((gPlayerEntity.action != PLAYER_MINISHDIE) && (gPlayerEntity.health == 0)) {
+ gPlayerState.flags &= ~PL_PARACHUTE;
+ gPlayerEntity.knockbackDuration = gPlayerEntity.health;
+ if (gPlayerState.field_0x7 == 0) {
+ if (gPlayerState.swim_state != 0) {
+ RespawnPlayer();
+ } else {
+ if ((gPlayerState.field_0x14 == 0) && ((gPlayerState.flags & PL_IN_MINECART) == 0)) {
+ if (gPlayerEntity.z.HALF.HI < 0) {
+ if (gPlayerEntity.zVelocity > 0) {
+ gPlayerEntity.zVelocity = 0;
+ }
+ if ((gPlayerState.jump_status & 0x41) == 0) {
+ gPlayerState.jump_status = 0x41;
+ gPlayerEntity.direction = 0xff;
+ gPlayerState.field_0xd = 0xff;
+ return TRUE;
+ } else {
+ return TRUE;
+ }
+ }
+ if (((gPlayerState.flags & PL_FLAGS2) == 0) && (sub_08079D48() == 0)) {
+ gPlayerState.field_0xa |= 0x10;
+ return TRUE;
+ }
+ }
+ }
+ gPlayerEntity.flags &= ~ENT_COLLIDE;
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
void sub_08079BD8(Entity* this) {
this->x = gPlayerEntity.x;
@@ -1337,7 +1501,28 @@ void UpdateFloorType(void) {
gUnk_0811C120[gPlayerState.floor_type](&gPlayerEntity);
}
-ASM_FUNC("asm/non_matching/playerUtils/GetSurfaceCalcType.inc", u32 GetSurfaceCalcType(Entity* a, u32 b, u32 c))
+u32 GetSurfaceCalcType(Entity* param_1, s32 x, s32 y) {
+ u32 position = TILE(param_1->x.HALF.HI + (u32)x, param_1->y.HALF.HI + y);
+ u32 tileType = GetTileTypeByPos(param_1->x.HALF.HI + x, param_1->y.HALF.HI + y, gPlayerEntity.collisionLayer);
+ if (tileType != gPlayerState.field_0x22[1]) {
+ gPlayerState.field_0x37 = 0;
+ }
+ if ((tileType != gPlayerState.field_0x22[1]) || (position != gPlayerState.field_0x22[0])) {
+ gPlayerState.field_0x22[0] = position;
+ gPlayerState.field_0x22[1] = tileType;
+ gPlayerState.field_0x11 = 0;
+ }
+
+ if (gPlayerState.field_0x11 != 0xff) {
+ gPlayerState.field_0x11++;
+ }
+ if (gPlayerState.field_0x37 != 0xff) {
+ gPlayerState.field_0x37++;
+ }
+ gPlayerState.floor_type_last = gPlayerState.floor_type;
+ tileType = GetRelativeCollisionTile(param_1, x, y);
+ return sub_08007DD6(tileType, (u16*)gUnk_08007CAC);
+}
void EnablePlayerDraw(Entity* this) {
this->type2 = 0;
@@ -1358,7 +1543,7 @@ bool32 sub_0807A2B8(void) {
ASM_FUNC("asm/non_matching/playerUtils/sub_0807A2F8.inc", u32 sub_0807A2F8(u32 a1))
-ASM_FUNC("asm/non_matching/playerUtils/sub_0807A500.inc", void sub_0807A500())
+ASM_FUNC("asm/non_matching/playerUtils/sub_0807A500.inc", u32 sub_0807A500())
ASM_FUNC("asm/non_matching/playerUtils/sub_0807A5B8.inc", void sub_0807A5B8(u32 a))
diff --git a/src/projectile/gyorgTail.c b/src/projectile/gyorgTail.c
index d743cf40..ddd0fcb9 100644
--- a/src/projectile/gyorgTail.c
+++ b/src/projectile/gyorgTail.c
@@ -188,7 +188,35 @@ END_NONMATCH
ASM_FUNC("asm/non_matching/gyorgTail/sub_080AC6F0.inc", void sub_080AC6F0(Entity* this))
-ASM_FUNC("asm/non_matching/gyorgTail/sub_080AC760.inc", void sub_080AC760(Entity* this))
+void sub_080AC760(Entity* param_1) {
+ s32 tmp;
+ Entity* entity1;
+ Entity* entity2;
+
+ entity1 = param_1->child;
+ tmp = (entity1->direction - param_1->direction) & 0xff;
+ if (((tmp + 8) & 0xff) > 0x10) {
+ if (tmp > 0x80) {
+ entity1->direction = param_1->direction - 8;
+ } else {
+ entity1->direction = param_1->direction + 8;
+ }
+ }
+ entity2 = entity1->child;
+ if (entity2->child == NULL) {
+ entity2->direction = param_1->parent->animationState ^ 0x80;
+ } else {
+ tmp = (entity2->direction - entity1->direction) & 0xff;
+ if (((tmp + 8) & 0xff) <= 0x10) {
+ return;
+ }
+ if (tmp > 0x80) {
+ entity2->direction = entity1->direction - 8;
+ } else {
+ entity2->direction = entity1->direction + 8;
+ }
+ }
+}
NONMATCH("asm/non_matching/gyorgTail/sub_080AC7C4.inc", void sub_080AC7C4(Entity* this)) {
// TODO regalloc
diff --git a/src/scroll.c b/src/scroll.c
index 6a1e8673..8f83d4c9 100644
--- a/src/scroll.c
+++ b/src/scroll.c
@@ -54,6 +54,8 @@ void sub_08080B60(u8*);
extern u8 gMapDataTopSpecial[];
+extern const void (*const gUnk_0811E7C4[])(int);
+
void UpdateScroll(void) {
static void (*const gUnk_0811E768[])(RoomControls*) = {
sub_0807FC64, sub_0807FC7C, sub_0807FDB0, NULL, sub_0807FEF0, sub_0807FF54,
@@ -363,7 +365,30 @@ ASM_FUNC("asm/non_matching/scroll/sub_08080794.inc", void sub_08080794())
ASM_FUNC("asm/non_matching/scroll/sub_08080808.inc", void sub_08080808())
-ASM_FUNC("asm/non_matching/scroll/DoExitTransition.inc", void DoExitTransition(const ScreenTransitionData* data))
+void DoExitTransition(const ScreenTransitionData* data) {
+ PlayerRoomStatus* status;
+ gRoomTransition.transitioningOut = 1;
+ status = &gRoomTransition.player_status;
+ if ((u16)data->playerXPos <= 0x3ff) {
+ status->start_pos_x = data->playerXPos;
+ } else {
+ status->start_pos_x = (gRoomControls.camera_target)->x.HALF.HI | 0x8000;
+ }
+ if ((u16)data->playerYPos <= 0x3ff) {
+ status->start_pos_y = data->playerYPos;
+ } else {
+ status->start_pos_y = (gRoomControls.camera_target)->y.HALF.HI | 0x8000;
+ }
+ status->area_next = data->area;
+ status->room_next = data->room;
+ status->layer = data->playerLayer;
+ status->spawn_type = data->field_0xe;
+ status->start_anim = data->playerState;
+ if (data->transitionSFX != SFX_NONE) {
+ SoundReq(data->transitionSFX);
+ }
+ gUnk_0811E7C4[data->type](data->field_0xa);
+}
void sub_080808D8(void) {
gRoomTransition.type = TRANSITION_DEFAULT;
diff --git a/src/subtask2.c b/src/subtask2.c
index 9717352c..e6cc5f44 100644
--- a/src/subtask2.c
+++ b/src/subtask2.c
@@ -364,7 +364,7 @@ void sub_080A5B34(void) {
}
if (bVar1) {
if (uVar3 == 0) {
- SetFade(7, 0x20);
+ SetFade(FADE_IN_OUT | FADE_BLACK_WHITE | FADE_INSTANT, 0x20);
gMenu.transitionTimer = 0x3c;
SetMenuType(2);
} else {
@@ -698,7 +698,7 @@ void sub_080A6378(void) {
if ((gGenericMenu.unk2c & 0x20) == 0) {
gOamCmd.x = gRoomTransition.player_status.overworld_map_x * 0xa0 / 0xf90 + 0x28;
gOamCmd.y = (gRoomTransition.player_status.overworld_map_y << 7) / 0xc60 + 0xc;
- if ((gPlayerState.flags & 8) != 0) {
+ if ((gPlayerState.flags & PL_NO_CAP) != 0) {
frameIndex = 0x5a;
} else {
frameIndex = 0x59;
@@ -773,7 +773,7 @@ void sub_080A6534(void) {
gGenericMenu.unk10.h[0] = 0;
gMenu.transitionTimer = 0x3c;
SetMenuType(1);
- SetFade(4, 8);
+ SetFade(FADE_INSTANT, 8);
}
void sub_080A65AC(void) {