ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/pclient
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/pclient (file contents):
Revision 1.201 by root, Mon May 8 18:31:01 2006 UTC vs.
Revision 1.203 by root, Mon May 8 20:55:49 2006 UTC

828 828
829 CFClient::SDL_SetVideoMode $WIDTH, $HEIGHT, $FULLSCREEN 829 CFClient::SDL_SetVideoMode $WIDTH, $HEIGHT, $FULLSCREEN
830 or die "SDL_SetVideoMode failed!\n"; 830 or die "SDL_SetVideoMode failed!\n";
831 831
832 $SDL_ACTIVE = 1; 832 $SDL_ACTIVE = 1;
833
834 $LAST_REFRESH = time - 0.01; 833 $LAST_REFRESH = time - 0.01;
835 834
836 CFClient::gl_init; 835 CFClient::gl_init;
837 836
838 $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; 837 $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize};
839 838
839 $CFClient::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d#
840
840 ############################################################################# 841 #############################################################################
841 842
843 if ($DEBUG_STATUS) {
844 # reconfigure all widgets
845 $CFClient::UI::ROOT->reconfigure;
846
847 } else {
848 # create the widgets
849
842 $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100; 850 $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100;
843 $DEBUG_STATUS->show; 851 $DEBUG_STATUS->show;
844 852
845 $STATUS_LINE = new CFClient::UI::Label 853 $STATUS_LINE = new CFClient::UI::Label
846 padding => 0, 854 padding => 0,
847 y => $HEIGHT - $FONTSIZE * 1.8; 855 y => $HEIGHT - $FONTSIZE * 1.8;
848 $STATUS_LINE->show; 856 $STATUS_LINE->show;
849 857
850 $ALT_ENTER_MESSAGE = new CFClient::UI::Label 858 $ALT_ENTER_MESSAGE = new CFClient::UI::Label
851 padding => 0, 859 padding => 0,
852 fontsize => 0.8, 860 fontsize => 0.8,
853 markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode"; 861 markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode";
854 $ALT_ENTER_MESSAGE->show; 862 $ALT_ENTER_MESSAGE->show;
855 $ALT_ENTER_MESSAGE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h}); 863 $ALT_ENTER_MESSAGE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h});
856 864
857 CFClient::UI::FancyFrame->new ( 865 CFClient::UI::FancyFrame->new (
858 border_bg => [1, 1, 1, 192/255], 866 border_bg => [1, 1, 1, 192/255],
859 bg => [1, 1, 1, 0], 867 bg => [1, 1, 1, 0],
860 child => ($MAPMAP = new CFClient::MapWidget::MapMap), 868 child => ($MAPMAP = new CFClient::MapWidget::MapMap),
861 )->show; 869 )->show;
862 870
863 $MAPWIDGET = new CFClient::MapWidget; 871 $MAPWIDGET = new CFClient::MapWidget;
864 $MAPWIDGET->connect (activate_console => sub { 872 $MAPWIDGET->connect (activate_console => sub {
865 my ($mapwidget, $preset) = @_; 873 my ($mapwidget, $preset) = @_;
866 874
867 if ($CONSOLE) { 875 if ($CONSOLE) {
868 $CONSOLE->{input}->{auto_activated} = 1; 876 $CONSOLE->{input}->{auto_activated} = 1;
869 $CONSOLE->{input}->focus_in; 877 $CONSOLE->{input}->focus_in;
870 878
871 if ($preset && $CONSOLE->{input}->get_text eq '') { 879 if ($preset && $CONSOLE->{input}->get_text eq '') {
872 $CONSOLE->{input}->set_text ($preset); 880 $CONSOLE->{input}->set_text ($preset);
881 }
873 } 882 }
874 } 883 });
875 });
876 $MAPWIDGET->show; 884 $MAPWIDGET->show;
877 $MAPWIDGET->focus_in; 885 $MAPWIDGET->focus_in;
878 886
879 $BUTTONBAR = new CFClient::UI::HBox; 887 $BUTTONBAR = new CFClient::UI::HBox;
880 888
881 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); 889 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup);
882 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); 890 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup);
883 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); 891 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window);
884 892
885 make_gauge_window->show; # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D 893 make_gauge_window->show; # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D
886 894
887 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window); 895 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window);
888 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window); 896 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window);
889 897
890 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { 898 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub {
891 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; 899 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc";
892 status "Configuration Saved"; 900 status "Configuration Saved";
893 }); 901 });
894 902
895 $BUTTONBAR->show; 903 $BUTTONBAR->show;
896 904
897 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup 905 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup
906 }
898} 907}
899 908
900sub video_shutdown { 909sub video_shutdown {
901 $CFClient::UI::ROOT->{children} = [];
902 undef $CFClient::UI::GRAB;
903 undef $CFClient::UI::HOVER;
904 undef $SDL_ACTIVE; 910 undef $SDL_ACTIVE;
905} 911}
906 912
907my @bgmusic = qw(game1.ogg game2.ogg game3.ogg game5.ogg game6.ogg ross1.ogg ross2.ogg ross3.ogg ross4.ogg ross5.ogg); #d# 913my @bgmusic = qw(game1.ogg game2.ogg game3.ogg game5.ogg game6.ogg ross1.ogg ross2.ogg ross3.ogg ross4.ogg ross5.ogg); #d#
908my $bgmusic;#TODO#hack#d# 914my $bgmusic;#TODO#hack#d#
1371 }); 1377 });
1372 refresh; 1378 refresh;
1373} 1379}
1374 1380
1375sub conn::container_add { 1381sub conn::container_add {
1376 my ($self, $id, $items) = @_; 1382 my ($self, $tag, $items) = @_;
1377 1383
1378 update_floorbox if $id == 0; 1384 update_floorbox if $tag == 0;
1379 if ($self->{player}{tag} == $id) { 1385
1380 $INV->set_items ($self->{container}{$self->{player}{tag}}); 1386 $INV->set_items ($self->{container}{$self->{player}{tag}})
1381 } 1387 if $tag == $self->{player}{tag};
1388
1382 # $self-<{player}{tag} => player inv 1389 # $self-<{player}{tag} => player inv
1383 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; 1390 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}};
1384} 1391}
1385 1392
1386sub conn::container_clear { 1393sub conn::container_clear {
1387 my ($self, $id) = @_; 1394 my ($self, $tag) = @_;
1388 1395
1389 update_floorbox if $id == 0; 1396 update_floorbox if $tag == 0;
1390 if ($self->{player}{tag} == $id) { 1397
1391 $INV->set_items ($self->{container}{$id}); 1398 $INV->set_items ($self->{container}{$tag})
1392 } 1399 if $tag == $self->{player}{tag};
1393 1400
1394# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; 1401# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0};
1395} 1402}
1396 1403
1397sub conn::item_delete { 1404sub conn::item_delete {
1398 my ($self, @items) = @_; 1405 my ($self, @items) = @_;
1399 1406
1400 for (@items) { 1407 for (@items) {
1401 update_floorbox if $_->{container} == 0; 1408 update_floorbox if $_->{container} == 0;
1402 if ($self->{player}{tag} == $_->{container}) { 1409
1403 $INV->set_items ($self->{container}{$_->{container}}); 1410 $INV->set_items ($self->{container}{$_->{container}})
1404 } 1411 if $_->{container} == $self->{player}{tag};
1405 } 1412 }
1406} 1413}
1407 1414
1408sub conn::item_update { 1415sub conn::item_update {
1409 my ($self, $item) = @_; 1416 my ($self, $item) = @_;
1410 1417
1411 update_floorbox if $item->{container} == 0; 1418 update_floorbox if $item->{container} == 0;
1412 if ($self->{player}{tag} == $item->{container}) { 1419
1413 $INV->set_items ($self->{container}{$item->{container}}); 1420 $INV->set_items ($self->{container}{$item->{container}})
1414 } 1421 if $item->{container}; == $self->{player}{tag};
1415} 1422}
1416 1423
1417%SDL_CB = ( 1424%SDL_CB = (
1418 CFClient::SDL_QUIT => sub { 1425 CFClient::SDL_QUIT => sub {
1419 Event::unloop -1; 1426 Event::unloop -1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines