… | |
… | |
126 | our $FONT_FIXED; |
126 | our $FONT_FIXED; |
127 | |
127 | |
128 | our $MAP; |
128 | our $MAP; |
129 | our $MAPMAP; |
129 | our $MAPMAP; |
130 | our $MAPWIDGET; |
130 | our $MAPWIDGET; |
|
|
131 | our $COMPLETER; |
131 | our $BUTTONBAR; |
132 | our $BUTTONBAR; |
132 | our $METASERVER; |
133 | our $METASERVER; |
133 | our $LOGIN_BUTTON; |
134 | our $LOGIN_BUTTON; |
134 | our $QUIT_DIALOG; |
135 | our $QUIT_DIALOG; |
135 | our $HOST_ENTRY; |
136 | our $HOST_ENTRY; |
… | |
… | |
146 | our $PL_WINDOW; |
147 | our $PL_WINDOW; |
147 | |
148 | |
148 | our $MUSIC_PLAYING_WIDGET; |
149 | our $MUSIC_PLAYING_WIDGET; |
149 | our $LICENSE_WIDGET; |
150 | our $LICENSE_WIDGET; |
150 | |
151 | |
|
|
152 | our $PICKUP_PAGE; |
151 | our $INVENTORY_PAGE; |
153 | our $INVENTORY_PAGE; |
152 | our $STATS_PAGE; |
154 | our $STATS_PAGE; |
153 | our $SKILL_PAGE; |
155 | our $SKILL_PAGE; |
154 | our $SPELL_PAGE; |
156 | our $SPELL_PAGE; |
155 | our $SPELL_LIST; |
157 | our $SPELL_LIST; |
… | |
… | |
167 | our $STATUSBOX; |
169 | our $STATUSBOX; |
168 | our $DEBUG_STATUS; |
170 | our $DEBUG_STATUS; |
169 | |
171 | |
170 | our $INV; |
172 | our $INV; |
171 | our $INVR; |
173 | our $INVR; |
172 | our $INV_RIGHT_HB; |
174 | our $INVR_HB; |
173 | |
|
|
174 | our $PICKUP_CFG; |
|
|
175 | |
175 | |
176 | ############################################################################# |
176 | ############################################################################# |
177 | |
177 | |
178 | sub status { |
178 | sub 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]); |
… | |
… | |
230 | $channel->set_position_r ($dx, $dy, 20); |
230 | $channel->set_position_r ($dx, $dy, 20); |
231 | $chunk->play ($channel); |
231 | $chunk->play ($channel); |
232 | } |
232 | } |
233 | } else { |
233 | } else { |
234 | # sound_meta not set means data is in flight either way |
234 | # sound_meta not set means data is in flight either way |
235 | my $meta = $CONN->{sound_meta}{$face} |
235 | my $meta = $CONN->{face}[$face] |
236 | or return; |
236 | or return; |
237 | |
237 | |
|
|
238 | $meta->{data} |
|
|
239 | or return; |
|
|
240 | |
238 | # if its a jingle, play it as ambient music |
241 | # if its a jingle, play it as ambient music |
239 | if ($meta->{meta}{jingle}) { |
242 | if ($meta->{data}{jingle}) { |
240 | if (delete $AUDIO_PLAY{$face}) { # take the jingle out of the sound queue |
243 | 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 |
244 | push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue |
242 | &audio_music_push ($face); |
245 | &audio_music_push ($face); |
243 | } |
246 | } |
244 | } else { |
247 | } else { |
245 | # fetch from database |
248 | # fetch from database |
246 | CFPlus::DB::get res_data => $meta->{name}, sub { |
249 | CFPlus::DB::get res_data => $meta->{name}, sub { |
247 | my $rwops = new CFPlus::RW $_[0]; |
250 | my $rwops = new CFPlus::RW $_[0]; |
248 | my $chunk = new CFPlus::MixChunk $rwops |
251 | my $chunk = new CFPlus::MixChunk $rwops |
249 | or Carp::confess "sound face " . (JSON::XS::to_json $meta) . " unloadable: " . CFPlus::Mix_GetError; |
252 | or Carp::confess "sound face " . (JSON::XS::to_json $meta) . " unloadable: " . CFPlus::Mix_GetError; |
250 | $chunk->volume (($meta->{meta}{volume} || 1) * 128); |
253 | $chunk->volume (($meta->{data}{volume} || 1) * 128); |
251 | $AUDIO_CHUNK{$face} = $chunk; |
254 | $AUDIO_CHUNK{$face} = $chunk; |
252 | |
255 | |
253 | audio_sound_push ($face); |
256 | audio_sound_push ($face); |
254 | }; |
257 | }; |
255 | } |
258 | } |
… | |
… | |
273 | sub audio_music_set_meta { |
276 | sub audio_music_set_meta { |
274 | my ($meta) = @_; |
277 | my ($meta) = @_; |
275 | |
278 | |
276 | $MUSIC_PLAYING_META = $meta; |
279 | $MUSIC_PLAYING_META = $meta; |
277 | $MUSIC_PLAYING_WIDGET->set_markup ( |
280 | $MUSIC_PLAYING_WIDGET->set_markup ( |
278 | "<b>Name</b>: " . (CFPlus::asxml $meta->{meta}{name}) . "\n" |
281 | "<b>Name</b>: " . (CFPlus::asxml $meta->{data}{name}) . "\n" |
279 | . "<b>Author</b>: " . (CFPlus::asxml $meta->{meta}{author}) . "\n" |
282 | . "<b>Author</b>: " . (CFPlus::asxml $meta->{data}{author}) . "\n" |
280 | . "<b>Source</b>: " . (CFPlus::asxml $meta->{meta}{source}) . "\n" |
283 | . "<b>Source</b>: " . (CFPlus::asxml $meta->{data}{source}) . "\n" |
281 | . "<b>License</b>: " . (CFPlus::asxml $meta->{meta}{license}) |
284 | . "<b>License</b>: " . (CFPlus::asxml $meta->{data}{license}) |
282 | ); |
285 | ); |
283 | } |
286 | } |
284 | |
287 | |
285 | sub audio_music_update_volume { |
288 | sub audio_music_update_volume { |
286 | return unless $MUSIC_PLAYING_META; |
289 | return unless $MUSIC_PLAYING_META; |
287 | my $volume = $MUSIC_PLAYING_META->{meta}{volume} || 1; |
290 | my $volume = $MUSIC_PLAYING_META->{data}{volume} || 1; |
288 | my $base = $MUSIC_PLAYING_META->{meta}{jingle} ? 1 : $CFG->{bgm_volume}; |
291 | my $base = $MUSIC_PLAYING_META->{data}{jingle} ? 1 : $CFG->{bgm_volume}; |
289 | CFPlus::MixMusic::volume $base * $volume * 128; |
292 | CFPlus::MixMusic::volume $base * $volume * 128; |
290 | } |
293 | } |
291 | |
294 | |
292 | sub audio_music_start { |
295 | sub audio_music_start { |
293 | my $meta = $MUSIC_PLAYING_META; |
296 | my $meta = $MUSIC_PLAYING_META; |
… | |
… | |
336 | $fade_out = 333; |
339 | $fade_out = 333; |
337 | } else { |
340 | } else { |
338 | return unless $CFG->{bgm_enable}; |
341 | return unless $CFG->{bgm_enable}; |
339 | |
342 | |
340 | my @have = |
343 | my @have = |
341 | grep $_, |
344 | grep $_ && $_->{data}, |
342 | map $CONN->{music_meta}{$_}, |
345 | map $CONN->{face}[$_], |
343 | @$MUSIC_WANT; |
346 | @$MUSIC_WANT; |
344 | |
347 | |
345 | @MUSIC_HAVE = @have |
348 | @MUSIC_HAVE = @have |
346 | if @have; |
349 | if @have; |
347 | |
350 | |
… | |
… | |
771 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
774 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
772 | ); |
775 | ); |
773 | |
776 | |
774 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Force OpenGL 1.1"); |
777 | $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 |
778 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
776 | state => $CFG->{opengl11}, |
779 | state => $CFG->{force_opengl11}, |
777 | tooltip => "Limit CFPlus to use OpenGL 1.1 features only. This will normally result in " |
780 | 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 " |
781 | . "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. " |
782 | . "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, " |
783 | . "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 " |
784 | . "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>", |
785 | . "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 } |
786 | on_changed => sub { my ($self, $value) = @_; $CFG->{force_opengl11} = $value; 0 } |
|
|
787 | ); |
|
|
788 | |
|
|
789 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Compress Textures"); |
|
|
790 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
|
|
791 | state => $CFG->{texture_compression}, |
|
|
792 | tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but " |
|
|
793 | . "will save a lot of memory and increase performance. The compression algorithm " |
|
|
794 | . "can differ form card to card, so your mileage may vary. This setting is ignored in " |
|
|
795 | . "forced OpenGL 1.1 mode.", |
|
|
796 | on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 } |
784 | ); |
797 | ); |
785 | |
798 | |
786 | $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
799 | $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 |
800 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
788 | state => $CFG->{fast}, |
801 | state => $CFG->{fast}, |
… | |
… | |
910 | expand => 1, state => $CFG->{bgm_enable}, |
923 | expand => 1, state => $CFG->{bgm_enable}, |
911 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", |
924 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", |
912 | on_changed => sub { |
925 | on_changed => sub { |
913 | $CFG->{bgm_enable} = $_[1]; |
926 | $CFG->{bgm_enable} = $_[1]; |
914 | $CONN->update_fx_want if $CONN; |
927 | $CONN->update_fx_want if $CONN; |
|
|
928 | audio_music_push; |
915 | 0 |
929 | 0 |
916 | } |
930 | } |
917 | ); |
931 | ); |
918 | $table->add_at (2, $row++, new CFPlus::UI::Slider |
932 | $table->add_at (2, $row++, new CFPlus::UI::Slider |
919 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], |
933 | 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"); |
986 | $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"); |
987 | $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"); |
988 | $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"); |
989 | $hb->add (my $fg = new CFPlus::UI::Gauge type => 'food', tooltip => "#stat_food"); |
976 | |
990 | |
977 | $vbox->add (my $exp = new CFPlus::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_exp"); |
991 | $vbox->add (my $exp = new CFPlus::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_exp"); |
|
|
992 | $vbox->add (my $prg = new CFPlus::UI::ExperienceProgress); |
|
|
993 | $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"); |
994 | $vbox->add (my $rng = new CFPlus::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_ranged"); |
979 | |
995 | |
980 | $GAUGES = { |
996 | $GAUGES = { |
|
|
997 | exp => $exp, prg => $prg, sklprg => $sklprg, |
981 | exp => $exp, win => $win, range => $rng, |
998 | win => $win, range => $rng, |
982 | food => $fg, mana => $mg, hp => $hg, grace => $gg |
999 | hp => $hg, mana => $mg, grace => $gg, food => $fg, |
983 | }; |
1000 | }; |
984 | |
1001 | |
985 | &set_gauge_window_fontsize; |
1002 | &set_gauge_window_fontsize; |
986 | |
1003 | |
987 | $win |
1004 | $win |
… | |
… | |
1188 | $r |
1205 | $r |
1189 | } |
1206 | } |
1190 | |
1207 | |
1191 | sub skill_window { |
1208 | sub skill_window { |
1192 | my $sw = new CFPlus::UI::ScrolledWindow (expand => 1); |
1209 | my $sw = new CFPlus::UI::ScrolledWindow (expand => 1); |
|
|
1210 | |
1193 | $sw->add ($STATWIDS->{skill_tbl} = new CFPlus::UI::Table expand => 1, col_expand => [0, 0, 1, 0, 0, 1]); |
1211 | $sw->add ($STATWIDS->{skill_tbl} = new CFPlus::UI::Table expand => 1, col_expand => [0, 0, 1, .1, 0, 0, 1, .1]); |
|
|
1212 | |
1194 | $sw |
1213 | $sw |
1195 | } |
1214 | } |
1196 | |
1215 | |
1197 | sub formsep($) { |
1216 | sub formsep($) { |
1198 | scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1 |
1217 | scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1 |
… | |
… | |
1610 | $sw1->add ($INV = new CFPlus::UI::Inventory); |
1629 | $sw1->add ($INV = new CFPlus::UI::Inventory); |
1611 | $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}}); |
1630 | $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}}); |
1612 | |
1631 | |
1613 | $hb->add (my $vb2 = new CFPlus::UI::VBox); |
1632 | $hb->add (my $vb2 = new CFPlus::UI::VBox); |
1614 | |
1633 | |
1615 | $vb2->add ($INV_RIGHT_HB = new CFPlus::UI::HBox); |
1634 | $vb2->add ($INVR_HB = new CFPlus::UI::HBox); |
1616 | |
1635 | |
1617 | $vb2->add (my $sw2 = new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1636 | $vb2->add (my $sw2 = new CFPlus::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1618 | $sw2->add ($INVR = new CFPlus::UI::Inventory); |
1637 | $sw2->add ($INVR = new CFPlus::UI::Inventory); |
1619 | |
1638 | |
1620 | # XXX: Call after $INVR = ... because set_opencont sets the items |
1639 | # XXX: Call after $INVR = ... because set_opencont sets the items |
… | |
… | |
1643 | } |
1662 | } |
1644 | |
1663 | |
1645 | sub add_license { |
1664 | sub add_license { |
1646 | my ($meta) = @_; |
1665 | my ($meta) = @_; |
1647 | |
1666 | |
1648 | $meta = $meta->{meta} |
1667 | $meta = $meta->{data} |
1649 | or return; |
1668 | or return; |
1650 | |
1669 | |
1651 | $meta->{license} || $meta->{author} || $meta->{source} |
1670 | $meta->{license} || $meta->{author} || $meta->{source} |
1652 | or return; |
1671 | or return; |
1653 | |
1672 | |
… | |
… | |
1707 | $ntb->add_tab ( |
1726 | $ntb->add_tab ( |
1708 | "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget, |
1727 | "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget, |
1709 | "Toggles the inventory window, where you can manage your loot (or treasures :). " |
1728 | "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." |
1729 | . "You can also hit the <b>Tab</b>-key to show/hide the Inventory." |
1711 | ); |
1730 | ); |
1712 | $ntb->add_tab (Pickup => autopickup_setup, |
1731 | $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."); |
1732 | "Configure autopickup settings, i.e. which items you will pick up automatically when walking (or running) over them."); |
1714 | |
1733 | |
1715 | $ntb->add_tab (Media => media_window, |
1734 | $ntb->add_tab (Media => media_window, |
1716 | "License, Author and Source info for media sent by the server."); |
1735 | "License, Author and Source info for media sent by the server."); |
1717 | |
1736 | |
… | |
… | |
1958 | |
1977 | |
1959 | $SDL_ACTIVE = 1; |
1978 | $SDL_ACTIVE = 1; |
1960 | $LAST_REFRESH = time - 0.01; |
1979 | $LAST_REFRESH = time - 0.01; |
1961 | |
1980 | |
1962 | CFPlus::OpenGL::init; |
1981 | CFPlus::OpenGL::init; |
|
|
1982 | CFPlus::Macro::init; |
1963 | |
1983 | |
1964 | $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
1984 | $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
1965 | |
1985 | |
1966 | $CFPlus::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d# |
1986 | $CFPlus::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d# |
1967 | |
1987 | |
1968 | ############################################################################# |
1988 | ############################################################################# |
1969 | |
1989 | |
1970 | if ($DEBUG_STATUS) { |
1990 | if ($DEBUG_STATUS) { |
1971 | CFPlus::UI::rescale_widgets $WIDTH / $old_w, $HEIGHT / $old_h; |
1991 | CFPlus::UI::rescale_widgets $WIDTH / $old_w, $HEIGHT / $old_h; |
1972 | } else { |
1992 | } else { |
1973 | # create the widgets |
1993 | # create/configure the widgets |
|
|
1994 | |
|
|
1995 | $CFPlus::UI::ROOT->connect (key_down => sub { |
|
|
1996 | my (undef, $ev) = @_; |
|
|
1997 | |
|
|
1998 | if (my @macros = CFPlus::Macro::find $ev) { |
|
|
1999 | CFPlus::Macro::execute $_ for @macros; |
|
|
2000 | |
|
|
2001 | return 1; |
|
|
2002 | } |
|
|
2003 | |
|
|
2004 | 0 |
|
|
2005 | }); |
1974 | |
2006 | |
1975 | $DEBUG_STATUS = new CFPlus::UI::Label |
2007 | $DEBUG_STATUS = new CFPlus::UI::Label |
1976 | padding => 0, |
2008 | padding => 0, |
1977 | z => 100, |
2009 | z => 100, |
1978 | force_x => "max", |
2010 | force_x => "max", |
… | |
… | |
2008 | $MESSAGE_WINDOW->activate_console ($preset) |
2040 | $MESSAGE_WINDOW->activate_console ($preset) |
2009 | if $MESSAGE_WINDOW; |
2041 | if $MESSAGE_WINDOW; |
2010 | }); |
2042 | }); |
2011 | $MAPWIDGET->show; |
2043 | $MAPWIDGET->show; |
2012 | $MAPWIDGET->grab_focus; |
2044 | $MAPWIDGET->grab_focus; |
|
|
2045 | |
|
|
2046 | $COMPLETER = new CFPlus::MapWidget::Command:: |
|
|
2047 | command => { }, |
|
|
2048 | tooltip => "#completer_help", |
|
|
2049 | ; |
2013 | |
2050 | |
2014 | $SETUP_DIALOG = new CFPlus::UI::Toplevel |
2051 | $SETUP_DIALOG = new CFPlus::UI::Toplevel |
2015 | title => "Setup", |
2052 | title => "Setup", |
2016 | name => "setup_dialog", |
2053 | name => "setup_dialog", |
2017 | x => 'center', |
2054 | x => 'center', |
… | |
… | |
2087 | }, |
2124 | }, |
2088 | ); |
2125 | ); |
2089 | |
2126 | |
2090 | $BUTTONBAR->show; |
2127 | $BUTTONBAR->show; |
2091 | $SETUP_DIALOG->show; |
2128 | $SETUP_DIALOG->show; |
|
|
2129 | $MESSAGE_WINDOW->show; |
2092 | } |
2130 | } |
2093 | |
2131 | |
2094 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
2132 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
2095 | } |
2133 | } |
2096 | |
2134 | |
… | |
… | |
2141 | delete $animate_object{$widget}; |
2179 | delete $animate_object{$widget}; |
2142 | } |
2180 | } |
2143 | |
2181 | |
2144 | %SDL_CB = ( |
2182 | %SDL_CB = ( |
2145 | CFPlus::SDL_QUIT => sub { |
2183 | CFPlus::SDL_QUIT => sub { |
2146 | exit; |
2184 | Event::unloop_all; |
2147 | }, |
2185 | }, |
2148 | CFPlus::SDL_VIDEORESIZE => sub { |
2186 | CFPlus::SDL_VIDEORESIZE => sub { |
2149 | }, |
2187 | }, |
2150 | CFPlus::SDL_VIDEOEXPOSE => sub { |
2188 | CFPlus::SDL_VIDEOEXPOSE => sub { |
2151 | CFPlus::UI::full_refresh; |
2189 | CFPlus::UI::full_refresh; |
… | |
… | |
2190 | CFPlus::DB::Server::run; |
2228 | CFPlus::DB::Server::run; |
2191 | |
2229 | |
2192 | CFPlus::UI::set_layout ($::CFG->{layout}); |
2230 | CFPlus::UI::set_layout ($::CFG->{layout}); |
2193 | |
2231 | |
2194 | my %DEF_CFG = ( |
2232 | my %DEF_CFG = ( |
2195 | sdl_mode => 0, |
2233 | sdl_mode => 0, |
2196 | fullscreen => 0, |
2234 | fullscreen => 0, |
2197 | fast => 0, |
2235 | fast => 0, |
2198 | opengl11 => 0, |
2236 | force_opengl11 => undef, |
|
|
2237 | texture_compression => 1, |
2199 | map_scale => 1, |
2238 | map_scale => 1, |
2200 | fow_enable => 1, |
2239 | fow_enable => 1, |
2201 | fow_intensity => 0, |
2240 | fow_intensity => 0, |
2202 | map_smoothing => 1, |
2241 | map_smoothing => 1, |
2203 | gui_fontsize => 1, |
2242 | gui_fontsize => 1, |
2204 | log_fontsize => 0.7, |
2243 | log_fontsize => 0.7, |
2205 | gauge_fontsize => 1, |
2244 | gauge_fontsize => 1, |
2206 | gauge_size => 0.35, |
2245 | gauge_size => 0.35, |
2207 | stat_fontsize => 0.7, |
2246 | stat_fontsize => 0.7, |
2208 | mapsize => 100, |
2247 | mapsize => 100, |
2209 | audio_enable => 1, |
2248 | audio_enable => 1, |
2210 | effects_enable => 1, |
2249 | effects_enable => 1, |
2211 | effects_volume => 1, |
2250 | effects_volume => 1, |
2212 | bgm_enable => 1, |
2251 | bgm_enable => 1, |
2213 | bgm_volume => 0.5, |
2252 | bgm_volume => 0.5, |
2214 | output_sync => 1, |
2253 | output_sync => 1, |
2215 | output_count => 1, |
2254 | output_count => 1, |
2216 | output_rate => "", |
2255 | output_rate => "", |
2217 | pickup => 0, |
2256 | pickup => 0, |
2218 | inv_sort => "mtime", |
2257 | inv_sort => "mtime", |
2219 | default => "profile", # default profile |
2258 | default => "profile", # default profile |
2220 | show_tips => 1, |
2259 | show_tips => 1, |
2221 | logview_max_par => 1000, |
2260 | logview_max_par => 1000, |
2222 | ); |
2261 | ); |
2223 | |
2262 | |
2224 | while (my ($k, $v) = each %DEF_CFG) { |
2263 | while (my ($k, $v) = each %DEF_CFG) { |
2225 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2264 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2226 | } |
2265 | } |
… | |
… | |
2283 | # } |
2322 | # } |
2284 | # my $t2 = Time::HiRes::time; |
2323 | # my $t2 = Time::HiRes::time; |
2285 | # warn $t2-$t1; |
2324 | # warn $t2-$t1; |
2286 | # } |
2325 | # } |
2287 | |
2326 | |
2288 | $startup_done->(); |
|
|
2289 | |
|
|
2290 | video_init; |
2327 | video_init; |
2291 | audio_init; |
2328 | audio_init; |
2292 | } |
2329 | } |
2293 | |
2330 | |
2294 | show_tip_of_the_day if $CFG->{show_tips}; |
2331 | show_tip_of_the_day if $CFG->{show_tips}; |
|
|
2332 | |
|
|
2333 | Event->idle (cb => sub { |
|
|
2334 | $_[0]->w->cancel; |
|
|
2335 | $startup_done->(); |
|
|
2336 | }); |
2295 | |
2337 | |
2296 | Event::loop; |
2338 | Event::loop; |
2297 | |
2339 | |
2298 | #video_shutdown; |
2340 | #video_shutdown; |
2299 | #audio_shutdown; |
2341 | #audio_shutdown; |