… | |
… | |
22 | my $self = $class->SUPER::new ( |
22 | my $self = $class->SUPER::new ( |
23 | z => -1, |
23 | z => -1, |
24 | can_focus => 1, |
24 | can_focus => 1, |
25 | list => glGenList, |
25 | list => glGenList, |
26 | tilesize => 32, |
26 | tilesize => 32, |
27 | |
|
|
28 | smooth_matrix => [ |
|
|
29 | 0.30, 0.50, 0.30, |
|
|
30 | 0.50, 0.50, 0.50, |
|
|
31 | 0.30, 0.50, 0.30, |
|
|
32 | ], |
|
|
33 | |
|
|
34 | @_ |
27 | @_ |
35 | ); |
28 | ); |
36 | |
29 | |
37 | $self->{completer} = new CFPlus::MapWidget::Command:: |
30 | $self->{completer} = new CFPlus::MapWidget::Command:: |
38 | command => $self->{command}, |
31 | command => $self->{command}, |
… | |
… | |
470 | |
463 | |
471 | my $dx = $self->{dx} = CFPlus::ceil 0.5 * ($::MAP->w - $sw) - $sx; |
464 | my $dx = $self->{dx} = CFPlus::ceil 0.5 * ($::MAP->w - $sw) - $sx; |
472 | my $dy = $self->{dy} = CFPlus::ceil 0.5 * ($::MAP->h - $sh) - $sy; |
465 | my $dy = $self->{dy} = CFPlus::ceil 0.5 * ($::MAP->h - $sh) - $sy; |
473 | |
466 | |
474 | if ($::CFG->{fow_enable}) { |
467 | if ($::CFG->{fow_enable}) { |
475 | my ($w, $h, $data) = $::MAP->fow_texture ( |
468 | my ($w, $h, $data) = $::MAP->fow_texture ($dx, $dy, $sw, $sh); |
476 | $dx, $dy, $sw, $sh, |
|
|
477 | $::CFG->{fow_smooth}, |
|
|
478 | pack "f*", @{ $self->{smooth_matrix} }, |
|
|
479 | ); |
|
|
480 | |
469 | |
481 | $self->{fow_texture} = new CFPlus::Texture |
470 | $self->{fow_texture} = new CFPlus::Texture |
482 | w => $w, |
471 | w => $w, |
483 | h => $h, |
472 | h => $h, |
484 | data => $data, |
473 | data => $data, |
… | |
… | |
498 | |
487 | |
499 | glScale $self->{tilesize}, $self->{tilesize}; |
488 | glScale $self->{tilesize}, $self->{tilesize}; |
500 | |
489 | |
501 | if (my $tex = $self->{fow_texture}) { |
490 | if (my $tex = $self->{fow_texture}) { |
502 | glPushMatrix; |
491 | glPushMatrix; |
503 | #glScale 1/3, 1/3 if $::CFG->{fow_smooth}; |
492 | glScale 1/3, 1/3; |
504 | glEnable GL_TEXTURE_2D; |
493 | glEnable GL_TEXTURE_2D; |
505 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
494 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
506 | |
495 | |
507 | glColor +($::CFG->{fow_intensity}) x 3, 0.9; |
496 | glColor +($::CFG->{fow_intensity}) x 3, 0.9; |
508 | $self->{fow_texture}->draw_quad_alpha (0, 0); |
497 | $self->{fow_texture}->draw_quad_alpha (0, 0); |
… | |
… | |
575 | |
564 | |
576 | use Time::HiRes qw(time); |
565 | use Time::HiRes qw(time); |
577 | use CFPlus::OpenGL; |
566 | use CFPlus::OpenGL; |
578 | |
567 | |
579 | sub size_request { |
568 | sub size_request { |
580 | ($::HEIGHT * 0.25, $::HEIGHT * 0.25) |
569 | ($::HEIGHT * 0.2, $::HEIGHT * 0.2) |
581 | } |
570 | } |
582 | |
571 | |
583 | sub refresh_hook { |
572 | sub refresh_hook { |
584 | my ($self) = @_; |
573 | my ($self) = @_; |
585 | |
574 | |