… | |
… | |
70 | |
70 | |
71 | our $FONT_PROP; |
71 | our $FONT_PROP; |
72 | our $FONT_FIXED; |
72 | our $FONT_FIXED; |
73 | |
73 | |
74 | our $MAP; |
74 | our $MAP; |
|
|
75 | our $MAPMAP; |
75 | our $MAPWIDGET; |
76 | our $MAPWIDGET; |
76 | our $BUTTONBAR; |
77 | our $BUTTONBAR; |
77 | our $LOGVIEW; |
78 | our $LOGVIEW; |
78 | our $CONSOLE; |
79 | our $CONSOLE; |
79 | our $METASERVER; |
80 | our $METASERVER; |
… | |
… | |
726 | } |
727 | } |
727 | |
728 | |
728 | sub message_window { |
729 | sub message_window { |
729 | my $window = new CFClient::UI::FancyFrame |
730 | my $window = new CFClient::UI::FancyFrame |
730 | title => "Messages", |
731 | title => "Messages", |
731 | border_bg => [1, 1, 1, 0.5], |
732 | border_bg => [1, 1, 1, 1], |
732 | bg => [0.3, 0.3, 0.3, 0.8], |
733 | bg => [0, 0, 0, 0.5], |
733 | user_w => int $::WIDTH / 3, |
734 | user_w => int $::WIDTH / 3, |
734 | user_h => int $::HEIGHT / 5, |
735 | user_h => int $::HEIGHT / 5, |
735 | child => (my $vbox = new CFClient::UI::VBox); |
736 | child => (my $vbox = new CFClient::UI::VBox); |
736 | |
737 | |
737 | $vbox->add ($LOGVIEW = new CFClient::UI::TextView |
738 | $vbox->add ($LOGVIEW = new CFClient::UI::TextView |
… | |
… | |
817 | fontsize => 0.8, |
818 | fontsize => 0.8, |
818 | markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode"; |
819 | markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode"; |
819 | $ALT_ENTER_MESSAGE->show; |
820 | $ALT_ENTER_MESSAGE->show; |
820 | $ALT_ENTER_MESSAGE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h}); |
821 | $ALT_ENTER_MESSAGE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h}); |
821 | |
822 | |
822 | $CFClient::UI::ROOT->add ($MAPWIDGET = new CFClient::MapWidget); |
823 | CFClient::UI::FancyFrame->new ( |
823 | $MAPWIDGET->focus_in; |
824 | border_bg => [1, 1, 1, 192/255], |
|
|
825 | bg => [1, 1, 1, 0], |
|
|
826 | child => $MAPMAP = new CFClient::MapWidget::MapMap |
|
|
827 | )->show; |
|
|
828 | |
|
|
829 | $MAPWIDGET = new CFClient::MapWidget; |
824 | $MAPWIDGET->connect (activate_console => sub { |
830 | $MAPWIDGET->connect (activate_console => sub { |
825 | my ($mapwidget, $preset) = @_; |
831 | my ($mapwidget, $preset) = @_; |
826 | |
832 | |
827 | if ($CONSOLE) { |
833 | if ($CONSOLE) { |
828 | $CONSOLE->{input}->{auto_activated} = 1; |
834 | $CONSOLE->{input}->{auto_activated} = 1; |
… | |
… | |
831 | if ($preset && $CONSOLE->{input}->get_text eq '') { |
837 | if ($preset && $CONSOLE->{input}->get_text eq '') { |
832 | $CONSOLE->{input}->set_text ($preset); |
838 | $CONSOLE->{input}->set_text ($preset); |
833 | } |
839 | } |
834 | } |
840 | } |
835 | }); |
841 | }); |
|
|
842 | $MAPWIDGET->show; |
|
|
843 | $MAPWIDGET->focus_in; |
836 | |
844 | |
837 | $CFClient::UI::ROOT->add ($BUTTONBAR = new CFClient::UI::HBox); |
845 | $BUTTONBAR = new CFClient::UI::HBox; |
838 | |
846 | |
839 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); |
847 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); |
840 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); |
848 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); |
841 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); |
849 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); |
842 | |
850 | |
… | |
… | |
845 | |
853 | |
846 | $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { |
854 | $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { |
847 | CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; |
855 | CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; |
848 | status "Configuration Saved"; |
856 | status "Configuration Saved"; |
849 | }); |
857 | }); |
|
|
858 | |
|
|
859 | $BUTTONBAR->show; |
850 | |
860 | |
851 | $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup |
861 | $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup |
852 | } |
862 | } |
853 | |
863 | |
854 | sub video_shutdown { |
864 | sub video_shutdown { |
… | |
… | |
1036 | # at worst. |
1046 | # at worst. |
1037 | sub conn::flood_fill { |
1047 | sub conn::flood_fill { |
1038 | my ($self, $gx, $gy, $path, $hash, $flags) = @_; |
1048 | my ($self, $gx, $gy, $path, $hash, $flags) = @_; |
1039 | |
1049 | |
1040 | # the server does not allow map paths > 6 |
1050 | # the server does not allow map paths > 6 |
1041 | return if 6 <= length $path; |
1051 | return if 7 <= length $path; |
1042 | |
1052 | |
1043 | my ($x0, $y0, $x1, $y1) = @{$self->{neigh_rect}}; |
1053 | my ($x0, $y0, $x1, $y1) = @{$self->{neigh_rect}}; |
1044 | |
1054 | |
1045 | for ( |
1055 | for ( |
1046 | [1, 0, -1], |
1056 | [1, 0, -1], |
… | |
… | |
1089 | |
1099 | |
1090 | $self->flush_map; |
1100 | $self->flush_map; |
1091 | |
1101 | |
1092 | my ($ox, $oy) = ($::MAP->ox, $::MAP->oy); |
1102 | my ($ox, $oy) = ($::MAP->ox, $::MAP->oy); |
1093 | |
1103 | |
1094 | my $mapmapw = 250; |
1104 | my $mapmapw = $MAPMAP->{w}; |
1095 | my $mapmaph = 250; |
1105 | my $mapmaph = $MAPMAP->{h}; |
1096 | |
1106 | |
1097 | $self->{neigh_rect} = [ |
1107 | $self->{neigh_rect} = [ |
1098 | $ox - $mapmapw * 0.5, $oy - $mapmapw * 0.5, |
1108 | $ox - $mapmapw * 0.5, $oy - $mapmapw * 0.5, |
1099 | $ox + $mapmapw * 0.5 + $w, $oy + $mapmapw * 0.5 + $h, |
1109 | $ox + $mapmapw * 0.5 + $w, $oy + $mapmapw * 0.5 + $h, |
1100 | ]; |
1110 | ]; |