… | |
… | |
137 | for (x = 0; x < mx; x++) |
137 | for (x = 0; x < mx; x++) |
138 | { |
138 | { |
139 | for (y = 0; y < my; y++) |
139 | for (y = 0; y < my; y++) |
140 | { |
140 | { |
141 | if (x >= ns->mapx || y >= ns->mapy) |
141 | if (x >= ns->mapx || y >= ns->mapy) |
142 | { |
|
|
143 | /* clear cells outside the viewable area */ |
142 | /* clear cells outside the viewable area */ |
144 | memset (&newmap.cells[x][y], 0, sizeof (struct MapCell)); |
143 | memset (&newmap.cells[x][y], 0, sizeof (struct MapCell)); |
145 | } |
|
|
146 | else if ((x + dx) < 0 || (x + dx) >= ns->mapx || (y + dy) < 0 || (y + dy) >= ns->mapy) |
144 | else if ((x + dx) < 0 || (x + dx) >= ns->mapx || (y + dy) < 0 || (y + dy) >= ns->mapy) |
147 | { |
|
|
148 | /* clear newly visible tiles within the viewable area */ |
145 | /* clear newly visible tiles within the viewable area */ |
149 | memset (&(newmap.cells[x][y]), 0, sizeof (struct MapCell)); |
146 | memset (&(newmap.cells[x][y]), 0, sizeof (struct MapCell)); |
150 | } |
|
|
151 | else |
147 | else |
152 | { |
|
|
153 | memcpy (&(newmap.cells[x][y]), &(ns->lastmap.cells[x + dx][y + dy]), sizeof (struct MapCell)); |
148 | memcpy (&(newmap.cells[x][y]), &(ns->lastmap.cells[x + dx][y + dy]), sizeof (struct MapCell)); |
154 | } |
|
|
155 | } |
149 | } |
156 | } |
150 | } |
157 | |
151 | |
158 | memcpy (&(ns->lastmap), &newmap, sizeof (struct Map)); |
152 | memcpy (&(ns->lastmap), &newmap, sizeof (struct Map)); |
159 | |
153 | |
… | |
… | |
1131 | AddIfShort (pl->last_stats.Wis, pl->ob->stats.Wis, CS_STAT_WIS); |
1125 | AddIfShort (pl->last_stats.Wis, pl->ob->stats.Wis, CS_STAT_WIS); |
1132 | AddIfShort (pl->last_stats.Dex, pl->ob->stats.Dex, CS_STAT_DEX); |
1126 | AddIfShort (pl->last_stats.Dex, pl->ob->stats.Dex, CS_STAT_DEX); |
1133 | AddIfShort (pl->last_stats.Con, pl->ob->stats.Con, CS_STAT_CON); |
1127 | AddIfShort (pl->last_stats.Con, pl->ob->stats.Con, CS_STAT_CON); |
1134 | AddIfShort (pl->last_stats.Cha, pl->ob->stats.Cha, CS_STAT_CHA); |
1128 | AddIfShort (pl->last_stats.Cha, pl->ob->stats.Cha, CS_STAT_CHA); |
1135 | } |
1129 | } |
|
|
1130 | |
1136 | if (pl->socket.exp64) |
1131 | if (pl->socket.exp64) |
1137 | { |
1132 | { |
1138 | uint8 s; |
1133 | uint8 s; |
1139 | |
1134 | |
1140 | for (s = 0; s < NUM_SKILLS; s++) |
1135 | for (s = 0; s < NUM_SKILLS; s++) |
… | |
… | |
1150 | SockList_AddInt64 (&sl, pl->last_skill_ob[s]->stats.exp); |
1145 | SockList_AddInt64 (&sl, pl->last_skill_ob[s]->stats.exp); |
1151 | pl->last_skill_exp[s] = pl->last_skill_ob[s]->stats.exp; |
1146 | pl->last_skill_exp[s] = pl->last_skill_ob[s]->stats.exp; |
1152 | } |
1147 | } |
1153 | } |
1148 | } |
1154 | } |
1149 | } |
|
|
1150 | |
1155 | if (pl->socket.exp64) |
1151 | if (pl->socket.exp64) |
1156 | { |
|
|
1157 | AddIfInt64 (pl->last_stats.exp, pl->ob->stats.exp, CS_STAT_EXP64); |
1152 | { AddIfInt64 (pl->last_stats.exp, pl->ob->stats.exp, CS_STAT_EXP64) } |
1158 | } |
|
|
1159 | else |
1153 | else |
1160 | { |
|
|
1161 | AddIfInt (pl->last_stats.exp, (int) pl->ob->stats.exp, CS_STAT_EXP); |
1154 | { AddIfInt (pl->last_stats.exp, (int) pl->ob->stats.exp, CS_STAT_EXP) } |
1162 | } |
1155 | |
1163 | AddIfShort (pl->last_level, (char) pl->ob->level, CS_STAT_LEVEL); |
1156 | AddIfShort (pl->last_level, (char) pl->ob->level, CS_STAT_LEVEL); |
1164 | AddIfShort (pl->last_stats.wc, pl->ob->stats.wc, CS_STAT_WC); |
1157 | AddIfShort (pl->last_stats.wc, pl->ob->stats.wc, CS_STAT_WC); |
1165 | AddIfShort (pl->last_stats.ac, pl->ob->stats.ac, CS_STAT_AC); |
1158 | AddIfShort (pl->last_stats.ac, pl->ob->stats.ac, CS_STAT_AC); |
1166 | AddIfShort (pl->last_stats.dam, pl->ob->stats.dam, CS_STAT_DAM); |
1159 | AddIfShort (pl->last_stats.dam, pl->ob->stats.dam, CS_STAT_DAM); |
1167 | AddIfFloat (pl->last_speed, pl->ob->speed, CS_STAT_SPEED); |
1160 | AddIfFloat (pl->last_speed, pl->ob->speed, CS_STAT_SPEED); |
1168 | AddIfShort (pl->last_stats.food, pl->ob->stats.food, CS_STAT_FOOD); |
1161 | AddIfShort (pl->last_stats.food, pl->ob->stats.food, CS_STAT_FOOD); |
1169 | AddIfFloat (pl->last_weapon_sp, pl->weapon_sp, CS_STAT_WEAP_SP); |
1162 | AddIfFloat (pl->last_weapon_sp, pl->weapon_sp, CS_STAT_WEAP_SP); |
1170 | AddIfInt (pl->last_weight_limit, (sint32) weight_limit[pl->ob->stats.Str], CS_STAT_WEIGHT_LIM); |
1163 | AddIfInt (pl->last_weight_limit, (sint32) weight_limit[pl->ob->stats.Str], CS_STAT_WEIGHT_LIM); |
1171 | flags = 0; |
1164 | flags = 0; |
|
|
1165 | |
1172 | if (pl->fire_on) |
1166 | if (pl->fire_on) |
1173 | flags |= SF_FIREON; |
1167 | flags |= SF_FIREON; |
|
|
1168 | |
1174 | if (pl->run_on) |
1169 | if (pl->run_on) |
1175 | flags |= SF_RUNON; |
1170 | flags |= SF_RUNON; |
1176 | |
1171 | |
1177 | AddIfShort (pl->last_flags, flags, CS_STAT_FLAGS); |
1172 | AddIfShort (pl->last_flags, flags, CS_STAT_FLAGS); |
|
|
1173 | |
1178 | if (pl->socket.sc_version < 1025) |
1174 | if (pl->socket.sc_version < 1025) |
1179 | { |
|
|
1180 | AddIfShort (pl->last_resist[ATNR_PHYSICAL], pl->ob->resist[ATNR_PHYSICAL], CS_STAT_ARMOUR); |
1175 | { AddIfShort (pl->last_resist[ATNR_PHYSICAL], pl->ob->resist[ATNR_PHYSICAL], CS_STAT_ARMOUR) } |
1181 | } |
|
|
1182 | else |
1176 | else |
1183 | { |
1177 | { |
1184 | int i; |
1178 | int i; |
1185 | |
1179 | |
1186 | for (i = 0; i < NROFATTACKS; i++) |
1180 | for (i = 0; i < NROFATTACKS; i++) |
1187 | { |
1181 | { |
1188 | /* Skip ones we won't send */ |
1182 | /* Skip ones we won't send */ |
1189 | if (atnr_cs_stat[i] == -1) |
1183 | if (atnr_cs_stat[i] == -1) |
1190 | continue; |
1184 | continue; |
|
|
1185 | |
1191 | AddIfShort (pl->last_resist[i], pl->ob->resist[i], (char) atnr_cs_stat[i]); |
1186 | AddIfShort (pl->last_resist[i], pl->ob->resist[i], (char) atnr_cs_stat[i]); |
1192 | } |
1187 | } |
1193 | } |
1188 | } |
|
|
1189 | |
1194 | if (pl->socket.monitor_spells) |
1190 | if (pl->socket.monitor_spells) |
1195 | { |
1191 | { |
1196 | AddIfInt (pl->last_path_attuned, pl->ob->path_attuned, CS_STAT_SPELL_ATTUNE); |
1192 | AddIfInt (pl->last_path_attuned, pl->ob->path_attuned, CS_STAT_SPELL_ATTUNE); |
1197 | AddIfInt (pl->last_path_repelled, pl->ob->path_repelled, CS_STAT_SPELL_REPEL); |
1193 | AddIfInt (pl->last_path_repelled, pl->ob->path_repelled, CS_STAT_SPELL_REPEL); |
1198 | AddIfInt (pl->last_path_denied, pl->ob->path_denied, CS_STAT_SPELL_DENY); |
1194 | AddIfInt (pl->last_path_denied, pl->ob->path_denied, CS_STAT_SPELL_DENY); |
1199 | } |
1195 | } |
|
|
1196 | |
1200 | rangetostring (pl->ob, buf); /* we want use the new fire & run system in new client */ |
1197 | rangetostring (pl->ob, buf); /* we want use the new fire & run system in new client */ |
1201 | AddIfString (pl->socket.stats.range, buf, CS_STAT_RANGE); |
1198 | AddIfString (pl->socket.stats.range, buf, CS_STAT_RANGE); |
1202 | set_title (pl->ob, buf); |
1199 | set_title (pl->ob, buf); |
1203 | AddIfString (pl->socket.stats.title, buf, CS_STAT_TITLE); |
1200 | AddIfString (pl->socket.stats.title, buf, CS_STAT_TITLE); |
1204 | |
1201 | |
… | |
… | |
1208 | #ifdef ESRV_DEBUG |
1205 | #ifdef ESRV_DEBUG |
1209 | LOG (llevDebug, "Sending stats command, %d bytes long.\n", sl.len); |
1206 | LOG (llevDebug, "Sending stats command, %d bytes long.\n", sl.len); |
1210 | #endif |
1207 | #endif |
1211 | Send_With_Handling (&pl->socket, &sl); |
1208 | Send_With_Handling (&pl->socket, &sl); |
1212 | } |
1209 | } |
|
|
1210 | |
1213 | free (sl.buf); |
1211 | free (sl.buf); |
1214 | } |
1212 | } |
1215 | |
|
|
1216 | |
1213 | |
1217 | /** |
1214 | /** |
1218 | * Tells the client that here is a player it should start using. |
1215 | * Tells the client that here is a player it should start using. |
1219 | */ |
1216 | */ |
1220 | void |
1217 | void |
… | |
… | |
1238 | |
1235 | |
1239 | Send_With_Handling (&pl->socket, &sl); |
1236 | Send_With_Handling (&pl->socket, &sl); |
1240 | free (sl.buf); |
1237 | free (sl.buf); |
1241 | SET_FLAG (pl->ob, FLAG_CLIENT_SENT); |
1238 | SET_FLAG (pl->ob, FLAG_CLIENT_SENT); |
1242 | } |
1239 | } |
1243 | |
|
|
1244 | |
1240 | |
1245 | /** |
1241 | /** |
1246 | * Need to send an animation sequence to the client. |
1242 | * Need to send an animation sequence to the client. |
1247 | * We will send appropriate face commands to the client if we haven't |
1243 | * We will send appropriate face commands to the client if we haven't |
1248 | * sent them the face yet (this can become quite costly in terms of |
1244 | * sent them the face yet (this can become quite costly in terms of |
… | |
… | |
1458 | map_clearcell (struct MapCell *cell, int face0, int face1, int face2, int count) |
1454 | map_clearcell (struct MapCell *cell, int face0, int face1, int face2, int count) |
1459 | { |
1455 | { |
1460 | cell->faces[0] = face0; |
1456 | cell->faces[0] = face0; |
1461 | cell->faces[1] = face1; |
1457 | cell->faces[1] = face1; |
1462 | cell->faces[2] = face2; |
1458 | cell->faces[2] = face2; |
1463 | cell->count = count; |
1459 | cell->count = count; |
1464 | cell->stat_hp = 0; |
1460 | cell->stat_hp = 0; |
|
|
1461 | cell->flags = 0; |
1465 | cell->player = 0; |
1462 | cell->player = 0; |
1466 | } |
1463 | } |
1467 | |
1464 | |
1468 | #define MAX_HEAD_POS MAX(MAX_CLIENT_X, MAX_CLIENT_Y) |
1465 | #define MAX_HEAD_POS MAX(MAX_CLIENT_X, MAX_CLIENT_Y) |
1469 | #define MAX_LAYERS 3 |
1466 | #define MAX_LAYERS 3 |
1470 | |
1467 | |
… | |
… | |
1866 | strcpy ((char *) sl.buf, "map1 "); |
1863 | strcpy ((char *) sl.buf, "map1 "); |
1867 | else |
1864 | else |
1868 | strcpy ((char *) sl.buf, "map1a "); |
1865 | strcpy ((char *) sl.buf, "map1a "); |
1869 | sl.len = strlen ((char *) sl.buf); |
1866 | sl.len = strlen ((char *) sl.buf); |
1870 | startlen = sl.len; |
1867 | startlen = sl.len; |
|
|
1868 | |
1871 | /*Extendedmapinfo structure initialisation */ |
1869 | /*Extendedmapinfo structure initialisation */ |
1872 | if (socket.ext_mapinfos) |
1870 | if (socket.ext_mapinfos) |
1873 | { |
1871 | { |
1874 | esl.buf = (unsigned char *) malloc (MAXSOCKBUF); |
1872 | esl.buf = (unsigned char *) malloc (MAXSOCKBUF); |
1875 | strcpy ((char *) esl.buf, "mapextended "); |
1873 | strcpy ((char *) esl.buf, "mapextended "); |
1876 | esl.len = strlen ((char *) esl.buf); |
1874 | esl.len = strlen ((char *) esl.buf); |
1877 | extendedinfos = EMI_NOREDRAW; |
1875 | extendedinfos = EMI_NOREDRAW; |
|
|
1876 | |
1878 | if (socket.EMI_smooth) |
1877 | if (socket.EMI_smooth) |
1879 | extendedinfos |= EMI_SMOOTH; |
1878 | extendedinfos |= EMI_SMOOTH; |
|
|
1879 | |
1880 | ewhatstart = esl.len; |
1880 | ewhatstart = esl.len; |
1881 | ewhatflag = extendedinfos; /*The EMI_NOREDRAW bit |
1881 | ewhatflag = extendedinfos; /*The EMI_NOREDRAW bit |
1882 | could need to be taken away */ |
1882 | could need to be taken away */ |
1883 | SockList_AddChar (&esl, extendedinfos); |
1883 | SockList_AddChar (&esl, extendedinfos); |
1884 | eentrysize = getExtendedMapInfoSize (&socket); |
1884 | eentrysize = getExtendedMapInfoSize (&socket); |
… | |
… | |
1890 | /* suppress compiler warnings */ |
1890 | /* suppress compiler warnings */ |
1891 | ewhatstart = 0; |
1891 | ewhatstart = 0; |
1892 | ewhatflag = 0; |
1892 | ewhatflag = 0; |
1893 | estartlen = 0; |
1893 | estartlen = 0; |
1894 | } |
1894 | } |
|
|
1895 | |
1895 | /* Init data to zero */ |
1896 | /* Init data to zero */ |
1896 | memset (heads, 0, sizeof (object *) * MAX_HEAD_POS * MAX_HEAD_POS * MAX_LAYERS); |
1897 | memset (heads, 0, sizeof (object *) * MAX_HEAD_POS * MAX_HEAD_POS * MAX_LAYERS); |
1897 | |
1898 | |
1898 | /* x,y are the real map locations. ax, ay are viewport relative |
1899 | /* x,y are the real map locations. ax, ay are viewport relative |
1899 | * locations. |
1900 | * locations. |
… | |
… | |
1903 | /* We could do this logic as conditionals in the if statement, |
1904 | /* We could do this logic as conditionals in the if statement, |
1904 | * but that started to get a bit messy to look at. |
1905 | * but that started to get a bit messy to look at. |
1905 | */ |
1906 | */ |
1906 | max_x = pl->x + (socket.mapx + 1) / 2; |
1907 | max_x = pl->x + (socket.mapx + 1) / 2; |
1907 | max_y = pl->y + (socket.mapy + 1) / 2; |
1908 | max_y = pl->y + (socket.mapy + 1) / 2; |
|
|
1909 | |
1908 | if (socket.mapmode == Map1aCmd) |
1910 | if (socket.mapmode == Map1aCmd) |
1909 | { |
1911 | { |
1910 | max_x += MAX_HEAD_OFFSET; |
1912 | max_x += MAX_HEAD_OFFSET; |
1911 | max_y += MAX_HEAD_OFFSET; |
1913 | max_y += MAX_HEAD_OFFSET; |
1912 | } |
1914 | } |
… | |
… | |
1945 | * with no faces tells the client to blank out the |
1947 | * with no faces tells the client to blank out the |
1946 | * space. |
1948 | * space. |
1947 | */ |
1949 | */ |
1948 | got_one = 0; |
1950 | got_one = 0; |
1949 | for (i = oldlen + 2; i < sl.len; i++) |
1951 | for (i = oldlen + 2; i < sl.len; i++) |
1950 | { |
|
|
1951 | if (sl.buf[i]) |
1952 | if (sl.buf[i]) |
1952 | got_one = 1; |
1953 | got_one = 1; |
1953 | } |
|
|
1954 | |
1954 | |
1955 | if (got_one && (mask & 0xf)) |
1955 | if (got_one && (mask & 0xf)) |
1956 | { |
|
|
1957 | sl.buf[oldlen + 1] = mask & 0xff; |
1956 | sl.buf[oldlen + 1] = mask & 0xff; |
1958 | } |
|
|
1959 | else |
1957 | else |
1960 | { /*either all faces blank, either no face at all */ |
1958 | { /*either all faces blank, either no face at all */ |
1961 | if (mask & 0xf) /*at least 1 face, we know it's blank, only send coordinates */ |
1959 | if (mask & 0xf) /*at least 1 face, we know it's blank, only send coordinates */ |
1962 | sl.len = oldlen + 2; |
1960 | sl.len = oldlen + 2; |
1963 | else |
1961 | else |
1964 | sl.len = oldlen; |
1962 | sl.len = oldlen; |
1965 | } |
1963 | } |
|
|
1964 | |
1966 | /*What concerns extendinfos, nothing to be done for now |
1965 | /*What concerns extendinfos, nothing to be done for now |
1967 | * (perhaps effects layer later) |
1966 | * (perhaps effects layer later) |
1968 | */ |
1967 | */ |
1969 | continue; /* don't do processing below */ |
1968 | continue; /* don't do processing below */ |
1970 | } |
1969 | } |
1971 | |
1970 | |
1972 | MapCell & lastcell = socket.lastmap.cells[ax][ay]; |
1971 | MapCell &lastcell = socket.lastmap.cells[ax][ay]; |
1973 | |
1972 | |
1974 | d = pl->contr->blocked_los[ax][ay]; |
1973 | d = pl->contr->blocked_los[ax][ay]; |
1975 | |
1974 | |
1976 | /* If the coordinates are not valid, or it is too dark to see, |
1975 | /* If the coordinates are not valid, or it is too dark to see, |
1977 | * we tell the client as such |
1976 | * we tell the client as such |
1978 | */ |
1977 | */ |
1979 | nx = x; |
1978 | nx = x; |
1980 | ny = y; |
1979 | ny = y; |
1981 | m = get_map_from_coord (pl->map, &nx, &ny); |
1980 | m = get_map_from_coord (pl->map, &nx, &ny); |
|
|
1981 | |
1982 | if (!m) |
1982 | if (!m) |
1983 | { |
1983 | { |
1984 | /* space is out of map. Update space and clear values |
1984 | /* space is out of map. Update space and clear values |
1985 | * if this hasn't already been done. If the space is out |
1985 | * if this hasn't already been done. If the space is out |
1986 | * of the map, it shouldn't have a head |
1986 | * of the map, it shouldn't have a head |
… | |
… | |
2000 | */ |
2000 | */ |
2001 | |
2001 | |
2002 | oldlen = sl.len; |
2002 | oldlen = sl.len; |
2003 | |
2003 | |
2004 | SockList_AddShort (&sl, mask); |
2004 | SockList_AddShort (&sl, mask); |
|
|
2005 | |
2005 | if (lastcell.count != -1) |
2006 | if (lastcell.count != -1) |
2006 | need_send = 1; |
2007 | need_send = 1; |
|
|
2008 | |
2007 | count = -1; |
2009 | count = -1; |
2008 | |
2010 | |
2009 | if (socket.mapmode == Map1aCmd && have_head (ax, ay)) |
2011 | if (socket.mapmode == Map1aCmd && have_head (ax, ay)) |
2010 | { |
2012 | { |
2011 | /* Now check to see if any heads need to be sent */ |
2013 | /* Now check to see if any heads need to be sent */ |
… | |
… | |
2016 | mask |= 0x2; |
2018 | mask |= 0x2; |
2017 | if (check_head (sl, socket, ax, ay, 0)) |
2019 | if (check_head (sl, socket, ax, ay, 0)) |
2018 | mask |= 0x1; |
2020 | mask |= 0x1; |
2019 | |
2021 | |
2020 | lastcell.count = count; |
2022 | lastcell.count = count; |
2021 | |
|
|
2022 | } |
2023 | } |
2023 | else |
2024 | else |
2024 | { |
2025 | { |
2025 | struct MapCell *cell = &lastcell; |
|
|
2026 | |
|
|
2027 | /* properly clear a previously sent big face */ |
2026 | /* properly clear a previously sent big face */ |
2028 | if (cell->faces[0] != 0 || cell->faces[1] != 0 || cell->faces[2] != 0) |
2027 | if (lastcell.faces[0] != 0 || lastcell.faces[1] != 0 || lastcell.faces[2] != 0 |
|
|
2028 | || lastcell.stat_hp || lastcell.flags || lastcell.player) |
2029 | need_send = 1; |
2029 | need_send = 1; |
|
|
2030 | |
2030 | map_clearcell (&lastcell, 0, 0, 0, count); |
2031 | map_clearcell (&lastcell, 0, 0, 0, count); |
2031 | } |
2032 | } |
2032 | |
2033 | |
2033 | if ((mask & 0xf) || need_send) |
2034 | if ((mask & 0xf) || need_send) |
2034 | { |
|
|
2035 | sl.buf[oldlen + 1] = mask & 0xff; |
2035 | sl.buf[oldlen + 1] = mask & 0xff; |
2036 | } |
|
|
2037 | else |
2036 | else |
2038 | { |
|
|
2039 | sl.len = oldlen; |
2037 | sl.len = oldlen; |
2040 | } |
|
|
2041 | } |
2038 | } |
2042 | else |
2039 | else |
2043 | { |
2040 | { |
2044 | /* In this block, the space is visible or there are head objects |
2041 | /* In this block, the space is visible or there are head objects |
2045 | * we need to send. |
2042 | * we need to send. |
… | |
… | |
2086 | |
2083 | |
2087 | if (socket.extmap) |
2084 | if (socket.extmap) |
2088 | { |
2085 | { |
2089 | uint8 stat_hp = 0; |
2086 | uint8 stat_hp = 0; |
2090 | uint8 stat_width = 0; |
2087 | uint8 stat_width = 0; |
|
|
2088 | uint8 flags = 0; |
2091 | tag_t player = 0; |
2089 | tag_t player = 0; |
2092 | |
2090 | |
2093 | // send hp information, if applicable |
2091 | // send hp information, if applicable |
2094 | if (object *op = GET_MAP_FACE_OBJ (m, nx, ny, 0)) |
2092 | if (object *op = GET_MAP_FACE_OBJ (m, nx, ny, 0)) |
2095 | { |
2093 | { |
… | |
… | |
2103 | stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; |
2101 | stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; |
2104 | stat_width = op->arch->tail_x; |
2102 | stat_width = op->arch->tail_x; |
2105 | } |
2103 | } |
2106 | } |
2104 | } |
2107 | |
2105 | |
|
|
2106 | if (op->msg && op->msg[0] == '@') |
|
|
2107 | flags |= 1; |
|
|
2108 | |
2108 | if (op->type == PLAYER && op != pl) |
2109 | if (op->type == PLAYER && op != pl) |
2109 | player = op->count; |
2110 | player = op->count; |
2110 | } |
2111 | } |
2111 | |
2112 | |
2112 | if (lastcell.stat_hp != stat_hp) |
2113 | if (lastcell.stat_hp != stat_hp) |
… | |
… | |
2137 | last_ext = sl.buf + sl.len; |
2138 | last_ext = sl.buf + sl.len; |
2138 | SockList_AddChar (&sl, 0x47); |
2139 | SockList_AddChar (&sl, 0x47); |
2139 | SockList_AddChar (&sl, 4); |
2140 | SockList_AddChar (&sl, 4); |
2140 | SockList_AddInt (&sl, player); |
2141 | SockList_AddInt (&sl, player); |
2141 | } |
2142 | } |
|
|
2143 | |
|
|
2144 | if (lastcell.flags != flags) |
|
|
2145 | { |
|
|
2146 | lastcell.flags = flags; |
|
|
2147 | |
|
|
2148 | mask |= 0x8; |
|
|
2149 | *last_ext |= 0x80; |
|
|
2150 | last_ext = sl.buf + sl.len; |
|
|
2151 | SockList_AddChar (&sl, 8); |
|
|
2152 | SockList_AddChar (&sl, flags); |
|
|
2153 | } |
2142 | } |
2154 | } |
2143 | |
2155 | |
2144 | /* Floor face */ |
2156 | /* Floor face */ |
2145 | if (update_space (&sl, &socket, m, nx, ny, ax, ay, 2)) |
2157 | if (update_space (&sl, &socket, m, nx, ny, ax, ay, 2)) |
2146 | mask |= 0x4; |
2158 | mask |= 0x4; |
… | |
… | |
2161 | { |
2173 | { |
2162 | if (lastcell.faces[0] != pl->face->number) |
2174 | if (lastcell.faces[0] != pl->face->number) |
2163 | { |
2175 | { |
2164 | lastcell.faces[0] = pl->face->number; |
2176 | lastcell.faces[0] = pl->face->number; |
2165 | mask |= 0x1; |
2177 | mask |= 0x1; |
|
|
2178 | |
2166 | if (!(socket.faces_sent[pl->face->number] & NS_FACESENT_FACE)) |
2179 | if (!(socket.faces_sent[pl->face->number] & NS_FACESENT_FACE)) |
2167 | esrv_send_face (&socket, pl->face->number, 0); |
2180 | esrv_send_face (&socket, pl->face->number, 0); |
|
|
2181 | |
2168 | SockList_AddShort (&sl, pl->face->number); |
2182 | SockList_AddShort (&sl, pl->face->number); |
2169 | } |
2183 | } |
2170 | } |
2184 | } |
2171 | /* Top face */ |
|
|
2172 | else |
2185 | else |
2173 | { |
2186 | { |
|
|
2187 | /* Top face */ |
2174 | if (update_space (&sl, &socket, m, nx, ny, ax, ay, 0)) |
2188 | if (update_space (&sl, &socket, m, nx, ny, ax, ay, 0)) |
2175 | mask |= 0x1; |
2189 | mask |= 0x1; |
|
|
2190 | |
2176 | if (socket.EMI_smooth) |
2191 | if (socket.EMI_smooth) |
2177 | if (update_smooth (&esl, &socket, m, nx, ny, ax, ay, 0)) |
2192 | if (update_smooth (&esl, &socket, m, nx, ny, ax, ay, 0)) |
2178 | { |
|
|
2179 | emask |= 0x1; |
2193 | emask |= 0x1; |
2180 | } |
|
|
2181 | } |
2194 | } |
|
|
2195 | |
2182 | /* Check to see if we are in fact sending anything for this |
2196 | /* Check to see if we are in fact sending anything for this |
2183 | * space by checking the mask. If so, update the mask. |
2197 | * space by checking the mask. If so, update the mask. |
2184 | * if not, reset the len to that from before adding the mask |
2198 | * if not, reset the len to that from before adding the mask |
2185 | * value, so we don't send those bits. |
2199 | * value, so we don't send those bits. |
2186 | */ |
2200 | */ |
2187 | if (mask & 0xf) |
2201 | if (mask & 0xf) |
2188 | { |
|
|
2189 | sl.buf[oldlen + 1] = mask & 0xff; |
2202 | sl.buf[oldlen + 1] = mask & 0xff; |
2190 | } |
|
|
2191 | else |
2203 | else |
2192 | { |
|
|
2193 | sl.len = oldlen; |
2204 | sl.len = oldlen; |
2194 | } |
2205 | |
2195 | if (emask & 0xf) |
2206 | if (emask & 0xf) |
2196 | { |
|
|
2197 | esl.buf[eoldlen + 1] = emask & 0xff; |
2207 | esl.buf[eoldlen + 1] = emask & 0xff; |
2198 | } |
|
|
2199 | else |
2208 | else |
2200 | { |
|
|
2201 | esl.len = eoldlen; |
2209 | esl.len = eoldlen; |
2202 | } |
|
|
2203 | } /* else this is a viewable space */ |
2210 | } /* else this is a viewable space */ |
2204 | } /* for x loop */ |
2211 | } /* for x loop */ |
2205 | } /* for y loop */ |
2212 | } /* for y loop */ |
2206 | |
2213 | |
2207 | /* Verify that we in fact do need to send this */ |
2214 | /* Verify that we in fact do need to send this */ |