… | |
… | |
34 | use Crossfire::Protocol; |
34 | use Crossfire::Protocol; |
35 | |
35 | |
36 | use Compress::LZF; |
36 | use Compress::LZF; |
37 | |
37 | |
38 | use CFClient; |
38 | use CFClient; |
|
|
39 | use CFClient::OpenGL (); |
39 | use CFClient::UI; |
40 | use CFClient::UI; |
40 | use CFClient::MapWidget; |
41 | use CFClient::MapWidget; |
41 | |
42 | |
42 | $Event::DIED = sub { |
43 | $Event::DIED = sub { |
43 | # TODO: display dialog box or so |
44 | # TODO: display dialog box or so |
… | |
… | |
966 | or die "SDL_SetVideoMode failed: " . (CFClient::SDL_GetError) . "\n"; |
967 | or die "SDL_SetVideoMode failed: " . (CFClient::SDL_GetError) . "\n"; |
967 | |
968 | |
968 | $SDL_ACTIVE = 1; |
969 | $SDL_ACTIVE = 1; |
969 | $LAST_REFRESH = time - 0.01; |
970 | $LAST_REFRESH = time - 0.01; |
970 | |
971 | |
971 | CFClient::gl_init; |
972 | CFClient::OpenGL::init; |
972 | |
973 | |
973 | $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
974 | $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
974 | |
975 | |
975 | $CFClient::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d# |
976 | $CFClient::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d# |
976 | |
977 | |
… | |
… | |
1257 | $MAPWIDGET->clr_commands; |
1258 | $MAPWIDGET->clr_commands; |
1258 | |
1259 | |
1259 | my $parser = new Pod::POM; |
1260 | my $parser = new Pod::POM; |
1260 | my $pod = $parser->parse_file (CFClient::find_rcfile "pod/command_help.pod"); |
1261 | my $pod = $parser->parse_file (CFClient::find_rcfile "pod/command_help.pod"); |
1261 | |
1262 | |
1262 | for my $head2 ($pod->head2) { |
1263 | for my $head2 ($pod->head1->[-2]->head2) { |
1263 | $head2->title =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x |
1264 | $head2->title =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x |
1264 | or next; |
1265 | or next; |
1265 | |
1266 | |
1266 | my $cmd = $1; |
1267 | my $cmd = $1; |
1267 | my @args = split /\|/, $2; |
1268 | my @args = split /\|/, $2; |
… | |
… | |
1276 | } |
1277 | } |
1277 | } |
1278 | } |
1278 | |
1279 | |
1279 | $self->{noface} = new_from_file CFClient::Texture |
1280 | $self->{noface} = new_from_file CFClient::Texture |
1280 | CFClient::find_rcfile "noface.png", minify => 1, mipmap => 1; |
1281 | CFClient::find_rcfile "noface.png", minify => 1, mipmap => 1; |
|
|
1282 | |
|
|
1283 | $self->{open_container} = 0; |
1281 | |
1284 | |
1282 | $self |
1285 | $self |
1283 | } |
1286 | } |
1284 | |
1287 | |
1285 | sub conn::stats_update { |
1288 | sub conn::stats_update { |
… | |
… | |
1685 | my $parser = new Pod::POM; |
1688 | my $parser = new Pod::POM; |
1686 | my $pod = $parser->parse_file (CFClient::find_rcfile "pod/skill_help.pod"); |
1689 | my $pod = $parser->parse_file (CFClient::find_rcfile "pod/skill_help.pod"); |
1687 | |
1690 | |
1688 | my %skill_tooltip; |
1691 | my %skill_tooltip; |
1689 | |
1692 | |
1690 | for my $head2 ($pod->head2) { |
1693 | for my $head2 ($pod->head1->[-2]->head2) { |
1691 | $skill_tooltip{$head2->title} = CFClient::pod_to_pango $head2->content; |
1694 | $skill_tooltip{$head2->title} = CFClient::pod_to_pango $head2->content; |
1692 | } |
1695 | } |
1693 | |
1696 | |
1694 | for my $skill (values %{$self->{skill_info}}) { |
1697 | for my $skill (values %{$self->{skill_info}}) { |
1695 | $MAPWIDGET->add_command ("ready_skill $skill", |
1698 | $MAPWIDGET->add_command ("ready_skill $skill", |
… | |
… | |
1753 | sub update_floorbox { |
1756 | sub update_floorbox { |
1754 | $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { |
1757 | $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { |
1755 | return unless $CONN; |
1758 | return unless $CONN; |
1756 | |
1759 | |
1757 | $FLOORBOX->clear; |
1760 | $FLOORBOX->clear; |
1758 | $FLOORBOX->add (0, 1, new CFClient::UI::Empty expand => 1); |
|
|
1759 | |
1761 | |
1760 | my $row; |
1762 | my $row; |
1761 | for (@{ $CONN->{container}{0} }) { |
1763 | for (@{ $CONN->{container}{0} }) { |
1762 | if (++$row < 7) { |
1764 | if ($row < 7) { |
1763 | local $_->{face_widget}; # hack to force recreation of widget |
1765 | local $_->{face_widget}; # hack to force recreation of widget |
1764 | local $_->{desc_widget}; # hack to force recreation of widget |
1766 | local $_->{desc_widget}; # hack to force recreation of widget |
1765 | CFClient::Item::update_widgets $_; |
1767 | CFClient::Item::update_widgets $_; |
1766 | |
1768 | |
1767 | $FLOORBOX->add (0, $row, $_->{face_widget}); |
1769 | $FLOORBOX->add (0, $row, $_->{face_widget}); |
1768 | $FLOORBOX->add (1, $row, $_->{desc_widget}); |
1770 | $FLOORBOX->add (1, $row, $_->{desc_widget}); |
|
|
1771 | |
|
|
1772 | $row++; |
1769 | } else { |
1773 | } else { |
1770 | $FLOORBOX->add (new CFClient::UI::Label text => "More..."); |
1774 | $FLOORBOX->add (1, $row, new CFClient::UI::Label text => "More..."); |
1771 | last; |
1775 | last; |
1772 | } |
1776 | } |
1773 | } |
1777 | } |
1774 | }); |
1778 | }); |
1775 | |
1779 | |
… | |
… | |
1812 | |
1816 | |
1813 | #d# print "container_clear: container $tag ($self->{player}{tag})\n"; |
1817 | #d# print "container_clear: container $tag ($self->{player}{tag})\n"; |
1814 | |
1818 | |
1815 | if ($tag == 0) { |
1819 | if ($tag == 0) { |
1816 | update_floorbox; |
1820 | update_floorbox; |
|
|
1821 | update_container (0); |
1817 | } elsif ($tag == $self->{player}{tag}) { |
1822 | } elsif ($tag == $self->{player}{tag}) { |
1818 | $INV->set_items ($self->{container}{$tag}) |
1823 | $INV->set_items ($self->{container}{$tag}) |
1819 | } |
1824 | } |
1820 | |
1825 | |
1821 | # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; |
1826 | # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; |
… | |
… | |
1856 | } elsif ($item->{flags} & Crossfire::Protocol::F_OPEN) { |
1861 | } elsif ($item->{flags} & Crossfire::Protocol::F_OPEN) { |
1857 | set_opencont ($CONN, $item->{tag}, CFClient::Item::desc_string $item); |
1862 | set_opencont ($CONN, $item->{tag}, CFClient::Item::desc_string $item); |
1858 | } else { |
1863 | } else { |
1859 | if ($item->{container} == 0) { |
1864 | if ($item->{container} == 0) { |
1860 | update_floorbox; |
1865 | update_floorbox; |
|
|
1866 | update_container (0); |
1861 | } elsif ($item->{container} == $self->{player}{tag}) { |
1867 | } elsif ($item->{container} == $self->{player}{tag}) { |
1862 | $INV->set_items ($self->{container}{$item->{container}}) |
1868 | $INV->set_items ($self->{container}{$item->{container}}) |
1863 | } |
1869 | } |
1864 | } |
1870 | } |
1865 | } |
1871 | } |