version 1.10 | | version 1.11 |
---|
| | |
/* | | /* |
* static char *rcsid_los_c = | | * static char *rcsid_los_c = |
* "$Id: los.c,v 1.10 2003/04/02 08:12:53 mwedel Exp $"; | | * "$Id: los.c,v 1.11 2005/04/16 05:30:47 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
| | |
void expand_lighted_sight(object *op) | | void expand_lighted_sight(object *op) |
{ | | { |
int x,y,darklevel,ax,ay, basex, basey, mflags, light; | | int x,y,darklevel,ax,ay, basex, basey, mflags, light, x1, y1; |
mapstruct *m=op->map; | | mapstruct *m=op->map; |
sint16 nx, ny; | | sint16 nx, ny; |
| | |
| | |
* spaces around here. | | * spaces around here. |
*/ | | */ |
light = GET_MAP_LIGHT(m, nx, ny); | | light = GET_MAP_LIGHT(m, nx, ny); |
if (light) { | | if (light != 0) { |
#if 0 | | #if 0 |
fprintf(stderr,"expand_lighted_sight: Found light at x=%d, y=%d, basex=%d, basey=%d\n", | | fprintf(stderr,"expand_lighted_sight: Found light at x=%d, y=%d, basex=%d, basey=%d\n", |
x, y, basex, basey); | | x, y, basex, basey); |
| | |
| | |
/* If the space is fully blocked, do nothing. Otherwise, we | | /* If the space is fully blocked, do nothing. Otherwise, we |
* brighten the space. The further the light is away from the | | * brighten the space. The further the light is away from the |
* source (basex-x), the less effect it has. Note that as done | | * source (basex-x), the less effect it has. Though light used |
* done now, light dims in effectively a square manner. for light radius | | * to dim in a square manner, it now dims in a circular manner |
* as small as they are (4), this probably isn't terrible, but should | | * using the the pythagorean theorem. glow_radius still |
* perhaps be fixed. It wouldn't be hard to creat a lookup table | | * represents the radius |
* (dimming[abs(base-x)][abs(basey-y)]) that is actually calculated | | */ |
* properly (ie, if the light is +2,+2, the dimming would be | | if(op->contr->blocked_los[ax][ay]!=100) { |
* 3 (2.82 or sqrt(8)) and not 2 like it is right now. | | x1 = abs(basex-ax)*abs(basex-ax); |
*/ | | y1 = abs(basey-ay)*abs(basey-ay); |
if(op->contr->blocked_los[ax][ay]!=100) | | op->contr->blocked_los[ax][ay]-= MAX((light - sqrt(x1 + y1)), 0); |
op->contr->blocked_los[ax][ay]-= (light - | | } |
MAX(abs(basex-ax),abs(basey -ay))); | | |
} /* for ay */ | | } /* for ay */ |
} /* for ax */ | | } /* for ax */ |
} /* if this space is providing light */ | | } /* if this space is providing light */ |