… | |
… | |
9 | use DC::OpenGL; |
9 | use DC::OpenGL; |
10 | use DC::UI; |
10 | use DC::UI; |
11 | use DC::Macro; |
11 | use DC::Macro; |
12 | |
12 | |
13 | our @ISA = DC::UI::Base::; |
13 | our @ISA = DC::UI::Base::; |
|
|
14 | |
|
|
15 | our @TEX_HIDDEN = map { |
|
|
16 | new_from_resource DC::Texture # MUST be POT |
|
|
17 | "hidden-$_.png", mipmap => 1, wrap => 1 |
|
|
18 | } 0, 1, 2; |
14 | |
19 | |
15 | my $magicmap_tex = |
20 | my $magicmap_tex = |
16 | new_from_resource DC::Texture "magicmap.png", |
21 | new_from_resource DC::Texture "magicmap.png", |
17 | mipmap => 1, wrap => 0, internalformat => GL_ALPHA; |
22 | mipmap => 1, wrap => 0, internalformat => GL_ALPHA; |
18 | |
23 | |
… | |
… | |
518 | -$self->{sdx}, -$self->{sdy}); |
523 | -$self->{sdx}, -$self->{sdy}); |
519 | |
524 | |
520 | glScale $self->{tilesize}, $self->{tilesize}; |
525 | glScale $self->{tilesize}, $self->{tilesize}; |
521 | |
526 | |
522 | if (my $tex = $self->{fow_texture}) { |
527 | if (my $tex = $self->{fow_texture}) { |
523 | if ($DC::OpenGL::GL_MULTITEX && $self->{last_fow_texture}) {#d# |
528 | if ($DC::OpenGL::GL_MULTITEX && $self->{last_fow_texture}) { |
524 | my $d1 = DC::distance $self->{sdx}, $self->{sdy}; |
529 | my $d1 = DC::distance $self->{sdx}, $self->{sdy}; |
525 | my $d2 = (DC::distance $self->{lfdx}, $self->{lfdy}) * $tilesize; |
530 | my $d2 = (DC::distance $self->{lfdx}, $self->{lfdy}) * $tilesize; |
526 | |
531 | |
527 | if ($d1 * $d2) { |
532 | if ($d1 * $d2) { |
528 | DC::Texture::draw_fow_texture |
533 | DC::Texture::draw_fow_texture |
529 | $::CFG->{fow_intensity}, |
534 | $::CFG->{fow_intensity}, |
530 | $self->{hidden_tex}{name}, |
535 | $TEX_HIDDEN[$::CFG->{fow_texture}]{name}, |
531 | @{$self->{fow_texture}}{qw(name data s t w h)}, |
536 | @{$self->{fow_texture}}{qw(name data s t w h)}, |
532 | (min 1, $d1 / $d2), |
537 | (min 1, $d1 / $d2), |
533 | $self->{lmdx} - $dx - $self->{lfdx}, |
538 | $self->{lmdx} - $dx - $self->{lfdx}, |
534 | $self->{lmdy} - $dy - $self->{lfdy}, |
539 | $self->{lmdy} - $dy - $self->{lfdy}, |
535 | @{$self->{last_fow_texture}}{qw(name data)}; |
540 | @{$self->{last_fow_texture}}{qw(name data)}; |
… | |
… | |
539 | } |
544 | } |
540 | |
545 | |
541 | unless ($self->{last_fow_texture}) { |
546 | unless ($self->{last_fow_texture}) { |
542 | DC::Texture::draw_fow_texture |
547 | DC::Texture::draw_fow_texture |
543 | $::CFG->{fow_intensity}, |
548 | $::CFG->{fow_intensity}, |
544 | $self->{hidden_tex}{name}, |
549 | $TEX_HIDDEN[$::CFG->{fow_texture}]{name}, |
545 | @{$self->{fow_texture}}{qw(name data s t w h)}; |
550 | @{$self->{fow_texture}}{qw(name data s t w h)}; |
546 | } |
551 | } |
547 | } |
552 | } |
548 | |
553 | |
549 | if ($self->{magicmap}) { |
554 | if ($self->{magicmap}) { |