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.200 by root, Mon May 8 17:23:08 2006 UTC vs.
Revision 1.204 by root, Mon May 8 21:16:10 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#
1195 } 1201 }
1196 1202
1197gotid: 1203gotid:
1198 $face->{id} = $id; 1204 $face->{id} = $id;
1199 $MAP->set_face ($facenum => $id); 1205 $MAP->set_face ($facenum => $id);
1206 $self->{faceid}[$facenum] = $id;#d#
1200 $TILECACHE->get ($id) 1207 $TILECACHE->get ($id)
1201} 1208}
1202 1209
1203sub conn::face_update { 1210sub conn::face_update {
1204 my ($self, $facenum, $face) = @_; 1211 my ($self, $facenum, $face) = @_;
1362 1369
1363 $FLOORBOX->clear; 1370 $FLOORBOX->clear;
1364 $FLOORBOX->add (new CFClient::UI::Empty expand => 1); 1371 $FLOORBOX->add (new CFClient::UI::Empty expand => 1);
1365 1372
1366 # we basically have to use the same sorting as everybody else 1373 # we basically have to use the same sorting as everybody else
1367 for my $item (@{ $CONN->{container}{0} }) { 1374 $FLOORBOX->add (
1368 $FLOORBOX->add (new CFClient::UI::InventoryItem item => $item); 1375 map +(new CFClient::UI::InventoryItem item => $_),
1376 @{ $CONN->{container}{0} }
1369 } 1377 );
1370 }); 1378 });
1371 refresh; 1379 refresh;
1372} 1380}
1373 1381
1374sub conn::container_add { 1382sub conn::container_add {
1375 my ($self, $id, $items) = @_; 1383 my ($self, $tag, $items) = @_;
1376 1384
1377 update_floorbox if $id == 0; 1385 update_floorbox if $tag == 0;
1378 if ($self->{player}{tag} == $id) { 1386
1379 $INV->set_items ($self->{container}{$self->{player}{tag}}); 1387 $INV->set_items ($self->{container}{$self->{player}{tag}})
1380 } 1388 if $tag == $self->{player}{tag};
1389
1381 # $self-<{player}{tag} => player inv 1390 # $self-<{player}{tag} => player inv
1382 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; 1391 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}};
1383} 1392}
1384 1393
1385sub conn::container_clear { 1394sub conn::container_clear {
1386 my ($self, $id) = @_; 1395 my ($self, $tag) = @_;
1387 1396
1388 update_floorbox if $id == 0; 1397 update_floorbox if $tag == 0;
1389 if ($self->{player}{tag} == $id) { 1398
1390 $INV->set_items ($self->{container}{$id}); 1399 $INV->set_items ($self->{container}{$tag})
1391 } 1400 if $tag == $self->{player}{tag};
1392 1401
1393# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; 1402# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0};
1394} 1403}
1395 1404
1396sub conn::item_delete { 1405sub conn::item_delete {
1397 my ($self, @items) = @_; 1406 my ($self, @items) = @_;
1398 1407
1399 for (@items) { 1408 for (@items) {
1400 update_floorbox if $_->{container} == 0; 1409 update_floorbox if $_->{container} == 0;
1401 if ($self->{player}{tag} == $_->{container}) { 1410
1402 $INV->set_items ($self->{container}{$_->{container}}); 1411 $INV->set_items ($self->{container}{$_->{container}})
1403 } 1412 if $_->{container} == $self->{player}{tag};
1404 } 1413 }
1405} 1414}
1406 1415
1407sub conn::item_update { 1416sub conn::item_update {
1408 my ($self, $item) = @_; 1417 my ($self, $item) = @_;
1409 1418
1410 update_floorbox if $item->{container} == 0; 1419 update_floorbox if $item->{container} == 0;
1411 if ($self->{player}{tag} == $item->{container}) { 1420
1412 $INV->set_items ($self->{container}{$item->{container}}); 1421 $INV->set_items ($self->{container}{$item->{container}})
1413 } 1422 if $item->{container} == $self->{player}{tag};
1414} 1423}
1415 1424
1416%SDL_CB = ( 1425%SDL_CB = (
1417 CFClient::SDL_QUIT => sub { 1426 CFClient::SDL_QUIT => sub {
1418 Event::unloop -1; 1427 Event::unloop -1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines