diff --git a/game/mips2c/functions/collide_edge_grab.cpp b/game/mips2c/functions/collide_edge_grab.cpp index e5e6a7b468..82969343e2 100644 --- a/game/mips2c/functions/collide_edge_grab.cpp +++ b/game/mips2c/functions/collide_edge_grab.cpp @@ -104,6 +104,12 @@ u64 execute(void* ctxt) { c->vmadd_bc(DEST::w, BC::z, vf9, vf0, vf9); // vmaddz.w vf9, vf0, vf9 // nop // sll r0, r0, 0 c->vrsqrt(vf0, BC::w, vf9, BC::w); // vrsqrt Q, vf0.w, vf9.w + if (c->vfs[vf9].f[3] == 0.f) { + // hack to prevent NaNs from getting in the collide data if we have a zero-area triangle + // this value doesn't matter - the normal is zeros anyway and the triangle will be rejected + // by every other step. + c->Q = 0.f; + } // nop // sll r0, r0, 0 c->dsll32(t5, t5, 12); // dsll32 t5, t5, 12 c->dsrl32(t5, t5, 26); // dsrl32 t5, t5, 26