1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-22 06:52:03 +00:00

Cleanup colliders struct members 2 (#2465)

* Cleanup colliders 2

* format

* fixes & review
This commit is contained in:
Dragorn421 2025-02-12 19:37:05 +01:00 committed by GitHub
parent e3831947b0
commit 1d2c912fbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
58 changed files with 497 additions and 487 deletions

View file

@ -179,8 +179,8 @@ void EnDh_Init(Actor* thisx, PlayState* play) {
this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED;
Collider_InitCylinder(play, &this->collider1);
Collider_SetCylinder(play, &this->collider1, &this->actor, &sCylinderInit);
Collider_InitJntSph(play, &this->collider2);
Collider_SetJntSph(play, &this->collider2, &this->actor, &sJntSphInit, this->elements);
Collider_InitJntSph(play, &this->colliderJntSph);
Collider_SetJntSph(play, &this->colliderJntSph, &this->actor, &sJntSphInit, this->colliderJntSphElements);
EnDh_SetupWait(this);
}
@ -190,7 +190,7 @@ void EnDh_Destroy(Actor* thisx, PlayState* play) {
func_800F5B58();
Collider_DestroyCylinder(play, &this->collider1);
Collider_DestroyJntSph(play, &this->collider2);
Collider_DestroyJntSph(play, &this->colliderJntSph);
}
void EnDh_SpawnDebris(PlayState* play, EnDh* this, Vec3f* spawnPos, f32 spread, s32 arg4, f32 accelXZ, f32 scale) {
@ -330,8 +330,10 @@ void EnDh_Attack(EnDh* this, PlayState* play) {
Animation_Change(&this->skelAnime, &object_dh_Anim_004658, -1.0f, this->skelAnime.curFrame, 0.0f, ANIMMODE_ONCE,
-4.0f);
this->actionState = 4;
this->collider2.base.atFlags = this->collider2.elements[0].base.atElemFlags = AT_NONE; // also ATELEM_NONE
this->collider2.elements[0].base.atDmgInfo.dmgFlags = this->collider2.elements[0].base.atDmgInfo.damage = 0;
this->colliderJntSph.base.atFlags = this->colliderJntSph.elements[0].base.atElemFlags =
AT_NONE; // also ATELEM_NONE
this->colliderJntSph.elements[0].base.atDmgInfo.dmgFlags =
this->colliderJntSph.elements[0].base.atDmgInfo.damage = 0;
}
switch (this->actionState) {
case 1:
@ -344,20 +346,20 @@ void EnDh_Attack(EnDh* this, PlayState* play) {
break;
case 2:
if (this->skelAnime.curFrame >= 4.0f) {
this->collider2.base.atFlags = this->collider2.elements[0].base.atElemFlags =
this->colliderJntSph.base.atFlags = this->colliderJntSph.elements[0].base.atElemFlags =
AT_ON | AT_TYPE_ENEMY; // also ATELEM_ON | ATELEM_SFX_WOOD
this->collider2.elements[0].base.atDmgInfo.dmgFlags = DMG_DEFAULT;
this->collider2.elements[0].base.atDmgInfo.damage = 8;
this->colliderJntSph.elements[0].base.atDmgInfo.dmgFlags = DMG_DEFAULT;
this->colliderJntSph.elements[0].base.atDmgInfo.damage = 8;
}
if (this->collider2.base.atFlags & AT_BOUNCED) {
this->collider2.base.atFlags &= ~(AT_HIT | AT_BOUNCED);
this->collider2.base.atFlags = this->collider2.elements[0].base.atElemFlags =
if (this->colliderJntSph.base.atFlags & AT_BOUNCED) {
this->colliderJntSph.base.atFlags &= ~(AT_HIT | AT_BOUNCED);
this->colliderJntSph.base.atFlags = this->colliderJntSph.elements[0].base.atElemFlags =
AT_NONE; // also ATELEM_NONE
this->collider2.elements[0].base.atDmgInfo.dmgFlags =
this->collider2.elements[0].base.atDmgInfo.damage = 0;
this->colliderJntSph.elements[0].base.atDmgInfo.dmgFlags =
this->colliderJntSph.elements[0].base.atDmgInfo.damage = 0;
this->actionState++;
} else if (this->collider2.base.atFlags & AT_HIT) {
this->collider2.base.atFlags &= ~AT_HIT;
} else if (this->colliderJntSph.base.atFlags & AT_HIT) {
this->colliderJntSph.base.atFlags &= ~AT_HIT;
Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, this->actor.shape.rot.y, 8.0f);
}
break;
@ -372,10 +374,10 @@ void EnDh_Attack(EnDh* this, PlayState* play) {
Animation_Change(&this->skelAnime, &object_dh_Anim_004658, -1.0f,
Animation_GetLastFrame(&object_dh_Anim_004658), 0.0f, ANIMMODE_ONCE, -4.0f);
this->actionState++;
this->collider2.base.atFlags = this->collider2.elements[0].base.atElemFlags =
this->colliderJntSph.base.atFlags = this->colliderJntSph.elements[0].base.atElemFlags =
AT_NONE; // also ATELEM_NONE
this->collider2.elements[0].base.atDmgInfo.dmgFlags =
this->collider2.elements[0].base.atDmgInfo.damage = 0;
this->colliderJntSph.elements[0].base.atDmgInfo.dmgFlags =
this->colliderJntSph.elements[0].base.atDmgInfo.damage = 0;
}
break;
case 5:
@ -504,11 +506,13 @@ void EnDh_CollisionCheck(EnDh* this, PlayState* play) {
Player* player = GET_PLAYER(play);
s32 lastHealth;
if ((this->collider2.base.acFlags & AC_HIT) && !this->retreat) {
this->collider2.base.acFlags &= ~AC_HIT;
if ((this->colliderJntSph.base.acFlags & AC_HIT) && !this->retreat) {
this->colliderJntSph.base.acFlags &= ~AC_HIT;
if ((this->actor.colChkInfo.damageEffect != 0) && (this->actor.colChkInfo.damageEffect != 6)) {
this->collider2.base.atFlags = this->collider2.elements[0].base.atElemFlags = AT_NONE; // also ATELEM_NONE
this->collider2.elements[0].base.atDmgInfo.dmgFlags = this->collider2.elements[0].base.atDmgInfo.damage = 0;
this->colliderJntSph.base.atFlags = this->colliderJntSph.elements[0].base.atElemFlags =
AT_NONE; // also ATELEM_NONE
this->colliderJntSph.elements[0].base.atDmgInfo.dmgFlags =
this->colliderJntSph.elements[0].base.atDmgInfo.damage = 0;
if (player->unk_844 != 0) {
this->unk_258 = player->unk_845;
}
@ -553,13 +557,13 @@ void EnDh_Update(Actor* thisx, PlayState* play) {
if (((this->curAction != DH_DAMAGE) && (this->actor.shape.yOffset == 0.0f)) ||
((player->unk_844 != 0) && (player->unk_845 != this->unk_258))) {
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base);
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider2.base);
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderJntSph.base);
CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base);
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base);
}
} else {
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider2.base);
CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderJntSph.base);
}
}
@ -571,7 +575,7 @@ void EnDh_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* rot,
Matrix_MultVec3f(&headOffset, &this->headPos);
Matrix_Push();
Matrix_Translate(headOffset.x, headOffset.y, headOffset.z, MTXMODE_APPLY);
Collider_UpdateSpheres(1, &this->collider2);
Collider_UpdateSpheres(1, &this->colliderJntSph);
Matrix_Pop();
}
}

View file

@ -24,8 +24,8 @@ typedef struct EnDh {
/* 0x025C */ s16 timer;
/* 0x025E */ s16 dirtWavePhase;
/* 0x0260 */ ColliderCylinder collider1;
/* 0x02AC */ ColliderJntSph collider2;
/* 0x02CC */ ColliderJntSphElement elements[1];
/* 0x02AC */ ColliderJntSph colliderJntSph;
/* 0x02CC */ ColliderJntSphElement colliderJntSphElements[1];
/* 0x030C */ Vec3f headPos;
/* 0x0318 */ f32 dirtWaveSpread;
/* 0x031C */ f32 dirtWaveHeight;