… | |
… | |
83 | mapcell *col; |
83 | mapcell *col; |
84 | } maprow; |
84 | } maprow; |
85 | |
85 | |
86 | typedef struct map { |
86 | typedef struct map { |
87 | int x, y, w, h; |
87 | int x, y, w, h; |
88 | int dx, dy; /* delayed map scrolling */ |
|
|
89 | int ox, oy; /* offset to virtual global coordinate system */ |
88 | int ox, oy; /* offset to virtual global coordinate system */ |
90 | int faces; |
89 | int faces; |
91 | mapface *face; |
90 | mapface *face; |
92 | |
91 | |
93 | int texs; |
92 | int texs; |
… | |
… | |
596 | |
595 | |
597 | void |
596 | void |
598 | scroll (CFClient::Map self, int dx, int dy) |
597 | scroll (CFClient::Map self, int dx, int dy) |
599 | CODE: |
598 | CODE: |
600 | { |
599 | { |
601 | self->dx += dx; self->ox += dx; |
|
|
602 | self->dy += dy; self->oy += dy; |
|
|
603 | } |
|
|
604 | |
|
|
605 | void |
|
|
606 | map1a_update (CFClient::Map self, SV *data_) |
|
|
607 | CODE: |
|
|
608 | { |
|
|
609 | if (self->dx > 0) |
600 | if (dx > 0) |
610 | map_blank (self, self->x, self->y, self->dx - 1, self->h); |
601 | map_blank (self, self->x, self->y, dx - 1, self->h); |
611 | else if (self->dx < 0) |
602 | else if (dx < 0) |
612 | map_blank (self, self->x + self->w + self->dx + 1, self->y, 1 - self->dx, self->h); |
603 | map_blank (self, self->x + self->w + dx + 1, self->y, 1 - dx, self->h); |
613 | |
604 | |
614 | if (self->dy > 0) |
605 | if (dy > 0) |
615 | map_blank (self, self->x, self->y, self->w, self->dy - 1); |
606 | map_blank (self, self->x, self->y, self->w, dy - 1); |
616 | else if (self->dy < 0) |
607 | else if (dy < 0) |
617 | map_blank (self, self->x, self->y + self->h + self->dy + 1, self->w, 1 - self->dy); |
608 | map_blank (self, self->x, self->y + self->h + dy + 1, self->w, 1 - dy); |
618 | |
609 | |
619 | self->x += self->dx; self->dx = 0; |
610 | self->ox += dx; self->x += dx; |
620 | self->y += self->dy; self->dy = 0; |
611 | self->oy += dy; self->y += dy; |
621 | |
612 | |
622 | while (self->y < 0) |
613 | while (self->y < 0) |
623 | { |
614 | { |
624 | Prepend (maprow, self->row, self->rows, MAP_EXTEND_Y); |
615 | Prepend (maprow, self->row, self->rows, MAP_EXTEND_Y); |
625 | |
616 | |
626 | self->rows += MAP_EXTEND_Y; |
617 | self->rows += MAP_EXTEND_Y; |
627 | self->y += MAP_EXTEND_Y; |
618 | self->y += MAP_EXTEND_Y; |
628 | } |
619 | } |
|
|
620 | } |
629 | |
621 | |
|
|
622 | void |
|
|
623 | map1a_update (CFClient::Map self, SV *data_) |
|
|
624 | CODE: |
|
|
625 | { |
630 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
626 | uint8_t *data = (uint8_t *)SvPVbyte_nolen (data_); |
631 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
627 | uint8_t *data_end = (uint8_t *)SvEND (data_); |
632 | |
628 | |
633 | while (data < data_end) |
629 | while (data < data_end) |
634 | { |
630 | { |