… | |
… | |
56 | |
56 | |
57 | if ($^O eq "MSWin32") { |
57 | if ($^O eq "MSWin32") { |
58 | # pango is relocatable on win32 |
58 | # pango is relocatable on win32 |
59 | } else { |
59 | } else { |
60 | # OS X |
60 | # OS X |
61 | $ENV{FONTCONFIG_FILE} = "$root/fonts.conf"; # no effect??!?! |
|
|
62 | $ENV{FONTCONFIG_DIR} = $root; # no effect??!?! |
|
|
63 | $ENV{PANGO_RC_FILE} = "$root/pango.rc"; |
61 | $ENV{PANGO_RC_FILE} = "$root/pango.rc"; |
64 | $ENV{DYLD_LIBRARY_PATH} = $root; |
62 | $ENV{DYLD_LIBRARY_PATH} = $root; |
65 | chdir $root; # for pango modules, maybe other things |
63 | chdir $root; # for pango modules, maybe other things |
66 | } |
64 | } |
67 | |
65 | |
68 | unshift @INC, $root; |
66 | unshift @INC, $root; |
69 | } |
67 | } |
70 | } |
68 | } |
71 | |
69 | |
72 | # prepend private library directory |
70 | # prepend private library directory and prepare env |
73 | BEGIN { |
71 | BEGIN { |
74 | for (grep !ref, @INC) { |
72 | for (grep !ref, @INC) { |
75 | my $path = "$_/Deliantra/Client/private"; |
73 | my $path = "$_/Deliantra/Client/private"; |
76 | if (-d $path) { |
74 | if (-d $path) { |
77 | unshift @INC, $path; |
75 | unshift @INC, $path; |
… | |
… | |
205 | our $FLOORBOX; |
203 | our $FLOORBOX; |
206 | our $GAUGES; |
204 | our $GAUGES; |
207 | our $STATWIDS; |
205 | our $STATWIDS; |
208 | |
206 | |
209 | our $SDL_ACTIVE; |
207 | our $SDL_ACTIVE; |
210 | our %SDL_CB; |
208 | our @SDL_CB; |
211 | |
209 | |
212 | our $ALT_ENTER_MESSAGE; |
210 | our $ALT_ENTER_MESSAGE; |
213 | our $STATUSBOX; |
211 | our $STATUSBOX; |
214 | our $MODBOX; |
212 | our $MODBOX; |
215 | our $DEBUG_STATUS; |
213 | our $DEBUG_STATUS; |
… | |
… | |
550 | $MUSIC_WANT = []; |
548 | $MUSIC_WANT = []; |
551 | @MUSIC_JINGLE = (); |
549 | @MUSIC_JINGLE = (); |
552 | %AUDIO_PLAY = (); |
550 | %AUDIO_PLAY = (); |
553 | %AUDIO_CHUNK = (); |
551 | %AUDIO_CHUNK = (); |
554 | |
552 | |
|
|
553 | DC::MixMusic::halt; |
|
|
554 | DC::Mix_AllocateChannels 0; |
555 | DC::Mix_CloseAudio if $SDL_MIXER; |
555 | DC::Mix_CloseAudio if $SDL_MIXER; |
556 | undef $SDL_MIXER; |
556 | undef $SDL_MIXER; |
557 | } |
557 | } |
558 | |
558 | |
559 | ############################################################################# |
559 | ############################################################################# |
… | |
… | |
818 | |
818 | |
819 | on_connect => sub { |
819 | on_connect => sub { |
820 | if ($_[0]) { |
820 | if ($_[0]) { |
821 | DC::lowdelay fileno $CONN->{fh}; |
821 | DC::lowdelay fileno $CONN->{fh}; |
822 | |
822 | |
823 | status "login successful"; |
823 | status "successfully connected to the server"; |
824 | } else { |
824 | } else { |
825 | undef $CONN; |
825 | undef $CONN; |
826 | status "unable to connect: $!"; |
826 | status "unable to connect: $!"; |
827 | stop_game(); |
827 | stop_game(); |
828 | } |
828 | } |
… | |
… | |
843 | # hack to make SURE we find the IP address all right |
843 | # hack to make SURE we find the IP address all right |
844 | # can be removed once AnyEvent::DNS is proven stable. |
844 | # can be removed once AnyEvent::DNS is proven stable. |
845 | if ($host eq "gameserver.deliantra.net") { |
845 | if ($host eq "gameserver.deliantra.net") { |
846 | AnyEvent::DNS::a "dnstest.deliantra.net", sub { |
846 | AnyEvent::DNS::a "dnstest.deliantra.net", sub { |
847 | if ($_[0] ne "80.101.114.108") { # Perl |
847 | if ($_[0] ne "80.101.114.108") { # Perl |
|
|
848 | status "dns failure, trying differently"; |
|
|
849 | $host = eval { Socket::inet_ntoa Socket::inet_aton "gameserver.deliantra.net" }; |
|
|
850 | unless (defined $host) { |
848 | status "dns failure, using hardcoded address"; |
851 | status "dns failure, using hardcoded address"; |
849 | $host = "129.13.162.95"; |
852 | $host = "129.13.162.95"; |
|
|
853 | } |
850 | } |
854 | } |
851 | |
855 | |
852 | dc_connect $host, $port; |
856 | dc_connect $host, $port; |
853 | }; |
857 | }; |
854 | } else { |
858 | } else { |
… | |
… | |
1636 | ); |
1640 | ); |
1637 | |
1641 | |
1638 | $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username"); |
1642 | $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username"); |
1639 | $table->add_at (1, 4, new DC::UI::Entry |
1643 | $table->add_at (1, 4, new DC::UI::Entry |
1640 | text => $CFG->{profile}{default}{user}, |
1644 | text => $CFG->{profile}{default}{user}, |
1641 | tooltip => "The name of your character on the server.", |
1645 | tooltip => "The name of your character on the server. The name is case-sensitive!", |
1642 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 } |
1646 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 } |
1643 | ); |
1647 | ); |
1644 | |
1648 | |
1645 | $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password"); |
1649 | $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password"); |
1646 | $table->add_at (1, 5, new DC::UI::Entry |
1650 | $table->add_at (1, 5, new DC::UI::Entry |
… | |
… | |
1809 | col_expand => [0, 1, 0, 1], |
1813 | col_expand => [0, 1, 0, 1], |
1810 | ); |
1814 | ); |
1811 | |
1815 | |
1812 | for ( |
1816 | for ( |
1813 | ["General", 0, 0, |
1817 | ["General", 0, 0, |
1814 | ["Enable autopickup" => PICKUP_NEWMODE, \$PICKUP_ENABLE], |
|
|
1815 | ["Inhibit autopickup" => PICKUP_INHIBIT], |
1818 | # ["Inhibit autopickup" => PICKUP_INHIBIT], |
1816 | ["Stop before pickup" => PICKUP_STOP], |
1819 | ["Stop before pickup" => PICKUP_STOP], |
1817 | ["Debug autopickup" => PICKUP_DEBUG], |
1820 | ["Debug autopickup" => PICKUP_DEBUG], |
1818 | ], |
1821 | ], |
1819 | ["Weapons", 0, 6, |
1822 | ["Weapons", 0, 6, |
1820 | ["All weapons" => PICKUP_ALLWEAPON], |
1823 | ["All weapons" => PICKUP_ALLWEAPON], |
… | |
… | |
1868 | $::CFG->{pickup} |= $mask; |
1871 | $::CFG->{pickup} |= $mask; |
1869 | } else { |
1872 | } else { |
1870 | $::CFG->{pickup} &= ~$mask; |
1873 | $::CFG->{pickup} &= ~$mask; |
1871 | } |
1874 | } |
1872 | |
1875 | |
1873 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1876 | $::CONN->send_pickup ($::CFG->{pickup}) |
1874 | if defined $::CONN; |
1877 | if defined $::CONN; |
1875 | |
1878 | |
1876 | 0 |
1879 | 0 |
1877 | }); |
1880 | }); |
1878 | |
1881 | |
… | |
… | |
1895 | }); |
1898 | }); |
1896 | |
1899 | |
1897 | $table->add_at (3, 18, new DC::UI::Button |
1900 | $table->add_at (3, 18, new DC::UI::Button |
1898 | text => "set", |
1901 | text => "set", |
1899 | on_activate => sub { |
1902 | on_activate => sub { |
1900 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1903 | $::CONN->send_pickup ($::CFG->{pickup}) |
1901 | if defined $::CONN; |
1904 | if defined $::CONN; |
1902 | 0 |
1905 | 0 |
1903 | }); |
1906 | }); |
1904 | |
1907 | |
1905 | $r |
1908 | $r |
… | |
… | |
2068 | |
2071 | |
2069 | sub keyboard_setup { |
2072 | sub keyboard_setup { |
2070 | DC::Macro::keyboard_setup |
2073 | DC::Macro::keyboard_setup |
2071 | } |
2074 | } |
2072 | |
2075 | |
2073 | sub help_window { |
2076 | sub make_help_window { |
2074 | my $win = new DC::UI::Toplevel |
2077 | my $win = new DC::UI::Toplevel |
2075 | x => 'center', |
2078 | x => 'center', |
2076 | y => 'center', |
2079 | y => 'center', |
2077 | z => 4, |
2080 | z => 4, |
2078 | name => 'doc_browser', |
2081 | name => 'doc_browser', |
… | |
… | |
2167 | |
2170 | |
2168 | $load_node->((DC::Pod::find @path)[0]); |
2171 | $load_node->((DC::Pod::find @path)[0]); |
2169 | $win->show; |
2172 | $win->show; |
2170 | }; |
2173 | }; |
2171 | |
2174 | |
2172 | $win |
2175 | $HELP_WINDOW = $win; |
2173 | } |
2176 | } |
2174 | |
2177 | |
2175 | sub open_quit_dialog { |
2178 | sub open_quit_dialog { |
2176 | unless ($QUIT_DIALOG) { |
2179 | unless ($QUIT_DIALOG) { |
2177 | $QUIT_DIALOG = new DC::UI::Toplevel |
2180 | $QUIT_DIALOG = new DC::UI::Toplevel |
… | |
… | |
2210 | |
2213 | |
2211 | $QUIT_DIALOG->show; |
2214 | $QUIT_DIALOG->show; |
2212 | $QUIT_DIALOG->grab_focus; |
2215 | $QUIT_DIALOG->grab_focus; |
2213 | } |
2216 | } |
2214 | |
2217 | |
2215 | sub make_menuframe { |
2218 | sub make_menubar { |
2216 | $MENUFRAME = new DC::UI::Toplevel |
2219 | $MENUFRAME = new DC::UI::Toplevel |
2217 | border => 0, |
2220 | border => 0, |
2218 | force_x => 0, |
2221 | force_x => 0, |
2219 | force_y => 0, |
2222 | force_y => 0, |
2220 | force_w => $::WIDTH, |
2223 | force_w => $::WIDTH, |
… | |
… | |
2230 | # tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
2233 | # tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
2231 | |
2234 | |
2232 | make_playerbook; |
2235 | make_playerbook; |
2233 | |
2236 | |
2234 | $MENUPOPUP = DC::UI::Menu->new (items => [ |
2237 | $MENUPOPUP = DC::UI::Menu->new (items => [ |
2235 | ["Setup…" , sub { $SETUP_DIALOG->toggle_visibility}], |
2238 | ["Setup…\tF9" , sub { $SETUP_DIALOG->toggle_visibility }], |
2236 | ["Playerbook…\tTab", sub { $PL_WINDOW ->toggle_visibility}], |
2239 | ["Playerbook…\tTab" , sub { $PL_WINDOW ->toggle_visibility }], |
|
|
2240 | ["…Statistics\tF2" , sub { toggle_player_page ($::STATS_PAGE) }], |
|
|
2241 | ["…Skills\tF3" , sub { toggle_player_page ($::SKILL_PAGE) }], |
|
|
2242 | ["…Spells\tF4" , sub { toggle_player_page ($::SPELL_PAGE) }], |
|
|
2243 | ["…Inventory\tF5" , sub { toggle_player_page ($::INVENTORY_PAGE) }], |
2237 | ["Help Browser…" , sub { $HELP_WINDOW ->toggle_visibility}], |
2244 | ["Help Browser…\tF1" , sub { $HELP_WINDOW ->toggle_visibility }], |
2238 | ["Quit…" , sub { |
2245 | ["Quit…" , sub { |
2239 | if ($CONN) { |
2246 | if ($CONN) { |
2240 | open_quit_dialog; |
2247 | open_quit_dialog; |
2241 | } else { |
2248 | } else { |
2242 | EV::unloop EV::UNLOOP_ALL; |
2249 | EV::unloop EV::UNLOOP_ALL; |
2243 | } |
2250 | } |
2244 | }], |
2251 | }], |
2245 | ]); |
2252 | ]); |
2246 | |
2253 | |
2247 | $BUTTONBAR->add (new DC::UI::Button text => "Menu…", |
2254 | $BUTTONBAR->add (new DC::UI::Button text => "Menu…", |
2248 | tooltip => "Shows the main menu", |
2255 | tooltip => "Shows the main menu", |
2249 | on_button_down => sub { $MENUPOPUP->popup ($_[1]) }, |
2256 | on_button_down => sub { |
|
|
2257 | my ($self, $ev) = @_; |
|
|
2258 | local $ev->{x} = 0; |
|
|
2259 | local $ev->{y} = 0; |
|
|
2260 | $MENUPOPUP->popup ($ev); |
|
|
2261 | }, |
2250 | ); |
2262 | ); |
2251 | |
2263 | |
2252 | $MENUBAR->add ($GAUGES->{prg} = new DC::UI::ExperienceProgress |
2264 | $MENUBAR->add ($GAUGES->{exp} = new DC::UI::ExperienceProgress |
2253 | c_rescale => 1, |
|
|
2254 | padding_x => 6, |
2265 | padding_x => 6, |
2255 | padding_y => 3, |
2266 | padding_y => 3, |
2256 | force_w => $::WIDTH * 0.1, |
|
|
2257 | tooltip => "This progress bar shows your progress towards the next character level.", |
2267 | tooltip => "This progress bar shows your overall experience and your progress towards the next character level.", |
|
|
2268 | template => " Exp: 888,888,888,888 (lvl 188) ", |
2258 | ); |
2269 | ); |
2259 | $MENUBAR->add ($GAUGES->{exp} = new DC::UI::Label |
2270 | |
2260 | align => 1, can_hover => 1, can_events => 1, |
2271 | $MENUBAR->add ($PICKUP_ENABLE = new DC::UI::CheckBox # checkbox bad, button better? |
2261 | text => "Total Experience", |
2272 | tooltip => "Automatic Pickup Enable - when this checkbox is enabled, then your character " |
2262 | tooltip => "#stat_exp", |
2273 | . "will automatically pick up items as defined by your item pickup settings " |
2263 | fontsize => 0.8, |
2274 | . "in the playerbook. Often (e.g. in apartments) you want to temporarily " |
|
|
2275 | . "disable autopickup by disabling this checkbox.", |
|
|
2276 | state => $CFG->{pickup} & PICKUP_INHIBIT ? 0 : 1, |
|
|
2277 | on_changed => sub { |
|
|
2278 | my ($self, $value) = @_; |
|
|
2279 | $CFG->{pickup} &= ~PICKUP_INHIBIT; |
|
|
2280 | $CFG->{pickup} |= PICKUP_INHIBIT unless $_[1]; |
|
|
2281 | $CONN->send_pickup ($CFG->{pickup}) |
|
|
2282 | if $CONN; |
|
|
2283 | }, |
2264 | ); |
2284 | ); |
|
|
2285 | |
2265 | $MENUBAR->add ($GAUGES->{sklprg} = new DC::UI::ExperienceProgress |
2286 | $MENUBAR->add ($GAUGES->{skillexp} = new DC::UI::ExperienceProgress |
2266 | c_rescale => 1, |
2287 | c_rescale => 1, |
2267 | padding_x => 6, |
2288 | padding_x => 6, |
2268 | padding_y => 3, |
2289 | padding_y => 3, |
2269 | force_w => $::WIDTH * 0.2, |
2290 | force_w => $::WIDTH * 0.2, |
2270 | tooltip => "This progress bar shows the currently used skill and your progress towards the next skill level of that skill.", |
2291 | tooltip => "This progress bar shows the currently used skill and your progress towards the next skill level of that skill.", |
|
|
2292 | template => "two handed weapons 99%", |
2271 | ); |
2293 | ); |
|
|
2294 | |
2272 | $MENUBAR->add ($GAUGES->{range} = new DC::UI::Label |
2295 | $MENUBAR->add ($GAUGES->{range} = new DC::UI::Label |
2273 | expand => 1, |
2296 | expand => 1, |
2274 | align => 1, can_hover => 1, can_events => 1, |
2297 | align => 1, can_hover => 1, can_events => 1, |
2275 | text => "Range and Combat Slots", |
2298 | text => "Range and Combat Slots", |
2276 | tooltip => "#stat_ranged", |
2299 | tooltip => "#stat_ranged", |
… | |
… | |
2462 | |
2485 | |
2463 | DC::UI::Toplevel->new ( |
2486 | DC::UI::Toplevel->new ( |
2464 | title => "Minimap", |
2487 | title => "Minimap", |
2465 | name => "mapmap", |
2488 | name => "mapmap", |
2466 | x => 0, |
2489 | x => 0, |
2467 | y => $FONTSIZE + 8, |
2490 | y => $::FONTSIZE + 8,#d# hack to move messages window below the menubar |
2468 | border_bg => [1, 1, 1, 192/255], |
2491 | border_bg => [1, 1, 1, 192/255], |
2469 | bg => [1, 1, 1, 0], |
2492 | bg => [1, 1, 1, 0], |
2470 | child => ($MAPMAP = new DC::MapWidget::MapMap |
2493 | child => ($MAPMAP = new DC::MapWidget::MapMap |
2471 | tooltip => "<b>Minimap</b>. This will display an overview of the surrounding areas.", |
2494 | tooltip => "<b>Minimap</b>. This will display an overview of the surrounding areas.", |
2472 | ), |
2495 | ), |
… | |
… | |
2501 | $METASERVER = metaserver_dialog; |
2524 | $METASERVER = metaserver_dialog; |
2502 | # the name is changed to not conflict with the older name as users could have hidden it |
2525 | # the name is changed to not conflict with the older name as users could have hidden it |
2503 | $MESSAGE_WINDOW = new DC::UI::Dockbar |
2526 | $MESSAGE_WINDOW = new DC::UI::Dockbar |
2504 | name => "message_window2", |
2527 | name => "message_window2", |
2505 | title => 'Messages', |
2528 | title => 'Messages', |
|
|
2529 | y => $::FONTSIZE + 8,#d# hack to move messages window below the menubar |
2506 | force_w => $::WIDTH * 0.6, |
2530 | force_w => $::WIDTH * 0.6, |
2507 | force_h => $::HEIGHT * 0.25, |
2531 | force_h => $::HEIGHT * 0.25, |
2508 | ; |
2532 | ; |
2509 | |
2533 | |
2510 | $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW; |
2534 | $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW; |
… | |
… | |
2530 | . "After pressing the combo the binding will be saved automatically and the " |
2554 | . "After pressing the combo the binding will be saved automatically and the " |
2531 | . "binding editor closes"); |
2555 | . "binding editor closes"); |
2532 | $SETUP_NOTEBOOK->add_tab (Debug => debug_setup, |
2556 | $SETUP_NOTEBOOK->add_tab (Debug => debug_setup, |
2533 | "Some debuggin' options. Do not ask."); |
2557 | "Some debuggin' options. Do not ask."); |
2534 | |
2558 | |
|
|
2559 | make_help_window; |
2535 | make_menuframe; |
2560 | make_menubar; |
2536 | |
2561 | |
2537 | $SETUP_DIALOG->show; |
2562 | $SETUP_DIALOG->show; |
2538 | $MESSAGE_WINDOW->show; |
2563 | $MESSAGE_WINDOW->show; |
2539 | } |
2564 | } |
2540 | |
2565 | |
… | |
… | |
2577 | my $want_refresh = EV::prepare_ns \&force_refresh; |
2602 | my $want_refresh = EV::prepare_ns \&force_refresh; |
2578 | |
2603 | |
2579 | my $input = EV::periodic 0, 1 / $MAX_FPS, undef, sub { |
2604 | my $input = EV::periodic 0, 1 / $MAX_FPS, undef, sub { |
2580 | $NOW = EV::now; |
2605 | $NOW = EV::now; |
2581 | |
2606 | |
2582 | ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) |
2607 | ($SDL_CB[$_->{type}] || sub { warn "unhandled event $_->{type}" })->($_) |
2583 | for DC::poll_events; |
2608 | for DC::poll_events; |
2584 | |
2609 | |
2585 | if (%animate_object) { |
2610 | if (%animate_object) { |
2586 | $_->animate ($LAST_REFRESH - $NOW) for values %animate_object; |
2611 | $_->animate ($LAST_REFRESH - $NOW) for values %animate_object; |
2587 | $WANT_REFRESH = 1; |
2612 | $WANT_REFRESH = 1; |
… | |
… | |
2599 | sub animation_stop { |
2624 | sub animation_stop { |
2600 | my ($widget) = @_; |
2625 | my ($widget) = @_; |
2601 | delete $animate_object{$widget}; |
2626 | delete $animate_object{$widget}; |
2602 | } |
2627 | } |
2603 | |
2628 | |
2604 | %SDL_CB = ( |
|
|
2605 | DC::SDL_QUIT => sub { |
2629 | $SDL_CB[DC::SDL_QUIT] = sub { |
2606 | crash "SDL_QUIT"; |
2630 | crash "SDL_QUIT"; |
2607 | EV::unloop EV::UNLOOP_ALL; |
2631 | EV::unloop EV::UNLOOP_ALL; |
2608 | }, |
2632 | }; |
2609 | DC::SDL_VIDEORESIZE => sub { |
2633 | $SDL_CB[DC::SDL_VIDEORESIZE] = sub { }; |
2610 | }, |
|
|
2611 | DC::SDL_VIDEOEXPOSE => sub { |
2634 | $SDL_CB[DC::SDL_VIDEOEXPOSE] = sub { |
2612 | DC::UI::full_refresh; |
2635 | DC::UI::full_refresh; |
2613 | }, |
2636 | }; |
2614 | DC::SDL_ACTIVEEVENT => sub { |
2637 | $SDL_CB[DC::SDL_ACTIVEEVENT] = sub { |
2615 | # not useful, as APPACTIVE includes only iconified state, not unmapped |
2638 | # not useful, as APPACTIVE includes only iconified state, not unmapped |
2616 | # printf "active %x %x %x\n", $_[0]{gain}, $_[0]{state}, DC::SDL_GetAppState;#d# |
2639 | # printf "active %x %x %x\n", $_[0]{gain}, $_[0]{state}, DC::SDL_GetAppState;#d# |
2617 | # printf "a %x\n", DC::SDL_GetAppState & DC::SDL_APPACTIVE;#d# |
2640 | # printf "a %x\n", DC::SDL_GetAppState & DC::SDL_APPACTIVE;#d# |
2618 | # printf "A\n" if $_[0]{state} & DC::SDL_APPACTIVE; |
2641 | # printf "A\n" if $_[0]{state} & DC::SDL_APPACTIVE; |
2619 | # printf "K\n" if $_[0]{state} & DC::SDL_APPINPUTFOCUS; |
2642 | # printf "K\n" if $_[0]{state} & DC::SDL_APPINPUTFOCUS; |
2620 | # printf "M\n" if $_[0]{state} & DC::SDL_APPMOUSEFOCUS; |
2643 | # printf "M\n" if $_[0]{state} & DC::SDL_APPMOUSEFOCUS; |
2621 | }, |
2644 | }; |
2622 | DC::SDL_KEYDOWN => sub { |
2645 | $SDL_CB[DC::SDL_KEYDOWN] = sub { |
2623 | if ($_[0]{mod} & DC::KMOD_ALT && $_[0]{sym} == 13) { |
2646 | if ($_[0]{mod} & DC::KMOD_ALT && $_[0]{sym} == 13) { |
2624 | # alt-enter |
2647 | # alt-enter |
2625 | video_shutdown; |
2648 | video_shutdown; |
2626 | $FULLSCREEN_ENABLE->toggle; |
2649 | $FULLSCREEN_ENABLE->toggle; |
2627 | video_init; |
2650 | video_init; |
2628 | } else { |
2651 | } else { |
2629 | &DC::UI::feed_sdl_key_down_event; |
2652 | &DC::UI::feed_sdl_key_down_event; |
2630 | } |
2653 | } |
2631 | update_modbox; |
2654 | update_modbox; |
2632 | }, |
2655 | }; |
2633 | DC::SDL_KEYUP => sub { |
2656 | $SDL_CB[DC::SDL_KEYUP] = sub { |
2634 | &DC::UI::feed_sdl_key_up_event; |
2657 | &DC::UI::feed_sdl_key_up_event; |
2635 | update_modbox; |
2658 | update_modbox; |
2636 | }, |
2659 | }; |
2637 | DC::SDL_MOUSEMOTION => \&DC::UI::feed_sdl_motion_event, |
2660 | $SDL_CB[DC::SDL_MOUSEMOTION] = \&DC::UI::feed_sdl_motion_event, |
2638 | DC::SDL_MOUSEBUTTONDOWN => \&DC::UI::feed_sdl_button_down_event, |
2661 | $SDL_CB[DC::SDL_MOUSEBUTTONDOWN] = \&DC::UI::feed_sdl_button_down_event, |
2639 | DC::SDL_MOUSEBUTTONUP => \&DC::UI::feed_sdl_button_up_event, |
2662 | $SDL_CB[DC::SDL_MOUSEBUTTONUP] = \&DC::UI::feed_sdl_button_up_event, |
2640 | DC::SDL_USEREVENT => sub { |
2663 | $SDL_CB[DC::SDL_USEREVENT] = sub { |
2641 | if ($_[0]{code} == 1) { |
2664 | if ($_[0]{code} == 1) { |
2642 | audio_channel_finished $_[0]{data1}; |
2665 | audio_channel_finished $_[0]{data1}; |
2643 | } elsif ($_[0]{code} == 0) { |
2666 | } elsif ($_[0]{code} == 0) { |
2644 | audio_music_finished; |
2667 | audio_music_finished; |
2645 | } |
|
|
2646 | }, |
2668 | } |
2647 | ); |
2669 | }; |
2648 | |
2670 | |
2649 | ############################################################################# |
2671 | ############################################################################# |
2650 | |
2672 | |
2651 | $SIG{INT} = $SIG{TERM} = sub { |
2673 | $SIG{INT} = $SIG{TERM} = sub { |
2652 | EV::unloop; |
2674 | EV::unloop; |
… | |
… | |
2706 | effects_enable => 1, |
2728 | effects_enable => 1, |
2707 | effects_volume => 1, |
2729 | effects_volume => 1, |
2708 | bgm_enable => 1, |
2730 | bgm_enable => 1, |
2709 | bgm_volume => 0.5, |
2731 | bgm_volume => 0.5, |
2710 | output_rate => "", |
2732 | output_rate => "", |
2711 | pickup => 0, |
2733 | pickup => PICKUP_SPELLBOOK | PICKUP_SKILLSCROLL | PICKUP_VALUABLES, |
2712 | inv_sort => "mtime", |
2734 | inv_sort => "mtime", |
2713 | default => "profile", # default profile |
2735 | default => "profile", # default profile |
2714 | show_tips => 1, |
2736 | show_tips => 1, |
2715 | logview_max_par => 1000, |
2737 | logview_max_par => 1000, |
2716 | shift_fire_stop => 0, |
2738 | shift_fire_stop => 0, |
2717 | uitheme => "wood", |
2739 | uitheme => "wood", |
|
|
2740 | map_shift_x => -24, # arbitrary |
|
|
2741 | map_shift_y => +24, # arbitrary |
2718 | ); |
2742 | ); |
2719 | |
2743 | |
2720 | while (my ($k, $v) = each %DEF_CFG) { |
2744 | while (my ($k, $v) = each %DEF_CFG) { |
2721 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2745 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2722 | } |
2746 | } |
… | |
… | |
2736 | } |
2760 | } |
2737 | } |
2761 | } |
2738 | |
2762 | |
2739 | sdl_init; |
2763 | sdl_init; |
2740 | |
2764 | |
|
|
2765 | $ENV{FONTCONFIG_FILE} = DC::find_rcfile "fonts/fonts.conf"; |
|
|
2766 | $ENV{FONTCONFIG_DIR} = DC::find_rcfile "fonts"; |
|
|
2767 | |
2741 | { |
2768 | { |
2742 | my @fonts = map DC::find_rcfile "fonts/$_", qw( |
2769 | my @fonts = map DC::find_rcfile "fonts/$_", qw( |
2743 | DejaVuSans.ttf |
2770 | DejaVuSans.ttf |
2744 | DejaVuSansMono.ttf |
2771 | DejaVuSansMono.ttf |
2745 | DejaVuSans-Bold.ttf |
2772 | DejaVuSans-Bold.ttf |
2746 | DejaVuSansMono-Bold.ttf |
2773 | DejaVuSansMono-Bold.ttf |
2747 | DejaVuSans-Oblique.ttf |
2774 | DejaVuSans-Oblique.ttf |
2748 | DejaVuSansMono-Oblique.ttf |
2775 | DejaVuSansMono-Oblique.ttf |
2749 | DejaVuSans-BoldOblique.ttf |
2776 | DejaVuSans-BoldOblique.ttf |
2750 | DejaVuSansMono-BoldOblique.ttf |
2777 | DejaVuSansMono-BoldOblique.ttf |
|
|
2778 | mona.ttf |
2751 | ); |
2779 | ); |
2752 | |
2780 | |
2753 | DC::add_font $_ for @fonts; |
2781 | DC::add_font $_ for @fonts; |
2754 | |
2782 | |
2755 | $FONT_PROP = new_from_file DC::Font $fonts[0]; |
2783 | $FONT_PROP = new_from_file DC::Font $fonts[0]; |