1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-03 14:34:32 +00:00

Doc Actor Rotation Functions (last 4 funcs in actor.c) (#1249)

* Cleanup functions

* Rename functions

* functions comments

* fix apostrophes

* Renames TurnTo -> Track, other review comments
This commit is contained in:
Derek Hensley 2022-06-03 11:29:23 -07:00 committed by GitHub
parent 451b24f79b
commit b2752a6a2e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 97 additions and 73 deletions

View file

@ -859,7 +859,7 @@ void BgDyYoseizo_Update(Actor* thisx, PlayState* play2) {
this->heightOffset = this->scale * 7500.0f;
Actor_SetFocus(&this->actor, this->heightOffset);
this->actor.focus.pos.y = this->heightOffset;
func_80038290(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->torsoRot, this->actor.focus.pos);
BgDyYoseizo_UpdateEffects(this, play);
Actor_SetScale(&this->actor, this->scale);
}

View file

@ -270,7 +270,7 @@ void EnAni_Update(Actor* thisx, PlayState* play) {
}
if (this->unk_2A8 & 1) {
func_80038290(play, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos);
this->unk_2A2.z = 0;
this->unk_2A2.y = this->unk_2A2.z;
this->unk_2A2.x = this->unk_2A2.z;

View file

@ -497,7 +497,7 @@ void EnBomBowlMan_Update(Actor* thisx, PlayState* play) {
}
}
func_80038290(play, &this->actor, &this->unk_218, &this->unk_224, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_218, &this->unk_224, this->actor.focus.pos);
break;
}

View file

@ -243,7 +243,7 @@ void EnDs_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
if (this->unk_1E8 & 1) {
func_80038290(play, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_1D8, &this->unk_1DE, this->actor.focus.pos);
} else {
Math_SmoothStepToS(&this->unk_1D8.x, 0, 6, 0x1838, 100);
Math_SmoothStepToS(&this->unk_1D8.y, 0, 6, 0x1838, 100);

View file

@ -253,7 +253,7 @@ void EnFu_Update(Actor* thisx, PlayState* play) {
Math_SmoothStepToS(&this->unk_2A2.y, 0, 6, 6200, 100);
this->behaviorFlags &= ~FU_RESET_LOOK_ANGLE;
} else {
func_80038290(play, &this->actor, &this->lookAngleOffset, &this->unk_2A2, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->lookAngleOffset, &this->unk_2A2, this->actor.focus.pos);
}
}

View file

@ -693,7 +693,7 @@ void EnGe1_TurnToFacePlayer(EnGe1* this, PlayState* play) {
if (ABS(angleDiff) <= 0x4000) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 4000, 100);
this->actor.world.rot.y = this->actor.shape.rot.y;
func_80038290(play, &this->actor, &this->headRot, &this->unk_2A2, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_2A2, this->actor.focus.pos);
} else {
if (angleDiff < 0) {
Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 6200, 0x100);
@ -710,7 +710,7 @@ void EnGe1_LookAtPlayer(EnGe1* this, PlayState* play) {
s16 angleDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if ((ABS(angleDiff) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) {
func_80038290(play, &this->actor, &this->headRot, &this->unk_2A2, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_2A2, this->actor.focus.pos);
} else {
Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100);
Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100);

View file

@ -397,7 +397,7 @@ void EnGe2_TurnToFacePlayer(EnGe2* this, PlayState* play) {
if (ABS(angleDiff) <= 0x4000) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 4000, 100);
this->actor.world.rot.y = this->actor.shape.rot.y;
func_80038290(play, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos);
} else {
if (angleDiff < 0) {
Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 6200, 0x100);
@ -413,7 +413,7 @@ void EnGe2_TurnToFacePlayer(EnGe2* this, PlayState* play) {
void EnGe2_LookAtPlayer(EnGe2* this, PlayState* play) {
if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x4300) &&
(this->actor.xzDistToPlayer < 200.0f)) {
func_80038290(play, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_2EE, this->actor.focus.pos);
} else {
Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100);
Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100);

View file

@ -98,7 +98,7 @@ void EnGe3_TurnToFacePlayer(EnGe3* this, PlayState* play) {
if (ABS(angleDiff) <= 0x4000) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 4000, 100);
this->actor.world.rot.y = this->actor.shape.rot.y;
func_80038290(play, &this->actor, &this->headRot, &this->unk_306, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_306, this->actor.focus.pos);
} else {
if (angleDiff < 0) {
Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 6200, 0x100);
@ -114,7 +114,7 @@ void EnGe3_TurnToFacePlayer(EnGe3* this, PlayState* play) {
void EnGe3_LookAtPlayer(EnGe3* this, PlayState* play) {
if ((ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y)) <= 0x2300) &&
(this->actor.xzDistToPlayer < 100.0f)) {
func_80038290(play, &this->actor, &this->headRot, &this->unk_306, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_306, this->actor.focus.pos);
} else {
Math_SmoothStepToS(&this->headRot.x, 0, 6, 6200, 100);
Math_SmoothStepToS(&this->headRot.y, 0, 6, 6200, 100);

View file

@ -769,7 +769,7 @@ void EnHeishi2_Update(Actor* thisx, PlayState* play) {
if ((this->type == 2) || (this->type == 5)) {
this->actor.focus.pos.y = 70.0f;
Actor_SetFocus(&this->actor, 70.0f);
func_80038290(play, &this->actor, &this->unk_260, &this->unk_26C, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_260, &this->unk_26C, this->actor.focus.pos);
}
this->unk_2FC++;

View file

@ -262,7 +262,7 @@ void func_80A56900(EnHeishi4* this, PlayState* play) {
void func_80A56994(EnHeishi4* this, PlayState* play) {
SkelAnime_Update(&this->skelAnime);
func_80038290(play, &this->actor, &this->unk_260, &this->unk_266, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_260, &this->unk_266, this->actor.focus.pos);
if ((this->unk_282 == Message_GetState(&play->msgCtx)) && Message_ShouldAdvance(play)) {
Message_CloseTextbox(play);
SET_INFTABLE(INFTABLE_6C);

View file

@ -241,7 +241,7 @@ void EnHs_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
if (this->unk_2A8 & 1) {
func_80038290(play, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos);
this->unk_2A8 &= ~1;
} else {
Math_SmoothStepToS(&this->unk_29C.x, 12800, 6, 6200, 100);

View file

@ -118,7 +118,7 @@ void EnHs2_Update(Actor* thisx, PlayState* play) {
}
this->actionFunc(this, play);
if (this->unk_2A8 & 0x1) {
func_80038290(play, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_29C, &this->unk_2A2, this->actor.focus.pos);
this->unk_2A8 &= ~1;
} else {
Math_SmoothStepToS(&this->unk_29C.x, 12800, 6, 6200, 100);

View file

@ -185,7 +185,7 @@ void EnJs_Update(Actor* thisx, PlayState* play) {
}
this->actionFunc(this, play);
if (this->unk_284 & 1) {
func_80038290(play, &this->actor, &this->unk_278, &this->unk_27E, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_278, &this->unk_27E, this->actor.focus.pos);
} else {
Math_SmoothStepToS(&this->unk_278.x, 0, 6, 0x1838, 0x64);
Math_SmoothStepToS(&this->unk_278.y, 0, 6, 0x1838, 0x64);

View file

@ -298,7 +298,7 @@ void EnMk_Update(Actor* thisx, PlayState* play) {
this->actionFunc(this, play);
if (this->flags & 1) {
func_80038290(play, &this->actor, &this->headRotation, &vec, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->headRotation, &vec, this->actor.focus.pos);
} else {
Math_SmoothStepToS(&this->headRotation.x, 0, 6, 6200, 100);
Math_SmoothStepToS(&this->headRotation.y, 0, 6, 6200, 100);

View file

@ -488,7 +488,7 @@ void func_80AAE50C(EnMm* this, PlayState* play) {
}
void func_80AAE598(EnMm* this, PlayState* play) {
func_80038290(play, &this->actor, &this->unk_248, &this->unk_24E, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_248, &this->unk_24E, this->actor.focus.pos);
SkelAnime_Update(&this->skelAnime);
if ((func_80AADA70() != 0) && (this->unk_1E0 == 0)) {

View file

@ -292,7 +292,7 @@ void EnMm2_Update(Actor* thisx, PlayState* play) {
s32 pad;
if (this->unk_1F4 & 1) {
func_80038290(play, &this->actor, &this->unk_1E8, &this->unk_1EE, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_1E8, &this->unk_1EE, this->actor.focus.pos);
} else {
Math_SmoothStepToS(&this->unk_1E8.x, 0, 6, 6200, 100);
Math_SmoothStepToS(&this->unk_1E8.y, 0, 6, 6200, 100);

View file

@ -184,7 +184,7 @@ void EnSth_FacePlayer(EnSth* this, PlayState* play) {
if (ABS(diffRot) <= 0x4000) {
Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, 0xFA0, 0x64);
this->actor.world.rot.y = this->actor.shape.rot.y;
func_80038290(play, &this->actor, &this->headRot, &this->unk_2AC, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_2AC, this->actor.focus.pos);
} else {
if (diffRot < 0) {
Math_SmoothStepToS(&this->headRot.y, -0x2000, 6, 0x1838, 0x100);
@ -200,7 +200,7 @@ void EnSth_LookAtPlayer(EnSth* this, PlayState* play) {
s16 diffRot = this->actor.yawTowardsPlayer - this->actor.shape.rot.y;
if ((ABS(diffRot) <= 0x4300) && (this->actor.xzDistToPlayer < 100.0f)) {
func_80038290(play, &this->actor, &this->headRot, &this->unk_2AC, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->unk_2AC, this->actor.focus.pos);
} else {
Math_SmoothStepToS(&this->headRot.x, 0, 6, 0x1838, 0x64);
Math_SmoothStepToS(&this->headRot.y, 0, 6, 0x1838, 0x64);

View file

@ -471,7 +471,7 @@ void EnSyatekiMan_Update(Actor* thisx, PlayState* play) {
this->blinkFunc(this);
this->actor.focus.pos.y = 70.0f;
Actor_SetFocus(&this->actor, 70.0f);
func_80038290(play, &this->actor, &this->headRot, &this->bodyRot, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->headRot, &this->bodyRot, this->actor.focus.pos);
}
s32 EnSyatekiMan_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) {

View file

@ -1146,7 +1146,7 @@ void EnTa_Update(Actor* thisx, PlayState* play) {
}
if (this->unk_2E0 & 1) {
func_80038290(play, &this->actor, &this->unk_2D4, &this->unk_2DA, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_2D4, &this->unk_2DA, this->actor.focus.pos);
} else {
Math_SmoothStepToS(&this->unk_2D4.x, 0, 6, 6200, 100);
Math_SmoothStepToS(&this->unk_2D4.y, 0, 6, 6200, 100);

View file

@ -185,7 +185,7 @@ void EnTakaraMan_Update(Actor* thisx, PlayState* play) {
}
Actor_SetFocus(&this->actor, this->height);
func_80038290(play, &this->actor, &this->unk_22C, &this->unk_232, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_22C, &this->unk_232, this->actor.focus.pos);
if (this->eyeTimer == 0) {
this->eyeTextureIdx++;
if (this->eyeTextureIdx >= 2) {

View file

@ -140,7 +140,7 @@ void func_80B4AF18(EnZl1* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s32 pad;
func_80038290(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos);
if (this->unk_1E6 != 0) {
if (Actor_TextboxIsClosing(&this->actor, play)) {
@ -329,7 +329,7 @@ void func_80B4B240(EnZl1* this, PlayState* play) {
frameCount = Animation_GetLastFrame(animHeaderSeg);
Animation_Change(&this->skelAnime, animHeaderSeg, 1.0f, 0.0f, frameCount, sp54[sp3C], -10.0f);
}
func_80038290(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos);
}
void func_80B4B7F4(CsCmdActorAction* npcAction, Vec3f* pos) {
@ -410,7 +410,7 @@ void func_80B4B8B4(EnZl1* this, PlayState* play) {
}
this->actor.velocity.z = (sp68.z - sp74.z) / actionLength;
}
func_80038290(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos);
Play_CameraSetAtEye(play, this->subCamId, &subCamAt, &subCamEye);
Play_CameraSetFov(play, this->subCamId, 70.0f);
}
@ -562,7 +562,7 @@ void func_80B4BF2C(EnZl1* this, PlayState* play) {
}
break;
}
func_80038290(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos);
Actor_TrackPlayer(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos);
}
void EnZl1_Update(Actor* thisx, PlayState* play) {