… | |
… | |
86 | our $CONSOLE; |
86 | our $CONSOLE; |
87 | our $METASERVER; |
87 | our $METASERVER; |
88 | our $LOGIN_BUTTON; |
88 | our $LOGIN_BUTTON; |
89 | our $QUIT_DIALOG; |
89 | our $QUIT_DIALOG; |
90 | our $HOST_ENTRY; |
90 | our $HOST_ENTRY; |
|
|
91 | our $FULLSCREEN_ENABLE; |
91 | our $PICKUP_ENABLE; |
92 | our $PICKUP_ENABLE; |
92 | our $SERVER_INFO; |
93 | our $SERVER_INFO; |
93 | |
94 | |
94 | our $SETUP_DIALOG; |
95 | our $SETUP_DIALOG; |
95 | our $SETUP_NOTEBOOK; |
96 | our $SETUP_NOTEBOOK; |
… | |
… | |
99 | our $PL_NOTEBOOK; |
100 | our $PL_NOTEBOOK; |
100 | our $PL_WINDOW; |
101 | our $PL_WINDOW; |
101 | |
102 | |
102 | our $INVENTORY_PAGE; |
103 | our $INVENTORY_PAGE; |
103 | our $STATS_PAGE; |
104 | our $STATS_PAGE; |
|
|
105 | our $SKILL_PAGE; |
104 | our $SPELL_PAGE; |
106 | our $SPELL_PAGE; |
105 | |
107 | |
106 | our $HELP_WINDOW; |
108 | our $HELP_WINDOW; |
107 | our $MESSAGE_WINDOW; |
109 | our $MESSAGE_WINDOW; |
108 | our $FLOORBOX; |
110 | our $FLOORBOX; |
… | |
… | |
416 | $mode_slider->emit (changed => $mode_slider->{range}[0]); |
418 | $mode_slider->emit (changed => $mode_slider->{range}[0]); |
417 | |
419 | |
418 | my $row = 1; |
420 | my $row = 1; |
419 | |
421 | |
420 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen"); |
422 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen"); |
421 | $table->add (1, $row++, new CFClient::UI::CheckBox |
423 | $table->add (1, $row++, $FULLSCREEN_ENABLE = new CFClient::UI::CheckBox |
422 | state => $CFG->{fullscreen}, |
424 | state => $CFG->{fullscreen}, |
423 | tooltip => "Bring the client into fullscreen mode.", |
425 | tooltip => "Bring the client into fullscreen mode.", |
424 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
426 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
425 | ); |
427 | ); |
426 | |
428 | |
… | |
… | |
642 | |
644 | |
643 | $table |
645 | $table |
644 | } |
646 | } |
645 | |
647 | |
646 | sub stats_window { |
648 | sub stats_window { |
|
|
649 | my $r = |
|
|
650 | new CFClient::UI::ScrolledWindow ( |
|
|
651 | expand => 1, |
|
|
652 | scroll_y => 1 |
|
|
653 | ); |
647 | my $vb = new CFClient::UI::VBox; |
654 | $r->add (my $vb = new CFClient::UI::VBox); |
648 | |
655 | |
649 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
656 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
650 | can_hover => 1, can_events => 1, |
657 | can_hover => 1, can_events => 1, |
651 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
658 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
652 | $vb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1, |
659 | $vb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1, |
… | |
… | |
769 | $col += 3; |
776 | $col += 3; |
770 | $row = 0; |
777 | $row = 0; |
771 | } |
778 | } |
772 | } |
779 | } |
773 | |
780 | |
774 | update_stats_window ({}); |
781 | #update_stats_window ({}); |
775 | |
782 | |
776 | $vb |
783 | $r |
777 | } |
784 | } |
778 | |
785 | |
779 | sub skill_window { |
786 | sub skill_window { |
780 | my ($self) = @_; |
787 | my $sw = new CFClient::UI::ScrolledWindow (expand => 1); |
781 | $STATWIDS->{"_skill_tbl"} = new CFClient::UI::Table expand => 1; |
788 | $sw->add ($STATWIDS->{skill_tbl} = new CFClient::UI::Table expand => 1, col_expand => [0, 0, 1, 0, 0, 1]); |
|
|
789 | $sw |
782 | } |
790 | } |
783 | |
791 | |
784 | sub formsep($) { |
792 | sub formsep($) { |
785 | scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1 |
793 | scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1 |
786 | } |
|
|
787 | |
|
|
788 | sub update_stats_window { |
|
|
789 | my ($stats) = @_; |
|
|
790 | |
|
|
791 | # I love text protocols... |
|
|
792 | |
|
|
793 | my $hp = $stats->{+CS_STAT_HP} * 1; |
|
|
794 | my $hp_m = $stats->{+CS_STAT_MAXHP} * 1; |
|
|
795 | my $sp = $stats->{+CS_STAT_SP} * 1; |
|
|
796 | my $sp_m = $stats->{+CS_STAT_MAXSP} * 1; |
|
|
797 | my $fo = $stats->{+CS_STAT_FOOD} * 1; |
|
|
798 | my $fo_m = 999; |
|
|
799 | my $gr = $stats->{+CS_STAT_GRACE} * 1; |
|
|
800 | my $gr_m = $stats->{+CS_STAT_MAXGRACE} * 1; |
|
|
801 | |
|
|
802 | $GAUGES->{hp} ->set_value ($hp, $hp_m); |
|
|
803 | $GAUGES->{mana} ->set_value ($sp, $sp_m); |
|
|
804 | $GAUGES->{food} ->set_value ($fo, $fo_m); |
|
|
805 | $GAUGES->{grace} ->set_value ($gr, $gr_m); |
|
|
806 | $GAUGES->{exp} ->set_text ("Exp: " . (formsep $stats->{+CS_STAT_EXP64}) |
|
|
807 | . " (lvl " . ($stats->{+CS_STAT_LEVEL} * 1) . ")"); |
|
|
808 | my $rng = $stats->{+CS_STAT_RANGE}; |
|
|
809 | $rng =~ s/^Range: //; # thank you so much dear server |
|
|
810 | $GAUGES->{range} ->set_text ("Rng: " . $rng); |
|
|
811 | my $title = $stats->{+CS_STAT_TITLE}; |
|
|
812 | $title =~ s/^Player: //; |
|
|
813 | $STATWIDS->{title} ->set_text ("Title: " . $title); |
|
|
814 | |
|
|
815 | $STATWIDS->{st_str} ->set_text (sprintf "%d" , $stats->{+CS_STAT_STR}); |
|
|
816 | $STATWIDS->{st_dex} ->set_text (sprintf "%d" , $stats->{+CS_STAT_DEX}); |
|
|
817 | $STATWIDS->{st_con} ->set_text (sprintf "%d" , $stats->{+CS_STAT_CON}); |
|
|
818 | $STATWIDS->{st_int} ->set_text (sprintf "%d" , $stats->{+CS_STAT_INT}); |
|
|
819 | $STATWIDS->{st_wis} ->set_text (sprintf "%d" , $stats->{+CS_STAT_WIS}); |
|
|
820 | $STATWIDS->{st_pow} ->set_text (sprintf "%d" , $stats->{+CS_STAT_POW}); |
|
|
821 | $STATWIDS->{st_cha} ->set_text (sprintf "%d" , $stats->{+CS_STAT_CHA}); |
|
|
822 | $STATWIDS->{st_wc} ->set_text (sprintf "%d" , $stats->{+CS_STAT_WC}); |
|
|
823 | $STATWIDS->{st_ac} ->set_text (sprintf "%d" , $stats->{+CS_STAT_AC}); |
|
|
824 | $STATWIDS->{st_dam} ->set_text (sprintf "%d" , $stats->{+CS_STAT_DAM}); |
|
|
825 | $STATWIDS->{st_arm} ->set_text (sprintf "%d" , $stats->{+CS_STAT_RES_PHYS}); |
|
|
826 | $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); |
|
|
827 | $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP}); |
|
|
828 | |
|
|
829 | $STATWIDS->{m_weight}->set_text (sprintf "Max weight: %.1fkg", $stats->{+CS_STAT_WEIGHT_LIM} / 1000); |
|
|
830 | |
|
|
831 | my %tbl = ( |
|
|
832 | phys => CS_STAT_RES_PHYS, |
|
|
833 | magic => CS_STAT_RES_MAG, |
|
|
834 | fire => CS_STAT_RES_FIRE, |
|
|
835 | elec => CS_STAT_RES_ELEC, |
|
|
836 | cold => CS_STAT_RES_COLD, |
|
|
837 | conf => CS_STAT_RES_CONF, |
|
|
838 | acid => CS_STAT_RES_ACID, |
|
|
839 | drain => CS_STAT_RES_DRAIN, |
|
|
840 | ghit => CS_STAT_RES_GHOSTHIT, |
|
|
841 | pois => CS_STAT_RES_POISON, |
|
|
842 | slow => CS_STAT_RES_SLOW, |
|
|
843 | para => CS_STAT_RES_PARA, |
|
|
844 | tund => CS_STAT_TURN_UNDEAD, |
|
|
845 | fear => CS_STAT_RES_FEAR, |
|
|
846 | depl => CS_STAT_RES_DEPLETE, |
|
|
847 | deat => CS_STAT_RES_DEATH, |
|
|
848 | holyw => CS_STAT_RES_HOLYWORD, |
|
|
849 | blind => CS_STAT_RES_BLIND, |
|
|
850 | ); |
|
|
851 | |
|
|
852 | if ($::CONN && !$STATWIDS->{_skill_tbl_init}) { |
|
|
853 | my $sktbl = $STATWIDS->{_skill_tbl}; |
|
|
854 | $sktbl->clear; |
|
|
855 | |
|
|
856 | $sktbl->add (0, 0, new CFClient::UI::Label text => "Exp.", align => 1); |
|
|
857 | $sktbl->add (1, 0, new CFClient::UI::Label text => "Level", align => 1); |
|
|
858 | $sktbl->add (2, 0, new CFClient::UI::Label text => "Skillname"); |
|
|
859 | |
|
|
860 | my @skills; |
|
|
861 | |
|
|
862 | for (my $i = CS_STAT_SKILLINFO; $i < CS_STAT_SKILLINFO+CS_NUM_SKILLS; $i++) { |
|
|
863 | push @skills, [$i, $::CONN->{skill_info}{$i}]; |
|
|
864 | } |
|
|
865 | |
|
|
866 | my $y = 1; |
|
|
867 | for (sort { $a->[1] cmp $b->[1] } @skills) { |
|
|
868 | my ($idx, $name) = @$_; |
|
|
869 | |
|
|
870 | unless (defined $STATWIDS->{"sk_xp_$idx"} || !$::CONN->{skill_info}{$idx}) { |
|
|
871 | $sktbl->add (0, $y, $STATWIDS->{"sk_xp_$idx"} = new CFClient::UI::Label text => "0", align => 1); |
|
|
872 | $sktbl->add (1, $y, $STATWIDS->{"sk_lvl_$idx"} = new CFClient::UI::Label text => "0", align => 1); |
|
|
873 | $sktbl->add (2, $y++, new CFClient::UI::Label text => $name); |
|
|
874 | } |
|
|
875 | } |
|
|
876 | |
|
|
877 | $STATWIDS->{_skill_tbl_init} = 1; |
|
|
878 | } |
|
|
879 | |
|
|
880 | for (my $i = CS_STAT_SKILLINFO; $i < CS_STAT_SKILLINFO+CS_NUM_SKILLS; $i++) { |
|
|
881 | if (exists $stats->{$i}) { |
|
|
882 | $STATWIDS->{"sk_xp_$i"}->set_text (formsep $stats->{$i}->[1]) |
|
|
883 | if $STATWIDS->{"sk_xp_$i"}; |
|
|
884 | $STATWIDS->{"sk_lvl_$i"}->set_text (sprintf "%d", $stats->{$i}->[0]) |
|
|
885 | if $STATWIDS->{"sk_lvl_$i"}; |
|
|
886 | } |
|
|
887 | } |
|
|
888 | |
|
|
889 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) |
|
|
890 | for keys %tbl; |
|
|
891 | } |
794 | } |
892 | |
795 | |
893 | my $METASERVER_ATIME; |
796 | my $METASERVER_ATIME; |
894 | |
797 | |
895 | sub update_metaserver { |
798 | sub update_metaserver { |
… | |
… | |
1333 | sub inventory_widget { |
1236 | sub inventory_widget { |
1334 | my $hb = new CFClient::UI::HBox homogeneous => 1; |
1237 | my $hb = new CFClient::UI::HBox homogeneous => 1; |
1335 | |
1238 | |
1336 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
1239 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
1337 | $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); |
1240 | $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); |
|
|
1241 | $vb1->add (my $sw1 = new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1338 | $vb1->add ($INV = new CFClient::UI::Inventory); |
1242 | $sw1->add ($INV = new CFClient::UI::Inventory); |
1339 | |
1243 | |
1340 | $hb->add (my $vb2 = new CFClient::UI::VBox); |
1244 | $hb->add (my $vb2 = new CFClient::UI::VBox); |
1341 | |
1245 | |
1342 | $vb2->add ($INV_RIGHT_HB = new CFClient::UI::HBox); |
1246 | $vb2->add ($INV_RIGHT_HB = new CFClient::UI::HBox); |
1343 | |
1247 | |
|
|
1248 | $vb2->add (my $sw2 = new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1344 | $vb2->add ($INVR = new CFClient::UI::Inventory); |
1249 | $sw2->add ($INVR = new CFClient::UI::Inventory); |
1345 | |
1250 | |
1346 | # XXX: Call after $INVR = ... because set_opencont sets the items |
1251 | # XXX: Call after $INVR = ... because set_opencont sets the items |
1347 | CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); |
1252 | CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); |
1348 | |
1253 | |
1349 | $hb |
1254 | $hb |
… | |
… | |
1371 | has_close_button => 1 |
1276 | has_close_button => 1 |
1372 | ; |
1277 | ; |
1373 | |
1278 | |
1374 | my $ntb = |
1279 | my $ntb = |
1375 | $PL_NOTEBOOK = |
1280 | $PL_NOTEBOOK = |
1376 | new CFClient::UI::Notebook |
1281 | new CFClient::UI::Notebook expand => 1, debug => 1; |
1377 | expand => 1, |
|
|
1378 | debug => 1, |
|
|
1379 | filter => (new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1), |
|
|
1380 | ; |
|
|
1381 | |
1282 | |
1382 | $ntb->add ( |
1283 | $ntb->add ( |
1383 | "Stats" => $STATS_PAGE = stats_window, |
1284 | "Statistics (F2)" => $STATS_PAGE = stats_window, |
1384 | "Shows statistics, where all your Stats and Resistances are shown." |
1285 | "Shows statistics, where all your Stats and Resistances are shown." |
1385 | ); |
1286 | ); |
1386 | $ntb->add ( |
1287 | $ntb->add ( |
1387 | "Skills" => $STATS_PAGE = skill_window, |
1288 | "Skills (F3)" => $SKILL_PAGE = skill_window, |
1388 | "Shows all your Skills." |
1289 | "Shows all your Skills." |
1389 | ); |
1290 | ); |
|
|
1291 | |
|
|
1292 | my $spellsw = new CFClient::UI::ScrolledWindow (expand => 1, scroll_y => 1); |
|
|
1293 | $spellsw->add ($SPELL_PAGE = new CFClient::UI::SpellList); |
1390 | $ntb->add ( |
1294 | $ntb->add ( |
1391 | Spellbook => $SPELL_PAGE = new CFClient::UI::SpellList, |
1295 | "Spellbook (F4)" => $spellsw, |
1392 | "Displays all spells you have and lets you edit keyboard shortcuts for them." |
1296 | "Displays all spells you have and lets you edit keyboard shortcuts for them." |
1393 | ); |
1297 | ); |
1394 | $ntb->add ( |
1298 | $ntb->add ( |
1395 | Inventory => $INVENTORY_PAGE = inventory_widget, |
1299 | "Inventory (F5)" => $INVENTORY_PAGE = inventory_widget, |
1396 | "Toggles the inventory window, where you can manage your loot (or treasures :). " |
1300 | "Toggles the inventory window, where you can manage your loot (or treasures :). " |
1397 | . "You can also hit the <b>Tab</b>-key to show/hide the Inventory." |
1301 | . "You can also hit the <b>Tab</b>-key to show/hide the Inventory." |
1398 | ); |
1302 | ); |
1399 | |
1303 | |
1400 | $ntb->set_current_page ($INVENTORY_PAGE); |
1304 | $ntb->set_current_page ($INVENTORY_PAGE); |
… | |
… | |
1513 | $refresh->(); |
1417 | $refresh->(); |
1514 | |
1418 | |
1515 | $vb |
1419 | $vb |
1516 | } |
1420 | } |
1517 | |
1421 | |
|
|
1422 | # just weirdness, pls. ignore |
|
|
1423 | sub load_html_page { |
|
|
1424 | my ($viewer, $base) = @_; |
|
|
1425 | |
|
|
1426 | $viewer->clear; |
|
|
1427 | |
|
|
1428 | require LWP::Simple; |
|
|
1429 | require HTML::Parser; |
|
|
1430 | require URI; |
|
|
1431 | |
|
|
1432 | my $page = LWP::Simple::get ($base) |
|
|
1433 | or return; |
|
|
1434 | |
|
|
1435 | my @s = { }; |
|
|
1436 | my %passthrough = map ($_ => undef), qw(b i u s tt big small sub sup); |
|
|
1437 | |
|
|
1438 | my $parser = HTML::Parser->new ( |
|
|
1439 | text_h => [sub { |
|
|
1440 | my ($text) = @_; |
|
|
1441 | $text =~ s/\s+/ /g; |
|
|
1442 | $s[-1]{text} .= CFClient::UI::Label::escape $text; |
|
|
1443 | }, "dtext"], |
|
|
1444 | start_h => [sub { |
|
|
1445 | my ($tag, $attr) = @_; |
|
|
1446 | if ($passthrough{$tag}) { |
|
|
1447 | $s[-1]{text} .= "<$tag>"; |
|
|
1448 | } elsif ($tag eq "h1") { |
|
|
1449 | push @s, { text => "<span foreground='#ffff00' size='x-large'>" }; |
|
|
1450 | } elsif ($tag eq "h2") { |
|
|
1451 | push @s, { text => "<span foreground='#ccccff' size='large'>" }; |
|
|
1452 | } elsif ($tag eq "h3") { |
|
|
1453 | push @s, { text => "<span size='large'>" }; |
|
|
1454 | } elsif ($tag eq "a") { |
|
|
1455 | push @s, { text => "", url => $attr->{href} }; |
|
|
1456 | } elsif ($tag eq "p") { |
|
|
1457 | push @s, { }; |
|
|
1458 | } elsif ($tag eq "img") { |
|
|
1459 | eval { |
|
|
1460 | push @{$s[-1]{obj}}, new CFClient::UI::Image |
|
|
1461 | tex => (new_from_image CFClient::Texture LWP::Simple::get (URI->new ($attr->{src}, $base)->abs ($base))); |
|
|
1462 | $s[-1]{text} .= "\x{fffc}"; |
|
|
1463 | }; |
|
|
1464 | } |
|
|
1465 | }, "tagname, attr"], |
|
|
1466 | end_h => [sub { |
|
|
1467 | my ($tag) = @_; |
|
|
1468 | if ($passthrough{$tag}) { |
|
|
1469 | $s[-1]{text} .= "</$tag>"; |
|
|
1470 | } elsif ($tag =~ /^h\d$/) { |
|
|
1471 | $s[-1]{text} .= "</span>"; |
|
|
1472 | push @s, { }; |
|
|
1473 | } elsif ($tag eq "a") { |
|
|
1474 | my $S = pop @s; |
|
|
1475 | $s[-1]{text} .= "\x{fffc}"; |
|
|
1476 | push @{$s[-1]{obj}}, new CFClient::UI::Label |
|
|
1477 | fg => [0.8, 0.8, 1], |
|
|
1478 | markup => "<u>$S->{text}</u>", |
|
|
1479 | fontsize => 0.8, |
|
|
1480 | can_events => 1, |
|
|
1481 | can_focus => 1, |
|
|
1482 | on_button_up => sub { |
|
|
1483 | load_html_page ($viewer, URI->new ($S->{url}, $base)->abs ($base)); |
|
|
1484 | }, |
|
|
1485 | ; |
|
|
1486 | } |
|
|
1487 | }, "tagname"], |
|
|
1488 | ); |
|
|
1489 | |
|
|
1490 | $parser->parse ($page); |
|
|
1491 | $parser->eof; |
|
|
1492 | |
|
|
1493 | $viewer->add_paragraph ([1, 1, 1, 1], [$_->{text}, @{ $_->{obj} || [] }], $_->{indent}) |
|
|
1494 | for @s; |
|
|
1495 | |
|
|
1496 | $viewer->set_offset (0); |
|
|
1497 | } |
|
|
1498 | |
1518 | sub help_window { |
1499 | sub help_window { |
1519 | my $win = new CFClient::UI::FancyFrame |
1500 | my $win = new CFClient::UI::FancyFrame |
1520 | x => 'center', |
1501 | x => 'center', |
1521 | y => 'center', |
1502 | y => 'center', |
1522 | z => 2, |
1503 | z => 2, |
… | |
… | |
1540 | [manual => "Main Manual"], |
1521 | [manual => "Main Manual"], |
1541 | [skill_help => "Skill Reference"], |
1522 | [skill_help => "Skill Reference"], |
1542 | [command_help => "Command Reference"], |
1523 | [command_help => "Command Reference"], |
1543 | [dmcommand_help => "DM Commands"], |
1524 | [dmcommand_help => "DM Commands"], |
1544 | [COPYING => "License Terms"], |
1525 | [COPYING => "License Terms"], |
|
|
1526 | [test => "test (do not select)"], #d#TODO |
1545 | ], |
1527 | ], |
1546 | on_changed => sub { |
1528 | on_changed => sub { |
1547 | my ($self, $pod) = @_; |
1529 | my ($self, $pod) = @_; |
|
|
1530 | |
|
|
1531 | if ($pod eq "test") {#d#TODO |
|
|
1532 | eval { |
|
|
1533 | load_html_page $viewer, "http://crossfire.real-time.com/guides/walkthrough/newbie-tower.html"; |
|
|
1534 | }; |
|
|
1535 | warn "$@" if $@; |
|
|
1536 | return; |
|
|
1537 | } |
1548 | |
1538 | |
1549 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1539 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1550 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1540 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1551 | |
1541 | |
1552 | $viewer->clear; |
1542 | $viewer->clear; |
… | |
… | |
1939 | # printf "active %x %x\n", $SDL_EV->active_gain, $SDL_EV->active_state;#d# |
1929 | # printf "active %x %x\n", $SDL_EV->active_gain, $SDL_EV->active_state;#d# |
1940 | }, |
1930 | }, |
1941 | CFClient::SDL_KEYDOWN => sub { |
1931 | CFClient::SDL_KEYDOWN => sub { |
1942 | if ($_[0]{mod} & CFClient::KMOD_ALT && $_[0]{sym} == 13) { |
1932 | if ($_[0]{mod} & CFClient::KMOD_ALT && $_[0]{sym} == 13) { |
1943 | # alt-enter |
1933 | # alt-enter |
|
|
1934 | $FULLSCREEN_ENABLE->toggle; |
1944 | video_shutdown; |
1935 | video_shutdown; |
1945 | $CFG->{fullscreen} = !$CFG->{fullscreen}; |
|
|
1946 | video_init; |
1936 | video_init; |
1947 | } else { |
1937 | } else { |
1948 | CFClient::UI::feed_sdl_key_down_event ($_[0]); |
1938 | CFClient::UI::feed_sdl_key_down_event ($_[0]); |
1949 | } |
1939 | } |
1950 | }, |
1940 | }, |
… | |
… | |
1966 | $SIG{INT} = $SIG{TERM} = sub { exit }; |
1956 | $SIG{INT} = $SIG{TERM} = sub { exit }; |
1967 | |
1957 | |
1968 | { |
1958 | { |
1969 | local $SIG{__DIE__} = sub { |
1959 | local $SIG{__DIE__} = sub { |
1970 | return unless defined $^S && !$^S; |
1960 | return unless defined $^S && !$^S; |
1971 | Carp::confess $_[1];#d#TODO: remove when stable |
1961 | Carp::confess $_[0];#d#TODO: remove when stable |
1972 | CFClient::fatal $_[0]; |
1962 | CFClient::fatal $_[0]; |
1973 | }; |
1963 | }; |
1974 | |
1964 | |
1975 | CFClient::read_cfg "$Crossfire::VARDIR/cfplusrc"; |
1965 | CFClient::read_cfg "$Crossfire::VARDIR/cfplusrc"; |
1976 | CFClient::UI::set_layout ($::CFG->{layout}); |
1966 | CFClient::UI::set_layout ($::CFG->{layout}); |