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

Comparing deliantra/Deliantra-Client/bin/deliantra (file contents):
Revision 1.84 by root, Fri Jan 9 22:38:17 2009 UTC vs.
Revision 1.88 by root, Sun Jan 11 23:50:27 2009 UTC

166 166
167our $MAP; 167our $MAP;
168our $MAPMAP; 168our $MAPMAP;
169our $MAPWIDGET; 169our $MAPWIDGET;
170our $COMPLETER; 170our $COMPLETER;
171our $BUTTONBAR; 171our $MENUFRAME; # the rectangle at the top
172our $MENUBAR; # the hbox at the top
173our $MENUPOPUP;
174our $BUTTONBAR; # the menu buttons
172our $METASERVER; 175our $METASERVER;
173our $LOGIN_BUTTON; 176our $LOGIN_BUTTON;
174our $QUIT_DIALOG; 177our $QUIT_DIALOG;
175our $HOST_ENTRY; 178our $HOST_ENTRY;
176our $FULLSCREEN_ENABLE; 179our $FULLSCREEN_ENABLE;
343 or return; 346 or return;
344 347
345 $meta->{data} 348 $meta->{data}
346 or return; 349 or return;
347 350
348 # if its a jingle, play it as ambient music 351 # if it's a jingle, play it as ambient music
349 if ($meta->{data}{jingle}) { 352 if ($meta->{data}{jingle}) {
350 if (delete $AUDIO_PLAY{$face}) { # take the jingle out of the sound queue 353 if (delete $AUDIO_PLAY{$face}) { # take the jingle out of the sound queue
351 push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue 354 push @MUSIC_JINGLE, $meta; # push it unto the music/jingle queue
352 &audio_music_push ($face); 355 &audio_music_push ($face);
353 } 356 }
354 } else { 357 } else {
355 # fetch from database 358 # fetch from database
356 DC::DB::get res_data => $meta->{name}, sub { 359 DC::DB::get res_data => $meta->{name}, sub {
357 my $rwops = new DC::RW $_[0]; 360 my $rwops = new DC::RW $_[0];
358 my $chunk = new DC::MixChunk $rwops 361 my $chunk = new DC::MixChunk $rwops
359 or Carp::confess "sound face " . (JSON::XS::encode_json $meta) . " unloadable: " . DC::Mix_GetError; 362 or Carp::confess "sound face " . (JSON::XS::encode_json $meta) . " (" . (unpack "H64", $_[0]) . ") unloadable: " . DC::Mix_GetError;
360 $chunk->volume (($meta->{data}{volume} || 1) * 128); 363 $chunk->volume (($meta->{data}{volume} || 1) * 128);
361 $AUDIO_CHUNK{$face} = $chunk; 364 $AUDIO_CHUNK{$face} = $chunk;
362 365
363 audio_sound_push ($face); 366 audio_sound_push ($face);
364 }; 367 };
411 414
412 audio_music_update_volume; 415 audio_music_update_volume;
413 416
414 $MUSIC_PLAYING_DATA = \$_[0]; 417 $MUSIC_PLAYING_DATA = \$_[0];
415 418
419 $meta->{path} or length $_[0]
420 or return clienterror "empty music face from res_data ($meta->{face})";#d#
421
416 my $rwops = $meta->{path} 422 my $rwops = $meta->{path}
417 ? new_from_file DC::RW $meta->{path} 423 ? (new_from_file DC::RW $meta->{path} or return clienterror "unable to load music face $meta->{path}: $!")#d#clienterror
418 : new DC::RW $$MUSIC_PLAYING_DATA; 424 : new DC::RW $$MUSIC_PLAYING_DATA;
419 425
420 $MUSIC_PLAYER = new DC::MixMusic $rwops 426 $MUSIC_PLAYER = new DC::MixMusic $rwops
421 or return clienterror "music face $meta->{face} unloadable: " . DC::Mix_GetError => 1; 427 or return clienterror "music face $meta->{face} unloadable: " . DC::Mix_GetError => 1;
422 428
915 921
916 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Video Mode"); 922 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Video Mode");
917 $table->add_at (1, $row++, my $hbox = new DC::UI::HBox); 923 $table->add_at (1, $row++, my $hbox = new DC::UI::HBox);
918 924
919 $hbox->add ($MODE_SLIDER = new DC::UI::Slider 925 $hbox->add ($MODE_SLIDER = new DC::UI::Slider
926 c_rescale => 1,
920 force_w => $WIDTH * 0.1, expand => 1, 927 force_w => $WIDTH * 0.1, expand => 1,
921 range => [ ($CFG->{sdl_mode}) x 3 ], 928 range => [ ($CFG->{sdl_mode}) x 3 ],
922 tooltip => $vidmode_tooltip); 929 tooltip => $vidmode_tooltip);
923 $hbox->add (my $mode_label = new DC::UI::Label 930 $hbox->add (my $mode_label = new DC::UI::Label
924 height => 0.8, template => "9999x9999@9+9", 931 height => 0.8, template => "9999x9999@9+9",
1248} 1255}
1249 1256
1250sub make_gauge_window { 1257sub make_gauge_window {
1251 my $gh = int $HEIGHT * $CFG->{gauge_size}; 1258 my $gh = int $HEIGHT * $CFG->{gauge_size};
1252 1259
1253 my $win = new DC::UI::Frame ( 1260 $GAUGES->{win} = my $win = new DC::UI::Frame (
1254 force_x => 0, 1261 force_x => 0,
1255 force_y => "max", 1262 force_y => "max",
1256 force_w => $WIDTH, 1263 force_w => $WIDTH,
1257 force_h => $gh, 1264 force_h => $gh,
1258 ); 1265 );
1274 (new DC::UI::Empty expand => 1), 1281 (new DC::UI::Empty expand => 1),
1275 (my $hb = new DC::UI::HBox), 1282 (my $hb = new DC::UI::HBox),
1276 ], 1283 ],
1277 ); 1284 );
1278 1285
1279 $hb->add (my $hg = new DC::UI::Gauge type => 'hp', tooltip => "#stat_health"); 1286 $hb->add ($GAUGES->{hp} = new DC::UI::Gauge type => 'hp', tooltip => "#stat_health");
1280 $hb->add (my $mg = new DC::UI::Gauge type => 'mana', tooltip => "#stat_mana"); 1287 $hb->add ($GAUGES->{mana} = new DC::UI::Gauge type => 'mana', tooltip => "#stat_mana");
1281 $hb->add (my $gg = new DC::UI::Gauge type => 'grace', tooltip => "#stat_grace"); 1288 $hb->add ($GAUGES->{grace} = new DC::UI::Gauge type => 'grace', tooltip => "#stat_grace");
1282 $hb->add (my $fg = new DC::UI::Gauge type => 'food', tooltip => "#stat_food"); 1289 $hb->add ($GAUGES->{food} = new DC::UI::Gauge type => 'food', tooltip => "#stat_food");
1283
1284 $vbox->add (my $exp = new DC::UI::Label align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_exp");
1285 $vbox->add (my $prg = new DC::UI::ExperienceProgress);
1286 $vbox->add (my $sklprg = new DC::UI::ExperienceProgress);
1287 $vbox->add (my $rng = new DC::UI::Label align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_ranged");
1288
1289 $GAUGES = {
1290 exp => $exp, prg => $prg, sklprg => $sklprg,
1291 win => $win, range => $rng,
1292 hp => $hg, mana => $mg, grace => $gg, food => $fg,
1293 };
1294 1290
1295 &set_gauge_window_fontsize; 1291 &set_gauge_window_fontsize;
1296 1292
1297 $win 1293 $win
1298} 1294}
1640 ); 1636 );
1641 1637
1642 $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username"); 1638 $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username");
1643 $table->add_at (1, 4, new DC::UI::Entry 1639 $table->add_at (1, 4, new DC::UI::Entry
1644 text => $CFG->{profile}{default}{user}, 1640 text => $CFG->{profile}{default}{user},
1645 tooltip => "The name of your character on the server.", 1641 tooltip => "The name of your character on the server. The name is case-sensitive!",
1646 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 } 1642 on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 }
1647 ); 1643 );
1648 1644
1649 $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password"); 1645 $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password");
1650 $table->add_at (1, 5, new DC::UI::Entry 1646 $table->add_at (1, 5, new DC::UI::Entry
1752 1748
1753 my $row = 0; 1749 my $row = 0;
1754 1750
1755 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Tip of the day"); 1751 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Tip of the day");
1756 $table->add_at (1, $row++, new DC::UI::CheckBox 1752 $table->add_at (1, $row++, new DC::UI::CheckBox
1753 c_colspan => 2,
1757 state => $CFG->{show_tips}, 1754 state => $CFG->{show_tips},
1758 tooltip => "Show the <b>Tip of the day</b> window at startup?", 1755 tooltip => "Show the <b>Tip of the day</b> window at startup?",
1759 on_changed => sub { 1756 on_changed => sub {
1760 my ($self, $value) = @_; 1757 my ($self, $value) = @_;
1761 $CFG->{show_tips} = $value; 1758 $CFG->{show_tips} = $value;
1763 } 1760 }
1764 ); 1761 );
1765 1762
1766 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Window Size"); 1763 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Window Size");
1767 $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry 1764 $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry
1765 c_colspan => 2,
1768 text => $CFG->{logview_max_par}, 1766 text => $CFG->{logview_max_par},
1769 tooltip => "This is maximum number of messages remembered in the <b>Message</b> window. If the server " 1767 tooltip => "This is maximum number of messages remembered in the <b>Message</b> window. If the server "
1770 . "sends more messages than this number, older messages get removed to save memory and " 1768 . "sends more messages than this number, older messages get removed to save memory and "
1771 . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", 1769 . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.",
1772 on_changed => sub { 1770 on_changed => sub {
1774 $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1); 1772 $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1);
1775 0 1773 0
1776 }, 1774 },
1777 ); 1775 );
1778 1776
1777 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Config Autosave");
1778 $table->add_at (1, $row, new DC::UI::CheckBox
1779 state => $CFG->{config_autosave},
1780 tooltip => "Normally, configuration settings and the user interface layout "
1781 . "are saved on client exit. You can disable this behaviour by "
1782 . "unchecking this checkbox.",
1783 on_changed => sub {
1784 my ($self, $value) = @_;
1785 $CFG->{config_autosave} = $value;
1786 0
1787 }
1788 );
1789 $table->add_at (2, $row++, new DC::UI::Button
1790 text => "Save Now",
1791 tooltip => "Use this to manually save configuration and UI layout when "
1792 . "autosave is disabled.",
1793 on_activate => sub {
1794 DC::write_cfg;
1795 0
1796 }
1797 );
1798
1779 $table 1799 $table
1780} 1800}
1781 1801
1782sub autopickup_setup { 1802sub autopickup_setup {
1783 my $r = new DC::UI::ScrolledWindow ( 1803 my $r = new DC::UI::ScrolledWindow (
1789 col_expand => [0, 1, 0, 1], 1809 col_expand => [0, 1, 0, 1],
1790 ); 1810 );
1791 1811
1792 for ( 1812 for (
1793 ["General", 0, 0, 1813 ["General", 0, 0,
1794 ["Enable autopickup" => PICKUP_NEWMODE, \$PICKUP_ENABLE],
1795 ["Inhibit autopickup" => PICKUP_INHIBIT], 1814# ["Inhibit autopickup" => PICKUP_INHIBIT],
1796 ["Stop before pickup" => PICKUP_STOP], 1815 ["Stop before pickup" => PICKUP_STOP],
1797 ["Debug autopickup" => PICKUP_DEBUG], 1816 ["Debug autopickup" => PICKUP_DEBUG],
1798 ], 1817 ],
1799 ["Weapons", 0, 6, 1818 ["Weapons", 0, 6,
1800 ["All weapons" => PICKUP_ALLWEAPON], 1819 ["All weapons" => PICKUP_ALLWEAPON],
1848 $::CFG->{pickup} |= $mask; 1867 $::CFG->{pickup} |= $mask;
1849 } else { 1868 } else {
1850 $::CFG->{pickup} &= ~$mask; 1869 $::CFG->{pickup} &= ~$mask;
1851 } 1870 }
1852 1871
1853 $::CONN->send_command ("pickup $::CFG->{pickup}") 1872 $::CONN->send_pickup ($::CFG->{pickup})
1854 if defined $::CONN; 1873 if defined $::CONN;
1855 1874
1856 0 1875 0
1857 }); 1876 });
1858 1877
1875 }); 1894 });
1876 1895
1877 $table->add_at (3, 18, new DC::UI::Button 1896 $table->add_at (3, 18, new DC::UI::Button
1878 text => "set", 1897 text => "set",
1879 on_activate => sub { 1898 on_activate => sub {
1880 $::CONN->send_command ("pickup $::CFG->{pickup}") 1899 $::CONN->send_pickup ($::CFG->{pickup})
1881 if defined $::CONN; 1900 if defined $::CONN;
1882 0 1901 0
1883 }); 1902 });
1884 1903
1885 $r 1904 $r
1998 $PL_NOTEBOOK->set_current_page ($widget); 2017 $PL_NOTEBOOK->set_current_page ($widget);
1999 $PL_WINDOW->show; 2018 $PL_WINDOW->show;
2000 } 2019 }
2001} 2020}
2002 2021
2003sub player_window { 2022sub make_playerbook {
2004 my $plwin = $PL_WINDOW = new DC::UI::Toplevel 2023 my $plwin = $PL_WINDOW = new DC::UI::Toplevel
2005 x => "center", 2024 x => "center",
2006 y => "center", 2025 y => "center",
2007 force_w => $WIDTH * 9/10, 2026 force_w => $WIDTH * 9/10,
2008 force_h => $HEIGHT * 9/10, 2027 force_h => $HEIGHT * 9/10,
2042 "License, Author and Source info for media sent by the server."); 2061 "License, Author and Source info for media sent by the server.");
2043 2062
2044 $ntb->set_current_page ($INVENTORY_PAGE); 2063 $ntb->set_current_page ($INVENTORY_PAGE);
2045 2064
2046 $plwin->add ($ntb); 2065 $plwin->add ($ntb);
2047 $plwin
2048} 2066}
2049 2067
2050sub keyboard_setup { 2068sub keyboard_setup {
2051 DC::Macro::keyboard_setup 2069 DC::Macro::keyboard_setup
2052} 2070}
2053 2071
2054sub help_window { 2072sub make_help_window {
2055 my $win = new DC::UI::Toplevel 2073 my $win = new DC::UI::Toplevel
2056 x => 'center', 2074 x => 'center',
2057 y => 'center', 2075 y => 'center',
2058 z => 4, 2076 z => 4,
2059 name => 'doc_browser', 2077 name => 'doc_browser',
2148 2166
2149 $load_node->((DC::Pod::find @path)[0]); 2167 $load_node->((DC::Pod::find @path)[0]);
2150 $win->show; 2168 $win->show;
2151 }; 2169 };
2152 2170
2153 $win 2171 $HELP_WINDOW = $win;
2154}
2155
2156sub open_string_query {
2157 my ($title, $cb, $txt, $tooltip) = @_;
2158 my $dialog = new DC::UI::Toplevel
2159 x => "center",
2160 y => "center",
2161 z => 50,
2162 force_w => $WIDTH * 4/5,
2163 title => $title;
2164
2165 $dialog->add (
2166 my $e = new DC::UI::Entry
2167 on_activate => sub { $cb->(@_); $dialog->hide; 0 },
2168 on_key_down => sub { $_[1]->{sym} == 27 and $dialog->hide; 0 },
2169 tooltip => $tooltip
2170 );
2171
2172 $e->grab_focus;
2173 $e->set_text ($txt) if $txt;
2174 $dialog->show;
2175} 2172}
2176 2173
2177sub open_quit_dialog { 2174sub open_quit_dialog {
2178 unless ($QUIT_DIALOG) { 2175 unless ($QUIT_DIALOG) {
2179 $QUIT_DIALOG = new DC::UI::Toplevel 2176 $QUIT_DIALOG = new DC::UI::Toplevel
2212 2209
2213 $QUIT_DIALOG->show; 2210 $QUIT_DIALOG->show;
2214 $QUIT_DIALOG->grab_focus; 2211 $QUIT_DIALOG->grab_focus;
2215} 2212}
2216 2213
2214sub make_menubar {
2215 $MENUFRAME = new DC::UI::Toplevel
2216 border => 0,
2217 force_x => 0,
2218 force_y => 0,
2219 force_w => $::WIDTH,
2220 child => ($MENUBAR = new DC::UI::HBox),
2221 ;
2222
2223 $MENUBAR->add ($BUTTONBAR = new DC::UI::Buttonbar);
2224
2225 # XXX: this has to be done before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D
2226 make_gauge_window->show;
2227
2228# $BUTTONBAR->add (new DC::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW,
2229# tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server.");
2230
2231 make_playerbook;
2232
2233 $MENUPOPUP = DC::UI::Menu->new (items => [
2234 ["Setup…\tF9" , sub { $SETUP_DIALOG->toggle_visibility }],
2235 ["Playerbook…\tTab" , sub { $PL_WINDOW ->toggle_visibility }],
2236 ["…Statistics\tF2" , sub { toggle_player_page ($::STATS_PAGE) }],
2237 ["…Skills\tF3" , sub { toggle_player_page ($::SKILL_PAGE) }],
2238 ["…Spells\tF4" , sub { toggle_player_page ($::SPELL_PAGE) }],
2239 ["…Inventory\tF5" , sub { toggle_player_page ($::INVENTORY_PAGE) }],
2240 ["Help Browser…\tF1" , sub { $HELP_WINDOW ->toggle_visibility }],
2241 ["Quit…" , sub {
2242 if ($CONN) {
2243 open_quit_dialog;
2244 } else {
2245 EV::unloop EV::UNLOOP_ALL;
2246 }
2247 }],
2248 ]);
2249
2250 $BUTTONBAR->add (new DC::UI::Button text => "Menu…",
2251 tooltip => "Shows the main menu",
2252 on_button_down => sub {
2253 my ($self, $ev) = @_;
2254 local $ev->{x} = 0;
2255 local $ev->{y} = 0;
2256 $MENUPOPUP->popup ($ev);
2257 },
2258 );
2259
2260 $MENUBAR->add ($GAUGES->{exp} = new DC::UI::ExperienceProgress
2261 padding_x => 6,
2262 padding_y => 3,
2263 tooltip => "This progress bar shows your progress towards the next character level.",
2264 template => " Exp: 888,888,888,888 (lvl 188) ",
2265 );
2266
2267 $MENUBAR->add ($PICKUP_ENABLE = new DC::UI::CheckBox # checkbox bad, button better?
2268 tooltip => "Automatic Pickup Enable - when this checkbox is enabled, then your character "
2269 . "will automatically pick up items as defined by your item pickup settings "
2270 . "in the playerbook. Often (e.g. in apartments) you want to temporarily "
2271 . "disable autopickup by disdabling this checkbox.",
2272 state => $CFG->{pickup} & PICKUP_INHIBIT ? 0 : 1,
2273 on_changed => sub {
2274 my ($self, $value) = @_;
2275 $CFG->{pickup} &= ~PICKUP_INHIBIT;
2276 $CFG->{pickup} |= PICKUP_INHIBIT unless $_[1];
2277 $CONN->send_pickup ($CFG->{pickup})
2278 if $CONN;
2279 },
2280 );
2281
2282 $MENUBAR->add ($GAUGES->{skillexp} = new DC::UI::ExperienceProgress
2283 c_rescale => 1,
2284 padding_x => 6,
2285 padding_y => 3,
2286 force_w => $::WIDTH * 0.2,
2287 tooltip => "This progress bar shows the currently used skill and your progress towards the next skill level of that skill.",
2288 template => "two handed weapons 99%",
2289 );
2290
2291 $MENUBAR->add ($GAUGES->{range} = new DC::UI::Label
2292 expand => 1,
2293 align => 1, can_hover => 1, can_events => 1,
2294 text => "Range and Combat Slots",
2295 tooltip => "#stat_ranged",
2296 );
2297
2298 $MENUFRAME->show;
2299}
2300
2301sub open_string_query {
2302 my ($title, $cb, $txt, $tooltip) = @_;
2303 my $dialog = new DC::UI::Toplevel
2304 x => "center",
2305 y => "center",
2306 z => 50,
2307 force_w => $WIDTH * 4/5,
2308 title => $title;
2309
2310 $dialog->add (
2311 my $e = new DC::UI::Entry
2312 on_activate => sub { $cb->(@_); $dialog->hide; 0 },
2313 on_key_down => sub { $_[1]->{sym} == 27 and $dialog->hide; 0 },
2314 tooltip => $tooltip
2315 );
2316
2317 $e->grab_focus;
2318 $e->set_text ($txt) if $txt;
2319 $dialog->show;
2320}
2321
2217sub show_tip_of_the_day { 2322sub show_tip_of_the_day {
2218 # find all tips 2323 # find all tips
2219 my @tod = DC::Pod::find tip_of_the_day => "*"; 2324 my @tod = DC::Pod::find tip_of_the_day => "*";
2220 2325
2221 DC::DB::get state => "tip_of_the_day", sub { 2326 DC::DB::get state => "tip_of_the_day", sub {
2360 2465
2361 (new DC::UI::Frame 2466 (new DC::UI::Frame
2362 bg => [0, 0, 0, 0.4], 2467 bg => [0, 0, 0, 0.4],
2363 force_x => 0, 2468 force_x => 0,
2364 force_y => "max", 2469 force_y => "max",
2365 child => (my $LR = new DC::UI::VBox), 2470 child => (my $LL = new DC::UI::VBox),
2366 )->show; 2471 )->show;
2367 2472
2368 $LR->add ($STATUSBOX); 2473 $LL->add ($STATUSBOX);
2369 $LR->add ($MODBOX); 2474 $LL->add ($MODBOX);
2370 $LR->add (new DC::UI::Label 2475 $LL->add (new DC::UI::Label
2371 align => 0, 2476 align => 0,
2372 markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode", 2477 markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode",
2373 fontsize => 0.5, 2478 fontsize => 0.5,
2374 fg => [1, 1, 0, 0.7], 2479 fg => [1, 1, 0, 0.7],
2375 ); 2480 );
2444 . "After pressing the combo the binding will be saved automatically and the " 2549 . "After pressing the combo the binding will be saved automatically and the "
2445 . "binding editor closes"); 2550 . "binding editor closes");
2446 $SETUP_NOTEBOOK->add_tab (Debug => debug_setup, 2551 $SETUP_NOTEBOOK->add_tab (Debug => debug_setup,
2447 "Some debuggin' options. Do not ask."); 2552 "Some debuggin' options. Do not ask.");
2448 2553
2449 $BUTTONBAR = new DC::UI::Buttonbar x => 0, y => 0, z => 200; # put on top 2554 make_help_window;
2555 make_menubar;
2450 2556
2451 $BUTTONBAR->add (new DC::UI::Flopper text => "Setup", other => $SETUP_DIALOG,
2452 tooltip => "Toggles a dialog where you can configure all aspects of this client.");
2453
2454# $BUTTONBAR->add (new DC::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW,
2455# tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server.");
2456
2457 make_gauge_window->show; # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D
2458
2459 $BUTTONBAR->add (new DC::UI::Flopper text => "Playerbook", other => player_window,
2460 tooltip => "Toggles the player view, where you can manage Inventory, Spells, Skills and see your Stats.");
2461
2462 $BUTTONBAR->add (new DC::UI::Button
2463 text => "Save Config",
2464 tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.",
2465 on_activate => sub {
2466 $::CFG->{layout} = DC::UI::get_layout;
2467 DC::write_cfg;
2468 status "Configuration Saved";
2469 0
2470 },
2471 );
2472
2473 $BUTTONBAR->add (new DC::UI::Flopper text => "Help!", other => $HELP_WINDOW = help_window,
2474 tooltip => "View Documentation");
2475
2476 $BUTTONBAR->add (new DC::UI::Button
2477 text => "Quit",
2478 tooltip => "Terminates the program",
2479 on_activate => sub {
2480 if ($CONN) {
2481 open_quit_dialog;
2482 } else {
2483 EV::unloop EV::UNLOOP_ALL;
2484 }
2485 0
2486 },
2487 );
2488
2489 $BUTTONBAR->show;
2490 $SETUP_DIALOG->show; 2557 $SETUP_DIALOG->show;
2491 $MESSAGE_WINDOW->show; 2558 $MESSAGE_WINDOW->show;
2492 } 2559 }
2493 2560
2494 $MODE_SLIDER->set_range ([$CFG->{sdl_mode}, 0, scalar @SDL_MODES, 1, 1]); 2561 $MODE_SLIDER->set_range ([$CFG->{sdl_mode}, 0, scalar @SDL_MODES, 1, 1]);
2631 DC::DB::open_db; 2698 DC::DB::open_db;
2632 2699
2633 DC::UI::set_layout ($::CFG->{layout}); 2700 DC::UI::set_layout ($::CFG->{layout});
2634 2701
2635 my %DEF_CFG = ( 2702 my %DEF_CFG = (
2703 config_autosave => 1,
2636 sdl_mode => undef, 2704 sdl_mode => undef,
2637 fullscreen => 1, 2705 fullscreen => 1,
2638 fast => 0, 2706 fast => 0,
2639 force_opengl11 => undef, 2707 force_opengl11 => undef,
2640 disable_alpha => 0, 2708 disable_alpha => 0,
2658 effects_enable => 1, 2726 effects_enable => 1,
2659 effects_volume => 1, 2727 effects_volume => 1,
2660 bgm_enable => 1, 2728 bgm_enable => 1,
2661 bgm_volume => 0.5, 2729 bgm_volume => 0.5,
2662 output_rate => "", 2730 output_rate => "",
2663 pickup => 0, 2731 pickup => PICKUP_SPELLBOOK | PICKUP_SKILLSCROLL | PICKUP_VALUABLES,
2664 inv_sort => "mtime", 2732 inv_sort => "mtime",
2665 default => "profile", # default profile 2733 default => "profile", # default profile
2666 show_tips => 1, 2734 show_tips => 1,
2667 logview_max_par => 1000, 2735 logview_max_par => 1000,
2668 shift_fire_stop => 0, 2736 shift_fire_stop => 0,
2737 }; 2805 };
2738 2806
2739 delete $SIG{__DIE__}; 2807 delete $SIG{__DIE__};
2740 EV::loop; 2808 EV::loop;
2741 2809
2810 DC::write_cfg if $CFG->{config_autosave};
2811
2742#video_shutdown; 2812 #video_shutdown;
2743#audio_shutdown; 2813 #audio_shutdown;
2814
2744 DC::OpenGL::quit; 2815 DC::OpenGL::quit;
2745 DC::SDL_Quit; 2816 DC::SDL_Quit;
2746 DC::DB::Server::stop; 2817 DC::DB::Server::stop;
2747} 2818}
2748 2819

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines