ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/cfplus
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.200 by root, Thu Aug 2 14:35:21 2007 UTC vs.
Revision 1.215 by root, Fri Aug 17 21:18:01 2007 UTC

113our $CONN; 113our $CONN;
114our $PROFILE; # current profile 114our $PROFILE; # current profile
115our $FAST; # fast, low-quality mode, possibly useful for software-rendering 115our $FAST; # fast, low-quality mode, possibly useful for software-rendering
116 116
117our $WANT_REFRESH; 117our $WANT_REFRESH;
118our $CAN_REFRESH;
119 118
120our @SDL_MODES; 119our @SDL_MODES;
121our $WIDTH; 120our $WIDTH;
122our $HEIGHT; 121our $HEIGHT;
123our $FULLSCREEN; 122our $FULLSCREEN;
168our $STATUSBOX; 167our $STATUSBOX;
169our $DEBUG_STATUS; 168our $DEBUG_STATUS;
170 169
171our $INV; 170our $INV;
172our $INVR; 171our $INVR;
173our $INV_RIGHT_HB; 172our $INVR_HB;
174
175our $PICKUP_CFG;
176 173
177############################################################################# 174#############################################################################
178 175
179sub status { 176sub status {
180 $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]);
217 my ($face) = @_; 214 my ($face) = @_;
218 215
219 $CFG->{effects_enable} 216 $CFG->{effects_enable}
220 or return; 217 or return;
221 218
219 $AUDIO_PLAY{$face}
220 or return;
221
222 if (my $chunk = $AUDIO_CHUNK{$face}) { 222 if (my $chunk = $AUDIO_CHUNK{$face}) {
223 for (grep $_->[0] >= Event::time, @{(delete $AUDIO_PLAY{$face}) || []}) { 223 for (grep $_->[0] >= Event::time, @{(delete $AUDIO_PLAY{$face}) || []}) {
224 my (undef, $dx, $dy, $vol) = @$_; 224 my (undef, $dx, $dy, $vol) = @$_;
225 225
226 my $channel = CFPlus::Channel::find; 226 my $channel = CFPlus::Channel::find;
227 $channel->volume ($vol * $CFG->{effects_volume} * 128 / 255); 227 $channel->volume ($vol * $CFG->{effects_volume} * 128 / 255);
228 $dx = $dx / 10 * 255;
229 $channel->set_panning (255 - $dx, 255 + $dx);
230
231# my $angle = $dx ? : $dx < 0 ?
232# my $distance = -$vol;
233# $channel->set_position ($angle, $distance); 228 $channel->set_position_r ($dx, $dy, 20);
234
235 $chunk->play ($channel); 229 $chunk->play ($channel);
236 } 230 }
237 } else { 231 } else {
238 # sound_meta not set means data is in flight either way 232 # sound_meta not set means data is in flight either way
239 my $meta = $CONN->{sound_meta}{$face} 233 my $meta = $CONN->{sound_meta}{$face}
240 or return; 234 or return;
241 235
242 # if its a jingle, play it as ambient music 236 # if its a jingle, play it as ambient music
243 if ($meta->{meta}{jingle}) { 237 if ($meta->{meta}{jingle}) {
244 delete $AUDIO_PLAY{$face}; # take the jingle out of the sound queue 238 if (delete $AUDIO_PLAY{$face}) { # take the jingle out of the sound queue
245 push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue 239 push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue
246 &audio_music_push ($face); 240 &audio_music_push ($face);
241 }
247 } else { 242 } else {
248 # fetch from database 243 # fetch from database
249 CFPlus::DB::get res_data => $meta->{name}, sub { 244 CFPlus::DB::get res_data => $meta->{name}, sub {
250 my $rwops = new CFPlus::RW $_[0]; 245 my $rwops = new CFPlus::RW $_[0];
251 my $chunk = new CFPlus::MixChunk $rwops; 246 my $chunk = new CFPlus::MixChunk $rwops
247 or Carp::confess "sound face " . (JSON::XS::to_json $meta) . " unloadable: " . CFPlus::Mix_GetError;
252 $chunk->volume (($meta->{meta}{volume} || 1) * 128); 248 $chunk->volume (($meta->{meta}{volume} || 1) * 128);
253 $AUDIO_CHUNK{$face} = $chunk; 249 $AUDIO_CHUNK{$face} = $chunk;
254 250
255 audio_sound_push ($face); 251 audio_sound_push ($face);
256 }; 252 };
265 or return; 261 or return;
266 $CFG->{effects_enable} 262 $CFG->{effects_enable}
267 or return; 263 or return;
268 264
269 my $queue = $AUDIO_PLAY{$face} ||= []; 265 my $queue = $AUDIO_PLAY{$face} ||= [];
270 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
271 audio_sound_push $face 267 audio_sound_push $face
272 unless @$queue > 1; 268 unless @$queue > 1;
273} 269}
274 270
275sub audio_music_set_meta { 271sub audio_music_set_meta {
308 my $rwops = $meta->{path} 304 my $rwops = $meta->{path}
309 ? new_from_file CFPlus::RW $meta->{path} 305 ? new_from_file CFPlus::RW $meta->{path}
310 : new CFPlus::RW $$MUSIC_PLAYING_DATA; 306 : new CFPlus::RW $$MUSIC_PLAYING_DATA;
311 307
312 $MUSIC_PLAYER = new CFPlus::MixMusic $rwops 308 $MUSIC_PLAYER = new CFPlus::MixMusic $rwops
313 or ((warn CFPlus::Mix_GetError), return); # pretty fatal error 309 or Carp::confess "music face $meta->{face} unloadable: " . CFPlus::Mix_GetError;
314 310
315 my $NOW = time; 311 my $NOW = time;
316 312
317 if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) { 313 if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) {
318 my $pos = $MUSIC_PLAYING_META->{stop_pos}; 314 my $pos = $MUSIC_PLAYING_META->{stop_pos};
351 @MUSIC_HAVE = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_HAVE; 347 @MUSIC_HAVE = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_HAVE;
352 $fade_out = 1000; 348 $fade_out = 1000;
353 } 349 }
354 350
355 # if the currently playing song is acceptable, let it continue 351 # if the currently playing song is acceptable, let it continue
356 return if $MUSIC_PLAYING_META
357 && grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE; 352 return if grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE;
358 353
359 my $NOW = time; 354 my $NOW = time;
360 355
361 if ($MUSIC_PLAYING_META) { 356 if ($MUSIC_PLAYING_META) {
362 $MUSIC_PLAYING_META->{stop_time} = $NOW; 357 $MUSIC_PLAYING_META->{stop_time} = $NOW;
418 413
419sub audio_shutdown { 414sub audio_shutdown {
420 undef $MUSIC_PLAYER; 415 undef $MUSIC_PLAYER;
421 undef $MUSIC_PLAYING_META; 416 undef $MUSIC_PLAYING_META;
422 undef $MUSIC_PLAYING_DATA; 417 undef $MUSIC_PLAYING_DATA;
423
424 audio_music_set_meta { };
425 418
426 $MUSIC_WANT = []; 419 $MUSIC_WANT = [];
427 @MUSIC_JINGLE = (); 420 @MUSIC_JINGLE = ();
428 %AUDIO_PLAY = (); 421 %AUDIO_PLAY = ();
429 %AUDIO_CHUNK = (); 422 %AUDIO_CHUNK = ();
774 state => $CFG->{fullscreen}, 767 state => $CFG->{fullscreen},
775 tooltip => "Bring the client into fullscreen mode.", 768 tooltip => "Bring the client into fullscreen mode.",
776 on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } 769 on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 }
777 ); 770 );
778 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->{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->{opengl11} = $value; 0 }
782 );
783
779 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); 784 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fast & Ugly");
780 $table->add_at (1, $row++, new CFPlus::UI::CheckBox 785 $table->add_at (1, $row++, new CFPlus::UI::CheckBox
781 state => $CFG->{fast}, 786 state => $CFG->{fast},
782 tooltip => "Lower the visual quality considerably to speed up rendering.", 787 tooltip => "Lower the visual quality considerably to speed up rendering.",
783 on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } 788 on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 }
809 814
810 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Map Smoothing"); 815 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Map Smoothing");
811 $table->add_at (1, $row++, new CFPlus::UI::CheckBox 816 $table->add_at (1, $row++, new CFPlus::UI::CheckBox
812 state => $CFG->{map_smoothing}, 817 state => $CFG->{map_smoothing},
813 tooltip => "<b>Map Smoothing</b> tries to make tile borders less square. " 818 tooltip => "<b>Map Smoothing</b> tries to make tile borders less square. "
814 . "This increases load on the graphics subsystem and works only with 2.x servers. " 819 . "This increases load on the graphics subsystem and works only with TRT servers. "
815 . "Changes take effect at next connection only.", 820 . "Changes take effect at next login only.",
816 on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 } 821 on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 }
817 ); 822 );
818 823
819 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fog of War"); 824 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fog of War");
820 $table->add_at (1, $row++, new CFPlus::UI::CheckBox 825 $table->add_at (1, $row++, new CFPlus::UI::CheckBox
831 ); 836 );
832 837
833 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Message Fontsize"); 838 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Message Fontsize");
834 $table->add_at (1, $row++, new CFPlus::UI::Slider 839 $table->add_at (1, $row++, new CFPlus::UI::Slider
835 range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], 840 range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1],
836 tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant.", 841 tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant, "
842 . "but you still need to press apply to correctly re-layout the widget.",
837 on_changed => sub { $MESSAGE_WINDOW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, 843 on_changed => sub { $MESSAGE_WINDOW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 },
838 ); 844 );
839 845
840 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); 846 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Gauge fontsize");
841 $table->add_at (1, $row++, new CFPlus::UI::Slider 847 $table->add_at (1, $row++, new CFPlus::UI::Slider
878# $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Effects Volume"); 884# $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Effects Volume");
879# $table->add_at (1, 8, new CFPlus::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], on_changed => sub { 885# $table->add_at (1, 8, new CFPlus::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], on_changed => sub {
880# $CFG->{effects_volume} = $_[1]; 886# $CFG->{effects_volume} = $_[1];
881# }); 887# });
882 888
883 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Effects Volume"); 889 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Sound Effects");
884 $table->add_at (1, $row, new CFPlus::UI::CheckBox 890 $table->add_at (1, $row, new CFPlus::UI::CheckBox
885 expand => 1, state => $CFG->{effects_enable}, 891 expand => 1, state => $CFG->{effects_enable},
886 tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.", 892 tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.",
893 on_changed => sub {
887 on_changed => sub { $CFG->{effects_enable} = $_[1]; 0 } 894 $CFG->{effects_enable} = $_[1];
895 $CONN->update_fx_want if $CONN;
896 0
897 }
888 ); 898 );
889 $table->add_at (2, $row++, new CFPlus::UI::Slider 899 $table->add_at (2, $row++, new CFPlus::UI::Slider
890 expand => 1, range => [$CFG->{effects_volume}, 0, 1, 0, 1/128], 900 expand => 1, range => [$CFG->{effects_volume}, 0, 1, 0, 1/128],
891 tooltip => "The relative volume of sound effects. Best audio quality is achieved if this " 901 tooltip => "The relative volume of sound effects. Best audio quality is achieved if this "
892 . "is set highest and you use your operating system volume setting. Changes are instant.", 902 . "is set highest (rightmost) and you use your operating system volume setting. Changes are instant.",
893 on_changed => sub { $CFG->{effects_volume} = $_[1]; 0 } 903 on_changed => sub { $CFG->{effects_volume} = $_[1]; 0 }
894 ); 904 );
895 905
896 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Background Music"); 906 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Background Music");
897 $table->add_at (1, $row, new CFPlus::UI::CheckBox 907 $table->add_at (1, $row, new CFPlus::UI::CheckBox
898 expand => 1, state => $CFG->{bgm_enable}, 908 expand => 1, state => $CFG->{bgm_enable},
899 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", 909 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.",
900 on_changed => sub { $CFG->{bgm_enable} = $_[1]; 0 } 910 on_changed => sub {
911 $CFG->{bgm_enable} = $_[1];
912 $CONN->update_fx_want if $CONN;
913 0
914 }
901 ); 915 );
902 $table->add_at (2, $row++, new CFPlus::UI::Slider 916 $table->add_at (2, $row++, new CFPlus::UI::Slider
903 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], 917 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128],
904 tooltip => "The volume of the background music. Changes are instant.", 918 tooltip => "The volume of the background music. Changes are instant.",
905 on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 } 919 on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 }
1594 $sw1->add ($INV = new CFPlus::UI::Inventory); 1608 $sw1->add ($INV = new CFPlus::UI::Inventory);
1595 $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}}); 1609 $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}});
1596 1610
1597 $hb->add (my $vb2 = new CFPlus::UI::VBox); 1611 $hb->add (my $vb2 = new CFPlus::UI::VBox);
1598 1612
1599 $vb2->add ($INV_RIGHT_HB = new CFPlus::UI::HBox); 1613 $vb2->add ($INVR_HB = new CFPlus::UI::HBox);
1600 1614
1601 $vb2->add (my $sw2 = new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); 1615 $vb2->add (my $sw2 = new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1);
1602 $sw2->add ($INVR = new CFPlus::UI::Inventory); 1616 $sw2->add ($INVR = new CFPlus::UI::Inventory);
1603 1617
1604 # XXX: Call after $INVR = ... because set_opencont sets the items 1618 # XXX: Call after $INVR = ... because set_opencont sets the items
1610sub media_window { 1624sub media_window {
1611 my $vb = new CFPlus::UI::VBox; 1625 my $vb = new CFPlus::UI::VBox;
1612 1626
1613 $vb->add (new CFPlus::UI::FancyFrame 1627 $vb->add (new CFPlus::UI::FancyFrame
1614 label => "Currently playing music", 1628 label => "Currently playing music",
1629 child => new CFPlus::UI::ScrolledWindow scroll_x => 1, scroll_y => 0,
1615 child => ($MUSIC_PLAYING_WIDGET = new CFPlus::UI::Label ellipsise => 0), 1630 child => ($MUSIC_PLAYING_WIDGET = new CFPlus::UI::Label ellipsise => 0, fontsize => 0.8),
1616 ); 1631 );
1617 1632
1618 $vb->add (new CFPlus::UI::FancyFrame 1633 $vb->add (new CFPlus::UI::FancyFrame
1619 label => "Other media used in this session", 1634 label => "Other media used in this session",
1635 expand => 1,
1620 child => ($LICENSE_WIDGET = new CFPlus::UI::TextScroller 1636 child => ($LICENSE_WIDGET = new CFPlus::UI::TextScroller
1621 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4), 1637 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4),
1622 ); 1638 );
1623 1639
1624 $vb 1640 $vb
1641}
1642
1643sub add_license {
1644 my ($meta) = @_;
1645
1646 $meta = $meta->{meta}
1647 or return;
1648
1649 $meta->{license} || $meta->{author} || $meta->{source}
1650 or return;
1651
1652 $LICENSE_WIDGET->add_paragraph ({
1653 fg => [1, 1, 1, 1],
1654 markup => "<small>"
1655 . "<b>Name:</b> " . (CFPlus::asxml $meta->{name}) . "\n"
1656 . "<b>Author:</b> " . (CFPlus::asxml $meta->{author}) . "\n"
1657 . "<b>Source:</b> " . (CFPlus::asxml $meta->{source}) . "\n"
1658 . "<b>License:</b> " . (CFPlus::asxml $meta->{license}) . "\n"
1659 . "</small>",
1660 });
1661 $LICENSE_WIDGET->scroll_to_bottom;
1625} 1662}
1626 1663
1627sub toggle_player_page { 1664sub toggle_player_page {
1628 my ($widget) = @_; 1665 my ($widget) = @_;
1629 1666
1836 on_activate => sub { $QUIT_DIALOG->hide; 0 }, 1873 on_activate => sub { $QUIT_DIALOG->hide; 0 },
1837 ); 1874 );
1838 $hb->add (new CFPlus::UI::Button 1875 $hb->add (new CFPlus::UI::Button
1839 text => "Quit anyway", 1876 text => "Quit anyway",
1840 expand => 1, 1877 expand => 1,
1841 on_activate => sub { exit }, 1878 on_activate => sub { Event::unloop_all },
1842 ); 1879 );
1843 } 1880 }
1844 1881
1845 $QUIT_DIALOG->show; 1882 $QUIT_DIALOG->show;
1846 $QUIT_DIALOG->grab_focus; 1883 $QUIT_DIALOG->grab_focus;
2040 tooltip => "Terminates the program", 2077 tooltip => "Terminates the program",
2041 on_activate => sub { 2078 on_activate => sub {
2042 if ($CONN) { 2079 if ($CONN) {
2043 open_quit_dialog; 2080 open_quit_dialog;
2044 } else { 2081 } else {
2045 exit; 2082 Event::unloop_all;
2046 } 2083 }
2047 0 2084 0
2048 }, 2085 },
2049 ); 2086 );
2050 2087
2051 $BUTTONBAR->show; 2088 $BUTTONBAR->show;
2052 $SETUP_DIALOG->show; 2089 $SETUP_DIALOG->show;
2090 $MESSAGE_WINDOW->show;
2053 } 2091 }
2054 2092
2055 $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); 2093 $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]);
2056} 2094}
2057 2095
2065my $animate_timer; 2103my $animate_timer;
2066 2104
2067my $fps = 9; 2105my $fps = 9;
2068 2106
2069sub force_refresh { 2107sub force_refresh {
2108 if ($ENV{CFPLUS_DEBUG} & 4) {
2070 $fps = $fps * 0.95 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.05; 2109 $fps = $fps * 0.98 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.02;
2071 debug sprintf "%3.2f", $fps if $ENV{CFPLUS_DEBUG} & 4; 2110 debug sprintf "%3.2f", $fps;
2111 }
2072 2112
2073 $CFPlus::UI::ROOT->draw; 2113 $CFPlus::UI::ROOT->draw;
2074 2114 CFPlus::SDL_GL_SwapBuffers;
2075 $WANT_REFRESH = 0;
2076 $CAN_REFRESH = 0;
2077 $LAST_REFRESH = $NOW; 2115 $LAST_REFRESH = $NOW;
2078 2116 $WANT_REFRESH->stop;
2079 CFPlus::SDL_GL_SwapBuffers;
2080} 2117}
2081 2118
2119$WANT_REFRESH = Event->idle (min => 0.001, max => 0.06, parked => 1, cb => \&force_refresh);
2120
2082my $refresh_watcher = Event->timer (after => 0, hard => 0, interval => 1 / $MAX_FPS, cb => sub { 2121my $input = Event->timer (after => 0, hard => 0, interval => 1 / 50, cb => sub {
2083 $NOW = time; 2122 $NOW = time;
2084 2123
2085 ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) 2124 ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_)
2086 for CFPlus::poll_events; 2125 for CFPlus::poll_events;
2087 2126
2088 if (%animate_object) { 2127 if (%animate_object) {
2089 $_->animate ($LAST_REFRESH - $NOW) for values %animate_object; 2128 $_->animate ($LAST_REFRESH - $NOW) for values %animate_object;
2090 ++$WANT_REFRESH; 2129 $WANT_REFRESH->start;
2091 }
2092
2093 if ($WANT_REFRESH) {
2094 force_refresh;
2095 } else {
2096 $CAN_REFRESH = 1;
2097 } 2130 }
2098}); 2131});
2099 2132
2100sub animation_start { 2133sub animation_start {
2101 my ($widget) = @_; 2134 my ($widget) = @_;
2159 2192
2160 my %DEF_CFG = ( 2193 my %DEF_CFG = (
2161 sdl_mode => 0, 2194 sdl_mode => 0,
2162 fullscreen => 0, 2195 fullscreen => 0,
2163 fast => 0, 2196 fast => 0,
2197 opengl11 => 0,
2164 map_scale => 1, 2198 map_scale => 1,
2165 fow_enable => 1, 2199 fow_enable => 1,
2166 fow_intensity => 0, 2200 fow_intensity => 0,
2167 map_smoothing => 1, 2201 map_smoothing => 1,
2168 gui_fontsize => 1, 2202 gui_fontsize => 1,
2257} 2291}
2258 2292
2259show_tip_of_the_day if $CFG->{show_tips}; 2293show_tip_of_the_day if $CFG->{show_tips};
2260 2294
2261Event::loop; 2295Event::loop;
2296
2297#video_shutdown;
2298#audio_shutdown;
2262#CFPlus::SDL_Quit; 2299CFPlus::SDL_Quit;
2263#CFPlus::_exit 0;
2264
2265END {
2266 CFPlus::SDL_Quit;
2267 CFPlus::DB::Server::stop; 2300CFPlus::DB::Server::stop;
2268}
2269 2301
2270=head1 NAME 2302=head1 NAME
2271 2303
2272cfplus - A Crossfire+ and Crossfire game client 2304cfplus - A Crossfire TRT and Crossfire game client
2273 2305
2274=head1 SYNOPSIS 2306=head1 SYNOPSIS
2275 2307
2276Just run it - no commandline arguments are supported. 2308Just run it - no commandline arguments are supported.
2277 2309
2278=head1 USAGE 2310=head1 USAGE
2279 2311
2280cfplus utilises OpenGL for all UI elements and the game. It is supposed to be used 2312cfplus utilises OpenGL for all UI elements and the game. It is supposed to
2281fullscreen and interactively. 2313be used in fullscreen mode and interactively.
2282 2314
2283=head1 DEBUGGING 2315=head1 DEBUGGING
2284 2316
2285 2317
2286CFPLUS_DEBUG - environment variable 2318CFPLUS_DEBUG - environment variable

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines