From 985eeb67a17517d522e963a1e52eafcd07712520 Mon Sep 17 00:00:00 2001 From: Catobat <69204835+Catobat@users.noreply.github.com> Date: Sun, 30 Apr 2023 15:10:30 +0200 Subject: [PATCH] Name members for R actions in struct_0200AF00 --- include/structures.h | 8 ++++---- src/beanstalkSubtask.c | 6 +++--- src/interrupts.c | 8 ++++---- src/item/itemTryPickupObject.c | 2 +- src/object/crenelBeanSprout.c | 6 +++--- src/object/itemForSale.c | 12 ++++++------ src/player.c | 4 ++-- src/playerUtils.c | 14 +++++++------- src/ui.c | 22 +++++++++++----------- 9 files changed, 41 insertions(+), 41 deletions(-) diff --git a/include/structures.h b/include/structures.h index b18bb1ea..2560d32a 100644 --- a/include/structures.h +++ b/include/structures.h @@ -117,10 +117,10 @@ typedef struct { u8 filler22[0x2]; u8 ezloNagFuncIndex; u8 filler25[7]; - u8 unk_2c; - u8 unk_2d; - u8 unk_2e; - u8 unk_2f; + u8 rActionInteractObject; // used as R button UI frame index + u8 rActionInteractTile; + u8 rActionGrabbing; + u8 rActionPlayerState; // if not 0, overrides other R actions u8 buttonText[3]; u8 unk_33; UIElement elements[MAX_UI_ELEMENTS]; diff --git a/src/beanstalkSubtask.c b/src/beanstalkSubtask.c index 42f6943b..6d102626 100644 --- a/src/beanstalkSubtask.c +++ b/src/beanstalkSubtask.c @@ -310,7 +310,7 @@ u32 UpdatePlayerCollision(void) { if (gPlayerEntity.animationState != 0) { return 0; } - gUnk_0200AF00.unk_2d = 4; + gUnk_0200AF00.rActionInteractTile = 4; if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) { return 0; } @@ -324,7 +324,7 @@ u32 UpdatePlayerCollision(void) { if ((gPlayerState.flags & 0x4080) != 0) { return 0; } - gUnk_0200AF00.unk_2d = 6; + gUnk_0200AF00.rActionInteractTile = 6; if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) { return 0; } @@ -335,7 +335,7 @@ u32 UpdatePlayerCollision(void) { if (HasDungeonSmallKey() == 0) { return 0; } - gUnk_0200AF00.unk_2d = 6; + gUnk_0200AF00.rActionInteractTile = 6; if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0) { return 0; } diff --git a/src/interrupts.c b/src/interrupts.c index 63abe0ea..674d064a 100644 --- a/src/interrupts.c +++ b/src/interrupts.c @@ -225,9 +225,9 @@ void PlayerUpdate(Entity* this) { static void HandlePlayerLife(Entity* this) { u32 temp; - gUnk_0200AF00.unk_2f = 0; - gUnk_0200AF00.unk_2d = 0; - gUnk_0200AF00.unk_2e = 0; + gUnk_0200AF00.rActionPlayerState = 0; + gUnk_0200AF00.rActionInteractTile = 0; + gUnk_0200AF00.rActionGrabbing = 0; if ((gPlayerEntity.contactFlags & 0x80) && (gPlayerEntity.iframes > 0)) SoundReq(SFX_86); @@ -323,7 +323,7 @@ static void sub_080171F0(void) { sub_080028E0(&gPlayerEntity); if (gPlayerState.flags & PL_CLONING) - gUnk_0200AF00.unk_2f = 1; + gUnk_0200AF00.rActionPlayerState = 1; sub_08078180(); gPlayerState.field_0x7 &= ~0x80; diff --git a/src/item/itemTryPickupObject.c b/src/item/itemTryPickupObject.c index 8a7b40dc..d776eee7 100644 --- a/src/item/itemTryPickupObject.c +++ b/src/item/itemTryPickupObject.c @@ -95,7 +95,7 @@ void ItemPickupCheck(ItemBehavior* this, u32 index) { carried->subAction = 5; gPlayerState.framestate = PL_STATE_THROW; sub_080762C4(this, carried, 2, index); - gUnk_0200AF00.unk_2e = 8; + gUnk_0200AF00.rActionGrabbing = 8; SoundReq(SFX_102); break; case 1: diff --git a/src/object/crenelBeanSprout.c b/src/object/crenelBeanSprout.c index a0fb206d..ee3364ee 100644 --- a/src/object/crenelBeanSprout.c +++ b/src/object/crenelBeanSprout.c @@ -172,9 +172,9 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { this->unk_70 = ((super->x.HALF.HI + (s8)gUnk_08123184[tmp]) & -0x10) | 8; this->unk_72 = ((super->y.HALF.HI + (s8)gUnk_08123184[(tmp) + 1]) & -0x10) | 8; if (sub_080B1AB4(this->unk_70, this->unk_72, super->collisionLayer) == 0x19) { - gUnk_0200AF00.unk_2f = 3; + gUnk_0200AF00.rActionPlayerState = 3; } else { - gUnk_0200AF00.unk_2f = 0; + gUnk_0200AF00.rActionPlayerState = 0; } PositionRelative(&gPlayerEntity, super, 0, 0x10000); if (GetTileUnderEntity(super) == 0x19) { @@ -184,7 +184,7 @@ void CrenelBeanSprout_Action1(CrenelBeanSproutEntity* this) { if ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_40)) == 0) { return; } - if (gUnk_0200AF00.unk_2f != 3) { + if (gUnk_0200AF00.rActionPlayerState != 3) { return; } gPlayerState.heldObject = 0; diff --git a/src/object/itemForSale.c b/src/object/itemForSale.c index 0f4b1fa5..ad83696b 100644 --- a/src/object/itemForSale.c +++ b/src/object/itemForSale.c @@ -85,7 +85,7 @@ void ItemForSale_Init(ItemForSaleEntity* this) { void ItemForSale_Action1(ItemForSaleEntity* this) { if (super->subAction != 0) { super->action = 2; - gUnk_0200AF00.unk_2f = 2; + gUnk_0200AF00.rActionPlayerState = 2; } else { if (super->type == 0x36) { if (super->interactType != 0) { @@ -102,7 +102,7 @@ void ItemForSale_Action1(ItemForSaleEntity* this) { ResetActiveItems(); gPlayerState.heldObject = 4; gNewPlayerEntity.unk_74 = super; - gUnk_0200AF00.unk_2f = 2; + gUnk_0200AF00.rActionPlayerState = 2; MessageClose(); } } @@ -112,14 +112,14 @@ void ItemForSale_Action1(ItemForSaleEntity* this) { void ItemForSale_Action2(ItemForSaleEntity* this) { void* ptr; - gUnk_0200AF00.unk_2f = 2; + gUnk_0200AF00.rActionPlayerState = 2; super->spriteSettings.draw = gPlayerEntity.spriteSettings.draw; if ((gPlayerState.heldObject == 0) || (super != gNewPlayerEntity.unk_74)) { sub_080819B4(this); } else { ptr = sub_080784E4(); if (((*(int*)(ptr + 8) == 0) || - ((*(u8*)(ptr + 1) != 1 || (gUnk_0200AF00.unk_2f = 7, (gPlayerState.playerInput.newInput & + ((*(u8*)(ptr + 1) != 1 || (gUnk_0200AF00.rActionPlayerState = 7, (gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_8)) == 0)))) && ((gPlayerState.playerInput.newInput & (PLAYER_INPUT_80 | PLAYER_INPUT_10 | PLAYER_INPUT_8)) != 0)) { sub_080819B4(this); @@ -142,8 +142,8 @@ void sub_080819B4(ItemForSaleEntity* this) { gNewPlayerEntity.unk_74 = 0; ptr = &gUnk_0200AF00; gRoomVars.shopItemType = 0; - ptr->unk_2c = 0; - ptr->unk_2f = 0; + ptr->rActionInteractObject = 0; + ptr->rActionPlayerState = 0; gRoomVars.shopItemType2 = 0; super->x.HALF.HI = this->unk_80 + gRoomControls.origin_x; super->y.HALF.HI = this->unk_82 + gRoomControls.origin_y; diff --git a/src/player.c b/src/player.c index d5f7a4e7..fd341662 100644 --- a/src/player.c +++ b/src/player.c @@ -1830,7 +1830,7 @@ static void PlayerPull(Entity* this) { gPlayerState.framestate = PL_STATE_PULL; sPlayerPullStates[this->subAction](this); - gUnk_0200AF00.unk_2e = 8; + gUnk_0200AF00.rActionGrabbing = 8; } static void sub_08072214(Entity* this) { @@ -2756,7 +2756,7 @@ static void sub_08073584(Entity* this) { return; } - gUnk_0200AF00.unk_2f = 1; + gUnk_0200AF00.rActionPlayerState = 1; if (sub_0807A2F8(0)) { this->subAction++; this->direction = 4 * (this->animationState & 6); diff --git a/src/playerUtils.c b/src/playerUtils.c index caad6878..5ce3c50d 100644 --- a/src/playerUtils.c +++ b/src/playerUtils.c @@ -211,7 +211,7 @@ bool32 IsPreventedFromUsingItem(void) { } return FALSE; default: - if ((((gUnk_0200AF00.unk_2c == 0xc) && (gPlayerState.field_0x1c == 0)) && + if ((((gUnk_0200AF00.rActionInteractObject == 0xc) && (gPlayerState.field_0x1c == 0)) && (gPlayerState.floor_type != SURFACE_SWAMP)) && ((((gPlayerState.playerInput.heldInput & PLAYER_INPUT_ANY_DIRECTION) != 0 && ((gPlayerState.flags & (PL_BURNING | PL_ROLLING)) == 0)) && @@ -976,21 +976,21 @@ void sub_08078180(void) { u8 uVar3; InteractableObject* ptr; - if (gUnk_0200AF00.unk_2f != 0) + if (gUnk_0200AF00.rActionPlayerState != 0) return; uVar1 = 0; if ((gPlayerState.jump_status == 0) && ((gPlayerState.flags & (PL_IN_HOLE | PL_FROZEN | PL_BURNING | PL_DISABLE_ITEMS | PL_DRUGGED)) == 0)) { if ((u8)(gPlayerState.heldObject - 1) < 4) { - if (gUnk_0200AF00.unk_2e != 0) { - uVar1 = gUnk_0200AF00.unk_2e; + if (gUnk_0200AF00.rActionGrabbing != 0) { + uVar1 = gUnk_0200AF00.rActionGrabbing; } else { uVar1 = 3; } } else { - if (gUnk_0200AF00.unk_2d != 0) { - uVar1 = gUnk_0200AF00.unk_2d; + if (gUnk_0200AF00.rActionInteractTile != 0) { + uVar1 = gUnk_0200AF00.rActionInteractTile; } else { ptr = sub_080784E4(); if (ptr->entity->interactType == 0) { @@ -1040,7 +1040,7 @@ void sub_08078180(void) { } } } - gUnk_0200AF00.unk_2c = uVar1; + gUnk_0200AF00.rActionInteractObject = uVar1; } bool32 sub_080782C0(void) { diff --git a/src/ui.c b/src/ui.c index f51fdfd6..7b9489d7 100644 --- a/src/ui.c +++ b/src/ui.c @@ -739,30 +739,30 @@ void ItemUIElement(UIElement* element) { void TextUIElement(UIElement* element) { UIElement* buttonUIElement; - u32 tmp; + u32 frameIndex; if (element->type2 == 9) { - tmp = gUnk_0200AF00.unk_2f; - if (tmp == 0) { + frameIndex = gUnk_0200AF00.rActionPlayerState; + if (frameIndex == 0) { switch (gArea.portal_mode) { case 2: - tmp = 0xb; + frameIndex = 0xb; break; case 3: - tmp = 0xa; + frameIndex = 0xa; break; default: - tmp = gUnk_0200AF00.unk_2c; + frameIndex = gUnk_0200AF00.rActionInteractObject; break; } } - gUnk_0200AF00.buttonText[2] = tmp; + gUnk_0200AF00.buttonText[2] = frameIndex; } - tmp = gUnk_0200AF00.buttonText[element->buttonElementId]; + frameIndex = gUnk_0200AF00.buttonText[element->buttonElementId]; element->unk_0_1 = 0; - if (tmp != 0) { - tmp += gUnk_080C9044[((SaveHeader*)0x2000000)->language]; - sub_0801CAFC(element, tmp); + if (frameIndex != 0) { + frameIndex += gUnk_080C9044[((SaveHeader*)0x2000000)->language]; + sub_0801CAFC(element, frameIndex); buttonUIElement = FindUIElement(element->buttonElementId); if (buttonUIElement != NULL) { element->x = buttonUIElement->x;