ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/los.C
(Generate patch)

Comparing deliantra/server/common/los.C (file contents):
Revision 1.4 by root, Sun Sep 10 16:00:23 2006 UTC vs.
Revision 1.7 by root, Mon Dec 11 21:32:16 2006 UTC

1
2/*
3 * static char *rcsid_los_c =
4 * "$Id: los.C,v 1.4 2006/09/10 16:00:23 root Exp $";
5 */
6
7/* 1/*
8 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
9 3
10 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
11 Copyright (C) 1992 Frank Tore Johansen 5 Copyright (C) 1992 Frank Tore Johansen
22 16
23 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 20
27 The authors can be reached via e-mail at crossfire-devel@real-time.com 21 The authors can be reached via e-mail at <crossfire@schmorp.de>
28*/ 22*/
29 23
30/* Nov 95 - inserted USE_LIGHTING code stuff in here - b.t. */ 24/* Nov 95 - inserted USE_LIGHTING code stuff in here - b.t. */
31 25
32#include <global.h> 26#include <global.h>
150 * area. l is the distance from x,y to the line. 144 * area. l is the distance from x,y to the line.
151 * 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)
152 * the line is off 146 * the line is off
153 */ 147 */
154 148
155 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));
156 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;
157 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;
158 l = FABS (sqrt (d1) * s); 152 l = FABS (sqrt (d1) * s);
159 153
160 if (l <= SPACE_BLOCK) 154 if (l <= SPACE_BLOCK)
333 327
334static void 328static void
335expand_lighted_sight (object *op) 329expand_lighted_sight (object *op)
336{ 330{
337 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;
338 mapstruct *m = op->map; 332 maptile *m = op->map;
339 sint16 nx, ny; 333 sint16 nx, ny;
340 334
341 darklevel = MAP_DARKNESS (m); 335 darklevel = MAP_DARKNESS (m);
342 336
343 /* 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 */
523 * players, which is should not be. 517 * players, which is should not be.
524 * Currently, this function is called from the 518 * Currently, this function is called from the
525 * change_map_light function 519 * change_map_light function
526 */ 520 */
527void 521void
528update_all_map_los (mapstruct *map) 522update_all_map_los (maptile *map)
529{ 523{
530 player *pl; 524 player *pl;
531 525
532 for (pl = first_player; pl != NULL; pl = pl->next) 526 for (pl = first_player; pl != NULL; pl = pl->next)
533 { 527 {
549 * 543 *
550 * 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.
551 */ 545 */
552 546
553void 547void
554update_all_los (const mapstruct *map, int x, int y) 548update_all_los (const maptile *map, int x, int y)
555{ 549{
556 player *pl; 550 player *pl;
557 551
558 for (pl = first_player; pl != NULL; pl = pl->next) 552 for (pl = first_player; pl != NULL; pl = pl->next)
559 { 553 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines