From 53c57599a4b2116a2900465f2567b2da21147c3e Mon Sep 17 00:00:00 2001 From: fig02 Date: Thu, 10 Oct 2024 22:04:30 -0400 Subject: [PATCH] Name talking action related things (#2260) * name talking related things * Player_Action_TalkExchangeItem -> Player_Action_ExchangeItem * splitting action stuff to new PR * format --- include/z64player.h | 4 +- src/code/z_actor.c | 18 ++--- .../ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c | 2 +- .../ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c | 2 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 2 +- .../actors/ovl_En_Goroiwa/z_en_goroiwa.c | 2 +- .../actors/ovl_En_Nutsball/z_en_nutsball.c | 2 +- src/overlays/actors/ovl_En_Okuta/z_en_okuta.c | 2 +- .../actors/ovl_player_actor/z_player.c | 81 +++++++++++-------- 9 files changed, 63 insertions(+), 52 deletions(-) diff --git a/include/z64player.h b/include/z64player.h index 3f79d7ca55..8b9ea8ce56 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -675,7 +675,7 @@ typedef struct WeaponInfo { #define PLAYER_STATE1_3 (1 << 3) #define PLAYER_STATE1_HOSTILE_LOCK_ON (1 << 4) // Currently locked onto a hostile actor. Triggers a "battle" variant of many actions. #define PLAYER_STATE1_5 (1 << 5) -#define PLAYER_STATE1_6 (1 << 6) +#define PLAYER_STATE1_TALKING (1 << 6) // Currently talking to an actor. This includes item exchanges. #define PLAYER_STATE1_DEAD (1 << 7) // Player has died. Note that this gets set when the death cutscene has started, after landing from the air. #define PLAYER_STATE1_START_CHANGING_HELD_ITEM (1 << 8) // Item change process has begun #define PLAYER_STATE1_9 (1 << 9) @@ -903,7 +903,7 @@ typedef struct Player { /* 0x0888 */ f32 distToInteractWall; // xyz distance to the interact wall /* 0x088C */ u8 ledgeClimbType; /* 0x088D */ u8 ledgeClimbDelayTimer; - /* 0x088E */ u8 unk_88E; + /* 0x088E */ u8 textboxBtnCooldownTimer; // Prevents usage of A/B/C-up when counting down /* 0x088F */ u8 damageFlickerAnimCounter; // Used to flicker Link after taking damage /* 0x0890 */ u8 unk_890; /* 0x0891 */ u8 bodyShockTimer; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index cbe84c927e..49ee50fbe8 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -389,7 +389,7 @@ void Attention_Draw(Attention* attention, PlayState* play) { Attention_SetReticlePos(attention, attention->curReticle, projectedPos.x, projectedPos.y, projectedPos.z); - if (!(player->stateFlags1 & PLAYER_STATE1_6) || (actor != player->focusActor)) { + if (!(player->stateFlags1 & PLAYER_STATE1_TALKING) || (actor != player->focusActor)) { OVERLAY_DISP = Gfx_SetupDL(OVERLAY_DISP, SETUPDL_57); for (i = 0, curReticle = attention->curReticle; i < numReticles; @@ -2308,29 +2308,29 @@ void Actor_InitContext(PlayState* play, ActorContext* actorCtx, ActorEntry* play u32 sCategoryFreezeMasks[ACTORCAT_MAX] = { // ACTORCAT_SWITCH - PLAYER_STATE1_6 | PLAYER_STATE1_DEAD | PLAYER_STATE1_28, + PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_28, // ACTORCAT_BG - PLAYER_STATE1_6 | PLAYER_STATE1_DEAD | PLAYER_STATE1_28, + PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_28, // ACTORCAT_PLAYER 0, // ACTORCAT_EXPLOSIVE - PLAYER_STATE1_6 | PLAYER_STATE1_DEAD | PLAYER_STATE1_10 | PLAYER_STATE1_28, + PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_10 | PLAYER_STATE1_28, // ACTORCAT_NPC PLAYER_STATE1_DEAD, // ACTORCAT_ENEMY - PLAYER_STATE1_6 | PLAYER_STATE1_DEAD | PLAYER_STATE1_28 | PLAYER_STATE1_29, + PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_28 | PLAYER_STATE1_29, // ACTORCAT_PROP PLAYER_STATE1_DEAD | PLAYER_STATE1_28, // ACTORCAT_ITEMACTION 0, // ACTORCAT_MISC - PLAYER_STATE1_6 | PLAYER_STATE1_DEAD | PLAYER_STATE1_28 | PLAYER_STATE1_29, + PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_28 | PLAYER_STATE1_29, // ACTORCAT_BOSS - PLAYER_STATE1_6 | PLAYER_STATE1_DEAD | PLAYER_STATE1_10 | PLAYER_STATE1_28, + PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_10 | PLAYER_STATE1_28, // ACTORCAT_DOOR 0, // ACTORCAT_CHEST - PLAYER_STATE1_6 | PLAYER_STATE1_DEAD | PLAYER_STATE1_28, + PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_28, }; void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { @@ -2381,7 +2381,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { requiredActorFlag = ACTOR_FLAG_25; } - if ((player->stateFlags1 & PLAYER_STATE1_6) && ((player->actor.textId & 0xFF00) != 0x600)) { + if ((player->stateFlags1 & PLAYER_STATE1_TALKING) && ((player->actor.textId & 0xFF00) != 0x600)) { sp74 = player->talkActor; } diff --git a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c index 3ac31d0c5c..4bb944cb9d 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c +++ b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c @@ -289,7 +289,7 @@ void BgHakaSgami_Update(Actor* thisx, PlayState* play) { BgHakaSgami* this = (BgHakaSgami*)thisx; Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & (PLAYER_STATE1_6 | PLAYER_STATE1_DEAD | PLAYER_STATE1_28 | PLAYER_STATE1_29)) || + if (!(player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_28 | PLAYER_STATE1_29)) || (this->actionFunc == BgHakaSgami_SetupSpin)) { this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c index 4b49c9b87b..9e2a0d9ad4 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c @@ -200,7 +200,7 @@ void BgJyaGoroiwa_Update(Actor* thisx, PlayState* play) { s32 bgId; Vec3f checkPos; - if (!(player->stateFlags1 & (PLAYER_STATE1_6 | PLAYER_STATE1_DEAD | PLAYER_STATE1_28 | PLAYER_STATE1_29))) { + if (!(player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_28 | PLAYER_STATE1_29))) { this->actionFunc(this, play); BgJyaGoroiwa_UpdateRotation(this); checkPos.x = this->actor.world.pos.x; diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index e34ea1fae9..1cfb4255d3 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -915,7 +915,7 @@ void DoorShutter_Update(Actor* thisx, PlayState* play) { DoorShutter* this = (DoorShutter*)thisx; Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & (PLAYER_STATE1_6 | PLAYER_STATE1_DEAD | PLAYER_STATE1_10 | PLAYER_STATE1_28)) || + if (!(player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_10 | PLAYER_STATE1_28)) || (this->actionFunc == DoorShutter_WaitForObject)) { this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index a4f7d74c1e..209b0b7c4d 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -739,7 +739,7 @@ void EnGoroiwa_Update(Actor* thisx, PlayState* play) { s32 pad; s32 bgId; - if (!(player->stateFlags1 & (PLAYER_STATE1_6 | PLAYER_STATE1_DEAD | PLAYER_STATE1_28 | PLAYER_STATE1_29))) { + if (!(player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_28 | PLAYER_STATE1_29))) { if (this->collisionDisabledTimer > 0) { this->collisionDisabledTimer--; } diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 5a89a5e2b3..d2f6fbdea6 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -147,7 +147,7 @@ void EnNutsball_Update(Actor* thisx, PlayState* play) { Player* player = GET_PLAYER(play); s32 pad; - if (!(player->stateFlags1 & (PLAYER_STATE1_6 | PLAYER_STATE1_DEAD | PLAYER_STATE1_28 | PLAYER_STATE1_29)) || + if (!(player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_28 | PLAYER_STATE1_29)) || (this->actionFunc == func_80ABBB34)) { this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c index 04450335d0..45b047f53f 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -578,7 +578,7 @@ void EnOkuta_Update(Actor* thisx, PlayState* play2) { Vec3f prevPos; s32 canRestorePrevPos; - if (!(player->stateFlags1 & (PLAYER_STATE1_6 | PLAYER_STATE1_DEAD | PLAYER_STATE1_28 | PLAYER_STATE1_29))) { + if (!(player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_28 | PLAYER_STATE1_29))) { if (this->actor.params == 0) { EnOkuta_ColliderCheck(this, play); if (!WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, this->actor.world.pos.z, diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 016fd87902..d9f846fa38 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -263,7 +263,7 @@ s32 func_80852F38(PlayState* play, Player* this); s32 Player_TryCsAction(PlayState* play, Actor* actor, s32 csAction); void func_80853080(Player* this, PlayState* play); s32 Player_InflictDamage(PlayState* play, s32 damage); -void func_80853148(PlayState* play, Actor* actor); +void Player_StartTalking(PlayState* play, Actor* actor); void Player_Action_80840450(Player* this, PlayState* play); void Player_Action_808407CC(Player* this, PlayState* play); @@ -305,7 +305,7 @@ void Player_Action_80846408(Player* this, PlayState* play); void Player_Action_808464B0(Player* this, PlayState* play); void Player_Action_80846578(Player* this, PlayState* play); void Player_Action_8084B1D8(Player* this, PlayState* play); -void Player_Action_8084B530(Player* this, PlayState* play); +void Player_Action_Talk(Player* this, PlayState* play); void Player_Action_8084B78C(Player* this, PlayState* play); void Player_Action_8084B898(Player* this, PlayState* play); void Player_Action_8084B9E4(Player* this, PlayState* play); @@ -333,7 +333,7 @@ void Player_Action_8084EAC0(Player* this, PlayState* play); void Player_Action_8084ECA4(Player* this, PlayState* play); void Player_Action_8084EED8(Player* this, PlayState* play); void Player_Action_8084EFC0(Player* this, PlayState* play); -void Player_Action_8084F104(Player* this, PlayState* play); +void Player_Action_ExchangeItem(Player* this, PlayState* play); void Player_Action_8084F390(Player* this, PlayState* play); void Player_Action_8084F608(Player* this, PlayState* play); void Player_Action_8084F698(Player* this, PlayState* play); @@ -1731,7 +1731,7 @@ BAD_RETURN(s32) func_80832224(Player* this) { this->unk_6AD = 0; } -s32 func_8083224C(PlayState* play) { +s32 Player_IsTalking(PlayState* play) { Player* this = GET_PLAYER(play); return CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_TALK); @@ -3438,8 +3438,8 @@ s32 Player_SetupAction(PlayState* play, Player* this, PlayerActionFunc actionFun Player_FinishAnimMovement(this); - this->stateFlags1 &= ~(PLAYER_STATE1_2 | PLAYER_STATE1_6 | PLAYER_STATE1_26 | PLAYER_STATE1_28 | PLAYER_STATE1_29 | - PLAYER_STATE1_31); + this->stateFlags1 &= ~(PLAYER_STATE1_2 | PLAYER_STATE1_TALKING | PLAYER_STATE1_26 | PLAYER_STATE1_28 | + PLAYER_STATE1_29 | PLAYER_STATE1_31); this->stateFlags2 &= ~(PLAYER_STATE2_19 | PLAYER_STATE2_27 | PLAYER_STATE2_IDLE_FIDGET); this->stateFlags3 &= ~(PLAYER_STATE3_1 | PLAYER_STATE3_3 | PLAYER_STATE3_FLYING_WITH_HOOKSHOT); @@ -3914,7 +3914,7 @@ void Player_UpdateZTargeting(Player* this, PlayState* play) { ignoreLeash = true; } - isTalking = func_8083224C(play); + isTalking = Player_IsTalking(play); if (isTalking || (this->zTargetActiveTimer != 0) || (this->stateFlags1 & (PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_BOOMERANG_THROWN))) { @@ -5376,7 +5376,7 @@ s32 Player_ActionHandler_1(Player* this, PlayState* play) { if (this->doorType <= PLAYER_DOORTYPE_AJAR) { doorActor->textId = 0xD0; - func_80853148(play, doorActor); + Player_StartTalking(play, doorActor); return 0; } @@ -5641,10 +5641,10 @@ void func_8083A0F4(PlayState* play, Player* this) { } } -void func_8083A2F8(PlayState* play, Player* this) { - Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084B530, 0); +void Player_SetupTalk(PlayState* play, Player* this) { + Player_SetupActionPreserveAnimMovement(play, this, Player_Action_Talk, 0); - this->stateFlags1 |= PLAYER_STATE1_6 | PLAYER_STATE1_29; + this->stateFlags1 |= PLAYER_STATE1_TALKING | PLAYER_STATE1_29; if (this->actor.textId != 0) { Message_StartTextbox(play, this->actor.textId, this->talkActor); @@ -6050,14 +6050,14 @@ s32 Player_ActionHandler_13(Player* this, PlayState* play) { (this->exchangeItemId == EXCH_ITEM_BOTTLE_BLUE_FIRE))))))) { if ((play->actorCtx.titleCtx.delayTimer == 0) && (play->actorCtx.titleCtx.alpha == 0)) { - Player_SetupActionPreserveItemAction(play, this, Player_Action_8084F104, 0); + Player_SetupActionPreserveItemAction(play, this, Player_Action_ExchangeItem, 0); if (sp2C >= 0) { giEntry = &sGetItemTable[D_80854528[sp2C] - 1]; func_8083AE40(this, giEntry->objectId); } - this->stateFlags1 |= PLAYER_STATE1_6 | PLAYER_STATE1_28 | PLAYER_STATE1_29; + this->stateFlags1 |= PLAYER_STATE1_TALKING | PLAYER_STATE1_28 | PLAYER_STATE1_29; if (sp2C >= 0) { sp2C = sp2C + 1; @@ -6255,7 +6255,7 @@ s32 Player_ActionHandler_Talk(Player* this, PlayState* play) { // This is especially important to prevent unwanted behavior with regards to mask trading. this->currentMask = sSavedCurrentMask; - func_80853148(play, talkOfferActor); + Player_StartTalking(play, talkOfferActor); return true; } @@ -10653,7 +10653,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { play->tryPlayerCsAction = Player_TryCsAction; play->func_11D54 = func_80853080; play->damagePlayer = Player_InflictDamage; - play->talkWithPlayer = func_80853148; + play->talkWithPlayer = Player_StartTalking; thisx->room = -1; this->ageProperties = &sAgeProperties[gSaveContext.save.linkAge]; @@ -11628,8 +11628,8 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->unk_A73--; } - if (this->unk_88E != 0) { - this->unk_88E--; + if (this->textboxBtnCooldownTimer != 0) { + this->textboxBtnCooldownTimer--; } if (this->unk_A87 != 0) { @@ -12069,7 +12069,9 @@ void Player_Update(Actor* thisx, PlayState* play) { } else { input = play->state.input[0]; - if (this->unk_88E != 0) { + if (this->textboxBtnCooldownTimer != 0) { + // Prevent the usage of A/B/C-up. + // Helps avoid accidental inputs when mashing to close the final textbox. input.cur.button &= ~(BTN_A | BTN_B | BTN_CUP); input.press.button &= ~(BTN_A | BTN_B | BTN_CUP); } @@ -12480,8 +12482,9 @@ s32 func_8084B4D4(PlayState* play, Player* this) { return 0; } -void Player_Action_8084B530(Player* this, PlayState* play) { +void Player_Action_Talk(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; + Player_UpdateUpperBody(this, play); if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { @@ -12507,7 +12510,7 @@ void Player_Action_8084B530(Player* this, PlayState* play) { } } - this->unk_88E = 10; + this->textboxBtnCooldownTimer = 10; return; } @@ -12518,6 +12521,7 @@ void Player_Action_8084B530(Player* this, PlayState* play) { } else if (!Player_CheckHostileLockOn(this) && LinkAnimation_Update(play, &this->skelAnime)) { if (this->skelAnime.movementFlags != 0) { Player_FinishAnimMovement(this); + if ((this->talkActor->category == ACTORCAT_NPC) && (this->heldItemAction != PLAYER_IA_FISHING_POLE)) { Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_talk_free); } else { @@ -13205,7 +13209,7 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { } if (this->av2.actionVar2 == 1) { - if (sUpperBodyIsBusy || func_8083224C(play)) { + if (sUpperBodyIsBusy || Player_IsTalking(play)) { Player_AnimPlayOnce(play, this, &gPlayerAnim_link_uma_wait_3); } else if (LinkAnimation_Update(play, &this->skelAnime)) { this->av2.actionVar2 = 99; @@ -13240,7 +13244,7 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { this->yaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; if ((this->csAction != PLAYER_CSACTION_NONE) || - (!func_8083224C(play) && ((rideActor->actor.speed != 0.0f) || !Player_ActionHandler_Talk(this, play)) && + (!Player_IsTalking(play) && ((rideActor->actor.speed != 0.0f) || !Player_ActionHandler_Talk(this, play)) && !Player_ActionHandler_Roll(this, play))) { if (!sUpperBodyIsBusy) { if (this->av1.actionVar1 != 0) { @@ -13380,7 +13384,7 @@ void Player_Action_8084D610(Player* this, PlayState* play) { func_80832CB0(play, this, &gPlayerAnim_link_swimer_swim_wait); func_8084B000(this); - if (!func_8083224C(play) && !Player_TryActionHandlerList(play, this, sActionHandlerList11, true) && + if (!Player_IsTalking(play) && !Player_TryActionHandlerList(play, this, sActionHandlerList11, true) && !func_8083D12C(play, this, sControlInput)) { f32 speedTarget; s16 yawTarget; @@ -13727,11 +13731,11 @@ void Player_Action_8084E3C4(Player* this, PlayState* play) { Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); if ((this->talkActor != NULL) && (this->talkActor == this->unk_6A8)) { - func_80853148(play, this->talkActor); + Player_StartTalking(play, this->talkActor); } else if (this->naviTextId < 0) { this->talkActor = this->naviActor; this->naviActor->textId = -this->naviTextId; - func_80853148(play, this->talkActor); + Player_StartTalking(play, this->talkActor); } else if (!Player_ActionHandler_13(this, play)) { func_8083A098(this, &gPlayerAnim_link_normal_okarina_end, play); } @@ -13804,7 +13808,7 @@ void Player_Action_8084E6D4(Player* this, PlayState* play) { this->exchangeItemId = EXCH_ITEM_NONE; if (func_8084B4D4(play, this) == 0) { - func_80853148(play, this->talkActor); + Player_StartTalking(play, this->talkActor); } } else { func_8084DFAC(play, this); @@ -14085,7 +14089,7 @@ static AnimSfxEntry D_80854A3C[] = { { NA_SE_PL_PUT_OUT_ITEM, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 30) }, }; -void Player_Action_8084F104(Player* this, PlayState* play) { +void Player_Action_ExchangeItem(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_5; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -14099,7 +14103,7 @@ void Player_Action_8084F104(Player* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_TALK; } - func_80853148(play, talkActor); + Player_StartTalking(play, talkActor); } else { GetItemEntry* giEntry = &sGetItemTable[D_80854528[this->exchangeItemId - 1] - 1]; @@ -16024,8 +16028,13 @@ s32 Player_InflictDamage(PlayState* play, s32 damage) { return 0; } -// Start talking with the given actor -void func_80853148(PlayState* play, Actor* actor) { +/** + * Start talking to the specified actor. + * + * This function does not concern trading exchange items. + * For item exchanges see relevant code in `Player_ActionChange_13` and `Player_Action_ExchangeItem`. + */ +void Player_StartTalking(PlayState* play, Actor* actor) { Player* this = GET_PLAYER(play); s32 pad; @@ -16038,6 +16047,8 @@ void func_80853148(PlayState* play, Actor* actor) { this->exchangeItemId = EXCH_ITEM_NONE; if (actor->textId == 0xFFFF) { + // Player will stand and look at the actor with no text appearing. + // This can be used to delay text from appearing, for example. Player_SetCsActionWithHaltedActors(play, actor, PLAYER_CSACTION_1); actor->flags |= ACTOR_FLAG_TALK; Player_PutAwayHeldItem(play, this); @@ -16053,15 +16064,15 @@ void func_80853148(PlayState* play, Actor* actor) { s32 sp24 = this->av2.actionVar2; Player_PutAwayHeldItem(play, this); - func_8083A2F8(play, this); + Player_SetupTalk(play, this); this->av2.actionVar2 = sp24; } else { if (func_808332B8(this)) { - Player_SetupWaitForPutAway(play, this, func_8083A2F8); + Player_SetupWaitForPutAway(play, this, Player_SetupTalk); Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim_wait); } else if ((actor->category != ACTORCAT_NPC) || (this->heldItemAction == PLAYER_IA_FISHING_POLE)) { - func_8083A2F8(play, this); + Player_SetupTalk(play, this); if (!Player_CheckHostileLockOn(this)) { if ((actor != this->naviActor) && (actor->xzDistToPlayer < 40.0f)) { @@ -16071,7 +16082,7 @@ void func_80853148(PlayState* play, Actor* actor) { } } } else { - Player_SetupWaitForPutAway(play, this, func_8083A2F8); + Player_SetupWaitForPutAway(play, this, Player_SetupTalk); Player_AnimPlayOnceAdjusted(play, this, (actor->xzDistToPlayer < 40.0f) ? &gPlayerAnim_link_normal_backspace : &gPlayerAnim_link_normal_talk_free); @@ -16085,7 +16096,7 @@ void func_80853148(PlayState* play, Actor* actor) { func_80832224(this); } - this->stateFlags1 |= PLAYER_STATE1_6 | PLAYER_STATE1_29; + this->stateFlags1 |= PLAYER_STATE1_TALKING | PLAYER_STATE1_29; } if ((this->naviActor == this->talkActor) && ((this->talkActor->textId & 0xFF00) != 0x200)) {