diff --git a/include/z64camera.h b/include/z64camera.h index 969dca94f0..b81f426534 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -1652,7 +1652,7 @@ s32 Camera_IsDbgCamEnabled(void); Vec3f Camera_GetQuakeOffset(Camera* camera); void Camera_SetCameraData(Camera* camera, s16 setDataFlags, void* data0, void* data1, s16 data2, s16 data3); s32 Camera_GetNegOne(void); -s16 func_800E0238(Camera* camera); +s16 Camera_SetFinishedFlag(Camera* camera); void Camera_SetFocalActor(Camera* camera, struct Actor* actor); void Camera_SetTargetActor(Camera* camera, struct Actor* actor); f32 Camera_GetWaterYPos(Camera* camera); diff --git a/include/z64player.h b/include/z64player.h index 37055e4c75..9fabf823f5 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -880,8 +880,8 @@ typedef enum PlayerCueId { #define PLAYER_STATE1_10 (1 << 4) // #define PLAYER_STATE1_20 (1 << 5) -// -#define PLAYER_STATE1_40 (1 << 6) +// Currently talking to an actor. This includes item exchanges. +#define PLAYER_STATE1_TALKING (1 << 6) // Player has died. Note that this gets set when the death cutscene has started, after landing from the air. // This also gets set when either deku/zora forms touches lava floor, or goron form enters water and the scene resets. #define PLAYER_STATE1_DEAD (1 << 7) @@ -937,8 +937,8 @@ typedef enum PlayerCueId { // #define PLAYER_STATE2_1 (1 << 0) -// -#define PLAYER_STATE2_2 (1 << 1) +// Can accept a talk offer. "Speak" or "Check" is shown on the A button. +#define PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER (1 << 1) // #define PLAYER_STATE2_4 (1 << 2) // @@ -1287,7 +1287,7 @@ typedef struct Player { /* 0xB58 */ f32 distToInteractWall; // xyz distance to the interact wall /* 0xB5C */ u8 ledgeClimbType; // see PlayerLedgeClimbType enum /* 0xB5D */ u8 ledgeClimbDelayTimer; - /* 0xB5E */ u8 unk_B5E; + /* 0xB5E */ u8 textboxBtnCooldownTimer; // Prevents usage of A/B/C-up when counting down /* 0xB5F */ u8 unk_B5F; /* 0xB60 */ u16 blastMaskTimer; /* 0xB62 */ s16 unk_B62; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index a7c9a497ba..125a2e116d 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -511,7 +511,7 @@ void Attention_Draw(Attention* attention, PlayState* play) { Player* player = GET_PLAYER(play); Actor* actor; // used for both the reticle actor and arrow hover actor - if (player->stateFlags1 & (PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | + if (player->stateFlags1 & (PLAYER_STATE1_2 | PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_400 | PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000)) { return; } @@ -574,7 +574,7 @@ void Attention_Draw(Attention* attention, PlayState* play) { Attention_SetReticlePos(attention, attention->curReticle, projectedPos.x, projectedPos.y, projectedPos.z); - if (!(player->stateFlags1 & PLAYER_STATE1_40) || (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; @@ -2626,33 +2626,33 @@ Actor* Actor_UpdateActor(UpdateActor_Params* params) { u32 sCategoryFreezeMasks[ACTORCAT_MAX] = { /* ACTORCAT_SWITCH */ - PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_10000000, + PLAYER_STATE1_2 | PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_10000000, /* ACTORCAT_BG */ - PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_10000000, + PLAYER_STATE1_2 | PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_10000000, /* ACTORCAT_PLAYER */ PLAYER_STATE1_200, /* ACTORCAT_EXPLOSIVES */ - PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_400 | + PLAYER_STATE1_2 | PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_400 | PLAYER_STATE1_10000000, /* ACTORCAT_NPC */ PLAYER_STATE1_2 | PLAYER_STATE1_DEAD | PLAYER_STATE1_200, /* ACTORCAT_ENEMY */ - PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_10000000 | + PLAYER_STATE1_2 | PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000, /* ACTORCAT_PROP */ PLAYER_STATE1_2 | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_10000000, /* ACTORCAT_ITEMACTION */ PLAYER_STATE1_2, /* ACTORCAT_MISC */ - PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_10000000 | + PLAYER_STATE1_2 | PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000, /* ACTORCAT_BOSS */ - PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_400 | + PLAYER_STATE1_2 | PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_400 | PLAYER_STATE1_10000000, /* ACTORCAT_DOOR */ PLAYER_STATE1_2, /* ACTORCAT_CHEST */ - PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_10000000, + PLAYER_STATE1_2 | PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_10000000, }; void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { @@ -2688,7 +2688,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { params.freezeExceptionFlag = 0; } - if ((player->stateFlags1 & PLAYER_STATE1_40) && ((player->actor.textId & 0xFF00) != 0x1900)) { + if ((player->stateFlags1 & PLAYER_STATE1_TALKING) && ((player->actor.textId & 0xFF00) != 0x1900)) { params.talkActor = player->talkActor; } else { params.talkActor = NULL; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 72e017e505..b3f3f5fdd9 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -8094,7 +8094,7 @@ s32 Camera_GetNegOne(void) { return sCameraNegOne; } -s16 func_800E0238(Camera* camera) { +s16 Camera_SetFinishedFlag(Camera* camera) { Camera_SetStateFlag(camera, CAM_STATE_3); if ((camera->camId == CAM_ID_MAIN) && (camera->play->activeCamId != CAM_ID_MAIN)) { Camera_SetStateFlag(GET_ACTIVE_CAM(camera->play), CAM_STATE_3); diff --git a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c index 2518b77320..b44885479e 100644 --- a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c +++ b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c @@ -65,8 +65,8 @@ void BgTobira01_Action(BgTobira01* this, PlayState* play) { this->timer = 180; } - if (!(player->stateFlags1 & PLAYER_STATE1_40) && CHECK_WEEKEVENTREG(WEEKEVENTREG_GATEKEEPER_OPENED_GORON_SHRINE) && - (DECR(this->timer) == 0)) { + if (!(player->stateFlags1 & PLAYER_STATE1_TALKING) && + CHECK_WEEKEVENTREG(WEEKEVENTREG_GATEKEEPER_OPENED_GORON_SHRINE) && (DECR(this->timer) == 0)) { CLEAR_WEEKEVENTREG(WEEKEVENTREG_GATEKEEPER_OPENED_GORON_SHRINE); } } 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 78b747e077..08c73bb315 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -646,7 +646,8 @@ void DoorShutter_Update(Actor* thisx, PlayState* play) { DoorShutter* this = THIS; Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & (PLAYER_STATE1_40 | PLAYER_STATE1_DEAD | PLAYER_STATE1_400 | PLAYER_STATE1_10000000)) || + if (!(player->stateFlags1 & + (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_400 | PLAYER_STATE1_10000000)) || (this->actionFunc == DoorShutter_SetupType)) { this->actionFunc(this, play); diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c index cea997c7f9..f51490e456 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c @@ -233,7 +233,8 @@ void DoorSpiral_Update(Actor* thisx, PlayState* play) { DoorSpiral* this = THIS; Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & (PLAYER_STATE1_40 | PLAYER_STATE1_DEAD | PLAYER_STATE1_400 | PLAYER_STATE1_10000000)) || + if (!(player->stateFlags1 & + (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_400 | PLAYER_STATE1_10000000)) || (this->actionFunc == func_809A2DB0)) { this->actionFunc(this, play); } diff --git a/src/overlays/actors/ovl_En_Ah/z_en_ah.c b/src/overlays/actors/ovl_En_Ah/z_en_ah.c index 1e8e020ba3..18ad7452e0 100644 --- a/src/overlays/actors/ovl_En_Ah/z_en_ah.c +++ b/src/overlays/actors/ovl_En_Ah/z_en_ah.c @@ -329,7 +329,7 @@ s32 func_80BD3198(EnAh* this, PlayState* play) { Player* player = GET_PLAYER(play); u16 temp = play->msgCtx.currentTextId; - if (player->stateFlags1 & PLAYER_STATE1_40) { + if (player->stateFlags1 & PLAYER_STATE1_TALKING) { if (this->unk_2DA != temp) { if (temp == 0x2954) { this->unk_18C = func_80BD3118; diff --git a/src/overlays/actors/ovl_En_Al/z_en_al.c b/src/overlays/actors/ovl_En_Al/z_en_al.c index 25d27a9624..bca0125635 100644 --- a/src/overlays/actors/ovl_En_Al/z_en_al.c +++ b/src/overlays/actors/ovl_En_Al/z_en_al.c @@ -892,7 +892,7 @@ s32 func_80BDF064(EnAl* this, PlayState* play) { Actor* sp1C = EnAl_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_GM); Actor* temp_v0 = EnAl_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); - if (player->stateFlags1 & PLAYER_STATE1_40) { + if (player->stateFlags1 & PLAYER_STATE1_TALKING) { this->unk_4C2 |= 0x400; if (this->unk_4C4 != sp22) { switch (sp22) { diff --git a/src/overlays/actors/ovl_En_An/z_en_an.c b/src/overlays/actors/ovl_En_An/z_en_an.c index de8d3da449..b1f561c86d 100644 --- a/src/overlays/actors/ovl_En_An/z_en_an.c +++ b/src/overlays/actors/ovl_En_An/z_en_an.c @@ -2030,7 +2030,7 @@ s32 EnAn_HandleDialogue(EnAn* this, PlayState* play) { Player* player = GET_PLAYER(play); u16 textId = play->msgCtx.currentTextId; - if (player->stateFlags1 & PLAYER_STATE1_40) { + if (player->stateFlags1 & PLAYER_STATE1_TALKING) { this->stateFlags |= ENAN_STATE_TALKING; if (this->prevTextId != textId) { diff --git a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c index 5d57181352..4c379b1119 100644 --- a/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c +++ b/src/overlays/actors/ovl_En_Bjt/z_en_bjt.c @@ -376,7 +376,7 @@ s32 EnBjt_ChooseAnimation(EnBjt* this, PlayState* play) { Player* player = GET_PLAYER(play); u16 curTextId = play->msgCtx.currentTextId; - if (player->stateFlags1 & (PLAYER_STATE1_40 | PLAYER_STATE1_400)) { // Talking, show item? + if (player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_400)) { // Talking, show item? this->stateFlags |= TOILET_HAND_STATE_TEXTBOX; if (this->textId != curTextId) { switch (curTextId) { diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c index 5d72c4a60b..0beeb5cd74 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -324,7 +324,7 @@ s32 func_80A52B68(EnDnq* this, PlayState* play) { Player* player = GET_PLAYER(play); u16 textId = play->msgCtx.currentTextId; - if ((player->stateFlags1 & PLAYER_STATE1_40) && (player->talkActor == &this->picto.actor)) { + if ((player->stateFlags1 & PLAYER_STATE1_TALKING) && (player->talkActor == &this->picto.actor)) { switch (textId) { case 0x89B: EnDnq_ChangeAnim(this, DEKU_KING_ANIM_FOOT_STAMP_LOOP); diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 52da2288da..34eb4b7bf4 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -973,7 +973,7 @@ void func_8088E850(EnElf* this, PlayState* play) { default: tatlHoverActor = play->actorCtx.attention.tatlHoverActor; - if ((player->stateFlags1 & PLAYER_STATE1_40) && (player->talkActor != NULL)) { + if ((player->stateFlags1 & PLAYER_STATE1_TALKING) && (player->talkActor != NULL)) { Math_Vec3f_Copy(&nextPos, &player->talkActor->focus.pos); } else { Math_Vec3f_Copy(&nextPos, &play->actorCtx.attention.tatlHoverPos); @@ -1153,7 +1153,7 @@ void func_8088F214(EnElf* this, PlayState* play) { if (this->unk_25C != 0) { this->unk_25C--; sp34 = 0; - } else if (!(player->stateFlags1 & PLAYER_STATE1_40)) { + } else if (!(player->stateFlags1 & PLAYER_STATE1_TALKING)) { if (this->unk_269 == 0) { Actor_PlaySfx(&this->actor, NA_SE_EV_NAVY_VANISH); } @@ -1216,7 +1216,7 @@ void func_8088F214(EnElf* this, PlayState* play) { if (this->unk_269 == 0) { Actor_PlaySfx(&this->actor, NA_SE_EV_BELL_DASH_NORMAL); } - } else if (player->stateFlags1 & PLAYER_STATE1_40) { + } else if (player->stateFlags1 & PLAYER_STATE1_TALKING) { player->stateFlags2 |= PLAYER_STATE2_100000; sp34 = 0; this->unk_25C = 0; diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 512d256315..7bd341ddd4 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -1019,7 +1019,7 @@ s32 func_8094F53C(EnGm* this, PlayState* play) { Actor* al = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AL); Actor* toto = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); - if (player->stateFlags1 & (PLAYER_STATE1_40 | PLAYER_STATE1_400)) { + if (player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_400)) { this->unk_3A4 |= 0x400; if (this->unk_3A6 != sp32) { switch (sp32) { @@ -1543,7 +1543,7 @@ s32 func_80950690(EnGm* this, PlayState* play) { al = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_AL); toto = EnGm_FindActor(this, play, ACTORCAT_NPC, ACTOR_EN_TOTO); if ((al != NULL) && (al->update != NULL) && (toto != NULL) && (toto->update != NULL) && - !(player->stateFlags1 & PLAYER_STATE1_40)) { + !(player->stateFlags1 & PLAYER_STATE1_TALKING)) { if (DECR(this->unk_3B8) == 0) { if (al == this->unk_268) { this->unk_268 = toto; diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 35e530745e..4a3d8ba439 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1486,7 +1486,7 @@ s32 EnGo_UpdateGraveyardAttentionTargetAndReactions(EnGo* this, PlayState* play) return false; } - if (player->stateFlags1 & PLAYER_STATE1_40) { + if (player->stateFlags1 & PLAYER_STATE1_TALKING) { if (this->lastTextId != textId) { switch (textId) { case 0xE1A: // Awakening from frozen form, confused, turn to other Goron 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 6f3df23901..1bda9934cb 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -1438,7 +1438,7 @@ void EnGoroiwa_Update(Actor* thisx, PlayState* play) { CollisionPoly* tmp; if (!(player->stateFlags1 & - (PLAYER_STATE1_40 | PLAYER_STATE1_DEAD | PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000))) { + (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000))) { if (this->unk_1CC > 0) { this->unk_1CC--; } diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c index 7a4ef453be..957116d0f5 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -515,7 +515,7 @@ s32 func_80BF1B40(EnIg* this, PlayState* play) { u16 temp = play->msgCtx.currentTextId; s32 pad; - if (player->stateFlags1 & (PLAYER_STATE1_40 | PLAYER_STATE1_400 | PLAYER_STATE1_CARRYING_ACTOR)) { + if (player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_400 | PLAYER_STATE1_CARRYING_ACTOR)) { this->unk_3D0 |= 0x400; if (this->unk_3D2 != temp) { if ((this->animIndex == ENIG_ANIM_2) || (this->animIndex == ENIG_ANIM_3)) { diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 991d17e963..b4b36021d0 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -622,7 +622,7 @@ s32 func_80BC0A18(EnNb* this, PlayState* play) { Player* player = GET_PLAYER(play); u16 currentTextId = play->msgCtx.currentTextId; - if (player->stateFlags1 & PLAYER_STATE1_40) { + if (player->stateFlags1 & PLAYER_STATE1_TALKING) { this->stateFlags |= EN_NB_FLAG_80; if (this->textId != currentTextId) { 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 f1d3069547..1a0f4e5093 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -98,7 +98,7 @@ void EnNutsball_Update(Actor* thisx, PlayState* play2) { CollisionPoly* poly; if (!(player->stateFlags1 & - (PLAYER_STATE1_40 | PLAYER_STATE1_DEAD | PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000))) { + (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000))) { this->timer--; if (this->timer < 0) { this->actor.velocity.y += this->actor.gravity; 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 0ac0733dce..8e0f5b03b6 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -946,7 +946,7 @@ void EnOkuta_Projectile_Update(Actor* thisx, PlayState* play) { Vec3f prevPos; s32 canRestorePrevPos = false; - if (!(player->stateFlags1 & (PLAYER_STATE1_2 | PLAYER_STATE1_40 | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | + if (!(player->stateFlags1 & (PLAYER_STATE1_2 | PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_200 | PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000))) { this->actionFunc(this, play); Actor_MoveWithoutGravity(&this->actor); diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index 314832491f..0f5fef684a 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -1012,7 +1012,7 @@ s32 func_80AF8DD4(EnPm* this, PlayState* play) { u16 textId = play->msgCtx.currentTextId; s32 pad; - if (player->stateFlags1 & (PLAYER_STATE1_40 | PLAYER_STATE1_400)) { + if (player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_400)) { this->unk_356 |= 0x400; if (this->unk_358 != textId) { if ((this->animIndex == ENPM_ANIM_0) || (this->animIndex == ENPM_ANIM_1)) { diff --git a/src/overlays/actors/ovl_En_Shn/z_en_shn.c b/src/overlays/actors/ovl_En_Shn/z_en_shn.c index 5720ed8e90..7de5b79b77 100644 --- a/src/overlays/actors/ovl_En_Shn/z_en_shn.c +++ b/src/overlays/actors/ovl_En_Shn/z_en_shn.c @@ -553,7 +553,7 @@ s32 func_80AE65F4(EnShn* this, PlayState* play) { Player* player = GET_PLAYER(play); u16 temp = play->msgCtx.currentTextId; - if (player->stateFlags1 & PLAYER_STATE1_40) { + if (player->stateFlags1 & PLAYER_STATE1_TALKING) { if (this->unk_1DA != temp) { if ((this->unk_1D8 & 0x80) || (this->unk_1D8 & 0x100)) { this->unk_1D8 |= 8; diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index 1c9cf2c509..93c9723e94 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -1229,7 +1229,7 @@ void func_80BAD380(EnSuttari* this, PlayState* play) { u8 talkState = Message_GetState(&play->msgCtx); Player* player = GET_PLAYER(play); - if ((player->stateFlags1 & PLAYER_STATE1_40) && (play->msgCtx.currentTextId != 0x2A31)) { + if ((player->stateFlags1 & PLAYER_STATE1_TALKING) && (play->msgCtx.currentTextId != 0x2A31)) { this->flags1 |= 0x8000; this->actor.speed = 0.0f; } else { diff --git a/src/overlays/actors/ovl_En_Tab/z_en_tab.c b/src/overlays/actors/ovl_En_Tab/z_en_tab.c index 698c3f9994..fec08358e6 100644 --- a/src/overlays/actors/ovl_En_Tab/z_en_tab.c +++ b/src/overlays/actors/ovl_En_Tab/z_en_tab.c @@ -569,7 +569,7 @@ s32 func_80BE10BC(EnTab* this, PlayState* play) { switch (this->scheduleResult) { case 1: - if ((player->stateFlags1 & PLAYER_STATE1_40) && !(play->msgCtx.currentTextId <= 0x2B00) && + if ((player->stateFlags1 & PLAYER_STATE1_TALKING) && !(play->msgCtx.currentTextId <= 0x2B00) && (play->msgCtx.currentTextId < 0x2B08)) { this->actor.child = &this->unk_1E4->actor; this->unk_2FC |= 8; diff --git a/src/overlays/actors/ovl_En_Test3/z_en_test3.c b/src/overlays/actors/ovl_En_Test3/z_en_test3.c index c7411ae7c8..5e6fc05518 100644 --- a/src/overlays/actors/ovl_En_Test3/z_en_test3.c +++ b/src/overlays/actors/ovl_En_Test3/z_en_test3.c @@ -694,7 +694,7 @@ s32 func_80A3FA58(EnTest3* this, PlayState* play) { struct_80A41828 sp40; ScheduleOutput scheduleOutput; - if (player->stateFlags1 & PLAYER_STATE1_40) { + if (player->stateFlags1 & PLAYER_STATE1_TALKING) { return false; } cond = func_80A40230(this, play); diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index a2f095d4ed..ff8e92e491 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -244,8 +244,8 @@ void EnWallmas_WaitToDrop(EnWallmas* this, PlayState* play) { } if ((player->stateFlags1 & (PLAYER_STATE1_100000 | PLAYER_STATE1_8000000)) || - (player->stateFlags2 & PLAYER_STATE2_80) || (player->unk_B5E > 0) || (player->actor.freezeTimer > 0) || - !(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + (player->stateFlags2 & PLAYER_STATE2_80) || (player->textboxBtnCooldownTimer > 0) || + (player->actor.freezeTimer > 0) || !(player->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || ((WALLMASTER_GET_TYPE(&this->actor) == WALLMASTER_TYPE_PROXIMITY) && (Math_Vec3f_DistXZ(&this->actor.home.pos, playerPos) > (120.f + this->detectionRadius)))) { AudioSfx_StopById(NA_SE_EN_FALL_AIM); diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index b4089d39c4..474c4513f7 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -58,7 +58,7 @@ s32 Player_GrabPlayer(PlayState* play, Player* this); s32 Player_TryCsAction(PlayState* play, Player* this, PlayerCsAction csAction); void func_8085B384(Player* this, PlayState* play); s32 Player_InflictDamage(PlayState* play, s32 damage); -void Player_TalkWithPlayer(PlayState* play, Actor* actor); +void Player_StartTalking(PlayState* play, Actor* actor); void func_8085B74C(PlayState* play); void func_8085B820(PlayState* play, s16 arg1); PlayerItemAction func_8085B854(PlayState* play, Player* this, ItemId itemId); @@ -157,7 +157,7 @@ void Player_Action_40(Player* this, PlayState* play); void Player_Action_41(Player* this, PlayState* play); void Player_Action_42(Player* this, PlayState* play); void Player_Action_43(Player* this, PlayState* play); -void Player_Action_44(Player* this, PlayState* play); +void Player_Action_Talk(Player* this, PlayState* play); void Player_Action_45(Player* this, PlayState* play); void Player_Action_46(Player* this, PlayState* play); void Player_Action_47(Player* this, PlayState* play); @@ -184,7 +184,7 @@ void Player_Action_67(Player* this, PlayState* play); void Player_Action_68(Player* this, PlayState* play); void Player_Action_69(Player* this, PlayState* play); void Player_Action_70(Player* this, PlayState* play); -void Player_Action_71(Player* this, PlayState* play); +void Player_Action_ExchangeItem(Player* this, PlayState* play); void Player_Action_72(Player* this, PlayState* play); void Player_Action_73(Player* this, PlayState* play); void Player_Action_74(Player* this, PlayState* play); @@ -241,7 +241,7 @@ s32 Player_ActionHandler_0(Player* this, PlayState* play); s32 Player_ActionHandler_1(Player* this, PlayState* play); s32 Player_ActionHandler_2(Player* this, PlayState* play); s32 Player_ActionHandler_3(Player* this, PlayState* play); -s32 Player_ActionHandler_4(Player* this, PlayState* play); +s32 Player_ActionHandler_Talk(Player* this, PlayState* play); s32 Player_ActionHandler_5(Player* this, PlayState* play); s32 Player_ActionHandler_6(Player* this, PlayState* play); s32 Player_ActionHandler_7(Player* this, PlayState* play); @@ -521,7 +521,7 @@ FloorProperty sPlayerPrevFloorProperty; s32 sPlayerShapeYawToTouchedWall; s32 sPlayerWorldYawToTouchedWall; s16 sPlayerFloorPitchShape; -s32 D_80862B2C; // D_80862B2C = player->currentMask; +s32 sSavedCurrentMask; Vec3f sPlayerInteractWallCheckResult; f32 D_80862B3C; FloorEffect sPlayerFloorEffect; @@ -545,7 +545,7 @@ void func_8082DAD4(Player* this) { this->unk_AA5 = PLAYER_UNKAA5_0; } -s32 func_8082DAFC(PlayState* play) { +s32 Player_IsTalking(PlayState* play) { Player* player = GET_PLAYER(play); return CHECK_FLAG_ALL(player->actor.flags, ACTOR_FLAG_TALK); @@ -624,7 +624,7 @@ void func_8082DD2C(PlayState* play, Player* this) { func_8082DC38(this); this->unk_AA5 = PLAYER_UNKAA5_0; func_8082DC64(play, this); - func_800E0238(Play_GetCamera(play, CAM_ID_MAIN)); + Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); this->stateFlags1 &= ~(PLAYER_STATE1_4 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_100000 | PLAYER_STATE1_200000); this->stateFlags2 &= ~(PLAYER_STATE2_10 | PLAYER_STATE2_80); @@ -4420,8 +4420,8 @@ s32 Player_SetAction(PlayState* play, Player* this, PlayerActionFunc actionFunc, func_80831454(this); Player_Anim_ResetMove(this); - this->stateFlags1 &= ~(PLAYER_STATE1_40 | PLAYER_STATE1_4000000 | PLAYER_STATE1_10000000 | PLAYER_STATE1_20000000 | - PLAYER_STATE1_80000000); + this->stateFlags1 &= ~(PLAYER_STATE1_TALKING | PLAYER_STATE1_4000000 | PLAYER_STATE1_10000000 | + PLAYER_STATE1_20000000 | PLAYER_STATE1_80000000); this->stateFlags2 &= ~(PLAYER_STATE2_80000 | PLAYER_STATE2_800000 | PLAYER_STATE2_2000000 | PLAYER_STATE2_USING_OCARINA | PLAYER_STATE2_IDLE_FIDGET); this->stateFlags3 &= @@ -4964,7 +4964,7 @@ void Player_UpdateZTargeting(Player* this, PlayState* play) { ignoreLeash = true; } - isTalking = func_8082DAFC(play); + isTalking = Player_IsTalking(play); if (isTalking || (this->zTargetActiveTimer != 0) || (this->stateFlags1 & (PLAYER_STATE1_1000 | PLAYER_STATE1_2000000))) { @@ -5011,7 +5011,7 @@ void Player_UpdateZTargeting(Player* this, PlayState* play) { this->focusActor = nextLockOnActor; this->zTargetActiveTimer = 15; - this->stateFlags2 &= ~(PLAYER_STATE2_2 | PLAYER_STATE2_200000); + this->stateFlags2 &= ~(PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER | PLAYER_STATE2_200000); } else if (!usingHoldTargeting) { Player_ReleaseLockOn(this); } @@ -5200,7 +5200,7 @@ typedef enum ActionHandlerIndex { /* 0x1 */ PLAYER_ACTION_HANDLER_1, /* 0x2 */ PLAYER_ACTION_HANDLER_2, /* 0x3 */ PLAYER_ACTION_HANDLER_3, - /* 0x4 */ PLAYER_ACTION_HANDLER_4, + /* 0x4 */ PLAYER_ACTION_HANDLER_TALK, /* 0x5 */ PLAYER_ACTION_HANDLER_5, /* 0x6 */ PLAYER_ACTION_HANDLER_6, /* 0x7 */ PLAYER_ACTION_HANDLER_7, @@ -5222,7 +5222,7 @@ typedef enum ActionHandlerIndex { s8 sActionHandlerList1[] = { /* 0 */ PLAYER_ACTION_HANDLER_13, /* 1 */ PLAYER_ACTION_HANDLER_2, - /* 2 */ PLAYER_ACTION_HANDLER_4, + /* 2 */ PLAYER_ACTION_HANDLER_TALK, /* 3 */ PLAYER_ACTION_HANDLER_9, /* 4 */ PLAYER_ACTION_HANDLER_10, /* 5 */ PLAYER_ACTION_HANDLER_11, @@ -5236,7 +5236,7 @@ s8 sActionHandlerList2[] = { /* 2 */ PLAYER_ACTION_HANDLER_2, /* 3 */ PLAYER_ACTION_HANDLER_5, /* 4 */ PLAYER_ACTION_HANDLER_3, - /* 5 */ PLAYER_ACTION_HANDLER_4, + /* 5 */ PLAYER_ACTION_HANDLER_TALK, /* 6 */ PLAYER_ACTION_HANDLER_9, /* 7 */ PLAYER_ACTION_HANDLER_10, /* 8 */ PLAYER_ACTION_HANDLER_11, @@ -5250,7 +5250,7 @@ s8 sActionHandlerList3[] = { /* 1 */ PLAYER_ACTION_HANDLER_1, /* 2 */ PLAYER_ACTION_HANDLER_2, /* 3 */ PLAYER_ACTION_HANDLER_3, - /* 4 */ PLAYER_ACTION_HANDLER_4, + /* 4 */ PLAYER_ACTION_HANDLER_TALK, /* 5 */ PLAYER_ACTION_HANDLER_9, /* 6 */ PLAYER_ACTION_HANDLER_10, /* 7 */ PLAYER_ACTION_HANDLER_11, @@ -5262,7 +5262,7 @@ s8 sActionHandlerList3[] = { s8 sActionHandlerList4[] = { /* 0 */ PLAYER_ACTION_HANDLER_13, /* 1 */ PLAYER_ACTION_HANDLER_2, - /* 2 */ PLAYER_ACTION_HANDLER_4, + /* 2 */ PLAYER_ACTION_HANDLER_TALK, /* 3 */ PLAYER_ACTION_HANDLER_9, /* 4 */ PLAYER_ACTION_HANDLER_10, /* 5 */ PLAYER_ACTION_HANDLER_11, @@ -5273,7 +5273,7 @@ s8 sActionHandlerList4[] = { s8 sActionHandlerList5[] = { /* 0 */ PLAYER_ACTION_HANDLER_13, /* 1 */ PLAYER_ACTION_HANDLER_2, - /* 2 */ PLAYER_ACTION_HANDLER_4, + /* 2 */ PLAYER_ACTION_HANDLER_TALK, /* 3 */ PLAYER_ACTION_HANDLER_9, /* 4 */ PLAYER_ACTION_HANDLER_10, /* 5 */ PLAYER_ACTION_HANDLER_11, @@ -5293,7 +5293,7 @@ s8 sActionHandlerListIdle[] = { /* 3 */ PLAYER_ACTION_HANDLER_2, /* 4 */ PLAYER_ACTION_HANDLER_3, /* 5 */ PLAYER_ACTION_HANDLER_5, - /* 6 */ PLAYER_ACTION_HANDLER_4, + /* 6 */ PLAYER_ACTION_HANDLER_TALK, /* 7 */ PLAYER_ACTION_HANDLER_9, /* 8 */ PLAYER_ACTION_HANDLER_8, /* 9 */ PLAYER_ACTION_HANDLER_7, @@ -5308,7 +5308,7 @@ s8 sActionHandlerList8[] = { /* 4 */ PLAYER_ACTION_HANDLER_3, /* 5 */ PLAYER_ACTION_HANDLER_12, /* 6 */ PLAYER_ACTION_HANDLER_5, - /* 7 */ PLAYER_ACTION_HANDLER_4, + /* 7 */ PLAYER_ACTION_HANDLER_TALK, /* 8 */ PLAYER_ACTION_HANDLER_9, /* 9 */ PLAYER_ACTION_HANDLER_8, /* 10 */ PLAYER_ACTION_HANDLER_7, @@ -5322,7 +5322,7 @@ s8 sActionHandlerList9[] = { /* 3 */ PLAYER_ACTION_HANDLER_3, /* 4 */ PLAYER_ACTION_HANDLER_12, /* 5 */ PLAYER_ACTION_HANDLER_5, - /* 6 */ PLAYER_ACTION_HANDLER_4, + /* 6 */ PLAYER_ACTION_HANDLER_TALK, /* 7 */ PLAYER_ACTION_HANDLER_9, /* 8 */ PLAYER_ACTION_HANDLER_10, /* 9 */ PLAYER_ACTION_HANDLER_11, @@ -5341,32 +5341,32 @@ s8 sActionHandlerList11[] = { /* 0 */ PLAYER_ACTION_HANDLER_0, /* 1 */ PLAYER_ACTION_HANDLER_12, /* 2 */ PLAYER_ACTION_HANDLER_5, - /* 3 */ PLAYER_ACTION_HANDLER_4, + /* 3 */ PLAYER_ACTION_HANDLER_TALK, /* 4 */ -PLAYER_ACTION_HANDLER_14, }; s8 sActionHandlerList12[] = { /* 0 */ PLAYER_ACTION_HANDLER_13, /* 1 */ PLAYER_ACTION_HANDLER_2, - /* 2 */ -PLAYER_ACTION_HANDLER_4, + /* 2 */ -PLAYER_ACTION_HANDLER_TALK, }; s32 (*sActionHandlerFuncs[PLAYER_ACTION_HANDLER_MAX])(Player* this, PlayState* play) = { - Player_ActionHandler_0, // PLAYER_ACTION_HANDLER_0 - Player_ActionHandler_1, // PLAYER_ACTION_HANDLER_1 - Player_ActionHandler_2, // PLAYER_ACTION_HANDLER_2 - Player_ActionHandler_3, // PLAYER_ACTION_HANDLER_3 - Player_ActionHandler_4, // PLAYER_ACTION_HANDLER_4 - Player_ActionHandler_5, // PLAYER_ACTION_HANDLER_5 - Player_ActionHandler_6, // PLAYER_ACTION_HANDLER_6 - Player_ActionHandler_7, // PLAYER_ACTION_HANDLER_7 - Player_ActionHandler_8, // PLAYER_ACTION_HANDLER_8 - Player_ActionHandler_9, // PLAYER_ACTION_HANDLER_9 - Player_ActionHandler_10, // PLAYER_ACTION_HANDLER_10 - Player_ActionHandler_11, // PLAYER_ACTION_HANDLER_11 - Player_ActionHandler_12, // PLAYER_ACTION_HANDLER_12 - Player_ActionHandler_13, // PLAYER_ACTION_HANDLER_13 - Player_ActionHandler_14, // PLAYER_ACTION_HANDLER_14 + Player_ActionHandler_0, // PLAYER_ACTION_HANDLER_0 + Player_ActionHandler_1, // PLAYER_ACTION_HANDLER_1 + Player_ActionHandler_2, // PLAYER_ACTION_HANDLER_2 + Player_ActionHandler_3, // PLAYER_ACTION_HANDLER_3 + Player_ActionHandler_Talk, // PLAYER_ACTION_HANDLER_TALK + Player_ActionHandler_5, // PLAYER_ACTION_HANDLER_5 + Player_ActionHandler_6, // PLAYER_ACTION_HANDLER_6 + Player_ActionHandler_7, // PLAYER_ACTION_HANDLER_7 + Player_ActionHandler_8, // PLAYER_ACTION_HANDLER_8 + Player_ActionHandler_9, // PLAYER_ACTION_HANDLER_9 + Player_ActionHandler_10, // PLAYER_ACTION_HANDLER_10 + Player_ActionHandler_11, // PLAYER_ACTION_HANDLER_11 + Player_ActionHandler_12, // PLAYER_ACTION_HANDLER_12 + Player_ActionHandler_13, // PLAYER_ACTION_HANDLER_13 + Player_ActionHandler_14, // PLAYER_ACTION_HANDLER_14 }; /** @@ -6817,7 +6817,7 @@ s32 Player_ActionHandler_1(Player* this, PlayState* play) { Actor* var_v0_3; if (this->doorType <= PLAYER_DOORTYPE_TALKING) { - Player_TalkWithPlayer(play, doorActor); + Player_StartTalking(play, doorActor); if (doorActor->textId == 0x1821) { doorActor->flags |= ACTOR_FLAG_TALK; } @@ -7311,11 +7311,11 @@ void func_808379C0(PlayState* play, Player* this) { } } -void func_80837B60(PlayState* play, Player* this) { - Player_SetAction_PreserveMoveFlags(play, this, Player_Action_44, 0); +void Player_SetupTalk(PlayState* play, Player* this) { + Player_SetAction_PreserveMoveFlags(play, this, Player_Action_Talk, 0); this->exchangeItemAction = PLAYER_IA_NONE; - this->stateFlags1 |= (PLAYER_STATE1_40 | PLAYER_STATE1_20000000); + this->stateFlags1 |= (PLAYER_STATE1_TALKING | PLAYER_STATE1_20000000); if (this->actor.textId != 0) { Message_StartTextbox(play, this->actor.textId, this->talkActor); } @@ -7850,7 +7850,7 @@ s32 Player_ActionHandler_13(Player* this, PlayState* play) { Player_StopCutscene(this); this->itemAction = PLAYER_IA_NONE; - Player_SetAction_PreserveItemAction(play, this, Player_Action_71, 0); + Player_SetAction_PreserveItemAction(play, this, Player_Action_ExchangeItem, 0); talkActor = this->talkActor; this->itemAction = heldItemTemp; this->csId = CS_ID_NONE; @@ -7859,7 +7859,7 @@ s32 Player_ActionHandler_13(Player* this, PlayState* play) { (this->itemAction == PLAYER_IA_MAGIC_BEANS)) || ((this->exchangeItemAction != PLAYER_IA_MAGIC_BEANS) && (this->exchangeItemAction > PLAYER_IA_NONE)))) { - this->stateFlags1 |= (PLAYER_STATE1_20000000 | PLAYER_STATE1_40); + this->stateFlags1 |= (PLAYER_STATE1_20000000 | PLAYER_STATE1_TALKING); if (this->exchangeItemAction == PLAYER_IA_MAGIC_BEANS) { Inventory_ChangeAmmo(ITEM_MAGIC_BEANS, -1); Player_SetAction_PreserveItemAction(play, this, Player_Action_17, 0); @@ -7883,7 +7883,7 @@ s32 Player_ActionHandler_13(Player* this, PlayState* play) { this->actor.textId = 0; this->focusActor = this->talkActor; } else { - this->stateFlags1 |= (PLAYER_STATE1_20000000 | PLAYER_STATE1_10000000 | PLAYER_STATE1_40); + this->stateFlags1 |= (PLAYER_STATE1_20000000 | PLAYER_STATE1_10000000 | PLAYER_STATE1_TALKING); this->csId = play->playerCsIds[PLAYER_CS_ID_ITEM_SHOW]; this->av1.actionVar1 = 1; this->actor.textId = 0xFE; @@ -7970,89 +7970,120 @@ s32 Player_ActionHandler_13(Player* this, PlayState* play) { return false; } -s32 Player_ActionHandler_4(Player* this, PlayState* play) { +s32 Player_ActionHandler_Talk(Player* this, PlayState* play) { if (gSaveContext.save.saveInfo.playerData.health != 0) { - Actor* talkActor = this->talkActor; + Actor* talkOfferActor = this->talkActor; Actor* lockOnActor = this->focusActor; - Actor* var_a1 = NULL; - s32 var_t1 = false; - s32 var_t2 = false; + Actor* cUpTalkActor = NULL; + s32 forceTalkToTatl = false; + s32 canTalkToLockOnWithCUp = false; if (this->tatlActor != NULL) { - var_t2 = (lockOnActor != NULL) && - (CHECK_FLAG_ALL(lockOnActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_WITH_C_UP) || - (lockOnActor->hintId != TATL_HINT_ID_NONE)); + canTalkToLockOnWithCUp = + (lockOnActor != NULL) && + (CHECK_FLAG_ALL(lockOnActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_WITH_C_UP) || + (lockOnActor->hintId != TATL_HINT_ID_NONE)); - if (var_t2 || (this->tatlTextId != 0)) { + if (canTalkToLockOnWithCUp || (this->tatlTextId != 0)) { //! @bug The comparison `((ABS_ALT(this->tatlTextId) & 0xFF00) != 0x10000)` always evaluates to `true` - var_t1 = (this->tatlTextId < 0) && ((ABS_ALT(this->tatlTextId) & 0xFF00) != 0x10000); + // Likely changed 0x200 -> 0x10000 to disable this check from OoT + forceTalkToTatl = (this->tatlTextId < 0) && ((ABS_ALT(this->tatlTextId) & 0xFF00) != 0x10000); - if (var_t1 || !var_t2) { - var_a1 = this->tatlActor; - if (var_t1) { + if (forceTalkToTatl || !canTalkToLockOnWithCUp) { + // If `lockOnActor` can't be talked to with c-up, the only option left is Tatl + cUpTalkActor = this->tatlActor; + if (forceTalkToTatl) { + // Clearing these pointers guarantees that `cUpTalkActor` will take priority lockOnActor = NULL; - talkActor = NULL; + talkOfferActor = NULL; } } else { - var_a1 = lockOnActor; + // Tatl is not the talk actor, so the only option left for talking with c-up is `lockOnActor` + // (though, `lockOnActor` may be NULL at this point). + cUpTalkActor = lockOnActor; } } } - if ((talkActor != NULL) || (var_a1 != NULL)) { - if ((lockOnActor == NULL) || (lockOnActor == talkActor) || (lockOnActor == var_a1)) { - if (!(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) || - ((this->heldActor != NULL) && - (var_t1 || (talkActor == this->heldActor) || (var_a1 == this->heldActor) || - ((talkActor != NULL) && (talkActor->flags & ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED))))) { - if (((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || - (this->stateFlags1 & PLAYER_STATE1_800000) || func_801242B4(this))) { - if (talkActor != NULL) { - if ((lockOnActor == NULL) || (lockOnActor == talkActor)) { - this->stateFlags2 |= PLAYER_STATE2_2; - } + if ((talkOfferActor != NULL) || (cUpTalkActor != NULL)) { + if ((lockOnActor != NULL) && (lockOnActor != talkOfferActor) && (lockOnActor != cUpTalkActor)) { + goto dont_talk; + } - if (!CutsceneManager_IsNext(CS_ID_GLOBAL_TALK)) { - return false; - } - - if (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A) || - (talkActor->flags & ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED)) { - var_a1 = NULL; - } else if (var_a1 == NULL) { - return false; - } - } - - if (var_a1 != NULL) { - if (!var_t1) { - this->stateFlags2 |= PLAYER_STATE2_200000; - if (!CutsceneManager_IsNext(CS_ID_GLOBAL_TALK) || - !CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_CUP)) { - return false; - } - } - - talkActor = var_a1; - this->talkActor = NULL; - - if (var_t1 || !var_t2) { - var_a1->textId = ABS_ALT(this->tatlTextId); - } else if (var_a1->hintId != 0xFF) { - var_a1->textId = var_a1->hintId + 0x1900; - } - } - - this->currentMask = D_80862B2C; - gSaveContext.save.equippedMask = this->currentMask; - Player_TalkWithPlayer(play, talkActor); - return true; - } + if (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { + if ((this->heldActor == NULL) || + (!forceTalkToTatl && (talkOfferActor != this->heldActor) && (cUpTalkActor != this->heldActor) && + ((talkOfferActor == NULL) || !(talkOfferActor->flags & ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED)))) { + goto dont_talk; } } + + // FAKE: used to maintain matching using goto's. Goto's not required, but improves readability. + if (1) {} + if (1) {} + + if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) { + if (!(this->stateFlags1 & PLAYER_STATE1_800000) && !func_801242B4(this)) { + goto dont_talk; + } + } + + if (talkOfferActor != NULL) { + // At this point the talk offer can be accepted. + // "Speak" or "Check" will appear on the A button in the HUD. + if ((lockOnActor == NULL) || (lockOnActor == talkOfferActor)) { + this->stateFlags2 |= PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER; + } + + if (!CutsceneManager_IsNext(CS_ID_GLOBAL_TALK)) { + return false; + } + + if (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A) || + (talkOfferActor->flags & ACTOR_FLAG_TALK_OFFER_AUTO_ACCEPTED)) { + // Talk Offer has been accepted. + // Clearing `cUpTalkActor` guarantees that `talkOfferActor` is the actor that will be spoken to + cUpTalkActor = NULL; + } else if (cUpTalkActor == NULL) { + return false; + } + } + + if (cUpTalkActor != NULL) { + if (!forceTalkToTatl) { + this->stateFlags2 |= PLAYER_STATE2_200000; + if (!CutsceneManager_IsNext(CS_ID_GLOBAL_TALK) || + !CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_CUP)) { + return false; + } + } + + talkOfferActor = cUpTalkActor; + this->talkActor = NULL; + + if (forceTalkToTatl || !canTalkToLockOnWithCUp) { + cUpTalkActor->textId = ABS_ALT(this->tatlTextId); + } else if (cUpTalkActor->hintId != 0xFF) { + cUpTalkActor->textId = cUpTalkActor->hintId + 0x1900; + } + } + + // `sSavedCurrentMask` saves the current mask just before the current action runs on this frame. + // This saved mask value is then restored just before starting a conversation. + // + // This handles an edge case where a conversation is started on the same frame that a mask was taken on or + // off. Because Player updates early before most actors, the text ID being offered comes from the previous + // frame. If a mask was taken on or off the same frame this function runs, the wrong text will be used. + this->currentMask = sSavedCurrentMask; + gSaveContext.save.equippedMask = this->currentMask; + + Player_StartTalking(play, talkOfferActor); + + return true; } } +dont_talk: return false; } @@ -8262,7 +8293,7 @@ void func_80839E74(Player* this, PlayState* play) { void func_80839ED0(Player* this, PlayState* play) { if (!(this->stateFlags3 & PLAYER_STATE3_80) && (Player_Action_64 != this->actionFunc) && !func_8083213C(this)) { func_80836D8C(this); - if (!(this->stateFlags1 & PLAYER_STATE1_40)) { + if (!(this->stateFlags1 & PLAYER_STATE1_TALKING)) { if (func_801242B4(this)) { func_808353DC(play, this); } else { @@ -9255,7 +9286,7 @@ s32 Player_ActionHandler_3(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A)) { if (CutsceneManager_IsNext(CS_ID_GLOBAL_TALK)) { rideActor->actor.textId = D_8085D254[this->transformation - 1]; - Player_TalkWithPlayer(play, &rideActor->actor); + Player_StartTalking(play, &rideActor->actor); return true; } } @@ -9265,7 +9296,7 @@ s32 Player_ActionHandler_3(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A)) { if (CutsceneManager_IsNext(CS_ID_GLOBAL_TALK)) { rideActor->actor.textId = D_8085D25C[this->transformation]; - Player_TalkWithPlayer(play, &rideActor->actor); + Player_StartTalking(play, &rideActor->actor); return true; } } @@ -10363,7 +10394,7 @@ s32 func_8083FD80(Player* this, PlayState* play) { } bool func_8083FE38(Player* this, PlayState* play) { - return Player_ActionHandler_13(this, play) || Player_ActionHandler_4(this, play) || + return Player_ActionHandler_13(this, play) || Player_ActionHandler_Talk(this, play) || Player_ActionHandler_2(this, play); } @@ -11039,7 +11070,7 @@ void Player_Init(Actor* thisx, PlayState* play) { play->tryPlayerCsAction = Player_TryCsAction; play->func_18780 = func_8085B384; play->damagePlayer = Player_InflictDamage; - play->talkWithPlayer = Player_TalkWithPlayer; + play->talkWithPlayer = Player_StartTalking; play->unk_1878C = func_8085B74C; play->unk_18790 = func_8085B820; play->unk_18794 = func_8085B854; @@ -11331,9 +11362,11 @@ void func_808425B4(Player* this) { } /** - * Sets the DoAction for the interface A/B buttons, depending on a significant number of things + * Updates the two main interface elements that player is responsible for: + * - Do Action label on the A/B buttons + * - Tatl C-up icon for hints */ -void Player_SetDoAction(PlayState* play, Player* this) { +void Player_UpdateInterface(PlayState* play, Player* this) { DoAction doActionB; s32 sp38; @@ -11425,7 +11458,7 @@ void Player_SetDoAction(PlayState* play, Player* this) { doActionA = DO_ACTION_CLIMB; } else if ((this->stateFlags1 & PLAYER_STATE1_800000) && (!EN_HORSE_CHECK_4((EnHorse*)this->rideActor) && (Player_Action_53 != this->actionFunc))) { - if ((this->stateFlags2 & PLAYER_STATE2_2) && (this->talkActor != NULL)) { + if ((this->stateFlags2 & PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER) && (this->talkActor != NULL)) { if ((this->talkActor->category == ACTORCAT_NPC) || (this->talkActor->id == ACTOR_DM_CHAR08)) { doActionA = DO_ACTION_SPEAK; } else { @@ -11436,7 +11469,7 @@ void Player_SetDoAction(PlayState* play, Player* this) { } else { doActionA = DO_ACTION_NONE; } - } else if ((this->stateFlags2 & PLAYER_STATE2_2) && (this->talkActor != NULL)) { + } else if ((this->stateFlags2 & PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER) && (this->talkActor != NULL)) { if ((this->talkActor->category == ACTORCAT_NPC) || (this->talkActor->category == ACTORCAT_ENEMY) || (this->talkActor->id == ACTOR_DM_CHAR08)) { doActionA = DO_ACTION_SPEAK; @@ -12342,8 +12375,8 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->unk_D57--; } - if (this->unk_B5E != 0) { - this->unk_B5E--; + if (this->textboxBtnCooldownTimer != 0) { + this->textboxBtnCooldownTimer--; } if (this->unk_D6B != 0) { @@ -12586,7 +12619,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { if (((this->focusActor == NULL) || (this->focusActor == this->talkActor) || (this->focusActor->hintId == TATL_HINT_ID_NONE)) && (this->tatlTextId == 0)) { - this->stateFlags2 &= ~(PLAYER_STATE2_2 | PLAYER_STATE2_200000); + this->stateFlags2 &= ~(PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER | PLAYER_STATE2_200000); } this->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_1000 | PLAYER_STATE1_400000); @@ -12606,13 +12639,13 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { sPlayerUseHeldItem = sPlayerHeldItemButtonIsHeldDown = false; var_v1 = Play_InCsMode(play); - D_80862B2C = this->currentMask; + sSavedCurrentMask = this->currentMask; if (!(this->stateFlags3 & PLAYER_STATE3_4)) { this->actionFunc(this, play); } if (!var_v1) { - Player_SetDoAction(play, this); + Player_UpdateInterface(play, this); } Player_UpdateCamAndSeqModes(play, this); @@ -12822,7 +12855,9 @@ void Player_Update(Actor* thisx, PlayState* play) { this->fallStartHeight = this->actor.world.pos.y; } else { input = *CONTROLLER1(&play->state); - if (this->unk_B5E != 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_CUP | BTN_B | BTN_A); input.press.button &= ~(BTN_CUP | BTN_B | BTN_A); } @@ -13538,7 +13573,7 @@ void func_80848250(PlayState* play, Player* this) { this->getItemDrawIdPlusOne = GID_NONE + 1; this->stateFlags1 &= ~(PLAYER_STATE1_400 | PLAYER_STATE1_CARRYING_ACTOR); this->getItemId = GI_NONE; - func_800E0238(Play_GetCamera(play, CAM_ID_MAIN)); + Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); } void func_80848294(PlayState* play, Player* this) { @@ -14786,7 +14821,7 @@ void Player_Action_17(Player* this, PlayState* play) { func_80836A98(this, D_8085BE84[PLAYER_ANIMGROUP_check_end][this->modelAnimType], play); } this->actor.flags &= ~ACTOR_FLAG_TALK; - func_800E0238(Play_GetCamera(play, CAM_ID_MAIN)); + Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); } } @@ -15731,7 +15766,7 @@ void Player_Action_35(Player* this, PlayState* play) { } R_PLAY_FILL_SCREEN_ON = 0; - func_800E0238(Play_GetCamera(play, CAM_ID_MAIN)); + Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); Player_StopCutscene(this); if (!(this->stateFlags3 & PLAYER_STATE3_20000)) { func_801226E0(play, ((void)0, gSaveContext.respawn[RESPAWN_MODE_DOWN].data)); @@ -15743,7 +15778,7 @@ void Player_Action_35(Player* this, PlayState* play) { if (play->sceneId == SCENE_20SICHITAI) { play->bButtonAmmoPlusOne = 0; } - } else if (!Player_ActionHandler_4(this, play)) { + } else if (!Player_ActionHandler_Talk(this, play)) { func_8083B2E4(this, play); } } @@ -15787,7 +15822,7 @@ void Player_Action_36(Player* this, PlayState* play) { Room_FinishRoomChange(play, &play->roomCtx); } - func_800E0238(Play_GetCamera(play, CAM_ID_MAIN)); + Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); Play_SetupRespawnPoint(play, RESPAWN_MODE_DOWN, PLAYER_PARAMS(0xFF, PLAYER_INITMODE_B)); } } @@ -15944,7 +15979,7 @@ void Player_Action_43(Player* this, PlayState* play) { ((this->unk_AA5 == PLAYER_UNKAA5_1) && CHECK_BTN_ANY(sPlayerControlInput->press.button, BTN_CRIGHT | BTN_CLEFT | BTN_CDOWN | BTN_CUP | BTN_R | BTN_B | BTN_A))) || - Player_ActionHandler_4(this, play)))) { + Player_ActionHandler_Talk(this, play)))) { func_80839ED0(this, play); Audio_PlaySfx(NA_SE_SY_CAMERA_ZOOM_UP); } else if ((DECR(this->av2.actionVar2) == 0) || (this->unk_AA5 != PLAYER_UNKAA5_3)) { @@ -15958,19 +15993,21 @@ void Player_Action_43(Player* this, PlayState* play) { this->yaw = this->actor.shape.rot.y; } -void Player_Action_44(Player* this, PlayState* play) { +void Player_Action_Talk(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_20; func_8083249C(this); Player_UpdateUpperBody(this, play); + if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~ACTOR_FLAG_TALK; if (!CHECK_FLAG_ALL(this->talkActor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE)) { this->stateFlags2 &= ~PLAYER_STATE2_LOCK_ON_WITH_SWITCH; } - func_800E0238(Play_GetCamera(play, CAM_ID_MAIN)); + Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); CutsceneManager_Stop(CS_ID_GLOBAL_TALK); + if (this->stateFlags1 & PLAYER_STATE1_800000) { s32 sp44 = this->av2.actionVar2; @@ -15985,7 +16022,7 @@ void Player_Action_44(Player* this, PlayState* play) { } } - this->unk_B5E = 0xA; + this->textboxBtnCooldownTimer = 10; return; } @@ -16555,7 +16592,7 @@ void Player_Action_52(Player* this, PlayState* play) { } if (this->av2.actionVar2 == 1) { - if (sUpperBodyIsBusy || func_8082DAFC(play)) { + if (sUpperBodyIsBusy || Player_IsTalking(play)) { Player_Anim_PlayOnce(play, this, &gPlayerAnim_link_uma_wait_3); } else if (PlayerAnimation_Update(play, &this->skelAnime)) { this->av2.actionVar2 = 0x63; @@ -16635,7 +16672,8 @@ void Player_Action_52(Player* this, PlayState* play) { func_8084FD7C(play, this, &rideActor->actor); } } else if ((this->csAction != PLAYER_CSACTION_NONE) || - (!func_8082DAFC(play) && ((rideActor->actor.speed != 0.0f) || !Player_ActionHandler_4(this, play)) && + (!Player_IsTalking(play) && + ((rideActor->actor.speed != 0.0f) || !Player_ActionHandler_Talk(this, play)) && !func_80847BF0(this, play) && !Player_ActionHandler_13(this, play))) { if (this->focusActor != NULL) { if (func_800B7128(this)) { @@ -16749,7 +16787,7 @@ void Player_Action_54(Player* this, PlayState* play) { this->av2.actionVar2 = 0; } - if (!func_8082DAFC(play) && !Player_TryActionHandlerList(play, this, sActionHandlerList11, true) && + if (!Player_IsTalking(play) && !Player_TryActionHandlerList(play, this, sActionHandlerList11, true) && !func_8083B3B4(play, this, sPlayerControlInput) && ((this->av2.actionVar2 != 0) || !func_80850734(play, this))) { speedTarget = 0.0f; @@ -17339,11 +17377,11 @@ void Player_Action_63(Player* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_20000000; if ((this->talkActor != NULL) && (this->talkActor == this->unk_A90) && (this->unk_A94 >= 0.0f)) { - Player_TalkWithPlayer(play, this->talkActor); + Player_StartTalking(play, this->talkActor); } else if (this->tatlTextId < 0) { this->talkActor = this->tatlActor; this->tatlActor->textId = -this->tatlTextId; - Player_TalkWithPlayer(play, this->talkActor); + Player_StartTalking(play, this->talkActor); } else if (!Player_ActionHandler_13(this, play)) { func_80836A5C(this, play); Player_Anim_PlayOnceAdjustedReverse(play, this, D_8085D17C[this->transformation]); @@ -17478,7 +17516,7 @@ void Player_Action_65(Player* this, PlayState* play) { func_80848250(play, this); this->exchangeItemAction = PLAYER_IA_NONE; if (!func_80847994(play, this)) { - Player_TalkWithPlayer(play, this->talkActor); + Player_StartTalking(play, this->talkActor); } } else { func_80848294(play, this); @@ -17714,11 +17752,11 @@ void Player_Action_68(Player* this, PlayState* play) { this->av1.actionVar1 = 0; Player_StopCutscene(this); - func_800E0238(Play_GetCamera(play, CAM_ID_MAIN)); + Camera_SetFinishedFlag(Play_GetCamera(play, CAM_ID_MAIN)); talkActor = this->talkActor; if ((talkActor != NULL) && (this->exchangeItemAction <= PLAYER_IA_MINUS1)) { - Player_TalkWithPlayer(play, talkActor); + Player_StartTalking(play, talkActor); } } } else { @@ -17865,7 +17903,7 @@ AnimSfxEntry D_8085D840[] = { ANIMSFX(ANIMSFX_TYPE_GENERAL, 30, NA_SE_PL_PUT_OUT_ITEM, STOP), }; -void Player_Action_71(Player* this, PlayState* play) { +void Player_Action_ExchangeItem(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_20; this->stateFlags3 |= PLAYER_STATE3_4000000; @@ -17881,7 +17919,7 @@ void Player_Action_71(Player* this, PlayState* play) { if ((talkActor->textId != 0) && (talkActor->textId != 0xFFFF)) { this->actor.flags |= ACTOR_FLAG_TALK; } - Player_TalkWithPlayer(play, talkActor); + Player_StartTalking(play, talkActor); } else { GetItemEntry* giEntry = &sGetItemTable[D_8085D1A4[this->exchangeItemAction] - 1]; @@ -17900,7 +17938,7 @@ void Player_Action_71(Player* this, PlayState* play) { this->getItemDrawIdPlusOne = GID_NONE + 1; this->actor.flags &= ~ACTOR_FLAG_TALK; func_80839E74(this, play); - this->unk_B5E = 0xA; + this->textboxBtnCooldownTimer = 10; } } } else if (this->av2.actionVar2 >= 0) { @@ -20767,7 +20805,7 @@ void Player_CsAction_End(PlayState* play, Player* this, CsCmdActorCue* cue) { func_8082DC64(play, this); } else { func_80839ED0(this, play); - if (!Player_ActionHandler_4(this, play)) { + if (!Player_ActionHandler_Talk(this, play)) { Player_ActionHandler_2(this, play); } } @@ -20996,72 +21034,77 @@ s32 Player_InflictDamage(PlayState* play, s32 damage) { return false; } -// Start talking with the given actor -void Player_TalkWithPlayer(PlayState* play, Actor* actor) { +/** + * Start talking to the specified actor. + */ +void Player_StartTalking(PlayState* play, Actor* actor) { s32 pad; - Player* player = GET_PLAYER(play); + Player* this = GET_PLAYER(play); - func_808323C0(player, CS_ID_GLOBAL_TALK); - if ((player->talkActor != NULL) || (actor == player->tatlActor) || + func_808323C0(this, CS_ID_GLOBAL_TALK); + + if ((this->talkActor != NULL) || (actor == this->tatlActor) || CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_TALK_WITH_C_UP)) { actor->flags |= ACTOR_FLAG_TALK; } - player->talkActor = actor; - player->exchangeItemAction = PLAYER_IA_NONE; - player->focusActor = actor; + this->talkActor = actor; + this->exchangeItemAction = PLAYER_IA_NONE; + this->focusActor = actor; 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, player); + Player_PutAwayHeldItem(play, this); } else { - if (player->actor.flags & ACTOR_FLAG_TALK) { - player->actor.textId = 0; + if (this->actor.flags & ACTOR_FLAG_TALK) { + this->actor.textId = 0; } else { - player->actor.flags |= ACTOR_FLAG_TALK; - player->actor.textId = actor->textId; + this->actor.flags |= ACTOR_FLAG_TALK; + this->actor.textId = actor->textId; } - if (player->stateFlags1 & PLAYER_STATE1_800000) { - s32 sp24 = player->av2.actionVar2; + if (this->stateFlags1 & PLAYER_STATE1_800000) { + s32 sp24 = this->av2.actionVar2; - Player_PutAwayHeldItem(play, player); - func_80837B60(play, player); - player->av2.actionVar2 = sp24; + Player_PutAwayHeldItem(play, this); + Player_SetupTalk(play, this); + this->av2.actionVar2 = sp24; } else { - if (func_801242B4(player)) { - Player_SetupWaitForPutAway(play, player, func_80837B60); - Player_Anim_PlayLoopSlowMorph(play, player, &gPlayerAnim_link_swimer_swim_wait); - } else if ((actor->category != ACTORCAT_NPC) || (player->heldItemAction == PLAYER_IA_FISHING_ROD)) { - func_80837B60(play, player); + if (func_801242B4(this)) { + Player_SetupWaitForPutAway(play, this, Player_SetupTalk); + Player_Anim_PlayLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim_wait); + } else if ((actor->category != ACTORCAT_NPC) || (this->heldItemAction == PLAYER_IA_FISHING_ROD)) { + Player_SetupTalk(play, this); - if (!Player_CheckHostileLockOn(player)) { - if ((actor != player->tatlActor) && (actor->xzDistToPlayer < (actor->colChkInfo.cylRadius + 40))) { - Player_Anim_PlayOnceAdjusted(play, player, &gPlayerAnim_link_normal_backspace); + if (!Player_CheckHostileLockOn(this)) { + if ((actor != this->tatlActor) && (actor->xzDistToPlayer < (actor->colChkInfo.cylRadius + 40))) { + Player_Anim_PlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_backspace); } else { - Player_Anim_PlayLoop(play, player, Player_GetIdleAnim(player)); + Player_Anim_PlayLoop(play, this, Player_GetIdleAnim(this)); } } } else { - Player_SetupWaitForPutAway(play, player, func_80837B60); - Player_Anim_PlayOnceAdjusted(play, player, + Player_SetupWaitForPutAway(play, this, Player_SetupTalk); + Player_Anim_PlayOnceAdjusted(play, this, (actor->xzDistToPlayer < (actor->colChkInfo.cylRadius + 40)) ? &gPlayerAnim_link_normal_backspace : &gPlayerAnim_link_normal_talk_free); } - if (player->skelAnime.animation == &gPlayerAnim_link_normal_backspace) { - Player_AnimReplace_Setup(play, player, ANIM_FLAG_1 | ANIM_FLAG_8 | ANIM_FLAG_NOMOVE); + if (this->skelAnime.animation == &gPlayerAnim_link_normal_backspace) { + Player_AnimReplace_Setup(play, this, ANIM_FLAG_1 | ANIM_FLAG_8 | ANIM_FLAG_NOMOVE); } - func_8082DAD4(player); + func_8082DAD4(this); } - player->stateFlags1 |= PLAYER_STATE1_40 | PLAYER_STATE1_20000000; + this->stateFlags1 |= PLAYER_STATE1_TALKING | PLAYER_STATE1_20000000; } - if ((player->tatlActor == player->talkActor) && ((player->talkActor->textId & 0xFF00) != 0x200)) { - player->tatlActor->flags |= ACTOR_FLAG_TALK; + if ((this->tatlActor == this->talkActor) && ((this->talkActor->textId & 0xFF00) != 0x200)) { + this->tatlActor->flags |= ACTOR_FLAG_TALK; } } @@ -21110,11 +21153,11 @@ PlayerItemAction func_8085B854(PlayState* play, Player* this, ItemId itemId) { this->itemAction = PLAYER_IA_NONE; this->actionFunc = NULL; - Player_SetAction_PreserveItemAction(play, this, Player_Action_71, 0); + Player_SetAction_PreserveItemAction(play, this, Player_Action_ExchangeItem, 0); this->csId = CS_ID_GLOBAL_TALK; this->itemAction = itemAction; Player_Anim_PlayOnce(play, this, &gPlayerAnim_link_normal_give_other); - this->stateFlags1 |= (PLAYER_STATE1_40 | PLAYER_STATE1_20000000); + this->stateFlags1 |= (PLAYER_STATE1_TALKING | PLAYER_STATE1_20000000); this->getItemDrawIdPlusOne = GID_NONE + 1; this->exchangeItemAction = itemAction; diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 089f2691c6..ebf96434ac 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -1293,7 +1293,7 @@ 0x800E01B8:("Camera_GetQuakeOffset",), 0x800E01DC:("Camera_SetCameraData",), 0x800E0228:("Camera_GetNegOne",), - 0x800E0238:("func_800E0238",), + 0x800E0238:("Camera_SetFinishedFlag",), 0x800E02AC:("Camera_SetFocalActor",), 0x800E0308:("Camera_SetTargetActor",), 0x800E031C:("Camera_GetWaterYPos",), @@ -4247,7 +4247,7 @@ 0x8082DA90:("func_8082DA90",), 0x8082DABC:("Player_StopHorizontalMovement",), 0x8082DAD4:("func_8082DAD4",), - 0x8082DAFC:("func_8082DAFC",), + 0x8082DAFC:("Player_IsTalking",), 0x8082DB18:("Player_Anim_PlayOnce",), 0x8082DB3C:("Player_Anim_PlayLoop",), 0x8082DB60:("Player_Anim_PlayLoopAdjusted",), @@ -4453,7 +4453,7 @@ 0x808378FC:("func_808378FC",), 0x8083798C:("func_8083798C",), 0x808379C0:("func_808379C0",), - 0x80837B60:("func_80837B60",), + 0x80837B60:("Player_SetupTalk",), 0x80837BD0:("func_80837BD0",), 0x80837BF8:("func_80837BF8",), 0x80837C20:("func_80837C20",), @@ -4471,7 +4471,7 @@ 0x808389BC:("func_808389BC",), 0x80838A20:("func_80838A20",), 0x80838A90:("Player_ActionHandler_13",), - 0x808391D8:("Player_ActionHandler_4",), + 0x808391D8:("Player_ActionHandler_Talk",), 0x80839518:("Player_ActionHandler_0",), 0x808395F0:("func_808395F0",), 0x808396B8:("func_808396B8",), @@ -4605,7 +4605,7 @@ 0x80841AC4:("Player_Init",), 0x80842510:("Player_ApproachZeroBinang",), 0x808425B4:("func_808425B4",), - 0x808426F0:("Player_SetDoAction",), + 0x808426F0:("Player_UpdateInterface",), 0x808430E0:("func_808430E0",), 0x80843178:("Player_ProcessSceneCollision",), 0x80843EC0:("Player_UpdateCamAndSeqModes",), @@ -4706,7 +4706,7 @@ 0x8084E58C:("Player_Action_41",), 0x8084E65C:("Player_Action_42",), 0x8084E724:("Player_Action_43",), - 0x8084E980:("Player_Action_44",), + 0x8084E980:("Player_Action_Talk",), 0x8084ED9C:("Player_Action_45",), 0x8084EE50:("Player_Action_46",), 0x8084EF9C:("Player_Action_47",), @@ -4750,7 +4750,7 @@ 0x808534C0:("Player_Action_68",), 0x80853754:("Player_Action_69",), 0x80853850:("Player_Action_70",), - 0x80853A5C:("Player_Action_71",), + 0x80853A5C:("Player_Action_ExchangeItem",), 0x80853CC0:("Player_Action_72",), 0x80853D68:("Player_Action_73",), 0x80854010:("Player_Action_74",), @@ -4881,7 +4881,7 @@ 0x8085B28C:("Player_TryCsAction",), 0x8085B384:("func_8085B384",), 0x8085B3E0:("Player_InflictDamage",), - 0x8085B460:("Player_TalkWithPlayer",), + 0x8085B460:("Player_StartTalking",), 0x8085B74C:("func_8085B74C",), 0x8085B820:("func_8085B820",), 0x8085B854:("func_8085B854",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 6a48738cb8..3acc21c416 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -5254,7 +5254,7 @@ 0x80862B20:("sPlayerShapeYawToTouchedWall","UNK_TYPE1","",0x1), 0x80862B24:("sPlayerWorldYawToTouchedWall","UNK_TYPE1","",0x1), 0x80862B28:("sPlayerFloorPitchShape","UNK_TYPE1","",0x1), - 0x80862B2C:("D_80862B2C","UNK_TYPE1","",0x1), + 0x80862B2C:("sSavedCurrentMask","UNK_TYPE1","",0x1), 0x80862B30:("sPlayerInteractWallCheckResult","UNK_TYPE1","",0x1), 0x80862B3C:("D_80862B3C","f32","",0x4), 0x80862B40:("sPlayerFloorEffect","UNK_TYPE1","",0x1), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 3cdd004877..2c6503463b 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -807,7 +807,7 @@ asm/non_matchings/code/z_camera/Camera_IsDbgCamEnabled.s,Camera_IsDbgCamEnabled, asm/non_matchings/code/z_camera/Camera_GetQuakeOffset.s,Camera_GetQuakeOffset,0x800E01B8,0x9 asm/non_matchings/code/z_camera/Camera_SetCameraData.s,Camera_SetCameraData,0x800E01DC,0x13 asm/non_matchings/code/z_camera/Camera_GetNegOne.s,Camera_GetNegOne,0x800E0228,0x4 -asm/non_matchings/code/z_camera/func_800E0238.s,func_800E0238,0x800E0238,0x1D +asm/non_matchings/code/z_camera/Camera_SetFinishedFlag.s,Camera_SetFinishedFlag,0x800E0238,0x1D asm/non_matchings/code/z_camera/Camera_SetFocalActor.s,Camera_SetFocalActor,0x800E02AC,0x17 asm/non_matchings/code/z_camera/Camera_SetTargetActor.s,Camera_SetTargetActor,0x800E0308,0x5 asm/non_matchings/code/z_camera/Camera_GetWaterYPos.s,Camera_GetWaterYPos,0x800E031C,0xB