--- deliantra/Deliantra-Client/Client.xs 2006/04/16 07:25:29 1.42 +++ deliantra/Deliantra-Client/Client.xs 2006/04/17 06:50:26 1.43 @@ -85,6 +85,7 @@ typedef struct map { int x, y, w, h; + int dx, dy; /* delayed map scrolling */ int ox, oy; /* offset to virtual global coordinate system */ int faces; mapface *face; @@ -580,32 +581,6 @@ tex->a = a; } -void -scroll (CFClient::Map self, int dx, int dy) - CODE: -{ - if (dx > 0) - map_blank (self, self->x, self->y, dx - 1, self->h); - else if (dx < 0) - map_blank (self, self->x + self->w + dx + 1, self->y, 1 - dx, self->h); - - if (dy > 0) - map_blank (self, self->x, self->y, self->w, dy - 1); - else if (dy < 0) - map_blank (self, self->x, self->y + self->h + dy + 1, self->w, 1 - dy); - - self->x += dx; self->ox += dx; - self->y += dy; self->oy += dy; - - while (self->y < 0) - { - Prepend (maprow, self->row, self->rows, MAP_EXTEND_Y); - - self->rows += MAP_EXTEND_Y; - self->y += MAP_EXTEND_Y; - } -} - int ox (CFClient::Map self) ALIAS: @@ -620,12 +595,41 @@ RETVAL void +scroll (CFClient::Map self, int dx, int dy) + CODE: +{ + self->dx += dx; self->ox += dx; + self->dy += dy; self->oy += dy; +} + +void map1a_update (CFClient::Map self, SV *data_) CODE: { + if (self->dx > 0) + map_blank (self, self->x, self->y, self->dx - 1, self->h); + else if (self->dx < 0) + map_blank (self, self->x + self->w + self->dx + 1, self->y, 1 - self->dx, self->h); + + if (self->dy > 0) + map_blank (self, self->x, self->y, self->w, self->dy - 1); + else if (self->dy < 0) + map_blank (self, self->x, self->y + self->h + self->dy + 1, self->w, 1 - self->dy); + + self->x += self->dx; self->dx = 0; + self->y += self->dy; self->dy = 0; + + while (self->y < 0) + { + Prepend (maprow, self->row, self->rows, MAP_EXTEND_Y); + + self->rows += MAP_EXTEND_Y; + self->y += MAP_EXTEND_Y; + } + uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); uint8_t *data_end = (uint8_t *)SvEND (data_); - + while (data < data_end) { int flags = (data [0] << 8) + data [1]; data += 2;