… | |
… | |
541 | sub audio_tab_update; |
541 | sub audio_tab_update; |
542 | audio_tab_update; |
542 | audio_tab_update; |
543 | } |
543 | } |
544 | |
544 | |
545 | sub audio_shutdown { |
545 | sub audio_shutdown { |
|
|
546 | if ($SDL_MIXER) { |
|
|
547 | DC::MixMusic::halt; |
|
|
548 | DC::Mix_AllocateChannels 0; |
|
|
549 | } |
|
|
550 | |
546 | undef $MUSIC_PLAYER; |
551 | undef $MUSIC_PLAYER; |
547 | undef $MUSIC_PLAYING_META; |
552 | undef $MUSIC_PLAYING_META; |
548 | undef $MUSIC_PLAYING_DATA; |
553 | undef $MUSIC_PLAYING_DATA; |
549 | |
554 | |
550 | $MUSIC_WANT = []; |
555 | $MUSIC_WANT = []; |
551 | @MUSIC_JINGLE = (); |
556 | @MUSIC_JINGLE = (); |
552 | %AUDIO_PLAY = (); |
557 | %AUDIO_PLAY = (); |
553 | %AUDIO_CHUNK = (); |
558 | %AUDIO_CHUNK = (); |
554 | |
559 | |
555 | DC::MixMusic::halt; |
|
|
556 | DC::Mix_AllocateChannels 0; |
|
|
557 | DC::Mix_CloseAudio if $SDL_MIXER; |
560 | DC::Mix_CloseAudio if $SDL_MIXER; |
558 | undef $SDL_MIXER; |
561 | undef $SDL_MIXER; |
559 | } |
562 | } |
560 | |
563 | |
561 | ############################################################################# |
564 | ############################################################################# |
… | |
… | |
1138 | |
1141 | |
1139 | my $text = !$freq |
1142 | my $text = !$freq |
1140 | ? "audio is off" |
1143 | ? "audio is off" |
1141 | : "audio is enabled\n" |
1144 | : "audio is enabled\n" |
1142 | . "frequency (Hz): $freq\n" |
1145 | . "frequency (Hz): $freq\n" |
1143 | . "channels: $chans"; |
1146 | . "channels: $chans\n" |
|
|
1147 | . "chunk decoders available: " . (join ", ", DC::MixChunk::decoders) . "\n" |
|
|
1148 | . "music decoders available: " . (join ", ", DC::MixMusic::decoders); |
1144 | |
1149 | |
1145 | $AUDIO_INFO->set_text ($text); |
1150 | $AUDIO_INFO->set_text ($text); |
1146 | } |
1151 | } |
1147 | |
1152 | |
1148 | sub audio_setup { |
1153 | sub audio_setup { |
… | |
… | |
1668 | child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), |
1673 | child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), |
1669 | ); |
1674 | ); |
1670 | |
1675 | |
1671 | $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username"); |
1676 | $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username"); |
1672 | $table->add_at (1, 4, new DC::UI::Entry |
1677 | $table->add_at (1, 4, new DC::UI::Entry |
1673 | text => $CFG->{profile}{default}{user}, |
1678 | text => $PROFILE->{user}, |
1674 | tooltip => "The name of your character on the server. The name is case-sensitive!", |
1679 | tooltip => "The name of your character on the server. The name is case-sensitive!", |
1675 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 } |
1680 | on_changed => sub { my ($self, $value) = @_; $PROFILE->{user} = $value; 1 } |
1676 | ); |
1681 | ); |
1677 | |
1682 | |
1678 | $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password"); |
1683 | $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password"); |
1679 | $table->add_at (1, 5, new DC::UI::Entry |
1684 | $table->add_at (1, 5, new DC::UI::Entry |
1680 | text => $CFG->{profile}{default}{password}, |
1685 | text => $PROFILE->{password}, |
1681 | hidden => 1, |
1686 | hidden => 1, |
1682 | tooltip => "The password for your character.", |
1687 | tooltip => "The password for your character.", |
1683 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 } |
1688 | on_changed => sub { my ($self, $value) = @_; $PROFILE->{password} = $value; 1 } |
1684 | ); |
1689 | ); |
1685 | |
1690 | |
1686 | $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button |
1691 | $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button |
1687 | expand => 1, |
1692 | expand => 1, |
1688 | text => "Login / Register", |
1693 | text => "Login / Register", |
… | |
… | |
1724 | $table->add_at (1, $row, my $vbox = new DC::UI::VBox); |
1729 | $table->add_at (1, $row, my $vbox = new DC::UI::VBox); |
1725 | |
1730 | |
1726 | $vbox->add ( |
1731 | $vbox->add ( |
1727 | $HOST_ENTRY = new DC::UI::Entry |
1732 | $HOST_ENTRY = new DC::UI::Entry |
1728 | expand => 1, |
1733 | expand => 1, |
1729 | text => $CFG->{profile}{default}{host}, |
1734 | text => $PROFILE->{host}, |
1730 | tooltip => "The hostname or ip address of the Deliantra server to connect to (e.g. <b>gameserver.deliantra.net</b>)", |
1735 | tooltip => "The hostname or ip address of the Deliantra server to connect to (e.g. <b>gameserver.deliantra.net</b>)", |
1731 | on_changed => sub { |
1736 | on_changed => sub { |
1732 | my ($self, $value) = @_; |
1737 | my ($self, $value) = @_; |
1733 | $CFG->{profile}{default}{host} = $value; |
1738 | $PROFILE->{host} = $value; |
1734 | 1 |
1739 | 1 |
1735 | } |
1740 | } |
1736 | ); |
1741 | ); |
1737 | |
1742 | |
1738 | if (0) { #d# disabled |
1743 | if (0) { #d# disabled |
… | |
… | |
2771 | shift_fire_stop => 0, |
2776 | shift_fire_stop => 0, |
2772 | uitheme => "wood", |
2777 | uitheme => "wood", |
2773 | map_shift_x => -24, # arbitrary |
2778 | map_shift_x => -24, # arbitrary |
2774 | map_shift_y => +24, # arbitrary |
2779 | map_shift_y => +24, # arbitrary |
2775 | ); |
2780 | ); |
2776 | |
2781 | |
2777 | while (my ($k, $v) = each %DEF_CFG) { |
2782 | while (my ($k, $v) = each %DEF_CFG) { |
2778 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2783 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
2779 | } |
2784 | } |
2780 | |
2785 | |
2781 | $CFG->{profile}{default}{host} ||= "gameserver.deliantra.net"; |
2786 | my @args = @ARGV; |
|
|
2787 | |
|
|
2788 | my $profile = 'default'; |
|
|
2789 | |
|
|
2790 | for (my $i = 0; $i < @args; $i++) { |
|
|
2791 | if ($args[$i] eq '-profile') { |
|
|
2792 | $profile = $args[$i + 1]; |
|
|
2793 | splice @args, $i, 2, (); |
|
|
2794 | $i = 0; |
|
|
2795 | } |
|
|
2796 | } |
|
|
2797 | |
|
|
2798 | $CFG->{profile}{$profile} ||= {}; |
2782 | $PROFILE = $CFG->{profile}{default}; |
2799 | $PROFILE = $CFG->{profile}{$profile}; |
|
|
2800 | $PROFILE->{host} ||= "gameserver.deliantra.net"; |
|
|
2801 | |
|
|
2802 | $PROFILE->{host} = $args[0] if @args > 0; |
|
|
2803 | $PROFILE->{user} = $args[1] if @args > 1; |
|
|
2804 | $PROFILE->{password} = $args[2] if @args > 2; |
2783 | |
2805 | |
2784 | # convert old bindings (only default profile matters) |
2806 | # convert old bindings (only default profile matters) |
2785 | if (my $bindings = delete $PROFILE->{bindings}) { |
2807 | if (my $bindings = delete $PROFILE->{bindings}) { |
2786 | while (my ($mod, $syms) = each %$bindings) { |
2808 | while (my ($mod, $syms) = each %$bindings) { |
2787 | while (my ($sym, $cmds) = each %$syms) { |
2809 | while (my ($sym, $cmds) = each %$syms) { |
… | |
… | |
2810 | DejaVuSansMono-BoldOblique.ttf |
2832 | DejaVuSansMono-BoldOblique.ttf |
2811 | mona.ttf |
2833 | mona.ttf |
2812 | ); |
2834 | ); |
2813 | |
2835 | |
2814 | DC::add_font $_ for @fonts; |
2836 | DC::add_font $_ for @fonts; |
2815 | |
2837 | |
2816 | $FONT_PROP = new_from_file DC::Font $fonts[0]; |
2838 | $FONT_PROP = new_from_file DC::Font $fonts[0]; |
2817 | $FONT_FIXED = new_from_file DC::Font $fonts[1]; |
2839 | $FONT_FIXED = new_from_file DC::Font $fonts[1]; |
2818 | |
2840 | |
2819 | $FONT_PROP->make_default; |
2841 | $FONT_PROP->make_default; |
2820 | |
2842 | |