… | |
… | |
133 | crash "CRASH/EV::DIED: $@" => 0; |
133 | crash "CRASH/EV::DIED: $@" => 0; |
134 | DC::fatal Carp::longmess $@; |
134 | DC::fatal Carp::longmess $@; |
135 | }; |
135 | }; |
136 | |
136 | |
137 | my $MAX_FPS = 60; |
137 | my $MAX_FPS = 60; |
|
|
138 | |
|
|
139 | our $DEFAULT_SERVER = "gameserver.deliantra.net"; |
138 | |
140 | |
139 | our $META_SERVER = "http://metaserver.schmorp.de/current.json"; |
141 | our $META_SERVER = "http://metaserver.schmorp.de/current.json"; |
140 | |
142 | |
141 | our $LAST_REFRESH; |
143 | our $LAST_REFRESH; |
142 | our $NOW; |
144 | our $NOW; |
… | |
… | |
830 | ; |
832 | ; |
831 | } |
833 | } |
832 | |
834 | |
833 | sub start_game { |
835 | sub start_game { |
834 | status "logging in..."; |
836 | status "logging in..."; |
|
|
837 | |
|
|
838 | my $server = $PROFILE->{host} || $DEFAULT_SERVER; |
|
|
839 | my ($host, $port) = AnyEvent::Socket::parse_hostport $server, "deliantra=13327" |
|
|
840 | or return status "$server: unable to parse server address, try an empty field."; |
835 | |
841 | |
836 | $LOGIN_BUTTON->set_text ("Logout"); |
842 | $LOGIN_BUTTON->set_text ("Logout"); |
837 | $SETUP_DIALOG->hide; |
843 | $SETUP_DIALOG->hide; |
838 | |
|
|
839 | my ($host, $port) = AnyEvent::Socket::parse_hostport $PROFILE->{host}, "deliantra=13327"; |
|
|
840 | |
844 | |
841 | $MAP = new DC::Map; |
845 | $MAP = new DC::Map; |
842 | |
846 | |
843 | # hack to make SURE we find the IP address all right |
847 | # hack to make SURE we find the IP address all right |
844 | # can be removed once AnyEvent::DNS is proven stable. |
848 | # can be removed once AnyEvent::DNS is proven stable. |
… | |
… | |
1027 | . "If you have a very slow system, non-accelerated drivers or plain dislike smooth scrolling, " |
1031 | . "If you have a very slow system, non-accelerated drivers or plain dislike smooth scrolling, " |
1028 | . "then disable this option. Changes take effect immdiately.", |
1032 | . "then disable this option. Changes take effect immdiately.", |
1029 | on_changed => sub { my ($self, $value) = @_; $CFG->{smooth_movement} = $value; 0 } |
1033 | on_changed => sub { my ($self, $value) = @_; $CFG->{smooth_movement} = $value; 0 } |
1030 | ); |
1034 | ); |
1031 | |
1035 | |
|
|
1036 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Smooth Transitions"); |
|
|
1037 | $table->add_at (1, $row++, new DC::UI::CheckBox |
|
|
1038 | state => $CFG->{smooth_transitions}, |
|
|
1039 | tooltip => "<b>Smooth Transitions</b> tries to blend the fog of war and lighting smoothly between updates. " |
|
|
1040 | . "If you have a very slow system, non-accelerated drivers or plain dislike smooth scrolling, " |
|
|
1041 | . "then disable this option. Requires Smooth Movement and OpenGL 1.4 or up. Changes take effect immdiately.", |
|
|
1042 | on_changed => sub { my ($self, $value) = @_; $CFG->{smooth_transitions} = $value; 0 } |
|
|
1043 | ); |
|
|
1044 | |
|
|
1045 | |
1032 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Map Scale"); |
1046 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Map Scale"); |
1033 | $table->add_at (1, $row++, new DC::UI::Slider |
1047 | $table->add_at (1, $row++, new DC::UI::Slider |
1034 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
1048 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
1035 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
1049 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
1036 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } |
1050 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } |
… | |
… | |
1048 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fog of War"); |
1062 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fog of War"); |
1049 | $table->add_at (1, $row++, new DC::UI::CheckBox |
1063 | $table->add_at (1, $row++, new DC::UI::CheckBox |
1050 | state => $CFG->{fow_enable}, |
1064 | state => $CFG->{fow_enable}, |
1051 | tooltip => "<b>Fog-of-War</b> marks areas that cannot be seen by the player. Changes are instant.", |
1065 | tooltip => "<b>Fog-of-War</b> marks areas that cannot be seen by the player. Changes are instant.", |
1052 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_enable} = $value; 0 } |
1066 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_enable} = $value; 0 } |
|
|
1067 | ); |
|
|
1068 | |
|
|
1069 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "FoW Pattern"); |
|
|
1070 | $table->add_at (1, $row++, new DC::UI::ImageButton |
|
|
1071 | tex => $DC::MapWidget::TEX_HIDDEN[$CFG->{fow_texture}], |
|
|
1072 | bg => [0.3, 0.3, 0.2], |
|
|
1073 | force_w => 64, |
|
|
1074 | force_h => 64, |
|
|
1075 | tooltip => "<b>Fog of War Pattern.</b> The pattern that is overlaid over areas hidden from view. Click to cycle through various alternatives. Changes are instant.", |
|
|
1076 | on_activate => sub { |
|
|
1077 | my ($self) = @_; |
|
|
1078 | $CFG->{fow_texture} = ($CFG->{fow_texture} + 1) % @DC::MapWidget::TEX_HIDDEN; |
|
|
1079 | $self->set_texture ($DC::MapWidget::TEX_HIDDEN[$CFG->{fow_texture}]); |
|
|
1080 | } |
1053 | ); |
1081 | ); |
1054 | |
1082 | |
1055 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "FoW Intensity"); |
1083 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "FoW Intensity"); |
1056 | $table->add_at (1, $row++, new DC::UI::Slider |
1084 | $table->add_at (1, $row++, new DC::UI::Slider |
1057 | range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], |
1085 | range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], |
… | |
… | |
2565 | |
2593 | |
2566 | $MODE_SLIDER->set_range ([$CFG->{sdl_mode}, 0, scalar @SDL_MODES, 1, 1]); |
2594 | $MODE_SLIDER->set_range ([$CFG->{sdl_mode}, 0, scalar @SDL_MODES, 1, 1]); |
2567 | $MODE_SLIDER->emit (changed => $CFG->{sdl_mode}); |
2595 | $MODE_SLIDER->emit (changed => $CFG->{sdl_mode}); |
2568 | |
2596 | |
2569 | $CAVEAT_LABEL->set_text ("None :)"); |
2597 | $CAVEAT_LABEL->set_text ("None :)"); |
|
|
2598 | $CAVEAT_LABEL->set_text ("Apple/NVIDIA Texture bug (slow)") |
|
|
2599 | if $DC::OpenGL::APPLE_NVIDIA_BUG; |
2570 | $CAVEAT_LABEL->set_text ("Software Rendering (very slow)") |
2600 | $CAVEAT_LABEL->set_text ("Software Rendering (very slow)") |
2571 | unless DC::SDL_GL_GetAttribute DC::SDL_GL_ACCELERATED_VISUAL; |
2601 | unless DC::SDL_GL_GetAttribute DC::SDL_GL_ACCELERATED_VISUAL; |
2572 | |
2602 | |
2573 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
2603 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
2574 | } |
2604 | } |
… | |
… | |
2707 | fullscreen => 1, |
2737 | fullscreen => 1, |
2708 | fast => 0, |
2738 | fast => 0, |
2709 | force_opengl11 => undef, |
2739 | force_opengl11 => undef, |
2710 | disable_alpha => 0, |
2740 | disable_alpha => 0, |
2711 | smooth_movement => 1, |
2741 | smooth_movement => 1, |
|
|
2742 | smooth_transitions => 1, |
2712 | texture_compression => 1, |
2743 | texture_compression => 1, |
2713 | map_scale => 1, |
2744 | map_scale => 1, |
2714 | fow_enable => 1, |
2745 | fow_enable => 1, |
2715 | fow_intensity => 0, |
2746 | fow_intensity => 0, |
|
|
2747 | fow_texture => 0, |
2716 | map_smoothing => 1, |
2748 | map_smoothing => 1, |
2717 | gui_fontsize => 1, |
2749 | gui_fontsize => 1, |
2718 | log_fontsize => 0.7, |
2750 | log_fontsize => 0.7, |
2719 | gauge_fontsize => 1, |
2751 | gauge_fontsize => 1, |
2720 | gauge_size => 0.35, |
2752 | gauge_size => 0.35, |