--- ray/src/rt/source.c 2003/12/31 19:38:27 2.40 +++ ray/src/rt/source.c 2004/01/18 17:03:12 2.42 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: source.c,v 2.40 2003/12/31 19:38:27 greg Exp $"; +static const char RCSid[] = "$Id: source.c,v 2.42 2004/01/18 17:03:12 greg Exp $"; #endif /* * source.c - routines dealing with illumination sources. @@ -415,7 +415,7 @@ char *p /* data for f */ if (bright(sr.rcol) <= FTINY) { #if SHADCACHE if ((scp <= srccnt || scp[-1].sno != scp->sno) - && (scp >= srccnt+ncnts || + && (scp >= srccnt+ncnts-1 || scp[1].sno != scp->sno)) srcblocker(&sr); #endif @@ -544,12 +544,11 @@ register RAY *r */ static int -weaksrcmat(int obj) /* identify material */ +weaksrcmat(OBJECT obj) /* identify material */ { - register OBJREC *o = objptr(obj); + OBJREC *o = findmaterial(objptr(obj)); - while (!ismaterial(o->otype)) /* find material */ - o = objptr(o->omod); + if (o == NULL) return 0; return((o->otype==MAT_ILLUM)|(o->otype==MAT_GLOW)); }