… | |
… | |
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; |
… | |
… | |
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 { |
… | |
… | |
2481 | |
2485 | |
2482 | DC::UI::Toplevel->new ( |
2486 | DC::UI::Toplevel->new ( |
2483 | title => "Minimap", |
2487 | title => "Minimap", |
2484 | name => "mapmap", |
2488 | name => "mapmap", |
2485 | x => 0, |
2489 | x => 0, |
2486 | y => $FONTSIZE + 8, |
2490 | y => $::FONTSIZE + 8,#d# hack to move messages window below the menubar |
2487 | border_bg => [1, 1, 1, 192/255], |
2491 | border_bg => [1, 1, 1, 192/255], |
2488 | bg => [1, 1, 1, 0], |
2492 | bg => [1, 1, 1, 0], |
2489 | child => ($MAPMAP = new DC::MapWidget::MapMap |
2493 | child => ($MAPMAP = new DC::MapWidget::MapMap |
2490 | 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.", |
2491 | ), |
2495 | ), |
… | |
… | |
2520 | $METASERVER = metaserver_dialog; |
2524 | $METASERVER = metaserver_dialog; |
2521 | # 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 |
2522 | $MESSAGE_WINDOW = new DC::UI::Dockbar |
2526 | $MESSAGE_WINDOW = new DC::UI::Dockbar |
2523 | name => "message_window2", |
2527 | name => "message_window2", |
2524 | title => 'Messages', |
2528 | title => 'Messages', |
|
|
2529 | y => $::FONTSIZE + 8,#d# hack to move messages window below the menubar |
2525 | force_w => $::WIDTH * 0.6, |
2530 | force_w => $::WIDTH * 0.6, |
2526 | force_h => $::HEIGHT * 0.25, |
2531 | force_h => $::HEIGHT * 0.25, |
2527 | ; |
2532 | ; |
2528 | |
2533 | |
2529 | $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW; |
2534 | $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW; |
… | |
… | |
2730 | default => "profile", # default profile |
2735 | default => "profile", # default profile |
2731 | show_tips => 1, |
2736 | show_tips => 1, |
2732 | logview_max_par => 1000, |
2737 | logview_max_par => 1000, |
2733 | shift_fire_stop => 0, |
2738 | shift_fire_stop => 0, |
2734 | uitheme => "wood", |
2739 | uitheme => "wood", |
|
|
2740 | map_shift_x => -24, # arbitrary |
|
|
2741 | map_shift_y => +24, # arbitrary |
2735 | ); |
2742 | ); |
2736 | |
2743 | |
2737 | while (my ($k, $v) = each %DEF_CFG) { |
2744 | while (my ($k, $v) = each %DEF_CFG) { |
2738 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2745 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2739 | } |
2746 | } |
… | |
… | |
2753 | } |
2760 | } |
2754 | } |
2761 | } |
2755 | |
2762 | |
2756 | sdl_init; |
2763 | sdl_init; |
2757 | |
2764 | |
|
|
2765 | $ENV{FONTCONFIG_FILE} = DC::find_rcfile "fonts/fonts.conf"; |
|
|
2766 | $ENV{FONTCONFIG_DIR} = DC::find_rcfile "fonts"; |
|
|
2767 | |
2758 | { |
2768 | { |
2759 | my @fonts = map DC::find_rcfile "fonts/$_", qw( |
2769 | my @fonts = map DC::find_rcfile "fonts/$_", qw( |
2760 | DejaVuSans.ttf |
2770 | DejaVuSans.ttf |
2761 | DejaVuSansMono.ttf |
2771 | DejaVuSansMono.ttf |
2762 | DejaVuSans-Bold.ttf |
2772 | DejaVuSans-Bold.ttf |
2763 | DejaVuSansMono-Bold.ttf |
2773 | DejaVuSansMono-Bold.ttf |
2764 | DejaVuSans-Oblique.ttf |
2774 | DejaVuSans-Oblique.ttf |
2765 | DejaVuSansMono-Oblique.ttf |
2775 | DejaVuSansMono-Oblique.ttf |
2766 | DejaVuSans-BoldOblique.ttf |
2776 | DejaVuSans-BoldOblique.ttf |
2767 | DejaVuSansMono-BoldOblique.ttf |
2777 | DejaVuSansMono-BoldOblique.ttf |
|
|
2778 | mona.ttf |
2768 | ); |
2779 | ); |
2769 | |
2780 | |
2770 | DC::add_font $_ for @fonts; |
2781 | DC::add_font $_ for @fonts; |
2771 | |
2782 | |
2772 | $FONT_PROP = new_from_file DC::Font $fonts[0]; |
2783 | $FONT_PROP = new_from_file DC::Font $fonts[0]; |