… | |
… | |
263 | or return; |
263 | or return; |
264 | $CFG->{effects_enable} |
264 | $CFG->{effects_enable} |
265 | or return; |
265 | or return; |
266 | |
266 | |
267 | my $queue = $AUDIO_PLAY{$face} ||= []; |
267 | my $queue = $AUDIO_PLAY{$face} ||= []; |
268 | push @$queue, [Event::time + 0.2, $dx, $dy, $vol]; # delay sound by max. 0.2s |
268 | push @$queue, [Event::time + 0.6, $dx, $dy, $vol]; # do not play sound for outdated events |
269 | audio_sound_push $face |
269 | audio_sound_push $face |
270 | unless @$queue > 1; |
270 | unless @$queue > 1; |
271 | } |
271 | } |
272 | |
272 | |
273 | sub audio_music_set_meta { |
273 | sub audio_music_set_meta { |
… | |
… | |
769 | state => $CFG->{fullscreen}, |
769 | state => $CFG->{fullscreen}, |
770 | tooltip => "Bring the client into fullscreen mode.", |
770 | tooltip => "Bring the client into fullscreen mode.", |
771 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
771 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
772 | ); |
772 | ); |
773 | |
773 | |
|
|
774 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Force OpenGL 1.1"); |
|
|
775 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
|
|
776 | state => $CFG->{opengl11}, |
|
|
777 | tooltip => "Limit CFPlus to use OpenGL 1.1 features only. This will normally result in " |
|
|
778 | . "higher memory usage and slower performance. It will, however, help tremendously on " |
|
|
779 | . "cards that claim to support a feature but fall back to software rendering. " |
|
|
780 | . "Nvidia Geforce FX cards are known to claim features the hardware doesn't support, " |
|
|
781 | . "but cards and drivers from other vendors (ATI) are often just as bad. <b>If you " |
|
|
782 | . "experience extremely low framerates and your card should do better, try this option.</b>", |
|
|
783 | on_changed => sub { my ($self, $value) = @_; $CFG->{opengl11} = $value; 0 } |
|
|
784 | ); |
|
|
785 | |
774 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
786 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
775 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
787 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
776 | state => $CFG->{fast}, |
788 | state => $CFG->{fast}, |
777 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
789 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
778 | on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } |
790 | on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } |
… | |
… | |
805 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Map Smoothing"); |
817 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Map Smoothing"); |
806 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
818 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
807 | state => $CFG->{map_smoothing}, |
819 | state => $CFG->{map_smoothing}, |
808 | tooltip => "<b>Map Smoothing</b> tries to make tile borders less square. " |
820 | tooltip => "<b>Map Smoothing</b> tries to make tile borders less square. " |
809 | . "This increases load on the graphics subsystem and works only with TRT servers. " |
821 | . "This increases load on the graphics subsystem and works only with TRT servers. " |
810 | . "Changes take effect at next connection only.", |
822 | . "Changes take effect at next login only.", |
811 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 } |
823 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 } |
812 | ); |
824 | ); |
813 | |
825 | |
814 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fog of War"); |
826 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fog of War"); |
815 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
827 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
… | |
… | |
826 | ); |
838 | ); |
827 | |
839 | |
828 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Message Fontsize"); |
840 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Message Fontsize"); |
829 | $table->add_at (1, $row++, new CFPlus::UI::Slider |
841 | $table->add_at (1, $row++, new CFPlus::UI::Slider |
830 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
842 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
831 | tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant.", |
843 | tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant, " |
|
|
844 | . "but you still need to press apply to correctly re-layout the widget.", |
832 | on_changed => sub { $MESSAGE_WINDOW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, |
845 | on_changed => sub { $MESSAGE_WINDOW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, |
833 | ); |
846 | ); |
834 | |
847 | |
835 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); |
848 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); |
836 | $table->add_at (1, $row++, new CFPlus::UI::Slider |
849 | $table->add_at (1, $row++, new CFPlus::UI::Slider |
… | |
… | |
1862 | on_activate => sub { $QUIT_DIALOG->hide; 0 }, |
1875 | on_activate => sub { $QUIT_DIALOG->hide; 0 }, |
1863 | ); |
1876 | ); |
1864 | $hb->add (new CFPlus::UI::Button |
1877 | $hb->add (new CFPlus::UI::Button |
1865 | text => "Quit anyway", |
1878 | text => "Quit anyway", |
1866 | expand => 1, |
1879 | expand => 1, |
1867 | on_activate => sub { exit }, |
1880 | on_activate => sub { Event::unloop_all }, |
1868 | ); |
1881 | ); |
1869 | } |
1882 | } |
1870 | |
1883 | |
1871 | $QUIT_DIALOG->show; |
1884 | $QUIT_DIALOG->show; |
1872 | $QUIT_DIALOG->grab_focus; |
1885 | $QUIT_DIALOG->grab_focus; |
… | |
… | |
2066 | tooltip => "Terminates the program", |
2079 | tooltip => "Terminates the program", |
2067 | on_activate => sub { |
2080 | on_activate => sub { |
2068 | if ($CONN) { |
2081 | if ($CONN) { |
2069 | open_quit_dialog; |
2082 | open_quit_dialog; |
2070 | } else { |
2083 | } else { |
2071 | exit; |
2084 | Event::unloop_all; |
2072 | } |
2085 | } |
2073 | 0 |
2086 | 0 |
2074 | }, |
2087 | }, |
2075 | ); |
2088 | ); |
2076 | |
2089 | |
2077 | $BUTTONBAR->show; |
2090 | $BUTTONBAR->show; |
2078 | $SETUP_DIALOG->show; |
2091 | $SETUP_DIALOG->show; |
|
|
2092 | $MESSAGE_WINDOW->show; |
2079 | } |
2093 | } |
2080 | |
2094 | |
2081 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
2095 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
2082 | } |
2096 | } |
2083 | |
2097 | |
… | |
… | |
2180 | |
2194 | |
2181 | my %DEF_CFG = ( |
2195 | my %DEF_CFG = ( |
2182 | sdl_mode => 0, |
2196 | sdl_mode => 0, |
2183 | fullscreen => 0, |
2197 | fullscreen => 0, |
2184 | fast => 0, |
2198 | fast => 0, |
|
|
2199 | opengl11 => 0, |
2185 | map_scale => 1, |
2200 | map_scale => 1, |
2186 | fow_enable => 1, |
2201 | fow_enable => 1, |
2187 | fow_intensity => 0, |
2202 | fow_intensity => 0, |
2188 | map_smoothing => 1, |
2203 | map_smoothing => 1, |
2189 | gui_fontsize => 1, |
2204 | gui_fontsize => 1, |
… | |
… | |
2278 | } |
2293 | } |
2279 | |
2294 | |
2280 | show_tip_of_the_day if $CFG->{show_tips}; |
2295 | show_tip_of_the_day if $CFG->{show_tips}; |
2281 | |
2296 | |
2282 | Event::loop; |
2297 | Event::loop; |
|
|
2298 | |
|
|
2299 | #video_shutdown; |
|
|
2300 | #audio_shutdown; |
2283 | #CFPlus::SDL_Quit; |
2301 | CFPlus::SDL_Quit; |
2284 | #CFPlus::_exit 0; |
|
|
2285 | |
|
|
2286 | END { |
|
|
2287 | video_shutdown; |
|
|
2288 | audio_shutdown; |
|
|
2289 | CFPlus::SDL_Quit; |
|
|
2290 | CFPlus::DB::Server::stop; |
2302 | CFPlus::DB::Server::stop; |
2291 | } |
|
|
2292 | |
2303 | |
2293 | =head1 NAME |
2304 | =head1 NAME |
2294 | |
2305 | |
2295 | cfplus - A Crossfire TRT and Crossfire game client |
2306 | cfplus - A Crossfire TRT and Crossfire game client |
2296 | |
2307 | |