… | |
… | |
315 | |
315 | |
316 | cell = row->col + x - row->c0; |
316 | cell = row->col + x - row->c0; |
317 | |
317 | |
318 | cell->darkness = 0; |
318 | cell->darkness = 0; |
319 | cell->stat_hp = 0; |
319 | cell->stat_hp = 0; |
|
|
320 | cell->flags = 0; |
|
|
321 | cell->player = 0; |
320 | } |
322 | } |
321 | } |
323 | } |
322 | } |
324 | } |
323 | |
325 | |
324 | static void |
326 | static void |
… | |
… | |
1244 | void |
1246 | void |
1245 | scroll (CFPlus::Map self, int dx, int dy) |
1247 | scroll (CFPlus::Map self, int dx, int dy) |
1246 | CODE: |
1248 | CODE: |
1247 | { |
1249 | { |
1248 | if (dx > 0) |
1250 | if (dx > 0) |
1249 | map_blank (self, self->x, self->y, dx - 1, self->h); |
1251 | map_blank (self, self->x, self->y, dx, self->h); |
1250 | else if (dx < 0) |
1252 | else if (dx < 0) |
1251 | map_blank (self, self->x + self->w + dx + 1, self->y, 1 - dx, self->h); |
1253 | map_blank (self, self->x + self->w + dx + 1, self->y, -dx, self->h); |
1252 | |
1254 | |
1253 | if (dy > 0) |
1255 | if (dy > 0) |
1254 | map_blank (self, self->x, self->y, self->w, dy - 1); |
1256 | map_blank (self, self->x, self->y, self->w, dy); |
1255 | else if (dy < 0) |
1257 | else if (dy < 0) |
1256 | map_blank (self, self->x, self->y + self->h + dy + 1, self->w, 1 - dy); |
1258 | map_blank (self, self->x, self->y + self->h + dy + 1, self->w, -dy); |
1257 | |
1259 | |
1258 | self->ox += dx; self->x += dx; |
1260 | self->ox += dx; self->x += dx; |
1259 | self->oy += dy; self->y += dy; |
1261 | self->oy += dy; self->y += dy; |
1260 | |
1262 | |
1261 | while (self->y < 0) |
1263 | while (self->y < 0) |
… | |
… | |
1287 | |
1289 | |
1288 | if (flags & 15) |
1290 | if (flags & 15) |
1289 | { |
1291 | { |
1290 | if (!cell->darkness) |
1292 | if (!cell->darkness) |
1291 | { |
1293 | { |
|
|
1294 | memset (cell, 0, sizeof (*cell)); |
1292 | cell->darkness = 256; |
1295 | cell->darkness = 256; |
1293 | cell->face [0] = 0; |
|
|
1294 | cell->face [1] = 0; |
|
|
1295 | cell->face [2] = 0; |
|
|
1296 | } |
1296 | } |
1297 | |
1297 | |
1298 | //TODO: don't trust server data to be in-range(!) |
1298 | //TODO: don't trust server data to be in-range(!) |
1299 | |
1299 | |
1300 | if (flags & 8) |
1300 | if (flags & 8) |
… | |
… | |
1333 | } |
1333 | } |
1334 | while (ext & 0x80); |
1334 | while (ext & 0x80); |
1335 | } |
1335 | } |
1336 | else |
1336 | else |
1337 | cell->darkness = *data++ + 1; |
1337 | cell->darkness = *data++ + 1; |
|
|
1338 | |
1338 | } |
1339 | } |
1339 | |
1340 | |
1340 | if (flags & 4) |
1341 | if (flags & 4) |
1341 | { |
1342 | { |
1342 | cell->face [0] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1343 | cell->face [0] = self->face [(data [0] << 8) + data [1]]; data += 2; |
… | |
… | |
1351 | { |
1352 | { |
1352 | cell->face [2] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1353 | cell->face [2] = self->face [(data [0] << 8) + data [1]]; data += 2; |
1353 | } |
1354 | } |
1354 | } |
1355 | } |
1355 | else |
1356 | else |
1356 | { |
|
|
1357 | cell->darkness = 0; |
1357 | cell->darkness = 0; |
1358 | cell->stat_hp = 0; |
|
|
1359 | } |
|
|
1360 | } |
1358 | } |
1361 | } |
1359 | } |
1362 | |
1360 | |
1363 | SV * |
1361 | SV * |
1364 | mapmap (CFPlus::Map self, int x0, int y0, int w, int h) |
1362 | mapmap (CFPlus::Map self, int x0, int y0, int w, int h) |