From fbc8911238443332c0b7aa97811507c96f84904b Mon Sep 17 00:00:00 2001 From: Maxime Morel Date: Thu, 22 Oct 2026 18:20:50 +0200 Subject: [PATCH] Water decal improvement 2 --- src/game/chrprop.c | 4 +--- src/game/explosion.c | 53 +++++++++++++------------------------------- src/game/explosion.h | 7 +----- 3 files changed, 17 insertions(+), 47 deletions(-) diff --git a/src/game/chrprop.c b/src/game/chrprop.c index 9c8f3384..34fcc12f 100644 --- a/src/game/chrprop.c +++ b/src/game/chrprop.c @@ -1180,9 +1180,7 @@ void chraiDefaultWeaponFireHandler(s32 hand) else if (gotbghit && besttexture >= 0 && g_Textures[besttexture].hitTexture == HIT_WATER) { /* a splash instead of the yellow impact flash below */ - rooms[0] = bestroom; - rooms[1] = 255; - explosionCreateWaterSplash(finalpos, hittile, rooms); + explosionCreateWaterSplash(finalpos, bestroom); createSpark = 0; } #endif diff --git a/src/game/explosion.c b/src/game/explosion.c index 1487128a..eeebd390 100644 --- a/src/game/explosion.c +++ b/src/game/explosion.c @@ -1590,9 +1590,6 @@ void explosionInitFlyingParticles(coord3d *spawnpos, f32 spawn_rand_scale, f32 s rand3 = (2.0f * (((f32) randomGetNext()) * (1.0f / (f32)UINT_MAX))) - 1.0f; g_FlyingParticlesBuffer[g_NumParticleEntries].unk00 = 1; -#ifdef PORT - g_FlyingParticlesBuffer[g_NumParticleEntries].is_splash = FALSE; -#endif g_FlyingParticlesBuffer[g_NumParticleEntries].position.f[0] = spawnpos->f[0] + (spawn_rand_scale * rand1); g_FlyingParticlesBuffer[g_NumParticleEntries].position.f[1] = spawnpos->f[1] + (spawn_rand_scale * rand2); @@ -1742,15 +1739,6 @@ void explosionUpdateFlyingParticles(void) g_FlyingParticlesBuffer[i].unk00 = 0; } -#ifdef PORT - if (g_FlyingParticlesBuffer[i].is_splash - && g_FlyingParticlesBuffer[i].position_drift.f[1] < 0.0f - && g_FlyingParticlesBuffer[i].position.f[1] < g_FlyingParticlesBuffer[i].splash_y) - { - g_FlyingParticlesBuffer[i].unk00 = 0; - } -#endif - // position-related. deletes particles that are too low or too high. if ((g_FlyingParticlesBuffer[i].position.f[1] < -30000.0f) || (g_FlyingParticlesBuffer[i].position.f[1] > 30000.0f)) { @@ -1762,37 +1750,26 @@ void explosionUpdateFlyingParticles(void) #ifdef PORT +#include "glass.h" + /* Bullet hitting water (PC): the N64 only drew the yellow impact flash there. - * Throw up light blue droplets (the wall-hit dust particles, recoloured) that - * vanish when they fall back through the surface, plus a white mist puff. */ -#define WATER_SPLASH_DROPLETS 12 - -void explosionCreateWaterSplash(coord3d *pos, StandTile *stan, u8 *rooms) + * Use the chr hit puffs instead (chrCreateHitPuffs: the small impact puff and + * the larger burst), tinted to the water colour. */ +static void explosionTintSpark(s_bullet_spark *spark) { - s32 i; - s32 j; - - for (i = 0; i < WATER_SPLASH_DROPLETS; i++) + if (spark != NULL) { - struct FlyingParticles *drop = &g_FlyingParticlesBuffer[g_NumParticleEntries]; - - explosionInitFlyingParticles(pos, 2.0f, 1.0f, 6.0f, 3.0f); - - drop->is_splash = TRUE; - drop->splash_y = pos->f[1]; - - for (j = 0; j < 4; j++) - { - u8 shade = 0xC0 + (randomGetNext() & 0x3F); - - drop->vertex_list[j].v.cn[0] = shade - 0x30; - drop->vertex_list[j].v.cn[1] = shade - 0x10; - drop->vertex_list[j].v.cn[2] = 0xFF; - drop->vertex_list[j].v.cn[3] = 0xB0; - } + spark->unk28 = 0xA0; + spark->unk29 = 0xC8; + spark->unk2A = 0xF0; + spark->unk2B = 0xFF; } +} - explosionCreateSmoke(pos, stan, 7, rooms, 0); +void explosionCreateWaterSplash(coord3d *pos, s16 room) +{ + explosionTintSpark(bullet_spark_create(pos, 3, 43.0f, room)); + explosionTintSpark(bullet_spark_create(pos, 1, 21.0f, room)); } #endif diff --git a/src/game/explosion.h b/src/game/explosion.h index d3e6a649..58740f1a 100644 --- a/src/game/explosion.h +++ b/src/game/explosion.h @@ -148,11 +148,6 @@ struct FlyingParticles { s32 unk34; Vtx vertex_list[4]; -#ifdef PORT - /* water splash droplet: removed once it falls back below splash_y */ - s32 is_splash; - f32 splash_y; -#endif }; extern f32 g_SpExplosionDamageMult; @@ -184,7 +179,7 @@ Gfx *explosionRenderBulletImpactOnProp(Gfx *arg0, PropRecord *arg1, s32 arg2); void explosionCreateSmoke(coord3d *pos, StandTile *stan, s16 smoke_type, u8 *rooms, s32 flags); #ifdef PORT -void explosionCreateWaterSplash(coord3d *pos, StandTile *stan, u8 *rooms); +void explosionCreateWaterSplash(coord3d *pos, s16 room); #endif void explosionUpdateFlyingParticles(void); u8 explosionChrpropSmokeTick(PropRecord* prop);