… | |
… | |
29 | # do things only needed for single-binary version (par) |
29 | # do things only needed for single-binary version (par) |
30 | BEGIN { |
30 | BEGIN { |
31 | if (%PAR::LibCache) { |
31 | if (%PAR::LibCache) { |
32 | @INC = grep ref, @INC; # weed out all paths except pars loader refs |
32 | @INC = grep ref, @INC; # weed out all paths except pars loader refs |
33 | |
33 | |
|
|
34 | my $tmp = $ENV{PAR_TEMP}; |
|
|
35 | |
34 | while (my ($filename, $zip) = each %PAR::LibCache) { |
36 | while (my ($filename, $zip) = each %PAR::LibCache) { |
35 | for ($zip->memberNames) { |
37 | for ($zip->memberNames) { |
36 | next unless /^root\/(.*)/; |
38 | next unless /^root\/(.*)/; |
37 | $zip->extractMember ($_, "$ENV{PAR_TEMP}/$1") |
39 | $zip->extractMember ($_, "$tmp/$1") |
38 | unless -e "$ENV{PAR_TEMP}/$1"; |
40 | unless -e "$tmp/$1"; |
39 | } |
41 | } |
40 | } |
42 | } |
41 | |
43 | |
42 | # TODO: pango-rc file, anybody? |
44 | if ($^O eq "MSWin32") { |
|
|
45 | # relocatable |
|
|
46 | } else { |
|
|
47 | # unix, need to patch pango rc file |
|
|
48 | open my $fh, "<:perlio", "$tmp/usr/lib/pango/1.5.0/module-files.d/libpango1.0-0.modules" |
|
|
49 | or die "$tmp/usr/lib/1.5.0/module-files.d/libpango1.0-0.modules: $!"; |
|
|
50 | local $/; |
|
|
51 | my $rc = <$fh>; |
|
|
52 | $rc =~ s/^\//$tmp\//gm; # replace abs paths by relative ones |
43 | |
53 | |
44 | unshift @INC, $ENV{PAR_TEMP}; |
54 | mkdir "$tmp/pango-modules"; |
|
|
55 | open my $fh, ">:perlio", "$tmp/pango-modules/pango.modules" |
|
|
56 | or die "$tmp/pango-modules/pango.modules: $!"; |
|
|
57 | print $fh $rc; |
|
|
58 | |
|
|
59 | $ENV{PANGO_RC_FILE} = "$tmp/pango.rc"; |
|
|
60 | open my $fh, ">:perlio", $ENV{PANGO_RC_FILE} |
|
|
61 | or die "$ENV{PANGO_RC_FILE}: $!"; |
|
|
62 | print $fh "[Pango]\nModuleFiles = $tmp/pango-modules\n"; |
|
|
63 | } |
|
|
64 | |
|
|
65 | unshift @INC, $tmp; |
45 | } |
66 | } |
46 | } |
67 | } |
47 | |
68 | |
48 | # need to do it again because that pile of garbage called PAR nukes it before main |
69 | # need to do it again because that pile of garbage called PAR nukes it before main |
49 | unshift @INC, $ENV{PAR_TEMP} |
70 | unshift @INC, $ENV{PAR_TEMP} |
… | |
… | |
207 | title => "Server Query", |
228 | title => "Server Query", |
208 | child => my $vbox = new CFPlus::UI::VBox, |
229 | child => my $vbox = new CFPlus::UI::VBox, |
209 | ; |
230 | ; |
210 | |
231 | |
211 | my @dialog = my $label = new CFPlus::UI::Label |
232 | my @dialog = my $label = new CFPlus::UI::Label |
212 | max_w => $::WIDTH * 0.4, |
233 | max_w => $::WIDTH * 0.8, |
213 | ellipsise => 0, |
234 | ellipsise => 0, |
214 | text => $prompt; |
235 | text => $prompt; |
215 | |
236 | |
216 | if ($flags & CS_QUERY_YESNO) { |
237 | if ($flags & CS_QUERY_YESNO) { |
217 | push @dialog, my $hbox = new CFPlus::UI::HBox; |
238 | push @dialog, my $hbox = new CFPlus::UI::HBox; |
… | |
… | |
234 | ); |
255 | ); |
235 | |
256 | |
236 | $dialog->grab_focus; |
257 | $dialog->grab_focus; |
237 | |
258 | |
238 | } elsif ($flags & CS_QUERY_SINGLECHAR) { |
259 | } 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) { |
260 | if ($prompt =~ /Now choose a character|Press any key for the next race/i) { |
242 | $MESSAGE_WINDOW->show; |
261 | $dialog->{tooltip} = "#charcreation_focus"; |
243 | |
262 | |
244 | unshift @dialog, new CFPlus::UI::Label |
263 | unshift @dialog, new CFPlus::UI::Label |
245 | max_w => $::WIDTH * 0.4, |
264 | max_w => $::WIDTH * 0.8, |
246 | ellipsise => 0, |
265 | ellipsise => 0, |
247 | markup => "\nOr use your keyboard and the text entry below:\n"; |
266 | markup => "\nOr use your keyboard and the text entry below:\n"; |
248 | |
267 | |
249 | unshift @dialog, my $table = new CFPlus::UI::Table; |
268 | unshift @dialog, my $table = new CFPlus::UI::Table; |
250 | |
269 | |
… | |
… | |
262 | $conn->send ("reply d"); |
281 | $conn->send ("reply d"); |
263 | destroy_query_dialog $conn; |
282 | destroy_query_dialog $conn; |
264 | 0 |
283 | 0 |
265 | }, |
284 | }, |
266 | ); |
285 | ); |
|
|
286 | |
|
|
287 | if ($conn->{chargen_race_description}) { |
|
|
288 | unshift @dialog, new CFPlus::UI::Label |
|
|
289 | max_w => $::WIDTH * 0.8, |
|
|
290 | ellipsise => 0, |
|
|
291 | markup => "<span foreground='#ccccff'>$conn->{chargen_race_description}</span>", |
|
|
292 | ; |
|
|
293 | } |
|
|
294 | |
|
|
295 | unshift @dialog, new CFPlus::UI::Face |
|
|
296 | face => $conn->{player}{face}, |
|
|
297 | bg => [.2, .2, .2, 1], |
|
|
298 | min_w => 64, |
|
|
299 | min_h => 64, |
|
|
300 | ; |
|
|
301 | |
|
|
302 | if ($conn->{chargen_race_title}) { |
|
|
303 | unshift @dialog, new CFPlus::UI::Label |
|
|
304 | allign => 1, |
|
|
305 | ellipsise => 0, |
|
|
306 | markup => "<span foreground='#ccccff' size='large'>Race: $conn->{chargen_race_title}</span>", |
|
|
307 | ; |
|
|
308 | } |
267 | |
309 | |
268 | unshift @dialog, new CFPlus::UI::Label |
310 | unshift @dialog, new CFPlus::UI::Label |
269 | max_w => $::WIDTH * 0.4, |
311 | max_w => $::WIDTH * 0.4, |
270 | ellipsise => 0, |
312 | ellipsise => 0, |
271 | markup => (CFPlus::Pod::section_label ui => "chargen_race"), |
313 | markup => (CFPlus::Pod::section_label ui => "chargen_race"), |
… | |
… | |
453 | $LOGIN_BUTTON->set_text ("Login"); |
495 | $LOGIN_BUTTON->set_text ("Login"); |
454 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
496 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
455 | $SETUP_DIALOG->show; |
497 | $SETUP_DIALOG->show; |
456 | $PL_WINDOW->hide; |
498 | $PL_WINDOW->hide; |
457 | $SPELL_LIST->clear_spells; |
499 | $SPELL_LIST->clear_spells; |
|
|
500 | $CFPlus::UI::ROOT->emit (stop_game => ! ! $CONN); |
458 | |
501 | |
459 | return unless $CONN; |
502 | return unless $CONN; |
460 | |
503 | |
461 | status "connection closed"; |
504 | status "connection closed"; |
462 | |
505 | |
… | |
… | |
703 | $table->add (1, 1, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2; 0 }); |
746 | $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"); |
747 | $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 }); |
748 | $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"); |
749 | $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 }); |
750 | $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" } ); |
751 | $table->add (0, 4, new CFPlus::UI::Button text => "die on click(tm)", on_activate => sub { &CFPlus::debug() } ); |
709 | |
752 | |
710 | my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05); |
753 | my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05); |
711 | |
754 | |
712 | for my $x (0..2) { |
755 | for my $x (0..2) { |
713 | for my $y (0 .. 2) { |
756 | for my $y (0 .. 2) { |
… | |
… | |
1411 | has_close_button => 1 |
1454 | has_close_button => 1 |
1412 | ; |
1455 | ; |
1413 | |
1456 | |
1414 | my $ntb = |
1457 | my $ntb = |
1415 | $PL_NOTEBOOK = |
1458 | $PL_NOTEBOOK = |
1416 | new CFPlus::UI::Notebook expand => 1, debug => 1; |
1459 | new CFPlus::UI::Notebook expand => 1; |
1417 | |
1460 | |
1418 | $ntb->add ( |
1461 | $ntb->add ( |
1419 | "Statistics (F2)" => $STATS_PAGE = stats_window, |
1462 | "Statistics (F2)" => $STATS_PAGE = stats_window, |
1420 | "Shows statistics, where all your Stats and Resistances are shown." |
1463 | "Shows statistics, where all your Stats and Resistances are shown." |
1421 | ); |
1464 | ); |
… | |
… | |
1433 | $ntb->add ( |
1476 | $ntb->add ( |
1434 | "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget, |
1477 | "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget, |
1435 | "Toggles the inventory window, where you can manage your loot (or treasures :). " |
1478 | "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." |
1479 | . "You can also hit the <b>Tab</b>-key to show/hide the Inventory." |
1437 | ); |
1480 | ); |
|
|
1481 | $ntb->add (Pickup => autopickup_setup, |
|
|
1482 | "Configure autopickup settings, i.e. which items you will pick up automatically when walking (or running) over them."); |
1438 | |
1483 | |
1439 | $ntb->set_current_page ($INVENTORY_PAGE); |
1484 | $ntb->set_current_page ($INVENTORY_PAGE); |
1440 | |
1485 | |
1441 | $plwin->add ($ntb); |
1486 | $plwin->add ($ntb); |
1442 | $plwin |
1487 | $plwin |
… | |
… | |
1769 | |
1814 | |
1770 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
1815 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
1771 | "Configure the server to play on, your username, password and other server-related options."); |
1816 | "Configure the server to play on, your username, password and other server-related options."); |
1772 | $SETUP_NOTEBOOK->add (Client => client_setup, |
1817 | $SETUP_NOTEBOOK->add (Client => client_setup, |
1773 | "Configure various client-specific settings."); |
1818 | "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, |
1819 | $SETUP_NOTEBOOK->add (Graphics => graphics_setup, |
1777 | "Configure the video mode, performance, fonts and other graphical aspects of the game."); |
1820 | "Configure the video mode, performance, fonts and other graphical aspects of the game."); |
1778 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
1821 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
1779 | "Configure the use of audio, sound effects and background music."); |
1822 | "Configure the use of audio, sound effects and background music."); |
1780 | $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, |
1823 | $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, |
… | |
… | |
2079 | if $CONN; |
2122 | if $CONN; |
2080 | }); |
2123 | }); |
2081 | |
2124 | |
2082 | %SDL_CB = ( |
2125 | %SDL_CB = ( |
2083 | CFPlus::SDL_QUIT => sub { |
2126 | CFPlus::SDL_QUIT => sub { |
2084 | Event::unloop -1; |
2127 | exit; |
2085 | }, |
2128 | }, |
2086 | CFPlus::SDL_VIDEORESIZE => sub { |
2129 | CFPlus::SDL_VIDEORESIZE => sub { |
2087 | }, |
2130 | }, |
2088 | CFPlus::SDL_VIDEOEXPOSE => sub { |
2131 | CFPlus::SDL_VIDEOEXPOSE => sub { |
2089 | CFPlus::UI::full_refresh; |
2132 | CFPlus::UI::full_refresh; |
… | |
… | |
2234 | |
2277 | |
2235 | Event::loop; |
2278 | Event::loop; |
2236 | #CFPlus::SDL_Quit; |
2279 | #CFPlus::SDL_Quit; |
2237 | #CFPlus::_exit 0; |
2280 | #CFPlus::_exit 0; |
2238 | |
2281 | |
|
|
2282 | END { |
2239 | END { CFPlus::SDL_Quit } |
2283 | CFPlus::SDL_Quit; |
|
|
2284 | CFPlus::DB::Server::stop; |
|
|
2285 | } |
2240 | |
2286 | |
2241 | =head1 NAME |
2287 | =head1 NAME |
2242 | |
2288 | |
2243 | cfplus - A Crossfire+ and Crossfire game client |
2289 | cfplus - A Crossfire+ and Crossfire game client |
2244 | |
2290 | |