… | |
… | |
188 | int dx = block[x][y].x[i], dy = block[x][y].y[i], ax, ay; |
188 | int dx = block[x][y].x[i], dy = block[x][y].y[i], ax, ay; |
189 | |
189 | |
190 | /* ax, ay are the values as adjusted to be in the |
190 | /* ax, ay are the values as adjusted to be in the |
191 | * socket look structure. |
191 | * socket look structure. |
192 | */ |
192 | */ |
193 | ax = dx - (MAP_CLIENT_X - op->contr->socket->mapx) / 2; |
193 | ax = dx - (MAP_CLIENT_X - op->contr->ns->mapx) / 2; |
194 | ay = dy - (MAP_CLIENT_Y - op->contr->socket->mapy) / 2; |
194 | ay = dy - (MAP_CLIENT_Y - op->contr->ns->mapy) / 2; |
195 | |
195 | |
196 | if (ax < 0 || ax >= op->contr->socket->mapx || ay < 0 || ay >= op->contr->socket->mapy) |
196 | if (ax < 0 || ax >= op->contr->ns->mapx || ay < 0 || ay >= op->contr->ns->mapy) |
197 | continue; |
197 | continue; |
198 | #if 0 |
198 | #if 0 |
199 | LOG (llevDebug, "blocked %d %d -> %d %d\n", dx, dy, ax, ay); |
199 | LOG (llevDebug, "blocked %d %d -> %d %d\n", dx, dy, ax, ay); |
200 | #endif |
200 | #endif |
201 | /* we need to adjust to the fact that the socket |
201 | /* we need to adjust to the fact that the socket |
… | |
… | |
220 | |
220 | |
221 | if (!block[x][y].index) |
221 | if (!block[x][y].index) |
222 | return; |
222 | return; |
223 | |
223 | |
224 | /* ax, ay are coordinates as indexed into the look window */ |
224 | /* ax, ay are coordinates as indexed into the look window */ |
225 | ax = x - (MAP_CLIENT_X - op->contr->socket->mapx) / 2; |
225 | ax = x - (MAP_CLIENT_X - op->contr->ns->mapx) / 2; |
226 | ay = y - (MAP_CLIENT_Y - op->contr->socket->mapy) / 2; |
226 | ay = y - (MAP_CLIENT_Y - op->contr->ns->mapy) / 2; |
227 | |
227 | |
228 | /* If the converted coordinates are outside the viewable |
228 | /* If the converted coordinates are outside the viewable |
229 | * area for the client, return now. |
229 | * area for the client, return now. |
230 | */ |
230 | */ |
231 | if (ax < 0 || ay < 0 || ax >= op->contr->socket->mapx || ay >= op->contr->socket->mapy) |
231 | if (ax < 0 || ay < 0 || ax >= op->contr->ns->mapx || ay >= op->contr->ns->mapy) |
232 | return; |
232 | return; |
233 | |
233 | |
234 | #if 0 |
234 | #if 0 |
235 | LOG (llevDebug, "check_wall, ax,ay=%d, %d x,y = %d, %d blocksview = %d, %d\n", |
235 | LOG (llevDebug, "check_wall, ax,ay=%d, %d x,y = %d, %d blocksview = %d, %d\n", |
236 | ax, ay, x, y, op->x + x - MAP_CLIENT_X / 2, op->y + y - MAP_CLIENT_Y / 2); |
236 | ax, ay, x, y, op->x + x - MAP_CLIENT_X / 2, op->y + y - MAP_CLIENT_Y / 2); |
… | |
… | |
254 | */ |
254 | */ |
255 | |
255 | |
256 | void |
256 | void |
257 | clear_los (object *op) |
257 | clear_los (object *op) |
258 | { |
258 | { |
259 | /* This is safer than using the socket->mapx, mapy because |
259 | /* This is safer than using the ns->mapx, mapy because |
260 | * we index the blocked_los as a 2 way array, so clearing |
260 | * we index the blocked_los as a 2 way array, so clearing |
261 | * the first z spaces may not not cover the spaces we are |
261 | * the first z spaces may not not cover the spaces we are |
262 | * actually going to use |
262 | * actually going to use |
263 | */ |
263 | */ |
264 | (void) memset ((void *) op->contr->blocked_los, 0, MAP_CLIENT_X * MAP_CLIENT_Y); |
264 | (void) memset ((void *) op->contr->blocked_los, 0, MAP_CLIENT_X * MAP_CLIENT_Y); |
… | |
… | |
274 | static void |
274 | static void |
275 | expand_sight (object *op) |
275 | expand_sight (object *op) |
276 | { |
276 | { |
277 | int i, x, y, dx, dy; |
277 | int i, x, y, dx, dy; |
278 | |
278 | |
279 | for (x = 1; x < op->contr->socket->mapx - 1; x++) /* loop over inner squares */ |
279 | for (x = 1; x < op->contr->ns->mapx - 1; x++) /* loop over inner squares */ |
280 | for (y = 1; y < op->contr->socket->mapy - 1; y++) |
280 | for (y = 1; y < op->contr->ns->mapy - 1; y++) |
281 | { |
281 | { |
282 | if (!op->contr->blocked_los[x][y] && |
282 | if (!op->contr->blocked_los[x][y] && |
283 | !(get_map_flags (op->map, NULL, |
283 | !(get_map_flags (op->map, NULL, |
284 | op->x - op->contr->socket->mapx / 2 + x, |
284 | op->x - op->contr->ns->mapx / 2 + x, |
285 | op->y - op->contr->socket->mapy / 2 + y, NULL, NULL) & (P_BLOCKSVIEW | P_OUT_OF_MAP))) |
285 | op->y - op->contr->ns->mapy / 2 + y, NULL, NULL) & (P_BLOCKSVIEW | P_OUT_OF_MAP))) |
286 | { |
286 | { |
287 | |
287 | |
288 | for (i = 1; i <= 8; i += 1) |
288 | for (i = 1; i <= 8; i += 1) |
289 | { /* mark all directions */ |
289 | { /* mark all directions */ |
290 | dx = x + freearr_x[i]; |
290 | dx = x + freearr_x[i]; |
… | |
… | |
298 | if (MAP_DARKNESS (op->map) > 0) /* player is on a dark map */ |
298 | if (MAP_DARKNESS (op->map) > 0) /* player is on a dark map */ |
299 | expand_lighted_sight (op); |
299 | expand_lighted_sight (op); |
300 | |
300 | |
301 | |
301 | |
302 | /* clear mark squares */ |
302 | /* clear mark squares */ |
303 | for (x = 0; x < op->contr->socket->mapx; x++) |
303 | for (x = 0; x < op->contr->ns->mapx; x++) |
304 | for (y = 0; y < op->contr->socket->mapy; y++) |
304 | for (y = 0; y < op->contr->ns->mapy; y++) |
305 | if (op->contr->blocked_los[x][y] < 0) |
305 | if (op->contr->blocked_los[x][y] < 0) |
306 | op->contr->blocked_los[x][y] = 0; |
306 | op->contr->blocked_los[x][y] = 0; |
307 | } |
307 | } |
308 | |
308 | |
309 | |
309 | |
… | |
… | |
354 | LOG (llevError, "Map darkness for %s on %s is too high (%d)\n", &op->name, op->map->path, darklevel); |
354 | LOG (llevError, "Map darkness for %s on %s is too high (%d)\n", &op->name, op->map->path, darklevel); |
355 | darklevel = MAX_DARKNESS; |
355 | darklevel = MAX_DARKNESS; |
356 | } |
356 | } |
357 | |
357 | |
358 | /* First, limit player furthest (unlighted) vision */ |
358 | /* First, limit player furthest (unlighted) vision */ |
359 | for (x = 0; x < op->contr->socket->mapx; x++) |
359 | for (x = 0; x < op->contr->ns->mapx; x++) |
360 | for (y = 0; y < op->contr->socket->mapy; y++) |
360 | for (y = 0; y < op->contr->ns->mapy; y++) |
361 | if (op->contr->blocked_los[x][y] != 100) |
361 | if (op->contr->blocked_los[x][y] != 100) |
362 | op->contr->blocked_los[x][y] = MAX_LIGHT_RADII; |
362 | op->contr->blocked_los[x][y] = MAX_LIGHT_RADII; |
363 | |
363 | |
364 | /* the spaces[] darkness value contains the information we need. |
364 | /* the spaces[] darkness value contains the information we need. |
365 | * Only process the area of interest. |
365 | * Only process the area of interest. |
366 | * the basex, basey values represent the position in the op->contr->blocked_los |
366 | * the basex, basey values represent the position in the op->contr->blocked_los |
367 | * array. Its easier to just increment them here (and start with the right |
367 | * array. Its easier to just increment them here (and start with the right |
368 | * value) than to recalculate them down below. |
368 | * value) than to recalculate them down below. |
369 | */ |
369 | */ |
370 | for (x = (op->x - op->contr->socket->mapx / 2 - MAX_LIGHT_RADII), basex = -MAX_LIGHT_RADII; |
370 | for (x = (op->x - op->contr->ns->mapx / 2 - MAX_LIGHT_RADII), basex = -MAX_LIGHT_RADII; |
371 | x <= (op->x + op->contr->socket->mapx / 2 + MAX_LIGHT_RADII); x++, basex++) |
371 | x <= (op->x + op->contr->ns->mapx / 2 + MAX_LIGHT_RADII); x++, basex++) |
372 | { |
372 | { |
373 | |
373 | |
374 | for (y = (op->y - op->contr->socket->mapy / 2 - MAX_LIGHT_RADII), basey = -MAX_LIGHT_RADII; |
374 | for (y = (op->y - op->contr->ns->mapy / 2 - MAX_LIGHT_RADII), basey = -MAX_LIGHT_RADII; |
375 | y <= (op->y + op->contr->socket->mapy / 2 + MAX_LIGHT_RADII); y++, basey++) |
375 | y <= (op->y + op->contr->ns->mapy / 2 + MAX_LIGHT_RADII); y++, basey++) |
376 | { |
376 | { |
377 | m = op->map; |
377 | m = op->map; |
378 | nx = x; |
378 | nx = x; |
379 | ny = y; |
379 | ny = y; |
380 | |
380 | |
… | |
… | |
392 | #if 0 |
392 | #if 0 |
393 | LOG (llevDebug, "expand_lighted_sight: Found light at x=%d, y=%d, basex=%d, basey=%d\n", x, y, basex, basey); |
393 | LOG (llevDebug, "expand_lighted_sight: Found light at x=%d, y=%d, basex=%d, basey=%d\n", x, y, basex, basey); |
394 | #endif |
394 | #endif |
395 | for (ax = basex - light; ax <= basex + light; ax++) |
395 | for (ax = basex - light; ax <= basex + light; ax++) |
396 | { |
396 | { |
397 | if (ax < 0 || ax >= op->contr->socket->mapx) |
397 | if (ax < 0 || ax >= op->contr->ns->mapx) |
398 | continue; |
398 | continue; |
399 | for (ay = basey - light; ay <= basey + light; ay++) |
399 | for (ay = basey - light; ay <= basey + light; ay++) |
400 | { |
400 | { |
401 | if (ay < 0 || ay >= op->contr->socket->mapy) |
401 | if (ay < 0 || ay >= op->contr->ns->mapy) |
402 | continue; |
402 | continue; |
403 | |
403 | |
404 | /* If the space is fully blocked, do nothing. Otherwise, we |
404 | /* If the space is fully blocked, do nothing. Otherwise, we |
405 | * brighten the space. The further the light is away from the |
405 | * brighten the space. The further the light is away from the |
406 | * source (basex-x), the less effect it has. Though light used |
406 | * source (basex-x), the less effect it has. Though light used |
… | |
… | |
426 | /* Outdoor should never really be completely pitch black dark like |
426 | /* Outdoor should never really be completely pitch black dark like |
427 | * a dungeon, so let the player at least see a little around themselves |
427 | * a dungeon, so let the player at least see a little around themselves |
428 | */ |
428 | */ |
429 | if (op->map->outdoor && darklevel > (MAX_DARKNESS - 3)) |
429 | if (op->map->outdoor && darklevel > (MAX_DARKNESS - 3)) |
430 | { |
430 | { |
431 | if (op->contr->blocked_los[op->contr->socket->mapx / 2][op->contr->socket->mapy / 2] > (MAX_DARKNESS - 3)) |
431 | if (op->contr->blocked_los[op->contr->ns->mapx / 2][op->contr->ns->mapy / 2] > (MAX_DARKNESS - 3)) |
432 | op->contr->blocked_los[op->contr->socket->mapx / 2][op->contr->socket->mapy / 2] = MAX_DARKNESS - 3; |
432 | op->contr->blocked_los[op->contr->ns->mapx / 2][op->contr->ns->mapy / 2] = MAX_DARKNESS - 3; |
433 | |
433 | |
434 | for (x = -1; x <= 1; x++) |
434 | for (x = -1; x <= 1; x++) |
435 | for (y = -1; y <= 1; y++) |
435 | for (y = -1; y <= 1; y++) |
436 | { |
436 | { |
437 | if (op->contr->blocked_los[x + op->contr->socket->mapx / 2][y + op->contr->socket->mapy / 2] > (MAX_DARKNESS - 2)) |
437 | if (op->contr->blocked_los[x + op->contr->ns->mapx / 2][y + op->contr->ns->mapy / 2] > (MAX_DARKNESS - 2)) |
438 | op->contr->blocked_los[x + op->contr->socket->mapx / 2][y + op->contr->socket->mapy / 2] = MAX_DARKNESS - 2; |
438 | op->contr->blocked_los[x + op->contr->ns->mapx / 2][y + op->contr->ns->mapy / 2] = MAX_DARKNESS - 2; |
439 | } |
439 | } |
440 | } |
440 | } |
441 | /* grant some vision to the player, based on the darklevel */ |
441 | /* grant some vision to the player, based on the darklevel */ |
442 | for (x = darklevel - MAX_DARKNESS; x < MAX_DARKNESS + 1 - darklevel; x++) |
442 | for (x = darklevel - MAX_DARKNESS; x < MAX_DARKNESS + 1 - darklevel; x++) |
443 | for (y = darklevel - MAX_DARKNESS; y < MAX_DARKNESS + 1 - darklevel; y++) |
443 | for (y = darklevel - MAX_DARKNESS; y < MAX_DARKNESS + 1 - darklevel; y++) |
444 | if (!(op->contr->blocked_los[x + op->contr->socket->mapx / 2][y + op->contr->socket->mapy / 2] == 100)) |
444 | if (!(op->contr->blocked_los[x + op->contr->ns->mapx / 2][y + op->contr->ns->mapy / 2] == 100)) |
445 | op->contr->blocked_los[x + op->contr->socket->mapx / 2][y + op->contr->socket->mapy / 2] -= |
445 | op->contr->blocked_los[x + op->contr->ns->mapx / 2][y + op->contr->ns->mapy / 2] -= |
446 | MAX (0, 6 - darklevel - MAX (abs (x), abs (y))); |
446 | MAX (0, 6 - darklevel - MAX (abs (x), abs (y))); |
447 | } |
447 | } |
448 | |
448 | |
449 | /* blinded_sight() - sets all veiwable squares to blocked except |
449 | /* blinded_sight() - sets all veiwable squares to blocked except |
450 | * for the one the central one that the player occupies. A little |
450 | * for the one the central one that the player occupies. A little |
… | |
… | |
455 | static void |
455 | static void |
456 | blinded_sight (object *op) |
456 | blinded_sight (object *op) |
457 | { |
457 | { |
458 | int x, y; |
458 | int x, y; |
459 | |
459 | |
460 | for (x = 0; x < op->contr->socket->mapx; x++) |
460 | for (x = 0; x < op->contr->ns->mapx; x++) |
461 | for (y = 0; y < op->contr->socket->mapy; y++) |
461 | for (y = 0; y < op->contr->ns->mapy; y++) |
462 | op->contr->blocked_los[x][y] = 100; |
462 | op->contr->blocked_los[x][y] = 100; |
463 | |
463 | |
464 | op->contr->blocked_los[op->contr->socket->mapx / 2][op->contr->socket->mapy / 2] = 0; |
464 | op->contr->blocked_los[op->contr->ns->mapx / 2][op->contr->ns->mapy / 2] = 0; |
465 | } |
465 | } |
466 | |
466 | |
467 | /* |
467 | /* |
468 | * update_los() recalculates the array which specifies what is |
468 | * update_los() recalculates the array which specifies what is |
469 | * visible for the given player-object. |
469 | * visible for the given player-object. |
470 | */ |
470 | */ |
471 | |
471 | |
472 | void |
472 | void |
473 | update_los (object *op) |
473 | update_los (object *op) |
474 | { |
474 | { |
475 | int dx = op->contr->socket->mapx / 2, dy = op->contr->socket->mapy / 2, x, y; |
475 | int dx = op->contr->ns->mapx / 2, dy = op->contr->ns->mapy / 2, x, y; |
476 | |
476 | |
477 | if (QUERY_FLAG (op, FLAG_REMOVED)) |
477 | if (QUERY_FLAG (op, FLAG_REMOVED)) |
478 | return; |
478 | return; |
479 | |
479 | |
480 | clear_los (op); |
480 | clear_los (op); |
… | |
… | |
484 | /* For larger maps, this is more efficient than the old way which |
484 | /* For larger maps, this is more efficient than the old way which |
485 | * used the chaining of the block array. Since many space views could |
485 | * used the chaining of the block array. Since many space views could |
486 | * be blocked by different spaces in front, this mean that a lot of spaces |
486 | * be blocked by different spaces in front, this mean that a lot of spaces |
487 | * could be examined multile times, as each path would be looked at. |
487 | * could be examined multile times, as each path would be looked at. |
488 | */ |
488 | */ |
489 | for (x = (MAP_CLIENT_X - op->contr->socket->mapx) / 2 - 1; x < (MAP_CLIENT_X + op->contr->socket->mapx) / 2 + 1; x++) |
489 | 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->socket->mapy) / 2 - 1; y < (MAP_CLIENT_Y + op->contr->socket->mapy) / 2 + 1; y++) |
490 | 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); |
491 | check_wall (op, x, y); |
492 | |
492 | |
493 | |
493 | |
494 | /* do the los of the player. 3 (potential) cases */ |
494 | /* do the los of the player. 3 (potential) cases */ |
495 | if (QUERY_FLAG (op, FLAG_BLIND)) /* player is blind */ |
495 | if (QUERY_FLAG (op, FLAG_BLIND)) /* player is blind */ |
… | |
… | |
566 | * so by setting it up this way, we trim processing |
566 | * so by setting it up this way, we trim processing |
567 | * some. |
567 | * some. |
568 | */ |
568 | */ |
569 | if (pl->ob->map == map) |
569 | if (pl->ob->map == map) |
570 | { |
570 | { |
571 | if ((abs (pl->ob->x - x) <= pl->socket->mapx / 2) && (abs (pl->ob->y - y) <= pl->socket->mapy / 2)) |
571 | if ((abs (pl->ob->x - x) <= pl->ns->mapx / 2) && (abs (pl->ob->y - y) <= pl->ns->mapy / 2)) |
572 | pl->do_los = 1; |
572 | pl->do_los = 1; |
573 | } |
573 | } |
574 | /* Now we check to see if player is on adjacent |
574 | /* Now we check to see if player is on adjacent |
575 | * maps to the one that changed and also within |
575 | * maps to the one that changed and also within |
576 | * view. The tile_maps[] could be null, but in that |
576 | * view. The tile_maps[] could be null, but in that |
… | |
… | |
587 | * and then add the players location, which gives |
587 | * and then add the players location, which gives |
588 | * a distance. |
588 | * a distance. |
589 | */ |
589 | */ |
590 | else if (pl->ob->map == map->tile_map[0]) |
590 | else if (pl->ob->map == map->tile_map[0]) |
591 | { |
591 | { |
592 | if ((abs (pl->ob->x - x) <= pl->socket->mapx / 2) && (abs (y + MAP_HEIGHT (map->tile_map[0]) - pl->ob->y) <= pl->socket->mapy / 2)) |
592 | if ((abs (pl->ob->x - x) <= pl->ns->mapx / 2) && (abs (y + MAP_HEIGHT (map->tile_map[0]) - pl->ob->y) <= pl->ns->mapy / 2)) |
593 | pl->do_los = 1; |
593 | pl->do_los = 1; |
594 | } |
594 | } |
595 | else if (pl->ob->map == map->tile_map[2]) |
595 | else if (pl->ob->map == map->tile_map[2]) |
596 | { |
596 | { |
597 | if ((abs (pl->ob->x - x) <= pl->socket->mapx / 2) && (abs (pl->ob->y + MAP_HEIGHT (map) - y) <= pl->socket->mapy / 2)) |
597 | if ((abs (pl->ob->x - x) <= pl->ns->mapx / 2) && (abs (pl->ob->y + MAP_HEIGHT (map) - y) <= pl->ns->mapy / 2)) |
598 | pl->do_los = 1; |
598 | pl->do_los = 1; |
599 | } |
599 | } |
600 | else if (pl->ob->map == map->tile_map[1]) |
600 | else if (pl->ob->map == map->tile_map[1]) |
601 | { |
601 | { |
602 | if ((abs (pl->ob->x + MAP_WIDTH (map) - x) <= pl->socket->mapx / 2) && (abs (pl->ob->y - y) <= pl->socket->mapy / 2)) |
602 | if ((abs (pl->ob->x + MAP_WIDTH (map) - x) <= pl->ns->mapx / 2) && (abs (pl->ob->y - y) <= pl->ns->mapy / 2)) |
603 | pl->do_los = 1; |
603 | pl->do_los = 1; |
604 | } |
604 | } |
605 | else if (pl->ob->map == map->tile_map[3]) |
605 | else if (pl->ob->map == map->tile_map[3]) |
606 | { |
606 | { |
607 | if ((abs (x + MAP_WIDTH (map->tile_map[3]) - pl->ob->x) <= pl->socket->mapx / 2) && (abs (pl->ob->y - y) <= pl->socket->mapy / 2)) |
607 | if ((abs (x + MAP_WIDTH (map->tile_map[3]) - pl->ob->x) <= pl->ns->mapx / 2) && (abs (pl->ob->y - y) <= pl->ns->mapy / 2)) |
608 | pl->do_los = 1; |
608 | pl->do_los = 1; |
609 | } |
609 | } |
610 | } |
610 | } |
611 | } |
611 | } |
612 | |
612 | |
… | |
… | |
620 | { |
620 | { |
621 | int x, y; |
621 | int x, y; |
622 | char buf[50], buf2[10]; |
622 | char buf[50], buf2[10]; |
623 | |
623 | |
624 | strcpy (buf, " "); |
624 | strcpy (buf, " "); |
625 | for (x = 0; x < op->contr->socket->mapx; x++) |
625 | for (x = 0; x < op->contr->ns->mapx; x++) |
626 | { |
626 | { |
627 | sprintf (buf2, "%2d", x); |
627 | sprintf (buf2, "%2d", x); |
628 | strcat (buf, buf2); |
628 | strcat (buf, buf2); |
629 | } |
629 | } |
630 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
630 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
631 | for (y = 0; y < op->contr->socket->mapy; y++) |
631 | for (y = 0; y < op->contr->ns->mapy; y++) |
632 | { |
632 | { |
633 | sprintf (buf, "%2d:", y); |
633 | sprintf (buf, "%2d:", y); |
634 | for (x = 0; x < op->contr->socket->mapx; x++) |
634 | for (x = 0; x < op->contr->ns->mapx; x++) |
635 | { |
635 | { |
636 | sprintf (buf2, " %1d", op->contr->blocked_los[x][y]); |
636 | sprintf (buf2, " %1d", op->contr->blocked_los[x][y]); |
637 | strcat (buf, buf2); |
637 | strcat (buf, buf2); |
638 | } |
638 | } |
639 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
639 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
… | |
… | |
650 | { |
650 | { |
651 | player *pl; |
651 | player *pl; |
652 | |
652 | |
653 | for (pl = first_player; pl; pl = pl->next) |
653 | for (pl = first_player; pl; pl = pl->next) |
654 | if (pl->ob->map == op->map && |
654 | if (pl->ob->map == op->map && |
655 | pl->ob->y - pl->socket->mapy / 2 <= op->y && |
655 | pl->ob->y - pl->ns->mapy / 2 <= op->y && |
656 | pl->ob->y + pl->socket->mapy / 2 >= op->y && pl->ob->x - pl->socket->mapx / 2 <= op->x && pl->ob->x + pl->socket->mapx / 2 >= op->x) |
656 | 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) |
657 | pl->blocked_los[pl->socket->mapx / 2 + op->x - pl->ob->x][pl->socket->mapy / 2 + op->y - pl->ob->y] = 0; |
657 | pl->blocked_los[pl->ns->mapx / 2 + op->x - pl->ob->x][pl->ns->mapy / 2 + op->y - pl->ob->y] = 0; |
658 | } |
658 | } |
659 | |
659 | |
660 | /* |
660 | /* |
661 | * make_sure_not_seen: The object which is supposed to be visible through |
661 | * make_sure_not_seen: The object which is supposed to be visible through |
662 | * walls has just been removed from the map, so update the los of any |
662 | * walls has just been removed from the map, so update the los of any |
… | |
… | |
668 | { |
668 | { |
669 | player *pl; |
669 | player *pl; |
670 | |
670 | |
671 | for (pl = first_player; pl; pl = pl->next) |
671 | for (pl = first_player; pl; pl = pl->next) |
672 | if (pl->ob->map == op->map && |
672 | if (pl->ob->map == op->map && |
673 | pl->ob->y - pl->socket->mapy / 2 <= op->y && |
673 | pl->ob->y - pl->ns->mapy / 2 <= op->y && |
674 | pl->ob->y + pl->socket->mapy / 2 >= op->y && pl->ob->x - pl->socket->mapx / 2 <= op->x && pl->ob->x + pl->socket->mapx / 2 >= op->x) |
674 | 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) |
675 | pl->do_los = 1; |
675 | pl->do_los = 1; |
676 | } |
676 | } |