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.241 by root, Tue May 23 23:14:46 2006 UTC vs.
Revision 1.250 by root, Thu May 25 03:24:29 2006 UTC

106our $INVR; 106our $INVR;
107our $INVR_LBL; 107our $INVR_LBL;
108our $OPENCONT; 108our $OPENCONT;
109 109
110sub status { 110sub status {
111 $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 20, fg => [1, 1, 0, 1]); 111 $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]);
112} 112}
113 113
114sub debug { 114sub debug {
115 $DEBUG_STATUS->set_text ($_[0]); 115 $DEBUG_STATUS->set_text ($_[0]);
116 my ($w, $h) = $DEBUG_STATUS->size_request; 116 my ($w, $h) = $DEBUG_STATUS->size_request;
175 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); 175 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]);
176 176
177 $table->add (0, 0, new CFClient::UI::Label valign => 0, align => 1, text => "Video Mode"); 177 $table->add (0, 0, new CFClient::UI::Label valign => 0, align => 1, text => "Video Mode");
178 $table->add (1, 0, my $hbox = new CFClient::UI::HBox); 178 $table->add (1, 0, my $hbox = new CFClient::UI::HBox);
179 179
180 $hbox->add (my $mode_slider = new CFClient::UI::Slider expand => 1, req_w => 100, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 1, 1]); 180 $hbox->add (my $mode_slider = new CFClient::UI::Slider expand => 1, req_w => 100, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1]);
181 $hbox->add (my $mode_label = new CFClient::UI::Label align => 0, valign => 0, height => 0.8, template => "9999x9999"); 181 $hbox->add (my $mode_label = new CFClient::UI::Label align => 0, valign => 0, height => 0.8, template => "9999x9999");
182 182
183 $mode_slider->connect (changed => sub { 183 $mode_slider->connect (changed => sub {
184 my ($self, $value) = @_; 184 my ($self, $value) = @_;
185 185
230 } 230 }
231 ); 231 );
232 232
233 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity"); 233 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity");
234 $table->add (1, $row++, new CFClient::UI::Slider 234 $table->add (1, $row++, new CFClient::UI::Slider
235 range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], 235 range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256],
236 tooltip => "The higher the intensity, the lighter the Fog-of-War color", 236 tooltip => "The higher the intensity, the lighter the Fog-of-War color",
237 connect_changed => sub { 237 connect_changed => sub {
238 my ($self, $value) = @_; 238 my ($self, $value) = @_;
239 $CFG->{fow_intensity} = $value; 239 $CFG->{fow_intensity} = $value;
240 } 240 }
251 } 251 }
252 ); 252 );
253 253
254 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); 254 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize");
255 $table->add (1, $row++, new CFClient::UI::Slider 255 $table->add (1, $row++, new CFClient::UI::Slider
256 range => [$CFG->{gui_fontsize}, 0.5, 2, 0.1, 0.1], 256 range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1],
257 tooltip => "The font size used by most GUI elements", 257 tooltip => "The font size used by most GUI elements",
258 connect_changed => sub { $CFG->{gui_fontsize} = $_[1] }, 258 connect_changed => sub { $CFG->{gui_fontsize} = $_[1] },
259 ); 259 );
260 260
261 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize"); 261 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize");
262 $table->add (1, $row++, new CFClient::UI::Slider 262 $table->add (1, $row++, new CFClient::UI::Slider
263 range => [$CFG->{log_fontsize}, 0.5, 2, 0.1, 0.1], 263 range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1],
264 tooltip => "The font size used by the server log window only", 264 tooltip => "The font size used by the server log window only",
265 connect_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]) }, 265 connect_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]) },
266 ); 266 );
267 267
268 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize"); 268 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize");
269 269
270 $table->add (1, $row++, new CFClient::UI::Slider 270 $table->add (1, $row++, new CFClient::UI::Slider
271 range => [$CFG->{stat_fontsize}, 0.5, 2, 0.1, 0.1], 271 range => [$CFG->{stat_fontsize}, 0.5, 2, 0, 0.1],
272 tooltip => "The font size used by the statistics window only", 272 tooltip => "The font size used by the statistics window only",
273 connect_changed => sub { 273 connect_changed => sub {
274 $CFG->{stat_fontsize} = $_[1]; 274 $CFG->{stat_fontsize} = $_[1];
275 &set_stats_window_fontsize; 275 &set_stats_window_fontsize;
276 } 276 }
277 ); 277 );
278 278
279 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size");
280 $table->add (1, $row++, new CFClient::UI::Slider
281 range => [$CFG->{gauge_size}, 0.2, 0.8, 0.02],
282 tooltip => "Adjust the size of the stats gauges at the bottom right",
283 connect_changed => sub {
284 $CFG->{gauge_size} = $_[1];
285 $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size});
286 }
287 );
288
289 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); 279 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize");
290 $table->add (1, $row++, new CFClient::UI::Slider 280 $table->add (1, $row++, new CFClient::UI::Slider
291 range => [$CFG->{gauge_fontsize}, 0.5, 2.0, 0.1, 0.1], 281 range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1],
292 tooltip => "Adjusts the fontsize of the gauges at the bottom right", 282 tooltip => "Adjusts the fontsize of the gauges at the bottom right",
293 connect_changed => sub { 283 connect_changed => sub {
294 $CFG->{gauge_fontsize} = $_[1]; 284 $CFG->{gauge_fontsize} = $_[1];
295 &set_gauge_window_fontsize; 285 &set_gauge_window_fontsize;
286 }
287 );
288
289 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size");
290 $table->add (1, $row++, new CFClient::UI::Slider
291 range => [$CFG->{gauge_size}, 0.2, 0.8],
292 tooltip => "Adjust the size of the stats gauges at the bottom right",
293 connect_changed => sub {
294 $CFG->{gauge_size} = $_[1];
295 $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size});
296 } 296 }
297 ); 297 );
298 298
299 $table->add (1, $row++, new CFClient::UI::Button 299 $table->add (1, $row++, new CFClient::UI::Button
300 expand => 1, align => 0, text => "Apply", 300 expand => 1, align => 0, text => "Apply",
325 connect_changed => sub { 325 connect_changed => sub {
326 $CFG->{bgm_enable} = $_[1]; 326 $CFG->{bgm_enable} = $_[1];
327 } 327 }
328 ); 328 );
329 $hbox->add (new CFClient::UI::Slider 329 $hbox->add (new CFClient::UI::Slider
330 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0.1], 330 expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128],
331 tooltip => "The volume of the background music", 331 tooltip => "The volume of the background music",
332 connect_changed => sub { 332 connect_changed => sub {
333 $CFG->{bgm_volume} = $_[1]; 333 $CFG->{bgm_volume} = $_[1];
334 CFClient::MixMusic::volume $_[1] * 128; 334 CFClient::MixMusic::volume $_[1] * 128;
335 } 335 }
342 audio_shutdown (); 342 audio_shutdown ();
343 audio_init (); 343 audio_init ();
344 } 344 }
345 ); 345 );
346 346
347 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Communication cmd"); 347 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Chat Command");
348 $table->add (1, $row++, my $saycmd = new CFClient::UI::Entry 348 $table->add (1, $row++, my $saycmd = new CFClient::UI::Entry
349 text => $CFG->{say_command}, 349 text => $CFG->{say_command},
350 tooltip => "This is the command that will be used if you write a line in the message window entry. " 350 tooltip => "This is the command that will be used if you write a line in the message window entry or press <b>\"</b> in the map window. "
351 ."Usually you want to enter something like 'say' or 'shout' or 'gsay' here. " 351 . "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. "
352 ."But you could also set it to 'tell &lt;playername&gt;' to only chat with that user.", 352 . "But you could also set it to <b>tell <i>playername</i></b> to only chat with that user.",
353 connect_changed => sub { 353 connect_changed => sub {
354 my ($self, $value) = @_; 354 my ($self, $value) = @_;
355 $CFG->{say_command} = $value; 355 $CFG->{say_command} = $value;
356 } 356 }
357 ); 357 );
367 367
368sub set_gauge_window_fontsize { 368sub set_gauge_window_fontsize {
369 for (map { $GAUGES->{$_} } grep { $_ ne 'win' } keys %{$GAUGES}) { 369 for (map { $GAUGES->{$_} } grep { $_ ne 'win' } keys %{$GAUGES}) {
370 $_->set_fontsize ($::CFG->{gauge_fontsize}); 370 $_->set_fontsize ($::CFG->{gauge_fontsize});
371 } 371 }
372
373# local $GAUGES->{win}{parent};#d#
374# use PApp::Util; open D, ">:utf8", "d"; print D PApp::Util::dumpval $GAUGES->{win}; close D;
375} 372}
376 373
377sub make_gauge_window { 374sub make_gauge_window {
378 my $gh = int $HEIGHT * $CFG->{gauge_size}; 375 my $gh = int $HEIGHT * $CFG->{gauge_size};
379 376
744 ); 741 );
745 742
746 $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); 743 $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size");
747 $table->add (1, 7, new CFClient::UI::Slider 744 $table->add (1, 7, new CFClient::UI::Slider
748 req_w => 100, 745 req_w => 100,
749 range => [$CFG->{mapsize}, 10, 100 + 1, 1, 1], 746 range => [$CFG->{mapsize}, 10, 100, 0, 1],
750 tooltip => "This is the size of the portion of the map update the server sends you. " 747 tooltip => "This is the size of the portion of the map update the server sends you. "
751 ."If you set this to a high value you will be able to see further for example.", 748 . "If you set this to a high value you will be able to see further, "
749 . "but you also increase bandwidht requirements and latency. "
750 . "This option is only used once at log-in.",
752 connect_changed => sub { 751 connect_changed => sub {
753 my ($self, $value) = @_; 752 my ($self, $value) = @_;
754 753
755 $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 754 $CFG->{mapsize} = $self->{range}[0] = $value = int $value;
756 }, 755 },
757 ); 756 );
758 757
758 $table->add (0, 8, new CFClient::UI::Label valign => 0, align => 1, text => "Face Prefetch");
759 $table->add (1, 8, new CFClient::UI::CheckBox
760 state => $CFG->{face_prefetch},
761 tooltip => "<b>Background Image Prefetch</b>\n\n"
762 . "If enabled, automatically pre-fetches images from the server. "
763 . "This might increase or create lag, but increases the chances "
764 . "of faces being ready for display when you encounter them. "
765 . "It also uses up server bandwidth on every connect, "
766 . "so only set it if you really need to prefetch images. "
767 . "This option can be set and unset any time.",
768 connect_changed => sub { $CFG->{face_prefetch} = $_[1] },
769 );
770
759 $table->add (0, 8, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Count"); 771 $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Count");
760 $table->add (1, 8, new CFClient::UI::Entry 772 $table->add (1, 9, new CFClient::UI::Entry
761 text => $CFG->{output_count}, 773 text => $CFG->{output_count},
762 tooltip => "Should be set to 1 unless you know what you are doing", 774 tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.",
763 connect_changed => sub { $CFG->{output_count} = $_[1] }, 775 connect_changed => sub { $CFG->{output_count} = $_[1] },
764 ); 776 );
765 777
766 $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Sync"); 778 $table->add (0, 10, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Sync");
767 $table->add (1, 9, new CFClient::UI::Entry 779 $table->add (1, 10, new CFClient::UI::Entry
768 text => $CFG->{output_sync}, 780 text => $CFG->{output_sync},
769 tooltip => "Should be set to 1 unless you know what you are doing", 781 tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.",
770 connect_changed => sub { $CFG->{output_sync} = $_[1] }, 782 connect_changed => sub { $CFG->{output_sync} = $_[1] },
771 ); 783 );
772 784
773 $table->add (1, 10, $LOGIN_BUTTON = new CFClient::UI::Button 785 $table->add (1, 11, $LOGIN_BUTTON = new CFClient::UI::Button
774 expand => 1, 786 expand => 1,
775 align => 0, 787 align => 0,
776 text => "Login", 788 text => "Login",
777 connect_activate => sub { 789 connect_activate => sub {
778 $CONN ? stop_game 790 $CONN ? stop_game
843 $QUIT_DIALOG = new CFClient::UI::FancyFrame title => "Really Quit?"; 855 $QUIT_DIALOG = new CFClient::UI::FancyFrame title => "Really Quit?";
844 856
845 $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); 857 $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1);
846 858
847 $vb->add (new CFClient::UI::Label 859 $vb->add (new CFClient::UI::Label
848 text => "You should find a savebed and apply it first!", 860 text => "You should find a savebed and apply it first!",
849 max_w => $WIDTH * 0.25 861 max_w => $WIDTH * 0.25,
862 ellipsize => 0,
850 ); 863 );
851 $vb->add (my $hb = new CFClient::UI::HBox expand => 1); 864 $vb->add (my $hb = new CFClient::UI::HBox expand => 1);
852 $hb->add (new CFClient::UI::Button 865 $hb->add (new CFClient::UI::Button
853 text => "Ok", 866 text => "Ok",
867 expand => 1,
854 connect_activate => sub { $QUIT_DIALOG->hide }, 868 connect_activate => sub { $QUIT_DIALOG->hide },
855 expand => 1
856 ); 869 );
857 $hb->add (new CFClient::UI::Button 870 $hb->add (new CFClient::UI::Button
858 text => "Quit anyway", 871 text => "Quit anyway",
872 expand => 1,
859 connect_activate => sub { exit 1 }, 873 connect_activate => sub { exit },
860 expand => 1
861 ); 874 );
862 $hb->add (new CFClient::UI::Label "You should find a savebed and apply it first!");
863 875
864 $QUIT_DIALOG->show_centered; 876 $QUIT_DIALOG->show_centered;
865 } else { 877 } else {
866 $QUIT_DIALOG->show_centered; 878 $QUIT_DIALOG->show_centered;
867 } 879 }
895 $vbox->add (my $buttons = new CFClient::UI::HBox); 907 $vbox->add (my $buttons = new CFClient::UI::HBox);
896 $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); 908 $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8);
897 909
898 for ( 910 for (
899 [intro => "Introduction"], 911 [intro => "Introduction"],
912 [manual => "Manual"],
900 [command_help => "Commands"], 913 [command_help => "Commands"],
901 [skill_help => "Skills"], 914 [skill_help => "Skills"],
902 ) { 915 ) {
903 my ($pod, $label) = @$_; 916 my ($pod, $label) = @$_;
904 917
910 923
911 $viewer->clear; 924 $viewer->clear;
912 925
913 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) 926 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0])
914 for @{ CFClient::pod_to_pango_list $pom }; 927 for @{ CFClient::pod_to_pango_list $pom };
928
929 $viewer->set_offset (0);
915 }, 930 },
916 ); 931 );
917 } 932 }
918 933
919 $viewer->add_paragraph ([1, 1, 0, 1], "<big>Use one of the buttons above to display a document.</big>"); 934 $viewer->add_paragraph ([1, 1, 0, 1], "<big>Use one of the buttons above to display a document.</big>");
929sub video_init { 944sub video_init {
930 sdl_init; 945 sdl_init;
931 946
932 $CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} >= @SDL_MODES; 947 $CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} >= @SDL_MODES;
933 948
949 my ($old_w, $old_h) = ($WIDTH, $HEIGHT);
950
934 ($WIDTH, $HEIGHT) = @{ $SDL_MODES[$CFG->{sdl_mode}] }; 951 ($WIDTH, $HEIGHT) = @{ $SDL_MODES[$CFG->{sdl_mode}] };
935 $FULLSCREEN = $CFG->{fullscreen}; 952 $FULLSCREEN = $CFG->{fullscreen};
936 $FAST = $CFG->{fast}; 953 $FAST = $CFG->{fast};
937 954
938 CFClient::SDL_SetVideoMode $WIDTH, $HEIGHT, $FULLSCREEN 955 CFClient::SDL_SetVideoMode $WIDTH, $HEIGHT, $FULLSCREEN
947 964
948 $CFClient::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d# 965 $CFClient::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d#
949 966
950 ############################################################################# 967 #############################################################################
951 968
952 unless ($DEBUG_STATUS) { 969 if ($DEBUG_STATUS) {
970 CFClient::UI::rescale_widgets $WIDTH / $old_w, $HEIGHT / $old_h;
971 } else {
953 # create the widgets 972 # create the widgets
954 973
955 $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100, req_x => -1; 974 $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100, req_x => -1;
956 $DEBUG_STATUS->show; 975 $DEBUG_STATUS->show;
957 976
1007 tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); 1026 tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server.");
1008 1027
1009 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 1028 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
1010 1029
1011 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window, 1030 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window,
1012 tooltip => "Toggles the statistics window, where all your Stats and Resistances are beign displaye at all times."); 1031 tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times.");
1013 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window, 1032 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window,
1014 tooltip => "Toggles the inventory window, where you can manage your loot (or treaures :)."); 1033 tooltip => "Toggles the inventory window, where you can manage your loot (or treaures :).");
1015 1034
1016 $BUTTONBAR->add (new CFClient::UI::Button 1035 $BUTTONBAR->add (new CFClient::UI::Button
1017 text => "Save Config", 1036 text => "Save Config",
1237 my $cmd = $1; 1256 my $cmd = $1;
1238 my @args = split /\|/, $2; 1257 my @args = split /\|/, $2;
1239 @args = (".*") unless @args; 1258 @args = (".*") unless @args;
1240 1259
1241 my $text = CFClient::pod_to_pango $head2->content; 1260 my $text = CFClient::pod_to_pango $head2->content;
1242 my @par = CFClient::pod_to_pango_list $head2->content; use Data::Dumper; warn Dumper \@par;#d#
1243 1261
1244 for my $arg (@args) { 1262 for my $arg (@args) {
1245 $arg = $arg eq ".*" ? "" : " $arg"; 1263 $arg = $arg eq ".*" ? "" : " $arg";
1246 1264
1247 $MAPWIDGET->add_command ("$cmd$arg", $text); 1265 $MAPWIDGET->add_command ("$cmd$arg", $text);
1355 1373
1356 return; 1374 return;
1357 } 1375 }
1358 } 1376 }
1359 1377
1360 $self->SUPER::send_mapinfo ($data, $cb); 1378 $self->Crossfire::Protocol::send_mapinfo ($data, $cb);
1361} 1379}
1362 1380
1363# this method does a "flood fill" into every tile direction 1381# this method does a "flood fill" into every tile direction
1364# it assumes that tiles are arranged in a rectangular grid, 1382# it assumes that tiles are arranged in a rectangular grid,
1365# i.e. a map is the same as the left of the right map etc. 1383# i.e. a map is the same as the left of the right map etc.
1478gotid: 1496gotid:
1479 $face->{id} = $id; 1497 $face->{id} = $id;
1480 $MAP->set_face ($facenum => $id); 1498 $MAP->set_face ($facenum => $id);
1481 $self->{faceid}[$facenum] = $id;#d# 1499 $self->{faceid}[$facenum] = $id;#d#
1482 1500
1483 $TILECACHE->get ($id) || do { 1501 my $face = $TILECACHE->get ($id);
1502
1503 if ($face) {
1504 $self->face_prefetch;
1505 $face
1506 } else {
1484 my $tex = $self->{noface}; 1507 my $tex = $self->{noface};
1485 $MAP->set_texture ($id, @$tex{qw(name w h s t)}, @{$tex->{minified}}); 1508 $MAP->set_texture ($id, @$tex{qw(name w h s t)}, @{$tex->{minified}});
1486 undef 1509 undef
1487 }; 1510 };
1488} 1511}
1535 title => "Query", 1558 title => "Query",
1536 child => my $vbox = new CFClient::UI::VBox; 1559 child => my $vbox = new CFClient::UI::VBox;
1537 1560
1538 $vbox->add (new CFClient::UI::Label 1561 $vbox->add (new CFClient::UI::Label
1539 max_w => $::WIDTH * 0.4, 1562 max_w => $::WIDTH * 0.4,
1563 ellipsise => 0,
1540 text => $prompt); 1564 text => $prompt);
1541 1565
1542 if ($flags & Crossfire::Protocol::CS_QUERY_YESNO) { 1566 if ($flags & Crossfire::Protocol::CS_QUERY_YESNO) {
1543 $vbox->add (my $hbox = new CFClient::HBox); 1567 $vbox->add (my $hbox = new CFClient::HBox);
1544 $hbox->add (new CFClient::Button 1568 $hbox->add (new CFClient::Button
1552 $hbox->add (new CFClient::Button 1576 $hbox->add (new CFClient::Button
1553 text => "Yes", 1577 text => "Yes",
1554 connect_activate => sub { 1578 connect_activate => sub {
1555 $self->send ("reply y"); 1579 $self->send ("reply y");
1556 $dialog->destroy; 1580 $dialog->destroy;
1557 $MAPWIDGET->focus_in;
1558 }, 1581 },
1559 ); 1582 );
1560 1583
1561 $dialog->focus_in; 1584 $dialog->focus_in;
1562 1585
1564 $dialog->{tooltip} = "Press a key (click on the entry to make sure it has keyboard focus)"; 1587 $dialog->{tooltip} = "Press a key (click on the entry to make sure it has keyboard focus)";
1565 $vbox->add (my $entry = new CFClient::UI::Entry 1588 $vbox->add (my $entry = new CFClient::UI::Entry
1566 connect_changed => sub { 1589 connect_changed => sub {
1567 $self->send ("reply $_[1]"); 1590 $self->send ("reply $_[1]");
1568 $dialog->destroy; 1591 $dialog->destroy;
1569 $MAPWIDGET->focus_in;
1570 }, 1592 },
1571 ); 1593 );
1572 1594
1573 $entry->focus_in; 1595 $entry->focus_in;
1574 1596
1578 $vbox->add (my $entry = new CFClient::UI::Entry 1600 $vbox->add (my $entry = new CFClient::UI::Entry
1579 $flags & Crossfire::Protocol::CS_QUERY_HIDEINPUT ? (hiddenchar => "*") : (), 1601 $flags & Crossfire::Protocol::CS_QUERY_HIDEINPUT ? (hiddenchar => "*") : (),
1580 connect_activate => sub { 1602 connect_activate => sub {
1581 $self->send ("reply $_[1]"); 1603 $self->send ("reply $_[1]");
1582 $dialog->destroy; 1604 $dialog->destroy;
1583 $MAPWIDGET->focus_in;
1584 }, 1605 },
1585 ); 1606 );
1586 1607
1587 $entry->focus_in; 1608 $entry->focus_in;
1588 } 1609 }
1619 join "\n", map "$time $_", split /\n/, $text); 1640 join "\n", map "$time $_", split /\n/, $text);
1620 1641
1621 $STATUSBOX->add ($text, 1642 $STATUSBOX->add ($text,
1622 group => $text, 1643 group => $text,
1623 fg => $color[$color], 1644 fg => $color[$color],
1624 timeout => 60, 1645 timeout => 10,
1625 tooltip_font => $::FONT_FIXED, 1646 tooltip_font => $::FONT_FIXED,
1626 ); 1647 );
1627} 1648}
1628 1649
1629sub conn::drawextinfo { 1650sub conn::drawextinfo {
1674 $MAPWIDGET->clr_commands; 1695 $MAPWIDGET->clr_commands;
1675 1696
1676 stop_game; 1697 stop_game;
1677} 1698}
1678 1699
1700sub conn::image_info {
1701 my ($self, $numfaces) = @_;
1702
1703 $self->{num_faces} = $numfaces;
1704 $self->{face_prefetch} = [1 .. $numfaces];
1705 $self->face_prefetch;
1706}
1707
1708sub conn::face_prefetch {
1709 my ($self) = @_;
1710
1711 return unless $CFG->{face_prefetch};
1712
1713 if ($self->{num_faces}) {
1714 return if @{ $self->{send_queue} || [] };
1715 my $todo = @{ $self->{face_prefetch} }
1716 or return;
1717
1718 my ($face) = splice @{ $self->{face_prefetch} }, 1 + rand @{ $self->{face_prefetch} }, 1, ();
1719
1720 $self->send ("requestinfo image_sums $face $face");
1721
1722 $STATUSBOX->add (CFClient::UI::Label::escape "prefetching $todo",
1723 group => "prefetch", timeout => 2, fg => [1, 1, 0, 0.5]);
1724 } elsif (!exists $self->{num_faces}) {
1725 $self->send ("requestinfo image_info");
1726
1727 $self->{num_faces} = 0;
1728
1729 $STATUSBOX->add (CFClient::UI::Label::escape "starting to prefetch",
1730 group => "prefetch", timeout => 2, fg => [1, 1, 0, 0.5]);
1731 }
1732}
1733
1734# check once/second for faces that need to be prefetched
1735
1736Event->timer (after => 1, interval => 1, cb => sub {
1737 $CONN->face_prefetch
1738 if $CONN;
1739});
1740
1679sub update_floorbox { 1741sub update_floorbox {
1680 $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { 1742 $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub {
1681 return unless $CONN; 1743 return unless $CONN;
1682 1744
1683 $FLOORBOX->clear; 1745 $FLOORBOX->clear;
1684 $FLOORBOX->add (new CFClient::UI::Empty expand => 1); 1746 $FLOORBOX->add (new CFClient::UI::Empty expand => 1);
1685 1747
1686 my $count = 4; 1748 my $count = 7;
1687 for (@{ $CONN->{container}{0} }) { 1749 for (@{ $CONN->{container}{0} }) {
1688 if (--$count) { 1750 if (--$count) {
1689 $FLOORBOX->add (new CFClient::UI::InventoryItem item => $_); 1751 $FLOORBOX->add (new CFClient::UI::InventoryItem item => $_);
1690 } else { 1752 } else {
1691 $FLOORBOX->add (new CFClient::UI::Label text => "More..."); 1753 $FLOORBOX->add (new CFClient::UI::Label text => "More...");
1854 host => "crossfire.schmorp.de", 1916 host => "crossfire.schmorp.de",
1855 say_command => 'say', 1917 say_command => 'say',
1856 audio_enable => 1, 1918 audio_enable => 1,
1857 bgm_enable => 1, 1919 bgm_enable => 1,
1858 bgm_volume => 0.25, 1920 bgm_volume => 0.25,
1921 face_prefetch => 0,
1859 output_sync => 1, 1922 output_sync => 1,
1860 output_count => 1, 1923 output_count => 1,
1861 ); 1924 );
1862 1925
1863 while (my ($k, $v) = each %DEF_CFG) { 1926 while (my ($k, $v) = each %DEF_CFG) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines