1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-16 21:05:12 +00:00

Child Ruto Part 10: Head rotation (#2578)

* Child Ruto Part 10: Head rotation

* Rename head turn speed variable
This commit is contained in:
Jordan Longstaff 2025-06-04 00:39:19 -04:00 committed by GitHub
parent f51e3e8ab2
commit 7085b48483
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 25 additions and 25 deletions

View file

@ -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);

View file

@ -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;