… | |
… | |
167 | our $STATUSBOX; |
167 | our $STATUSBOX; |
168 | our $DEBUG_STATUS; |
168 | our $DEBUG_STATUS; |
169 | |
169 | |
170 | our $INV; |
170 | our $INV; |
171 | our $INVR; |
171 | our $INVR; |
172 | our $INV_RIGHT_HB; |
172 | our $INVR_HB; |
173 | |
|
|
174 | our $PICKUP_CFG; |
|
|
175 | |
173 | |
176 | ############################################################################# |
174 | ############################################################################# |
177 | |
175 | |
178 | sub status { |
176 | sub status { |
179 | $STATUSBOX->add (CFPlus::asxml $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); |
177 | $STATUSBOX->add (CFPlus::asxml $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); |
… | |
… | |
263 | or return; |
261 | or return; |
264 | $CFG->{effects_enable} |
262 | $CFG->{effects_enable} |
265 | or return; |
263 | or return; |
266 | |
264 | |
267 | my $queue = $AUDIO_PLAY{$face} ||= []; |
265 | my $queue = $AUDIO_PLAY{$face} ||= []; |
268 | push @$queue, [Event::time + 0.2, $dx, $dy, $vol]; # delay sound by max. 0.2s |
266 | push @$queue, [Event::time + 0.6, $dx, $dy, $vol]; # do not play sound for outdated events |
269 | audio_sound_push $face |
267 | audio_sound_push $face |
270 | unless @$queue > 1; |
268 | unless @$queue > 1; |
271 | } |
269 | } |
272 | |
270 | |
273 | sub audio_music_set_meta { |
271 | sub audio_music_set_meta { |
… | |
… | |
769 | state => $CFG->{fullscreen}, |
767 | state => $CFG->{fullscreen}, |
770 | tooltip => "Bring the client into fullscreen mode.", |
768 | tooltip => "Bring the client into fullscreen mode.", |
771 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
769 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
772 | ); |
770 | ); |
773 | |
771 | |
|
|
772 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Force OpenGL 1.1"); |
|
|
773 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
|
|
774 | state => $CFG->{force_opengl11}, |
|
|
775 | tooltip => "Limit CFPlus to use OpenGL 1.1 features only. This will normally result in " |
|
|
776 | . "higher memory usage and slower performance. It will, however, help tremendously on " |
|
|
777 | . "cards that claim to support a feature but fall back to software rendering. " |
|
|
778 | . "Nvidia Geforce FX cards are known to claim features the hardware doesn't support, " |
|
|
779 | . "but cards and drivers from other vendors (ATI) are often just as bad. <b>If you " |
|
|
780 | . "experience extremely low framerates and your card should do better, try this option.</b>", |
|
|
781 | on_changed => sub { my ($self, $value) = @_; $CFG->{force_opengl11} = $value; 0 } |
|
|
782 | ); |
|
|
783 | |
|
|
784 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Compress Textures"); |
|
|
785 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
|
|
786 | state => $CFG->{texture_compression}, |
|
|
787 | tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but " |
|
|
788 | . "will save a lot of memory and increase performance. The compression algorithm " |
|
|
789 | . "can differ form card to card, so your mileage may vary.", |
|
|
790 | on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 } |
|
|
791 | ); |
|
|
792 | |
774 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
793 | $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 |
794 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
776 | state => $CFG->{fast}, |
795 | state => $CFG->{fast}, |
777 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
796 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
778 | on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } |
797 | on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } |
… | |
… | |
804 | |
823 | |
805 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Map Smoothing"); |
824 | $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 |
825 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
807 | state => $CFG->{map_smoothing}, |
826 | state => $CFG->{map_smoothing}, |
808 | tooltip => "<b>Map Smoothing</b> tries to make tile borders less square. " |
827 | tooltip => "<b>Map Smoothing</b> tries to make tile borders less square. " |
809 | . "This increases load on the graphics subsystem and works only with 2.x servers. " |
828 | . "This increases load on the graphics subsystem and works only with TRT servers. " |
810 | . "Changes take effect at next connection only.", |
829 | . "Changes take effect at next login only.", |
811 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 } |
830 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 } |
812 | ); |
831 | ); |
813 | |
832 | |
814 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fog of War"); |
833 | $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 |
834 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
… | |
… | |
826 | ); |
845 | ); |
827 | |
846 | |
828 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Message Fontsize"); |
847 | $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 |
848 | $table->add_at (1, $row++, new CFPlus::UI::Slider |
830 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
849 | 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.", |
850 | tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant, " |
|
|
851 | . "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 }, |
852 | on_changed => sub { $MESSAGE_WINDOW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, |
833 | ); |
853 | ); |
834 | |
854 | |
835 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); |
855 | $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 |
856 | $table->add_at (1, $row++, new CFPlus::UI::Slider |
… | |
… | |
1597 | $sw1->add ($INV = new CFPlus::UI::Inventory); |
1617 | $sw1->add ($INV = new CFPlus::UI::Inventory); |
1598 | $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}}); |
1618 | $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}}); |
1599 | |
1619 | |
1600 | $hb->add (my $vb2 = new CFPlus::UI::VBox); |
1620 | $hb->add (my $vb2 = new CFPlus::UI::VBox); |
1601 | |
1621 | |
1602 | $vb2->add ($INV_RIGHT_HB = new CFPlus::UI::HBox); |
1622 | $vb2->add ($INVR_HB = new CFPlus::UI::HBox); |
1603 | |
1623 | |
1604 | $vb2->add (my $sw2 = new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1624 | $vb2->add (my $sw2 = new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1605 | $sw2->add ($INVR = new CFPlus::UI::Inventory); |
1625 | $sw2->add ($INVR = new CFPlus::UI::Inventory); |
1606 | |
1626 | |
1607 | # XXX: Call after $INVR = ... because set_opencont sets the items |
1627 | # XXX: Call after $INVR = ... because set_opencont sets the items |
… | |
… | |
1862 | on_activate => sub { $QUIT_DIALOG->hide; 0 }, |
1882 | on_activate => sub { $QUIT_DIALOG->hide; 0 }, |
1863 | ); |
1883 | ); |
1864 | $hb->add (new CFPlus::UI::Button |
1884 | $hb->add (new CFPlus::UI::Button |
1865 | text => "Quit anyway", |
1885 | text => "Quit anyway", |
1866 | expand => 1, |
1886 | expand => 1, |
1867 | on_activate => sub { exit }, |
1887 | on_activate => sub { Event::unloop_all }, |
1868 | ); |
1888 | ); |
1869 | } |
1889 | } |
1870 | |
1890 | |
1871 | $QUIT_DIALOG->show; |
1891 | $QUIT_DIALOG->show; |
1872 | $QUIT_DIALOG->grab_focus; |
1892 | $QUIT_DIALOG->grab_focus; |
… | |
… | |
2066 | tooltip => "Terminates the program", |
2086 | tooltip => "Terminates the program", |
2067 | on_activate => sub { |
2087 | on_activate => sub { |
2068 | if ($CONN) { |
2088 | if ($CONN) { |
2069 | open_quit_dialog; |
2089 | open_quit_dialog; |
2070 | } else { |
2090 | } else { |
2071 | exit; |
2091 | Event::unloop_all; |
2072 | } |
2092 | } |
2073 | 0 |
2093 | 0 |
2074 | }, |
2094 | }, |
2075 | ); |
2095 | ); |
2076 | |
2096 | |
2077 | $BUTTONBAR->show; |
2097 | $BUTTONBAR->show; |
2078 | $SETUP_DIALOG->show; |
2098 | $SETUP_DIALOG->show; |
|
|
2099 | $MESSAGE_WINDOW->show; |
2079 | } |
2100 | } |
2080 | |
2101 | |
2081 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
2102 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
2082 | } |
2103 | } |
2083 | |
2104 | |
… | |
… | |
2177 | CFPlus::DB::Server::run; |
2198 | CFPlus::DB::Server::run; |
2178 | |
2199 | |
2179 | CFPlus::UI::set_layout ($::CFG->{layout}); |
2200 | CFPlus::UI::set_layout ($::CFG->{layout}); |
2180 | |
2201 | |
2181 | my %DEF_CFG = ( |
2202 | my %DEF_CFG = ( |
2182 | sdl_mode => 0, |
2203 | sdl_mode => 0, |
2183 | fullscreen => 0, |
2204 | fullscreen => 0, |
2184 | fast => 0, |
2205 | fast => 0, |
|
|
2206 | force_opengl11 => undef, |
|
|
2207 | texture_compression => 1, |
2185 | map_scale => 1, |
2208 | map_scale => 1, |
2186 | fow_enable => 1, |
2209 | fow_enable => 1, |
2187 | fow_intensity => 0, |
2210 | fow_intensity => 0, |
2188 | map_smoothing => 1, |
2211 | map_smoothing => 1, |
2189 | gui_fontsize => 1, |
2212 | gui_fontsize => 1, |
2190 | log_fontsize => 0.7, |
2213 | log_fontsize => 0.7, |
2191 | gauge_fontsize => 1, |
2214 | gauge_fontsize => 1, |
2192 | gauge_size => 0.35, |
2215 | gauge_size => 0.35, |
2193 | stat_fontsize => 0.7, |
2216 | stat_fontsize => 0.7, |
2194 | mapsize => 100, |
2217 | mapsize => 100, |
2195 | audio_enable => 1, |
2218 | audio_enable => 1, |
2196 | effects_enable => 1, |
2219 | effects_enable => 1, |
2197 | effects_volume => 1, |
2220 | effects_volume => 1, |
2198 | bgm_enable => 1, |
2221 | bgm_enable => 1, |
2199 | bgm_volume => 0.5, |
2222 | bgm_volume => 0.5, |
2200 | output_sync => 1, |
2223 | output_sync => 1, |
2201 | output_count => 1, |
2224 | output_count => 1, |
2202 | output_rate => "", |
2225 | output_rate => "", |
2203 | pickup => 0, |
2226 | pickup => 0, |
2204 | inv_sort => "mtime", |
2227 | inv_sort => "mtime", |
2205 | default => "profile", # default profile |
2228 | default => "profile", # default profile |
2206 | show_tips => 1, |
2229 | show_tips => 1, |
2207 | logview_max_par => 1000, |
2230 | logview_max_par => 1000, |
2208 | ); |
2231 | ); |
2209 | |
2232 | |
2210 | while (my ($k, $v) = each %DEF_CFG) { |
2233 | while (my ($k, $v) = each %DEF_CFG) { |
2211 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2234 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2212 | } |
2235 | } |
… | |
… | |
2278 | } |
2301 | } |
2279 | |
2302 | |
2280 | show_tip_of_the_day if $CFG->{show_tips}; |
2303 | show_tip_of_the_day if $CFG->{show_tips}; |
2281 | |
2304 | |
2282 | Event::loop; |
2305 | Event::loop; |
|
|
2306 | |
|
|
2307 | #video_shutdown; |
|
|
2308 | #audio_shutdown; |
2283 | #CFPlus::SDL_Quit; |
2309 | 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; |
2310 | CFPlus::DB::Server::stop; |
2291 | } |
|
|
2292 | |
2311 | |
2293 | =head1 NAME |
2312 | =head1 NAME |
2294 | |
2313 | |
2295 | cfplus - A Crossfire TRT and Crossfire game client |
2314 | cfplus - A Crossfire TRT and Crossfire game client |
2296 | |
2315 | |