mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-21 06:21:16 +00:00
Clean up NPC player interaction usages (#1458)
* Clean up player tracking related things in NPCs * Cleanup Npc_UpdateTalking usages and related things * Reformat * Minor fixes based on review comments * Remove unneeded declarations * More consistent function names
This commit is contained in:
parent
934d488420
commit
2ae64683a5
34 changed files with 471 additions and 487 deletions
|
@ -83,7 +83,7 @@ void EnMu_Interact(EnMu* this, PlayState* play) {
|
|||
}
|
||||
|
||||
if (i == 5) {
|
||||
if (this->defFaceReaction == (textIdOffset[randomIndex] | 0x7000)) {
|
||||
if (this->defaultTextId == (textIdOffset[randomIndex] | 0x7000)) {
|
||||
randomIndex++;
|
||||
if (randomIndex >= 5) {
|
||||
randomIndex = 0;
|
||||
|
@ -93,19 +93,19 @@ void EnMu_Interact(EnMu* this, PlayState* play) {
|
|||
}
|
||||
|
||||
textFlags |= bitmask[randomIndex];
|
||||
this->defFaceReaction = textIdOffset[randomIndex] | 0x7000;
|
||||
this->defaultTextId = textIdOffset[randomIndex] | 0x7000;
|
||||
textFlags &= EVENTINF_20_MASK | EVENTINF_21_MASK | EVENTINF_22_MASK | EVENTINF_23_MASK | EVENTINF_24_MASK | 0xE0;
|
||||
gSaveContext.eventInf[EVENTINF_20_21_22_23_24_INDEX] |= textFlags;
|
||||
}
|
||||
|
||||
u16 EnMu_GetFaceReaction(PlayState* play, Actor* thisx) {
|
||||
u16 EnMu_GetTextId(PlayState* play, Actor* thisx) {
|
||||
EnMu* this = (EnMu*)thisx;
|
||||
u16 faceReaction = Text_GetFaceReaction(play, this->actor.params + 0x3A);
|
||||
|
||||
if (faceReaction != 0) {
|
||||
return faceReaction;
|
||||
}
|
||||
return this->defFaceReaction;
|
||||
return this->defaultTextId;
|
||||
}
|
||||
|
||||
s16 EnMu_UpdateTalkState(PlayState* play, Actor* thisx) {
|
||||
|
@ -172,8 +172,7 @@ void EnMu_Update(Actor* thisx, PlayState* play) {
|
|||
Actor_UpdateBgCheckInfo(play, &this->actor, 0.0f, 0.0f, 0.0f, UPDBGCHECKINFO_FLAG_2);
|
||||
this->actionFunc(this, play);
|
||||
talkDist = this->collider.dim.radius + 30.0f;
|
||||
Npc_UpdateTalking(play, &this->actor, &this->npcInfo.talkState, talkDist, EnMu_GetFaceReaction,
|
||||
EnMu_UpdateTalkState);
|
||||
Npc_UpdateTalking(play, &this->actor, &this->npcInfo.talkState, talkDist, EnMu_GetTextId, EnMu_UpdateTalkState);
|
||||
|
||||
this->actor.focus.pos = this->actor.world.pos;
|
||||
this->actor.focus.pos.y += 60.0f;
|
||||
|
|
|
@ -14,7 +14,7 @@ typedef struct EnMu {
|
|||
/* 0x0190 */ EnMuActionFunc actionFunc;
|
||||
/* 0x0194 */ ColliderCylinder collider;
|
||||
/* 0x01E0 */ NpcInteractInfo npcInfo;
|
||||
/* 0x0208 */ u16 defFaceReaction;
|
||||
/* 0x0208 */ u16 defaultTextId;
|
||||
/* 0x020A */ s16 unk_20A[16];
|
||||
/* 0x022A */ s16 unk_22A[17];
|
||||
} EnMu; // size = 0x024C
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue