summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJordan Longstaff <JordanLongstaff@users.noreply.github.com>2025-06-04 00:39:19 -0400
committerGitHub <noreply@github.com>2025-06-04 06:39:19 +0200
commit7085b48483ef765cc6e69e295d243f584046271c (patch)
treea75b6d5a8dccbb990ae673f48dbc47ad74b2d22c /src
parentf51e3e8ab2758f31bce636b0028f9e260c913f24 (diff)
Child Ruto Part 10: Head rotation (#2578)
* Child Ruto Part 10: Head rotation * Rename head turn speed variable
Diffstat (limited to 'src')
-rw-r--r--src/overlays/actors/ovl_En_Ru1/z_en_ru1.c44
-rw-r--r--src/overlays/actors/ovl_En_Ru1/z_en_ru1.h6
2 files changed, 25 insertions, 25 deletions
diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c
index ceaea5935..e94723f58 100644
--- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c
+++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c
@@ -1307,35 +1307,35 @@ void func_80AED83C(EnRu1* this) {
Math_SmoothStepToS(&torsoRot->y, 0, 0x14, 0x1838, 0x64);
}
-void func_80AED8DC(EnRu1* this) {
- s32 temp_hi;
- s16* unk_2AC = &this->unk_2AC;
+void EnRu1_UpdateHeadRotation(EnRu1* this) {
+ s32 headRotOffset;
+ s16* headRotTimer = &this->headRotTimer;
s16* headRotY = &this->interactInfo.headRot.y;
- s16* unk_29E = &this->unk_29E;
+ s16* headTurnSpeed = &this->headTurnSpeed;
s32 pad[2];
- if (DECR(*unk_2AC) == 0) {
- *unk_2AC = Rand_S16Offset(0xA, 0x19);
- temp_hi = *unk_2AC % 5;
- if (temp_hi == 0) {
- this->unk_2B0 = 1;
- } else if (temp_hi == 1) {
- this->unk_2B0 = 2;
+ if (DECR(*headRotTimer) == 0) {
+ *headRotTimer = Rand_S16Offset(0xA, 0x19);
+ headRotOffset = *headRotTimer % 5;
+ if (headRotOffset == 0) {
+ this->headRotDirection = 1;
+ } else if (headRotOffset == 1) {
+ this->headRotDirection = 2;
} else {
- this->unk_2B0 = 0;
+ this->headRotDirection = 0;
}
- *unk_29E = 0;
+ *headTurnSpeed = 0;
}
- if (this->unk_2B0 == 0) {
- Math_SmoothStepToS(unk_29E, 0 - *headRotY, 1, 0x190, 0x190);
- Math_SmoothStepToS(headRotY, 0, 3, ABS(*unk_29E), 0x64);
- } else if (this->unk_2B0 == 1) {
- Math_SmoothStepToS(unk_29E, -0x2AAA - *headRotY, 1, 0x190, 0x190);
- Math_SmoothStepToS(headRotY, -0x2AAA, 3, ABS(*unk_29E), 0x64);
+ if (this->headRotDirection == 0) {
+ Math_SmoothStepToS(headTurnSpeed, 0 - *headRotY, 1, 0x190, 0x190);
+ Math_SmoothStepToS(headRotY, 0, 3, ABS(*headTurnSpeed), 0x64);
+ } else if (this->headRotDirection == 1) {
+ Math_SmoothStepToS(headTurnSpeed, -0x2AAA - *headRotY, 1, 0x190, 0x190);
+ Math_SmoothStepToS(headRotY, -0x2AAA, 3, ABS(*headTurnSpeed), 0x64);
} else {
- Math_SmoothStepToS(unk_29E, 0x2AAA - *headRotY, 1, 0x190, 0x190);
- Math_SmoothStepToS(headRotY, 0x2AAA, 3, ABS(*unk_29E), 0x64);
+ Math_SmoothStepToS(headTurnSpeed, 0x2AAA - *headRotY, 1, 0x190, 0x190);
+ Math_SmoothStepToS(headRotY, 0x2AAA, 3, ABS(*headTurnSpeed), 0x64);
}
}
@@ -1784,7 +1784,7 @@ void func_80AEED58(EnRu1* this, PlayState* play) {
}
void func_80AEEDCC(EnRu1* this, PlayState* play) {
- func_80AED8DC(this);
+ EnRu1_UpdateHeadRotation(this);
EnRu1_UpdateSkelAnime(this);
func_80AEAECC(this, play);
func_80AEE2F8(this, play);
diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h
index 8778174ef..7684a93fe 100644
--- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h
+++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.h
@@ -38,12 +38,12 @@ typedef struct EnRu1 {
/* 0x0294 */ char unk_294[0x4];
/* 0x0298 */ s32 unk_298;
/* 0x029C */ char unk_29C[0x2];
- /* 0x029E */ s16 unk_29E;
+ /* 0x029E */ s16 headTurnSpeed;
/* 0x02A0 */ char unk_2A0[0x4];
/* 0x02A4 */ f32 unk_2A4;
/* 0x02A8 */ s32 alpha;
- /* 0x02AC */ s16 unk_2AC;
- /* 0x02B0 */ s32 unk_2B0;
+ /* 0x02AC */ s16 headRotTimer;
+ /* 0x02B0 */ s32 headRotDirection;
/* 0x02B4 */ ColliderCylinder collider;
/* 0x0300 */ ColliderCylinder collider2;
/* 0x034C */ s32 unk_34C;