diff --git a/asm/enemy/chuchuBoss.s b/asm/enemy/chuchuBoss.s index 0cf40833..37000057 100644 --- a/asm/enemy/chuchuBoss.s +++ b/asm/enemy/chuchuBoss.s @@ -84,7 +84,7 @@ _08025D28: strb r3, [r1] adds r2, #0x45 strb r3, [r2] - ldr r0, _08025D80 @ =gUnk_02034490 + ldr r0, _08025D80 @ =gPauseMenuOptions strb r3, [r0] movs r0, #0x94 lsls r0, r0, #1 @@ -93,7 +93,7 @@ _08025D28: bl GenericDeath b _08025D9C .align 2, 0 -_08025D80: .4byte gUnk_02034490 +_08025D80: .4byte gPauseMenuOptions _08025D84: lsls r0, r1, #0x18 lsrs r0, r0, #0x18 @@ -746,7 +746,7 @@ _08026268: thumb_func_start sub_0802626C sub_0802626C: @ 0x0802626C push {lr} - ldr r2, _0802629C @ =gUnk_02034490 + ldr r2, _0802629C @ =gPauseMenuOptions movs r1, #1 strb r1, [r2] ldr r2, _080262A0 @ =gUnk_080CC20C @@ -768,7 +768,7 @@ sub_0802626C: @ 0x0802626C _08026298: pop {pc} .align 2, 0 -_0802629C: .4byte gUnk_02034490 +_0802629C: .4byte gPauseMenuOptions _080262A0: .4byte gUnk_080CC20C _080262A4: .4byte gPlayerEntity @@ -1146,14 +1146,14 @@ sub_0802653C: @ 0x0802653C ldr r0, [r4, #0x54] movs r1, #0 bl InitAnimationForceUpdate - ldr r0, _0802657C @ =gUnk_02034490 + ldr r0, _0802657C @ =gPauseMenuOptions strb r5, [r0] _08026572: add sp, #4 pop {r4, r5, pc} .align 2, 0 _08026578: .4byte gRoomControls -_0802657C: .4byte gUnk_02034490 +_0802657C: .4byte gPauseMenuOptions thumb_func_start sub_08026580 sub_08026580: @ 0x08026580 @@ -3355,7 +3355,7 @@ _08027428: ldr r0, _0802744C @ =gRoomControls ldr r2, [r6, #0x54] str r2, [r0, #0x30] - ldr r1, _08027450 @ =gUnk_02034490 + ldr r1, _08027450 @ =gPauseMenuOptions movs r0, #1 strb r0, [r1] movs r0, #9 @@ -3369,7 +3369,7 @@ _08027444: b _08027484 .align 2, 0 _0802744C: .4byte gRoomControls -_08027450: .4byte gUnk_02034490 +_08027450: .4byte gPauseMenuOptions _08027454: ldr r5, [r6, #0x48] adds r0, r6, #0 diff --git a/asm/non_matching/itemBomb/sub_08076088.inc b/asm/non_matching/itemBomb/sub_08076088.inc index b5f733df..bd3321f2 100644 --- a/asm/non_matching/itemBomb/sub_08076088.inc +++ b/asm/non_matching/itemBomb/sub_08076088.inc @@ -104,7 +104,7 @@ _0807614A: bne _08076162 adds r0, r4, #0 adds r1, r5, #0 - bl sub_08077F50 + bl PlayerCancelHoldItem b _080761A0 _08076162: ldr r1, _08076194 @ =gPlayerEntity diff --git a/asm/non_matching/itemTryPickupObject/ItemPickupCheck.inc b/asm/non_matching/itemTryPickupObject/ItemPickupCheck.inc index 8b0b2e23..45c5a679 100644 --- a/asm/non_matching/itemTryPickupObject/ItemPickupCheck.inc +++ b/asm/non_matching/itemTryPickupObject/ItemPickupCheck.inc @@ -120,7 +120,7 @@ _080762B4: .4byte 0x00000948 _080762B8: adds r0, r4, #0 adds r1, r6, #0 - bl sub_08077F50 + bl PlayerCancelHoldItem _080762C0: pop {r4, r5, r6, pc} .align 2, 0 diff --git a/asm/non_matching/itemTryPickupObject/sub_080762D8.inc b/asm/non_matching/itemTryPickupObject/sub_080762D8.inc index 696ef580..203b0b11 100644 --- a/asm/non_matching/itemTryPickupObject/sub_080762D8.inc +++ b/asm/non_matching/itemTryPickupObject/sub_080762D8.inc @@ -9,7 +9,7 @@ strb r1, [r4, #5] adds r0, r5, #0 adds r1, r6, #0 - bl sub_08077F64 + bl PlayerTryDropItem cmp r0, #0 bne _080762F6 b _08076486 @@ -79,7 +79,7 @@ _0807636C: _08076376: adds r0, r5, #0 adds r1, r6, #0 - bl sub_08077F50 + bl PlayerCancelHoldItem b _08076486 _08076380: adds r0, r3, #0 @@ -213,7 +213,7 @@ _08076476: _0807647E: adds r0, r5, #0 adds r1, r6, #0 - bl sub_08077F50 + bl PlayerCancelHoldItem _08076486: pop {r4, r5, r6, r7, pc} .syntax divided diff --git a/asm/non_matching/itemTryPickupObject/sub_08076518.inc b/asm/non_matching/itemTryPickupObject/sub_08076518.inc index 696b2d1e..46aaa4e5 100644 --- a/asm/non_matching/itemTryPickupObject/sub_08076518.inc +++ b/asm/non_matching/itemTryPickupObject/sub_08076518.inc @@ -4,7 +4,7 @@ push {r7} adds r4, r0, #0 mov r8, r1 - bl sub_08077F64 + bl PlayerTryDropItem cmp r0, #0 beq _080765D4 ldr r5, _0807655C @ =gPlayerState @@ -28,7 +28,7 @@ beq _08076564 adds r0, r4, #0 mov r1, r8 - bl sub_08077F50 + bl PlayerCancelHoldItem b _080765D4 .align 2, 0 _0807655C: .4byte gPlayerState diff --git a/asm/non_matching/ocarina/OcarinaUpdate.inc b/asm/non_matching/ocarina/OcarinaUpdate.inc index b6d19673..5a46f81b 100644 --- a/asm/non_matching/ocarina/OcarinaUpdate.inc +++ b/asm/non_matching/ocarina/OcarinaUpdate.inc @@ -21,7 +21,7 @@ str r1, [r2, #0x30] adds r2, #0x27 strb r4, [r2] - ldr r1, _08076C7C @ =gUnk_02034490 + ldr r1, _08076C7C @ =gPauseMenuOptions strb r4, [r1] bl CreateBird bl ResetPlayerEventPriority @@ -34,5 +34,5 @@ _08076C6E: _08076C70: .4byte gPlayerEntity _08076C74: .4byte gPlayerState _08076C78: .4byte 0xEFFFFFFF -_08076C7C: .4byte gUnk_02034490 +_08076C7C: .4byte gPauseMenuOptions .syntax divided diff --git a/asm/non_matching/playerItem13/sub_080ACFCC.inc b/asm/non_matching/playerItem13/sub_080ACFCC.inc index 4334f0a5..429d6063 100644 --- a/asm/non_matching/playerItem13/sub_080ACFCC.inc +++ b/asm/non_matching/playerItem13/sub_080ACFCC.inc @@ -17,7 +17,7 @@ _080ACFE8: ldrb r0, [r1, #0xc] cmp r0, #2 beq _080ACFF8 - bl sub_08079184 + bl PlayerDropHeldObject bl DeleteThisEntity b _080AD03C _080ACFF8: @@ -51,7 +51,7 @@ _080AD00E: _080AD02C: .4byte gPlayerState _080AD030: .4byte gPlayerEntity _080AD034: - bl sub_08079184 + bl PlayerDropHeldObject bl DeleteThisEntity _080AD03C: pop {r4, pc} diff --git a/asm/non_matching/playerItem13/sub_080AD27C.inc b/asm/non_matching/playerItem13/sub_080AD27C.inc index 1c31dc1d..021b3773 100644 --- a/asm/non_matching/playerItem13/sub_080AD27C.inc +++ b/asm/non_matching/playerItem13/sub_080AD27C.inc @@ -81,7 +81,7 @@ _080AD2C2: _080AD318: .4byte gUnk_081320CC _080AD31C: .4byte gUnk_081320D4 _080AD320: - bl sub_08079184 + bl PlayerDropHeldObject bl DeleteThisEntity _080AD328: pop {r4, r5, pc} diff --git a/asm/non_matching/playerUtils/RespawnPlayer.inc b/asm/non_matching/playerUtils/RespawnPlayer.inc index e783d28b..79e407cc 100644 --- a/asm/non_matching/playerUtils/RespawnPlayer.inc +++ b/asm/non_matching/playerUtils/RespawnPlayer.inc @@ -9,7 +9,7 @@ adds r0, r4, #0 adds r0, #0x42 strb r1, [r0] - bl sub_08078EE4 + bl ResetPlayerPosition ldr r2, _0807949C @ =gPlayerState ldr r1, [r2, #0x30] movs r0, #0x80 diff --git a/asm/non_matching/playerUtils/sub_080792D8.inc b/asm/non_matching/playerUtils/sub_080792D8.inc index 7d6186df..18b746ba 100644 --- a/asm/non_matching/playerUtils/sub_080792D8.inc +++ b/asm/non_matching/playerUtils/sub_080792D8.inc @@ -109,7 +109,7 @@ _08079374: ldrb r0, [r4, #2] cmp r0, #0 bne _080793CA - bl ResetPlayer + bl ResetPlayerItem ldr r0, [r4, #0x30] movs r1, #8 ands r0, r1 diff --git a/asm/non_matching/subtask2/sub_080A5A90.inc b/asm/non_matching/subtask2/sub_080A5A90.inc index 03c9de07..9600a2a3 100644 --- a/asm/non_matching/subtask2/sub_080A5A90.inc +++ b/asm/non_matching/subtask2/sub_080A5A90.inc @@ -24,7 +24,7 @@ _080A5AA8: .align 2, 0 _080A5ABC: .4byte gInput _080A5AC0: - ldr r0, _080A5AD4 @ =gUnk_02034490 + ldr r0, _080A5AD4 @ =gPauseMenuOptions ldrb r0, [r0, #1] movs r1, #1 cmp r0, #0xa @@ -36,5 +36,5 @@ _080A5ACC: _080A5AD2: pop {pc} .align 2, 0 -_080A5AD4: .4byte gUnk_02034490 +_080A5AD4: .4byte gPauseMenuOptions .syntax divided diff --git a/asm/non_matching/subtask2/sub_080A5BB8.inc b/asm/non_matching/subtask2/sub_080A5BB8.inc index b1778bc3..da36b8c5 100644 --- a/asm/non_matching/subtask2/sub_080A5BB8.inc +++ b/asm/non_matching/subtask2/sub_080A5BB8.inc @@ -14,7 +14,7 @@ bl SetFade movs r0, #2 bl sub_080A4E84 - ldr r1, _080A5BEC @ =gUnk_02034490 + ldr r1, _080A5BEC @ =gPauseMenuOptions movs r0, #0x10 strb r0, [r1, #0x16] _080A5BE2: @@ -22,5 +22,5 @@ _080A5BE2: .align 2, 0 _080A5BE4: .4byte gFadeControl _080A5BE8: .4byte gMain -_080A5BEC: .4byte gUnk_02034490 +_080A5BEC: .4byte gPauseMenuOptions .syntax divided diff --git a/asm/non_matching/subtask2/sub_080A6650.inc b/asm/non_matching/subtask2/sub_080A6650.inc index fc42e7f5..d4c80a7f 100644 --- a/asm/non_matching/subtask2/sub_080A6650.inc +++ b/asm/non_matching/subtask2/sub_080A6650.inc @@ -2,7 +2,7 @@ push {lr} ldr r0, _080A6670 @ =gUnk_08128E84 bl sub_080A70AC - ldr r0, _080A6674 @ =gUnk_02034490 + ldr r0, _080A6674 @ =gPauseMenuOptions ldrb r0, [r0, #6] ldr r1, _080A6678 @ =gMenu strb r0, [r1, #3] @@ -13,6 +13,6 @@ pop {pc} .align 2, 0 _080A6670: .4byte gUnk_08128E84 -_080A6674: .4byte gUnk_02034490 +_080A6674: .4byte gPauseMenuOptions _080A6678: .4byte gMenu .syntax divided diff --git a/data/scripts/castorWilds/script_GreatFairyRupees.inc b/data/scripts/castorWilds/script_GreatFairyRupees.inc index 9ab8427f..5dea3e4d 100644 --- a/data/scripts/castorWilds/script_GreatFairyRupees.inc +++ b/data/scripts/castorWilds/script_GreatFairyRupees.inc @@ -8,7 +8,7 @@ script_0800B6CC: script_0800B6D4: CheckPlayerInRegion 0x0078, 0x00b8, 0x1060 JumpIfNot script_0800B6D4 - Call sub_08079184 + Call PlayerDropHeldObject SetPlayerIdle Call WaitForPlayerNormal StartPlayerScript script_PlayerAtGreatFairy diff --git a/data/scripts/castorWilds/script_PlayerAtDarknutFight.inc b/data/scripts/castorWilds/script_PlayerAtDarknutFight.inc index 1c974574..c09e6ed0 100644 --- a/data/scripts/castorWilds/script_PlayerAtDarknutFight.inc +++ b/data/scripts/castorWilds/script_PlayerAtDarknutFight.inc @@ -13,5 +13,5 @@ SCRIPT_START script_PlayerAtDarknutFight LoadRoomEntityList gUnk_080DA260 Wait 0x001e SetSyncFlag 0x00000001 - Call sub_0807921C + Call PlayerSetNormalAndCollide SCRIPT_END diff --git a/data/scripts/cutscene/intro/script_Object69Intro.inc b/data/scripts/cutscene/intro/script_Object69Intro.inc index 1e643580..9fe815c9 100644 --- a/data/scripts/cutscene/intro/script_Object69Intro.inc +++ b/data/scripts/cutscene/intro/script_Object69Intro.inc @@ -12,5 +12,5 @@ SCRIPT_START script_Object69Intro SetGlobalFlag 0x001c Call sub_0807DF50 EnablePlayerControl - Call sub_0807921C + Call PlayerSetNormalAndCollide SCRIPT_END diff --git a/data/scripts/graveyard/script_GreatFairyArrows.inc b/data/scripts/graveyard/script_GreatFairyArrows.inc index c032efd8..24b6ba6f 100644 --- a/data/scripts/graveyard/script_GreatFairyArrows.inc +++ b/data/scripts/graveyard/script_GreatFairyArrows.inc @@ -5,7 +5,7 @@ SCRIPT_START script_GreatFairyArrows script_0800B618: CheckPlayerInRegion 0x0078, 0x00b8, 0x1060 JumpIfNot script_0800B618 - Call sub_08079184 + Call PlayerDropHeldObject SetPlayerIdle Call WaitForPlayerNormal StartPlayerScript script_PlayerAtGreatFairy diff --git a/data/scripts/hyruleTown/script_PlayerAtCarlov.inc b/data/scripts/hyruleTown/script_PlayerAtCarlov.inc index 68bd0226..1b37c9d3 100644 --- a/data/scripts/hyruleTown/script_PlayerAtCarlov.inc +++ b/data/scripts/hyruleTown/script_PlayerAtCarlov.inc @@ -7,5 +7,5 @@ SCRIPT_START script_PlayerAtCarlov DoPostScriptAction 0x0000 Wait 0x0010 SetSyncFlag 0x00000001 - Call sub_0807921C + Call PlayerSetNormalAndCollide SCRIPT_END diff --git a/data/scripts/hyruleTown/script_PlayerWhenLeavingCarlovAlreadyPaid.inc b/data/scripts/hyruleTown/script_PlayerWhenLeavingCarlovAlreadyPaid.inc index be67e071..9e17ee23 100644 --- a/data/scripts/hyruleTown/script_PlayerWhenLeavingCarlovAlreadyPaid.inc +++ b/data/scripts/hyruleTown/script_PlayerWhenLeavingCarlovAlreadyPaid.inc @@ -7,5 +7,5 @@ SCRIPT_START script_PlayerWhenLeavingCarlovAlreadyPaid DoPostScriptAction 0x0000 Wait 0x0010 SetSyncFlag 0x00000002 - Call sub_0807921C + Call PlayerSetNormalAndCollide SCRIPT_END diff --git a/data/scripts/lonLonRanch/script_MalonLostKey.inc b/data/scripts/lonLonRanch/script_MalonLostKey.inc index 664c68c2..07d170b8 100644 --- a/data/scripts/lonLonRanch/script_MalonLostKey.inc +++ b/data/scripts/lonLonRanch/script_MalonLostKey.inc @@ -40,7 +40,7 @@ script_0800B4F0: Wait 0x001e SetSyncFlag 0x00000010 SetGlobalFlag 0x001d - Call sub_0807921C + Call PlayerSetNormalAndCollide EnablePlayerControl Call sub_0807FBCC DoPostScriptAction 0x0006 diff --git a/data/scripts/mtCrenel/script_GreatFairyBombs.inc b/data/scripts/mtCrenel/script_GreatFairyBombs.inc index bfde8c90..828ff5c0 100644 --- a/data/scripts/mtCrenel/script_GreatFairyBombs.inc +++ b/data/scripts/mtCrenel/script_GreatFairyBombs.inc @@ -5,7 +5,7 @@ SCRIPT_START script_GreatFairyBombs script_0800B734: Call sub_0808747C JumpIfNot script_0800B734 - Call sub_08079184 + Call PlayerDropHeldObject SetPlayerIdle Wait 0x000a Call WaitForPlayerNormal diff --git a/include/area.h b/include/area.h index e1648f8c..e6e749d7 100644 --- a/include/area.h +++ b/include/area.h @@ -34,13 +34,13 @@ typedef struct { u8 unk_0c_4 : 4; u8 filler3[2]; u16 field_0x10; - u16 curPortalX; - u16 curPortalY; - u8 curPortalExitDirection; - u8 curPortalType; - u8 field_0x18; + u16 portal_x; + u16 portal_y; + u8 portal_exit_dir; + u8 portal_type; + u8 portal_mode; // u8 filler3[7]; - bool8 playShrinkSeq; + bool8 portal_in_use; u8 unk1A; u8 filler2[13]; u8 inventoryGfxIdx; diff --git a/include/functions.h b/include/functions.h index acfa617d..c2ded725 100644 --- a/include/functions.h +++ b/include/functions.h @@ -187,7 +187,7 @@ extern bool32 sub_08077EC8(ItemBehavior*); extern bool32 sub_08077EFC(ItemBehavior*); extern bool32 sub_08077F10(ItemBehavior*); extern bool32 sub_08077F24(ItemBehavior*, u32); -extern void sub_08077F50(ItemBehavior*, u32); +extern void PlayerCancelHoldItem(ItemBehavior*, u32); extern bool32 sub_08077FEC(u32); extern void sub_08078180(void); extern void sub_080784C8(); @@ -204,8 +204,8 @@ extern void sub_08078AC0(u32, u32, u32); extern void sub_08078B48(void); extern void sub_08078E84(Entity*, Entity*); extern void sub_08078FB0(Entity*); -extern void sub_08079184(); -extern void sub_0807919C(); +extern void PlayerDropHeldObject(); +extern void PlayerResetStateFromFusion(); extern void sub_080792BC(s32, u32, u32); extern u32 sub_0807953C(void); extern void sub_08079BD8(Entity*); @@ -246,7 +246,7 @@ extern void sub_080A2AF4(Entity*, s32, s32); extern void sub_080A2CC0(Entity*, u16**, u16*); extern void sub_080A57F4(void); extern void sub_080A71C4(u32, u32, u32, u32); -extern void sub_080A7C18(u32, u32, u32); +extern void InitItemGetSequence(u32, u32, u32); extern void sub_080ADD70(void); extern bool32 sub_080AE4CC(Entity*, u32, u32, u32); extern void sub_080AE58C(Entity*, u32, u32); diff --git a/include/player.h b/include/player.h index fdb3d2d8..6f00b872 100644 --- a/include/player.h +++ b/include/player.h @@ -316,9 +316,10 @@ extern Entity* gPlayerClones[]; extern PlayerState gPlayerState; extern Entity gPlayerEntity; +void DoPlayerAction(Entity*); bool32 CheckInitPauseMenu(void); void SetPlayerControl(PlayerControlMode mode); -void ResetPlayer(void); +void ResetPlayerItem(void); void ResetPlayerVelocity(void); void ResetPlayerAnimationAndAction(void); void SetPlayerActionNormal(void); @@ -342,21 +343,21 @@ void ModRupees(s32 delta); // playerUtils.c void DeleteClones(void); void sub_08077728(u32); -void sub_08077B20(void); +void PutAwayItems(void); void sub_08079E58(s32 speed, u32 direction); void RespawnPlayer(void); u32 GetSurfaceCalcType(Entity*, u32, u32); void UpdatePlayerMovement(void); void EnablePlayerDraw(Entity*); void sub_080797EC(void); -void sub_08079258(void); +void PlayerMinishSetNormalAndCollide(void); u32 sub_08079B24(void); void sub_08079708(Entity*); void sub_08079744(Entity*); void sub_0807AE20(Entity*); u32 sub_0807A894(Entity*); u32 sub_080797C4(void); -void sub_08078F24(void); +void CheckPlayerVelocity(void); void sub_0807B068(Entity*); u32 sub_0807A2F8(u32); void sub_08077698(/* PlayerEntity* */); @@ -365,14 +366,15 @@ u32 sub_08079550(void); u32 sub_080782C0(void); bool32 sub_080793E4(u32); bool32 sub_08079C30(Entity*); -void sub_08077AEC(void); +void ResetLantern(void); bool32 CheckQueuedAction(void); void UpdatePlayerSkills(void); u32 sub_0807AC54(Entity*); void sub_080792D8(void); u32 sub_08078F74(Entity*); void sub_0807879C(Entity*); -void sub_0807921C(); +void PlayerSetNormalAndCollide(void); +bool32 PlayerTryDropItem(ItemBehavior* arg0, u32 unk); // player.s extern u32 PlayerCheckNEastTile(); diff --git a/include/room.h b/include/room.h index 3ab02772..33f95d68 100644 --- a/include/room.h +++ b/include/room.h @@ -205,7 +205,7 @@ typedef enum { BIG_CHEST, BOMBABLE_WALL, SIGN, - TILE_ENTITY_6, + TILE_EZLO_HINT, MUSIC_SETTER, TILE_ENTITY_8, DARKNESS, diff --git a/include/structures.h b/include/structures.h index 00e83b72..7fc1210f 100644 --- a/include/structures.h +++ b/include/structures.h @@ -208,7 +208,7 @@ typedef struct { extern PriorityHandler gPriorityHandler; extern struct { - u8 unk0; + u8 disabled; u8 unk1; u8 unk2[0xf]; u8 unk11; @@ -218,8 +218,8 @@ extern struct { u8 unk15; s8 unk16; u8 unk17; -} gUnk_02034490; -static_assert(sizeof(gUnk_02034490) == 0x18); +} gPauseMenuOptions; +static_assert(sizeof(gPauseMenuOptions) == 0x18); typedef struct { u8 unk00 : 1; diff --git a/linker.ld b/linker.ld index 5ec81484..2792d15d 100644 --- a/linker.ld +++ b/linker.ld @@ -116,7 +116,7 @@ SECTIONS { . = 0x00034330; gUnk_02034330 = .; . = 0x00034350; gRoomVars = .; . = 0x00034480; gUnk_02034480 = .; - . = 0x00034490; gUnk_02034490 = .; + . = 0x00034490; gPauseMenuOptions = .; . = 0x00034492; gUnk_02034492 = .; . = 0x000344A0; gUnk_020344A0 = .; . = 0x000344B0; gBG2Buffer = .; diff --git a/src/collision.c b/src/collision.c index 6c4f9a5b..4e5337bf 100644 --- a/src/collision.c +++ b/src/collision.c @@ -550,7 +550,7 @@ s32 sub_08017F40(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) org->spriteOrientation.flipY = tgt->spriteOrientation.flipY; org->iframes = -1; tgt->iframes = -8; - ResetPlayer(); + ResetPlayerItem(); return 1; } } else { @@ -638,7 +638,7 @@ s32 sub_08018168(Entity* org, Entity* tgt, u32 direction, ColSettings* settings) gPlayerEntity.spriteOrientation.flipY = tgt->spriteOrientation.flipY; gPlayerEntity.iframes = 0xff; tgt->iframes = -8; - sub_08077B20(); + PutAwayItems(); return 1; } } else { diff --git a/src/enemy/bobomb.c b/src/enemy/bobomb.c index e47bf4e4..d8130a25 100644 --- a/src/enemy/bobomb.c +++ b/src/enemy/bobomb.c @@ -285,7 +285,7 @@ void sub_0802CBC4(Entity* this) { COLLISION_OFF(this); this->health = 0; if (this->field_0x82.HALF.HI) { - sub_08079184(); + PlayerDropHeldObject(); } FreeCarryEntity(this); diff --git a/src/enemy/cuccoAggr.c b/src/enemy/cuccoAggr.c index 5d2631df..c9993651 100644 --- a/src/enemy/cuccoAggr.c +++ b/src/enemy/cuccoAggr.c @@ -116,7 +116,7 @@ void sub_08038DD8(CuccoAggrEntity* this) { void sub_08038E18(CuccoAggrEntity* this) { if (super->field_0xf) { if (--super->field_0xf == 0) { - sub_08079184(); + PlayerDropHeldObject(); sub_08039218(this); COLLISION_ON(super); super->spritePriority.b1 = 1; diff --git a/src/enemy/ghini.c b/src/enemy/ghini.c index ab807ba0..5ffab6bf 100644 --- a/src/enemy/ghini.c +++ b/src/enemy/ghini.c @@ -390,7 +390,7 @@ void sub_0803F6EC(GhiniEntity* this) { } void sub_0803F738(GhiniEntity* this) { - ResetPlayer(); + ResetPlayerItem(); gPlayerState.mobility |= 0x80; gPlayerState.field_0xa |= 0x80; sub_0806FA90(&gPlayerEntity, super, 0, 1); diff --git a/src/enemy/gibdo.c b/src/enemy/gibdo.c index 611e2fcc..dd2ec640 100644 --- a/src/enemy/gibdo.c +++ b/src/enemy/gibdo.c @@ -175,7 +175,7 @@ void sub_08037690(GibdoEntity* this) { void sub_080376D0(GibdoEntity* this) { u8* x; if (sub_080379EC(this) == 0) { - ResetPlayer(); + ResetPlayerItem(); gPlayerState.mobility = gPlayerState.mobility | 0x80; gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80; CopyPositionAndSpriteOffset(&gPlayerEntity, super); diff --git a/src/enemy/gleerok.c b/src/enemy/gleerok.c index 95c2232c..d257fcea 100644 --- a/src/enemy/gleerok.c +++ b/src/enemy/gleerok.c @@ -125,7 +125,7 @@ void Gleerok_OnDeath(GleerokEntity* this) { void sub_0802D158(GleerokEntity* this) { super->action = 1; - gUnk_02034490.unk0 = 1; + gPauseMenuOptions.disabled = 1; SetFade(7, 8); } @@ -373,7 +373,7 @@ void sub_0802D650(GleerokEntity* this) { void sub_0802D674(GleerokEntity* this) { u32 val; - gUnk_02034490.unk0 = 1; + gPauseMenuOptions.disabled = 1; if (gPlayerEntity.z.WORD != 0) return; @@ -464,7 +464,7 @@ void sub_0802D7B4(GleerokEntity* this) { #ifndef EU gPlayerState.controlMode = CONTROL_1; #endif - gUnk_02034490.unk0 = 0; + gPauseMenuOptions.disabled = 0; SoundReq(BGM_BOSS_THEME); return; } else { diff --git a/src/enemy/likeLike.c b/src/enemy/likeLike.c index 867ce963..a0c15d4b 100644 --- a/src/enemy/likeLike.c +++ b/src/enemy/likeLike.c @@ -191,7 +191,7 @@ void sub_0802805C(Entity* this) { if (this->field_0xf >= 0x19 || gSave.stats.health == 0) { sub_0802810C(this); } else { - ResetPlayer(); + ResetPlayerItem(); gPlayerState.mobility |= 0x80; PositionRelative(this, &gPlayerEntity, 0, Q_16_16(1.0)); @@ -268,7 +268,7 @@ void sub_08028224(u32 item) { #ifdef EU CreateItemEntity(item, 0, 1); #else - sub_080A7C18(item, 0, 1); + InitItemGetSequence(item, 0, 1); #endif MessageFromTarget(0x579); } diff --git a/src/enemy/mazaalBracelet.c b/src/enemy/mazaalBracelet.c index 786039df..a6a273a1 100644 --- a/src/enemy/mazaalBracelet.c +++ b/src/enemy/mazaalBracelet.c @@ -1244,7 +1244,7 @@ void sub_0803B804(Entity* this) { } void sub_0803B824(Entity* this) { - ResetPlayer(); + ResetPlayerItem(); gPlayerState.mobility = gPlayerState.mobility | 0x80; sub_0806FA90(this, &gPlayerEntity, gUnk_080CFD1D[this->type], 1); gPlayerEntity.spriteOffsetY = -6; diff --git a/src/enemy/octorokBoss.c b/src/enemy/octorokBoss.c index d69fefd0..51e2b692 100644 --- a/src/enemy/octorokBoss.c +++ b/src/enemy/octorokBoss.c @@ -135,7 +135,7 @@ void OctorokBoss_Hit_SubAction0(OctorokBossEntity* this) { this->heap->fallingStonesTimer = 0; if (this->bossPhase == 4) { super->subAction = 4; - gUnk_02034490.unk0 = 1; + gPauseMenuOptions.disabled = 1; sub_08078B48(); SoundReq(SFX_BOSS_DIE); } else { @@ -325,7 +325,7 @@ void OctorokBoss_Intro(OctorokBossEntity* this) { OctorokBoss_Intro_SubAction3, OctorokBoss_Intro_SubAction4, OctorokBoss_Intro_SubAction5, }; sub_08078B48(); - gUnk_02034490.unk0 = 1; + gPauseMenuOptions.disabled = 1; sub_08036F60(this); OctorokBoss_Intro_SubActions[super->subAction](this); SetAffineInfo(super, this->unk_76, this->unk_74, this->angle.HWORD); @@ -399,7 +399,7 @@ void OctorokBoss_Intro_SubAction5(OctorokBossEntity* this) { super->subAction = 0; gRoomControls.unk5 = gPlayerEntity.animationState; OctorokBoss_SetAttackTimer(this); - gUnk_02034490.unk0 = 0; + gPauseMenuOptions.disabled = 0; SoundReq(BGM_BOSS_THEME); } } else { @@ -679,7 +679,7 @@ void OctorokBoss_Action1_Attack(OctorokBossEntity* this) { gPlayerEntity.flags &= ~ENT_COLLIDE; gPlayerEntity.collisionLayer = 2; sub_08078B48(); - sub_08077B20(); + PutAwayItems(); gPlayerEntity.parent = super; sub_08036914(&gPlayerEntity, (u8) - (this->angle.HALF.HI + 0x80), 0x3800); } diff --git a/src/enemy/pesto.c b/src/enemy/pesto.c index 210d8b41..a5f07588 100644 --- a/src/enemy/pesto.c +++ b/src/enemy/pesto.c @@ -806,7 +806,7 @@ void sub_08024E4C(Entity* this) { sub_08024A14(this, 0, 8); } else { Entity* player = &gPlayerEntity; - ResetPlayer(); + ResetPlayerItem(); gPlayerState.flags |= PL_DISABLE_ITEMS; gPlayerState.field_0xa |= 0x80; gPlayerState.queued_action = PLAYER_0807204C; diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 720243ed..8cda5e02 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -169,7 +169,7 @@ void sub_0802953C(Entity* this) { if (((this->field_0xf > 0x2d) || (gSave.stats.rupees == 0)) && (this->actionDelay == 0)) { sub_080296D8(this); } else { - ResetPlayer(); + ResetPlayerItem(); gPlayerState.mobility |= 0x80; PositionRelative(this, &gPlayerEntity, 0, Q_16_16(1.0)); pbVar3 = GetSpriteSubEntryOffsetDataPointer((u16)this->spriteIndex, this->frameIndex); diff --git a/src/enemy/vaatiProjectile.c b/src/enemy/vaatiProjectile.c index 320e4bf3..c3abb271 100644 --- a/src/enemy/vaatiProjectile.c +++ b/src/enemy/vaatiProjectile.c @@ -226,7 +226,7 @@ void VaatiProjectileFunction0Action9(Entity* this) { } void sub_0803E444(Entity* this) { - ResetPlayer(); + ResetPlayerItem(); gPlayerState.mobility = gPlayerState.mobility | 0x80; gPlayerState.field_0xa = gPlayerState.field_0xa | 0x80; sub_0806FA90(this, this->field_0x4c, 0, -2); diff --git a/src/enterPortalSubtask.c b/src/enterPortalSubtask.c index 5898e758..5019a300 100644 --- a/src/enterPortalSubtask.c +++ b/src/enterPortalSubtask.c @@ -37,7 +37,7 @@ void sub_080A71F4(ScreenTransitionData*); bool32 sub_0804ACA8(void); bool32 CheckInitPortal(void) { - if (gArea.playShrinkSeq) { + if (gArea.portal_in_use) { gMain.substate = GAMEMAIN_MINISHPORTAL; gArea.filler[8] = 0; gArea.filler[9] = 0; @@ -45,8 +45,8 @@ bool32 CheckInitPortal(void) { SetInitializationPriority(); return 1; } else { - gArea.filler[18] = gArea.playShrinkSeq; - *(vu8*)&gArea.playShrinkSeq = gArea.playShrinkSeq; + gArea.filler[18] = gArea.portal_in_use; + *(vu8*)&gArea.portal_in_use = gArea.portal_in_use; return 0; } } @@ -59,7 +59,7 @@ void sub_0804AAD4(void) { MemClear(&gUnk_02018EB0, 0x28); gUnk_02018EB0.unk_14 = NULL; EraseAllEntities(); - CreateObject(OBJECT_3D, gArea.curPortalType, 0); + CreateObject(OBJECT_3D, gArea.portal_type, 0); gArea.filler[8]++; } @@ -98,7 +98,7 @@ void sub_0804AB70(void) { controls->scroll_x = 0; gScreen.bg1.yOffset = 0; controls->scroll_y = 0; - portalId = gArea.curPortalType; + portalId = gArea.portal_type; if ((portalId == 2) && (gUI.unk_1c.area != 2)) { portalId = 3; } @@ -151,7 +151,7 @@ bool32 sub_0804ACA8(void) { void sub_0804ACC8(void) { if (gFadeControl.active == 0) { - SetGlobalFlag(gArea.curPortalType + ENTRANCE_0); + SetGlobalFlag(gArea.portal_type + ENTRANCE_0); sub_0804AD6C((RoomControls*)&gUI.unk_1c); sub_080A71F4(0); } @@ -166,11 +166,11 @@ void RespawnAsMinish(void) { } bool32 sub_0804AD18(void) { - switch (gArea.curPortalType) { + switch (gArea.portal_type) { case 0: case 1: case 2: - if (!CheckGlobalFlag(ENTRANCE_0 + gArea.curPortalType)) { + 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. @@ -191,10 +191,10 @@ void sub_0804AD6C(RoomControls* controls) { gRoomTransition.type = 0; area = &gArea; gRoomTransition.player_status.start_pos_x = - (area->curPortalX + gUnk_080D4140[area->curPortalExitDirection * 2]) - controls->origin_x; + (area->portal_x + gUnk_080D4140[area->portal_exit_dir * 2]) - controls->origin_x; gRoomTransition.player_status.start_pos_y = - (area->curPortalY + gUnk_080D4140[area->curPortalExitDirection * 2 + 1]) - controls->origin_y; - gRoomTransition.player_status.start_anim = area->curPortalExitDirection << 1; + (area->portal_y + gUnk_080D4140[area->portal_exit_dir * 2 + 1]) - controls->origin_y; + gRoomTransition.player_status.start_anim = area->portal_exit_dir << 1; gRoomTransition.player_status.spawn_type = 1; gRoomTransition.player_status.area_next = controls->area; gRoomTransition.player_status.room_next = controls->room; diff --git a/src/game.c b/src/game.c index 8b5ac8ac..f2db988a 100644 --- a/src/game.c +++ b/src/game.c @@ -372,7 +372,7 @@ static void GameMain_ChangeRoom(void) { sub_080300C4(); gMain.substate = GAMEMAIN_UPDATE; SetPlayerControl(0); - gUnk_02034490.unk0 = 0; + gPauseMenuOptions.disabled = 0; #if defined(USA) || defined(DEMO_USA) if (gArea.inventoryGfxIdx != 0xff) { sub_0801855C(); @@ -1282,7 +1282,7 @@ static void InitRoomTransition(void) { bool32 CanDispEzloMessage(void) { s32 tmp = PL_STATE_WALK; - if (!(gInput.heldKeys & SELECT_BUTTON) || gPlayerState.controlMode != CONTROL_ENABLED || gUnk_02034490.unk0 || + if (!(gInput.heldKeys & SELECT_BUTTON) || gPlayerState.controlMode != CONTROL_ENABLED || gPauseMenuOptions.disabled || gUnk_0200AF00.unk_1) return 0; @@ -1337,11 +1337,11 @@ static void CreateManagerF(void) { #endif static void sub_08052C3C(void) { - if (gArea.field_0x18 == 0) - gArea.unk1A = gArea.field_0x18; + if (gArea.portal_mode == 0) + gArea.unk1A = gArea.portal_mode; if (gArea.unk1A) { gArea.unk1A--; - gArea.field_0x18 = 0; + gArea.portal_mode = 0; } } diff --git a/src/interrupts.c b/src/interrupts.c index a21d6c5f..97d1c8c2 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -201,7 +201,7 @@ void PlayerUpdate(Entity* this) { if (EntityIsDeleted(this) == 0) { if (gPlayerState.flags & PL_MOLDWORM_CAPTURED) { - sub_08077B20(); + PutAwayItems(); if (gPlayerState.flags & PL_MOLDWORM_RELEASED) { gPlayerState.queued_action = PLAYER_ROLL; gPlayerState.flags &= ~PL_MOLDWORM_CAPTURED; @@ -236,7 +236,7 @@ void HandlePlayerLife(Entity* this) { gPlayerState.flags &= ~(0x2000000 | PL_FALLING); if (gPlayerState.flags & PL_BURNING) - ResetPlayer(); + ResetPlayerItem(); if ((gPlayerState.flags & PL_CLONING) && gPlayerState.chargeState.action == 0) DeleteClones(); if (sub_08079B24() == 0) @@ -311,7 +311,7 @@ void HandlePlayerLife(Entity* this) { void sub_080171F0(void) { if (gPlayerState.mobility != 0) - ResetPlayer(); + ResetPlayerItem(); if (gPlayerState.field_0x14 != 0) gPlayerState.field_0x14--; if (gPlayerEntity.field_0x7a.HWORD != 0) diff --git a/src/item/itemOcarina.c b/src/item/itemOcarina.c index a536d2d7..f73e3d48 100644 --- a/src/item/itemOcarina.c +++ b/src/item/itemOcarina.c @@ -24,7 +24,7 @@ void OcarinaUse(ItemBehavior* this, u32 arg1) { gPlayerEntity.field_0x7a.HWORD = 2; gPlayerState.flags |= PL_USE_OCARINA; gPlayerState.field_0x27[0] = -1; - gUnk_02034490.unk0 = 1; + gPauseMenuOptions.disabled = 1; gPlayerState.field_0xa = (8 >> arg1) | gPlayerState.field_0xa; gPlayerState.keepFacing = (8 >> arg1) | gPlayerState.keepFacing; ResetPlayerVelocity(); @@ -41,7 +41,7 @@ NONMATCH("asm/non_matching/ocarina/OcarinaUpdate.inc", void OcarinaUpdate(ItemBe gPlayerEntity.flags |= ENT_COLLIDE; gPlayerState.flags &= ~PL_USE_OCARINA; gPlayerState.field_0x27[0] = 0; - gUnk_02034490.unk0 = 0; + gPauseMenuOptions.disabled = 0; CreateBird(); ResetPlayerEventPriority(); DeletePlayerItem(this, arg1); diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c index 2e4c9fd3..d45a748e 100644 --- a/src/item/itemTryPickupObject.c +++ b/src/item/itemTryPickupObject.c @@ -3,8 +3,6 @@ extern void (*const gUnk_0811BDB4[])(ItemBehavior*, u32); -u32 sub_08077F64(ItemBehavior* arg0, u32 unk); - void ItemTryPickupObject(ItemBehavior* this, u32 arg1) { gUnk_0811BDB4[this->stateID](this, arg1); } @@ -24,7 +22,7 @@ void sub_08076488(ItemBehavior* this, u32 arg1) { s32 iVar2; if (this->field_0x5[2] == 0) { - if (sub_08077F64(this, arg1) != 0) { + if (PlayerTryDropItem(this, arg1) != 0) { if (((*(u8*)((this->field_0x18) + 0x16) & 0xf0) == 0x10) && ((gRoomTransition.frameCount & 1U) != 0)) { return; } @@ -48,9 +46,9 @@ void sub_08076488(ItemBehavior* this, u32 arg1) { ASM_FUNC("asm/non_matching/itemTryPickupObject/sub_08076518.inc", void sub_08076518(ItemBehavior* this, u32 arg1)) void sub_080765E0(ItemBehavior* this, u32 arg1) { - if (sub_08077F64(this, arg1) != 0) { + if (PlayerTryDropItem(this, arg1) != 0) { if ((this->field_0x5[9] & 0x80) != 0) { - sub_08077F50(this, arg1); + PlayerCancelHoldItem(this, arg1); } else { UpdateItemAnim(this); } diff --git a/src/manager/manager15.c b/src/manager/manager15.c index 598f7b04..f9a3fe11 100644 --- a/src/manager/manager15.c +++ b/src/manager/manager15.c @@ -306,9 +306,9 @@ void sub_0805A76C(Manager15* this) { gPlayerEntity.animationState = 4; RequestPriorityDuration((Entity*)this, 600); SetPlayerControl(0xFF); - gUnk_02034490.unk0 = 1; + gPauseMenuOptions.disabled = 1; gRoomControls.camera_target = NULL; - sub_08077B20(); + PutAwayItems(); } } } diff --git a/src/manager/manager3.c b/src/manager/manager3.c index 7d9b085b..fff973b6 100644 --- a/src/manager/manager3.c +++ b/src/manager/manager3.c @@ -26,7 +26,7 @@ typedef struct { } Manager3; extern s8 gUnk_08107C6C[]; -extern u32 sub_08057810(void); +extern u32 PortalReadyForMinish(void); extern u32 sub_080B1AC8(u16, u16, u8); void Manager3_Main(Manager3* this) { @@ -38,19 +38,19 @@ void Manager3_Main(Manager3* this) { return; } if (CheckPlayerProximity(this->unk_20, this->unk_24, 0x40, 0x40)) { - gArea.curPortalX = this->unk_20 + 0x20; - gArea.curPortalY = this->unk_24 + 0x20 + gUnk_08107C6C[this->manager.unk_0a]; - gArea.curPortalExitDirection = this->unk_34; - gArea.curPortalType = this->manager.unk_0a; + gArea.portal_x = this->unk_20 + 0x20; + gArea.portal_y = this->unk_24 + 0x20 + gUnk_08107C6C[this->manager.unk_0a]; + gArea.portal_exit_dir = this->unk_34; + gArea.portal_type = this->manager.unk_0a; if (!CheckGlobalFlag(EZERO_1ST)) { - gArea.field_0x18 = 1; - gArea.curPortalType = 5; + gArea.portal_mode = 1; + gArea.portal_type = 5; } else { if ((gPlayerState.flags & PL_USE_PORTAL) && gPlayerState.jump_status == 0) { - gArea.field_0x18 = 2; + gArea.portal_mode = 2; } else { - if (sub_08057810()) { - gArea.field_0x18 = 3; + if (PortalReadyForMinish()) { + gArea.portal_mode = 3; } } if (sub_080B1AC8(this->unk_38, this->unk_3a, this->manager.unk_0e) == 0x3d) { @@ -92,8 +92,8 @@ void CreateMagicSparkles(u32 baseX, u32 baseY, u32 layer) { UpdateSpriteForCollisionLayer(spark); } -u32 sub_08057810(void) { - if ((gPlayerState.flags & PL_MINISH) && !gPlayerState.field_0xaa && (gArea.curPortalType != 0x6) && +u32 PortalReadyForMinish(void) { + if ((gPlayerState.flags & PL_MINISH) && !gPlayerState.field_0xaa && (gArea.portal_type != 0x6) && (gPlayerState.heldObject == 0)) { switch (gPlayerState.framestate) { case PL_STATE_IDLE: diff --git a/src/manager/manager7.c b/src/manager/manager7.c index 25a73eb4..9827621c 100644 --- a/src/manager/manager7.c +++ b/src/manager/manager7.c @@ -80,7 +80,7 @@ void Manager7_Main(Manager7* this) { tmp2 = &gUnk_081080A4[tmp << 4]; tmp3 = this->manager.unk_0e; if (tmp3 == 0) { - gUnk_02034490.unk0 = 1; + gPauseMenuOptions.disabled = 1; LoadResourceAsync(&gGlobalGfxAndPalettes[tmp2[0]], tmp2[1], 0x1000); LoadPaletteGroup(gUnk_081081E4[tmp]); this->manager.unk_0e++; @@ -97,7 +97,7 @@ void Manager7_Main(Manager7* this) { LoadResourceAsync(&gGlobalGfxAndPalettes[tmp2[(this->manager.unk_0e << 1)]], tmp2[(this->manager.unk_0e << 1) + 1], 0x1000); this->manager.unk_0e++; - gUnk_02034490.unk0 = 0; + gPauseMenuOptions.disabled = 0; case 8: break; } @@ -130,7 +130,7 @@ void Manager7_Main(Manager7* this) { tmp2 = &gUnk_081080A4[tmp << 4]; switch (this->manager.unk_0e) { case 0: - gUnk_02034490.unk0 = 1; + gPauseMenuOptions.disabled = 1; LoadResourceAsync(&gGlobalGfxAndPalettes[tmp2[0]], tmp2[1], 0x1000); LoadPaletteGroup(gUnk_081081E4[tmp]); this->manager.unk_0e++; @@ -147,7 +147,7 @@ void Manager7_Main(Manager7* this) { this->manager.unk_0e++; break; case 8: - gUnk_02034490.unk0 = 0; + gPauseMenuOptions.disabled = 0; this->manager.unk_0e++; break; } diff --git a/src/manager/managerF.c b/src/manager/managerF.c index e0a0252f..41e4024b 100644 --- a/src/manager/managerF.c +++ b/src/manager/managerF.c @@ -157,7 +157,7 @@ void sub_08058FB0(ManagerF* this) { case 2: if (this->manager.unk_0e == 90) { SetPlayerControl(2); - sub_08077B20(); + PutAwayItems(); } if (this->manager.unk_0e == 60) { gPlayerEntity.animationState = this->manager.unk_0f; diff --git a/src/menu/figurine_menu.c b/src/menu/figurine_menu.c index 3160d0e1..ae7c0c51 100644 --- a/src/menu/figurine_menu.c +++ b/src/menu/figurine_menu.c @@ -601,7 +601,7 @@ void sub_080A4DB8(u32 param_1) { MemClear(gUnk_0200AF00.elements, sizeof(gUnk_0200AF00.elements)); MemClear(&gFigurineMenu, sizeof(gFigurineMenu)); gFigurineMenu.unk2e = 0xffff; - gMenu.field_0x3 = gUnk_02034490.unk2[param_1]; + gMenu.field_0x3 = gPauseMenuOptions.unk2[param_1]; ptr = &gUnk_08128AD8[gUnk_08128A38[param_1].unk0]; gScreen.lcd.displayControl = ptr->unk2 | 0x1940; gScreen.bg0.xOffset = 0; @@ -627,10 +627,10 @@ void sub_080A4DB8(u32 param_1) { } void sub_080A4E84(u8 param_1) { - gUnk_02034490.unk14 = param_1; + gPauseMenuOptions.unk14 = param_1; } void sub_080A4E90(u8 param_1) { - gUnk_02034490.unk11 = param_1; - gUnk_02034490.unk12 = 0; + gPauseMenuOptions.unk11 = param_1; + gPauseMenuOptions.unk12 = 0; } diff --git a/src/menu/pause_menu.c b/src/menu/pause_menu.c index 4bd0a4fc..1509b683 100644 --- a/src/menu/pause_menu.c +++ b/src/menu/pause_menu.c @@ -31,21 +31,21 @@ void Subtask_PauseMenu(void) { PauseMenu_Variant3, PauseMenu_Variant4, PauseMenu_Variant5, }; - if (gUnk_02034490.unk11 == 6) { + if (gPauseMenuOptions.unk11 == 6) { SetBgmVolume(0x100); Subtask_Exit(); } else { FlushSprites(); - pauseMenu_Variants[gUnk_02034490.unk11](); + pauseMenu_Variants[gPauseMenuOptions.unk11](); sub_080A5128(); UpdateUIElements(); DrawUIElements(); - if (gUnk_02034490.unk11 != 4) { - gUnk_08128A38[gUnk_02034490.unk1].func(); + if (gPauseMenuOptions.unk11 != 4) { + gUnk_08128A38[gPauseMenuOptions.unk1].func(); } CopyOAM(); { - u32 t = gUnk_02034490.unk16; + u32 t = gPauseMenuOptions.unk16; u32 t2 = (t != 0) ? 0xe46 : 0; gScreen.controls.layerFXControl = t2; gScreen.controls.alphaBlend = (t << 8) | (0x10 - t); @@ -81,18 +81,18 @@ void PauseMenu_Variant0(void) { } while (r1 <= 0xd); ptr = sub_080A6A80((u16)gRoomTransition.player_status.overworld_map_x, (u16)gRoomTransition.player_status.overworld_map_y); - gUnk_02034490.unk2[4] = ptr->_4; - gUnk_02034490.unk2[5] = sub_0801DB94(); + gPauseMenuOptions.unk2[4] = ptr->_4; + gPauseMenuOptions.unk2[5] = sub_0801DB94(); if (IsItemEquipped(ITEM_LANTERN_ON) != 2) { r1 = 0x10; } else { r1 = 0xf; } - gUnk_02034490.unk15 = r1; - r0 = gUnk_08128A38[gUnk_02034490.unk1].unk1; + gPauseMenuOptions.unk15 = r1; + r0 = gUnk_08128A38[gPauseMenuOptions.unk1].unk1; r0 = sub_080A50A0(r0); - gUnk_02034490.unk1 = r0; - gUnk_02034490.unk14 = r0; + gPauseMenuOptions.unk1 = r0; + gPauseMenuOptions.unk14 = r0; sub_080A4DB8(r0); SetFade(4, 0x20); sub_080A4E90(1); @@ -141,16 +141,16 @@ void PauseMenu_Variant2(void) { bVar5 = gMenu.field_0xc[iVar4]; } default: - gUnk_02034490.unk14 = bVar5; + gPauseMenuOptions.unk14 = bVar5; SoundReq(SFX_TEXTBOX_OPEN); gMenu.field_0xc = NULL; break; } } } - bVar5 = sub_080A50A0(gUnk_02034490.unk14); - if (gUnk_02034490.unk1 != bVar5) { - gUnk_02034490.unk14 = bVar5; + bVar5 = sub_080A50A0(gPauseMenuOptions.unk14); + if (gPauseMenuOptions.unk1 != bVar5) { + gPauseMenuOptions.unk14 = bVar5; sub_080A51D4(); if (bVar5 == 0xe) { sub_080A4E90(6); @@ -178,19 +178,19 @@ s32 sub_080A50A0(s32 param_1) { void PauseMenu_Variant3(void) { s32 iVar1; - iVar1 = gUnk_02034490.unk16 + 2; + iVar1 = gPauseMenuOptions.unk16 + 2; if (0x10 < iVar1) { gScreen.lcd.displayControl &= 0xf8ff; sub_080A4E90(4); iVar1 = 0x10; } - gUnk_02034490.unk16 = iVar1; + gPauseMenuOptions.unk16 = iVar1; } void PauseMenu_Variant4(void) { u32 t; - gUnk_02034490.unk16 = 0x10; - gUnk_02034490.unk1 = t = gUnk_02034490.unk14; + gPauseMenuOptions.unk16 = 0x10; + gPauseMenuOptions.unk1 = t = gPauseMenuOptions.unk14; sub_080A4DB8(t); sub_080A4E90(5); } @@ -198,12 +198,12 @@ void PauseMenu_Variant4(void) { void PauseMenu_Variant5(void) { s32 iVar1; - iVar1 = gUnk_02034490.unk16 - 2; + iVar1 = gPauseMenuOptions.unk16 - 2; if (iVar1 < 0) { sub_080A4E90(2); iVar1 = 0; } - gUnk_02034490.unk16 = iVar1; + gPauseMenuOptions.unk16 = iVar1; } void sub_080A5128(void) { @@ -213,7 +213,7 @@ void sub_080A5128(void) { int y; } p[3]; - switch (gUnk_02034490.unk1) { + switch (gPauseMenuOptions.unk1) { case 7: case 8: p[0].x = 0x60; @@ -229,8 +229,8 @@ void sub_080A5128(void) { return; default: p[0].x = 0x40; - p[0].y = 0x10 - (gUnk_02034490.unk16 << 1); - t = (gUnk_02034490.unk16 / 3); + p[0].y = 0x10 - (gPauseMenuOptions.unk16 << 1); + t = (gPauseMenuOptions.unk16 / 3); p[1].x = 0x10 - t; p[1].y = 0x48; p[2].x = 0xe0 + t; @@ -257,9 +257,9 @@ void sub_080A5128(void) { } void sub_080A51D4(void) { - u32 i = gUnk_02034490.unk1; + u32 i = gPauseMenuOptions.unk1; if (i < 0xe) { - gUnk_02034490.unk2[i] = gMenu.field_0x3; + gPauseMenuOptions.unk2[i] = gMenu.field_0x3; } } @@ -267,7 +267,7 @@ u32 sub_080A51F4(void) { u32 retval = 1; if (gFadeControl.active != 0) retval = 0; - if (gUnk_02034490.unk11 != 2) + if (gPauseMenuOptions.unk11 != 2) retval = 0; return retval; } @@ -331,7 +331,7 @@ void PauseMenu_ItemMenu_Init(void) { switch (item) { case ITEM_LANTERN_OFF: case ITEM_LANTERN_ON: - item = gUnk_02034490.unk15; + item = gPauseMenuOptions.unk15; break; default: break; diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index b98646b3..65976883 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -329,7 +329,7 @@ void sub_0806D600(Entity* this, ScriptExecutionContext* context) { void sub_0806D620(void) { SetInventoryValue(ITEM_SHIELD, 0); - sub_080A7C18(ITEM_MIRROR_SHIELD, 0, 0); + InitItemGetSequence(ITEM_MIRROR_SHIELD, 0, 0); } void sub_0806D638(Entity* this) { diff --git a/src/npc/bladeBrothers.c b/src/npc/bladeBrothers.c index a8ab63b5..14777d9a 100644 --- a/src/npc/bladeBrothers.c +++ b/src/npc/bladeBrothers.c @@ -191,7 +191,7 @@ void sub_08068C28(Entity* this) { } void sub_08068C6C(Entity* this) { - sub_080A7C18(gUnk_0811162B[this->actionDelay] & 0xffffff7f, 0, 0); + InitItemGetSequence(gUnk_0811162B[this->actionDelay] & 0xffffff7f, 0, 0); } void sub_08068C8C(Entity* this, ScriptExecutionContext* context) { diff --git a/src/npc/goronMerchant.c b/src/npc/goronMerchant.c index 3cb1a668..96e6172f 100644 --- a/src/npc/goronMerchant.c +++ b/src/npc/goronMerchant.c @@ -134,7 +134,7 @@ void GoronMerchant_TryToBuyKinstone(Entity* this, ScriptExecutionContext* contex if (salePrice <= gSave.stats.rupees) { if (sub_0801E7D0(gRoomVars.shopItemType2) < 99) { ModRupees(-salePrice); - sub_080A7C18(0x5c, gRoomVars.shopItemType2, 0); + InitItemGetSequence(0x5c, gRoomVars.shopItemType2, 0); gRoomVars.shopItemType = 0; gRoomVars.shopItemType2 = 0; context->condition = 1; diff --git a/src/npc/melari.c b/src/npc/melari.c index 37f97286..11cd5f93 100644 --- a/src/npc/melari.c +++ b/src/npc/melari.c @@ -135,7 +135,7 @@ void sub_08068910(Entity* this) { } void sub_08068964(Entity* this) { - sub_080A7C18(ITEM_QST_BROKEN_SWORD, 0, 3); + InitItemGetSequence(ITEM_QST_BROKEN_SWORD, 0, 3); SetInventoryValue(ITEM_QST_BROKEN_SWORD, 2); } diff --git a/src/npc/npc23.c b/src/npc/npc23.c index a0a0c8bf..2dedb197 100644 --- a/src/npc/npc23.c +++ b/src/npc/npc23.c @@ -48,7 +48,7 @@ void sub_08066358(Entity* this) { } this->speed = 0x80; this->cutsceneBeh.HWORD = 1; - gUnk_02034490.unk0 = 1; + gPauseMenuOptions.disabled = 1; sub_080788E0(this); } } else { @@ -95,7 +95,7 @@ void sub_0806643C(Entity* this) { void sub_08066474(void) { if (gPlayerEntity.action != PLAYER_080720DC) { - gUnk_02034490.unk0 = 0; + gPauseMenuOptions.disabled = 0; } } diff --git a/src/npc/percy.c b/src/npc/percy.c index dea47a15..3d7b5591 100644 --- a/src/npc/percy.c +++ b/src/npc/percy.c @@ -124,9 +124,9 @@ void sub_0806B540(Entity* this) { if ((gMessage.doTextBox & 0x7f) == 0) { context->unk_18 = 3; if (gSave.stats.hasAllFigurines != 0) { - sub_080A7C18(0x58, 0, 0); + InitItemGetSequence(0x58, 0, 0); } else { - sub_080A7C18(0x3f, 100, 0); + InitItemGetSequence(0x3f, 100, 0); } SetRoomFlag(0xf); } diff --git a/src/npc/pita.c b/src/npc/pita.c index 49529a98..397128de 100644 --- a/src/npc/pita.c +++ b/src/npc/pita.c @@ -59,7 +59,7 @@ bool32 sub_08062EDC(Entity* this, ScriptExecutionContext* context) { } else { tmp = GetRandomByWeight(gUnk_0810C435); tmp2 = gUnk_0810C43D[tmp]; - sub_080A7C18(0x5c, tmp2, 1); + InitItemGetSequence(0x5c, tmp2, 1); MessageNoOverlap(0x3c05, this); context->condition = TRUE; return TRUE; diff --git a/src/npc/stockwell.c b/src/npc/stockwell.c index d305d835..e9069519 100644 --- a/src/npc/stockwell.c +++ b/src/npc/stockwell.c @@ -223,7 +223,7 @@ void sub_08065370(Entity* this, ScriptExecutionContext* context) { itemPrice = GetItemPrice(shopItemType); if (itemPrice <= gSave.stats.rupees) { ModRupees(-itemPrice); - sub_080A7C18(shopItemType, gRoomVars.shopItemType2, 2); + InitItemGetSequence(shopItemType, gRoomVars.shopItemType2, 2); gRoomVars.shopItemType = 0; gRoomVars.shopItemType2 = 0; context->condition = 1; diff --git a/src/npcUtils.c b/src/npcUtils.c index 09906e44..407169e3 100644 --- a/src/npcUtils.c +++ b/src/npcUtils.c @@ -101,7 +101,7 @@ u32 sub_0806ED78(Entity* ent) { u32 result = sub_0800445C(ent); if (result) { if (gPlayerState.dash_state & 0x40) { - sub_08077B20(); + PutAwayItems(); } } return result; @@ -323,7 +323,7 @@ u32 UpdateFuseInteraction(Entity* ent) { gPlayerState.controlMode = CONTROL_DISABLED; ret = 1; case 1: - sub_0807919C(); + PlayerResetStateFromFusion(); gPlayerState.controlMode = CONTROL_1; break; } diff --git a/src/object/bigVortex.c b/src/object/bigVortex.c index 323cbf0b..00e43c6b 100644 --- a/src/object/bigVortex.c +++ b/src/object/bigVortex.c @@ -73,7 +73,7 @@ void sub_08098DC4(Entity* this) { if (this->type2 == 1) { SetGlobalFlag(TATSUMAKI); } - sub_08077B20(); + PutAwayItems(); } UpdateAnimationSingleFrame(this); } diff --git a/src/object/bird.c b/src/object/bird.c index 3cb75c4b..c798c6f5 100644 --- a/src/object/bird.c +++ b/src/object/bird.c @@ -224,16 +224,16 @@ void Bird_Type8(Entity* this) { this->actionDelay = 8; this->speed = 0x300; this->field_0x68.HWORD = 0xe000; - sub_08079184(); + PlayerDropHeldObject(); sub_08078B48(); ResetPlayerAnimationAndAction(); - sub_08077B20(); + PutAwayItems(); gPlayerState.swim_state = 0; gPlayerState.jump_status = 0; gPlayerEntity.flags &= 0x7f; gPlayerEntity.spriteSettings.draw = 0; gPriorityHandler.sys_priority = 6; - gUnk_02034490.unk0 = 1; + gPauseMenuOptions.disabled = 1; } } } @@ -322,7 +322,7 @@ void Bird_Type9(Entity* this) { gPlayerEntity.spriteSettings.draw = 1; ResetPlayerAnimationAndAction(); ResetPlayerEventPriority(); - gUnk_02034490.unk0 = 0; + gPauseMenuOptions.disabled = 0; if (!CheckGlobalFlag(WARP_1ST)) { pEVar1 = CreateObject(OBJECT_69, 0, 0); if (pEVar1 != NULL) { @@ -394,7 +394,7 @@ void sub_0809D738(void) { if (pEVar2 != NULL) { pEVar1->child = pEVar2; } - gUnk_02034490.unk0 = 1; + gPauseMenuOptions.disabled = 1; } else { ResetPlayerAnimationAndAction(); } diff --git a/src/object/chestSpawner.c b/src/object/chestSpawner.c index 2e567789..af493443 100644 --- a/src/object/chestSpawner.c +++ b/src/object/chestSpawner.c @@ -99,7 +99,7 @@ void ChestSpawner_Type2Action1(ChestSpawnerEntity* this) { if (CheckFlags(this->unk_86)) { gScreen.controls.layerFXControl = 0xf40; gScreen.controls.alphaBlend = 0x1000; - gUnk_02034490.unk0 = 1; + gPauseMenuOptions.disabled = 1; super->action = 2; super->subAction = 0; super->field_0xf = 0x1e; @@ -138,7 +138,7 @@ void ChestSpawner_Type2Action2(ChestSpawnerEntity* this) { tmp = ++super->field_0xf; gScreen.controls.alphaBlend = (((0x10 - tmp) * 0x100) & 0xff00) | tmp; if (gScreen.controls.alphaBlend == 0x10) { - gUnk_02034490.unk0 = 0; + gPauseMenuOptions.disabled = 0; gScreen.controls.layerFXControl = 0; sub_08083E20(this); SoundReq(SFX_SECRET_BIG); diff --git a/src/object/cloud.c b/src/object/cloud.c index fbd9e1b1..a8b22546 100644 --- a/src/object/cloud.c +++ b/src/object/cloud.c @@ -33,7 +33,7 @@ void sub_0809F514(Entity* this) { this->spriteSettings.draw = 0; this->field_0x68.HALF.LO = 12; gRoomControls.camera_target = this; - gUnk_02034490.unk0 = 255; + gPauseMenuOptions.disabled = 255; sub_0809F7BC(this); } diff --git a/src/object/cuccoMinigame.c b/src/object/cuccoMinigame.c index 2e690ab7..1c3ebbeb 100644 --- a/src/object/cuccoMinigame.c +++ b/src/object/cuccoMinigame.c @@ -203,7 +203,7 @@ void sub_080A13E8(ObjectB9Entity* this) { } if (!bVar2) { - sub_080A7C18(ptr[0], ptr[1], 0); + InitItemGetSequence(ptr[0], ptr[1], 0); } else { this->unk6e = 2; } diff --git a/src/object/fourElements.c b/src/object/fourElements.c index daecece1..942cc485 100644 --- a/src/object/fourElements.c +++ b/src/object/fourElements.c @@ -95,7 +95,7 @@ void FourElements_Action2(FourElementsEntity* this) { super->actionDelay = 0x2d; gScreen.controls.layerFXControl = 0x640; gScreen.controls.alphaBlend = 0; - sub_080A7C18(super->type, 0, 1); + InitItemGetSequence(super->type, 0, 1); sub_0808C650(super, 1); SetFade(6, 2); SoundReq(SFX_F8); diff --git a/src/object/itemForSale.c b/src/object/itemForSale.c index 85f6326d..c119010f 100644 --- a/src/object/itemForSale.c +++ b/src/object/itemForSale.c @@ -99,7 +99,7 @@ void ItemForSale_Action1(ItemForSaleEntity* this) { super->interactType = 0; super->subAction = 1; sub_08078B48(); - ResetPlayer(); + ResetPlayerItem(); gPlayerState.heldObject = 4; gNewPlayerEntity.unk_74 = super; gUnk_0200AF00.unk_2f = 2; diff --git a/src/object/jarPortal.c b/src/object/jarPortal.c index 63681ad0..adcd258f 100644 --- a/src/object/jarPortal.c +++ b/src/object/jarPortal.c @@ -4,7 +4,7 @@ extern void (*gUnk_08121488[])(Entity*); -extern u32 sub_08057810(void); +extern u32 PortalReadyForMinish(void); u32 sub_0808C128(Entity*); void sub_0808C13C(Entity*); @@ -99,19 +99,19 @@ void sub_0808BFD8(Entity* this) { void sub_0808C01C(Entity* this, u32 r1) { if (CheckPlayerProximity(this->x.HALF.HI - 0x18, this->y.HALF.HI - 0x18, 0x30, 0x30)) { u32 type; - gArea.curPortalX = this->x.HALF.HI; - gArea.curPortalY = this->y.HALF.HI; - gArea.curPortalExitDirection = 2; + gArea.portal_x = this->x.HALF.HI; + gArea.portal_y = this->y.HALF.HI; + gArea.portal_exit_dir = 2; type = 4; if (r1 != 0) type = 2; - gArea.curPortalType = type; + gArea.portal_type = type; if (r1 == 1) { if ((gPlayerState.flags & PL_USE_PORTAL) && (gPlayerState.jump_status == 0)) { - gArea.field_0x18 = 2; + gArea.portal_mode = 2; } else { - if (sub_08057810() != 0) { - gArea.field_0x18 = 3; + if (PortalReadyForMinish() != 0) { + gArea.portal_mode = 3; } } CreateMagicSparkles(this->x.HALF.HI, this->y.HALF.HI, this->collisionLayer); diff --git a/src/object/lilypadLarge.c b/src/object/lilypadLarge.c index 0ef2bcbc..845fa697 100644 --- a/src/object/lilypadLarge.c +++ b/src/object/lilypadLarge.c @@ -323,7 +323,7 @@ void sub_08085E74(LilypadLargeEntity* this) { if (gPlayerState.item != NULL) { DeleteEntity(gPlayerState.item); } - ResetPlayer(); + ResetPlayerItem(); } void sub_08085EFC(LilypadLargeEntity* this) { diff --git a/src/object/macroPlayer.c b/src/object/macroPlayer.c index 4adcb573..f024215f 100644 --- a/src/object/macroPlayer.c +++ b/src/object/macroPlayer.c @@ -200,7 +200,7 @@ void MacroPlayer_Type0_Action6(MacroPlayerEntity* this) { u32 uVar2; if (--super->actionDelay == 0) { - uVar2 = gArea.curPortalExitDirection; + uVar2 = gArea.portal_exit_dir; super->action += 1; super->action += uVar2; super->animationState = gUnk_081216B4[uVar2 * 2]; diff --git a/src/object/minecart.c b/src/object/minecart.c index 581152c2..937439fe 100644 --- a/src/object/minecart.c +++ b/src/object/minecart.c @@ -81,7 +81,7 @@ void sub_080917DC(MinecartEntity* this) { gPlayerEntity.zVelocity = Q_16_16(2.0); gPlayerEntity.speed = 0x100; gPlayerEntity.flags &= ~PL_MINISH; - ResetPlayer(); + ResetPlayerItem(); DeleteClones(); SoundReq(SFX_PLY_JUMP); } diff --git a/src/object/object3D.c b/src/object/object3D.c index 05514818..807285ce 100644 --- a/src/object/object3D.c +++ b/src/object/object3D.c @@ -35,8 +35,8 @@ void Object3D(Object3DEntity* this) { void Object3D_Init(Object3DEntity* this) { super->action = 1; - super->x.HALF.HI = gArea.curPortalX - gRoomControls.scroll_x; - super->y.HALF.HI = gArea.curPortalY - gRoomControls.scroll_y; + super->x.HALF.HI = gArea.portal_x - gRoomControls.scroll_x; + super->y.HALF.HI = gArea.portal_y - gRoomControls.scroll_y; this->unk_68 = 0x80; super->updatePriority = 6; sub_0801E1B8(0x1f17, 0); diff --git a/src/object/object74.c b/src/object/object74.c index e3c4111c..459880bc 100644 --- a/src/object/object74.c +++ b/src/object/object74.c @@ -51,7 +51,7 @@ void sub_08097B84(Object74Entity* this) { void sub_08097BDC(Object74Entity* this) { if (CheckFlags(this->unk_86)) { SetPlayerControl(CONTROL_1); - gUnk_02034490.unk0 = 1; + gPauseMenuOptions.disabled = 1; RequestPriorityDuration(super, 0x1e); if (sub_08097CB0(this) == FALSE) { sub_08097CB4(this); @@ -76,7 +76,7 @@ void sub_08097C20(Object74Entity* this) { gScreen.controls.alphaBlend = (((0x10 - tmp) * 0x100)) | tmp; if (gScreen.controls.alphaBlend == 0x10) { SetPlayerControl(CONTROL_ENABLED); - gUnk_02034490.unk0 = 0; + gPauseMenuOptions.disabled = 0; gScreen.controls.layerFXControl = 0; sub_08097CFC(this); super->action = 4; diff --git a/src/object/objectC1.c b/src/object/objectC1.c index ed045a6d..454fd432 100644 --- a/src/object/objectC1.c +++ b/src/object/objectC1.c @@ -48,7 +48,7 @@ void ObjectC1_Init(ObjectC1Entity* this) { void ObjectC1_Action1(ObjectC1Entity* this) { ResetPlayerEventPriority(); - gUnk_02034490.unk0 = 0; + gPauseMenuOptions.disabled = 0; DeleteThisEntity(); } diff --git a/src/object/warpPoint.c b/src/object/warpPoint.c index 9f35a442..a5f9e0ec 100644 --- a/src/object/warpPoint.c +++ b/src/object/warpPoint.c @@ -86,7 +86,7 @@ void sub_0808B590(Entity* this) { return; this->action = 5; this->field_0xf = 0x60; - sub_08077B20(); + PutAwayItems(); gPlayerEntity.x.HALF.HI = this->x.HALF.HI; gPlayerEntity.y.HALF.HI = this->y.HALF.HI; gPlayerEntity.animationState = 4; diff --git a/src/object/whirlwind.c b/src/object/whirlwind.c index 2315052e..7a843ab1 100644 --- a/src/object/whirlwind.c +++ b/src/object/whirlwind.c @@ -81,7 +81,7 @@ void Whirlwind_Action1(Entity* this) { gPlayerState.field_0x39 = 0xff; this->spritePriority.b0 = gPlayerEntity.spritePriority.b0 - 1; this->action++; - sub_08077B20(); + PutAwayItems(); SoundReq(SFX_153); SoundReq(SFX_PLY_VO5); } diff --git a/src/objectUtils.c b/src/objectUtils.c index aadc61c4..247dc648 100644 --- a/src/objectUtils.c +++ b/src/objectUtils.c @@ -25,7 +25,7 @@ Entity* sub_080A276C(Entity* parent, u32 type, u32 type2) { PrependEntityToList(e, 6); CopyPosition(&gPlayerEntity, e); gPriorityHandler.sys_priority = 6; - gUnk_02034490.unk0 = 1; + gPauseMenuOptions.disabled = 1; e->field_0x68.HALF.HI = gPlayerEntity.flags; e->field_0x68.HALF.LO = gPlayerEntity.spriteSettings.draw; e->field_0x6a.HALF.LO = gPlayerEntity.iframes; diff --git a/src/player.c b/src/player.c index 315b064f..7ff0703a 100644 --- a/src/player.c +++ b/src/player.c @@ -119,10 +119,10 @@ static EntityAction PortalEnterUpdate; static EntityAction PortalUnknownUpdate; // PLAYER_TALKEZLO -static EntityAction PlayerTalkEzloInit; -static EntityAction sub_0807193C; -static EntityAction sub_08071990; -static EntityAction sub_08071A4C; +static EntityAction PlayerTalkEzlo_Init; +static EntityAction PlayerTalkEzlo_CreateMessage; +static EntityAction PlayerTalkEzlo_MessageIdle; +static EntityAction PlayerTalkEzlo_Leave; // PLAYER_PUSH static EntityAction PlayerPushInit; @@ -281,7 +281,7 @@ extern ScriptExecutionContext gPlayerScriptExecutionContext; bool32 CheckInitPauseMenu(void) { u32 framestate; - if (((gInput.newKeys & START_BUTTON) == 0 || gFadeControl.active || gUnk_02034490.unk0 || + if (((gInput.newKeys & START_BUTTON) == 0 || gFadeControl.active || gPauseMenuOptions.disabled || (gMessage.doTextBox & 0x7F) || gSave.stats.health == 0 || !gSave.fillerD0[34] || gPlayerState.controlMode != 0 || gPriorityHandler.priority_timer != 0)) { return FALSE; @@ -371,7 +371,7 @@ static void PlayerInit(Entity* this) { UpdatePlayerSkills(); if (CheckQueuedAction() == 0) { - sub_0807921C(); + PlayerSetNormalAndCollide(); UpdateFloorType(); if (gPlayerState.swim_state != 0) { Entity* ent; @@ -400,7 +400,7 @@ static void PlayerNormal(Entity* this) { else gPlayerState.animation = 604; sub_0806F948(&gPlayerEntity); - ResetPlayer(); + ResetPlayerItem(); sub_08077698(this); return; } @@ -445,7 +445,7 @@ static void PlayerNormal(Entity* this) { if (gPlayerState.jump_status == 0 && (gPlayerState.flags & PL_BURNING) == 0) { if (this->knockbackDuration == 0 && sub_080782C0()) { if (gRoomVars.shopItemType == 0) { - ResetPlayer(); + ResetPlayerItem(); } if ((gPlayerState.flags & (PL_USE_OCARINA | PL_FLAGS2)) == 0) { UpdateFloorType(); @@ -606,7 +606,7 @@ static void PlayerFallInit(Entity* this) { this->subAction++; COLLISION_OFF(this); this->spritePriority.b1 = 0; - ResetPlayer(); + ResetPlayerItem(); DeleteClones(); SoundReq(SFX_PLY_VO7); SoundReq(SFX_FALL_HOLE); @@ -659,7 +659,7 @@ static void PlayerBounceInit(Entity* this) { gPlayerState.jump_status = 0x80; SoundReq(SFX_14C); - ResetPlayer(); + ResetPlayerItem(); ResetPlayerVelocity(); } @@ -797,7 +797,7 @@ static void PlayerItemGetInit(Entity* this) { } this->subAction = 1; - ResetPlayer(); + ResetPlayerItem(); ResetPlayerVelocity(); } @@ -848,7 +848,7 @@ static void PlayerJumpInit(Entity* this) { if ((gPlayerState.heldObject | gPlayerState.sword_state) == 0) { if ((gPlayerState.flags & PL_MINISH) == 0) { - ResetPlayer(); + ResetPlayerItem(); if (gPlayerState.flags & PL_NO_CAP) { gPlayerState.animation = 0x420; } else { @@ -969,7 +969,7 @@ static void PlayerDrownInit(Entity* this) { else gPlayerState.animation = 0x44c; } - ResetPlayer(); + ResetPlayerItem(); } static void sub_080712F0(Entity* this) { @@ -1019,7 +1019,7 @@ static void PlayerUsePortal(Entity* this) { if ((gInput.newKeys & (B_BUTTON | R_BUTTON)) == 0) return; - if (AreaIsDungeon() || gArea.curPortalType == 3) { + if (AreaIsDungeon() || gArea.portal_type == 3) { this->subAction = 7; this->actionDelay = 30; SetFade(7, 16); @@ -1036,11 +1036,11 @@ static void PortalJumpOnUpdate(Entity* this) { COLLISION_OFF(this); this->knockbackDuration = 0; - x = gArea.curPortalX; - y = gArea.curPortalY; + x = gArea.portal_x; + y = gArea.portal_y; if ((this->x.HALF.HI != x) || (this->y.HALF.HI != y)) { - this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, gArea.curPortalX, gArea.curPortalY); + this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, gArea.portal_x, gArea.portal_y); this->speed = JUMP_SPEED_FWD; UpdatePlayerMovement(); } @@ -1053,20 +1053,20 @@ static void PortalJumpOnUpdate(Entity* this) { this->subAction = 1; this->animationState = IdleSouth; this->spriteSettings.flipX = FALSE; - if (gArea.curPortalType == 4) { + if (gArea.portal_type == 4) { gPlayerState.animation = 0x52c; } } this->actionDelay = 8; - if (gArea.curPortalType != 3) { + if (gArea.portal_type != 3) { this->spritePriority.b0 = 3; } } static void PortalStandUpdate(Entity* this) { - switch (gArea.curPortalType) { + switch (gArea.portal_type) { case 4: case 5: sub_0806F948(&gPlayerEntity); @@ -1094,7 +1094,7 @@ static void PortalStandUpdate(Entity* this) { this->actionDelay = 8; } - if (gArea.curPortalType == 4) { + if (gArea.portal_type == 4) { if (this->frame == 0) { UpdateAnimationSingleFrame(this); return; @@ -1107,12 +1107,12 @@ static void PortalStandUpdate(Entity* this) { static void PortalActivateInit(Entity* this) { gRoomControls.camera_target = NULL; - gUnk_02034490.unk0 = 1; + gPauseMenuOptions.disabled = 1; this->subAction = 3; - this->field_0xf = 0x1e; + this->field_0xf = 30; gPlayerState.animation = 0x738; CreateObjectWithParent(this, EZLO_CAP, 1, 0); - sub_08077B20(); + PutAwayItems(); SetPlayerEventPriority(); } @@ -1221,15 +1221,15 @@ static void PortalEnterUpdate(Entity* this) { this->spriteSettings.draw = FALSE; - if (gArea.curPortalType == 3) { + if (gArea.portal_type == 3) { if (--this->field_0xf == 0) sub_080717F8(this); return; } - if (gArea.curPortalType == 6) + if (gArea.portal_type == 6) DoExitTransition(&gUnk_0813AB58); else - gArea.playShrinkSeq = 1; + gArea.portal_in_use = TRUE; return; } @@ -1254,11 +1254,11 @@ static void sub_080717F8(Entity* this) { 0, -22, 22, 0, 0, 22, -22, 0, }; - this->animationState = gArea.curPortalExitDirection << 1; - this->x.HALF.HI = gArea.curPortalX + sOffsets[gArea.curPortalExitDirection * 2]; - this->y.HALF.HI = gArea.curPortalY + sOffsets[gArea.curPortalExitDirection * 2 + 1]; + this->animationState = gArea.portal_exit_dir << 1; + this->x.HALF.HI = gArea.portal_x + sOffsets[gArea.portal_exit_dir * 2]; + this->y.HALF.HI = gArea.portal_y + sOffsets[gArea.portal_exit_dir * 2 + 1]; gArea.unk1A = 0xb4; - gUnk_02034490.unk0 = 0; + gPauseMenuOptions.disabled = 0; this->action = PLAYER_MINISH; this->subAction = 0; gPlayerState.flags = (gPlayerState.flags & ~PL_USE_PORTAL) | PL_MINISH; @@ -1268,10 +1268,10 @@ static void sub_080717F8(Entity* this) { static void PlayerTalkEzlo(Entity* this) { static EntityAction* const sPlayerTalkEzloStates[] = { - PlayerTalkEzloInit, - sub_0807193C, - sub_08071990, - sub_08071A4C, + PlayerTalkEzlo_Init, + PlayerTalkEzlo_CreateMessage, + PlayerTalkEzlo_MessageIdle, + PlayerTalkEzlo_Leave, }; if (CheckQueuedAction()) { @@ -1284,8 +1284,8 @@ static void PlayerTalkEzlo(Entity* this) { } } -static void PlayerTalkEzloInit(Entity* this) { - ResetPlayer(); +static void PlayerTalkEzlo_Init(Entity* this) { + ResetPlayerItem(); gUnk_03000B80[3].field_0xf = 0; this->iframes = 0; gPriorityHandler.sys_priority = PRIO_PLAYER_EVENT; @@ -1301,38 +1301,40 @@ static void PlayerTalkEzloInit(Entity* this) { if (gPlayerState.jump_status == 0) { this->subAction++; - if (this->animationState == IdleEast) + if (this->animationState == IdleEast) { gPlayerState.animation = 0x3ca; - else + } else { gPlayerState.animation = 0x3c6; + } this->spriteSettings.flipX = 0; return; } - if (!GravityUpdate(this, GRAVITY_RATE)) + if (!GravityUpdate(this, GRAVITY_RATE)) { gPlayerState.jump_status = 0; + } } -static void sub_0807193C(Entity* this) { +static void PlayerTalkEzlo_CreateMessage(Entity* this) { Entity* child; UpdateAnimationSingleFrame(this); if (this->frame & ANIM_DONE) { this->subAction++; - child = CreateObjectWithParent(this, EZLO_CAP, 0, 0); - this->child = child; - if (child != NULL) { - if (this->animationState == IdleEast) + this->child = CreateObjectWithParent(this, EZLO_CAP, 0, 0); + if (this->child != NULL) { + if (this->animationState == IdleEast) { gPlayerState.animation = 0x3cc; - else + } else { gPlayerState.animation = 0x3c7; + } DisplayEzloMessage(); } } } -static void sub_08071990(Entity* this) { +static void PlayerTalkEzlo_MessageIdle(Entity* this) { u32 temp; if ((gMessage.doTextBox & 0x7f) == 0) { @@ -1344,7 +1346,7 @@ static void sub_08071990(Entity* this) { gPlayerState.animation = 0x3c9; } else { reset_priority(); - sub_08079258(); + PlayerMinishSetNormalAndCollide(); } return; } @@ -1371,11 +1373,11 @@ static void sub_08071990(Entity* this) { UpdateAnimationSingleFrame(this); } -static void sub_08071A4C(Entity* this) { +static void PlayerTalkEzlo_Leave(Entity* this) { UpdateAnimationSingleFrame(this); if (this->frame & ANIM_DONE) { reset_priority(); - sub_0807921C(); + PlayerSetNormalAndCollide(); } } @@ -1520,7 +1522,7 @@ static void PlayerMinishDieInit(Entity* this) { gPlayerState.jump_status = 0; gPlayerState.pushedObject = 0; sub_0800451C(this); - ResetPlayer(); + ResetPlayerItem(); SoundReq(SFX_PLY_DIE); } @@ -1654,7 +1656,7 @@ static void PlayerEmptyBottle(Entity* this) { static void PlayerEmptyBottleInit(Entity* this) { Entity* ent; - ResetPlayer(); + ResetPlayerItem(); ent = CreatePlayerItemWithParent((ItemBehavior*)this, 0xe); if (ent != NULL) { ent->field_0x68.HALF.LO = gPlayerState.field_0x38; @@ -1678,7 +1680,7 @@ static void PlayerEmptyBottleUpdate(Entity* this) { UpdateAnimationSingleFrame(this); if (this->frame & ANIM_DONE) { gPlayerState.item = NULL; - sub_0807921C(); + PlayerSetNormalAndCollide(); } } @@ -1696,7 +1698,7 @@ static void PlayerFrozenInit(Entity* this) { this->actionDelay = 120; this->subAction++; gPlayerState.animation = 0x294; - sub_08077B20(); + PutAwayItems(); SoundReq(SFX_195); } @@ -1753,7 +1755,7 @@ static void sub_08072064(Entity* this) { COLLISION_OFF(this); this->actionDelay = gPlayerState.field_0x3a; gPlayerState.animation = gPlayerState.field_0x38 | (gPlayerState.field_0x39 << 8); - ResetPlayer(); + ResetPlayerItem(); } static void sub_08072098(Entity* this) { @@ -1796,7 +1798,7 @@ static void sub_08072100(Entity* this) { } else { gPlayerState.animation = 0x104; } - ResetPlayer(); + ResetPlayerItem(); sub_08072168(this); } @@ -1892,7 +1894,7 @@ static void PlayerLavaInit(Entity* this) { this->knockbackDuration = 10; } gPlayerState.flags |= (PL_BURNING | PL_BUSY); - ResetPlayer(); + ResetPlayerItem(); SoundReq(SFX_124); SoundReq(SFX_PLY_VO6); } @@ -2040,7 +2042,7 @@ static void PlayerRollInit(Entity* this) { } this->subAction = 1; this->actionDelay = 0; - ResetPlayer(); + ResetPlayerItem(); temp = gPlayerState.flags; if (gPlayerState.flags & PL_MINISH) { this->spritePriority.b1 = 0; @@ -2121,7 +2123,7 @@ static void PlayerRollUpdate(Entity* this) { this->speed = 0; break; } - sub_08078F24(); + CheckPlayerVelocity(); UpdatePlayerMovement(); } if (((this->frame & 0x10) == 0) && ((gPlayerState.flags & PL_MINISH) == 0)) { @@ -2192,7 +2194,7 @@ static void PlayerInHoleInit(Entity* this) { } } SetTile(0x4070, COORD_TO_TILE(this), this->collisionLayer); - ResetPlayer(); + ResetPlayerItem(); PlayerInHoleUpdate(this); SoundReq(SFX_81); } @@ -2230,7 +2232,7 @@ static void sub_08072ACC(Entity* this) { this->spritePriority.b0 = 4; this->spritePriority.b1 = 1; gPlayerState.jump_status = 0x41; - sub_0807921C(); + PlayerSetNormalAndCollide(); RestorePrevTileEntity(COORD_TO_TILE(this), this->collisionLayer); } else { this->animationState = Direction8ToAnimationState(gPlayerState.field_0xd); @@ -2259,7 +2261,7 @@ static void sub_08072B5C(Entity* this) { this->z.WORD--; gPlayerState.jump_status = 0x41; sub_0806F854(this, 0, -12); - sub_0807921C(); + PlayerSetNormalAndCollide(); return; } @@ -2291,7 +2293,7 @@ static void sub_08072C48(Entity* this) { } } } else { - sub_0807921C(); + PlayerSetNormalAndCollide(); } } @@ -2332,7 +2334,7 @@ static void sub_08072CFC(Entity* this) { gPlayerState.animation = 0x810; this->actionDelay = 5; this->field_0xf = 0; - ResetPlayer(); + ResetPlayerItem(); } static const u16 sTiles[] = { @@ -2428,7 +2430,7 @@ static void sub_08072D54(Entity* this) { static void sub_08072F14(Entity* this) { if (this->actionDelay-- != 0) { - sub_0807921C(); + PlayerSetNormalAndCollide(); } else { UpdateAnimationSingleFrame(this); } @@ -2461,7 +2463,7 @@ static void sub_08072F94(Entity* this) { switch (gPlayerState.floor_type) { default: - sub_0807921C(); + PlayerSetNormalAndCollide(); break; case SURFACE_LADDER: case SURFACE_AUTO_LADDER: @@ -2544,7 +2546,7 @@ static void sub_08073094(Entity* this) { ResetPlayerAnimationAndAction(); break; default: - sub_0807921C(); + PlayerSetNormalAndCollide(); break; case SURFACE_LADDER: case SURFACE_CLIMB_WALL: @@ -2610,7 +2612,7 @@ static void sub_080731D8(Entity* this) { } gRoomControls.camera_target = NULL; DeleteClones(); - ResetPlayer(); + ResetPlayerItem(); } static void sub_080732D0(Entity* this) { @@ -2682,7 +2684,7 @@ static void sub_080733BC(Entity* this) { LinearMoveUpdate(this); if (this->field_0x7c.HALF_U.HI == this->y.HALF.HI) { gRoomControls.camera_target = this; - sub_0807921C(); + PlayerSetNormalAndCollide(); } } @@ -2711,7 +2713,7 @@ static void sub_08073468(Entity* this) { gPlayerState.flags |= PL_PARACHUTE; CreateObjectWithParent(this, OBJECT_61, 0, 0); } - ResetPlayer(); + ResetPlayerItem(); if (this->zVelocity > 0 || gPlayerState.field_0x38 == 1) COLLISION_OFF(this); } @@ -2749,7 +2751,7 @@ static void sub_08073584(Entity* this) { if ((gPlayerState.field_0x92 & 0x80) || this->iframes > 0 || gPlayerState.field_0x3c[0] || (gPlayerState.flags & PL_PARACHUTE) == 0) { gPlayerState.jump_status |= 0x40; - sub_0807921C(); + PlayerSetNormalAndCollide(); DoJump(this); gPlayerState.animation = 1840; return; @@ -2849,7 +2851,7 @@ static void sub_08073584(Entity* this) { if (--this->field_0x7c.WORD == -1) { gPlayerState.jump_status |= 0x40; - sub_0807921C(); + PlayerSetNormalAndCollide(); } else { u32 di = (this->field_0x7c.WORD / 20); this->z.HALF.HI = -8 - di; @@ -2879,7 +2881,7 @@ static void sub_080737BC(Entity* this) { tmp &= pos; if (tmp == 8 && !sub_080B1B0C(this)) { gPlayerState.jump_status |= 0x40; - sub_0807921C(); + PlayerSetNormalAndCollide(); } } @@ -2946,7 +2948,7 @@ static void sub_08073924(Entity* this) { gPlayerState.jump_status = 0x40; gPlayerState.field_0xd = 0xff; this->direction = 0xff; - sub_08077B20(); + PutAwayItems(); sub_08073968(this); } } @@ -2955,7 +2957,7 @@ static void sub_08073968(Entity* this) { if ((gPlayerState.jump_status & 0xC0) == 0) { this->direction = gPlayerState.field_0xd; } - sub_08078F24(); + CheckPlayerVelocity(); if ((gPlayerState.heldObject | gPlayerState.keepFacing) == 0) { if (gPlayerState.flags & PL_NO_CAP) { gPlayerState.animation = 1052; @@ -3208,14 +3210,14 @@ static void sub_08073F04(Entity* this) { this->zVelocity = Q_16_16(2.5); this->speed = 0x100; gPlayerState.flags &= ~PL_MINISH; - ResetPlayer(); + ResetPlayerItem(); } static void sub_08073F4C(Entity* this) { - u32 x = gArea.curPortalX; - u32 y = gArea.curPortalY; + u32 x = gArea.portal_x; + u32 y = gArea.portal_y; if (this->x.HALF.HI != x || this->y.HALF.HI != y) { - this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, gArea.curPortalX, gArea.curPortalY); + this->direction = CalculateDirectionTo(this->x.HALF.HI, this->y.HALF.HI, gArea.portal_x, gArea.portal_y); this->speed = 0x100; LinearMoveUpdate(this); } else { @@ -3311,7 +3313,7 @@ void sub_080740D8(Entity* this) { else this->field_0xf = 1; if (!GravityUpdate(this, GRAVITY_RATE)) - sub_0807921C(); + PlayerSetNormalAndCollide(); } u32 sub_080741C4(void) { @@ -3329,7 +3331,7 @@ void SurfaceAction_DoNothing(Entity* this) { void SurfaceAction_Pit(Entity* this) { if (!sub_080741C4() && sub_08079C30(this)) { if (this->action != PLAYER_FALL) { - ResetPlayer(); + ResetPlayerItem(); gPlayerState.queued_action = PLAYER_FALL; } } @@ -3418,7 +3420,7 @@ static void hide(Entity* this) { this->spriteSettings.draw = 0; COLLISION_OFF(this); this->knockbackDuration = 0; - ResetPlayer(); + ResetPlayerItem(); } void SurfaceAction_14(Entity* this) { @@ -3478,7 +3480,7 @@ void SurfaceAction_CloneTile(Entity* this) { gPlayerState.flags |= PL_CLONING; this->x.WORD = (this->x.WORD & ~0xFFFFF) | 0x80000; this->y.WORD = (this->y.WORD & ~0xFFFFF) | 0x80000; - sub_08077AEC(); + ResetLantern(); } } } @@ -3552,7 +3554,7 @@ void SurfaceAction_Swamp(Entity* this) { return; } } else { - sub_08077B20(); + PutAwayItems(); } if (gPlayerState.field_0x37 == 1) { @@ -3595,7 +3597,7 @@ void SurfaceAction_Water(Entity* this) { } static void sub_08074808(Entity* this) { - sub_08077AEC(); + ResetLantern(); if (GetInventoryValue(ITEM_FLIPPERS) == 1) { if (!gPlayerState.swim_state) { if ((gPlayerState.flags & PL_FLAGS10000) != 0) @@ -3607,7 +3609,7 @@ static void sub_08074808(Entity* this) { if ((gPlayerState.flags & PL_MINISH) == 0) CreateFx(this, FX_WATER_SPLASH, 0); SoundReq(SFX_1A5); - ResetPlayer(); + ResetPlayerItem(); } if ((gPlayerState.swim_state & 0xF) != 1) { sub_08079744(this); @@ -3664,7 +3666,7 @@ void SurfaceAction_Ladder(Entity* this) { this->spriteOrientation.flipY = 1; this->animationState = IdleNorth; this->collisionLayer = 3; - ResetPlayer(); + ResetPlayerItem(); } } @@ -3692,7 +3694,7 @@ void SurfaceAction_AutoLadder(Entity* this) { gPlayerState.animation = 726; this->direction = DirectionNorth; } - ResetPlayer(); + ResetPlayerItem(); } } @@ -3775,7 +3777,7 @@ void SurfaceAction_ConveyerEast(Entity* this) { } static void conveyer_push(Entity* this) { - ResetPlayer(); + ResetPlayerItem(); this->spritePriority.b1 = 0; this->speed = WALK_SPEED; gPlayerState.flags |= PL_FLAGS2000000; diff --git a/src/playerItem/playerItemBottle.c b/src/playerItem/playerItemBottle.c index c3617b25..f4363c31 100644 --- a/src/playerItem/playerItemBottle.c +++ b/src/playerItem/playerItemBottle.c @@ -88,7 +88,7 @@ void PlayerItemBottle_Action1(Entity* this) { #if defined(EU) || defined(JP) || defined(DEMO_JP) CreateItemEntity(this->type2, iVar1, 5); #else - sub_080A7C18(this->type2, iVar1, 5); + InitItemGetSequence(this->type2, iVar1, 5); #endif SoundReq(SFX_109); } diff --git a/src/playerItem/playerItemPacciCane.c b/src/playerItem/playerItemPacciCane.c index 3a1d7540..5a9fbd14 100644 --- a/src/playerItem/playerItemPacciCane.c +++ b/src/playerItem/playerItemPacciCane.c @@ -59,5 +59,5 @@ void PlayerItemPacciCane_Action1(Entity* this) { // TODO This name sounds like this does not belong in this file void ClearMenuSavestate(void) { - MemClear(&gUnk_02034490, sizeof(gUnk_02034490)); + MemClear(&gPauseMenuOptions, sizeof(gPauseMenuOptions)); } diff --git a/src/playerItemUtils.c b/src/playerItemUtils.c index 09e822db..094128cb 100644 --- a/src/playerItemUtils.c +++ b/src/playerItemUtils.c @@ -8,10 +8,11 @@ #include "object.h" #include "player.h" -Entity* GiveItemWithCutscene(u32, u32, u32); +static Entity* GiveItemWithCutscene(u32, u32, u32); +static void InitTileMessage(u32, u32); + Entity* sub_080A276C(Entity*, u32, u32); -void sub_08078AF0(Entity*, u32, u32); -void sub_080A7D44(u32, u32); +void SetPlayerItemGetState(Entity*, u32, u32); void CreateItemEntity(u32 type, u32 type2, u32 delay) { Entity* e = GiveItemWithCutscene(type, type2, delay); @@ -20,15 +21,15 @@ void CreateItemEntity(u32 type, u32 type2, u32 delay) { } } -void sub_080A7C18(u32 type, u32 type2, u32 delay) { +void InitItemGetSequence(u32 type, u32 type2, u32 delay) { Entity* e = GiveItemWithCutscene(type, type2, delay); if (e != NULL) { e->parent = &gPlayerEntity; - sub_08078AF0(e, e->type, 0); + SetPlayerItemGetState(e, e->type, 0); } } -Entity* GiveItemWithCutscene(u32 type, u32 type2, u32 delay) { +static Entity* GiveItemWithCutscene(u32 type, u32 type2, u32 delay) { Entity* e; if (type == 63 && gSave.stats.hasAllFigurines) { type = 87; @@ -75,18 +76,19 @@ void sub_080A7C8C(u32 pos, u32 layer) { u32 sub_080A7CFC(u32 a1) { u32 msg = 0x600; - u32 isTileEntity6 = 0; + bool32 hint = FALSE; + TileEntity* t = GetCurrentRoomProperty(3); if (t != 0) { do { if (t->_4 == a1) { switch (t->type) { case SIGN: - isTileEntity6 = 0; + hint = FALSE; msg = *(u16*)&t->_6; break; - case TILE_ENTITY_6: - isTileEntity6 = 1; + case TILE_EZLO_HINT: + hint = TRUE; msg = *(u16*)&t->_6; break; } @@ -95,13 +97,14 @@ u32 sub_080A7CFC(u32 a1) { t++; } while (t->_4 != 0); } - sub_080A7D44(msg, isTileEntity6); + InitTileMessage(msg, hint); } -void sub_080A7D44(u32 msg, u32 isTileEntity6) { - if (isTileEntity6) +static void InitTileMessage(u32 msg, u32 hint) { + if (hint) { CreateEzloHint(msg, 0); - else + } else { // Read sign text MessageFromTarget(msg); + } } diff --git a/src/playerUtils.c b/src/playerUtils.c index d879ff6f..7833a875 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -18,7 +18,6 @@ extern void sub_080752E8(ItemBehavior* behavior, u32 arg1); // item.c extern void sub_0800857C(Entity*); extern void SetDefaultPriorityForKind(Entity*); -extern void DoPlayerAction(Entity*); extern void sub_0809D738(Entity*); extern s32 Mod(s32, s32); extern void sub_08003FDE(Entity*, u32, u32, u32); @@ -44,7 +43,7 @@ u32 sub_080789A8(void); ItemBehavior* sub_080779EC(u32); void DeletePlayerItem(ItemBehavior*, u32); bool32 sub_08079E90(u32); -void sub_08079258(void); +void PlayerMinishSetNormalAndCollide(void); void sub_08078D60(void); void* sub_08077C54(ItemBehavior*); u32 sub_08079FD4(Entity*, u32); @@ -130,8 +129,8 @@ NONMATCH("asm/non_matching/playerUtils/sub_080777A0.inc", bool32 sub_080777A0(vo gPlayerState.chargeState.action = 1; DeleteClones(); } else { - if (gArea.field_0x18 != 2) { - if (gArea.field_0x18 == 3) { + if (gArea.portal_mode != 2) { + if (gArea.portal_mode == 3) { if ((gArea.unk1A == 0) && ((gPlayerState.flags & PL_MINISH) != 0)) { gPlayerEntity.subAction += 1; gPlayerEntity.flags &= ~ENT_COLLIDE; @@ -280,7 +279,7 @@ ItemBehavior* sub_08077AC8(void) { return gUnk_03000B80 + 3; } -void sub_08077AEC(void) { +void ResetLantern(void) { u32 slot; DeletePlayerItem(gUnk_03000B80 + 3, 3); @@ -291,12 +290,12 @@ void sub_08077AEC(void) { } } -void sub_08077B20(void) { - ResetPlayer(); - sub_08077AEC(); +void PutAwayItems(void) { + ResetPlayerItem(); + ResetLantern(); } -void ResetPlayer() { +void ResetPlayerItem() { u32 index = 0; ItemBehavior* ptr = gUnk_03000B80; do { @@ -325,10 +324,9 @@ void ResetPlayer() { switch (gPlayerState.framestate) { case 2: case 3: - case 4: { + case 4: gPlayerState.framestate = PL_STATE_IDLE; break; - } } } @@ -562,18 +560,22 @@ bool32 sub_08077F24(ItemBehavior* beh, u32 arg1) { return (val & arg1) ? 1 : 0; } -void sub_08077F50(ItemBehavior* beh, u32 arg1) { - sub_08079184(); +void PlayerCancelHoldItem(ItemBehavior* beh, u32 arg1) { + PlayerDropHeldObject(); DeletePlayerItem(beh, arg1); } -u32 sub_08077F64(ItemBehavior* arg0, u32 unk) { +/** + * Check if player state believes the held item is valid? + * If it's not delete the item? + */ +bool32 PlayerTryDropItem(ItemBehavior* arg0, u32 unk) { u32 temp; if (gPlayerState.heldObject == 0) { - sub_08077F50(arg0, unk); - temp = 0; + PlayerCancelHoldItem(arg0, unk); + temp = FALSE; } else { - temp = 1; + temp = TRUE; } return temp; } @@ -850,7 +852,7 @@ void sub_08078AC0(u32 param_1, u32 param_2, u32 param_3) { } /** Set up player states for getting the item? */ -void sub_08078AF0(Entity* item, u8 param_2, u8 param_3) { +void SetPlayerItemGetState(Entity* item, u8 param_2, u8 param_3) { gPlayerState.field_0x38 = param_2; gPlayerState.field_0x39 = param_3; gPlayerState.field_0x3a = 0; @@ -956,7 +958,7 @@ void sub_08078E84(Entity* param_1, Entity* param_2) { } } -void sub_08078EE4(void) { +void ResetPlayerPosition(void) { gPlayerEntity.x.HALF.HI = gPlayerState.startPosX; gPlayerEntity.y.HALF.HI = gPlayerState.startPosY; } @@ -973,7 +975,8 @@ bool32 CheckQueuedAction(void) { } } -void sub_08078F24(void) { +// this doesnt seem to have any real function where its used +void CheckPlayerVelocity(void) { u32 angle = gPlayerState.field_0xd; if ((angle & 0x80) != 0) { ResetPlayerVelocity(); @@ -989,7 +992,7 @@ void ResetPlayerVelocity(void) { } bool32 sub_08078F74(Entity* this) { - if ((gArea.field_0x18 == 3) && (gPlayerState.field_0x35 != 0xff)) { + if ((gArea.portal_mode == 3) && (gPlayerState.field_0x35 != 0xff)) { gPlayerState.jump_status = 0x81; this->action = 0x15; this->subAction = 0; @@ -1041,17 +1044,17 @@ void sub_080790E4(Entity* this) { } } -void sub_08079184(void) { +void PlayerDropHeldObject(void) { gPlayerState.heldObject = 0; gPlayerState.field_0x0[1] = 0; gNewPlayerEntity.unk_74 = NULL; } -void sub_0807919C(void) { +void PlayerResetStateFromFusion(void) { if ((gPlayerState.flags & PL_MINISH) == 0) { SetPlayerActionNormal(); } else { - sub_08079258(); + PlayerMinishSetNormalAndCollide(); } } @@ -1067,13 +1070,13 @@ void ResetPlayerAnimationAndAction(void) { } if ((gPlayerState.flags & PL_MINISH) == 0) { gPlayerEntity.spritePriority.b1 = 1; - sub_0807921C(); + PlayerSetNormalAndCollide(); } else { - sub_08079258(); + PlayerMinishSetNormalAndCollide(); } } -void sub_0807921C(void) { +void PlayerSetNormalAndCollide(void) { gPlayerEntity.flags |= ENT_COLLIDE; gPlayerEntity.spriteSettings.draw = 3; gPlayerState.flags &= ~(PL_BUSY | PL_DROWNING | PL_DISABLE_ITEMS | PL_FROZEN | PL_ROLLING | PL_IN_HOLE | @@ -1083,7 +1086,7 @@ void sub_0807921C(void) { SetDefaultPriorityForKind(&gPlayerEntity); } -void sub_08079258(void) { +void PlayerMinishSetNormalAndCollide(void) { if ((gPlayerState.flags & PL_HIDDEN) == 0) { gPlayerEntity.flags |= ENT_COLLIDE; gPlayerEntity.spriteSettings.draw = 3; @@ -1202,7 +1205,7 @@ void sub_08079D84(void) { gPlayerState.field_0x3a = 0x3c; gPlayerState.queued_action = PLAYER_0807204C; gPlayerEntity.iframes = 0x7c; - sub_08077B20(); + PutAwayItems(); SoundReq(SFX_193); } } @@ -1446,7 +1449,7 @@ void UpdatePlayerSkills(void) { void sub_0807AFE8(void) { Entity* effect; - sub_08077B20(); + PutAwayItems(); effect = CreateFx(&gPlayerEntity, FX_BIG_EXPLOSION2, 0); if (effect != NULL) { effect->y.HALF.HI++; diff --git a/src/projectile/v1DarkMagicProjectile.c b/src/projectile/v1DarkMagicProjectile.c index 8131c3d7..188fed6e 100644 --- a/src/projectile/v1DarkMagicProjectile.c +++ b/src/projectile/v1DarkMagicProjectile.c @@ -35,7 +35,7 @@ void sub_080AAC44(Entity* this) { } else { SortEntityAbove(this->parent, this); } - ResetPlayer(); + ResetPlayerItem(); gPlayerState.mobility |= 0x80; gPlayerState.field_0xa |= 0x80; } @@ -215,7 +215,7 @@ void sub_080AAF74(Entity* this) { gPlayerState.mobility = 0; this->health = 0; } else { - ResetPlayer(); + ResetPlayerItem(); gPlayerState.mobility |= 0x80; gPlayerState.field_0xa |= 0x80; CopyPosition(&gPlayerEntity, this); diff --git a/src/script.c b/src/script.c index 1bdf1468..cbcab29d 100644 --- a/src/script.c +++ b/src/script.c @@ -443,21 +443,21 @@ void sub_0807DEDC(Entity* entity, ScriptExecutionContext* context, u32 x, u32 y) void sub_0807DF28(void) { sub_0807DF38(); - sub_08079184(); - sub_08077B20(); + PlayerDropHeldObject(); + PutAwayItems(); } void sub_0807DF38(void) { gUnk_0200AF00.unk_1 = 0xff; - gUnk_02034490.unk0 = 0xff; + gPauseMenuOptions.disabled = 0xff; } void sub_0807DF50(void) { - gUnk_02034490.unk0 = 0; + gPauseMenuOptions.disabled = 0; gUnk_0200AF00.unk_1 = 0; RecoverUI(0); ResetPlayerAnimationAndAction(); - sub_08079184(); + PlayerDropHeldObject(); } void ExecuteScript(Entity* entity, ScriptExecutionContext* context) { @@ -849,7 +849,7 @@ void ScriptCommand_BuyItem(Entity* entity, ScriptExecutionContext* context) { context->condition = (price <= gSave.stats.rupees); if (context->condition) { ModRupees(-price); - sub_080A7C18(item, tmp2, 0); + InitItemGetSequence(item, tmp2, 0); gRoomVars.shopItemType = 0; gRoomVars.shopItemType2 = 0; } @@ -1157,7 +1157,7 @@ void ScriptCommand_0807E9F0(Entity* entity, ScriptExecutionContext* context) { switch (gFuseInfo._0) { case 2: gPlayerState.controlMode = CONTROL_DISABLED; - gUnk_02034490.unk0 = tmp; + gPauseMenuOptions.disabled = tmp; context->condition = tmp; break; case 1: @@ -1167,7 +1167,7 @@ void ScriptCommand_0807E9F0(Entity* entity, ScriptExecutionContext* context) { goto lbl; } if (tmp) { - sub_0807919C(); + PlayerResetStateFromFusion(); gPlayerState.controlMode = CONTROL_1; } else { lbl: @@ -1489,11 +1489,11 @@ void ScriptCommand_GivePlayerItem(Entity* entity, ScriptExecutionContext* contex if (context->scriptInstructionPointer[1] == 0x3F) { tmp = context->intVariable; } - sub_080A7C18(context->scriptInstructionPointer[1], tmp, 0); + InitItemGetSequence(context->scriptInstructionPointer[1], tmp, 0); } void ScriptCommand_GiveKinstone(Entity* entity, ScriptExecutionContext* context) { - sub_080A7C18(0x5C, context->scriptInstructionPointer[1], 0); + InitItemGetSequence(0x5C, context->scriptInstructionPointer[1], 0); } void ScriptCommand_GetInventoryValue(Entity* entity, ScriptExecutionContext* context) { @@ -1506,7 +1506,7 @@ void ScriptCommand_SetInventoryValue(Entity* entity, ScriptExecutionContext* con } void ScriptCommand_0807F088(Entity* entity, ScriptExecutionContext* context) { - sub_080A7C18(context->scriptInstructionPointer[1], 0, 3); + InitItemGetSequence(context->scriptInstructionPointer[1], 0, 3); } void ScriptCommand_CameraTargetEntity(Entity* entity, ScriptExecutionContext* context) { @@ -1906,13 +1906,13 @@ void sub_0807F800(Entity* entity, ScriptExecutionContext* context) { price = GetItemPrice(item); ModRupees(-price); - sub_080A7C18(item, 0, 0); + InitItemGetSequence(item, 0, 0); gRoomVars.shopItemType = 0; gActiveScriptInfo.flags |= 1; } void sub_0807F83C(Entity* entity, ScriptExecutionContext* context) { - sub_08079184(); + PlayerDropHeldObject(); } void sub_0807F844(Entity* entity, ScriptExecutionContext* context) { diff --git a/src/scroll.c b/src/scroll.c index ba5986e4..d987b2c1 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -192,7 +192,7 @@ void sub_0807FF6C(RoomControls* controls) { gScreen.controls.windowOutsideControl = (gScreen.controls.windowOutsideControl & 0xff00) | 7; gScreen.controls.window1HorizontalDimensions = 0xf0; gScreen.controls.window1VerticalDimensions = 0xf0; - ResetPlayer(); + ResetPlayerItem(); ResetPlayerAnimationAndAction(); if (gUnk_03004030.isDiggingCave) { gPlayerEntity.animationState = 4; diff --git a/src/subtask2.c b/src/subtask2.c index f27faf5e..d4755441 100644 --- a/src/subtask2.c +++ b/src/subtask2.c @@ -263,7 +263,7 @@ void sub_080A6DF8(void) { ResetPlayerAnimationAndAction(); sub_080042D0(&gPlayerEntity, (u32)gPlayerEntity.animIndex, gPlayerEntity.spriteIndex); Subtask_Exit(); - gUnk_02034490.unk0 = 0; + gPauseMenuOptions.disabled = 0; SoundReq(SFX_MENU_CANCEL); } } diff --git a/src/ui.c b/src/ui.c index e72b7ea0..006cb3f2 100644 --- a/src/ui.c +++ b/src/ui.c @@ -617,7 +617,7 @@ void TextUIElement(UIElement* element) { if (element->type2 == 9) { tmp = gUnk_0200AF00.unk_2f; if (tmp == 0) { - switch (gArea.field_0x18) { + switch (gArea.portal_mode) { case 2: tmp = 0xb; break;