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.19 by pippijn, Mon Jan 15 21:06:18 2007 UTC vs.
Revision 1.22 by elmex, Fri Feb 16 21:38:18 2007 UTC

41{ 41{
42 int x[4], y[4]; 42 int x[4], y[4];
43 int index; 43 int index;
44} blocks; 44} blocks;
45 45
46blocks block[MAP_CLIENT_X][MAP_CLIENT_Y]; 46blocks block[(MAP_CLIENT_X | 1) + 1][(MAP_CLIENT_Y | 1) + 1]; // still a speed hack
47 47
48static void expand_lighted_sight (object *op); 48static void expand_lighted_sight (object *op);
49 49
50/* 50/*
51 * Used to initialise the array used by the LOS routines. 51 * Used to initialise the array used by the LOS routines.
296 } 296 }
297 297
298 if (op->map->darkness > 0) /* player is on a dark map */ 298 if (op->map->darkness > 0) /* player is on a dark map */
299 expand_lighted_sight (op); 299 expand_lighted_sight (op);
300 300
301
302 /* clear mark squares */ 301 /* clear mark squares */
303 for (x = 0; x < op->contr->ns->mapx; x++) 302 for (x = 0; x < op->contr->ns->mapx; x++)
304 for (y = 0; y < op->contr->ns->mapy; y++) 303 for (y = 0; y < op->contr->ns->mapy; y++)
305 if (op->contr->blocked_los[x][y] < 0) 304 if (op->contr->blocked_los[x][y] < 0)
306 op->contr->blocked_los[x][y] = 0; 305 op->contr->blocked_los[x][y] = 0;
307} 306}
308
309
310
311 307
312/* returns true if op carries one or more lights 308/* returns true if op carries one or more lights
313 * This is a trivial function now days, but it used to 309 * This is a trivial function now days, but it used to
314 * be a bit longer. Probably better for callers to just 310 * be a bit longer. Probably better for callers to just
315 * check the op->glow_radius instead of calling this. 311 * check the op->glow_radius instead of calling this.
488 */ 484 */
489 for (x = (MAP_CLIENT_X - op->contr->ns->mapx) / 2 - 1; x < (MAP_CLIENT_X + op->contr->ns->mapx) / 2 + 1; x++) 485 for (x = (MAP_CLIENT_X - op->contr->ns->mapx) / 2 - 1; x < (MAP_CLIENT_X + op->contr->ns->mapx) / 2 + 1; x++)
490 for (y = (MAP_CLIENT_Y - op->contr->ns->mapy) / 2 - 1; y < (MAP_CLIENT_Y + op->contr->ns->mapy) / 2 + 1; y++) 486 for (y = (MAP_CLIENT_Y - op->contr->ns->mapy) / 2 - 1; y < (MAP_CLIENT_Y + op->contr->ns->mapy) / 2 + 1; y++)
491 check_wall (op, x, y); 487 check_wall (op, x, y);
492 488
493
494 /* do the los of the player. 3 (potential) cases */ 489 /* do the los of the player. 3 (potential) cases */
495 if (QUERY_FLAG (op, FLAG_BLIND)) /* player is blind */ 490 if (QUERY_FLAG (op, FLAG_BLIND)) /* player is blind */
496 blinded_sight (op); 491 blinded_sight (op);
497 else 492 else
498 expand_sight (op); 493 expand_sight (op);
499 494
495 //TODO: no range-checking whatsoever :(
500 if (QUERY_FLAG (op, FLAG_XRAYS)) 496 if (QUERY_FLAG (op, FLAG_XRAYS))
501 {
502 int x, y;
503
504 for (x = -2; x <= 2; x++) 497 for (int x = -2; x <= 2; x++)
505 for (y = -2; y <= 2; y++) 498 for (int y = -2; y <= 2; y++)
506 op->contr->blocked_los[dx + x][dy + y] = 0; 499 op->contr->blocked_los[dx + x][dy + y] = 0;
507 }
508} 500}
509 501
510/* update all_map_los is like update_all_los below, 502/* update all_map_los is like update_all_los below,
511 * but updates everyone on the map, no matter where they 503 * but updates everyone on the map, no matter where they
512 * are. This generally should not be used, as a per 504 * are. This generally should not be used, as a per

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines