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.48 by root, Tue Dec 23 06:58:23 2008 UTC vs.
Revision 1.56 by root, Thu Jan 8 19:23:44 2009 UTC

19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * 20 *
21 * The authors can be reached via e-mail to <support@deliantra.net> 21 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 22 */
23 23
24/* Nov 95 - inserted USE_LIGHTING code stuff in here - b.t. */
25
26#include <global.h> 24#include <global.h>
27#include <cmath> 25#include <cmath>
28 26
29static void expand_lighted_sight (object *op); 27#define SEE_IN_DARK_RADIUS 2
30 28
29// los flags
31enum { 30enum {
32 LOS_XI = 0x01, 31 FLG_XI = 0x01, // we have an x-parent
33 LOS_YI = 0x02, 32 FLG_YI = 0x02, // we have an y-parent
33 FLG_BLOCKED = 0x04, // this space blocks the view
34 FLG_QUEUED = 0x80 // already queued in queue, or border
34}; 35};
35 36
36struct los_info 37struct los_info
37{ 38{
39 uint8 flags; // FLG_xxx
40 uint8 culled; // culled from "tree"
41 uint8 visible;
42 uint8 pad0;
43
38 sint8 xo, yo; // obscure angle 44 sint8 xo, yo; // obscure angle
39 sint8 xe, ye; // angle deviation 45 sint8 xe, ye; // angle deviation
40 uint8 culled; // culled from "tree"
41 uint8 queued; // already queued
42 uint8 visible;
43 uint8 flags; // LOS_XI/YI
44}; 46};
45 47
46// temporary storage for the los algorithm, 48// temporary storage for the los algorithm,
47// one los_info for each lightable map space 49// one los_info for each lightable map space
48static los_info los[MAP_CLIENT_X][MAP_CLIENT_Y]; 50static los_info los[MAP_CLIENT_X][MAP_CLIENT_Y];
75enqueue (sint8 dx, sint8 dy, uint8 flags = 0) 77enqueue (sint8 dx, sint8 dy, uint8 flags = 0)
76{ 78{
77 sint8 x = LOS_X0 + dx; 79 sint8 x = LOS_X0 + dx;
78 sint8 y = LOS_Y0 + dy; 80 sint8 y = LOS_Y0 + dy;
79 81
80 if (x < 0 || x >= MAP_CLIENT_X) return;
81 if (y < 0 || y >= MAP_CLIENT_Y) return;
82
83 los_info &l = los[x][y]; 82 los_info &l = los[x][y];
84 83
85 l.flags |= flags; 84 l.flags |= flags;
86 85
87 if (l.queued) 86 if (l.flags & FLG_QUEUED)
88 return; 87 return;
89 88
90 l.queued = 1; 89 l.flags |= FLG_QUEUED;
91 90
92 queue[q1].x = dx; 91 queue[q1].x = dx;
93 queue[q1].y = dy; 92 queue[q1].y = dy;
94 93
95 q1 = (q1 + 1) & (QUEUE_LENGTH - 1); 94 q1 = (q1 + 1) & (QUEUE_LENGTH - 1);
101// which has been simplified and changed considerably, but 100// which has been simplified and changed considerably, but
102// still is basically the same algorithm. 101// still is basically the same algorithm.
103static void 102static void
104calculate_los (player *pl) 103calculate_los (player *pl)
105{ 104{
106 int max_radius = max (pl->ns->mapx, pl->ns->mapy) / 2; 105 {
107
108 memset (los, 0, sizeof (los)); 106 memset (los, 0, sizeof (los));
107
108 // we keep one line for ourselves, for the border flag
109 // so the client area is actually MAP_CLIENT_(X|Y) - 2
110 int half_x = min (LOS_X0 - 1, pl->ns->mapx / 2);
111 int half_y = min (LOS_Y0 - 1, pl->ns->mapy / 2);
112
113 // create borders, the corners are not touched
114 for (int dx = -half_x; dx <= half_x; ++dx)
115 los [dx + LOS_X0][LOS_Y0 - (half_y + 1)].flags =
116 los [dx + LOS_X0][LOS_Y0 + (half_y + 1)].flags = FLG_QUEUED;
117
118 for (int dy = -half_y; dy <= half_y; ++dy)
119 los [LOS_X0 - (half_x + 1)][dy + LOS_Y0].flags =
120 los [LOS_X0 + (half_x + 1)][dy + LOS_Y0].flags = FLG_QUEUED;
121
122 // now reset the los area and also add blocked flags
123 // which supposedly is faster than doing it inside the
124 // spiral path algorithm below, except when very little
125 // area is visible, in which case it is slower. which evens
126 // out los calculation times between large and small los maps.
127 // apply_lights also iterates over this area, maybe these
128 // two passes could be combined somehow.
129 unordered_mapwalk (pl->observe, -half_x, -half_y, half_x, half_y)
130 {
131 los_info &l = los [LOS_X0 + dx][LOS_Y0 + dy];
132 l.flags = m->at (nx, ny).flags () & P_BLOCKSVIEW ? FLG_BLOCKED : 0;
133 }
134 }
109 135
110 q1 = 0; q2 = 0; // initialise queue, not strictly required 136 q1 = 0; q2 = 0; // initialise queue, not strictly required
111 enqueue (0, 0); // enqueue center 137 enqueue (0, 0); // enqueue center
112 138
113 // treat the origin specially 139 // treat the origin specially
126 q2 = (q2 + 1) & (QUEUE_LENGTH - 1); 152 q2 = (q2 + 1) & (QUEUE_LENGTH - 1);
127 153
128 sint8 x = LOS_X0 + dx; 154 sint8 x = LOS_X0 + dx;
129 sint8 y = LOS_Y0 + dy; 155 sint8 y = LOS_Y0 + dy;
130 156
131 //int distance = idistance (dx, dy); if (distance > max_radius) continue;//D
132 int distance = 0;//D
133
134 los_info &l = los[x][y]; 157 los_info &l = los[x][y];
135 158
136 if (expect_true (l.flags & (LOS_XI | LOS_YI))) 159 if (expect_true (l.flags & (FLG_XI | FLG_YI)))
137 { 160 {
138 l.culled = 1; 161 l.culled = 1;
162 l.xo = l.yo = l.xe = l.ye = 0;
139 163
140 // check contributing spaces, first horizontal 164 // check contributing spaces, first horizontal
141 if (expect_true (l.flags & LOS_XI)) 165 if (expect_true (l.flags & FLG_XI))
142 { 166 {
143 los_info *xi = &los[x - sign (dx)][y]; 167 los_info *xi = &los[x - sign (dx)][y];
144 168
145 // don't cull unless obscured 169 // don't cull unless obscured
146 l.culled &= !xi->visible; 170 l.culled &= !xi->visible;
171 } 195 }
172 } 196 }
173 } 197 }
174 198
175 // check contributing spaces, last vertical, identical structure 199 // check contributing spaces, last vertical, identical structure
176 if (expect_true (l.flags & LOS_YI)) 200 if (expect_true (l.flags & FLG_YI))
177 { 201 {
178 los_info *yi = &los[x][y - sign (dy)]; 202 los_info *yi = &los[x][y - sign (dy)];
179 203
180 // don't cull unless obscured 204 // don't cull unless obscured
181 l.culled &= !yi->visible; 205 l.culled &= !yi->visible;
205 l.xo = yi->xo; 229 l.xo = yi->xo;
206 } 230 }
207 } 231 }
208 } 232 }
209 233
210 // check whether this space blocks the view 234 if (l.flags & FLG_BLOCKED)
211 maptile *m = pl->observe->map;
212 sint16 nx = pl->observe->x + dx;
213 sint16 ny = pl->observe->y + dy;
214
215 if (expect_true (!xy_normalise (m, nx, ny))
216 || expect_false (m->at (nx, ny).flags () & P_BLOCKSVIEW))
217 { 235 {
218 l.xo = l.xe = abs (dx); 236 l.xo = l.xe = abs (dx);
219 l.yo = l.ye = abs (dy); 237 l.yo = l.ye = abs (dy);
220 238
221 // we obscure dependents, but might be visible 239 // we obscure dependents, but might be visible
222 // copy the los from the square towards the player, 240 // copy the los from the square towards the player,
223 // so outward diagonal corners are lit. 241 // so outward diagonal corners are lit.
224 pl->los[x][y] = los[x - sign0 (dx)][y - sign0 (dy)].visible ? 0 : LOS_BLOCKED; 242 pl->los[x][y] = los[x - sign0 (dx)][y - sign0 (dy)].visible ? 0 : LOS_BLOCKED;
243
225 l.visible = false; 244 l.visible = false;
226 } 245 }
227 else 246 else
228 { 247 {
229 // we are not blocked, so calculate visibility, by checking 248 // we are not blocked, so calculate visibility, by checking
230 // whether we are inside or outside the shadow 249 // whether we are inside or outside the shadow
231 l.visible = (l.xe <= 0 || l.xe > l.xo) 250 l.visible = (l.xe <= 0 || l.xe > l.xo)
232 && (l.ye <= 0 || l.ye > l.yo); 251 && (l.ye <= 0 || l.ye > l.yo);
233 252
234 pl->los[x][y] = l.culled ? LOS_BLOCKED 253 pl->los[x][y] = l.culled ? LOS_BLOCKED
235 : l.visible ? max (0, 2 - max_radius + distance) 254 : l.visible ? 0
236 : 3; 255 : 3;
237 } 256 }
238 257
239 } 258 }
240 259
241 // Expands by the unit length in each component's current direction. 260 // Expands by the unit length in each component's current direction.
242 // If a component has no direction, then it is expanded in both of its 261 // If a component has no direction, then it is expanded in both of its
243 // positive and negative directions. 262 // positive and negative directions.
244 if (!l.culled) 263 if (!l.culled)
245 { 264 {
246 if (dx >= 0) enqueue (dx + 1, dy, LOS_XI); 265 if (dx >= 0) enqueue (dx + 1, dy, FLG_XI);
247 if (dx <= 0) enqueue (dx - 1, dy, LOS_XI); 266 if (dx <= 0) enqueue (dx - 1, dy, FLG_XI);
248 if (dy >= 0) enqueue (dx, dy + 1, LOS_YI); 267 if (dy >= 0) enqueue (dx, dy + 1, FLG_YI);
249 if (dy <= 0) enqueue (dx, dy - 1, LOS_YI); 268 if (dy <= 0) enqueue (dx, dy - 1, FLG_YI);
250 } 269 }
251 } 270 }
252} 271}
253 272
254/* returns true if op carries one or more lights
255 * This is a trivial function now days, but it used to
256 * be a bit longer. Probably better for callers to just
257 * check the op->glow_radius instead of calling this.
258 */
259int
260has_carried_lights (const object *op)
261{
262 /* op may glow! */
263 if (op->glow_radius > 0)
264 return 1;
265
266 return 0;
267}
268
269/* radius, distance => lightness adjust */ 273/* radius, distance => lightness adjust */
270static sint8 light_atten[MAX_LIGHT_RADIUS * 2 + 1][MAX_LIGHT_RADIUS * 3 / 2 + 1]; 274static sint8 light_atten[MAX_LIGHT_RADIUS * 2 + 1][MAX_LIGHT_RADIUS * 3 / 2 + 1];
271static sint8 vision_atten[MAX_DARKNESS + 1][MAX_DARKNESS * 3 / 2 + 1]; 275static sint8 vision_atten[MAX_DARKNESS + SEE_IN_DARK_RADIUS + 1][(MAX_DARKNESS + SEE_IN_DARK_RADIUS) * 3 / 2 + 1];
272 276
273static struct los_init 277static struct los_init
274{ 278{
275 los_init () 279 los_init ()
276 { 280 {
281 assert (("QUEUE_LENGTH, MAP_CLIENT_X and MAP_CLIENT_Y *must* be powers of two",
282 !(QUEUE_LENGTH & (QUEUE_LENGTH - 1))));
283
277 /* for lights */ 284 /* for lights */
278 for (int radius = -MAX_LIGHT_RADIUS; radius <= MAX_LIGHT_RADIUS; ++radius) 285 for (int radius = -MAX_LIGHT_RADIUS; radius <= MAX_LIGHT_RADIUS; ++radius)
279 for (int distance = 0; distance <= MAX_LIGHT_RADIUS * 3 / 2; ++distance) 286 for (int distance = 0; distance <= MAX_LIGHT_RADIUS * 3 / 2; ++distance)
280 { 287 {
281 // max intensity 288 // max intensity
288 ? min (3, intensity) 295 ? min (3, intensity)
289 : LOS_MAX - intensity; 296 : LOS_MAX - intensity;
290 } 297 }
291 298
292 /* for general vision */ 299 /* for general vision */
293 for (int radius = 0; radius <= MAX_DARKNESS; ++radius) 300 for (int radius = 0; radius <= MAX_DARKNESS + SEE_IN_DARK_RADIUS; ++radius)
294 for (int distance = 0; distance <= MAX_DARKNESS * 3 / 2; ++distance) 301 for (int distance = 0; distance <= (MAX_DARKNESS + SEE_IN_DARK_RADIUS) * 3 / 2; ++distance)
295 {
296 vision_atten [radius][distance] = distance <= radius ? 3 : 4; 302 vision_atten [radius][distance] = distance <= radius ? 3 : 4;
297 }
298 } 303 }
299} los_init; 304} los_init;
300 305
301sint8 306sint8
302los_brighten (sint8 b, sint8 l) 307los_brighten (sint8 b, sint8 l)
339apply_lights (player *pl) 344apply_lights (player *pl)
340{ 345{
341 object *op = pl->observe; 346 object *op = pl->observe;
342 int darklevel = op->map->darklevel (); 347 int darklevel = op->map->darklevel ();
343 348
344 /* If the player can see in the dark, lower the darklevel for him */
345 if (op->flag [FLAG_SEE_IN_DARK])
346 darklevel = max (0, darklevel - 2);
347
348 int half_x = pl->ns->mapx / 2; 349 int half_x = pl->ns->mapx / 2;
349 int half_y = pl->ns->mapy / 2; 350 int half_y = pl->ns->mapy / 2;
350 351
351 int min_x = op->x - half_x - MAX_LIGHT_RADIUS;
352 int min_y = op->y - half_y - MAX_LIGHT_RADIUS;
353 int max_x = op->x + half_x + MAX_LIGHT_RADIUS;
354 int max_y = op->y + half_y + MAX_LIGHT_RADIUS;
355
356 int pass2 = 0; // negative lights have an extra pass 352 int pass2 = 0; // negative lights have an extra pass
353
354 maprect *rects = pl->observe->map->split_to_tiles (
355 pl->observe->x - half_x - MAX_LIGHT_RADIUS,
356 pl->observe->y - half_y - MAX_LIGHT_RADIUS,
357 pl->observe->x + half_x + MAX_LIGHT_RADIUS + 1,
358 pl->observe->y + half_y + MAX_LIGHT_RADIUS + 1
359 );
357 360
358 if (!darklevel) 361 if (!darklevel)
359 pass2 = 1; 362 pass2 = 1;
360 else 363 else
361 { 364 {
362 /* first, make everything totally dark */ 365 /* first, make everything totally dark */
363 for (int dx = -half_x; dx <= half_x; dx++) 366 for (int dx = -half_x; dx <= half_x; dx++)
364 for (int dy = -half_x; dy <= half_y; dy++) 367 for (int dy = -half_x; dy <= half_y; dy++)
365 if (pl->los[dx + LOS_X0][dy + LOS_Y0] != LOS_BLOCKED)
366 pl->los[dx + LOS_X0][dy + LOS_Y0] = LOS_MAX; 368 max_it (pl->los[dx + LOS_X0][dy + LOS_Y0], LOS_MAX);
367 369
368 /* 370 /*
369 * Only process the area of interest. 371 * Only process the area of interest.
370 * the basex, basey values represent the position in the op->contr->los 372 * the basex, basey values represent the position in the op->contr->los
371 * array. Its easier to just increment them here (and start with the right 373 * array. Its easier to just increment them here (and start with the right
372 * value) than to recalculate them down below. 374 * value) than to recalculate them down below.
373 */ 375 */
374 for (int x = min_x; x <= max_x; x++) 376 for (maprect *r = rects; r->m; ++r)
375 for (int y = min_y; y <= max_y; y++) 377 rect_mapwalk (r, 0, 0)
376 { 378 {
377 maptile *m = pl->observe->map;
378 sint16 nx = x;
379 sint16 ny = y;
380
381 if (!xy_normalise (m, nx, ny))
382 continue;
383
384 mapspace &ms = m->at (nx, ny); 379 mapspace &ms = m->at (nx, ny);
385 ms.update (); 380 ms.update ();
386 sint8 light = ms.light; 381 sint8 light = ms.light;
387 382
388 if (expect_false (light)) 383 if (expect_false (light))
389 if (light < 0) 384 if (light < 0)
390 pass2 = 1; 385 pass2 = 1;
391 else 386 else
392 apply_light<los_brighten> (pl, x - op->x, y - op->y, light, light_atten [light + MAX_LIGHT_RADIUS]); 387 apply_light<los_brighten> (pl, dx - pl->observe->x, dy - pl->observe->y, light, light_atten [light + MAX_LIGHT_RADIUS]);
393 } 388 }
394 389
395 /* grant some vision to the player, based on the darklevel */ 390 /* grant some vision to the player, based on the darklevel */
396 { 391 {
397 int light = clamp (MAX_DARKNESS - darklevel, 0, MAX_DARKNESS); 392 int light = clamp (MAX_DARKNESS - darklevel, 0, MAX_DARKNESS);
393
394 /* If the player can see in the dark, lower the darklevel for him */
395 if (op->flag [FLAG_SEE_IN_DARK])
396 light += SEE_IN_DARK_RADIUS;
398 397
399 apply_light<los_brighten> (pl, 0, 0, light, vision_atten [light]); 398 apply_light<los_brighten> (pl, 0, 0, light, vision_atten [light]);
400 } 399 }
401 } 400 }
402 401
403 // possibly do 2nd pass for rare negative glow radii 402 // possibly do 2nd pass for rare negative glow radii
404 // for effect, those are always considered to be stronger than anything else 403 // for effect, those are always considered to be stronger than anything else
405 // but they can't darken a place completely 404 // but they can't darken a place completely
406 if (pass2) 405 if (pass2)
407 for (int x = min_x; x <= max_x; x++) 406 for (maprect *r = rects; r->m; ++r)
408 for (int y = min_y; y <= max_y; y++) 407 rect_mapwalk (r, 0, 0)
409 { 408 {
410 maptile *m = pl->observe->map;
411 sint16 nx = x;
412 sint16 ny = y;
413
414 if (!xy_normalise (m, nx, ny))
415 continue;
416
417 mapspace &ms = m->at (nx, ny); 409 mapspace &ms = m->at (nx, ny);
418 ms.update (); 410 ms.update ();
419 sint8 light = ms.light; 411 sint8 light = ms.light;
420 412
421 if (expect_false (light < 0)) 413 if (expect_false (light < 0))
422 apply_light<los_darken> (pl, x - op->x, y - op->y, -light, light_atten [light + MAX_LIGHT_RADIUS]); 414 apply_light<los_darken> (pl, dx - pl->observe->x, dy - pl->observe->y, -light, light_atten [light + MAX_LIGHT_RADIUS]);
423 } 415 }
424} 416}
425 417
426/* blinded_sight() - sets all viewable squares to blocked except 418/* blinded_sight() - sets all viewable squares to blocked except
427 * for the one the central one that the player occupies. A little 419 * for the one the central one that the player occupies. A little
442player::update_los () 434player::update_los ()
443{ 435{
444 if (ob->flag [FLAG_REMOVED])//D really needed? 436 if (ob->flag [FLAG_REMOVED])//D really needed?
445 return; 437 return;
446 438
447 clear_los ();
448
449 if (ob->flag [FLAG_WIZLOOK]) 439 if (ob->flag [FLAG_WIZLOOK])
450 memset (los, 0, sizeof (los)); 440 clear_los (0);
451 else if (observe->flag [FLAG_BLIND]) /* player is blind */ 441 else if (observe->flag [FLAG_BLIND]) /* player is blind */
442 {
443 clear_los ();
452 blinded_sight (this); 444 blinded_sight (this);
445 }
453 else 446 else
454 { 447 {
448 clear_los ();
455 calculate_los (this); 449 calculate_los (this);
456 apply_lights (this); 450 apply_lights (this);
457 } 451 }
458 452
459 if (observe->flag [FLAG_XRAYS]) 453 if (observe->flag [FLAG_XRAYS])
460 for (int dx = -2; dx <= 2; dx++) 454 for (int dx = -2; dx <= 2; dx++)
461 for (int dy = -2; dy <= 2; dy++) 455 for (int dy = -2; dy <= 2; dy++)
462 min_it (los[dx + LOS_X0][dy + LOS_X0], 1); 456 min_it (los[dx + LOS_X0][dy + LOS_Y0], 1);
463} 457}
464 458
465/* update all_map_los is like update_all_los below, 459/* update all_map_los is like update_all_los below,
466 * but updates everyone on the map, no matter where they 460 * but updates everyone on the map, no matter where they
467 * are. This generally should not be used, as a per 461 * are. This generally should not be used, as a per
493 * map is the map that changed, x and y are the coordinates. 487 * map is the map that changed, x and y are the coordinates.
494 */ 488 */
495void 489void
496update_all_los (const maptile *map, int x, int y) 490update_all_los (const maptile *map, int x, int y)
497{ 491{
492 // no need to do anything if we don't have darkness
493 if (map->darklevel () <= 0)
494 return;
495
498 map->at (x, y).invalidate (); 496 map->at (x, y).invalidate ();
499 497
500 for_all_players (pl) 498 for_all_players (pl)
501 { 499 {
502 /* Player should not have a null map, but do this 500 /* Player should not have a null map, but do this
513 * player can't be on another map that may be closer, 511 * player can't be on another map that may be closer,
514 * so by setting it up this way, we trim processing 512 * so by setting it up this way, we trim processing
515 * some. 513 * some.
516 */ 514 */
517 if (pl->ob->map == map) 515 if (pl->ob->map == map)
518 {
519 if ((abs (pl->ob->x - x) <= pl->ns->mapx / 2) && (abs (pl->ob->y - y) <= pl->ns->mapy / 2)) 516 if ((abs (pl->ob->x - x) <= pl->ns->mapx / 2) && (abs (pl->ob->y - y) <= pl->ns->mapy / 2))
520 pl->do_los = 1; 517 pl->do_los = 1;
521 }
522 518
523 /* Now we check to see if player is on adjacent 519 /* Now we check to see if player is on adjacent
524 * maps to the one that changed and also within 520 * maps to the one that changed and also within
525 * view. The tile_maps[] could be null, but in that 521 * view. The tile_maps[] could be null, but in that
526 * case it should never match the pl->ob->map, so 522 * case it should never match the pl->ob->map, so
618{ 614{
619 for_all_players (pl) 615 for_all_players (pl)
620 if (pl->ob->map == op->map && 616 if (pl->ob->map == op->map &&
621 pl->ob->y - pl->ns->mapy / 2 <= op->y && 617 pl->ob->y - pl->ns->mapy / 2 <= op->y &&
622 pl->ob->y + pl->ns->mapy / 2 >= op->y && pl->ob->x - pl->ns->mapx / 2 <= op->x && pl->ob->x + pl->ns->mapx / 2 >= op->x) 618 pl->ob->y + pl->ns->mapy / 2 >= op->y && pl->ob->x - pl->ns->mapx / 2 <= op->x && pl->ob->x + pl->ns->mapx / 2 >= op->x)
623 pl->los[op->x - pl->ob->x + LOS_X0][op->y - pl->ob->y + LOS_X0] = 0; 619 pl->los[op->x - pl->ob->x + LOS_X0][op->y - pl->ob->y + LOS_Y0] = 0;
624} 620}
625 621
626/* 622/*
627 * make_sure_not_seen: The object which is supposed to be visible through 623 * make_sure_not_seen: The object which is supposed to be visible through
628 * walls has just been removed from the map, so update the los of any 624 * walls has just been removed from the map, so update the los of any
635 if (pl->ob->map == op->map && 631 if (pl->ob->map == op->map &&
636 pl->ob->y - pl->ns->mapy / 2 <= op->y && 632 pl->ob->y - pl->ns->mapy / 2 <= op->y &&
637 pl->ob->y + pl->ns->mapy / 2 >= op->y && pl->ob->x - pl->ns->mapx / 2 <= op->x && pl->ob->x + pl->ns->mapx / 2 >= op->x) 633 pl->ob->y + pl->ns->mapy / 2 >= op->y && pl->ob->x - pl->ns->mapx / 2 <= op->x && pl->ob->x + pl->ns->mapx / 2 >= op->x)
638 pl->do_los = 1; 634 pl->do_los = 1;
639} 635}
636

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines