| 18 |
|
|
| 19 |
|
#include "otypes.h" |
| 20 |
|
|
| 21 |
– |
extern double atof(); |
| 21 |
|
static double getflt(); |
| 22 |
|
static long getint(); |
| 23 |
|
static char *getstr(); |
| 24 |
+ |
static int getobj(), octerror(); |
| 25 |
|
static OCTREE getfullnode(), gettree(); |
| 26 |
|
|
| 27 |
|
static char *infn; /* input file name */ |
| 43 |
|
int nf; |
| 44 |
|
OBJECT fnobjects; |
| 45 |
|
register int i; |
| 46 |
+ |
long m; |
| 47 |
|
|
| 48 |
|
if (fname == NULL) { |
| 49 |
|
infn = "standard input"; |
| 84 |
|
if (load & IO_FILES) |
| 85 |
|
ofn[nf] = NULL; |
| 86 |
|
/* get number of objects */ |
| 87 |
< |
fnobjects = getint(objsize); |
| 87 |
> |
fnobjects = m = getint(objsize); |
| 88 |
> |
if (fnobjects != m) |
| 89 |
> |
octerror(USER, "too many objects"); |
| 90 |
|
|
| 91 |
|
if (load & IO_TREE) { |
| 92 |
|
/* get the octree */ |
| 93 |
|
scene->cutree = gettree(); |
| 94 |
< |
/* get the scene */ |
| 95 |
< |
if (nf == 0 && load & IO_SCENE) { |
| 94 |
> |
if (load & IO_SCENE) /* get the scene */ |
| 95 |
> |
if (nf == 0) { |
| 96 |
|
for (i = 0; *getstr(sbuf); i++) |
| 97 |
|
if ((otypmap[i] = otype(sbuf)) < 0) { |
| 98 |
|
sprintf(errmsg, "unknown type \"%s\"", |
| 101 |
|
} |
| 102 |
|
while (getobj() != OVOID) |
| 103 |
|
; |
| 104 |
< |
} else if (load & IO_SCENE) { /* consistency checks */ |
| 105 |
< |
/* check object count */ |
| 104 |
> |
} else { /* consistency checks */ |
| 105 |
> |
/* check object count */ |
| 106 |
|
if (nobjects != objorig+fnobjects) |
| 107 |
|
octerror(USER, "bad object count; octree stale?"); |
| 108 |
< |
/* check for non-surfaces */ |
| 108 |
> |
/* check for non-surfaces */ |
| 109 |
|
if (nonsurfinset(objorig, fnobjects)) |
| 110 |
< |
octerror(USER, "non-surface in set; octree stale?"); |
| 111 |
< |
} |
| 110 |
> |
octerror(USER, "modifier in tree; octree stale?"); |
| 111 |
> |
} |
| 112 |
|
} |
| 113 |
|
fclose(infp); |
| 114 |
|
return(nf); |
| 138 |
|
register int i; |
| 139 |
|
register long m; |
| 140 |
|
|
| 141 |
< |
m = getint(objsize); |
| 139 |
< |
if (m > MAXSET) |
| 141 |
> |
if ((set[0] = getint(objsize)) > MAXSET) |
| 142 |
|
octerror(USER, "bad set in getfullnode"); |
| 141 |
– |
set[0] = m; |
| 143 |
|
for (i = 1; i <= set[0]; i++) { |
| 144 |
|
m = getint(objsize) + objorig; |
| 145 |
< |
if ((OBJECT)m != m) |
| 145 |
> |
if ((set[i] = m) != m) |
| 146 |
|
octerror(USER, "too many objects"); |
| 146 |
– |
set[i] = m; |
| 147 |
|
} |
| 148 |
|
return(fullnode(set)); |
| 149 |
|
} |
| 252 |
|
objp->oargs.iarg = NULL; |
| 253 |
|
#endif |
| 254 |
|
if (objp->oargs.nfargs = getint(2)) { |
| 255 |
< |
objp->oargs.farg = (double *)bmalloc |
| 256 |
< |
(objp->oargs.nfargs*sizeof(double)); |
| 255 |
> |
objp->oargs.farg = (FLOAT *)bmalloc |
| 256 |
> |
(objp->oargs.nfargs*sizeof(FLOAT)); |
| 257 |
|
if (objp->oargs.farg == NULL) |
| 258 |
|
goto memerr; |
| 259 |
|
for (i = 0; i < objp->oargs.nfargs; i++) |