46 #define SPACE_BLOCK 0.5
75 static void set_block(
int x,
int y,
int bx,
int by) {
76 int index = block[x][y].
index, i;
80 for (i = 0; i < index; i++) {
81 if (block[x][y].x[i] == bx
82 && block[x][y].y[i] == by)
86 block[x][y].
x[index] = bx;
87 block[x][y].
y[index] = by;
90 LOG(
llevDebug,
"setblock: added %d %d -> %d %d (%d)\n", x, y, bx, by, block[x][y].index);
104 static const int block_x[3] = {
112 block[x][y].
index = 0;
118 for (x = 1; x <= MAP_CLIENT_X/2; x++) {
119 for (y = 1; y <= MAP_CLIENT_Y/2; y++) {
120 for (i = 0; i < 3; i++) {
125 if (x == MAP_CLIENT_X/2 && y == MAP_CLIENT_Y/2)
129 if ((dx == x && x == MAP_CLIENT_X/2)
130 || (dy == y && y == MAP_CLIENT_Y/2)) {
135 if (x == MAP_CLIENT_X/2) {
136 set_block(x, MAP_CLIENT_Y-y-1, dx, MAP_CLIENT_Y-dy-1);
137 }
else if (y == MAP_CLIENT_Y/2) {
138 set_block(MAP_CLIENT_X-x-1, y, MAP_CLIENT_X-dx-1, dy);
150 d1 = (float)(pow(MAP_CLIENT_X/2-dx, 2)+pow(MAP_CLIENT_Y/2-dy, 2));
151 r = (float)((dy-y)*(dy-MAP_CLIENT_Y/2)-(dx-x)*(MAP_CLIENT_X/2-dx))/d1;
152 s = (float)((dy-y)*(MAP_CLIENT_X/2-dx)-(dx-x)*(MAP_CLIENT_Y/2-dy))/d1;
153 l =
FABS(sqrt(d1)*s);
160 set_block(MAP_CLIENT_X-x-1, y, MAP_CLIENT_X-dx-1, dy);
161 set_block(x, MAP_CLIENT_Y-y-1, dx, MAP_CLIENT_Y-dy-1);
162 set_block(MAP_CLIENT_X-x-1, MAP_CLIENT_Y-y-1, MAP_CLIENT_X-dx-1, MAP_CLIENT_Y-dy-1);
188 for (i = 0; i < block[x][y].
index; i++) {
189 int dx = block[x][y].
x[i], dy = block[x][y].
y[i], ax, ay;
223 if (!block[x][y].index)
289 for (i = 1; i <= 8; i += 1) {
337 int x, y, darklevel, ax, ay, basex, basey, mflags, light, x1, y1;
393 for (ax = basex-light; ax <= basex+light; ax++) {
396 for (ay = basey-light; ay <= basey+light; ay++) {
408 x1 = abs(basex-ax)*abs(basex-ax);
409 y1 = abs(basey-ay)*abs(basey-ay);
428 for (x = -1; x <= 1; x++)
429 for (y = -1; y <= 1; y++) {
495 for (x = -2; x <= 2; x++)
496 for (y = -2; y <= 2; y++)
520 if (pl->
ob->
map == map)
563 if (pl->
ob->
map == map) {
618 snprintf(buf,
sizeof(buf),
"[fixed] ");
620 snprintf(buf2,
sizeof(buf2),
"%2d", x);
621 strncat(buf, buf2,
sizeof(buf)-strlen(buf)-1);
625 snprintf(buf,
sizeof(buf),
"[fixed]%2d:", y);
628 strncat(buf, buf2,
sizeof(buf)-strlen(buf)-1);
int get_map_flags(mapstruct *oldmap, mapstruct **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny)
static void blinded_sight(object *op)
static void expand_lighted_sight(object *op)
struct mapdef * tile_map[4]
short freearr_x[SIZEOFFREE]
static void expand_sight(object *op)
void draw_ext_info(int flags, int pri, const object *pl, uint8 type, uint8 subtype, const char *message, const char *oldmessage)
void make_sure_seen(const object *op)
static void check_wall(object *op, int x, int y)
short freearr_y[SIZEOFFREE]
static blocks block[MAP_CLIENT_X][MAP_CLIENT_Y]
void update_all_los(const mapstruct *map, int x, int y)
static void set_wall(object *op, int x, int y)
static void set_block(int x, int y, int bx, int by)
#define GET_MAP_LIGHT(M, X, Y)
#define QUERY_FLAG(xyz, p)
void clear_los(object *op)
#define MSG_TYPE_COMMAND_DEBUG
int has_carried_lights(const object *op)
int snprintf(char *dest, int max, const char *format,...)
void print_los(object *op)
void update_all_map_los(mapstruct *map)
void update_los(object *op)
EXTERN player * first_player
void LOG(LogLevel logLevel, const char *format,...)
void make_sure_not_seen(const object *op)
sint8 blocked_los[MAP_CLIENT_X][MAP_CLIENT_Y]