So, I got FitzQuake 0.85 source and altered it to read ambient sounds from 4 cvars (_sfx_envwind, _sfx_envlava, _sfx_envslime and _sfx_envwater). Added a small function to reload the sfx every time one of these cvars are changed, so I can change the sounds at my will. Also, I produced a small test map consisting of 4 isolated rooms, each one containing one of the "content" brushes that triggers ambient sounds (lava, slime, water, sky). And I noticed a funny thing that at first I thought was my fault messing something:
a) if you set _gfx_envlava or _gfxenvwind, they work as expected;
b) if you set _gfx_envslime, nothing changes;
c) water brushes don' t emit the water ambient sound or any sound at all;
d) slime brushes emit the _gfx_envwater sound instead the expected.
As I said, at first I thought I should have messed something, but then I tested the same map with vanilla GlQuake and the behavior persists. I double checked the FitzQuake source and was unable to find anything wrong. So, I want to ask if anyone already observed such behavior ? Could it be a bug in the QBSP/VIS/LIGHT tools I am using (Bengt Jardrup's Quake map utilities) ?
EDIT:
Yeah, it's a "feature" from the VIS tool, after all:
Code: Select all
void CalcAmbientSounds (void)
{
int i, j, k, l;
dleaf_t *leaf, *hit;
byte *vis;
dface_t *surf;
vec3_t mins, maxs;
float d, maxd;
int ambient_type;
texinfo_t *info;
miptex_t *miptex;
int ofs;
float dists[NUM_AMBIENTS];
float vol;
for (i=0 ; i< portalleafs ; i++)
{
leaf = &dleafs[i+1];
//
// clear ambients
//
for (j=0 ; j<NUM_AMBIENTS ; j++)
dists[j] = 1020;
vis = &uncompressed[i*bitbytes];
for (j=0 ; j< portalleafs ; j++)
{
if ( !(vis[j>>3] & (1<<(j&7))) )
continue;
//
// check this leaf for sound textures
//
hit = &dleafs[j+1];
for (k=0 ; k< hit->nummarksurfaces ; k++)
{
surf = &dfaces[dmarksurfaces[hit->firstmarksurface + k]];
info = &texinfo[surf->texinfo];
ofs = ((dmiptexlump_t *)dtexdata)->dataofs[info->miptex];
miptex = (miptex_t *)(&dtexdata[ofs]);
if ( !Q_strncasecmp (miptex->name, "*water", 6) )
ambient_type = AMBIENT_WATER;
else if ( !Q_strncasecmp (miptex->name, "sky", 3) )
ambient_type = AMBIENT_SKY;
else if ( !Q_strncasecmp (miptex->name, "*slime", 6) )
ambient_type = AMBIENT_WATER; // AMBIENT_SLIME;
else if ( !Q_strncasecmp (miptex->name, "*lava", 6) )
ambient_type = AMBIENT_LAVA;
else if ( !Q_strncasecmp (miptex->name, "*04water", 8) )
ambient_type = AMBIENT_WATER;
else
continue;
// find distance from source leaf to polygon
SurfaceBBox (surf, mins, maxs);
maxd = 0;
for (l=0 ; l<3 ; l++)
{
if (mins[l] > leaf->maxs[l])
d = mins[l] - leaf->maxs[l];
else if (maxs[l] < leaf->mins[l])
d = leaf->mins[l] - mins[l];
else
d = 0;
if (d > maxd)
maxd = d;
}
maxd = 0.25;
if (maxd < dists[ambient_type])
dists[ambient_type] = maxd;
}
}
for (j=0 ; j<NUM_AMBIENTS ; j++)
{
if (dists[j] < 100)
vol = 1.0;
else
{
vol = 1.0 - dists[2]*0.002;
if (vol < 0)
vol = 0;
}
leaf->ambient_level[j] = vol*255;
}
}
}
EDIT2: just to clarify: it's working this way since the original VIS tool.