mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-22 23:11:20 +00:00
Cleanup colliders 3 (#2467)
* standardize s[Name][Collider]JntSphElementsInit[Name] * standardize ColliderCylinder struct members names on `[name]collider[s][Cylinder]` * format * fix * fix2 * fix3 * collidersCylinder -> colliderCylinders
This commit is contained in:
parent
c859678d5f
commit
6f8b4d82d5
49 changed files with 468 additions and 464 deletions
|
@ -295,20 +295,20 @@ void EnSt_InitColliders(EnSt* this, PlayState* play) {
|
|||
s32 pad;
|
||||
|
||||
for (i = 0; i < ARRAY_COUNT(cylinders); i++) {
|
||||
Collider_InitCylinder(play, &this->colliderCylinder[i]);
|
||||
Collider_SetCylinder(play, &this->colliderCylinder[i], &this->actor, cylinders[i]);
|
||||
Collider_InitCylinder(play, &this->colliderCylinders[i]);
|
||||
Collider_SetCylinder(play, &this->colliderCylinders[i], &this->actor, cylinders[i]);
|
||||
}
|
||||
|
||||
this->colliderCylinder[0].elem.acDmgInfo.dmgFlags =
|
||||
this->colliderCylinders[0].elem.acDmgInfo.dmgFlags =
|
||||
DMG_MAGIC_FIRE | DMG_ARROW | DMG_HOOKSHOT | DMG_HAMMER_SWING | DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT;
|
||||
this->colliderCylinder[1].elem.acDmgInfo.dmgFlags =
|
||||
this->colliderCylinders[1].elem.acDmgInfo.dmgFlags =
|
||||
DMG_DEFAULT &
|
||||
~(DMG_MAGIC_FIRE | DMG_ARROW | DMG_HOOKSHOT | DMG_HAMMER_SWING | DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT) &
|
||||
~(DMG_MAGIC_LIGHT | DMG_MAGIC_ICE);
|
||||
this->colliderCylinder[2].base.colMaterial = COL_MATERIAL_METAL;
|
||||
this->colliderCylinder[2].elem.acElemFlags = ACELEM_ON | ACELEM_HOOKABLE | ACELEM_NO_AT_INFO;
|
||||
this->colliderCylinder[2].elem.elemMaterial = ELEM_MATERIAL_UNK2;
|
||||
this->colliderCylinder[2].elem.acDmgInfo.dmgFlags =
|
||||
this->colliderCylinders[2].base.colMaterial = COL_MATERIAL_METAL;
|
||||
this->colliderCylinders[2].elem.acElemFlags = ACELEM_ON | ACELEM_HOOKABLE | ACELEM_NO_AT_INFO;
|
||||
this->colliderCylinders[2].elem.elemMaterial = ELEM_MATERIAL_UNK2;
|
||||
this->colliderCylinders[2].elem.acDmgInfo.dmgFlags =
|
||||
DMG_DEFAULT &
|
||||
~(DMG_MAGIC_FIRE | DMG_ARROW | DMG_HOOKSHOT | DMG_HAMMER_SWING | DMG_BOOMERANG | DMG_EXPLOSIVE | DMG_DEKU_NUT);
|
||||
|
||||
|
@ -319,34 +319,34 @@ void EnSt_InitColliders(EnSt* this, PlayState* play) {
|
|||
}
|
||||
|
||||
void EnSt_CheckBodyStickHit(EnSt* this, PlayState* play) {
|
||||
ColliderElement* bodyElem = &this->colliderCylinder[0].elem;
|
||||
ColliderElement* bodyElem = &this->colliderCylinders[0].elem;
|
||||
Player* player = GET_PLAYER(play);
|
||||
|
||||
if (player->unk_860 != 0) {
|
||||
bodyElem->acDmgInfo.dmgFlags |= DMG_DEKU_STICK;
|
||||
this->colliderCylinder[1].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK;
|
||||
this->colliderCylinder[2].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK;
|
||||
this->colliderCylinders[1].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK;
|
||||
this->colliderCylinders[2].elem.acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK;
|
||||
} else {
|
||||
bodyElem->acDmgInfo.dmgFlags &= ~DMG_DEKU_STICK;
|
||||
this->colliderCylinder[1].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK;
|
||||
this->colliderCylinder[2].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK;
|
||||
this->colliderCylinders[1].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK;
|
||||
this->colliderCylinders[2].elem.acDmgInfo.dmgFlags |= DMG_DEKU_STICK;
|
||||
}
|
||||
}
|
||||
|
||||
void EnSt_SetBodyCylinderAC(EnSt* this, PlayState* play) {
|
||||
Collider_UpdateCylinder(&this->actor, &this->colliderCylinder[0]);
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder[0].base);
|
||||
Collider_UpdateCylinder(&this->actor, &this->colliderCylinders[0]);
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinders[0].base);
|
||||
}
|
||||
|
||||
void EnSt_SetLegsCylinderAC(EnSt* this, PlayState* play) {
|
||||
s16 angleTowardsLink = ABS((s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y));
|
||||
|
||||
if (angleTowardsLink < 0x3FFC) {
|
||||
Collider_UpdateCylinder(&this->actor, &this->colliderCylinder[2]);
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder[2].base);
|
||||
Collider_UpdateCylinder(&this->actor, &this->colliderCylinders[2]);
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinders[2].base);
|
||||
} else {
|
||||
Collider_UpdateCylinder(&this->actor, &this->colliderCylinder[1]);
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinder[1].base);
|
||||
Collider_UpdateCylinder(&this->actor, &this->colliderCylinders[1]);
|
||||
CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCylinders[1].base);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -369,10 +369,10 @@ s32 EnSt_SetCylinderOC(EnSt* this, PlayState* play) {
|
|||
Matrix_RotateY(BINANG_TO_RAD_ALT(this->initialYaw), MTXMODE_APPLY);
|
||||
Matrix_MultVec3f(&cyloffsets[i], &cylPos);
|
||||
Matrix_Pop();
|
||||
this->colliderCylinder[i + 3].dim.pos.x = cylPos.x;
|
||||
this->colliderCylinder[i + 3].dim.pos.y = cylPos.y;
|
||||
this->colliderCylinder[i + 3].dim.pos.z = cylPos.z;
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinder[i + 3].base);
|
||||
this->colliderCylinders[i + 3].dim.pos.x = cylPos.x;
|
||||
this->colliderCylinders[i + 3].dim.pos.y = cylPos.y;
|
||||
this->colliderCylinders[i + 3].dim.pos.z = cylPos.z;
|
||||
CollisionCheck_SetOC(play, &play->colChkCtx, &this->colliderCylinders[i + 3].base);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -400,10 +400,10 @@ s32 EnSt_CheckHitPlayer(EnSt* this, PlayState* play) {
|
|||
s32 i;
|
||||
|
||||
for (i = 0, hit = 0; i < 3; i++) {
|
||||
if (((this->colliderCylinder[i + 3].base.ocFlags2 & OC2_HIT_PLAYER) != 0) == 0) {
|
||||
if (((this->colliderCylinders[i + 3].base.ocFlags2 & OC2_HIT_PLAYER) != 0) == 0) {
|
||||
continue;
|
||||
}
|
||||
this->colliderCylinder[i + 3].base.ocFlags2 &= ~OC2_HIT_PLAYER;
|
||||
this->colliderCylinders[i + 3].base.ocFlags2 &= ~OC2_HIT_PLAYER;
|
||||
hit = true;
|
||||
}
|
||||
|
||||
|
@ -423,13 +423,13 @@ s32 EnSt_CheckHitPlayer(EnSt* this, PlayState* play) {
|
|||
}
|
||||
|
||||
s32 EnSt_CheckHitFrontside(EnSt* this) {
|
||||
u8 acFlags = this->colliderCylinder[2].base.acFlags;
|
||||
u8 acFlags = this->colliderCylinders[2].base.acFlags;
|
||||
|
||||
if (!!(acFlags & AC_HIT) == 0) {
|
||||
// not hit
|
||||
return false;
|
||||
} else {
|
||||
this->colliderCylinder[2].base.acFlags &= ~AC_HIT;
|
||||
this->colliderCylinders[2].base.acFlags &= ~AC_HIT;
|
||||
this->invulnerableTimer = 8;
|
||||
this->playSwayFlag = 0;
|
||||
this->swayTimer = 60;
|
||||
|
@ -438,7 +438,7 @@ s32 EnSt_CheckHitFrontside(EnSt* this) {
|
|||
}
|
||||
|
||||
s32 EnSt_CheckHitBackside(EnSt* this, PlayState* play) {
|
||||
ColliderCylinder* cyl = &this->colliderCylinder[0];
|
||||
ColliderCylinder* cyl = &this->colliderCylinders[0];
|
||||
s32 flags = 0; // damage flags from colliders 0 and 1
|
||||
s32 hit = false;
|
||||
|
||||
|
@ -448,7 +448,7 @@ s32 EnSt_CheckHitBackside(EnSt* this, PlayState* play) {
|
|||
flags |= cyl->elem.acHitElem->atDmgInfo.dmgFlags;
|
||||
}
|
||||
|
||||
cyl = &this->colliderCylinder[1];
|
||||
cyl = &this->colliderCylinders[1];
|
||||
if (cyl->base.acFlags & AC_HIT) {
|
||||
cyl->base.acFlags &= ~AC_HIT;
|
||||
hit = true;
|
||||
|
@ -538,16 +538,16 @@ void EnSt_SetColliderScale(EnSt* this) {
|
|||
this->colliderJntSph.elements[0].dim.modelSphere.radius = radius;
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
yShift = this->colliderCylinder[i].dim.yShift;
|
||||
radius = this->colliderCylinder[i].dim.radius;
|
||||
height = this->colliderCylinder[i].dim.height;
|
||||
yShift = this->colliderCylinders[i].dim.yShift;
|
||||
radius = this->colliderCylinders[i].dim.radius;
|
||||
height = this->colliderCylinders[i].dim.height;
|
||||
yShift *= scaleAmount;
|
||||
radius *= scaleAmount;
|
||||
height *= scaleAmount;
|
||||
|
||||
this->colliderCylinder[i].dim.yShift = yShift;
|
||||
this->colliderCylinder[i].dim.radius = radius;
|
||||
this->colliderCylinder[i].dim.height = height;
|
||||
this->colliderCylinders[i].dim.yShift = yShift;
|
||||
this->colliderCylinders[i].dim.radius = radius;
|
||||
this->colliderCylinders[i].dim.height = height;
|
||||
}
|
||||
Actor_SetScale(&this->actor, 0.04f * scaleAmount);
|
||||
this->colliderScale = scaleAmount;
|
||||
|
@ -828,7 +828,7 @@ void EnSt_Destroy(Actor* thisx, PlayState* play) {
|
|||
|
||||
Effect_Delete(play, this->blureIdx);
|
||||
for (i = 0; i < 6; i++) {
|
||||
Collider_DestroyCylinder(play, &this->colliderCylinder[i]);
|
||||
Collider_DestroyCylinder(play, &this->colliderCylinders[i]);
|
||||
}
|
||||
Collider_DestroyJntSph(play, &this->colliderJntSph);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ typedef struct EnSt {
|
|||
/* 0x0000 */ Actor actor;
|
||||
/* 0x014C */ SkelAnime skelAnime;
|
||||
/* 0x0190 */ EnStActionFunc actionFunc;
|
||||
/* 0x0194 */ ColliderCylinder colliderCylinder[6];
|
||||
/* 0x0194 */ ColliderCylinder colliderCylinders[6];
|
||||
/* 0x035C */ ColliderJntSph colliderJntSph;
|
||||
/* 0x037C */ ColliderJntSphElement colliderJntSphElements[1];
|
||||
/* 0x03BC */ s16 initialYaw;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue