321 |
|
(*dev->comout)(buf); |
322 |
|
(*dev->comin)(buf, NULL); |
323 |
|
if (sscanf(buf, "%d", &i0) != 1) |
324 |
< |
break; |
324 |
> |
return(0); |
325 |
|
} |
326 |
|
ptr->i = i0; |
327 |
< |
break; |
327 |
> |
return(1); |
328 |
|
case 'r': /* real */ |
329 |
|
if (sscanf(str, "%lf", &d0) != 1) { |
330 |
|
(*dev->comout)(dsc); |
332 |
|
(*dev->comout)(buf); |
333 |
|
(*dev->comin)(buf, NULL); |
334 |
|
if (sscanf(buf, "%lf", &d0) != 1) |
335 |
< |
break; |
335 |
> |
return(0); |
336 |
|
} |
337 |
|
ptr->d = d0; |
338 |
< |
break; |
338 |
> |
return(1); |
339 |
|
case 'b': /* boolean */ |
340 |
|
if (sscanf(str, "%1s", buf) != 1) { |
341 |
|
(*dev->comout)(dsc); |
344 |
|
(*dev->comin)(buf, NULL); |
345 |
|
if (buf[0] == '\0' || |
346 |
|
index("yY+1tTnN-0fF", buf[0]) == NULL) |
347 |
< |
break; |
347 |
> |
return(0); |
348 |
|
} |
349 |
|
ptr->i = index("yY+1tT", buf[0]) != NULL; |
350 |
< |
break; |
350 |
> |
return(1); |
351 |
|
case 'C': /* color */ |
352 |
|
if (sscanf(str, "%lf %lf %lf", &d0, &d1, &d2) != 3) { |
353 |
|
(*dev->comout)(dsc); |
358 |
|
(*dev->comout)(buf); |
359 |
|
(*dev->comin)(buf, NULL); |
360 |
|
if (sscanf(buf, "%lf %lf %lf", &d0, &d1, &d2) != 3) |
361 |
< |
break; |
361 |
> |
return(0); |
362 |
|
} |
363 |
|
setcolor(ptr->C, d0, d1, d2); |
364 |
< |
break; |
364 |
> |
return(1); |
365 |
|
} |
366 |
|
} |
367 |
|
|
390 |
|
|
391 |
|
if (s[0] == '\0') { |
392 |
|
(*dev->comout)( |
393 |
< |
"aa ab ad ar as av b dc di dj dt i lr lw sp st: "); |
393 |
> |
"aa ab ad ar as av b dc di dj ds dt i lr lw sp st: "); |
394 |
|
(*dev->comin)(buf, NULL); |
395 |
|
s = buf; |
396 |
|
} |
453 |
|
getparam(s+2, "ambient bounces", 'i', &ambounce); |
454 |
|
break; |
455 |
|
case 'r': |
456 |
< |
getparam(s+2, "ambient resolution", 'i', &ambres); |
457 |
< |
minarad = ambres > 0 ? thescene.cusize/ambres : 0.0; |
456 |
> |
if (getparam(s+2, "ambient resolution", 'i', &ambres)) |
457 |
> |
minarad = ambres > 0 ? |
458 |
> |
thescene.cusize/ambres : 0.0; |
459 |
|
break; |
460 |
|
default: |
461 |
|
goto badparam; |
464 |
|
case 's': /* sample */ |
465 |
|
switch (s[1]) { |
466 |
|
case 'p': /* pixel */ |
467 |
< |
getparam(s+2, "sample pixel", 'i', &psample); |
468 |
< |
pdepth = 0; |
467 |
> |
if (getparam(s+2, "sample pixel", 'i', &psample)) |
468 |
> |
pdepth = 0; |
469 |
|
break; |
470 |
|
case 't': /* threshold */ |
471 |
< |
getparam(s+2, "sample threshold", 'r', &maxdiff); |
472 |
< |
pdepth = 0; |
471 |
> |
if (getparam(s+2, "sample threshold", 'r', &maxdiff)) |
472 |
> |
pdepth = 0; |
473 |
|
break; |
474 |
|
default: |
475 |
|
goto badparam; |