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.214 by elmex, Tue Aug 14 14:12:46 2007 UTC vs.
Revision 1.225 by root, Fri Aug 31 08:03:10 2007 UTC

126our $FONT_FIXED; 126our $FONT_FIXED;
127 127
128our $MAP; 128our $MAP;
129our $MAPMAP; 129our $MAPMAP;
130our $MAPWIDGET; 130our $MAPWIDGET;
131our $COMPLETER;
131our $BUTTONBAR; 132our $BUTTONBAR;
132our $METASERVER; 133our $METASERVER;
133our $LOGIN_BUTTON; 134our $LOGIN_BUTTON;
134our $QUIT_DIALOG; 135our $QUIT_DIALOG;
135our $HOST_ENTRY; 136our $HOST_ENTRY;
146our $PL_WINDOW; 147our $PL_WINDOW;
147 148
148our $MUSIC_PLAYING_WIDGET; 149our $MUSIC_PLAYING_WIDGET;
149our $LICENSE_WIDGET; 150our $LICENSE_WIDGET;
150 151
152our $PICKUP_PAGE;
151our $INVENTORY_PAGE; 153our $INVENTORY_PAGE;
152our $STATS_PAGE; 154our $STATS_PAGE;
153our $SKILL_PAGE; 155our $SKILL_PAGE;
154our $SPELL_PAGE; 156our $SPELL_PAGE;
155our $SPELL_LIST; 157our $SPELL_LIST;
167our $STATUSBOX; 169our $STATUSBOX;
168our $DEBUG_STATUS; 170our $DEBUG_STATUS;
169 171
170our $INV; 172our $INV;
171our $INVR; 173our $INVR;
172our $INV_RIGHT_HB; 174our $INVR_HB;
173
174our $PICKUP_CFG;
175 175
176############################################################################# 176#############################################################################
177 177
178sub status { 178sub status {
179 $STATUSBOX->add (CFPlus::asxml $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); 179 $STATUSBOX->add (CFPlus::asxml $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]);
182sub debug { 182sub debug {
183 $DEBUG_STATUS->set_text ($_[0]); 183 $DEBUG_STATUS->set_text ($_[0]);
184} 184}
185 185
186sub message { 186sub message {
187 my ($para) = @_;
188 $MESSAGE_WINDOW->message ($para); 187 $MESSAGE_WINDOW->message (@_);
189} 188}
190 189
191############################################################################# 190#############################################################################
192#TODO: maybe move into own audio module... 191#TODO: maybe move into own audio module...
193 192
230 $channel->set_position_r ($dx, $dy, 20); 229 $channel->set_position_r ($dx, $dy, 20);
231 $chunk->play ($channel); 230 $chunk->play ($channel);
232 } 231 }
233 } else { 232 } else {
234 # sound_meta not set means data is in flight either way 233 # sound_meta not set means data is in flight either way
235 my $meta = $CONN->{sound_meta}{$face} 234 my $meta = $CONN->{face}[$face]
236 or return; 235 or return;
237 236
237 $meta->{data}
238 or return;
239
238 # if its a jingle, play it as ambient music 240 # if its a jingle, play it as ambient music
239 if ($meta->{meta}{jingle}) { 241 if ($meta->{data}{jingle}) {
240 if (delete $AUDIO_PLAY{$face}) { # take the jingle out of the sound queue 242 if (delete $AUDIO_PLAY{$face}) { # take the jingle out of the sound queue
241 push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue 243 push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue
242 &audio_music_push ($face); 244 &audio_music_push ($face);
243 } 245 }
244 } else { 246 } else {
245 # fetch from database 247 # fetch from database
246 CFPlus::DB::get res_data => $meta->{name}, sub { 248 CFPlus::DB::get res_data => $meta->{name}, sub {
247 my $rwops = new CFPlus::RW $_[0]; 249 my $rwops = new CFPlus::RW $_[0];
248 my $chunk = new CFPlus::MixChunk $rwops 250 my $chunk = new CFPlus::MixChunk $rwops
249 or Carp::confess "sound face " . (JSON::XS::to_json $meta) . " unloadable: " . CFPlus::Mix_GetError; 251 or Carp::confess "sound face " . (JSON::XS::to_json $meta) . " unloadable: " . CFPlus::Mix_GetError;
250 $chunk->volume (($meta->{meta}{volume} || 1) * 128); 252 $chunk->volume (($meta->{data}{volume} || 1) * 128);
251 $AUDIO_CHUNK{$face} = $chunk; 253 $AUDIO_CHUNK{$face} = $chunk;
252 254
253 audio_sound_push ($face); 255 audio_sound_push ($face);
254 }; 256 };
255 } 257 }
273sub audio_music_set_meta { 275sub audio_music_set_meta {
274 my ($meta) = @_; 276 my ($meta) = @_;
275 277
276 $MUSIC_PLAYING_META = $meta; 278 $MUSIC_PLAYING_META = $meta;
277 $MUSIC_PLAYING_WIDGET->set_markup ( 279 $MUSIC_PLAYING_WIDGET->set_markup (
278 "<b>Name</b>: " . (CFPlus::asxml $meta->{meta}{name}) . "\n" 280 "<b>Name</b>: " . (CFPlus::asxml $meta->{data}{name}) . "\n"
279 . "<b>Author</b>: " . (CFPlus::asxml $meta->{meta}{author}) . "\n" 281 . "<b>Author</b>: " . (CFPlus::asxml $meta->{data}{author}) . "\n"
280 . "<b>Source</b>: " . (CFPlus::asxml $meta->{meta}{source}) . "\n" 282 . "<b>Source</b>: " . (CFPlus::asxml $meta->{data}{source}) . "\n"
281 . "<b>License</b>: " . (CFPlus::asxml $meta->{meta}{license}) 283 . "<b>License</b>: " . (CFPlus::asxml $meta->{data}{license})
282 ); 284 );
283} 285}
284 286
285sub audio_music_update_volume { 287sub audio_music_update_volume {
286 return unless $MUSIC_PLAYING_META; 288 return unless $MUSIC_PLAYING_META;
287 my $volume = $MUSIC_PLAYING_META->{meta}{volume} || 1; 289 my $volume = $MUSIC_PLAYING_META->{data}{volume} || 1;
288 my $base = $MUSIC_PLAYING_META->{meta}{jingle} ? 1 : $CFG->{bgm_volume}; 290 my $base = $MUSIC_PLAYING_META->{data}{jingle} ? 1 : $CFG->{bgm_volume};
289 CFPlus::MixMusic::volume $base * $volume * 128; 291 CFPlus::MixMusic::volume $base * $volume * 128;
290} 292}
291 293
292sub audio_music_start { 294sub audio_music_start {
293 my $meta = $MUSIC_PLAYING_META; 295 my $meta = $MUSIC_PLAYING_META;
312 314
313 my $NOW = time; 315 my $NOW = time;
314 316
315 if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) { 317 if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) {
316 my $pos = $MUSIC_PLAYING_META->{stop_pos}; 318 my $pos = $MUSIC_PLAYING_META->{stop_pos};
317 $MUSIC_PLAYER->fade_in_pos (0, 1000, $pos); 319 $MUSIC_PLAYER->fade_in_pos (0, 700, $pos);
318 $MUSIC_START = time - $pos; 320 $MUSIC_START = time - $pos;
319 } else { 321 } else {
320 $MUSIC_PLAYER->play (0); 322 $MUSIC_PLAYER->play (0);
321 $MUSIC_START = time; 323 $MUSIC_START = time;
322 } 324 }
336 $fade_out = 333; 338 $fade_out = 333;
337 } else { 339 } else {
338 return unless $CFG->{bgm_enable}; 340 return unless $CFG->{bgm_enable};
339 341
340 my @have = 342 my @have =
341 grep $_, 343 grep $_ && $_->{data},
342 map $CONN->{music_meta}{$_}, 344 map $CONN->{face}[$_],
343 @$MUSIC_WANT; 345 @$MUSIC_WANT;
346
347 # randomize music a bit so that the order is not always the same
348 $_->{stop_time} ||= rand for @have;
344 349
345 @MUSIC_HAVE = @have 350 @MUSIC_HAVE = @have
346 if @have; 351 if @have;
347 352
348 # default MUSIC_HAVE == MUSIC_DEFAULT 353 # default MUSIC_HAVE == MUSIC_DEFAULT
349 @MUSIC_HAVE = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_HAVE; 354 @MUSIC_HAVE = { path => CFPlus::find_rcfile "music/$MUSIC_DEFAULT" } unless @MUSIC_HAVE;
350 $fade_out = 1000; 355 $fade_out = 700;
351 } 356 }
352 357
353 # if the currently playing song is acceptable, let it continue 358 # if the currently playing song is acceptable, let it continue
354 return if grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE; 359 return if grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE;
355 360
364 @MUSIC_HAVE = sort { $a->{stop_time} <=> $b->{stop_time} } @MUSIC_HAVE; 369 @MUSIC_HAVE = sort { $a->{stop_time} <=> $b->{stop_time} } @MUSIC_HAVE;
365 370
366 # if the most recently-played piece played very recently, 371 # if the most recently-played piece played very recently,
367 # resume it, else choose the oldest piece for rotation. 372 # resume it, else choose the oldest piece for rotation.
368 audio_music_set_meta 373 audio_music_set_meta
369 $MUSIC_HAVE[-1]{stop_time} > $NOW - $MUSIC_RESUME 374 $MUSIC_HAVE[-1]{stop_pos} && $MUSIC_HAVE[-1]{stop_time} > $NOW - $MUSIC_RESUME
370 ? $MUSIC_HAVE[-1] 375 ? $MUSIC_HAVE[-1]
371 : $MUSIC_HAVE[0]; 376 : $MUSIC_HAVE[0];
372 377
373 audio_music_start; 378 audio_music_start;
374 } 379 }
380 $MUSIC_WANT = $songs; 385 $MUSIC_WANT = $songs;
381 audio_music_push; 386 audio_music_push;
382} 387}
383 388
384sub audio_music_finished { 389sub audio_music_finished {
390 if ($MUSIC_PLAYING_META) {
391 $MUSIC_PLAYING_META->{stop_time} = time;
392 }
393
385 # we compress multiple jingles of the same type 394 # we compress multiple jingles of the same type
386 shift @MUSIC_JINGLE 395 shift @MUSIC_JINGLE
387 while @MUSIC_JINGLE && $MUSIC_PLAYING_META == $MUSIC_JINGLE[0]; 396 while @MUSIC_JINGLE && $MUSIC_PLAYING_META == $MUSIC_JINGLE[0];
388 397
389 $MUSIC_PLAYING_WIDGET->clear; 398 $MUSIC_PLAYING_WIDGET->clear;
771 on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } 780 on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 }
772 ); 781 );
773 782
774 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Force OpenGL 1.1"); 783 $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 784 $table->add_at (1, $row++, new CFPlus::UI::CheckBox
776 state => $CFG->{opengl11}, 785 state => $CFG->{force_opengl11},
777 tooltip => "Limit CFPlus to use OpenGL 1.1 features only. This will normally result in " 786 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 " 787 . "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. " 788 . "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, " 789 . "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 " 790 . "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>", 791 . "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 } 792 on_changed => sub { my ($self, $value) = @_; $CFG->{force_opengl11} = $value; 0 }
793 );
794
795 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Compress Textures");
796 $table->add_at (1, $row++, new CFPlus::UI::CheckBox
797 state => $CFG->{texture_compression},
798 tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but "
799 . "will save a lot of memory and increase performance. The compression algorithm "
800 . "can differ form card to card, so your mileage may vary. This setting is ignored in "
801 . "forced OpenGL 1.1 mode.",
802 on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 }
784 ); 803 );
785 804
786 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); 805 $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fast & Ugly");
787 $table->add_at (1, $row++, new CFPlus::UI::CheckBox 806 $table->add_at (1, $row++, new CFPlus::UI::CheckBox
788 state => $CFG->{fast}, 807 state => $CFG->{fast},
910 expand => 1, state => $CFG->{bgm_enable}, 929 expand => 1, state => $CFG->{bgm_enable},
911 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", 930 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.",
912 on_changed => sub { 931 on_changed => sub {
913 $CFG->{bgm_enable} = $_[1]; 932 $CFG->{bgm_enable} = $_[1];
914 $CONN->update_fx_want if $CONN; 933 $CONN->update_fx_want if $CONN;
934 audio_music_push;
915 0 935 0
916 } 936 }
917 ); 937 );
918 $table->add_at (2, $row++, new CFPlus::UI::Slider 938 $table->add_at (2, $row++, new CFPlus::UI::Slider
919 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], 939 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128],
972 $hb->add (my $hg = new CFPlus::UI::Gauge type => 'hp', tooltip => "#stat_health"); 992 $hb->add (my $hg = new CFPlus::UI::Gauge type => 'hp', tooltip => "#stat_health");
973 $hb->add (my $mg = new CFPlus::UI::Gauge type => 'mana', tooltip => "#stat_mana"); 993 $hb->add (my $mg = new CFPlus::UI::Gauge type => 'mana', tooltip => "#stat_mana");
974 $hb->add (my $gg = new CFPlus::UI::Gauge type => 'grace', tooltip => "#stat_grace"); 994 $hb->add (my $gg = new CFPlus::UI::Gauge type => 'grace', tooltip => "#stat_grace");
975 $hb->add (my $fg = new CFPlus::UI::Gauge type => 'food', tooltip => "#stat_food"); 995 $hb->add (my $fg = new CFPlus::UI::Gauge type => 'food', tooltip => "#stat_food");
976 996
977 $vbox->add (my $exp = new CFPlus::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_exp"); 997 $vbox->add (my $exp = new CFPlus::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_exp");
998 $vbox->add (my $prg = new CFPlus::UI::ExperienceProgress);
999 $vbox->add (my $sklprg = new CFPlus::UI::ExperienceProgress);
978 $vbox->add (my $rng = new CFPlus::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_ranged"); 1000 $vbox->add (my $rng = new CFPlus::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_ranged");
979 1001
980 $GAUGES = { 1002 $GAUGES = {
1003 exp => $exp, prg => $prg, sklprg => $sklprg,
981 exp => $exp, win => $win, range => $rng, 1004 win => $win, range => $rng,
982 food => $fg, mana => $mg, hp => $hg, grace => $gg 1005 hp => $hg, mana => $mg, grace => $gg, food => $fg,
983 }; 1006 };
984 1007
985 &set_gauge_window_fontsize; 1008 &set_gauge_window_fontsize;
986 1009
987 $win 1010 $win
1188 $r 1211 $r
1189} 1212}
1190 1213
1191sub skill_window { 1214sub skill_window {
1192 my $sw = new CFPlus::UI::ScrolledWindow (expand => 1); 1215 my $sw = new CFPlus::UI::ScrolledWindow (expand => 1);
1216
1193 $sw->add ($STATWIDS->{skill_tbl} = new CFPlus::UI::Table expand => 1, col_expand => [0, 0, 1, 0, 0, 1]); 1217 $sw->add ($STATWIDS->{skill_tbl} = new CFPlus::UI::Table expand => 1, col_expand => [0, 0, 1, .1, 0, 0, 1, .1]);
1218
1194 $sw 1219 $sw
1195} 1220}
1196 1221
1197sub formsep($) { 1222sub formsep($) {
1198 scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1 1223 scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1
1610 $sw1->add ($INV = new CFPlus::UI::Inventory); 1635 $sw1->add ($INV = new CFPlus::UI::Inventory);
1611 $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}}); 1636 $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}});
1612 1637
1613 $hb->add (my $vb2 = new CFPlus::UI::VBox); 1638 $hb->add (my $vb2 = new CFPlus::UI::VBox);
1614 1639
1615 $vb2->add ($INV_RIGHT_HB = new CFPlus::UI::HBox); 1640 $vb2->add ($INVR_HB = new CFPlus::UI::HBox);
1616 1641
1617 $vb2->add (my $sw2 = new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); 1642 $vb2->add (my $sw2 = new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1);
1618 $sw2->add ($INVR = new CFPlus::UI::Inventory); 1643 $sw2->add ($INVR = new CFPlus::UI::Inventory);
1619 1644
1620 # XXX: Call after $INVR = ... because set_opencont sets the items 1645 # XXX: Call after $INVR = ... because set_opencont sets the items
1643} 1668}
1644 1669
1645sub add_license { 1670sub add_license {
1646 my ($meta) = @_; 1671 my ($meta) = @_;
1647 1672
1648 $meta = $meta->{meta} 1673 $meta = $meta->{data}
1649 or return; 1674 or return;
1650 1675
1651 $meta->{license} || $meta->{author} || $meta->{source} 1676 $meta->{license} || $meta->{author} || $meta->{source}
1652 or return; 1677 or return;
1653 1678
1707 $ntb->add_tab ( 1732 $ntb->add_tab (
1708 "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget, 1733 "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget,
1709 "Toggles the inventory window, where you can manage your loot (or treasures :). " 1734 "Toggles the inventory window, where you can manage your loot (or treasures :). "
1710 . "You can also hit the <b>Tab</b>-key to show/hide the Inventory." 1735 . "You can also hit the <b>Tab</b>-key to show/hide the Inventory."
1711 ); 1736 );
1712 $ntb->add_tab (Pickup => autopickup_setup, 1737 $ntb->add_tab (Pickup => $PICKUP_PAGE = autopickup_setup,
1713 "Configure autopickup settings, i.e. which items you will pick up automatically when walking (or running) over them."); 1738 "Configure autopickup settings, i.e. which items you will pick up automatically when walking (or running) over them.");
1714 1739
1715 $ntb->add_tab (Media => media_window, 1740 $ntb->add_tab (Media => media_window,
1716 "License, Author and Source info for media sent by the server."); 1741 "License, Author and Source info for media sent by the server.");
1717 1742
1958 1983
1959 $SDL_ACTIVE = 1; 1984 $SDL_ACTIVE = 1;
1960 $LAST_REFRESH = time - 0.01; 1985 $LAST_REFRESH = time - 0.01;
1961 1986
1962 CFPlus::OpenGL::init; 1987 CFPlus::OpenGL::init;
1988 CFPlus::Macro::init;
1963 1989
1964 $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; 1990 $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize};
1965 1991
1966 $CFPlus::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d# 1992 $CFPlus::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d#
1967 1993
1968 ############################################################################# 1994 #############################################################################
1969 1995
1970 if ($DEBUG_STATUS) { 1996 if ($DEBUG_STATUS) {
1971 CFPlus::UI::rescale_widgets $WIDTH / $old_w, $HEIGHT / $old_h; 1997 CFPlus::UI::rescale_widgets $WIDTH / $old_w, $HEIGHT / $old_h;
1972 } else { 1998 } else {
1973 # create the widgets 1999 # create/configure the widgets
2000
2001 $CFPlus::UI::ROOT->connect (key_down => sub {
2002 my (undef, $ev) = @_;
2003
2004 if (my @macros = CFPlus::Macro::find $ev) {
2005 CFPlus::Macro::execute $_ for @macros;
2006
2007 return 1;
2008 }
2009
2010 0
2011 });
1974 2012
1975 $DEBUG_STATUS = new CFPlus::UI::Label 2013 $DEBUG_STATUS = new CFPlus::UI::Label
1976 padding => 0, 2014 padding => 0,
1977 z => 100, 2015 z => 100,
1978 force_x => "max", 2016 force_x => "max",
2008 $MESSAGE_WINDOW->activate_console ($preset) 2046 $MESSAGE_WINDOW->activate_console ($preset)
2009 if $MESSAGE_WINDOW; 2047 if $MESSAGE_WINDOW;
2010 }); 2048 });
2011 $MAPWIDGET->show; 2049 $MAPWIDGET->show;
2012 $MAPWIDGET->grab_focus; 2050 $MAPWIDGET->grab_focus;
2051
2052 $COMPLETER = new CFPlus::MapWidget::Command::
2053 command => { },
2054 tooltip => "#completer_help",
2055 ;
2013 2056
2014 $SETUP_DIALOG = new CFPlus::UI::Toplevel 2057 $SETUP_DIALOG = new CFPlus::UI::Toplevel
2015 title => "Setup", 2058 title => "Setup",
2016 name => "setup_dialog", 2059 name => "setup_dialog",
2017 x => 'center', 2060 x => 'center',
2142 delete $animate_object{$widget}; 2185 delete $animate_object{$widget};
2143} 2186}
2144 2187
2145%SDL_CB = ( 2188%SDL_CB = (
2146 CFPlus::SDL_QUIT => sub { 2189 CFPlus::SDL_QUIT => sub {
2147 exit; 2190 Event::unloop_all;
2148 }, 2191 },
2149 CFPlus::SDL_VIDEORESIZE => sub { 2192 CFPlus::SDL_VIDEORESIZE => sub {
2150 }, 2193 },
2151 CFPlus::SDL_VIDEOEXPOSE => sub { 2194 CFPlus::SDL_VIDEOEXPOSE => sub {
2152 CFPlus::UI::full_refresh; 2195 CFPlus::UI::full_refresh;
2191 CFPlus::DB::Server::run; 2234 CFPlus::DB::Server::run;
2192 2235
2193 CFPlus::UI::set_layout ($::CFG->{layout}); 2236 CFPlus::UI::set_layout ($::CFG->{layout});
2194 2237
2195 my %DEF_CFG = ( 2238 my %DEF_CFG = (
2196 sdl_mode => 0, 2239 sdl_mode => 0,
2197 fullscreen => 0, 2240 fullscreen => 0,
2198 fast => 0, 2241 fast => 0,
2199 opengl11 => 0, 2242 force_opengl11 => undef,
2243 texture_compression => 1,
2200 map_scale => 1, 2244 map_scale => 1,
2201 fow_enable => 1, 2245 fow_enable => 1,
2202 fow_intensity => 0, 2246 fow_intensity => 0,
2203 map_smoothing => 1, 2247 map_smoothing => 1,
2204 gui_fontsize => 1, 2248 gui_fontsize => 1,
2205 log_fontsize => 0.7, 2249 log_fontsize => 0.7,
2206 gauge_fontsize => 1, 2250 gauge_fontsize => 1,
2207 gauge_size => 0.35, 2251 gauge_size => 0.35,
2208 stat_fontsize => 0.7, 2252 stat_fontsize => 0.7,
2209 mapsize => 100, 2253 mapsize => 100,
2210 audio_enable => 1, 2254 audio_enable => 1,
2211 effects_enable => 1, 2255 effects_enable => 1,
2212 effects_volume => 1, 2256 effects_volume => 1,
2213 bgm_enable => 1, 2257 bgm_enable => 1,
2214 bgm_volume => 0.5, 2258 bgm_volume => 0.5,
2215 output_sync => 1, 2259 output_sync => 1,
2216 output_count => 1, 2260 output_count => 1,
2217 output_rate => "", 2261 output_rate => "",
2218 pickup => 0, 2262 pickup => 0,
2219 inv_sort => "mtime", 2263 inv_sort => "mtime",
2220 default => "profile", # default profile 2264 default => "profile", # default profile
2221 show_tips => 1, 2265 show_tips => 1,
2222 logview_max_par => 1000, 2266 logview_max_par => 1000,
2223 ); 2267 );
2224 2268
2225 while (my ($k, $v) = each %DEF_CFG) { 2269 while (my ($k, $v) = each %DEF_CFG) {
2226 $CFG->{$k} = $v unless exists $CFG->{$k}; 2270 $CFG->{$k} = $v unless exists $CFG->{$k};
2227 } 2271 }
2284# } 2328# }
2285# my $t2 = Time::HiRes::time; 2329# my $t2 = Time::HiRes::time;
2286# warn $t2-$t1; 2330# warn $t2-$t1;
2287# } 2331# }
2288 2332
2289 $startup_done->();
2290
2291 video_init; 2333 video_init;
2292 audio_init; 2334 audio_init;
2293} 2335}
2294 2336
2295show_tip_of_the_day if $CFG->{show_tips}; 2337show_tip_of_the_day if $CFG->{show_tips};
2338
2339Event->idle (cb => sub {
2340 $_[0]->w->cancel;
2341 $startup_done->();
2342});
2296 2343
2297Event::loop; 2344Event::loop;
2298 2345
2299#video_shutdown; 2346#video_shutdown;
2300#audio_shutdown; 2347#audio_shutdown;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines