diff --git a/src/game/explosion.c b/src/game/explosion.c index fe18dfef..8fb90ad6 100644 --- a/src/game/explosion.c +++ b/src/game/explosion.c @@ -2133,6 +2133,21 @@ void explosionCreateBulletImpact(struct coord3d *pos, struct coord3d *arg1, s16 impact_type = 0x10; } +#ifdef PORT + /* Glass objects: the bulletproof/unbreakable ones take the texture-based + * hole, a decal drawn in the opaque pass. Transparent glass writes no + * depth there, so the decal depth test (RDP ZMODE_DEC, emulated exactly) + * rejects every pixel. Use the window crack the breakable glass gets: it + * is drawn after the glass in the translucent pass, without the decal + * test. */ + if ((prop != NULL) && (impact_type != 0x10) + && ((prop->obj->type == PROPDEF_GLASS) || (prop->obj->type == PROPDEF_TINTED_GLASS)) + && ((g_ImpactTypes[impact_type].unk2 >= 2) || (g_ImpactTypes[impact_type].unk1 != 2))) + { + impact_type = (randomGetNext() % 3) + 0x11; + } +#endif + spA0.f[0] = pos->f[0]; spA0.f[1] = pos->f[1]; spA0.f[2] = pos->f[2];