24 |
|
|
25 |
|
HOLO *hdlist[HDMAX+1]; /* global holodeck list */ |
26 |
|
|
27 |
< |
char *hdofn[HDMAX+1]; /* holodeck section octree list */ |
27 |
> |
char *hdgfn[HDMAX]; /* holodeck section geometry list */ |
28 |
> |
char *hdpfn[HDMAX]; /* section portal list */ |
29 |
|
|
30 |
|
char cmdlist[DC_NCMDS][8] = DC_INIT; |
31 |
|
|
196 |
|
} |
197 |
|
|
198 |
|
|
199 |
< |
add_holo(hdg, ofn) /* register a new holodeck section */ |
199 |
> |
add_holo(hdg, gfn, pfn) /* register a new holodeck section */ |
200 |
|
HDGRID *hdg; |
201 |
< |
char *ofn; |
201 |
> |
char *gfn, *pfn; |
202 |
|
{ |
203 |
|
VIEW nv; |
204 |
|
double d; |
213 |
|
error(SYSTEM, "out of memory in add_holo"); |
214 |
|
bcopy((char *)hdg, (char *)hdlist[hd], sizeof(HDGRID)); |
215 |
|
hdcompgrid(hdlist[hd]); |
216 |
< |
hdofn[hd] = savestr(ofn); |
216 |
> |
hdgfn[hd] = savestr(gfn); |
217 |
> |
hdpfn[hd] = pfn && *pfn ? savestr(pfn) : (char *)NULL; |
218 |
|
if (hd) |
219 |
|
return; |
220 |
|
/* set initial viewpoint */ |
302 |
|
goto again; /* poss. overloading dev_section()? */ |
303 |
|
} |
304 |
|
DCHECK(*slist < 0, WARNING, "no visible sections in new_view"); |
305 |
< |
while (*slist >= 0) |
306 |
< |
dev_section(hdofn[*slist++]); |
305 |
> |
for ( ; *slist >= 0; slist++) |
306 |
> |
dev_section(hdgfn[*slist], hdpfn[*slist]); |
307 |
|
} |
308 |
< |
dev_section(NULL); /* end section list */ |
308 |
> |
dev_section(NULL,NULL); /* end section list */ |
309 |
|
dev_flush(); /* update display */ |
310 |
|
/* update server */ |
311 |
|
imm_mode = beam_sync(odev.firstuse) > 0; |
488 |
|
disp_bundle((PACKHEAD *)buf); |
489 |
|
break; |
490 |
|
case DS_ADDHOLO: |
491 |
< |
if (msg.nbytes <= sizeof(HDGRID)) |
491 |
> |
if (msg.nbytes < sizeof(HDGRID)+2) |
492 |
|
error(INTERNAL, "bad holodeck record from server"); |
493 |
< |
add_holo((HDGRID *)buf, buf+sizeof(HDGRID)); |
493 |
> |
add_holo((HDGRID *)buf, buf+sizeof(HDGRID), |
494 |
> |
buf+sizeof(HDGRID)+strlen(buf+sizeof(HDGRID))+1); |
495 |
|
break; |
496 |
|
case DS_OUTSECT: |
497 |
|
do_outside = 1; |
502 |
|
break; |
503 |
|
case DS_STARTIMM: |
504 |
|
case DS_ENDIMM: |
505 |
+ |
if (!(imm_mode = msg.type==DS_STARTIMM)) |
506 |
+ |
dev_flush(); |
507 |
|
#ifdef DEBUG |
508 |
|
{ |
509 |
|
time_t tnow = time(NULL); |
512 |
|
tmodesw = tnow; |
513 |
|
} |
514 |
|
#endif |
510 |
– |
if (!(imm_mode = msg.type==DS_STARTIMM)) |
511 |
– |
dev_flush(); |
515 |
|
goto noargs; |
516 |
|
case DS_ACKNOW: |
517 |
|
case DS_SHUTDOWN: |
582 |
|
quit(code) /* clean up and exit */ |
583 |
|
int code; |
584 |
|
{ |
585 |
+ |
if (code) |
586 |
+ |
exit(code); |
587 |
|
if (odev.v.type) |
588 |
|
dev_close(); |
589 |
< |
exit(code); |
589 |
> |
exit(0); |
590 |
|
} |