109 |
|
register int i; |
110 |
|
|
111 |
|
src->sflags = 0; |
112 |
+ |
src->aimsuccess = 2*AIMREQT-1; /* bitch on second failure */ |
113 |
|
src->nhits = 1; src->ntests = 2; /* start probability = 1/2 */ |
114 |
|
src->so = so; |
115 |
|
|
215 |
|
} |
216 |
|
if (dstrsrc > FTINY) { |
217 |
|
/* distribute source direction */ |
218 |
< |
for (i = 0; i < 3; i++) |
219 |
< |
vd[i] = dstrsrc * source[sn].ss * (1.0 - 2.0*frandom()); |
220 |
< |
|
218 |
> |
dimlist[ndims++] = sn; |
219 |
> |
for (i = 0; i < 3; i++) { |
220 |
> |
dimlist[ndims] = i + 8831; |
221 |
> |
vd[i] = dstrsrc * source[sn].ss * |
222 |
> |
(1.0 - 2.0*urand(ilhash(dimlist,ndims+1)+samplendx)); |
223 |
> |
} |
224 |
> |
ndims--; |
225 |
|
if (norm != NULL) { /* project offset */ |
226 |
|
d = DOT(vd, norm); |
227 |
|
for (i = 0; i < 3; i++) |
342 |
|
if (cntord[sn].brt <= 0.0) |
343 |
|
continue; |
344 |
|
/* compute intersection */ |
345 |
< |
if (!( source[sn].sflags & SDISTANT ? |
345 |
> |
if (source[sn].sflags & SDISTANT ? |
346 |
|
sourcehit(&sr) : |
347 |
|
(*ofun[source[sn].so->otype].funp) |
348 |
< |
(source[sn].so, &sr) )) { |
348 |
> |
(source[sn].so, &sr)) { |
349 |
> |
if (source[sn].aimsuccess >= 0) |
350 |
> |
source[sn].aimsuccess++; |
351 |
> |
} else { |
352 |
> |
cntord[sn].brt = 0.0; |
353 |
> |
if (source[sn].aimsuccess < 0) |
354 |
> |
continue; /* bitched already */ |
355 |
> |
source[sn].aimsuccess -= AIMREQT; |
356 |
> |
if (source[sn].aimsuccess >= 0) |
357 |
> |
continue; /* leniency */ |
358 |
|
sprintf(errmsg, |
359 |
|
"aiming failure for light source \"%s\"", |
360 |
|
source[sn].so->oname); |
361 |
|
error(WARNING, errmsg); |
348 |
– |
cntord[sn].brt = 0.0; |
362 |
|
continue; |
363 |
|
} |
364 |
|
/* compute contribution */ |
473 |
|
m->oargs.farg[2]); |
474 |
|
/* modify value */ |
475 |
|
multcolor(r->rcol, r->pcol); |
463 |
– |
/* assign distance */ |
464 |
– |
r->rt = r->rot; |
476 |
|
} |
477 |
|
} |