1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-18 13:00:23 +00:00

Document NPC talking and player tracking (#1426)

* Rename npc dialog state variable

* Rename and doc NPC actor talking funtion

* Introduce NpcTalkState enum

* Rename NPC_TALK_STATE enum values

* Document NpcPlayerInteractionState and related functions

* Rename player tracking opt enum variants

* Rename npc functions, interact info

* Minor npc actor function tweaks

* Minor comment fixes for npc

* Generalize NPC player tracking to point tracking

* Change unused NpcInteractInfo field type and name

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>

* Rename headRot and torsoRot

* Rename GetTalkState to UpdateTalkState

* Minor comment fixes

* Rename rotateActorShape and clarify related comments

* Remove unneeded parentheses in z_en_heishi4.c

* Reformat

* Remove unclear comment

* Rename yPosOffset to yOffset

Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com>
This commit is contained in:
Lauri Koskela 2022-11-25 19:52:28 +02:00 committed by GitHub
parent 9c35716fe2
commit b57f2162ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
66 changed files with 936 additions and 808 deletions

View file

@ -166,44 +166,44 @@ void DemoIm_UpdateCollider(DemoIm* this, PlayState* play) {
void func_80984DB8(DemoIm* this) {
s32 pad[2];
Vec3s* vec1 = &this->unk_2D4.unk_08;
Vec3s* vec2 = &this->unk_2D4.unk_0E;
Vec3s* headRot = &this->interactInfo.headRot;
Vec3s* torsoRot = &this->interactInfo.torsoRot;
Math_SmoothStepToS(&vec1->x, 0, 20, 6200, 100);
Math_SmoothStepToS(&vec1->y, 0, 20, 6200, 100);
Math_SmoothStepToS(&headRot->x, 0, 20, 6200, 100);
Math_SmoothStepToS(&headRot->y, 0, 20, 6200, 100);
Math_SmoothStepToS(&vec2->x, 0, 20, 6200, 100);
Math_SmoothStepToS(&vec2->y, 0, 20, 6200, 100);
Math_SmoothStepToS(&torsoRot->x, 0, 20, 6200, 100);
Math_SmoothStepToS(&torsoRot->y, 0, 20, 6200, 100);
}
void func_80984E58(DemoIm* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s16 yawDiff;
s16 phi_a3;
s16 npcTrackingMode;
this->unk_2D4.unk_18 = player->actor.world.pos;
this->unk_2D4.unk_14 = kREG(16) + 4.0f;
this->interactInfo.trackPos = player->actor.world.pos;
this->interactInfo.yOffset = kREG(16) + 4.0f;
yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
phi_a3 = (ABS(yawDiff) < 0x18E3) ? 2 : 1;
func_80034A14(&this->actor, &this->unk_2D4, kREG(17) + 0xC, phi_a3);
npcTrackingMode = (ABS(yawDiff) < 0x18E3) ? NPC_TRACKING_HEAD_AND_TORSO : NPC_TRACKING_NONE;
Npc_TrackPoint(&this->actor, &this->interactInfo, kREG(17) + 0xC, npcTrackingMode);
}
void func_80984F10(DemoIm* this, PlayState* play) {
Player* player = GET_PLAYER(play);
this->unk_2D4.unk_18 = player->actor.world.pos;
this->unk_2D4.unk_14 = kREG(16) + 12.0f;
this->interactInfo.trackPos = player->actor.world.pos;
this->interactInfo.yOffset = kREG(16) + 12.0f;
func_80034A14(&this->actor, &this->unk_2D4, kREG(17) + 0xC, 2);
Npc_TrackPoint(&this->actor, &this->interactInfo, kREG(17) + 0xC, NPC_TRACKING_HEAD_AND_TORSO);
}
void func_80984F94(DemoIm* this, PlayState* play) {
Player* player = GET_PLAYER(play);
this->unk_2D4.unk_18 = player->actor.world.pos;
this->unk_2D4.unk_14 = kREG(16) + 4.0f;
func_80034A14(&this->actor, &this->unk_2D4, kREG(17) + 0xC, 4);
this->interactInfo.trackPos = player->actor.world.pos;
this->interactInfo.yOffset = kREG(16) + 4.0f;
Npc_TrackPoint(&this->actor, &this->interactInfo, kREG(17) + 0xC, NPC_TRACKING_FULL_BODY);
}
void DemoIm_UpdateBgCheckInfo(DemoIm* this, PlayState* play) {
@ -1137,17 +1137,17 @@ s32 DemoIm_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f*
s32* unk_2D0 = &this->unk_2D0;
if (this->unk_280 != 0) {
Vec3s* unk_2D4_unk_0E = &this->unk_2D4.unk_0E;
Vec3s* unk_2D4_unk_08 = &this->unk_2D4.unk_08;
Vec3s* torsoRot = &this->interactInfo.torsoRot;
Vec3s* headRot = &this->interactInfo.headRot;
switch (limbIndex) {
case IMPA_LIMB_CHEST:
rot->x += unk_2D4_unk_0E->y;
rot->y -= unk_2D4_unk_0E->x;
rot->x += torsoRot->y;
rot->y -= torsoRot->x;
break;
case IMPA_LIMB_HEAD:
rot->x += unk_2D4_unk_08->y;
rot->z += unk_2D4_unk_08->x;
rot->x += headRot->y;
rot->z += headRot->x;
break;
}
}

View file

@ -48,7 +48,7 @@ typedef struct DemoIm {
/* 0x0280 */ s32 unk_280;
/* 0x0284 */ ColliderCylinder collider;
/* 0x02D0 */ s32 unk_2D0;
/* 0x02D4 */ struct_80034A14_arg1 unk_2D4;
/* 0x02D4 */ NpcInteractInfo interactInfo;
} DemoIm; // size = 0x02FC
#endif