mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-30 20:50:42 +00:00
fix the missing LOCK and UNLOCK defs (found by accident:) and use a dstring
for building the compressed vis data
This commit is contained in:
parent
b59a945566
commit
544d4d6ff8
2 changed files with 29 additions and 42 deletions
|
@ -29,7 +29,11 @@
|
||||||
#ifndef __vis_h
|
#ifndef __vis_h
|
||||||
#define __vis_h
|
#define __vis_h
|
||||||
|
|
||||||
#ifdef __alpha
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_PTHREAD_H
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
extern pthread_mutex_t *my_mutex;
|
extern pthread_mutex_t *my_mutex;
|
||||||
#define LOCK pthread_mutex_lock (my_mutex)
|
#define LOCK pthread_mutex_lock (my_mutex)
|
||||||
|
|
|
@ -85,7 +85,7 @@ int leafon; // the next leaf to be given to a thread to process
|
||||||
portal_t *portals;
|
portal_t *portals;
|
||||||
leaf_t *leafs;
|
leaf_t *leafs;
|
||||||
qboolean showgetleaf = true;
|
qboolean showgetleaf = true;
|
||||||
byte *vismap, *vismap_p, *vismap_end; // past visfile
|
dstring_t *visdata;
|
||||||
byte *uncompressed; // [bitbytes * portalleafs]
|
byte *uncompressed; // [bitbytes * portalleafs]
|
||||||
|
|
||||||
|
|
||||||
|
@ -410,7 +410,7 @@ CompressRow (byte *vis, byte *dest)
|
||||||
void
|
void
|
||||||
LeafFlow (int leafnum)
|
LeafFlow (int leafnum)
|
||||||
{
|
{
|
||||||
byte *dest, *outbuffer;
|
byte *outbuffer;
|
||||||
byte compressed[MAX_MAP_LEAFS / 8];
|
byte compressed[MAX_MAP_LEAFS / 8];
|
||||||
int numvis, i, j;
|
int numvis, i, j;
|
||||||
leaf_t *leaf;
|
leaf_t *leaf;
|
||||||
|
@ -449,24 +449,8 @@ LeafFlow (int leafnum)
|
||||||
i = CompressRow (outbuffer, compressed);
|
i = CompressRow (outbuffer, compressed);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dest = vismap_p;
|
bsp->leafs[leafnum + 1].visofs = visdata->size;
|
||||||
vismap_p += i;
|
dstring_append (visdata, compressed, i);
|
||||||
|
|
||||||
if (vismap_p > vismap_end) {
|
|
||||||
int d = dest - bsp->visdata;
|
|
||||||
int p = vismap_p - bsp->visdata;
|
|
||||||
int e = vismap_end - bsp->visdata;
|
|
||||||
bsp->visdatasize = p;
|
|
||||||
vismap = bsp->visdata = realloc (bsp->visdata, bsp->visdatasize);
|
|
||||||
dest = bsp->visdata + d;
|
|
||||||
vismap_p = bsp->visdata + p;
|
|
||||||
vismap_end = bsp->visdata + e;
|
|
||||||
fprintf (stderr, "Vismap grown\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
bsp->leafs[leafnum + 1].visofs = dest - vismap; // leaf 0 is a common solid
|
|
||||||
|
|
||||||
memcpy (dest, compressed, i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -764,9 +748,6 @@ LoadPortals (char *name)
|
||||||
|
|
||||||
originalvismapsize = portalleafs * ((portalleafs + 7) / 8);
|
originalvismapsize = portalleafs * ((portalleafs + 7) / 8);
|
||||||
|
|
||||||
vismap = vismap_p = bsp->visdata;
|
|
||||||
vismap_end = vismap + bsp->visdatasize;
|
|
||||||
|
|
||||||
for (i = 0, portal = portals; i < numportals; i++) {
|
for (i = 0, portal = portals; i < numportals; i++) {
|
||||||
if (fscanf (f, "%i %i %i ", &numpoints, &leafnums[0],
|
if (fscanf (f, "%i %i %i ", &numpoints, &leafnums[0],
|
||||||
&leafnums[1]) != 3)
|
&leafnums[1]) != 3)
|
||||||
|
@ -852,6 +833,8 @@ main (int argc, char **argv)
|
||||||
bsp = LoadBSPFile (f, Qfilesize (f));
|
bsp = LoadBSPFile (f, Qfilesize (f));
|
||||||
Qclose (f);
|
Qclose (f);
|
||||||
|
|
||||||
|
visdata = dstring_new ();
|
||||||
|
|
||||||
portalfile->size = strlen (options.bspfile) + 1;
|
portalfile->size = strlen (options.bspfile) + 1;
|
||||||
dstring_adjust (portalfile);
|
dstring_adjust (portalfile);
|
||||||
COM_StripExtension (options.bspfile, portalfile->str);
|
COM_StripExtension (options.bspfile, portalfile->str);
|
||||||
|
@ -866,7 +849,7 @@ main (int argc, char **argv)
|
||||||
if (options.verbosity >= 0)
|
if (options.verbosity >= 0)
|
||||||
printf ("c_chains: %i\n", c_chains);
|
printf ("c_chains: %i\n", c_chains);
|
||||||
|
|
||||||
bsp->visdatasize = vismap_p - bsp->visdata;
|
BSP_AddVisibility (bsp, visdata->str, visdata->size);
|
||||||
if (options.verbosity >= 0)
|
if (options.verbosity >= 0)
|
||||||
printf ("visdatasize:%i compressed from %i\n", bsp->visdatasize,
|
printf ("visdatasize:%i compressed from %i\n", bsp->visdatasize,
|
||||||
originalvismapsize);
|
originalvismapsize);
|
||||||
|
|
Loading…
Reference in a new issue