1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-05-11 11:33:48 +00:00

cleanup around ColliderJntSphElement usage

This commit is contained in:
Dragorn421 2025-02-15 10:47:57 +01:00
parent 6f8b4d82d5
commit 974036756a
No known key found for this signature in database
GPG key ID: 381AEBAF3D429335
3 changed files with 15 additions and 14 deletions

View file

@ -159,7 +159,7 @@ void BgHidanRsekizou_Destroy(Actor* thisx, PlayState* play) {
void BgHidanRsekizou_Update(Actor* thisx, PlayState* play) {
BgHidanRsekizou* this = (BgHidanRsekizou*)thisx;
s32 i;
ColliderJntSphElement* sphere;
ColliderJntSphElement* element;
s32 pad;
f32 yawSine;
f32 yawCosine;
@ -179,12 +179,14 @@ void BgHidanRsekizou_Update(Actor* thisx, PlayState* play) {
yawCosine = Math_CosS(this->dyna.actor.shape.rot.y);
for (i = 0; i < ARRAY_COUNT(this->colliderElements); i++) {
sphere = &this->collider.elements[i];
sphere->dim.worldSphere.center.x = this->dyna.actor.home.pos.x + yawCosine * sphere->dim.modelSphere.center.x +
yawSine * sphere->dim.modelSphere.center.z;
sphere->dim.worldSphere.center.y = (s16)this->dyna.actor.home.pos.y + sphere->dim.modelSphere.center.y;
sphere->dim.worldSphere.center.z = (this->dyna.actor.home.pos.z - yawSine * sphere->dim.modelSphere.center.x) +
yawCosine * sphere->dim.modelSphere.center.z;
element = &this->collider.elements[i];
element->dim.worldSphere.center.x = this->dyna.actor.home.pos.x +
(yawCosine * element->dim.modelSphere.center.x) +
(yawSine * element->dim.modelSphere.center.z);
element->dim.worldSphere.center.y = (s16)this->dyna.actor.home.pos.y + element->dim.modelSphere.center.y;
element->dim.worldSphere.center.z = this->dyna.actor.home.pos.z -
(yawSine * element->dim.modelSphere.center.x) +
(yawCosine * element->dim.modelSphere.center.z);
}
CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base);

View file

@ -70,7 +70,7 @@ static InitChainEntry sInitChain[] = {
void BgMenkuriEye_Init(Actor* thisx, PlayState* play) {
BgMenkuriEye* this = (BgMenkuriEye*)thisx;
ColliderJntSphElement* colliderList;
s32 pad;
Actor_ProcessInitChain(&this->actor, sInitChain);
Collider_InitJntSph(play, &this->collider);
@ -78,8 +78,7 @@ void BgMenkuriEye_Init(Actor* thisx, PlayState* play) {
this->collider.elements[0].dim.worldSphere.center.x = this->actor.world.pos.x;
this->collider.elements[0].dim.worldSphere.center.y = this->actor.world.pos.y;
this->collider.elements[0].dim.worldSphere.center.z = this->actor.world.pos.z;
colliderList = this->collider.elements;
colliderList->dim.worldSphere.radius = colliderList->dim.modelSphere.radius;
this->collider.elements[0].dim.worldSphere.radius = this->collider.elements[0].dim.modelSphere.radius;
if (!Flags_GetSwitch(play, this->actor.params)) {
sNumEyesShot = 0;
}

View file

@ -1304,12 +1304,12 @@ void BossFd_Effects(BossFd* this, PlayState* play) {
}
void BossFd_CollisionCheck(BossFd* this, PlayState* play) {
ColliderJntSphElement* headCollider = &this->collider.elements[0];
ColliderJntSphElement* headColliderElem = &this->collider.elements[0];
ColliderElement* acHitElem;
if (headCollider->base.acElemFlags & ACELEM_HIT) {
headCollider->base.acElemFlags &= ~ACELEM_HIT;
acHitElem = headCollider->base.acHitElem;
if (headColliderElem->base.acElemFlags & ACELEM_HIT) {
headColliderElem->base.acElemFlags &= ~ACELEM_HIT;
acHitElem = headColliderElem->base.acHitElem;
this->actor.colChkInfo.health -= 2;
if (acHitElem->atDmgInfo.dmgFlags & DMG_ARROW_ICE) {
this->actor.colChkInfo.health -= 2;