Rename more water-related variables

This commit is contained in:
JordanLongstaff 2025-06-02 09:26:18 -04:00
parent ed153def7c
commit f35352c160
2 changed files with 22 additions and 20 deletions

View File

@ -1479,18 +1479,20 @@ void func_80AEE02C(EnRu1* this) {
void EnRu1_UpdateWaterState(EnRu1* this) {
s32 pad;
f32 sp28;
f32 sp24;
f32 bobMagnitude;
f32 startY;
EnRu1* thisx = this; // necessary to match
if (this->waterState == ENRU1_WATER_OUTSIDE) {
if ((this->actor.minVelocityY == 0.0f) && (this->actor.speed == 0.0f)) {
// When Ruto's velocity has been slowed enough by the water, stop her motion
this->waterState = ENRU1_WATER_IMMERSED;
func_80AEE02C(this);
this->unk_35C = 0;
this->unk_358 = (this->actor.depthInWater - 10.0f) * 0.5f;
this->unk_354 = this->actor.world.pos.y + thisx->unk_358; // thisx only used here
this->bobPhase = 0;
this->bobDepth = (this->actor.depthInWater - 10.0f) * 0.5f;
this->sinkingStartPosY = this->actor.world.pos.y + thisx->bobDepth; // thisx only used here
} else {
// Ruto is touching the water but still traveling along some path, e.g. from being thrown
this->actor.gravity = 0.0f;
this->actor.minVelocityY *= 0.2f;
this->actor.velocity.y *= 0.2f;
@ -1508,23 +1510,23 @@ void EnRu1_UpdateWaterState(EnRu1* this) {
}
} else {
if (this->waterState == ENRU1_WATER_IMMERSED) {
if (this->unk_358 <= 1.0f) {
if (this->bobDepth <= 1.0f) {
func_80AEE02C(this);
this->waterState = ENRU1_WATER_BOBBING;
this->unk_360 = 0.0f;
this->isSinking = 0.0f;
} else {
f32 temp_f10;
f32 deltaY;
sp28 = this->unk_358;
sp24 = this->unk_354;
temp_f10 = Math_CosS(this->unk_35C) * -sp28;
this->actor.world.pos.y = temp_f10 + sp24;
this->unk_35C += 0x3E8;
this->unk_358 *= 0.95f;
bobMagnitude = this->bobDepth;
startY = this->sinkingStartPosY;
deltaY = Math_CosS(this->bobPhase) * -bobMagnitude;
this->actor.world.pos.y = deltaY + startY;
this->bobPhase += 0x3E8;
this->bobDepth *= 0.95f;
}
} else {
this->unk_360 += 1.0f;
if (this->unk_360 > 0.0f) {
this->isSinking += 1.0f;
if (this->isSinking > 0.0f) {
this->waterState = ENRU1_WATER_SINKING;
}
}

View File

@ -48,10 +48,10 @@ typedef struct EnRu1 {
/* 0x0300 */ ColliderCylinder collider2;
/* 0x034C */ s32 unk_34C;
/* 0x0350 */ s32 waterState;
/* 0x0354 */ f32 unk_354;
/* 0x0358 */ f32 unk_358;
/* 0x035C */ s16 unk_35C;
/* 0x0360 */ f32 unk_360;
/* 0x0354 */ f32 sinkingStartPosY;
/* 0x0358 */ f32 bobDepth;
/* 0x035C */ s16 bobPhase;
/* 0x0360 */ f32 isSinking;
/* 0x0364 */ Vec3f unk_364;
/* 0x0370 */ f32 unk_370;
/* 0x0374 */ NpcInteractInfo interactInfo;