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.150 by root, Mon Apr 16 21:06:37 2007 UTC vs.
Revision 1.162 by root, Thu Jul 5 07:06:05 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}
207 title => "Server Query", 229 title => "Server Query",
208 child => my $vbox = new CFPlus::UI::VBox, 230 child => my $vbox = new CFPlus::UI::VBox,
209 ; 231 ;
210 232
211 my @dialog = my $label = new CFPlus::UI::Label 233 my @dialog = my $label = new CFPlus::UI::Label
212 max_w => $::WIDTH * 0.4, 234 max_w => $::WIDTH * 0.8,
213 ellipsise => 0, 235 ellipsise => 0,
214 text => $prompt; 236 text => $prompt;
215 237
216 if ($flags & CS_QUERY_YESNO) { 238 if ($flags & CS_QUERY_YESNO) {
217 push @dialog, my $hbox = new CFPlus::UI::HBox; 239 push @dialog, my $hbox = new CFPlus::UI::HBox;
234 ); 256 );
235 257
236 $dialog->grab_focus; 258 $dialog->grab_focus;
237 259
238 } elsif ($flags & CS_QUERY_SINGLECHAR) { 260 } elsif ($flags & CS_QUERY_SINGLECHAR) {
239 $dialog->{tooltip} = "#charcreation_focus";
240
241 if ($prompt =~ /Now choose a character|Press any key for the next race/i) { 261 if ($prompt =~ /Now choose a character|Press any key for the next race/i) {
242 $MESSAGE_WINDOW->show; 262 $dialog->{tooltip} = "#charcreation_focus";
243 263
244 unshift @dialog, new CFPlus::UI::Label 264 unshift @dialog, new CFPlus::UI::Label
245 max_w => $::WIDTH * 0.4, 265 max_w => $::WIDTH * 0.8,
246 ellipsise => 0, 266 ellipsise => 0,
247 markup => "\nOr use your keyboard and the text entry below:\n"; 267 markup => "\nOr use your keyboard and the text entry below:\n";
248 268
249 unshift @dialog, my $table = new CFPlus::UI::Table; 269 unshift @dialog, my $table = new CFPlus::UI::Table;
250 270
262 $conn->send ("reply d"); 282 $conn->send ("reply d");
263 destroy_query_dialog $conn; 283 destroy_query_dialog $conn;
264 0 284 0
265 }, 285 },
266 ); 286 );
287
288 if ($conn->{chargen_race_description}) {
289 unshift @dialog, new CFPlus::UI::Label
290 max_w => $::WIDTH * 0.8,
291 ellipsise => 0,
292 markup => "<span foreground='#ccccff'>$conn->{chargen_race_description}</span>",
293 ;
294 }
295
296 unshift @dialog, new CFPlus::UI::Face
297 face => $conn->{player}{face},
298 bg => [.2, .2, .2, 1],
299 min_w => 64,
300 min_h => 64,
301 ;
302
303 if ($conn->{chargen_race_title}) {
304 unshift @dialog, new CFPlus::UI::Label
305 allign => 1,
306 ellipsise => 0,
307 markup => "<span foreground='#ccccff' size='large'>Race: $conn->{chargen_race_title}</span>",
308 ;
309 }
267 310
268 unshift @dialog, new CFPlus::UI::Label 311 unshift @dialog, new CFPlus::UI::Label
269 max_w => $::WIDTH * 0.4, 312 max_w => $::WIDTH * 0.4,
270 ellipsise => 0, 313 ellipsise => 0,
271 markup => (CFPlus::Pod::section_label ui => "chargen_race"), 314 markup => (CFPlus::Pod::section_label ui => "chargen_race"),
453 $LOGIN_BUTTON->set_text ("Login"); 496 $LOGIN_BUTTON->set_text ("Login");
454 $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); 497 $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER);
455 $SETUP_DIALOG->show; 498 $SETUP_DIALOG->show;
456 $PL_WINDOW->hide; 499 $PL_WINDOW->hide;
457 $SPELL_LIST->clear_spells; 500 $SPELL_LIST->clear_spells;
501 $CFPlus::UI::ROOT->emit (stop_game => ! ! $CONN);
458 502
459 return unless $CONN; 503 return unless $CONN;
460 504
461 status "connection closed"; 505 status "connection closed";
462 506
703 $table->add (1, 1, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2; 0 }); 747 $table->add (1, 1, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2; 0 });
704 $table->add (0, 2, new CFPlus::UI::Label text => "Show FPS"); 748 $table->add (0, 2, new CFPlus::UI::Label text => "Show FPS");
705 $table->add (1, 2, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); 749 $table->add (1, 2, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 });
706 $table->add (0, 3, new CFPlus::UI::Label text => "Suppress Tooltips"); 750 $table->add (0, 3, new CFPlus::UI::Label text => "Suppress Tooltips");
707 $table->add (1, 3, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); 751 $table->add (1, 3, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 });
708 $table->add (0, 4, new CFPlus::UI::Button text => "die on click(tm)", on_activate => sub { die "violator" } ); 752 $table->add (0, 4, new CFPlus::UI::Button text => "die on click(tm)", on_activate => sub { &CFPlus::debug() } );
709 753
710 my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05); 754 my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05);
711 755
712 for my $x (0..2) { 756 for my $x (0..2) {
713 for my $y (0 .. 2) { 757 for my $y (0 .. 2) {
1411 has_close_button => 1 1455 has_close_button => 1
1412 ; 1456 ;
1413 1457
1414 my $ntb = 1458 my $ntb =
1415 $PL_NOTEBOOK = 1459 $PL_NOTEBOOK =
1416 new CFPlus::UI::Notebook expand => 1, debug => 1; 1460 new CFPlus::UI::Notebook expand => 1;
1417 1461
1418 $ntb->add ( 1462 $ntb->add (
1419 "Statistics (F2)" => $STATS_PAGE = stats_window, 1463 "Statistics (F2)" => $STATS_PAGE = stats_window,
1420 "Shows statistics, where all your Stats and Resistances are shown." 1464 "Shows statistics, where all your Stats and Resistances are shown."
1421 ); 1465 );
1433 $ntb->add ( 1477 $ntb->add (
1434 "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget, 1478 "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget,
1435 "Toggles the inventory window, where you can manage your loot (or treasures :). " 1479 "Toggles the inventory window, where you can manage your loot (or treasures :). "
1436 . "You can also hit the <b>Tab</b>-key to show/hide the Inventory." 1480 . "You can also hit the <b>Tab</b>-key to show/hide the Inventory."
1437 ); 1481 );
1482 $ntb->add (Pickup => autopickup_setup,
1483 "Configure autopickup settings, i.e. which items you will pick up automatically when walking (or running) over them.");
1438 1484
1439 $ntb->set_current_page ($INVENTORY_PAGE); 1485 $ntb->set_current_page ($INVENTORY_PAGE);
1440 1486
1441 $plwin->add ($ntb); 1487 $plwin->add ($ntb);
1442 $plwin 1488 $plwin
1769 1815
1770 $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, 1816 $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup,
1771 "Configure the server to play on, your username, password and other server-related options."); 1817 "Configure the server to play on, your username, password and other server-related options.");
1772 $SETUP_NOTEBOOK->add (Client => client_setup, 1818 $SETUP_NOTEBOOK->add (Client => client_setup,
1773 "Configure various client-specific settings."); 1819 "Configure various client-specific settings.");
1774 $SETUP_NOTEBOOK->add (Pickup => autopickup_setup,
1775 "Configure autopickup settings, i.e. which items you will pick up automatically when walking (or running) over them.");
1776 $SETUP_NOTEBOOK->add (Graphics => graphics_setup, 1820 $SETUP_NOTEBOOK->add (Graphics => graphics_setup,
1777 "Configure the video mode, performance, fonts and other graphical aspects of the game."); 1821 "Configure the video mode, performance, fonts and other graphical aspects of the game.");
1778 $SETUP_NOTEBOOK->add (Audio => audio_setup, 1822 $SETUP_NOTEBOOK->add (Audio => audio_setup,
1779 "Configure the use of audio, sound effects and background music."); 1823 "Configure the use of audio, sound effects and background music.");
1780 $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, 1824 $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup,
2079 if $CONN; 2123 if $CONN;
2080}); 2124});
2081 2125
2082%SDL_CB = ( 2126%SDL_CB = (
2083 CFPlus::SDL_QUIT => sub { 2127 CFPlus::SDL_QUIT => sub {
2084 Event::unloop -1; 2128 exit;
2085 }, 2129 },
2086 CFPlus::SDL_VIDEORESIZE => sub { 2130 CFPlus::SDL_VIDEORESIZE => sub {
2087 }, 2131 },
2088 CFPlus::SDL_VIDEOEXPOSE => sub { 2132 CFPlus::SDL_VIDEOEXPOSE => sub {
2089 CFPlus::UI::full_refresh; 2133 CFPlus::UI::full_refresh;
2235Event::loop; 2279Event::loop;
2236#CFPlus::SDL_Quit; 2280#CFPlus::SDL_Quit;
2237#CFPlus::_exit 0; 2281#CFPlus::_exit 0;
2238 2282
2239END { 2283END {
2284 CFPlus::SDL_Quit;
2240 CFPlus::DB::Server::stop; 2285 CFPlus::DB::Server::stop;
2241 CFPlus::SDL_Quit;
2242} 2286}
2243 2287
2244=head1 NAME 2288=head1 NAME
2245 2289
2246cfplus - A Crossfire+ and Crossfire game client 2290cfplus - A Crossfire+ and Crossfire game client

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines