… | |
… | |
578 | cell->darkness = -1; |
578 | cell->darkness = -1; |
579 | } |
579 | } |
580 | } |
580 | } |
581 | |
581 | |
582 | void |
582 | void |
583 | draw (CFClient::Map self, int x0, int y0, int sw, int sh) |
583 | draw (CFClient::Map self, int shift_x, int shift_y, int x0, int y0, int sw, int sh) |
584 | PPCODE: |
584 | PPCODE: |
585 | { |
585 | { |
586 | int sw4 = (sw + 3) & ~3; |
586 | int sw4 = (sw + 3) & ~3; |
587 | SV *darkness_sv = sv_2mortal (newSV (sw4 * sh)); |
587 | SV *darkness_sv = sv_2mortal (newSV (sw4 * sh)); |
588 | uint8_t *darkness = (uint8_t *)SvPVX (darkness_sv); |
588 | uint8_t *darkness = (uint8_t *)SvPVX (darkness_sv); |
589 | |
589 | |
590 | SvPOK_only (darkness_sv); |
590 | SvPOK_only (darkness_sv); |
591 | SvCUR_set (darkness_sv, sw4 * sh); |
591 | SvCUR_set (darkness_sv, sw4 * sh); |
592 | |
592 | |
|
|
593 | int vx = self->x + (self->w - sw) / 2 - shift_x; |
|
|
594 | int vy = self->y + (self->h - sh) / 2 - shift_y; |
|
|
595 | |
|
|
596 | if (0) |
|
|
597 | { |
593 | int vx = self->vx = self->w >= sw |
598 | int vx = self->vx = self->w >= sw |
594 | ? self->x + (self->w - sw) / 2 |
599 | ? self->x + (self->w - sw) / 2 |
595 | : MIN (self->x, MAX (self->x + self->w - sw + 1, self->vx)); |
600 | : MIN (self->x, MAX (self->x + self->w - sw + 1, self->vx)); |
596 | |
601 | |
597 | int vy = self->vy = self->h >= sh |
602 | int vy = self->vy = self->h >= sh |
598 | ? self->y + (self->h - sh) / 2 |
603 | ? self->y + (self->h - sh) / 2 |
599 | : MIN (self->y, MAX (self->y + self->h - sh + 1, self->vy)); |
604 | : MIN (self->y, MAX (self->y + self->h - sh + 1, self->vy)); |
|
|
605 | } |
600 | |
606 | |
601 | glColor4ub (255, 255, 255, 255); |
607 | glColor4ub (255, 255, 255, 255); |
602 | |
608 | |
603 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
609 | glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); |
604 | glEnable (GL_BLEND); |
610 | glEnable (GL_BLEND); |