… | |
… | |
144 | * area. l is the distance from x,y to the line. |
144 | * area. l is the distance from x,y to the line. |
145 | * r is more a curiosity - it lets us know what direction (left/right) |
145 | * r is more a curiosity - it lets us know what direction (left/right) |
146 | * the line is off |
146 | * the line is off |
147 | */ |
147 | */ |
148 | |
148 | |
149 | d1 = (float) (pow (MAP_CLIENT_X / 2 - dx, 2) + pow (MAP_CLIENT_Y / 2 - dy, 2)); |
149 | d1 = (float) (pow (MAP_CLIENT_X / 2 - dx, 2.f) + pow (MAP_CLIENT_Y / 2 - dy, 2.f)); |
150 | r = (float) ((dy - y) * (dy - MAP_CLIENT_Y / 2) - (dx - x) * (MAP_CLIENT_X / 2 - dx)) / d1; |
150 | r = (float) ((dy - y) * (dy - MAP_CLIENT_Y / 2) - (dx - x) * (MAP_CLIENT_X / 2 - dx)) / d1; |
151 | s = (float) ((dy - y) * (MAP_CLIENT_X / 2 - dx) - (dx - x) * (MAP_CLIENT_Y / 2 - dy)) / d1; |
151 | s = (float) ((dy - y) * (MAP_CLIENT_X / 2 - dx) - (dx - x) * (MAP_CLIENT_Y / 2 - dy)) / d1; |
152 | l = FABS (sqrt (d1) * s); |
152 | l = FABS (sqrt (d1) * s); |
153 | |
153 | |
154 | if (l <= SPACE_BLOCK) |
154 | if (l <= SPACE_BLOCK) |
… | |
… | |
327 | |
327 | |
328 | static void |
328 | static void |
329 | expand_lighted_sight (object *op) |
329 | expand_lighted_sight (object *op) |
330 | { |
330 | { |
331 | int x, y, darklevel, ax, ay, basex, basey, mflags, light, x1, y1; |
331 | int x, y, darklevel, ax, ay, basex, basey, mflags, light, x1, y1; |
332 | mapstruct *m = op->map; |
332 | maptile *m = op->map; |
333 | sint16 nx, ny; |
333 | sint16 nx, ny; |
334 | |
334 | |
335 | darklevel = MAP_DARKNESS (m); |
335 | darklevel = MAP_DARKNESS (m); |
336 | |
336 | |
337 | /* If the player can see in the dark, lower the darklevel for him */ |
337 | /* If the player can see in the dark, lower the darklevel for him */ |
… | |
… | |
517 | * players, which is should not be. |
517 | * players, which is should not be. |
518 | * Currently, this function is called from the |
518 | * Currently, this function is called from the |
519 | * change_map_light function |
519 | * change_map_light function |
520 | */ |
520 | */ |
521 | void |
521 | void |
522 | update_all_map_los (mapstruct *map) |
522 | update_all_map_los (maptile *map) |
523 | { |
523 | { |
524 | player *pl; |
524 | player *pl; |
525 | |
525 | |
526 | for (pl = first_player; pl != NULL; pl = pl->next) |
526 | for (pl = first_player; pl != NULL; pl = pl->next) |
527 | { |
527 | { |
… | |
… | |
543 | * |
543 | * |
544 | * map is the map that changed, x and y are the coordinates. |
544 | * map is the map that changed, x and y are the coordinates. |
545 | */ |
545 | */ |
546 | |
546 | |
547 | void |
547 | void |
548 | update_all_los (const mapstruct *map, int x, int y) |
548 | update_all_los (const maptile *map, int x, int y) |
549 | { |
549 | { |
550 | player *pl; |
550 | player *pl; |
551 | |
551 | |
552 | for (pl = first_player; pl != NULL; pl = pl->next) |
552 | for (pl = first_player; pl != NULL; pl = pl->next) |
553 | { |
553 | { |