… | |
… | |
251 | } |
251 | } |
252 | |
252 | |
253 | sub set_magicmap { |
253 | sub set_magicmap { |
254 | my ($self, $w, $h, $x, $y, $data) = @_; |
254 | my ($self, $w, $h, $x, $y, $data) = @_; |
255 | |
255 | |
256 | $x += - $::MAP->x - int 0.5 * $::MAP->w; |
256 | $x -= $::MAP->ox + int 0.5 * $::MAP->w; |
257 | $y += - $::MAP->y - int 0.5 * $::MAP->h; |
257 | $y -= $::MAP->oy + int 0.5 * $::MAP->h; |
258 | |
258 | |
259 | $self->{magicmap} = [$x, $y, $w, $h, $data]; |
259 | $self->{magicmap} = [$x, $y, $w, $h, $data]; |
260 | |
260 | |
261 | $self->update; |
261 | $self->update; |
262 | } |
262 | } |
… | |
… | |
332 | } |
332 | } |
333 | |
333 | |
334 | if ($self->{magicmap}) { |
334 | if ($self->{magicmap}) { |
335 | my ($x, $y, $w, $h, $data) = @{ $self->{magicmap} }; |
335 | my ($x, $y, $w, $h, $data) = @{ $self->{magicmap} }; |
336 | |
336 | |
337 | $x += $::MAP->x - $sx + int 0.5 * ($::MAP->w - $sw + 1); |
337 | $x += $::MAP->ox - $sx + int 0.5 * ($::MAP->w - $sw + 1); |
338 | $y += $::MAP->y - $sy + int 0.5 * ($::MAP->h - $sh + 1); |
338 | $y += $::MAP->oy - $sy + int 0.5 * ($::MAP->h - $sh + 1); |
339 | |
339 | |
340 | glTranslate - $x - 1, - $y - 1; |
340 | glTranslate - $x - 1, - $y - 1; |
341 | glBindTexture GL_TEXTURE_2D, $magicmap_tex->{name}; |
341 | glBindTexture GL_TEXTURE_2D, $magicmap_tex->{name}; |
342 | $::MAP->draw_magicmap ($x, $y, $w, $h, $data); |
342 | $::MAP->draw_magicmap ($x, $y, $w, $h, $data); |
343 | } |
343 | } |