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.29 by root, Mon Mar 24 00:24:47 2008 UTC vs.
Revision 1.38 by root, Mon May 5 16:26:11 2008 UTC

99use Deliantra; 99use Deliantra;
100use Deliantra::Protocol::Constants; 100use Deliantra::Protocol::Constants;
101 101
102use Compress::LZF; 102use Compress::LZF;
103 103
104use DC; 104use DC; BEGIN { $SIG{__DIE__} = sub { DC::fatal Carp::longmess "$@" unless $^S } }
105use DC::OpenGL (); 105use DC::OpenGL ();
106use DC::Protocol; 106use DC::Protocol;
107use DC::DB; 107use DC::DB;
108use DC::UI; 108use DC::UI;
109use DC::UI::Canvas; 109use DC::UI::Canvas;
232 232
233 $markup .= $mod & DC::KMOD_NUM 233 $markup .= $mod & DC::KMOD_NUM
234 ? "[NUM]" 234 ? "[NUM]"
235 : "[<span foreground='#888'>num</span>]"; 235 : "[<span foreground='#888'>num</span>]";
236 236
237 # <tt> around next statement works around some bug that keeps the
238 # "font =>" from being used on windows
237 $MODBOX->set_markup ($markup); 239 $MODBOX->set_markup ("<tt>$markup</tt>");
238} 240}
239 241
240############################################################################# 242#############################################################################
241#TODO: maybe move into own audio module... 243#TODO: maybe move into own audio module...
242 244
662 # right: accept 664 # right: accept
663 $table->add_at (4, 0, new DC::UI::Button 665 $table->add_at (4, 0, new DC::UI::Button
664 text => "Accept", 666 text => "Accept",
665 on_activate => sub { 667 on_activate => sub {
666 $conn->send ("reply n"); 668 $conn->send ("reply n");
667 $STATS_PAGE->hide;
668 destroy_query_dialog $conn; 669 destroy_query_dialog $conn;
669 0 670 0
670 }, 671 },
671 ); 672 );
672 673
763 if ($CONN) { 764 if ($CONN) {
764 DC::lowdelay fileno $CONN->{fh}; 765 DC::lowdelay fileno $CONN->{fh};
765 766
766 status "login successful"; 767 status "login successful";
767 } else { 768 } else {
769 warn $@;
768 status "unable to connect"; 770 status "unable to connect";
769 stop_game(); 771 stop_game();
770 } 772 }
771} 773}
772 774
1618 $CFG->{show_tips} = $value; 1620 $CFG->{show_tips} = $value;
1619 0 1621 0
1620 } 1622 }
1621 ); 1623 );
1622 1624
1623 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Messages Window Size"); 1625 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Window Size");
1624 $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry 1626 $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry
1625 text => $CFG->{logview_max_par}, 1627 text => $CFG->{logview_max_par},
1626 tooltip => "This is maximum number of messages remembered in the <b>Messages</b> window. If the server " 1628 tooltip => "This is maximum number of messages remembered in the <b>Message</b> window. If the server "
1627 . "sends more messages than this number, older messages get removed to save memory and " 1629 . "sends more messages than this number, older messages get removed to save memory and "
1628 . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", 1630 . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.",
1629 on_changed => sub { 1631 on_changed => sub {
1630 my ($self, $value) = @_; 1632 my ($self, $value) = @_;
1631 $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1); 1633 $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1);
1972 my @path = DC::Pod::full_path_of $node; 1974 my @path = DC::Pod::full_path_of $node;
1973 pop @path; # drop current node 1975 pop @path; # drop current node
1974 1976
1975 for my $node (@path) { 1977 for my $node (@path) {
1976 $buttons->add (new DC::UI::Button 1978 $buttons->add (new DC::UI::Button
1977 text => $node->{kw}[0], 1979 text => $node->[DC::Pod::N_KW][0],
1978 tooltip => "go to <i>" . (DC::asxml DC::Pod::full_path $node) . "</i>", 1980 tooltip => "go to <i>" . (DC::asxml DC::Pod::full_path $node) . "</i>",
1979 on_activate => sub { 1981 on_activate => sub {
1980 push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = (); 1982 push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = ();
1981 $load_node->($node); 1983 $load_node->($node);
1982 }, 1984 },
1983 ); 1985 );
1984 $buttons->add (new DC::UI::Label text => "/"); 1986 $buttons->add (new DC::UI::Label text => "/");
1985 } 1987 }
1986 1988
1987 $buttons->add (new DC::UI::Label text => $node->{kw}[0], padding_x => 4, padding_y => 4); 1989 $buttons->add (new DC::UI::Label text => $node->[DC::Pod::N_KW][0], padding_x => 4, padding_y => 4);
1988 1990
1989 $curnode = $node; 1991 $curnode = $node;
1990 1992
1991 $viewer->clear; 1993 $viewer->clear;
1992 $viewer->add_paragraph (DC::Pod::as_paragraphs DC::Pod::section_of $curnode); 1994 $viewer->add_paragraph (DC::Pod::as_paragraphs DC::Pod::section_of $curnode);
2178 can_events => 1, 2180 can_events => 1,
2179 can_hover => 1, 2181 can_hover => 1,
2180 markup => "", 2182 markup => "",
2181 align => 0, 2183 align => 0,
2182 font => $FONT_FIXED, 2184 font => $FONT_FIXED,
2183 tooltip => "#modifier_box"; 2185 tooltip => "#modifier_box",
2186 tooltip_width => 0.67,
2187 ;
2184 2188
2185 update_modbox; 2189 update_modbox;
2186 2190
2187 (new DC::UI::Frame 2191 (new DC::UI::Frame
2188 bg => [0, 0, 0, 0.4], 2192 bg => [0, 0, 0, 0.4],
2237 force_h => $::HEIGHT * 0.6, 2241 force_h => $::HEIGHT * 0.6,
2238 has_close_button => 1, 2242 has_close_button => 1,
2239 ; 2243 ;
2240 2244
2241 $METASERVER = metaserver_dialog; 2245 $METASERVER = metaserver_dialog;
2242 $MESSAGE_WINDOW = new DC::UI::Dockbar (name => 'message_window', title => 'Messages'); 2246 $MESSAGE_WINDOW = new DC::UI::Dockbar (title => 'Messages');
2243 $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW; 2247 $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW;
2244 2248
2245 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, debug => 1, 2249 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1,
2246 filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); 2250 filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1);
2247 2251
2248 $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup, 2252 $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup,
2249 "Configure the server to play on, your username and password."); 2253 "Configure the server to play on, your username and password.");
2250 $SETUP_NOTEBOOK->add_tab (Server => $SETUP_SERVER = server_setup, 2254 $SETUP_NOTEBOOK->add_tab (Server => $SETUP_SERVER = server_setup,
2268 $BUTTONBAR = new DC::UI::Buttonbar x => 0, y => 0, z => 200; # put on top 2272 $BUTTONBAR = new DC::UI::Buttonbar x => 0, y => 0, z => 200; # put on top
2269 2273
2270 $BUTTONBAR->add (new DC::UI::Flopper text => "Setup", other => $SETUP_DIALOG, 2274 $BUTTONBAR->add (new DC::UI::Flopper text => "Setup", other => $SETUP_DIALOG,
2271 tooltip => "Toggles a dialog where you can configure all aspects of this client."); 2275 tooltip => "Toggles a dialog where you can configure all aspects of this client.");
2272 2276
2273 $BUTTONBAR->add (new DC::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW, 2277# $BUTTONBAR->add (new DC::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW,
2274 tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); 2278# tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server.");
2275 2279
2276 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 2280 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
2277 2281
2278 $BUTTONBAR->add (new DC::UI::Flopper text => "Playerbook", other => player_window, 2282 $BUTTONBAR->add (new DC::UI::Flopper text => "Playerbook", other => player_window,
2279 tooltip => "Toggles the player view, where you can manage Inventory, Spells, Skills and see your Stats."); 2283 tooltip => "Toggles the player view, where you can manage Inventory, Spells, Skills and see your Stats.");
2281 $BUTTONBAR->add (new DC::UI::Button 2285 $BUTTONBAR->add (new DC::UI::Button
2282 text => "Save Config", 2286 text => "Save Config",
2283 tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", 2287 tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.",
2284 on_activate => sub { 2288 on_activate => sub {
2285 $::CFG->{layout} = DC::UI::get_layout; 2289 $::CFG->{layout} = DC::UI::get_layout;
2286 DC::write_cfg "$Deliantra::VARDIR/client.cf"; 2290 DC::write_cfg;
2287 status "Configuration Saved"; 2291 status "Configuration Saved";
2288 0 2292 0
2289 }, 2293 },
2290 ); 2294 );
2291 2295
2292 $BUTTONBAR->add (new DC::UI::Flopper text => "Help!", other => $HELP_WINDOW = help_window, 2296 $BUTTONBAR->add (new DC::UI::Flopper text => "Help!", other => $HELP_WINDOW = help_window,
2293 tooltip => "View Documentation"); 2297 tooltip => "View Documentation");
2294
2295 2298
2296 $BUTTONBAR->add (new DC::UI::Button 2299 $BUTTONBAR->add (new DC::UI::Button
2297 text => "Quit", 2300 text => "Quit",
2298 tooltip => "Terminates the program", 2301 tooltip => "Terminates the program",
2299 on_activate => sub { 2302 on_activate => sub {
2416 EV::unloop; 2419 EV::unloop;
2417 #d# TODO calling exit here hangs the process in some futex 2420 #d# TODO calling exit here hangs the process in some futex
2418}; 2421};
2419 2422
2420{ 2423{
2424 DC::Pod::load_docwiki DC::find_rcfile "docwiki.pst";
2425
2421 if (-e "$Deliantra::VARDIR/client.cf") { 2426 if (-e "$Deliantra::VARDIR/client.cf") {
2422 DC::read_cfg "$Deliantra::VARDIR/client.cf"; 2427 DC::read_cfg "$Deliantra::VARDIR/client.cf";
2423 } else { 2428 } else {
2424 #TODO: compatibility cruft 2429 #TODO: compatibility cruft
2425 DC::read_cfg "$Deliantra::OLDDIR/cfplusrc"; 2430 DC::read_cfg "$Deliantra::OLDDIR/cfplusrc";
2426 print STDERR "INFO: used old configuration file\n"; 2431 print STDERR "INFO: used old configuration file\n";
2427 } 2432 }
2428 2433
2429 DC::DB::Server::run; 2434 DC::DB::Server::run;
2435
2436 if ($CFG->{db_schema} < 1) {
2437 warn "INFO: upgrading database schema from 0 to 1, mapcache and tilecache will be lost\n";
2438 DC::DB::nuke_db;
2439 $CFG->{db_schema} = 1;
2440 DC::write_cfg;
2441 }
2442
2443 DC::DB::open_db;
2430 2444
2431 DC::UI::set_layout ($::CFG->{layout}); 2445 DC::UI::set_layout ($::CFG->{layout});
2432 2446
2433 my %DEF_CFG = ( 2447 my %DEF_CFG = (
2434 sdl_mode => 0, 2448 sdl_mode => 0,
2504 DejaVuSansMono-BoldOblique.ttf 2518 DejaVuSansMono-BoldOblique.ttf
2505 ); 2519 );
2506 2520
2507 DC::add_font $_ for @fonts; 2521 DC::add_font $_ for @fonts;
2508 2522
2509 DC::pango_init;
2510
2511 $FONT_PROP = new_from_file DC::Font $fonts[0]; 2523 $FONT_PROP = new_from_file DC::Font $fonts[0];
2512 $FONT_FIXED = new_from_file DC::Font $fonts[1]; 2524 $FONT_FIXED = new_from_file DC::Font $fonts[1];
2513 2525
2514 $FONT_PROP->make_default; 2526 $FONT_PROP->make_default;
2527
2528 DC::pango_init;
2515 } 2529 }
2516 2530
2517# compare mono (ft) vs. rgba (cairo) 2531# compare mono (ft) vs. rgba (cairo)
2518# ft - 1.8s, cairo 3s, even in alpha-only mode 2532# ft - 1.8s, cairo 3s, even in alpha-only mode
2519# for my $rgba (0..1) { 2533# for my $rgba (0..1) {
2536our $STARTUP_CANCEL = EV::idle sub { 2550our $STARTUP_CANCEL = EV::idle sub {
2537 undef $::STARTUP_CANCEL; 2551 undef $::STARTUP_CANCEL;
2538 $startup_done->(); 2552 $startup_done->();
2539}; 2553};
2540 2554
2555delete $SIG{__DIE__};
2541EV::loop; 2556EV::loop;
2542 2557
2543#video_shutdown; 2558#video_shutdown;
2544#audio_shutdown; 2559#audio_shutdown;
2545DC::OpenGL::quit; 2560DC::OpenGL::quit;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines