1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-05-10 19:13:42 +00:00

Fix misc 13 (#1244)

* Squared variables fixup

* `sAnimSoundFrames` fixup

* `ocElemFlags` fixup

* `toucherFlags` fixup

* `bumperFlags` fixup

* `atFlags` fixup

* `acFlags` fixup

* `ocFlags1` fixup

* `ocFlags2` fixup

* `&=`

* `TOUCH_SFX_NONE` -> `_MASK` in `CollisionCheck_HitSolid`
This commit is contained in:
Dragorn421 2022-05-31 11:48:41 -07:00 committed by GitHub
parent d6a7d43735
commit fa1ea37d54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 126 additions and 124 deletions

View file

@ -1715,7 +1715,7 @@ s32 Math3D_TriChkLineSegParaZDist(Vec3f* v0, Vec3f* v1, Vec3f* v2, Plane* plane,
s32 Math3D_LineSegVsPlane(f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* linePointA, Vec3f* linePointB,
Vec3f* intersect, s32 fromFront);
void Math3D_TriNorm(TriNorm* tri, Vec3f* va, Vec3f* vb, Vec3f* vc);
s32 Math3D_PointDistToLine2D(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2, f32 y2, f32* lineLenSq);
s32 Math3D_PointDistSqToLine2D(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2, f32 y2, f32* lineLenSq);
s32 Math3D_LineVsSph(Sphere16* sphere, Linef* line);
s32 Math3D_TriVsSphIntersect(Sphere16* sphere, TriNorm* tri, Vec3f* intersectPoint);
s32 Math3D_CylVsLineSeg(Cylinder16* cyl, Vec3f* linePointA, Vec3f* linePointB, Vec3f* intersectA, Vec3f* intersectB);

View file

@ -25,7 +25,7 @@ typedef struct {
typedef struct {
/* 0x00 */ u8 colType; // Determines hitmarks and sound effects during AC collisions.
/* 0x01 */ u8 atFlags; // Information flags for AT collisions.
/* 0x02 */ u8 acFlags; // Information flags for OC collisions.
/* 0x02 */ u8 acFlags; // Information flags for AC collisions.
/* 0x03 */ u8 ocFlags1; // Information flags for OC collisions.
/* 0x04 */ u8 ocFlags2; // Flags related to which colliders it can OC collide with.
/* 0x05 */ u8 shape; // JntSph, Cylinder, Tris, or Quad
@ -317,6 +317,7 @@ typedef enum {
#define TOUCH_ON (1 << 0) // Can have AT collisions
#define TOUCH_HIT (1 << 1) // Had an AT collision
#define TOUCH_NEAREST (1 << 2) // If a Quad, only collides with the closest bumper
#define TOUCH_SFX_MASK (3 << 3)
#define TOUCH_SFX_NORMAL (0 << 3) // Hit sound effect based on AC collider's type
#define TOUCH_SFX_HARD (1 << 3) // Always uses hard deflection sound
#define TOUCH_SFX_WOOD (2 << 3) // Always uses wood deflection sound

View file

@ -987,15 +987,15 @@ s32 Math3D_TriChkPointParaYImpl(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 z, f32 x, f
if (fabsf(ny) > 0.5f) {
// Do a check on each face of the triangle, if the point is within `chkDist` units return true.
if (Math3D_PointDistToLine2D(z, x, v0->z, v0->x, v1->z, v1->x, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
if (Math3D_PointDistSqToLine2D(z, x, v0->z, v0->x, v1->z, v1->x, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
return true;
}
if (Math3D_PointDistToLine2D(z, x, v1->z, v1->x, v2->z, v2->x, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
if (Math3D_PointDistSqToLine2D(z, x, v1->z, v1->x, v2->z, v2->x, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
return true;
}
if (Math3D_PointDistToLine2D(z, x, v2->z, v2->x, v0->z, v0->x, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
if (Math3D_PointDistSqToLine2D(z, x, v2->z, v2->x, v0->z, v0->x, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
return true;
}
}
@ -1121,15 +1121,15 @@ s32 Math3D_TriChkPointParaXImpl(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 y, f32 z, f
if (fabsf(nx) > 0.5f) {
if (Math3D_PointDistToLine2D(y, z, v0->y, v0->z, v1->y, v1->z, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
if (Math3D_PointDistSqToLine2D(y, z, v0->y, v0->z, v1->y, v1->z, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
return true;
}
if (Math3D_PointDistToLine2D(y, z, v1->y, v1->z, v2->y, v2->z, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
if (Math3D_PointDistSqToLine2D(y, z, v1->y, v1->z, v2->y, v2->z, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
return true;
}
if (Math3D_PointDistToLine2D(y, z, v2->y, v2->z, v0->y, v0->z, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
if (Math3D_PointDistSqToLine2D(y, z, v2->y, v2->z, v0->y, v0->z, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
return true;
}
}
@ -1233,15 +1233,15 @@ s32 Math3D_TriChkPointParaZImpl(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 x, f32 y, f
if (fabsf(nz) > 0.5f) {
if (Math3D_PointDistToLine2D(x, y, v0->x, v0->y, v1->x, v1->y, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
if (Math3D_PointDistSqToLine2D(x, y, v0->x, v0->y, v1->x, v1->y, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
return true;
}
if (Math3D_PointDistToLine2D(x, y, v1->x, v1->y, v2->x, v2->y, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
if (Math3D_PointDistSqToLine2D(x, y, v1->x, v1->y, v2->x, v2->y, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
return true;
}
if (Math3D_PointDistToLine2D(x, y, v2->x, v2->y, v0->x, v0->y, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
if (Math3D_PointDistSqToLine2D(x, y, v2->x, v2->y, v0->x, v0->y, &distToEdgeSq) && (distToEdgeSq < chkDistSq)) {
return true;
}
}
@ -1415,7 +1415,7 @@ s32 Math3D_PointInSph(Sphere16* sphere, Vec3f* point) {
* Distance squared is output to `lineLenSq`, returns true if the point perpendicular from (`x0`,`y0`)
* is contained within the segment between (`x1`,`y1`) and (`x2`,`y2`)
*/
s32 Math3D_PointDistToLine2D(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2, f32 y2, f32* lineLenSq) {
s32 Math3D_PointDistSqToLine2D(f32 x0, f32 y0, f32 x1, f32 y1, f32 x2, f32 y2, f32* lineLenSq) {
static Vec3f perpendicularPoint;
f32 perpendicularRatio;

View file

@ -1559,7 +1559,7 @@ void CollisionCheck_RedBloodUnused(PlayState* play, Collider* collider, Vec3f* v
* Plays sound effects and displays hitmarks for solid-type AC colliders (METAL, WOOD, HARD, and TREE)
*/
void CollisionCheck_HitSolid(PlayState* play, ColliderInfo* info, Collider* collider, Vec3f* hitPos) {
s32 flags = info->toucherFlags & TOUCH_SFX_NONE;
s32 flags = info->toucherFlags & TOUCH_SFX_MASK;
if (flags == TOUCH_SFX_NORMAL && collider->colType != COLTYPE_METAL) {
EffectSsHitMark_SpawnFixedScale(play, EFFECT_HITMARK_WHITE, hitPos);

View file

@ -411,14 +411,14 @@ void func_8086DB68(BgBdanSwitch* this, PlayState* play) {
default:
return;
case YELLOW_TALL_1:
if (((this->collider.base.acFlags & AC_HIT) != 0) && this->unk_1D8 <= 0) {
if ((this->collider.base.acFlags & AC_HIT) && this->unk_1D8 <= 0) {
this->unk_1D8 = 0xA;
func_8086DC30(this);
func_8086D4B4(this, play);
}
break;
case YELLOW_TALL_2:
if (((this->collider.base.acFlags & AC_HIT) != 0) && ((this->unk_1DC & 2) == 0) && this->unk_1D8 <= 0) {
if ((this->collider.base.acFlags & AC_HIT) && !(this->unk_1DC & AC_HIT) && this->unk_1D8 <= 0) {
this->unk_1D8 = 0xA;
func_8086DC30(this);
func_8086D4B4(this, play);
@ -455,7 +455,7 @@ void func_8086DCE8(BgBdanSwitch* this, PlayState* play) {
}
break;
case YELLOW_TALL_2:
if (((this->collider.base.acFlags & AC_HIT) != 0) && ((this->unk_1DC & 2) == 0) && (this->unk_1D8 <= 0)) {
if ((this->collider.base.acFlags & AC_HIT) && !(this->unk_1DC & AC_HIT) && (this->unk_1D8 <= 0)) {
this->unk_1D8 = 0xA;
func_8086DDA8(this);
func_8086D548(this, play);

View file

@ -225,7 +225,7 @@ void BgBreakwall_WaitForObject(BgBreakwall* this, PlayState* play) {
* despawn itself.
*/
void BgBreakwall_Wait(BgBreakwall* this, PlayState* play) {
if (this->collider.base.acFlags & 2) {
if (this->collider.base.acFlags & AC_HIT) {
Vec3f effectPos;
s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF;

View file

@ -166,7 +166,7 @@ void BgHakaTrap_Init(Actor* thisx, PlayState* play) {
this->colliderCylinder.dim.radius = 18;
this->colliderCylinder.dim.height = 115;
this->colliderCylinder.info.toucherFlags = this->colliderCylinder.info.toucherFlags;
this->colliderCylinder.info.toucherFlags &= ~TOUCH_SFX_NORMAL;
this->colliderCylinder.info.toucherFlags |= TOUCH_SFX_WOOD;
this->actionFunc = func_808801B8;

View file

@ -200,8 +200,8 @@ void func_8088960C(BgHidanHrock* this, PlayState* play) {
}
void func_808896B8(BgHidanHrock* this, PlayState* play) {
if (this->collider.base.acFlags & 2) {
this->collider.base.acFlags &= ~2;
if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
this->actionFunc = func_808894B0;
this->dyna.actor.flags |= ACTOR_FLAG_4;

View file

@ -145,7 +145,7 @@ void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, PlayState* play) {
}
if (this->collider.base.atFlags & AT_HIT) {
this->collider.base.atFlags &= ~AT_HIT & ~AT_ON;
this->collider.base.atFlags &= ~(AT_ON | AT_HIT);
relYawTowardsPlayer = thisx->yawTowardsPlayer - thisx->world.rot.y;
if ((relYawTowardsPlayer > -0x4000) && (relYawTowardsPlayer < 0x4000)) {

View file

@ -288,7 +288,7 @@ void BgSpot06Objects_LockWait(BgSpot06Objects* this, PlayState* play) {
f32 sin;
f32 cos;
if (this->collider.base.acFlags & 2) {
if (this->collider.base.acFlags & AC_HIT) {
this->timer = 130;
this->dyna.actor.flags |= ACTOR_FLAG_4;
sin = Math_SinS(this->dyna.actor.world.rot.y);

View file

@ -284,7 +284,7 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, PlayState* play) {
BgYdanSp_BurnWeb(this, play);
return;
}
if ((this->trisCollider.base.acFlags & 2) != 0) {
if (this->trisCollider.base.acFlags & AC_HIT) {
BgYdanSp_BurnWeb(this, play);
return;
}
@ -396,7 +396,7 @@ void BgYdanSp_WallWebIdle(BgYdanSp* this, PlayState* play) {
Vec3f sp30;
player = GET_PLAYER(play);
if (Flags_GetSwitch(play, this->burnSwitchFlag) || (this->trisCollider.base.acFlags & 2)) {
if (Flags_GetSwitch(play, this->burnSwitchFlag) || (this->trisCollider.base.acFlags & AC_HIT)) {
this->dyna.actor.home.pos.y = this->dyna.actor.world.pos.y + 80.0f;
BgYdanSp_BurnWeb(this, play);
} else if (player->heldItemActionParam == PLAYER_AP_STICK && player->unk_860 != 0) {

View file

@ -1236,12 +1236,12 @@ void BossDodongo_UpdateDamage(BossDodongo* this, PlayState* play) {
if (this->unk_1C0 == 0) {
if (this->actionFunc == BossDodongo_Inhale) {
for (i = 0; i < 19; i++) {
if (this->collider.elements[i].info.bumperFlags & 2) {
if (this->collider.elements[i].info.bumperFlags & BUMP_HIT) {
item1 = this->collider.elements[i].info.acHitInfo;
item2 = item1;
if ((item2->toucher.dmgFlags & 0x10) || (item2->toucher.dmgFlags & 4)) {
this->collider.elements[i].info.bumperFlags &= ~2;
this->collider.elements[i].info.bumperFlags &= ~BUMP_HIT;
this->unk_1C0 = 2;
BossDodongo_SetupWalk(this);
this->unk_1DA = 0x32;
@ -1251,8 +1251,8 @@ void BossDodongo_UpdateDamage(BossDodongo* this, PlayState* play) {
}
}
if (this->collider.elements->info.bumperFlags & 2) {
this->collider.elements->info.bumperFlags &= ~2;
if (this->collider.elements->info.bumperFlags & BUMP_HIT) {
this->collider.elements->info.bumperFlags &= ~BUMP_HIT;
item1 = this->collider.elements[0].info.acHitInfo;
if ((this->actionFunc == BossDodongo_Vulnerable) || (this->actionFunc == BossDodongo_LayDown)) {
swordDamage = damage = CollisionCheck_GetSwordDamage(item1->toucher.dmgFlags);

View file

@ -2686,9 +2686,9 @@ void BossGanon_UpdateDamage(BossGanon* this, PlayState* play) {
s16 j;
ColliderInfo* acHitInfo;
if (this->collider.base.acFlags & 2) {
if (this->collider.base.acFlags & AC_HIT) {
this->unk_2D4 = 2;
this->collider.base.acFlags &= ~2;
this->collider.base.acFlags &= ~AC_HIT;
acHitInfo = this->collider.info.acHitInfo;
if ((this->actionFunc == BossGanon_HitByLightBall) || (this->actionFunc == BossGanon_ChargeBigMagic)) {
@ -3932,10 +3932,10 @@ void BossGanon_LightBall_Update(Actor* thisx, PlayState* play2) {
hitWithBottle = false;
}
if ((this->collider.base.acFlags & 2) || hitWithBottle) {
if ((this->collider.base.acFlags & AC_HIT) || hitWithBottle) {
ColliderInfo* acHitInfo = this->collider.info.acHitInfo;
this->collider.base.acFlags &= ~2;
this->collider.base.acFlags &= ~AC_HIT;
if ((hitWithBottle == false) && (acHitInfo->toucher.dmgFlags & 0x100000)) {
spBA = 2;
@ -4417,10 +4417,10 @@ void func_808E2544(Actor* thisx, PlayState* play) {
break;
}
if (this->collider.base.acFlags & 2) {
if (this->collider.base.acFlags & AC_HIT) {
acHitInfo = this->collider.info.acHitInfo;
this->collider.base.acFlags &= ~2;
this->collider.base.acFlags &= ~AC_HIT;
if (!(acHitInfo->toucher.dmgFlags & 0x100000) || Player_HasMirrorShieldEquipped(play)) {
func_800AA000(this->actor.xyzDistToPlayerSq, 0xB4, 0x14, 0x64);

View file

@ -1828,10 +1828,10 @@ void func_80902348(BossGanon2* this, PlayState* play) {
if (this->unk_316 == 0) {
for (i = 0; i < ARRAY_COUNT(this->unk_864); i++) {
if (this->unk_444.elements[i].info.bumperFlags & 2) {
this->unk_444.elements[i].info.bumperFlags &= ~2;
} else if (this->unk_444.elements[i].info.toucherFlags & 2) {
this->unk_444.elements[i].info.toucherFlags &= ~2;
if (this->unk_444.elements[i].info.bumperFlags & BUMP_HIT) {
this->unk_444.elements[i].info.bumperFlags &= ~BUMP_HIT;
} else if (this->unk_444.elements[i].info.toucherFlags & TOUCH_HIT) {
this->unk_444.elements[i].info.toucherFlags &= ~TOUCH_HIT;
if (this->unk_312 == 1) {
phi_v0_2 = 0x1800;
@ -1873,15 +1873,15 @@ void func_80902524(BossGanon2* this, PlayState* play) {
osSyncPrintf("this->no_hit_time %d\n", this->unk_316);
if (this->unk_316 != 0 || ((this->unk_334 == 0) && (this->actionFunc == func_80900890))) {
for (i = 0; i < ARRAY_COUNT(this->unk_464); i++) {
this->unk_424.elements[i].info.bumperFlags &= ~2;
this->unk_424.elements[i].info.bumperFlags &= ~BUMP_HIT;
}
}
osSyncPrintf("this->look_on %d\n", this->unk_313);
if (this->unk_313) {
if (this->actionFunc != func_808FFFE0) {
if (this->unk_424.elements[0].info.bumperFlags & 2) {
this->unk_424.elements[0].info.bumperFlags &= ~2;
if (this->unk_424.elements[0].info.bumperFlags & BUMP_HIT) {
this->unk_424.elements[0].info.bumperFlags &= ~BUMP_HIT;
acHitInfo = this->unk_424.elements[0].info.acHitInfo;
if ((acHitInfo->toucher.dmgFlags & 0x2000) && (this->actionFunc != func_80900890)) {
func_809000A0(this, play);
@ -1911,8 +1911,8 @@ void func_80902524(BossGanon2* this, PlayState* play) {
}
}
} else {
if (this->unk_424.elements[15].info.bumperFlags & 2) {
this->unk_424.elements[15].info.bumperFlags &= ~2;
if (this->unk_424.elements[15].info.bumperFlags & BUMP_HIT) {
this->unk_424.elements[15].info.bumperFlags &= ~BUMP_HIT;
acHitInfo = this->unk_424.elements[15].info.acHitInfo;
this->unk_316 = 60;
this->unk_344 = 0x32;

View file

@ -1299,7 +1299,7 @@ void BossGoma_FloorAttack(BossGoma* this, PlayState* play) {
switch (this->actionState) {
case 0:
for (i = 0; i < this->collider.count; i++) {
if (this->collider.elements[i].info.toucherFlags & 2) {
if (this->collider.elements[i].info.toucherFlags & TOUCH_HIT) {
this->framesUntilNextAction = 10;
break;
}

View file

@ -227,7 +227,7 @@ void DoorKiller_FallAsRubble(DoorKiller* this, PlayState* play) {
s32 DoorKiller_IsHit(Actor* thisx, PlayState* play) {
DoorKiller* this = (DoorKiller*)thisx;
if ((this->colliderCylinder.base.acFlags & 2) && (this->colliderCylinder.info.acHitInfo != NULL)) {
if ((this->colliderCylinder.base.acFlags & AC_HIT) && (this->colliderCylinder.info.acHitInfo != NULL)) {
return true;
}
return false;

View file

@ -108,11 +108,11 @@ void func_809B27D8(EnAnubiceFire* this, PlayState* play) {
Math_ApproachF(&this->scale, this->unk_154, 0.2f, 0.4f);
if ((this->unk_15A == 0) && (this->scale < 0.1f)) {
Actor_Kill(&this->actor);
} else if ((this->actor.params == 0) && (this->cylinder.base.atFlags & 4)) {
} else if ((this->actor.params == 0) && (this->cylinder.base.atFlags & AT_BOUNCED)) {
if (Player_HasMirrorShieldEquipped(play)) {
Audio_PlayActorSound2(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW);
this->cylinder.base.atFlags &= 0xFFE9;
this->cylinder.base.atFlags |= 8;
this->cylinder.base.atFlags &= ~(AT_HIT | AT_BOUNCED | AT_TYPE_ENEMY);
this->cylinder.base.atFlags |= AT_TYPE_PLAYER;
this->cylinder.info.toucher.dmgFlags = 2;
this->unk_15A = 30;
this->actor.params = 1;

View file

@ -121,8 +121,8 @@ void EnArrow_Init(Actor* thisx, PlayState* play) {
Collider_SetQuad(play, &this->collider, &this->actor, &sColliderInit);
if (this->actor.params <= ARROW_NORMAL) {
this->collider.info.toucherFlags &= ~0x18;
this->collider.info.toucherFlags |= 0;
this->collider.info.toucherFlags &= ~TOUCH_SFX_MASK;
this->collider.info.toucherFlags |= TOUCH_SFX_NORMAL;
}
if (this->actor.params < 0) {
@ -300,7 +300,7 @@ void EnArrow_Fly(EnArrow* this, PlayState* play) {
this->hitFlags |= 1;
this->hitFlags |= 2;
if (this->collider.info.atHitInfo->bumperFlags & 2) {
if (this->collider.info.atHitInfo->bumperFlags & BUMP_HIT) {
this->actor.world.pos.x = this->collider.info.atHitInfo->bumper.hitPos.x;
this->actor.world.pos.y = this->collider.info.atHitInfo->bumper.hitPos.y;
this->actor.world.pos.z = this->collider.info.atHitInfo->bumper.hitPos.z;

View file

@ -300,8 +300,8 @@ void EnBa_SwingAtPlayer(EnBa* this, PlayState* play) {
}
this->unk_2A8[13].x = this->unk_2A8[12].x;
this->unk_2A8[13].y = this->unk_2A8[12].y;
if (this->collider.base.atFlags & 2) {
this->collider.base.atFlags &= ~2;
if (this->collider.base.atFlags & AT_HIT) {
this->collider.base.atFlags &= ~AT_HIT;
if (this->collider.base.at == &player->actor) {
func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f);
}
@ -447,8 +447,8 @@ void EnBa_Die(EnBa* this, PlayState* play) {
void EnBa_Update(Actor* thisx, PlayState* play) {
EnBa* this = (EnBa*)thisx;
if ((this->actor.params < EN_BA_DEAD_BLOB) && (this->collider.base.acFlags & 2)) {
this->collider.base.acFlags &= ~2;
if ((this->actor.params < EN_BA_DEAD_BLOB) && (this->collider.base.acFlags & AC_HIT)) {
this->collider.base.acFlags &= ~AC_HIT;
this->actor.colChkInfo.health--;
if (this->actor.colChkInfo.health == 0) {
func_809B75A0(this, play);

View file

@ -339,10 +339,10 @@ s32 func_809F70E8(EnDodojr* this, PlayState* play) {
return 0;
}
if (!(this->collider.base.acFlags & 2)) {
if (!(this->collider.base.acFlags & AC_HIT)) {
return 0;
} else {
this->collider.base.acFlags &= ~2;
this->collider.base.acFlags &= ~AC_HIT;
if ((this->actionFunc == func_809F73AC) || (this->actionFunc == func_809F74C4)) {
this->actor.shape.shadowDraw = ActorShadow_DrawCircle;

View file

@ -344,8 +344,8 @@ void EnFireRock_Update(Actor* thisx, PlayState* play) {
if (this->actionFunc != EnFireRock_SpawnMoreBrokenPieces) {
if ((this->type == FIRE_ROCK_SPAWNED_FALLING1) || (this->type == FIRE_ROCK_SPAWNED_FALLING2) ||
(this->type == FIRE_ROCK_BROKEN_PIECE1)) {
if (this->collider.base.atFlags & 4) {
this->collider.base.atFlags &= ~4;
if (this->collider.base.atFlags & AT_BOUNCED) {
this->collider.base.atFlags &= ~AT_BOUNCED;
Audio_PlayActorSound2(thisx, NA_SE_EV_BRIDGE_OPEN_STOP);
thisx->velocity.y = 0.0f;
thisx->speedXZ = 0.0f;
@ -359,8 +359,8 @@ void EnFireRock_Update(Actor* thisx, PlayState* play) {
}
if (this->type == FIRE_ROCK_ON_FLOOR) {
if (this->collider.base.atFlags & 2) {
this->collider.base.atFlags &= ~2;
if (this->collider.base.atFlags & AT_HIT) {
this->collider.base.atFlags &= ~AT_HIT;
if (this->collider.base.at == playerActor) {
if (!(player->stateFlags1 & PLAYER_STATE1_26)) {
func_8002F758(play, thisx, 2.0f, -player->actor.world.rot.y, 3.0f, 4);

View file

@ -977,7 +977,7 @@ void EnFloormas_ColliderCheck(EnFloormas* this, PlayState* play) {
s32 pad;
s32 isSmall;
if ((this->collider.base.acFlags & AC_HIT) != 0) {
if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
Actor_SetDropFlag(&this->actor, &this->collider.info, true);
if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) {

View file

@ -330,17 +330,17 @@ void EnFz_ApplyDamage(EnFz* this, PlayState* play) {
}
if (this->isFreezing) {
if ((this->actor.params < 0) && (this->collider1.base.atFlags & 2)) {
if ((this->actor.params < 0) && (this->collider1.base.atFlags & AT_HIT)) {
this->isMoving = false;
this->collider1.base.acFlags &= ~2;
this->collider1.base.acFlags &= ~AC_HIT;
this->actor.speedXZ = this->speedXZ = 0.0f;
this->timer = 10;
EnFz_SetupDisappear(this);
} else if (this->collider2.base.acFlags & 0x80) {
this->collider2.base.acFlags &= ~0x80;
this->collider1.base.acFlags &= ~2;
} else if (this->collider1.base.acFlags & 2) {
this->collider1.base.acFlags &= ~2;
} else if (this->collider2.base.acFlags & AC_BOUNCED) {
this->collider2.base.acFlags &= ~AC_BOUNCED;
this->collider1.base.acFlags &= ~AC_HIT;
} else if (this->collider1.base.acFlags & AC_HIT) {
this->collider1.base.acFlags &= ~AC_HIT;
if (this->actor.colChkInfo.damageEffect != 2) {
if (this->actor.colChkInfo.damageEffect == 0xF) {
Actor_ApplyDamage(&this->actor);

View file

@ -553,7 +553,7 @@ void EnGe2_Update(Actor* thisx, PlayState* play) {
if ((this->stateFlags & GE2_STATE_KO) || (this->stateFlags & GE2_STATE_CAPTURING)) {
this->actionFunc(this, play);
} else if (this->collider.base.acFlags & 2) {
} else if (this->collider.base.acFlags & AC_HIT) {
if ((this->collider.info.acHitInfo != NULL) && (this->collider.info.acHitInfo->toucher.dmgFlags & 0x80)) {
Actor_SetColorFilter(&this->actor, 0, 120, 0, 400);
this->actor.update = EnGe2_UpdateStunned;
@ -603,7 +603,7 @@ void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2) {
CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base);
Actor_UpdateBgCheckInfo(play, &this->actor, 40.0f, 25.0f, 40.0f, UPDBGCHECKINFO_FLAG_0 | UPDBGCHECKINFO_FLAG_2);
if ((this->collider.base.acFlags & 2) &&
if ((this->collider.base.acFlags & AC_HIT) &&
((this->collider.info.acHitInfo == NULL) || !(this->collider.info.acHitInfo->toucher.dmgFlags & 0x80))) {
this->actor.colorFilterTimer = 0;
EnGe2_ChangeAction(this, GE2_ACTION_KNOCKEDOUT);

View file

@ -707,8 +707,8 @@ void EnGo_StopRolling(EnGo* this, PlayState* play) {
EnBom* bomb;
if (DECR(this->unk_20E) == 0) {
if (this->collider.base.ocFlags2 & 1) {
this->collider.base.ocFlags2 &= ~1;
if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) {
this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER;
play->damagePlayer(play, -4);
func_8002F71C(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f);
this->unk_20E = 0x10;

View file

@ -805,7 +805,8 @@ s16 EnGo2_GetState(PlayState* play, Actor* thisx) {
s32 func_80A44790(EnGo2* this, PlayState* play) {
if ((this->actor.params & 0x1F) != GORON_DMT_BIGGORON && (this->actor.params & 0x1F) != GORON_CITY_ROLLING_BIG) {
return func_800343CC(play, &this->actor, &this->unk_194.unk_00, this->unk_218, EnGo2_GetTextId, EnGo2_GetState);
} else if (((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) && ((this->collider.base.ocFlags2 & 1) == 0)) {
} else if (((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) &&
!(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) {
return false;
} else {
if (Actor_ProcessTalkRequest(&this->actor, play)) {
@ -873,28 +874,28 @@ s32 func_80A44AB0(EnGo2* this, PlayState* play) {
(this->actionFunc != EnGo2_ContinueRolling)) {
return false;
} else {
if (this->collider.base.acFlags & 2) {
if (this->collider.base.acFlags & AC_HIT) {
Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
this->actor.flags &= ~ACTOR_FLAG_24;
this->collider.base.acFlags &= ~0x2;
this->collider.base.acFlags &= ~AC_HIT;
EnGo2_StopRolling(this, play);
return true;
}
if (player->invincibilityTimer <= 0) {
this->collider.base.ocFlags1 |= 8;
this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER;
} else {
return false;
}
if (this->collider.base.ocFlags2 & 1) {
this->collider.base.ocFlags2 &= ~1;
if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) {
this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER;
arg2 = this->actionFunc == EnGo2_ContinueRolling ? 1.5f : this->actor.speedXZ * 1.5f;
play->damagePlayer(play, -4);
func_8002F71C(play, &this->actor, arg2, this->actor.yawTowardsPlayer, 6.0f);
Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT);
this->collider.base.ocFlags1 &= ~0x8;
this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER;
}
}
}
@ -951,7 +952,7 @@ s32 EnGo2_IsWakingUp(EnGo2* this) {
s16 yawDiffAbs;
if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) {
if ((this->collider.base.ocFlags2 & 1) == 0) {
if (!(this->collider.base.ocFlags2 & OC2_HIT_PLAYER)) {
this->actor.flags &= ~ACTOR_FLAG_0;
return false;
} else {
@ -1324,7 +1325,7 @@ void EnGo2_GetItemAnimation(EnGo2* this, PlayState* play) {
void EnGo2_SetupRolling(EnGo2* this, PlayState* play) {
if ((this->actor.params & 0x1F) == GORON_CITY_ROLLING_BIG || (this->actor.params & 0x1F) == GORON_CITY_LINK) {
this->collider.info.bumperFlags = 1;
this->collider.info.bumperFlags = BUMP_ON;
this->actor.speedXZ = GET_INFTABLE(INFTABLE_11E) ? 6.0f : 3.6000001f;
} else {
this->actor.speedXZ = 6.0f;
@ -1348,7 +1349,7 @@ void EnGo2_StopRolling(EnGo2* this, PlayState* play) {
}
}
} else {
this->collider.info.bumperFlags = 0;
this->collider.info.bumperFlags = BUMP_NONE;
}
this->actor.shape.rot = this->actor.world.rot;
@ -1582,8 +1583,8 @@ void EnGo2_Init(Actor* thisx, PlayState* play) {
(INV_CONTENT(ITEM_TRADE_ADULT) <= ITEM_EYEDROPS)) {
this->eyeMouthTexState = 1;
}
this->collider.base.acFlags = 0;
this->collider.base.ocFlags1 = 0xD; // OC_PLAYER | OC_NO_PUSH | OC_ON
this->collider.base.acFlags = AC_NONE;
this->collider.base.ocFlags1 = OC1_ON | OC1_NO_PUSH | OC1_TYPE_PLAYER;
this->actionFunc = EnGo2_CurledUp;
break;
case GORON_DMT_BOMB_FLOWER:

View file

@ -613,7 +613,7 @@ void EnGoma_UpdateHit(EnGoma* this, PlayState* play) {
ColliderInfo* acHitInfo;
u8 swordDamage;
if ((this->colCyl1.base.atFlags & 2) && this->actionFunc == EnGoma_Jump) {
if ((this->colCyl1.base.atFlags & AT_HIT) && this->actionFunc == EnGoma_Jump) {
EnGoma_SetupLand(this);
this->actor.speedXZ = 0.0f;
this->actor.velocity.y = 0.0f;

View file

@ -372,7 +372,7 @@ static RaceWaypoint sIngoRaceWaypoints[] = {
{ -1552, 1, -1008, 11, 0x638D }, { -947, -1, -1604, 10, 0x4002 },
};
static RaceInfo sIngoRace = { 8, sIngoRaceWaypoints };
static RaceInfo sIngoRace = { ARRAY_COUNT(sIngoRaceWaypoints), sIngoRaceWaypoints };
static s32 sAnimSoundFrames[] = { 0, 16 };
static InitChainEntry sInitChain[] = {
@ -542,7 +542,7 @@ void EnHorse_UpdateIngoRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceIn
f32 px;
f32 pz;
f32 d;
f32 dist;
f32 distSq;
s32 prevWaypoint;
EnHorse_RaceWaypointPos(raceInfo->waypoints, this->curRaceWaypoint, &curWaypointPos);
@ -561,13 +561,13 @@ void EnHorse_UpdateIngoRaceInfo(EnHorse* this, PlayState* play, RaceInfo* raceIn
prevWaypoint = raceInfo->numWaypoints - 1;
}
EnHorse_RaceWaypointPos(raceInfo->waypoints, prevWaypoint, &prevWaypointPos);
Math3D_PointDistToLine2D(this->actor.world.pos.x, this->actor.world.pos.z, prevWaypointPos.x, prevWaypointPos.z,
curWaypointPos.x, curWaypointPos.z, &dist);
Math3D_PointDistSqToLine2D(this->actor.world.pos.x, this->actor.world.pos.z, prevWaypointPos.x, prevWaypointPos.z,
curWaypointPos.x, curWaypointPos.z, &distSq);
EnHorse_RotateToPoint(this, play, &curWaypointPos, 400);
if (dist < 90000.0f) {
if (distSq < SQ(300.0f)) {
playerDist = this->actor.xzDistToPlayer;
if (playerDist < 130.0f || this->jntSph.elements[0].info.ocElemFlags & 2) {
if (playerDist < 130.0f || this->jntSph.elements[0].info.ocElemFlags & OCELEM_HIT) {
if (Math_SinS(this->actor.yawTowardsPlayer - this->actor.world.rot.y) > 0.0f) {
this->actor.world.rot.y = this->actor.world.rot.y - 280;
} else {
@ -611,7 +611,7 @@ void EnHorse_PlayWalkingSound(EnHorse* this) {
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_WALK, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
if (++this->soundTimer > 1) {
if (++this->soundTimer >= ARRAY_COUNT(sAnimSoundFrames)) {
this->soundTimer = 0;
}
}
@ -3527,12 +3527,12 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) {
this->rider->shape.rot.y = thisx->shape.rot.y;
}
}
if (this->jntSph.elements[0].info.ocElemFlags & 2) {
if (this->jntSph.elements[0].info.ocElemFlags & OCELEM_HIT) {
if (thisx->speedXZ > 6.0f) {
thisx->speedXZ -= 1.0f;
}
}
if (this->jntSph.base.acFlags & 2) {
if (this->jntSph.base.acFlags & AC_HIT) {
this->unk_21C = this->unk_228;
if (this->stateFlags & ENHORSE_DRAW) {
Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &this->unk_21C, 4, &gSfxDefaultFreqAndVolScale,
@ -3595,9 +3595,9 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) {
}
if (thisx->speedXZ >= 5.0f) {
this->cyl1.base.atFlags |= 1;
this->cyl1.base.atFlags |= AT_ON;
} else {
this->cyl1.base.atFlags &= ~1;
this->cyl1.base.atFlags &= ~AT_ON;
}
if (gSaveContext.entranceIndex != 343 || gSaveContext.sceneSetupIndex != 9) {

View file

@ -291,20 +291,20 @@ s32 EnNy_CollisionCheck(EnNy* this, PlayState* play) {
sp3F = 0;
this->hitPlayer = 0;
if (this->collider.base.atFlags & 4) {
this->collider.base.atFlags &= ~4;
if (this->collider.base.atFlags & AT_BOUNCED) {
this->collider.base.atFlags &= ~AT_BOUNCED;
this->hitPlayer = 1;
this->actor.world.rot.y = this->actor.yawTowardsPlayer;
this->actor.speedXZ = -4.0f;
return 0;
}
if (this->collider.base.atFlags & 2) {
this->collider.base.atFlags &= ~2;
if (this->collider.base.atFlags & AT_HIT) {
this->collider.base.atFlags &= ~AT_HIT;
this->hitPlayer = 1;
return 0;
} else {
if (this->collider.base.acFlags & 2) {
this->collider.base.acFlags &= ~2;
if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
effectPos.x = this->collider.elements[0].info.bumper.hitPos.x;
effectPos.y = this->collider.elements[0].info.bumper.hitPos.y;
effectPos.z = this->collider.elements[0].info.bumper.hitPos.z;

View file

@ -296,7 +296,7 @@ void EnSkb_Advance(EnSkb* this, PlayState* play) {
void func_80AFD33C(EnSkb* this) {
Animation_Change(&this->skelAnime, &gStalchildAttackingAnim, 0.6f, 0.0f,
Animation_GetLastFrame(&gStalchildAttackingAnim), ANIMMODE_ONCE_INTERP, 4.0f);
this->collider.base.atFlags &= ~4;
this->collider.base.atFlags &= ~AT_BOUNCED;
this->unk_280 = 3;
this->actor.speedXZ = 0.0f;
EnSkb_SetupAction(this, EnSkb_SetupAttack);
@ -312,8 +312,8 @@ void EnSkb_SetupAttack(EnSkb* this, PlayState* play) {
} else if (frameData == 6) {
this->unk_281 = 0;
}
if (this->collider.base.atFlags & 4) {
this->collider.base.atFlags &= ~6;
if (this->collider.base.atFlags & AT_BOUNCED) {
this->collider.base.atFlags &= ~(AT_HIT | AT_BOUNCED);
func_80AFD47C(this);
} else if (SkelAnime_Update(&this->skelAnime) != 0) {
func_80AFCD60(this);
@ -323,7 +323,7 @@ void EnSkb_SetupAttack(EnSkb* this, PlayState* play) {
void func_80AFD47C(EnSkb* this) {
Animation_Change(&this->skelAnime, &gStalchildAttackingAnim, -0.4f, this->skelAnime.curFrame - 1.0f, 0.0f,
ANIMMODE_ONCE_INTERP, 0.0f);
this->collider.base.atFlags &= ~4;
this->collider.base.atFlags &= ~AT_BOUNCED;
this->unk_280 = 5;
this->unk_281 = 0;
EnSkb_SetupAction(this, func_80AFD508);
@ -445,8 +445,8 @@ void func_80AFD968(EnSkb* this, PlayState* play) {
this->unk_281 = 0;
func_80AFD7B4(this, play);
} else if (this->unk_280 >= 3) {
if ((this->collider.base.acFlags & 2) != 0) {
this->collider.base.acFlags &= ~2;
if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
if (this->actor.colChkInfo.damageEffect != 6) {
this->unk_282 = this->actor.colChkInfo.damageEffect;
Actor_SetDropFlag(&this->actor, &this->collider.elements[1].info, true);

View file

@ -324,8 +324,8 @@ s32 func_80B0C9F0(EnSw* this, PlayState* play) {
}
if (this->unk_392 == 0) {
if ((this->collider.base.acFlags & 2) || phi_v1) {
this->collider.base.acFlags &= ~2;
if ((this->collider.base.acFlags & AC_HIT) || phi_v1) {
this->collider.base.acFlags &= ~AC_HIT;
this->unk_392 = 0x10;
Actor_SetColorFilter(&this->actor, 0x4000, 0xC8, 0, this->unk_392);
if (Actor_ApplyDamage(&this->actor) != 0) {
@ -359,7 +359,7 @@ s32 func_80B0C9F0(EnSw* this, PlayState* play) {
}
}
if ((this->unk_390 == 0) && (this->collider.base.atFlags & 2)) {
if ((this->unk_390 == 0) && (this->collider.base.atFlags & AT_HIT)) {
this->unk_390 = 30;
}
@ -535,15 +535,15 @@ void func_80B0D590(EnSw* this, PlayState* play) {
if (((this->actor.params & 0xE000) >> 0xD) == 2) {
if (this->actor.scale.x < 0.0139999995f) {
this->collider.elements[0].info.toucherFlags = 0;
this->collider.elements[0].info.bumperFlags = 0;
this->collider.elements[0].info.ocElemFlags = 0;
this->collider.elements[0].info.toucherFlags = TOUCH_NONE;
this->collider.elements[0].info.bumperFlags = BUMP_NONE;
this->collider.elements[0].info.ocElemFlags = OCELEM_NONE;
}
if (this->actor.scale.x >= 0.0139999995f) {
this->collider.elements[0].info.toucherFlags = 1;
this->collider.elements[0].info.bumperFlags = 1;
this->collider.elements[0].info.ocElemFlags = 1;
this->collider.elements[0].info.toucherFlags = TOUCH_ON;
this->collider.elements[0].info.bumperFlags = BUMP_ON;
this->collider.elements[0].info.ocElemFlags = OCELEM_ON;
}
Math_ApproachF(&this->actor.scale.x, !IS_DAY ? 0.02f : 0.0f, 0.2f, 0.01f);

View file

@ -147,7 +147,7 @@ void EnTrap_Update(Actor* thisx, PlayState* play) {
touchingActor = true;
}
// Freeze the trap if hit by ice arrows:
if ((this->collider.base.acFlags & AC_HIT) != 0) {
if (this->collider.base.acFlags & AC_HIT) {
icePos = thisx->world.pos;
this->collider.base.acFlags &= ~AC_HIT;
Actor_SetColorFilter(thisx, 0, 250, 0, 250);

View file

@ -501,7 +501,7 @@ void EnWallmas_Stun(EnWallmas* this, PlayState* play) {
}
void EnWallmas_ColUpdate(EnWallmas* this, PlayState* play) {
if ((this->collider.base.acFlags & AC_HIT) != 0) {
if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
Actor_SetDropFlag(&this->actor, &this->collider.info, true);
if ((this->actor.colChkInfo.damageEffect != 0) || (this->actor.colChkInfo.damage != 0)) {

View file

@ -174,7 +174,7 @@ void ObjComb_Wait(ObjComb* this, PlayState* play) {
this->unk_1B0 = 0;
}
if ((this->collider.base.acFlags & AC_HIT) != 0) {
if (this->collider.base.acFlags & AC_HIT) {
this->collider.base.acFlags &= ~AC_HIT;
dmgFlags = this->collider.elements[0].info.acHitInfo->toucher.dmgFlags;
if (dmgFlags & 0x4001F866) {

View file

@ -492,7 +492,7 @@ s32 ObjSwitch_EyeIsHit(ObjSwitch* this) {
Actor* collidingActor;
s16 yawDiff;
if ((this->tris.col.base.acFlags & AC_HIT) && !(this->unk_17F & 2)) {
if ((this->tris.col.base.acFlags & AC_HIT) && !(this->unk_17F & AC_HIT)) {
collidingActor = this->tris.col.base.ac;
if (collidingActor != NULL) {
yawDiff = collidingActor->world.rot.y - this->dyna.actor.shape.rot.y;
@ -609,7 +609,7 @@ void ObjSwitch_CrystalOff(ObjSwitch* this, PlayState* play) {
}
break;
case OBJSWITCH_SUBTYPE_TOGGLE:
if ((this->jntSph.col.base.acFlags & AC_HIT) && !(this->unk_17F & 2) && this->disableAcTimer <= 0) {
if ((this->jntSph.col.base.acFlags & AC_HIT) && !(this->unk_17F & AC_HIT) && this->disableAcTimer <= 0) {
this->disableAcTimer = 10;
ObjSwitch_SetOn(this, play);
ObjSwitch_CrystalTurnOnInit(this);
@ -651,7 +651,7 @@ void ObjSwitch_CrystalOn(ObjSwitch* this, PlayState* play) {
}
break;
case OBJSWITCH_SUBTYPE_TOGGLE:
if ((this->jntSph.col.base.acFlags & AC_HIT) && !(this->unk_17F & 2) && this->disableAcTimer <= 0) {
if ((this->jntSph.col.base.acFlags & AC_HIT) && !(this->unk_17F & AC_HIT) && this->disableAcTimer <= 0) {
this->disableAcTimer = 10;
play = play;
ObjSwitch_CrystalTurnOffInit(this);