5 |
|
#endif |
6 |
|
|
7 |
|
/* |
8 |
< |
* Holodeck beam tracking |
8 |
> |
* Holodeck beam tracking for display process |
9 |
|
*/ |
10 |
|
|
11 |
|
#include "rholo.h" |
15 |
|
extern int *getviewcells(); |
16 |
|
|
17 |
|
typedef struct { |
18 |
< |
int hd; /* holodeck section number */ |
18 |
> |
int hd; /* holodeck section number (-1 if inactive) */ |
19 |
|
int i[3]; /* voxel index (may be outside section) */ |
20 |
|
} VOXL; /* a voxel */ |
21 |
|
|
36 |
|
static int xcbeams = 0; /* extra (unregistered) beams past ncbeams */ |
37 |
|
static int maxcbeam = 0; /* size of cbeam array */ |
38 |
|
|
39 |
– |
|
39 |
|
struct cellact { |
40 |
|
short vi; /* voxel index */ |
41 |
|
short add; /* zero means delete */ |
42 |
|
}; /* action for cell */ |
43 |
|
|
45 |
– |
|
44 |
|
struct beamact { |
45 |
|
struct cellact ca; /* cell action */ |
46 |
|
GCOORD gc; /* grid coordinate */ |
290 |
|
copystruct(gc, gcp); |
291 |
|
copystruct(gc+1, &bp->gc); |
292 |
|
if ((bi = hdbindex(hdlist[voxel[bp->ca.vi].hd], gc)) <= 0) |
293 |
< |
return(0); /* should report an error? */ |
293 |
> |
error(CONSISTENCY, "bad grid coordinate in dobeam"); |
294 |
|
if (bp->ca.add) { /* add it in */ |
295 |
|
i = getcbeam(voxel[bp->ca.vi].hd, bi); |
296 |
|
cbeam[i].wants |= 1<<bp->ca.vi; /* say we want it */ |
401 |
|
} |
402 |
|
/* take care of list tails */ |
403 |
|
for (ca.add = 1; ncnt > 0; ncnt--) |
404 |
< |
docell(ngcp++, &ca); |
404 |
> |
netchange += docell(ngcp++, &ca); |
405 |
|
for (ca.add = 0; ocnt > 0; ocnt--) |
406 |
< |
docell(ogcp++, &ca); |
406 |
> |
netchange -= docell(ogcp++, &ca); |
407 |
|
/* clean up */ |
408 |
|
if (ocl != NULL) free((char *)ocl); |
409 |
|
if (ncl != NULL) free((char *)ncl); |