Child Ruto Part 5: Colliders (#2572)

* Child Ruto Part 5: Colliders

* Suggested refactoring

* Missed function rename
This commit is contained in:
Jordan Longstaff 2025-06-05 19:51:35 -04:00 committed by GitHub
parent d1ac2561b5
commit 6e804b165e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 33 additions and 33 deletions

View File

@ -97,7 +97,7 @@ typedef enum EnRu1WaterState {
/* 3 */ ENRU1_WATER_SINKING,
} EnRu1WaterState;
static ColliderCylinderInitType1 sCylinderInit1 = {
static ColliderCylinderInitType1 sStandingCylinderInit = {
{
COL_MATERIAL_HIT0,
AT_NONE,
@ -109,7 +109,7 @@ static ColliderCylinderInitType1 sCylinderInit1 = {
{ 25, 80, 0, { 0 } },
};
static ColliderCylinderInitType1 sCylinderInit2 = {
static ColliderCylinderInitType1 sSittingCylinderInit = {
{
COL_MATERIAL_HIT0,
AT_ON | AT_TYPE_PLAYER,
@ -172,48 +172,48 @@ ActorProfile En_Ru1_Profile = {
/**/ EnRu1_Draw,
};
void func_80AEAC10(EnRu1* this, PlayState* play) {
void EnRu1_UpdateStandingOC(EnRu1* this, PlayState* play) {
s32 pad[5];
Collider_UpdateCylinder(&this->actor, &this->collider);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
Collider_UpdateCylinder(&this->actor, &this->standingCollider);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->standingCollider.base);
}
void func_80AEAC54(EnRu1* this, PlayState* play) {
void EnRu1_UpdateSittingOC(EnRu1* this, PlayState* play) {
s32 pad[5];
Collider_UpdateCylinder(&this->actor, &this->collider2);
if (this->unk_34C != 0) {
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base);
Collider_UpdateCylinder(&this->actor, &this->sittingCollider);
if (this->isSittingOCActive) {
CollisionCheck_SetOC(play, &play->colChkCtx, &this->sittingCollider.base);
} else if (this->actor.xzDistToPlayer > 32.0f) {
this->unk_34C = 1;
this->isSittingOCActive = true;
}
}
void func_80AEACDC(EnRu1* this, PlayState* play) {
void EnRu1_UpdateSittingAT(EnRu1* this, PlayState* play) {
s32 pad[5];
Collider_UpdateCylinder(&this->actor, &this->collider2);
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base);
Collider_UpdateCylinder(&this->actor, &this->sittingCollider);
CollisionCheck_SetAT(play, &play->colChkCtx, &this->sittingCollider.base);
}
void func_80AEAD20(Actor* thisx, PlayState* play) {
void EnRu1_InitColliders(Actor* thisx, PlayState* play) {
EnRu1* this = (EnRu1*)thisx;
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinderType1(play, &this->collider, &this->actor, &sCylinderInit1);
Collider_InitCylinder(play, &this->standingCollider);
Collider_SetCylinderType1(play, &this->standingCollider, &this->actor, &sStandingCylinderInit);
Collider_InitCylinder(play, &this->collider2);
Collider_SetCylinderType1(play, &this->collider2, &this->actor, &sCylinderInit2);
Collider_InitCylinder(play, &this->sittingCollider);
Collider_SetCylinderType1(play, &this->sittingCollider, &this->actor, &sSittingCylinderInit);
}
void EnRu1_DestroyColliders(EnRu1* this, PlayState* play) {
Collider_DestroyCylinder(play, &this->collider);
Collider_DestroyCylinder(play, &this->collider2);
Collider_DestroyCylinder(play, &this->standingCollider);
Collider_DestroyCylinder(play, &this->sittingCollider);
}
void func_80AEADD8(EnRu1* this) {
this->unk_34C = 0;
void EnRu1_DisableSittingOC(EnRu1* this) {
this->isSittingOCActive = false;
}
u8 EnRu1_GetSwitchFlag(EnRu1* this) {
@ -1619,7 +1619,7 @@ void func_80AEE568(EnRu1* this, PlayState* play) {
func_80AEE02C(this);
Actor_OfferCarry(&this->actor, play);
this->action = 27;
func_80AEADD8(this);
EnRu1_DisableSittingOC(this);
return;
}
@ -1727,7 +1727,7 @@ s32 EnRu1_CheckHitBottomUnderwater(EnRu1* this, PlayState* play) {
func_80AEE02C(this);
Actor_OfferCarry(&this->actor, play);
this->action = 27;
func_80AEADD8(this);
EnRu1_DisableSittingOC(this);
return true;
}
return false;
@ -1748,7 +1748,7 @@ void func_80AEEBB4(EnRu1* this, PlayState* play) {
void func_80AEEBD4(EnRu1* this, PlayState* play) {
func_80AED83C(this);
func_80AEAC54(this, play);
EnRu1_UpdateSittingOC(this, play);
func_80AEAECC(this, play);
EnRu1_UpdateSkelAnime(this);
EnRu1_UpdateEyes(this);
@ -1760,7 +1760,7 @@ void func_80AEEBD4(EnRu1* this, PlayState* play) {
void func_80AEEC5C(EnRu1* this, PlayState* play) {
func_80AED83C(this);
func_80AEACDC(this, play);
EnRu1_UpdateSittingAT(this, play);
func_80AEAECC(this, play);
func_80AEE2F8(this, play);
func_80AEDFF4(this, play);
@ -1896,7 +1896,7 @@ void func_80AEF1F0(EnRu1* this, PlayState* play, UNK_TYPE arg2) {
func_80AED6DC(this, play);
Actor_OfferCarry(&this->actor, play);
this->action = 27;
func_80AEADD8(this);
EnRu1_DisableSittingOC(this);
}
}
@ -1916,7 +1916,7 @@ void func_80AEF2D0(EnRu1* this, PlayState* play) {
func_80AEEF68(this, play);
EnRu1_UpdateSkelAnime(this);
EnRu1_UpdateEyes(this);
func_80AEAC10(this, play);
EnRu1_UpdateStandingOC(this, play);
func_80AEAECC(this, play);
cond = func_80AEE264(this, play);
func_80AED624(this, play);
@ -2229,7 +2229,7 @@ void func_80AEFECC(EnRu1* this, PlayState* play) {
func_80AEEF68(this, play);
EnRu1_UpdateSkelAnime(this);
EnRu1_UpdateEyes(this);
func_80AEAC10(this, play);
EnRu1_UpdateStandingOC(this, play);
func_80AEAECC(this, play);
func_80AEFE84(this, play, func_80AEFDC0(this, play));
}
@ -2293,7 +2293,7 @@ void EnRu1_Init(Actor* thisx, PlayState* play) {
ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f);
SkelAnime_InitFlex(play, &this->skelAnime, &gRutoChildSkel, NULL, this->jointTable, this->morphTable, 17);
func_80AEAD20(&this->actor, play);
EnRu1_InitColliders(&this->actor, play);
switch (EnRu1_GetType(this)) {
case ENRU1_TYPE_BOSS_ROOM:
EnRu1_InitInBossRoom(this, play);

View File

@ -47,9 +47,9 @@ typedef struct EnRu1 {
/* 0x02A8 */ s32 alpha;
/* 0x02AC */ s16 headRotTimer;
/* 0x02B0 */ s32 headRotDirection;
/* 0x02B4 */ ColliderCylinder collider;
/* 0x0300 */ ColliderCylinder collider2;
/* 0x034C */ s32 unk_34C;
/* 0x02B4 */ ColliderCylinder standingCollider;
/* 0x0300 */ ColliderCylinder sittingCollider;
/* 0x034C */ s32 isSittingOCActive;
/* 0x0350 */ s32 waterState;
/* 0x0354 */ f32 sinkingStartPosY;
/* 0x0358 */ f32 bobDepth;