1 | #!/opt/bin/perl |
1 | #!/opt/bin/perl |
2 | |
2 | |
3 | my $startup_done = sub { }; |
3 | my $startup_done = sub { }; |
|
|
4 | our $PANGO = "1.5.0"; |
4 | |
5 | |
5 | # do splash-screen thingy on win32 |
6 | # do splash-screen thingy on win32 |
6 | BEGIN { |
7 | BEGIN { |
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) |
30 | BEGIN { |
31 | BEGIN { |
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 |
49 | unshift @INC, $ENV{PAR_TEMP} |
71 | unshift @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"), |
… | |
… | |
402 | |
445 | |
403 | my ($host, $port) = split /:/, $PROFILE->{host}; |
446 | my ($host, $port) = split /:/, $PROFILE->{host}; |
404 | |
447 | |
405 | $MAP = new CFPlus::Map; |
448 | $MAP = new CFPlus::Map; |
406 | |
449 | |
|
|
450 | warn "connecting...\n";#d# |
407 | $CONN = eval { |
451 | $CONN = eval { |
408 | new CFPlus::Protocol |
452 | new CFPlus::Protocol |
409 | host => $host, |
453 | host => $host, |
410 | port => $port || 13327, |
454 | port => $port || 13327, |
411 | user => $PROFILE->{user}, |
455 | user => $PROFILE->{user}, |
… | |
… | |
436 | or return; |
480 | or return; |
437 | |
481 | |
438 | $chunk->play; |
482 | $chunk->play; |
439 | }, |
483 | }, |
440 | }; |
484 | }; |
|
|
485 | warn "connected<$CONN,$@>\n";#d# |
441 | |
486 | |
442 | if ($CONN) { |
487 | if ($CONN) { |
443 | CFPlus::lowdelay fileno $CONN->{fh}; |
488 | CFPlus::lowdelay fileno $CONN->{fh}; |
444 | |
489 | |
445 | status "login successful"; |
490 | status "login successful"; |
… | |
… | |
453 | $LOGIN_BUTTON->set_text ("Login"); |
498 | $LOGIN_BUTTON->set_text ("Login"); |
454 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
499 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
455 | $SETUP_DIALOG->show; |
500 | $SETUP_DIALOG->show; |
456 | $PL_WINDOW->hide; |
501 | $PL_WINDOW->hide; |
457 | $SPELL_LIST->clear_spells; |
502 | $SPELL_LIST->clear_spells; |
|
|
503 | $CFPlus::UI::ROOT->emit (stop_game => ! ! $CONN); |
458 | |
504 | |
459 | return unless $CONN; |
505 | return unless $CONN; |
460 | |
506 | |
461 | status "connection closed"; |
507 | status "connection closed"; |
462 | |
508 | |
… | |
… | |
703 | $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 }); |
704 | $table->add (0, 2, new CFPlus::UI::Label text => "Show FPS"); |
750 | $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 }); |
751 | $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"); |
752 | $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 }); |
753 | $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" } ); |
754 | $table->add (0, 4, new CFPlus::UI::Button text => "die on click(tm)", on_activate => sub { &CFPlus::debug() } ); |
709 | |
755 | |
710 | 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); |
711 | |
757 | |
712 | for my $x (0..2) { |
758 | for my $x (0..2) { |
713 | for my $y (0 .. 2) { |
759 | for my $y (0 .. 2) { |
… | |
… | |
1411 | has_close_button => 1 |
1457 | has_close_button => 1 |
1412 | ; |
1458 | ; |
1413 | |
1459 | |
1414 | my $ntb = |
1460 | my $ntb = |
1415 | $PL_NOTEBOOK = |
1461 | $PL_NOTEBOOK = |
1416 | new CFPlus::UI::Notebook expand => 1, debug => 1; |
1462 | new CFPlus::UI::Notebook expand => 1; |
1417 | |
1463 | |
1418 | $ntb->add ( |
1464 | $ntb->add ( |
1419 | "Statistics (F2)" => $STATS_PAGE = stats_window, |
1465 | "Statistics (F2)" => $STATS_PAGE = stats_window, |
1420 | "Shows statistics, where all your Stats and Resistances are shown." |
1466 | "Shows statistics, where all your Stats and Resistances are shown." |
1421 | ); |
1467 | ); |
… | |
… | |
1433 | $ntb->add ( |
1479 | $ntb->add ( |
1434 | "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget, |
1480 | "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget, |
1435 | "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 :). " |
1436 | . "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." |
1437 | ); |
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."); |
1438 | |
1486 | |
1439 | $ntb->set_current_page ($INVENTORY_PAGE); |
1487 | $ntb->set_current_page ($INVENTORY_PAGE); |
1440 | |
1488 | |
1441 | $plwin->add ($ntb); |
1489 | $plwin->add ($ntb); |
1442 | $plwin |
1490 | $plwin |
… | |
… | |
1769 | |
1817 | |
1770 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
1818 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
1771 | "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."); |
1772 | $SETUP_NOTEBOOK->add (Client => client_setup, |
1820 | $SETUP_NOTEBOOK->add (Client => client_setup, |
1773 | "Configure various client-specific settings."); |
1821 | "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, |
1822 | $SETUP_NOTEBOOK->add (Graphics => graphics_setup, |
1777 | "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."); |
1778 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
1824 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
1779 | "Configure the use of audio, sound effects and background music."); |
1825 | "Configure the use of audio, sound effects and background music."); |
1780 | $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, |
1826 | $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, |