ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Main.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Main.pm (file contents):
Revision 1.23 by root, Fri Nov 16 12:03:26 2012 UTC vs.
Revision 1.30 by root, Sun Jan 29 00:11:23 2017 UTC

511 audio_music_push; 511 audio_music_push;
512} 512}
513 513
514sub audio_init { 514sub audio_init {
515 if ($CFG->{audio_enable}) { 515 if ($CFG->{audio_enable}) {
516 DC::Audio::init $CFG->{audio_driver}; 516 DC::Audio::init;
517 517
518 if ($SDL_MIXER) { 518 if ($SDL_MIXER) {
519 audio_music_finished; 519 audio_music_finished;
520 } else { 520 } else {
521 status "Unable to open sound device: there will be no sound"; 521 status "Unable to open sound device: there will be no sound";
975 new DC::Protocol 975 new DC::Protocol
976 host => $host, 976 host => $host,
977 port => $port, 977 port => $port,
978 create_login => $create, 978 create_login => $create,
979 user => $PROFILE->{user}, 979 user => $PROFILE->{user},
980 pass => $PROFILE->{password}, 980 pass => (pack "H*", $PROFILE->{password}),
981 mapw => $mapw, 981 mapw => $mapw,
982 maph => $maph, 982 maph => $maph,
983 983
984 c_version => { 984 c_version => {
985 client => "deliantra", 985 client => "deliantra",
1178 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Compress Textures"); 1178 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Compress Textures");
1179 $table->add_at (1, $row++, new DC::UI::CheckBox 1179 $table->add_at (1, $row++, new DC::UI::CheckBox
1180 state => $CFG->{texture_compression}, 1180 state => $CFG->{texture_compression},
1181 tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but " 1181 tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but "
1182 . "will save a lot of memory and increase performance (and also fall prey to the ever-buggy Mac OS X software renderer). " 1182 . "will save a lot of memory and increase performance (and also fall prey to the ever-buggy Mac OS X software renderer). "
1183 . "The compression algorithm can differ form card to card, so your mileage may vary. This setting is ignored in " 1183 . "The compression algorithm can differ from card to card, so your mileage may vary. This setting is ignored in "
1184 . "forced OpenGL 1.1 mode and when using the Apple renderer.", 1184 . "forced OpenGL 1.1 mode and when using the Apple renderer.",
1185 on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 } 1185 on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 }
1186 ); 1186 );
1187 1187
1188 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fast & Ugly"); 1188 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fast & Ugly");
1540 $DELIANTRA_DEBUG ^= $_[0]; 1540 $DELIANTRA_DEBUG ^= $_[0];
1541 1541
1542 if ($DELIANTRA_DEBUG & 16) { 1542 if ($DELIANTRA_DEBUG & 16) {
1543 $BW_WATCHER = EV::periodic 0, 1, 0, sub { 1543 $BW_WATCHER = EV::periodic 0, 1, 0, sub {
1544 return unless $CONN; 1544 return unless $CONN;
1545 debug sprintf "%8.2gKB/s", $CONN->{octets_in} / 1e3; 1545 debug sprintf "%8.2gkB/s", $CONN->{octets_in} / 1e3;
1546 $CONN->{octets_in} = 0; 1546 $CONN->{octets_in} = 0;
1547 }; 1547 };
1548 } else { 1548 } else {
1549 undef $BW_WATCHER; 1549 undef $BW_WATCHER;
1550 } 1550 }
1915 if $self->{text} eq $nullpw; 1915 if $self->{text} eq $nullpw;
1916 0 1916 0
1917 }, 1917 },
1918 on_changed => sub { 1918 on_changed => sub {
1919 my ($self, $value) = @_; 1919 my ($self, $value) = @_;
1920 $PROFILE->{password} = Deliantra::Util::hash_pw $value 1920 $PROFILE->{password} = unpack "H*", Deliantra::Util::hash_pw $value
1921 if length $value && $value ne $nullpw; 1921 if length $value && $value ne $nullpw;
1922 1 1922 1
1923 }, 1923 },
1924 ); 1924 );
1925 1925
1955 }, 1955 },
1956 ); 1956 );
1957 1957
1958 $vbox->add (new DC::UI::FancyFrame 1958 $vbox->add (new DC::UI::FancyFrame
1959 label => "Server Message", 1959 label => "Server Message",
1960 tooltip => "The last message, or error, form the server.", 1960 tooltip => "The last message, or error, from the server.",
1961 child => ($LOGIN_ERROR = new DC::UI::Label valign => 0, ellipsise => 0), 1961 child => ($LOGIN_ERROR = new DC::UI::Label valign => 0, ellipsise => 0),
1962 ); 1962 );
1963 1963
1964 $vbox->add (new DC::UI::FancyFrame 1964 $vbox->add (new DC::UI::FancyFrame
1965 label => "How to Play", 1965 label => "How to Play",
2028 $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Output-Rate"); 2028 $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Output-Rate");
2029 $table->add_at (1, $row, new DC::UI::Entry 2029 $table->add_at (1, $row, new DC::UI::Entry
2030 text => $CFG->{output_rate}, 2030 text => $CFG->{output_rate},
2031 tooltip => "The maximum bandwidth in bytes per second that the server should not exceed " 2031 tooltip => "The maximum bandwidth in bytes per second that the server should not exceed "
2032 . "when sending data. When 0 or unset, the server " 2032 . "when sending data. When 0 or unset, the server "
2033 . "default will be used, which is usually around 100kb/s. Most servers will " 2033 . "default will be used, which is usually around 100kB/s. Most servers will "
2034 . "dynamically find an optimal rate, so adjust this only when necessary.", 2034 . "dynamically find an optimal rate, so adjust this only when necessary.",
2035 on_changed => sub { $CFG->{output_rate} = $_[1]; 1 }, 2035 on_changed => sub { $CFG->{output_rate} = $_[1]; 1 },
2036 ); 2036 );
2037 2037
2038 $vbox->add (new DC::UI::FancyFrame 2038 $vbox->add (new DC::UI::FancyFrame
2595 make_playerbook; 2595 make_playerbook;
2596 2596
2597 $MENUPOPUP = DC::UI::Menu->new (items => [ 2597 $MENUPOPUP = DC::UI::Menu->new (items => [
2598 ["Setup…\tF9" , sub { $SETUP_DIALOG->toggle_visibility }], 2598 ["Setup…\tF9" , sub { $SETUP_DIALOG->toggle_visibility }],
2599 ["Playerbook…\tTab" , sub { $PL_WINDOW ->toggle_visibility }], 2599 ["Playerbook…\tTab" , sub { $PL_WINDOW ->toggle_visibility }],
2600 ["…Statistics\tF2" , sub { toggle_player_page ($::STATS_PAGE) }], 2600 ["…Statistics\tF2" , sub { toggle_player_page ($::STATS_PAGE) }],
2601 ["…Skills\tF3" , sub { toggle_player_page ($::SKILL_PAGE) }], 2601 ["…Skills\tF3" , sub { toggle_player_page ($::SKILL_PAGE) }],
2602 ["…Spells\tF4" , sub { toggle_player_page ($::SPELL_PAGE) }], 2602 ["…Spells\tF4" , sub { toggle_player_page ($::SPELL_PAGE) }],
2603 ["…Inventory\tF5" , sub { toggle_player_page ($::INVENTORY_PAGE) }], 2603 ["…Inventory\tF5" , sub { toggle_player_page ($::INVENTORY_PAGE) }],
2604 ["Help Browser…\tF1" , sub { $HELP_WINDOW ->toggle_visibility }], 2604 ["Help Browser…\tF1" , sub { $HELP_WINDOW ->toggle_visibility }],
2605 ["Quit…" , sub { 2605 ["Quit…" , sub {
2606 if ($CONN) { 2606 if ($CONN) {
2607 open_quit_dialog; 2607 open_quit_dialog;
2608 } else { 2608 } else {
2609 EV::unloop EV::UNLOOP_ALL; 2609 EV::break EV::BREAK_ALL;
2610 } 2610 }
2611 }], 2611 }],
2612 ]); 2612 ]);
2613 2613
2614 $BUTTONBAR->add (new DC::UI::Button text => "Menu…", 2614 $BUTTONBAR->add (new DC::UI::Button text => "Menu…",
2985 delete $animate_object{$widget}; 2985 delete $animate_object{$widget};
2986} 2986}
2987 2987
2988$SDL_CB[DC::SDL_QUIT] = sub { 2988$SDL_CB[DC::SDL_QUIT] = sub {
2989 crash "SDL_QUIT"; 2989 crash "SDL_QUIT";
2990 EV::unloop EV::UNLOOP_ALL; 2990 EV::break EV::BREAK_ALL;
2991}; 2991};
2992$SDL_CB[DC::SDL_VIDEORESIZE] = sub { }; 2992$SDL_CB[DC::SDL_VIDEORESIZE] = sub { };
2993$SDL_CB[DC::SDL_VIDEOEXPOSE] = sub { 2993$SDL_CB[DC::SDL_VIDEOEXPOSE] = sub {
2994 DC::UI::full_refresh; 2994 DC::UI::full_refresh;
2995}; 2995};
3028}; 3028};
3029 3029
3030############################################################################# 3030#############################################################################
3031 3031
3032$SIG{INT} = $SIG{TERM} = sub { 3032$SIG{INT} = $SIG{TERM} = sub {
3033 EV::unloop; 3033 EV::break;
3034 #d# TODO calling exit here hangs the process in some futex 3034 #d# TODO calling exit here hangs the process in some futex
3035}; 3035};
3036 3036
3037# due to mac os x + sdl combined braindamage, we need this contortion 3037# due to mac os x + sdl combined braindamage, we need this contortion
3038sub DC::Main::run { 3038sub DC::Main::run {
3080 3080
3081 $CFG->{profile}{$profile} ||= {}; 3081 $CFG->{profile}{$profile} ||= {};
3082 $PROFILE = $CFG->{profile}{$profile}; 3082 $PROFILE = $CFG->{profile}{$profile};
3083 $PROFILE->{host} ||= "gameserver.deliantra.net"; 3083 $PROFILE->{host} ||= "gameserver.deliantra.net";
3084 3084
3085 $PROFILE->{host} = $args[0] if @args > 0; 3085 $PROFILE->{host} = $args[0] if @args > 0;
3086 $PROFILE->{user} = $args[1] if @args > 1; 3086 $PROFILE->{user} = $args[1] if @args > 1;
3087 $PROFILE->{password} = $args[2] if @args > 2; 3087 $PROFILE->{password} = unpack "H*", Deliantra::Util::hash_pw $args[2] if @args > 2;
3088 3088
3089 # convert old bindings (only default profile matters) 3089 # convert old bindings (only default profile matters)
3090 if (my $bindings = delete $PROFILE->{bindings}) { 3090 if (my $bindings = delete $PROFILE->{bindings}) {
3091 while (my ($mod, $syms) = each %$bindings) { 3091 while (my ($mod, $syms) = each %$bindings) {
3092 while (my ($sym, $cmds) = each %$syms) { 3092 while (my ($sym, $cmds) = each %$syms) {
3155 }; 3155 };
3156 3156
3157 debug_toggle 0; 3157 debug_toggle 0;
3158 3158
3159 delete $SIG{__DIE__}; 3159 delete $SIG{__DIE__};
3160 EV::loop; 3160 EV::run;
3161 3161
3162 DC::save_cfg if $CFG->{config_autosave}; 3162 DC::save_cfg if $CFG->{config_autosave};
3163 3163
3164 #video_shutdown; 3164 #video_shutdown;
3165 #audio_shutdown; 3165 #audio_shutdown;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines