Go to the documentation of this file.
45 #define FOG_MAP_SIZE 512
51 #define FOG_BORDER_MIN 128
56 #define MAX_FACE_SIZE 16
63 #define CURRENT_MAX_VIEW 33
120 int clear_cells_i, j;
123 for (clear_cells_i = 0; clear_cells_i < (len_y); clear_cells_i++) {
191 for (sdx=-1; sdx<2; sdx++)
192 for (sdy=-1; sdy<2; sdy++)
223 for (dx = 0; dx < w; dx++) {
224 for (dy = !dx; dy < h; dy++) {
315 for (dx = 0; dx < w; dx++) {
316 for (dy = !dx; dy < h; dy++) {
353 for (dx = 0; dx < w && dx <= x; dx++) {
354 for (dy = !dx; dy < h && dy <= y; dy++) {
356 assert(0 <= x-dx && x-dx <
MAX_VIEW);
357 assert(0 <= y-dy && y-dy <
MAX_VIEW);
370 if (0 <= x-dx && x-dx <
width
371 && 0 <= y-dy && y-dy <
height) {
374 if (set_need_update) {
405 head = &headcell->
head;
406 if (head->
face != 0) {
410 if (headcell->
prev != NULL) {
413 if (headcell->
next != NULL) {
417 assert(headcell->
prev == NULL);
420 assert(headcell->
prev != NULL);
422 headcell->
prev = NULL;
423 headcell->
next = NULL;
428 assert(head->
size_x == 1);
429 assert(head->
size_y == 1);
453 head = &headcell->
head;
460 assert(headcell->
prev == NULL);
461 assert(headcell->
next == NULL);
478 for (dx = 0; dx < w && dx <= x; dx++) {
479 for (dy = !dx; dy < h && dy <= y; dy++) {
481 assert(0 <= x-dx && x-dx <
MAX_VIEW);
482 assert(0 <= y-dy && y-dy <
MAX_VIEW);
489 if (0 <= x-dx && x-dx <
width
490 && 0 <= y-dy && y-dy <
height) {
518 for (dx = 0; dx < w; dx++) {
519 for (dy = 0; dy < h; dy++) {
543 if (head->
face != 0) {
546 assert(head->
size_x == 1);
547 assert(head->
size_y == 1);
557 g_assert(
map->_cells != NULL);
569 for (
int i = 0; i <
map->width; i++) {
570 map->_cells[i] =
map->_cells[0]+i*
map->height;
637 return(x >= 0 && x < width && y >= 0 && y <
height);
766 static int dx[8]= {0,1,1,1,0,-1,-1,-1};
767 static int dy[8]= {-1,-1,0,1,1,1,0,-1};
768 int rx, ry, px, py, i;
779 for (i=0; i<8; i++) {
860 int i, face, animation, phase, speed_left;
876 if (num_animations == 0) {
878 "animating object with zero animations");
881 phase = g_random_int() % num_animations;
883 speed_left = anim_speed % g_random_int();
965 for (
x = 0;
x < -dx;
x++) {
981 for (
y = 0;
y < -dy;
y++) {
1058 if (head->
face != 0) {
1062 }
else if (tail->
face != 0) {
1097 assert(0 <= dx && dx < w);
1098 assert(0 <= dy && dy < h);
1125 if (!clear_bigface) {
1142 assert(0 <= dx && dx < w);
1143 assert(0 <= dy && dy < h);
1194 int shift_x, shift_y;
1239 if (shift_x == 0 && shift_y == 0) {
1266 if (shift_x <= -the_map.width || shift_x >=
the_map.
width
1267 || shift_y <= -the_map.height || shift_y >=
the_map.
height) {
1303 for (sx = src_x, dx = dst_x, i = 0; i < len_x; sx++, dx++, i++) {
1309 }
else if (shift_x > 0) {
1310 for (sx = src_x+len_x-1, dx = dst_x+len_x-1, i = 0; i < len_x; sx--, dx--, i++) {
1317 assert(src_x == dst_x);
1318 for (dx = src_x, i = 0; i < len_x; dx++, i++) {
1327 for (dx = 0; dx < dst_x; dx++) {
1334 for (dx = 0; dx < len_x; dx++) {
1337 }
else if (shift_y < 0) {
1338 for (dx = 0; dx < len_x; dx++) {
1370 int x, y, layer,
face;
1404 for (layer=0; layer<
MAXLAYERS; layer++) {
1406 cell = &map_space->
heads[layer];
struct MapCell * mapdata_cell(const int x, const int y)
void mapdata_clear_space(int x, int y)
int relative_direction(int dx, int dy)
@ LOG_WARNING
Warning that something might not work.
gint16 mapdata_bigface(int x, int y, int layer, int *ww, int *hh)
void mapdata_set_face_layer(int x, int y, gint16 face, int layer)
void mapdata_newmap(void)
gint16 mapdata_face(int x, int y, int layer)
static void expand_need_update(int x, int y, int w, int h)
void mapdata_set_smooth(int x, int y, guint8 smooth, int layer)
static struct BigCell * bigfaces_head
void mapdata_set_check_space(int x, int y)
bool mapdata_can_smooth(int x, int y, int layer)
static void expand_clear_face(int x, int y, int w, int h, int layer)
static void mapdata_alloc(struct Map *const map, const int width, const int height)
void mapdata_clear_old(int x, int y)
static void expand_need_update_from_layer(int x, int y, int layer)
int display_mapscroll(int dx, int dy)
static void expand_set_bigface(int x, int y, int layer, gint16 face, int clear)
static void mapdata_init(void)
static void recenter_virtual_map_view(int diff_x, int diff_y)
struct MapCellLayer heads[MAXLAYERS]
static void mapdata_get_image_size(int face, guint8 *w, guint8 *h)
void mapdata_size(int *x, int *y)
static bool mapdata_has_tile(int x, int y, int layer)
void mapdata_set_anim_layer(int x, int y, guint16 anim, guint8 anim_speed, int layer)
void LOG(LogLevel level, const char *origin, const char *format,...)
gint16 mapdata_bigface_head(int x, int y, int layer, int *ww, int *hh)
static struct Map the_map
gint16 want_config[CONFIG_NUMS]
static void expand_clear_bigface_from_layer(int x, int y, int layer, int set_need_update)
gint16 mapdata_face_info(int mx, int my, int layer, int *dx, int *dy)
static void mark_resmooth(int x, int y, int layer)
void get_map_image_size(int face, guint8 *w, guint8 *h)
int mapdata_is_inside(int x, int y)
bool mapdata_contains(int x, int y)
static void expand_clear_bigface(int x, int y, int w, int h, int layer, int set_need_update)
void set_move_to(int dx, int dy)
struct MapCellTailLayer tails[MAXLAYERS]
static void set_darkness(int x, int y, int darkness)
static struct BigCell bigfaces[MAX_VIEW][MAX_VIEW][MAXLAYERS]
void mapdata_scroll(int dx, int dy)
void mapdata_set_size(int viewx, int viewy)
static void expand_clear_face_from_layer(int x, int y, int layer)
void pl_mpos(int *px, int *py)
void mapdata_set_darkness(int x, int y, int darkness)
gint16 use_config[CONFIG_NUMS]
Animations animations[MAXANIM]
static void clear_cells(int x, int y, int len_y)
static void expand_set_face(int x, int y, int layer, gint16 face, int clear)
struct MapCellTailLayer tail
void mapdata_animation(void)
PlayerPosition script_pos