From 3f3657e0279b4f7b111906870e8b974359cc7463 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 25 Oct 2015 15:39:07 +0300 Subject: Add layer field into wall. For now it used 0 from scripts. --- src/emap/map.c | 19 ++++++++++++------- src/emap/map.h | 1 + src/emap/script.c | 2 +- src/emap/send.c | 8 ++++---- src/emap/send.h | 2 ++ src/emap/struct/walldata2.h | 1 + 6 files changed, 21 insertions(+), 12 deletions(-) (limited to 'src/emap') diff --git a/src/emap/map.c b/src/emap/map.c index 51c1ce9..0a81291 100644 --- a/src/emap/map.c +++ b/src/emap/map.c @@ -405,7 +405,7 @@ void emap_iwall_get(struct map_session_data *sd) { if (wall->m != sd->bl.m) continue; - send_setwall_single(sd->fd, wall->m, wall->x1, wall->y1 , wall->x2 , wall->y2 , wall->mask); + send_setwall_single(sd->fd, wall->m, wall->layer, wall->x1, wall->y1 , wall->x2 , wall->y2 , wall->mask); } dbi_destroy(iter); hookStop(); @@ -429,19 +429,23 @@ void emap_iwall_remove(const char *name) int x2 = wall->x2; int y2 = wall->y2; int m = wall->m; - for (y = y1; y <= y2; y ++) + int layer = wall->layer; + if (layer == 0) { - for (x = x1; x <= x2; x ++) - emap_setgatcell2(m, x, y, mask); // default collision can be lost + for (y = y1; y <= y2; y ++) + { + for (x = x1; x <= x2; x ++) + emap_setgatcell2(m, x, y, mask); // default collision can be lost + } } - send_setwall(m, x1, y1, x2, y2, mask, ALL_SAMEMAP); + send_setwall(m, layer, x1, y1, x2, y2, mask, ALL_SAMEMAP); map->list[wall->m].iwall_num--; strdb_remove(map->iwall_db, wall->name); hookStop(); } -bool emap_iwall_set2(int m, int x1, int y1, int x2, int y2, int mask, const char *name) +bool emap_iwall_set2(int m, int layer, int x1, int y1, int x2, int y2, int mask, const char *name) { struct WallData *wall; @@ -458,6 +462,7 @@ bool emap_iwall_set2(int m, int x1, int y1, int x2, int y2, int mask, const char wall->x2 = x2; wall->y2 = y2; wall->mask = mask; + wall->layer = layer; safestrncpy(wall->name, name, sizeof(wall->name)); int x; @@ -467,7 +472,7 @@ bool emap_iwall_set2(int m, int x1, int y1, int x2, int y2, int mask, const char for (x = x1; x <= x2; x ++) emap_setgatcell2(m, x, y, mask); } - send_setwall(m, x1, y1, x2, y2, mask, ALL_SAMEMAP); + send_setwall(m, layer, x1, y1, x2, y2, mask, ALL_SAMEMAP); strdb_put(map->iwall_db, wall->name, wall); map->list[m].iwall_num++; diff --git a/src/emap/map.h b/src/emap/map.h index f0bf8d5..1e57749 100644 --- a/src/emap/map.h +++ b/src/emap/map.h @@ -34,6 +34,7 @@ bool emap_iwall_set(int16 *m, void emap_iwall_get(struct map_session_data *sd); void emap_iwall_remove(const char *name); bool emap_iwall_set2(int m, + int layer, int x1, int y1, int x2, int y2, int mask, diff --git a/src/emap/script.c b/src/emap/script.c index 1874564..d64f190 100644 --- a/src/emap/script.c +++ b/src/emap/script.c @@ -1756,7 +1756,7 @@ BUILDIN(setCells) if ((m = map->mapname2mapid(mapname)) < 0) return true; // Invalid Map - emap_iwall_set2(m, x1, y1, x2, y2, mask, name); + emap_iwall_set2(m, 0, x1, y1, x2, y2, mask, name); return true; } diff --git a/src/emap/send.c b/src/emap/send.c index 8af9dc6..815464a 100644 --- a/src/emap/send.c +++ b/src/emap/send.c @@ -398,7 +398,7 @@ void send_changelook2(struct map_session_data* sd, struct block_list *bl, int id clif->send(buf, 19, bl, target); } -void send_setwall(int m, int x1, int y1, int x2, int y2, int mask, enum send_target target) +void send_setwall(int m, int layer, int x1, int y1, int x2, int y2, int mask, enum send_target target) { unsigned char buf[50]; @@ -408,7 +408,7 @@ void send_setwall(int m, int x1, int y1, int x2, int y2, int mask, enum send_tar WBUFW(buf, 6) = x2; WBUFW(buf, 8) = y2; WBUFL(buf, 10) = mask; - WBUFL(buf, 14) = 0; + WBUFL(buf, 14) = layer; mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name,(char*)WBUFP(buf, 18)); struct block_list dummy_bl; @@ -419,7 +419,7 @@ void send_setwall(int m, int x1, int y1, int x2, int y2, int mask, enum send_tar clif->send(buf, 34, &dummy_bl, target); } -void send_setwall_single(int fd, int m, int x1, int y1, int x2, int y2, int mask) +void send_setwall_single(int fd, int m, int layer, int x1, int y1, int x2, int y2, int mask) { struct SessionExt *data = session_get(fd); if (!data || data->clientVersion < 14) @@ -432,7 +432,7 @@ void send_setwall_single(int fd, int m, int x1, int y1, int x2, int y2, int mask WFIFOW(fd, 6) = x2; WFIFOW(fd, 8) = y2; WFIFOL(fd, 10) = mask; - WFIFOL(fd, 14) = 0; + WFIFOL(fd, 14) = layer; mapindex->getmapname_ext(map->list[m].custom_name ? map->list[map->list[m].instance_src_map].name : map->list[m].name,(char*)WFIFOP(fd, 18)); WFIFOSET(fd, 34); } diff --git a/src/emap/send.h b/src/emap/send.h index aec7e60..7634f1a 100644 --- a/src/emap/send.h +++ b/src/emap/send.h @@ -34,12 +34,14 @@ void send_changelook2(struct map_session_data* sd, struct block_list *bl, int val, int val2, struct item_data *data, int n, enum send_target target); void send_setwall(int m, + int layer, int x1, int y1, int x2, int y2, int mask, enum send_target target); void send_setwall_single(int fd, int m, + int layer, int x1, int y1, int x2, int y2, int mask); diff --git a/src/emap/struct/walldata2.h b/src/emap/struct/walldata2.h index 781ebb3..a49013d 100644 --- a/src/emap/struct/walldata2.h +++ b/src/emap/struct/walldata2.h @@ -7,6 +7,7 @@ struct WallData { char name[50]; + int layer; int x1; int y1; int x2; -- cgit v1.2.3-70-g09d2