1 |
|
#ifndef lint |
2 |
< |
static const char RCSid[] = "$Id$"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
4 |
|
/* |
5 |
|
* writeoct.c - routines for writing octree information to stdout. |
13 |
|
|
14 |
|
#include "object.h" |
15 |
|
|
16 |
< |
#include "otypes.h" |
16 |
> |
static int oputint(), oputstr(), puttree(); |
17 |
|
|
18 |
– |
static int oputint(), oputstr(), puttree(), putobj(); |
18 |
|
|
20 |
– |
|
19 |
|
writeoct(store, scene, ofn) /* write octree structures to stdout */ |
20 |
|
int store; |
21 |
|
CUBE *scene; |
22 |
|
char *ofn[]; |
23 |
|
{ |
24 |
|
char sbuf[64]; |
25 |
< |
register int i; |
25 |
> |
int i; |
26 |
|
/* write format number */ |
27 |
|
oputint((long)(OCTMAGIC+sizeof(OBJECT)), 2); |
28 |
|
|
51 |
|
if (store & IO_FILES || !(store & IO_SCENE)) |
52 |
|
return; |
53 |
|
/* write the scene */ |
54 |
< |
for (i = 0; i < NUMOTYPE; i++) |
57 |
< |
oputstr(ofun[i].funame); |
58 |
< |
oputstr(""); |
59 |
< |
for (i = 0; i < nobjects; i++) |
60 |
< |
putobj(objptr(i)); |
61 |
< |
putobj(NULL); |
54 |
> |
writescene(0, nobjects, stdout); |
55 |
|
} |
56 |
|
|
57 |
|
|
114 |
|
putfullnode(ot); /* write fullnode */ |
115 |
|
} else |
116 |
|
putc(OT_EMPTY, stdout); /* indicate empty */ |
124 |
– |
} |
125 |
– |
|
126 |
– |
|
127 |
– |
static |
128 |
– |
putobj(o) /* write out object */ |
129 |
– |
register OBJREC *o; |
130 |
– |
{ |
131 |
– |
register int i; |
132 |
– |
|
133 |
– |
if (o == NULL) { /* terminator */ |
134 |
– |
oputint(-1L, 1); |
135 |
– |
return; |
136 |
– |
} |
137 |
– |
oputint((long)o->otype, 1); |
138 |
– |
oputint((long)o->omod, sizeof(OBJECT)); |
139 |
– |
oputstr(o->oname); |
140 |
– |
oputint((long)o->oargs.nsargs, 2); |
141 |
– |
for (i = 0; i < o->oargs.nsargs; i++) |
142 |
– |
oputstr(o->oargs.sarg[i]); |
143 |
– |
#ifdef IARGS |
144 |
– |
oputint((long)o->oargs.niargs, 2); |
145 |
– |
for (i = 0; i < o->oargs.niargs; i++) |
146 |
– |
oputint((long)o->oargs.iarg[i], 4); |
147 |
– |
#endif |
148 |
– |
oputint((long)o->oargs.nfargs, 2); |
149 |
– |
for (i = 0; i < o->oargs.nfargs; i++) |
150 |
– |
oputflt(o->oargs.farg[i]); |
117 |
|
} |