vis: fix ambient sounds when using func_detail, broken in tyrutils-ericw-v0.15.3

This commit is contained in:
Eric Wasylishen 2016-03-04 15:38:08 -07:00
parent 8ed849f462
commit 98a020fde7
3 changed files with 8 additions and 4 deletions

View File

@ -110,6 +110,7 @@ typedef struct {
extern int numportals;
extern int portalleafs;
extern int portalleafs_real;
extern int *clustermap;
extern portal_t *portals;
extern leaf_t *leafs;

View File

@ -94,7 +94,11 @@ CalcAmbientSounds(bsp2_t *bsp)
for (j = 0; j < NUM_AMBIENTS; j++)
dists[j] = 1020;
vis = &uncompressed[i * leafbytes_real];
if (portalleafs != portalleafs_real) {
vis = &uncompressed[clustermap[i] * leafbytes_real];
} else {
vis = &uncompressed[i * leafbytes_real];
}
for (j = 0; j < portalleafs_real; j++) {
if (!(vis[j >> 3] & (1 << (j & 7))))

View File

@ -33,7 +33,7 @@ static byte *vismap_end; // past visfile
int originalvismapsize;
byte *uncompressed; // [leafbytes_real*portalleafs_real]
byte *uncompressed; // [leafbytes_real*portalleafs]
int leafbytes; // (portalleafs+63)>>3
int leaflongs;
@ -1275,8 +1275,7 @@ main(int argc, char **argv)
StripExtension(statetmpfile);
DefaultExtension(statetmpfile, ".vi0");
uncompressed = malloc(leafbytes_real * portalleafs_real);
memset(uncompressed, 0, leafbytes_real * portalleafs_real);
uncompressed = calloc(portalleafs, leafbytes_real);
// CalcPassages ();