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
122 int clear_cells_i, j;
125 for (clear_cells_i = 0; clear_cells_i < (len_y); clear_cells_i++) {
218 for (sdx=-1; sdx<2; sdx++)
219 for (sdy=-1; sdy<2; sdy++)
250 for (dx = 0; dx < w; dx++) {
251 for (dy = !dx; dy < h; dy++) {
342 for (dx = 0; dx < w; dx++) {
343 for (dy = !dx; dy < h; dy++) {
380 for (dx = 0; dx < w && dx <= x; dx++) {
381 for (dy = !dx; dy < h && dy <= y; dy++) {
383 assert(0 <= x-dx && x-dx <
MAX_VIEW);
384 assert(0 <= y-dy && y-dy <
MAX_VIEW);
397 if (0 <= x-dx && x-dx <
width
398 && 0 <= y-dy && y-dy <
height) {
401 if (set_need_update) {
432 head = &headcell->
head;
433 if (head->
face != 0) {
437 if (headcell->
prev != NULL) {
440 if (headcell->
next != NULL) {
444 assert(headcell->
prev == NULL);
447 assert(headcell->
prev != NULL);
449 headcell->
prev = NULL;
450 headcell->
next = NULL;
455 assert(head->
size_x == 1);
456 assert(head->
size_y == 1);
480 head = &headcell->
head;
487 assert(headcell->
prev == NULL);
488 assert(headcell->
next == NULL);
505 for (dx = 0; dx < w && dx <= x; dx++) {
506 for (dy = !dx; dy < h && dy <= y; dy++) {
508 assert(0 <= x-dx && x-dx <
MAX_VIEW);
509 assert(0 <= y-dy && y-dy <
MAX_VIEW);
516 if (0 <= x-dx && x-dx <
width
517 && 0 <= y-dy && y-dy <
height) {
545 for (dx = 0; dx < w; dx++) {
546 for (dy = 0; dy < h; dy++) {
570 if (head->
face != 0) {
573 assert(head->
size_x == 1);
574 assert(head->
size_y == 1);
584 g_assert(
map->_cells != NULL);
596 for (
int i = 0; i <
map->width; i++) {
597 map->_cells[i] =
map->_cells[0]+i*
map->height;
664 return(x >= 0 && x < width && y >= 0 && y <
height);
777 static int dx[8]= {0,1,1,1,0,-1,-1,-1};
778 static int dy[8]= {-1,-1,0,1,1,1,0,-1};
779 int rx, ry, px, py, i;
790 for (i=0; i<8; i++) {
870 int i, face, animation, phase, speed_left;
886 if (num_animations == 0) {
888 "animating object with zero animations");
891 phase = g_random_int() % num_animations;
893 speed_left = anim_speed % g_random_int();
963 for (
x = 0;
x < -dx;
x++) {
977 for (
y = 0;
y < -dy;
y++) {
1053 if (head->
face != 0) {
1057 }
else if (tail->
face != 0) {
1092 assert(0 <= dx && dx < w);
1093 assert(0 <= dy && dy < h);
1120 if (!clear_bigface) {
1137 assert(0 <= dx && dx < w);
1138 assert(0 <= dy && dy < h);
1189 int shift_x, shift_y;
1234 if (shift_x == 0 && shift_y == 0) {
1261 if (shift_x <= -the_map.width || shift_x >=
the_map.
width
1262 || shift_y <= -the_map.height || shift_y >=
the_map.
height) {
1298 for (sx = src_x, dx = dst_x, i = 0; i < len_x; sx++, dx++, i++) {
1304 }
else if (shift_x > 0) {
1305 for (sx = src_x+len_x-1, dx = dst_x+len_x-1, i = 0; i < len_x; sx--, dx--, i++) {
1312 assert(src_x == dst_x);
1313 for (dx = src_x, i = 0; i < len_x; dx++, i++) {
1322 for (dx = 0; dx < dst_x; dx++) {
1329 for (dx = 0; dx < len_x; dx++) {
1332 }
else if (shift_y < 0) {
1333 for (dx = 0; dx < len_x; dx++) {
1365 int x, y, layer,
face;
1399 for (layer=0; layer<
MAXLAYERS; layer++) {
1401 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)
static void mapdata_get_image_size(int face, guint8 *w, guint8 *h)
void mapdata_size(int *x, int *y)
struct MapCellLayer heads[MAXLAYERS]
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)
struct MapCellTailLayer tails[MAXLAYERS]
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)
void mapdata_clear(int x, int y)
static void mark_resmooth(int x, int y, int layer)
struct MapCellTailLayer tail
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)
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)
void mapdata_animation(void)
PlayerPosition script_pos