… | |
… | |
446 | } |
446 | } |
447 | |
447 | |
448 | sub set_magicmap { |
448 | sub set_magicmap { |
449 | my ($self, $w, $h, $x, $y, $data) = @_; |
449 | my ($self, $w, $h, $x, $y, $data) = @_; |
450 | |
450 | |
451 | $x -= $::MAP->ox + int 0.5 * $::MAP->w; |
451 | $x -= $::MAP->ox + 1 + int 0.5 * $::MAP->w; |
452 | $y -= $::MAP->oy + int 0.5 * $::MAP->h; |
452 | $y -= $::MAP->oy + 1 + int 0.5 * $::MAP->h; |
453 | |
453 | |
454 | $self->{magicmap} = [$x, $y, $w, $h, $data]; |
454 | $self->{magicmap} = [$x, $y, $w, $h, $data]; |
455 | |
455 | |
456 | $self->update; |
456 | $self->update; |
457 | } |
457 | } |
… | |
… | |
530 | } |
530 | } |
531 | |
531 | |
532 | if ($self->{magicmap}) { |
532 | if ($self->{magicmap}) { |
533 | my ($x, $y, $w, $h, $data) = @{ $self->{magicmap} }; |
533 | my ($x, $y, $w, $h, $data) = @{ $self->{magicmap} }; |
534 | |
534 | |
535 | $x += $::MAP->ox - $sx + int 0.5 * ($::MAP->w - $sw + 1); |
535 | $x += $::MAP->ox + $self->{dx}; |
536 | $y += $::MAP->oy - $sy + int 0.5 * ($::MAP->h - $sh + 1); |
536 | $y += $::MAP->oy + $self->{dy}; |
537 | |
537 | |
538 | glTranslate - $x - 1, - $y - 1; |
538 | glTranslate - $x - 1, - $y - 1; |
539 | glBindTexture GL_TEXTURE_2D, $magicmap_tex->{name}; |
539 | glBindTexture GL_TEXTURE_2D, $magicmap_tex->{name}; |
540 | $::MAP->draw_magicmap ($x, $y, $w, $h, $data); |
540 | $::MAP->draw_magicmap ($x, $y, $w, $h, $data); |
541 | } |
541 | } |