… | |
… | |
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; |
… | |
… | |
180 | sub debug { |
182 | sub debug { |
181 | $DEBUG_STATUS->set_text ($_[0]); |
183 | $DEBUG_STATUS->set_text ($_[0]); |
182 | } |
184 | } |
183 | |
185 | |
184 | sub message { |
186 | sub message { |
185 | my ($para) = @_; |
|
|
186 | $MESSAGE_WINDOW->message ($para); |
187 | $MESSAGE_WINDOW->message (@_); |
187 | } |
188 | } |
188 | |
189 | |
189 | ############################################################################# |
190 | ############################################################################# |
190 | #TODO: maybe move into own audio module... |
191 | #TODO: maybe move into own audio module... |
191 | |
192 | |
… | |
… | |
228 | $channel->set_position_r ($dx, $dy, 20); |
229 | $channel->set_position_r ($dx, $dy, 20); |
229 | $chunk->play ($channel); |
230 | $chunk->play ($channel); |
230 | } |
231 | } |
231 | } else { |
232 | } else { |
232 | # sound_meta not set means data is in flight either way |
233 | # sound_meta not set means data is in flight either way |
233 | my $meta = $CONN->{sound_meta}{$face} |
234 | my $meta = $CONN->{face}[$face] |
234 | or return; |
235 | or return; |
235 | |
236 | |
|
|
237 | $meta->{data} |
|
|
238 | or return; |
|
|
239 | |
236 | # if its a jingle, play it as ambient music |
240 | # if its a jingle, play it as ambient music |
237 | if ($meta->{meta}{jingle}) { |
241 | if ($meta->{data}{jingle}) { |
238 | 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 |
239 | push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue |
243 | push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue |
240 | &audio_music_push ($face); |
244 | &audio_music_push ($face); |
241 | } |
245 | } |
242 | } else { |
246 | } else { |
243 | # fetch from database |
247 | # fetch from database |
244 | CFPlus::DB::get res_data => $meta->{name}, sub { |
248 | CFPlus::DB::get res_data => $meta->{name}, sub { |
245 | my $rwops = new CFPlus::RW $_[0]; |
249 | my $rwops = new CFPlus::RW $_[0]; |
246 | my $chunk = new CFPlus::MixChunk $rwops |
250 | my $chunk = new CFPlus::MixChunk $rwops |
247 | 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; |
248 | $chunk->volume (($meta->{meta}{volume} || 1) * 128); |
252 | $chunk->volume (($meta->{data}{volume} || 1) * 128); |
249 | $AUDIO_CHUNK{$face} = $chunk; |
253 | $AUDIO_CHUNK{$face} = $chunk; |
250 | |
254 | |
251 | audio_sound_push ($face); |
255 | audio_sound_push ($face); |
252 | }; |
256 | }; |
253 | } |
257 | } |
… | |
… | |
271 | sub audio_music_set_meta { |
275 | sub audio_music_set_meta { |
272 | my ($meta) = @_; |
276 | my ($meta) = @_; |
273 | |
277 | |
274 | $MUSIC_PLAYING_META = $meta; |
278 | $MUSIC_PLAYING_META = $meta; |
275 | $MUSIC_PLAYING_WIDGET->set_markup ( |
279 | $MUSIC_PLAYING_WIDGET->set_markup ( |
276 | "<b>Name</b>: " . (CFPlus::asxml $meta->{meta}{name}) . "\n" |
280 | "<b>Name</b>: " . (CFPlus::asxml $meta->{data}{name}) . "\n" |
277 | . "<b>Author</b>: " . (CFPlus::asxml $meta->{meta}{author}) . "\n" |
281 | . "<b>Author</b>: " . (CFPlus::asxml $meta->{data}{author}) . "\n" |
278 | . "<b>Source</b>: " . (CFPlus::asxml $meta->{meta}{source}) . "\n" |
282 | . "<b>Source</b>: " . (CFPlus::asxml $meta->{data}{source}) . "\n" |
279 | . "<b>License</b>: " . (CFPlus::asxml $meta->{meta}{license}) |
283 | . "<b>License</b>: " . (CFPlus::asxml $meta->{data}{license}) |
280 | ); |
284 | ); |
281 | } |
285 | } |
282 | |
286 | |
283 | sub audio_music_update_volume { |
287 | sub audio_music_update_volume { |
284 | return unless $MUSIC_PLAYING_META; |
288 | return unless $MUSIC_PLAYING_META; |
285 | my $volume = $MUSIC_PLAYING_META->{meta}{volume} || 1; |
289 | my $volume = $MUSIC_PLAYING_META->{data}{volume} || 1; |
286 | my $base = $MUSIC_PLAYING_META->{meta}{jingle} ? 1 : $CFG->{bgm_volume}; |
290 | my $base = $MUSIC_PLAYING_META->{data}{jingle} ? 1 : $CFG->{bgm_volume}; |
287 | CFPlus::MixMusic::volume $base * $volume * 128; |
291 | CFPlus::MixMusic::volume $base * $volume * 128; |
288 | } |
292 | } |
289 | |
293 | |
290 | sub audio_music_start { |
294 | sub audio_music_start { |
291 | my $meta = $MUSIC_PLAYING_META; |
295 | my $meta = $MUSIC_PLAYING_META; |
… | |
… | |
310 | |
314 | |
311 | my $NOW = time; |
315 | my $NOW = time; |
312 | |
316 | |
313 | if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) { |
317 | if ($MUSIC_PLAYING_META->{stop_time} > $NOW - $MUSIC_RESUME) { |
314 | my $pos = $MUSIC_PLAYING_META->{stop_pos}; |
318 | my $pos = $MUSIC_PLAYING_META->{stop_pos}; |
315 | $MUSIC_PLAYER->fade_in_pos (0, 1000, $pos); |
319 | $MUSIC_PLAYER->fade_in_pos (0, 700, $pos); |
316 | $MUSIC_START = time - $pos; |
320 | $MUSIC_START = time - $pos; |
317 | } else { |
321 | } else { |
318 | $MUSIC_PLAYER->play (0); |
322 | $MUSIC_PLAYER->play (0); |
319 | $MUSIC_START = time; |
323 | $MUSIC_START = time; |
320 | } |
324 | } |
… | |
… | |
334 | $fade_out = 333; |
338 | $fade_out = 333; |
335 | } else { |
339 | } else { |
336 | return unless $CFG->{bgm_enable}; |
340 | return unless $CFG->{bgm_enable}; |
337 | |
341 | |
338 | my @have = |
342 | my @have = |
339 | grep $_, |
343 | grep $_ && $_->{data}, |
340 | map $CONN->{music_meta}{$_}, |
344 | map $CONN->{face}[$_], |
341 | @$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; |
342 | |
349 | |
343 | @MUSIC_HAVE = @have |
350 | @MUSIC_HAVE = @have |
344 | if @have; |
351 | if @have; |
345 | |
352 | |
346 | # default MUSIC_HAVE == MUSIC_DEFAULT |
353 | # default MUSIC_HAVE == MUSIC_DEFAULT |
347 | @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; |
348 | $fade_out = 1000; |
355 | $fade_out = 700; |
349 | } |
356 | } |
350 | |
357 | |
351 | # if the currently playing song is acceptable, let it continue |
358 | # if the currently playing song is acceptable, let it continue |
352 | return if grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE; |
359 | return if grep $MUSIC_PLAYING_META == $_, @MUSIC_HAVE; |
353 | |
360 | |
… | |
… | |
362 | @MUSIC_HAVE = sort { $a->{stop_time} <=> $b->{stop_time} } @MUSIC_HAVE; |
369 | @MUSIC_HAVE = sort { $a->{stop_time} <=> $b->{stop_time} } @MUSIC_HAVE; |
363 | |
370 | |
364 | # if the most recently-played piece played very recently, |
371 | # if the most recently-played piece played very recently, |
365 | # resume it, else choose the oldest piece for rotation. |
372 | # resume it, else choose the oldest piece for rotation. |
366 | audio_music_set_meta |
373 | audio_music_set_meta |
367 | $MUSIC_HAVE[-1]{stop_time} > $NOW - $MUSIC_RESUME |
374 | $MUSIC_HAVE[-1]{stop_pos} && $MUSIC_HAVE[-1]{stop_time} > $NOW - $MUSIC_RESUME |
368 | ? $MUSIC_HAVE[-1] |
375 | ? $MUSIC_HAVE[-1] |
369 | : $MUSIC_HAVE[0]; |
376 | : $MUSIC_HAVE[0]; |
370 | |
377 | |
371 | audio_music_start; |
378 | audio_music_start; |
372 | } |
379 | } |
… | |
… | |
378 | $MUSIC_WANT = $songs; |
385 | $MUSIC_WANT = $songs; |
379 | audio_music_push; |
386 | audio_music_push; |
380 | } |
387 | } |
381 | |
388 | |
382 | sub audio_music_finished { |
389 | sub audio_music_finished { |
|
|
390 | if ($MUSIC_PLAYING_META) { |
|
|
391 | $MUSIC_PLAYING_META->{stop_time} = time; |
|
|
392 | } |
|
|
393 | |
383 | # we compress multiple jingles of the same type |
394 | # we compress multiple jingles of the same type |
384 | shift @MUSIC_JINGLE |
395 | shift @MUSIC_JINGLE |
385 | while @MUSIC_JINGLE && $MUSIC_PLAYING_META == $MUSIC_JINGLE[0]; |
396 | while @MUSIC_JINGLE && $MUSIC_PLAYING_META == $MUSIC_JINGLE[0]; |
386 | |
397 | |
387 | $MUSIC_PLAYING_WIDGET->clear; |
398 | $MUSIC_PLAYING_WIDGET->clear; |
… | |
… | |
769 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
780 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
770 | ); |
781 | ); |
771 | |
782 | |
772 | $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"); |
773 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
784 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
774 | state => $CFG->{opengl11}, |
785 | state => $CFG->{force_opengl11}, |
775 | 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 " |
776 | . "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 " |
777 | . "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. " |
778 | . "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, " |
779 | . "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 " |
780 | . "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>", |
781 | 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 } |
782 | ); |
803 | ); |
783 | |
804 | |
784 | $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"); |
785 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
806 | $table->add_at (1, $row++, new CFPlus::UI::CheckBox |
786 | state => $CFG->{fast}, |
807 | state => $CFG->{fast}, |
… | |
… | |
908 | expand => 1, state => $CFG->{bgm_enable}, |
929 | expand => 1, state => $CFG->{bgm_enable}, |
909 | 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.", |
910 | on_changed => sub { |
931 | on_changed => sub { |
911 | $CFG->{bgm_enable} = $_[1]; |
932 | $CFG->{bgm_enable} = $_[1]; |
912 | $CONN->update_fx_want if $CONN; |
933 | $CONN->update_fx_want if $CONN; |
|
|
934 | audio_music_push; |
913 | 0 |
935 | 0 |
914 | } |
936 | } |
915 | ); |
937 | ); |
916 | $table->add_at (2, $row++, new CFPlus::UI::Slider |
938 | $table->add_at (2, $row++, new CFPlus::UI::Slider |
917 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], |
939 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], |
… | |
… | |
970 | $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"); |
971 | $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"); |
972 | $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"); |
973 | $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"); |
974 | |
996 | |
975 | $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); |
976 | $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"); |
977 | |
1001 | |
978 | $GAUGES = { |
1002 | $GAUGES = { |
|
|
1003 | exp => $exp, prg => $prg, sklprg => $sklprg, |
979 | exp => $exp, win => $win, range => $rng, |
1004 | win => $win, range => $rng, |
980 | food => $fg, mana => $mg, hp => $hg, grace => $gg |
1005 | hp => $hg, mana => $mg, grace => $gg, food => $fg, |
981 | }; |
1006 | }; |
982 | |
1007 | |
983 | &set_gauge_window_fontsize; |
1008 | &set_gauge_window_fontsize; |
984 | |
1009 | |
985 | $win |
1010 | $win |
… | |
… | |
1186 | $r |
1211 | $r |
1187 | } |
1212 | } |
1188 | |
1213 | |
1189 | sub skill_window { |
1214 | sub skill_window { |
1190 | my $sw = new CFPlus::UI::ScrolledWindow (expand => 1); |
1215 | my $sw = new CFPlus::UI::ScrolledWindow (expand => 1); |
|
|
1216 | |
1191 | $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 | |
1192 | $sw |
1219 | $sw |
1193 | } |
1220 | } |
1194 | |
1221 | |
1195 | sub formsep($) { |
1222 | sub formsep($) { |
1196 | scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1 |
1223 | scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1 |
… | |
… | |
1641 | } |
1668 | } |
1642 | |
1669 | |
1643 | sub add_license { |
1670 | sub add_license { |
1644 | my ($meta) = @_; |
1671 | my ($meta) = @_; |
1645 | |
1672 | |
1646 | $meta = $meta->{meta} |
1673 | $meta = $meta->{data} |
1647 | or return; |
1674 | or return; |
1648 | |
1675 | |
1649 | $meta->{license} || $meta->{author} || $meta->{source} |
1676 | $meta->{license} || $meta->{author} || $meta->{source} |
1650 | or return; |
1677 | or return; |
1651 | |
1678 | |
… | |
… | |
1705 | $ntb->add_tab ( |
1732 | $ntb->add_tab ( |
1706 | "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget, |
1733 | "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget, |
1707 | "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 :). " |
1708 | . "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." |
1709 | ); |
1736 | ); |
1710 | $ntb->add_tab (Pickup => autopickup_setup, |
1737 | $ntb->add_tab (Pickup => $PICKUP_PAGE = autopickup_setup, |
1711 | "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."); |
1712 | |
1739 | |
1713 | $ntb->add_tab (Media => media_window, |
1740 | $ntb->add_tab (Media => media_window, |
1714 | "License, Author and Source info for media sent by the server."); |
1741 | "License, Author and Source info for media sent by the server."); |
1715 | |
1742 | |
… | |
… | |
1956 | |
1983 | |
1957 | $SDL_ACTIVE = 1; |
1984 | $SDL_ACTIVE = 1; |
1958 | $LAST_REFRESH = time - 0.01; |
1985 | $LAST_REFRESH = time - 0.01; |
1959 | |
1986 | |
1960 | CFPlus::OpenGL::init; |
1987 | CFPlus::OpenGL::init; |
|
|
1988 | CFPlus::Macro::init; |
1961 | |
1989 | |
1962 | $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
1990 | $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
1963 | |
1991 | |
1964 | $CFPlus::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d# |
1992 | $CFPlus::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d# |
1965 | |
1993 | |
1966 | ############################################################################# |
1994 | ############################################################################# |
1967 | |
1995 | |
1968 | if ($DEBUG_STATUS) { |
1996 | if ($DEBUG_STATUS) { |
1969 | CFPlus::UI::rescale_widgets $WIDTH / $old_w, $HEIGHT / $old_h; |
1997 | CFPlus::UI::rescale_widgets $WIDTH / $old_w, $HEIGHT / $old_h; |
1970 | } else { |
1998 | } else { |
1971 | # 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 | }); |
1972 | |
2012 | |
1973 | $DEBUG_STATUS = new CFPlus::UI::Label |
2013 | $DEBUG_STATUS = new CFPlus::UI::Label |
1974 | padding => 0, |
2014 | padding => 0, |
1975 | z => 100, |
2015 | z => 100, |
1976 | force_x => "max", |
2016 | force_x => "max", |
… | |
… | |
2006 | $MESSAGE_WINDOW->activate_console ($preset) |
2046 | $MESSAGE_WINDOW->activate_console ($preset) |
2007 | if $MESSAGE_WINDOW; |
2047 | if $MESSAGE_WINDOW; |
2008 | }); |
2048 | }); |
2009 | $MAPWIDGET->show; |
2049 | $MAPWIDGET->show; |
2010 | $MAPWIDGET->grab_focus; |
2050 | $MAPWIDGET->grab_focus; |
|
|
2051 | |
|
|
2052 | $COMPLETER = new CFPlus::MapWidget::Command:: |
|
|
2053 | command => { }, |
|
|
2054 | tooltip => "#completer_help", |
|
|
2055 | ; |
2011 | |
2056 | |
2012 | $SETUP_DIALOG = new CFPlus::UI::Toplevel |
2057 | $SETUP_DIALOG = new CFPlus::UI::Toplevel |
2013 | title => "Setup", |
2058 | title => "Setup", |
2014 | name => "setup_dialog", |
2059 | name => "setup_dialog", |
2015 | x => 'center', |
2060 | x => 'center', |
… | |
… | |
2140 | delete $animate_object{$widget}; |
2185 | delete $animate_object{$widget}; |
2141 | } |
2186 | } |
2142 | |
2187 | |
2143 | %SDL_CB = ( |
2188 | %SDL_CB = ( |
2144 | CFPlus::SDL_QUIT => sub { |
2189 | CFPlus::SDL_QUIT => sub { |
2145 | exit; |
2190 | Event::unloop_all; |
2146 | }, |
2191 | }, |
2147 | CFPlus::SDL_VIDEORESIZE => sub { |
2192 | CFPlus::SDL_VIDEORESIZE => sub { |
2148 | }, |
2193 | }, |
2149 | CFPlus::SDL_VIDEOEXPOSE => sub { |
2194 | CFPlus::SDL_VIDEOEXPOSE => sub { |
2150 | CFPlus::UI::full_refresh; |
2195 | CFPlus::UI::full_refresh; |
… | |
… | |
2189 | CFPlus::DB::Server::run; |
2234 | CFPlus::DB::Server::run; |
2190 | |
2235 | |
2191 | CFPlus::UI::set_layout ($::CFG->{layout}); |
2236 | CFPlus::UI::set_layout ($::CFG->{layout}); |
2192 | |
2237 | |
2193 | my %DEF_CFG = ( |
2238 | my %DEF_CFG = ( |
2194 | sdl_mode => 0, |
2239 | sdl_mode => 0, |
2195 | fullscreen => 0, |
2240 | fullscreen => 0, |
2196 | fast => 0, |
2241 | fast => 0, |
2197 | opengl11 => 0, |
2242 | force_opengl11 => undef, |
|
|
2243 | texture_compression => 1, |
2198 | map_scale => 1, |
2244 | map_scale => 1, |
2199 | fow_enable => 1, |
2245 | fow_enable => 1, |
2200 | fow_intensity => 0, |
2246 | fow_intensity => 0, |
2201 | map_smoothing => 1, |
2247 | map_smoothing => 1, |
2202 | gui_fontsize => 1, |
2248 | gui_fontsize => 1, |
2203 | log_fontsize => 0.7, |
2249 | log_fontsize => 0.7, |
2204 | gauge_fontsize => 1, |
2250 | gauge_fontsize => 1, |
2205 | gauge_size => 0.35, |
2251 | gauge_size => 0.35, |
2206 | stat_fontsize => 0.7, |
2252 | stat_fontsize => 0.7, |
2207 | mapsize => 100, |
2253 | mapsize => 100, |
2208 | audio_enable => 1, |
2254 | audio_enable => 1, |
2209 | effects_enable => 1, |
2255 | effects_enable => 1, |
2210 | effects_volume => 1, |
2256 | effects_volume => 1, |
2211 | bgm_enable => 1, |
2257 | bgm_enable => 1, |
2212 | bgm_volume => 0.5, |
2258 | bgm_volume => 0.5, |
2213 | output_sync => 1, |
2259 | output_sync => 1, |
2214 | output_count => 1, |
2260 | output_count => 1, |
2215 | output_rate => "", |
2261 | output_rate => "", |
2216 | pickup => 0, |
2262 | pickup => 0, |
2217 | inv_sort => "mtime", |
2263 | inv_sort => "mtime", |
2218 | default => "profile", # default profile |
2264 | default => "profile", # default profile |
2219 | show_tips => 1, |
2265 | show_tips => 1, |
2220 | logview_max_par => 1000, |
2266 | logview_max_par => 1000, |
2221 | ); |
2267 | ); |
2222 | |
2268 | |
2223 | while (my ($k, $v) = each %DEF_CFG) { |
2269 | while (my ($k, $v) = each %DEF_CFG) { |
2224 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2270 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2225 | } |
2271 | } |
… | |
… | |
2282 | # } |
2328 | # } |
2283 | # my $t2 = Time::HiRes::time; |
2329 | # my $t2 = Time::HiRes::time; |
2284 | # warn $t2-$t1; |
2330 | # warn $t2-$t1; |
2285 | # } |
2331 | # } |
2286 | |
2332 | |
2287 | $startup_done->(); |
|
|
2288 | |
|
|
2289 | video_init; |
2333 | video_init; |
2290 | audio_init; |
2334 | audio_init; |
2291 | } |
2335 | } |
2292 | |
2336 | |
2293 | show_tip_of_the_day if $CFG->{show_tips}; |
2337 | show_tip_of_the_day if $CFG->{show_tips}; |
|
|
2338 | |
|
|
2339 | Event->idle (cb => sub { |
|
|
2340 | $_[0]->w->cancel; |
|
|
2341 | $startup_done->(); |
|
|
2342 | }); |
2294 | |
2343 | |
2295 | Event::loop; |
2344 | Event::loop; |
2296 | |
2345 | |
2297 | #video_shutdown; |
2346 | #video_shutdown; |
2298 | #audio_shutdown; |
2347 | #audio_shutdown; |