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

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.152 by root, Tue Apr 24 01:13:15 2007 UTC vs.
Revision 1.160 by root, Thu Jul 5 06:51:04 2007 UTC

1#!/opt/bin/perl 1#!/opt/bin/perl
2 2
3my $startup_done = sub { }; 3my $startup_done = sub { };
4our $PANGO = "1.5.0";
4 5
5# do splash-screen thingy on win32 6# do splash-screen thingy on win32
6BEGIN { 7BEGIN {
7 if (%PAR::LibCache && $^O eq "MSWin32") { 8 if (%PAR::LibCache && $^O eq "MSWin32") {
8 while (my ($filename, $zip) = each %PAR::LibCache) { 9 while (my ($filename, $zip) = each %PAR::LibCache) {
29# do things only needed for single-binary version (par) 30# do things only needed for single-binary version (par)
30BEGIN { 31BEGIN {
31 if (%PAR::LibCache) { 32 if (%PAR::LibCache) {
32 @INC = grep ref, @INC; # weed out all paths except pars loader refs 33 @INC = grep ref, @INC; # weed out all paths except pars loader refs
33 34
35 my $tmp = $ENV{PAR_TEMP};
36
34 while (my ($filename, $zip) = each %PAR::LibCache) { 37 while (my ($filename, $zip) = each %PAR::LibCache) {
35 for ($zip->memberNames) { 38 for ($zip->memberNames) {
36 next unless /^root\/(.*)/; 39 next unless /^root\/(.*)/;
37 $zip->extractMember ($_, "$ENV{PAR_TEMP}/$1") 40 $zip->extractMember ($_, "$tmp/$1")
38 unless -e "$ENV{PAR_TEMP}/$1"; 41 unless -e "$tmp/$1";
39 } 42 }
40 } 43 }
41 44
42 # TODO: pango-rc file, anybody? 45 if ($^O eq "MSWin32") {
46 # relocatable
47 } else {
48 # unix, need to patch pango rc file
49 open my $fh, "<:perlio", "$tmp/usr/lib/pango/$PANGO/module-files.d/libpango1.0-0.modules"
50 or die "$tmp/usr/lib/$PANGO/module-files.d/libpango1.0-0.modules: $!";
51 local $/;
52 my $rc = <$fh>;
53 $rc =~ s/^\//$tmp\//gm; # replace abs paths by relative ones
43 54
44 unshift @INC, $ENV{PAR_TEMP}; 55 mkdir "$tmp/pango-modules";
56 open my $fh, ">:perlio", "$tmp/pango-modules/pango.modules"
57 or die "$tmp/pango-modules/pango.modules: $!";
58 print $fh $rc;
59
60 $ENV{PANGO_RC_FILE} = "$tmp/pango.rc";
61 open my $fh, ">:perlio", $ENV{PANGO_RC_FILE}
62 or die "$ENV{PANGO_RC_FILE}: $!";
63 print $fh "[Pango]\nModuleFiles = $tmp/pango-modules\n";
64 }
65
66 unshift @INC, $tmp;
45 } 67 }
46} 68}
47 69
48# need to do it again because that pile of garbage called PAR nukes it before main 70# need to do it again because that pile of garbage called PAR nukes it before main
49unshift @INC, $ENV{PAR_TEMP} 71unshift @INC, $ENV{PAR_TEMP}
269 ellipsise => 0, 291 ellipsise => 0,
270 markup => "<span foreground='#ccccff'>$conn->{chargen_race_description}</span>", 292 markup => "<span foreground='#ccccff'>$conn->{chargen_race_description}</span>",
271 ; 293 ;
272 } 294 }
273 295
274 if ($conn->{chargen_race_title}) {
275 unshift @dialog, new CFPlus::UI::Face 296 unshift @dialog, new CFPlus::UI::Face
276 face => $conn->{player}{face}, 297 face => $conn->{player}{face},
277 bg => [.2, .2, .2, 1], 298 bg => [.2, .2, .2, 1],
278 min_w => 64, 299 min_w => 64,
279 min_h => 64, 300 min_h => 64,
280 ;
281 } 301 ;
282 302
283 if ($conn->{chargen_race_title}) { 303 if ($conn->{chargen_race_title}) {
284 unshift @dialog, new CFPlus::UI::Label 304 unshift @dialog, new CFPlus::UI::Label
285 allign => 1, 305 allign => 1,
286 ellipsise => 0, 306 ellipsise => 0,
425 445
426 my ($host, $port) = split /:/, $PROFILE->{host}; 446 my ($host, $port) = split /:/, $PROFILE->{host};
427 447
428 $MAP = new CFPlus::Map; 448 $MAP = new CFPlus::Map;
429 449
450 warn "connecting...\n";#d#
430 $CONN = eval { 451 $CONN = eval {
431 new CFPlus::Protocol 452 new CFPlus::Protocol
432 host => $host, 453 host => $host,
433 port => $port || 13327, 454 port => $port || 13327,
434 user => $PROFILE->{user}, 455 user => $PROFILE->{user},
459 or return; 480 or return;
460 481
461 $chunk->play; 482 $chunk->play;
462 }, 483 },
463 }; 484 };
485 warn "connected<$CONN>\n";#d#
464 486
465 if ($CONN) { 487 if ($CONN) {
466 CFPlus::lowdelay fileno $CONN->{fh}; 488 CFPlus::lowdelay fileno $CONN->{fh};
467 489
468 status "login successful"; 490 status "login successful";
476 $LOGIN_BUTTON->set_text ("Login"); 498 $LOGIN_BUTTON->set_text ("Login");
477 $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); 499 $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER);
478 $SETUP_DIALOG->show; 500 $SETUP_DIALOG->show;
479 $PL_WINDOW->hide; 501 $PL_WINDOW->hide;
480 $SPELL_LIST->clear_spells; 502 $SPELL_LIST->clear_spells;
503 $CFPlus::UI::ROOT->emit (stop_game => ! ! $CONN);
481 504
482 return unless $CONN; 505 return unless $CONN;
483 506
484 status "connection closed"; 507 status "connection closed";
485 508
726 $table->add (1, 1, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2; 0 }); 749 $table->add (1, 1, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2; 0 });
727 $table->add (0, 2, new CFPlus::UI::Label text => "Show FPS"); 750 $table->add (0, 2, new CFPlus::UI::Label text => "Show FPS");
728 $table->add (1, 2, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); 751 $table->add (1, 2, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 });
729 $table->add (0, 3, new CFPlus::UI::Label text => "Suppress Tooltips"); 752 $table->add (0, 3, new CFPlus::UI::Label text => "Suppress Tooltips");
730 $table->add (1, 3, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); 753 $table->add (1, 3, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 });
731 $table->add (0, 4, new CFPlus::UI::Button text => "die on click(tm)", on_activate => sub { die "violator" } ); 754 $table->add (0, 4, new CFPlus::UI::Button text => "die on click(tm)", on_activate => sub { &CFPlus::debug() } );
732 755
733 my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05); 756 my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05);
734 757
735 for my $x (0..2) { 758 for my $x (0..2) {
736 for my $y (0 .. 2) { 759 for my $y (0 .. 2) {
1434 has_close_button => 1 1457 has_close_button => 1
1435 ; 1458 ;
1436 1459
1437 my $ntb = 1460 my $ntb =
1438 $PL_NOTEBOOK = 1461 $PL_NOTEBOOK =
1439 new CFPlus::UI::Notebook expand => 1, debug => 1; 1462 new CFPlus::UI::Notebook expand => 1;
1440 1463
1441 $ntb->add ( 1464 $ntb->add (
1442 "Statistics (F2)" => $STATS_PAGE = stats_window, 1465 "Statistics (F2)" => $STATS_PAGE = stats_window,
1443 "Shows statistics, where all your Stats and Resistances are shown." 1466 "Shows statistics, where all your Stats and Resistances are shown."
1444 ); 1467 );
1456 $ntb->add ( 1479 $ntb->add (
1457 "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget, 1480 "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget,
1458 "Toggles the inventory window, where you can manage your loot (or treasures :). " 1481 "Toggles the inventory window, where you can manage your loot (or treasures :). "
1459 . "You can also hit the <b>Tab</b>-key to show/hide the Inventory." 1482 . "You can also hit the <b>Tab</b>-key to show/hide the Inventory."
1460 ); 1483 );
1484 $ntb->add (Pickup => autopickup_setup,
1485 "Configure autopickup settings, i.e. which items you will pick up automatically when walking (or running) over them.");
1461 1486
1462 $ntb->set_current_page ($INVENTORY_PAGE); 1487 $ntb->set_current_page ($INVENTORY_PAGE);
1463 1488
1464 $plwin->add ($ntb); 1489 $plwin->add ($ntb);
1465 $plwin 1490 $plwin
1792 1817
1793 $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, 1818 $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup,
1794 "Configure the server to play on, your username, password and other server-related options."); 1819 "Configure the server to play on, your username, password and other server-related options.");
1795 $SETUP_NOTEBOOK->add (Client => client_setup, 1820 $SETUP_NOTEBOOK->add (Client => client_setup,
1796 "Configure various client-specific settings."); 1821 "Configure various client-specific settings.");
1797 $SETUP_NOTEBOOK->add (Pickup => autopickup_setup,
1798 "Configure autopickup settings, i.e. which items you will pick up automatically when walking (or running) over them.");
1799 $SETUP_NOTEBOOK->add (Graphics => graphics_setup, 1822 $SETUP_NOTEBOOK->add (Graphics => graphics_setup,
1800 "Configure the video mode, performance, fonts and other graphical aspects of the game."); 1823 "Configure the video mode, performance, fonts and other graphical aspects of the game.");
1801 $SETUP_NOTEBOOK->add (Audio => audio_setup, 1824 $SETUP_NOTEBOOK->add (Audio => audio_setup,
1802 "Configure the use of audio, sound effects and background music."); 1825 "Configure the use of audio, sound effects and background music.");
1803 $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, 1826 $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines