Go to the documentation of this file.
32 #define SPACE_BLOCK 0.5
66 for (i = 0; i <
index; i++) {
90 static const int block_x[3] = {
110 for (i = 0; i < 3; i++) {
138 l =
FABS(sqrt(d1)*s);
181 for (
int i = 0; i < at->
index; i++) {
182 int dx = at->
x[i], dy = at->
y[i];
230 if (ax < 0 || ay < 0 || ax >=
op->contr->socket.mapx || ay >=
op->contr->socket.mapy)
237 if (
op->contr->blocked_los[ax][ay] == 100)
275 for (
x = 1;
x <
op->contr->socket.mapx-1;
x++)
276 for (
y = 1;
y <
op->contr->socket.mapy-1;
y++) {
277 if (!
op->contr->blocked_los[
x][
y]
279 op->x-
op->contr->socket.mapx/2+
x,
280 op->y-
op->contr->socket.mapy/2+
y,
282 for (i = 1; i <= 8; i += 1) {
285 if (
op->contr->blocked_los[dx][dy] > 0)
286 op->contr->blocked_los[dx][dy] = -1;
296 for (
x = 0;
x <
op->contr->socket.mapx;
x++)
297 for (
y = 0;
y <
op->contr->socket.mapy;
y++)
298 if (
op->contr->blocked_los[
x][
y] < 0)
299 op->contr->blocked_los[
x][
y] = 0;
317 if (
op->glow_radius > 0)
330 int x,
y, darklevel, ax, ay, basex, basey, mflags, light,
x1,
y1;
351 LOG(
llevError,
"Map darkness for %s on %s is too high (%d)\n",
op->name,
op->map->path, darklevel);
356 for (
x = 0;
x <
op->contr->socket.mapx;
x++)
357 for (
y = 0;
y <
op->contr->socket.mapy;
y++)
358 if (
op->contr->blocked_los[
x][
y] != 100)
385 for (ax = basex-light; ax <= basex+light; ax++) {
386 if (ax < 0 || ax >=
op->contr->socket.mapx)
388 for (ay = basey-light; ay <= basey+light; ay++) {
389 if (ay < 0 || ay >=
op->contr->socket.mapy)
399 if (
op->contr->blocked_los[ax][ay] != 100) {
400 x1 = abs(basex-ax)*abs(basex-ax);
401 y1 = abs(basey-ay)*abs(basey-ay);
417 if (
op->contr->blocked_los[
op->contr->socket.mapx/2][
op->contr->socket.mapy/2] > (
MAX_DARKNESS-3))
418 op->contr->blocked_los[
op->contr->socket.mapx/2][
op->contr->socket.mapy/2] =
MAX_DARKNESS-3;
420 for (
x = -1;
x <= 1;
x++)
421 for (
y = -1;
y <= 1;
y++) {
422 if (
op->contr->blocked_los[
x+
op->contr->socket.mapx/2][
y+
op->contr->socket.mapy/2] > (
MAX_DARKNESS-2))
423 op->contr->blocked_los[
x+
op->contr->socket.mapx/2][
y+
op->contr->socket.mapy/2] =
MAX_DARKNESS-2;
429 if (!(
op->contr->blocked_los[
x+
op->contr->socket.mapx/2][
y+
op->contr->socket.mapy/2] == 100))
430 op->contr->blocked_los[
x+
op->contr->socket.mapx/2][
y+
op->contr->socket.mapy/2] -=
MAX(0, 6-darklevel-
MAX(abs(
x), abs(
y)));
460 int dx =
op->contr->socket.mapx/2, dy =
op->contr->socket.mapy/2,
x,
y;
487 for (
x = -2;
x <= 2;
x++)
488 for (
y = -2;
y <= 2;
y++)
489 op->contr->blocked_los[dx+
x][dy+
y] = 0;
610 snprintf(
buf,
sizeof(
buf),
"[fixed] ");
611 for (
x = 0;
x <
op->contr->socket.mapx;
x++) {
612 snprintf(buf2,
sizeof(buf2),
"%2d",
x);
613 strncat(
buf, buf2,
sizeof(
buf)-strlen(
buf)-1);
616 for (
y = 0;
y <
op->contr->socket.mapy;
y++) {
617 snprintf(
buf,
sizeof(
buf),
"[fixed]%2d:",
y);
618 for (
x = 0;
x <
op->contr->socket.mapx;
x++) {
619 snprintf(buf2,
sizeof(buf2),
" %1d",
op->contr->blocked_los[
x][
y] == 100 ? 1 : 0);
620 strncat(
buf, buf2,
sizeof(
buf)-strlen(
buf)-1);
void make_sure_seen(const object *op)
#define QUERY_FLAG(xyz, p)
int8_t blocked_los[MAP_CLIENT_X][MAP_CLIENT_Y]
static void set_wall(player *pl, int x, int y)
short freearr_x[SIZEOFFREE]
short freearr_y[SIZEOFFREE]
#define MSG_TYPE_COMMAND_DEBUG
static void blinded_sight(player *pl)
static event_registration m
int has_carried_lights(const object *op)
static blocks block[MAP_CLIENT_X][MAP_CLIENT_Y]
void print_los(object *op)
static void expand_lighted_sight(object *op)
static void set_block(int x, int y, int bx, int by)
EXTERN player * first_player
static void check_wall(object *op, int x, int y)
static void expand_sight(object *op)
#define GET_MAP_LIGHT(M, X, Y)
void clear_los(player *pl)
void LOG(LogLevel logLevel, const char *format,...)
void update_all_los(const mapstruct *map, int x, int y)
void draw_ext_info(int flags, int pri, const object *pl, uint8_t type, uint8_t subtype, const char *message)
void make_sure_not_seen(const object *op)
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, int16_t x, int16_t y, int16_t *nx, int16_t *ny)
void update_los(object *op)
void update_all_map_los(mapstruct *map)