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.240 by root, Tue May 23 21:14:42 2006 UTC vs.
Revision 1.254 by root, Thu May 25 13:58:36 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
191 my $row = 1; 191 my $row = 1;
192 192
193 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen"); 193 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen");
194 $table->add (1, $row++, new CFClient::UI::CheckBox 194 $table->add (1, $row++, new CFClient::UI::CheckBox
195 state => $CFG->{fullscreen}, 195 state => $CFG->{fullscreen},
196 tooltip => "Bring the client into fullscreen mode", 196 tooltip => "Bring the client into fullscreen mode.",
197 connect_changed => sub { 197 connect_changed => sub {
198 my ($self, $value) = @_; 198 my ($self, $value) = @_;
199 $CFG->{fullscreen} = $value; 199 $CFG->{fullscreen} = $value;
200 } 200 }
201 ); 201 );
211 ); 211 );
212 212
213 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Map Scale"); 213 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Map Scale");
214 $table->add (1, $row++, new CFClient::UI::Slider 214 $table->add (1, $row++, new CFClient::UI::Slider
215 range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], 215 range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1],
216 tooltip => "Enlarge or shrink the displayed map", 216 tooltip => "Enlarge or shrink the displayed map. Changes are instant.",
217 connect_changed => sub { 217 connect_changed => sub {
218 my ($self, $value) = @_; 218 my ($self, $value) = @_;
219 $CFG->{map_scale} = 2 ** $value; 219 $CFG->{map_scale} = 2 ** $value;
220 } 220 }
221 ); 221 );
222 222
223 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); 223 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War");
224 $table->add (1, $row++, new CFClient::UI::CheckBox 224 $table->add (1, $row++, new CFClient::UI::CheckBox
225 state => $CFG->{fow_enable}, 225 state => $CFG->{fow_enable},
226 tooltip => "Fog-of-War marks areas that cannot be seen by the player", 226 tooltip => "<b>Fog-of-War</b> marks areas that cannot be seen by the player. Changes are instant.",
227 connect_changed => sub { 227 connect_changed => sub {
228 my ($self, $value) = @_; 228 my ($self, $value) = @_;
229 $CFG->{fow_enable} = $value; 229 $CFG->{fow_enable} = $value;
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 => "<b>Fog of War Lightness.</b> The higher the intensity, the lighter the Fog-of-War color. Changes are instant.",
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 }
241 ); 241 );
242 242
243 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth"); 243 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth");
244 $table->add (1, $row++, new CFClient::UI::CheckBox 244 $table->add (1, $row++, new CFClient::UI::CheckBox
245 state => $CFG->{fow_smooth}, 245 state => $CFG->{fow_smooth},
246 tooltip => "Smooth the Fog-of-War a bit to make it more realistic", 246 tooltip => "Smooth the Fog-of-War a bit to make it more realistic. Changes are instant.",
247 connect_changed => sub { 247 connect_changed => sub {
248 my ($self, $value) = @_; 248 my ($self, $value) = @_;
249 $CFG->{fow_smooth} = $value; 249 $CFG->{fow_smooth} = $value;
250 status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::GL_VERSION < 1.2; 250 status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::GL_VERSION < 1.2;
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 base font size used by most GUI elements that do not have their own setting.",
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 => "Message 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 <b>message/server log</b> window only. Changes are instant.",
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 <b>statistics window</b> only. Changes are instant.",
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 fontsize");
280 $table->add (1, $row++, new CFClient::UI::Slider
281 range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1],
282 tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.",
283 connect_changed => sub {
284 $CFG->{gauge_fontsize} = $_[1];
285 &set_gauge_window_fontsize;
286 }
287 );
288
279 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size"); 289 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size");
280 $table->add (1, $row++, new CFClient::UI::Slider 290 $table->add (1, $row++, new CFClient::UI::Slider
281 range => [$CFG->{gauge_size}, 0.2, 0.8, 0.02], 291 range => [$CFG->{gauge_size}, 0.2, 0.8],
282 tooltip => "Adjust the size of the stats gauges at the bottom right", 292 tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.",
283 connect_changed => sub { 293 connect_changed => sub {
284 $CFG->{gauge_size} = $_[1]; 294 $CFG->{gauge_size} = $_[1];
285 $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size}); 295 $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");
290 $table->add (1, $row++, new CFClient::UI::Slider
291 range => [$CFG->{gauge_fontsize}, 0.5, 2.0, 0.1, 0.1],
292 tooltip => "Adjusts the fontsize of the gauges at the bottom right",
293 connect_changed => sub {
294 $CFG->{gauge_fontsize} = $_[1];
295 &set_gauge_window_fontsize;
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",
306 ); 306 );
307 307
308 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable"); 308 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable");
309 $table->add (1, $row++, new CFClient::UI::CheckBox 309 $table->add (1, $row++, new CFClient::UI::CheckBox
310 state => $CFG->{audio_enable}, 310 state => $CFG->{audio_enable},
311 tooltip => "If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", 311 tooltip => "<b>Master Audio Enable.</b> If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.",
312 connect_changed => sub { 312 connect_changed => sub {
313 $CFG->{audio_enable} = $_[1]; 313 $CFG->{audio_enable} = $_[1];
314 } 314 }
315 ); 315 );
316# $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume"); 316# $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume");
319# }); 319# });
320 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music"); 320 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music");
321 $table->add (1, $row++, my $hbox = new CFClient::UI::HBox); 321 $table->add (1, $row++, my $hbox = new CFClient::UI::HBox);
322 $hbox->add (new CFClient::UI::CheckBox 322 $hbox->add (new CFClient::UI::CheckBox
323 expand => 1, state => $CFG->{bgm_enable}, 323 expand => 1, state => $CFG->{bgm_enable},
324 tooltip => "Enable background music playing", 324 tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.",
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. Changes are instant.",
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 }
336 ); 336 );
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
425 422
426 $win 423 $win
427} 424}
428 425
429sub make_stats_window { 426sub make_stats_window {
430 my $tgw = new CFClient::UI::FancyFrame x => $WIDTH * 2/5, y => 0, title => "Stats"; 427 my $tgw = new CFClient::UI::FancyFrame title => "Stats";
431 428
432 $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); 429 $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox);
433 $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, 430 $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1,
434 can_hover => 1, can_events => 1, 431 can_hover => 1, can_events => 1,
435 tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); 432 tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server.");
438 tooltip => "The map you are currently on (if supported by the server)."); 435 tooltip => "The map you are currently on (if supported by the server).");
439 436
440 $vb->add (my $hb = new CFClient::UI::HBox expand => 1); 437 $vb->add (my $hb = new CFClient::UI::HBox expand => 1);
441 $hb->add (my $tbl = new CFClient::UI::Table expand => 1); 438 $hb->add (my $tbl = new CFClient::UI::Table expand => 1);
442 439
443 my $black = [0, 0, 0]; 440 my $color2 = [1, 1, 0];
444 441
445 for ( 442 for (
446 [0, 0, st_str => "Str", 30, "<b>Physical Strength</b>, determines damage dealt with weapons, how much you can carry, and how often you can attack"], 443 [0, 0, st_str => "Str", 30, "<b>Physical Strength</b>, determines damage dealt with weapons, how much you can carry, and how often you can attack"],
447 [0, 1, st_dex => "Dex", 30, "<b>Dexterity</b>, your physical agility. Determines chance of being hit and affects armor class and speed"], 444 [0, 1, st_dex => "Dex", 30, "<b>Dexterity</b>, your physical agility. Determines chance of being hit and affects armor class and speed"],
448 [0, 2, st_con => "Con", 30, "<b>Constitution</b>, physical health and toughness. Determines how many healthpoints you can have"], 445 [0, 2, st_con => "Con", 30, "<b>Constitution</b>, physical health and toughness. Determines how many healthpoints you can have"],
461 my ($col, $row, $id, $label, $template, $tooltip) = @$_; 458 my ($col, $row, $id, $label, $template, $tooltip) = @$_;
462 459
463 $tbl->add ($col , $row, $STATWIDS->{$id} = new CFClient::UI::Label 460 $tbl->add ($col , $row, $STATWIDS->{$id} = new CFClient::UI::Label
464 font => $FONT_FIXED, can_hover => 1, can_events => 1, valign => 0, align => +1, template => $template, tooltip => $tooltip); 461 font => $FONT_FIXED, can_hover => 1, can_events => 1, valign => 0, align => +1, template => $template, tooltip => $tooltip);
465 $tbl->add ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new CFClient::UI::Label 462 $tbl->add ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new CFClient::UI::Label
466 font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $black, valign => 0, align => -1, text => $label, tooltip => $tooltip); 463 font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2, valign => 0, align => -1, text => $label, tooltip => $tooltip);
467 } 464 }
468 465
469 $hb->add (my $tbl2 = new CFClient::UI::Table expand => 1); 466 $hb->add (my $tbl2 = new CFClient::UI::Table expand => 1);
470 467
471 my $row = 0; 468 my $row = 0;
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 bandwidth 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, the client 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 }
884 $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); 896 $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1);
885 897
886 $invwin 898 $invwin
887} 899}
888 900
901sub make_help_window {
902 my $win = new CFClient::UI::FancyFrame
903 user_w => $WIDTH * (7/8), user_h => $HEIGHT * (7/8), title => "Documentation";
904
905 $win->add (my $vbox = new CFClient::UI::VBox);
906
907 $vbox->add (my $buttons = new CFClient::UI::HBox);
908 $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8);
909
910 for (
911 [intro => "Introduction"],
912 [manual => "Manual"],
913 [command_help => "Commands"],
914 [skill_help => "Skills"],
915 ) {
916 my ($pod, $label) = @$_;
917
918 $buttons->add (new CFClient::UI::Button
919 text => $label,
920 connect_activate => sub {
921 my $parser = new Pod::POM;
922 my $pom = $parser->parse_file (CFClient::find_rcfile "pod/$pod.pod");
923
924 $viewer->clear;
925
926 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0])
927 for @{ CFClient::pod_to_pango_list $pom };
928
929 $viewer->set_offset (0);
930 },
931 );
932 }
933
934 $viewer->add_paragraph ([1, 1, 0, 1], "<big>Use one of the buttons above to display a document.</big>");
935
936 $win
937}
938
889sub sdl_init { 939sub sdl_init {
890 CFClient::SDL_Init 940 CFClient::SDL_Init
891 and die "SDL::Init failed!\n"; 941 and die "SDL::Init failed!\n";
892} 942}
893 943
894sub video_init { 944sub video_init {
895 sdl_init; 945 sdl_init;
896 946
897 $CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} >= @SDL_MODES; 947 $CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} >= @SDL_MODES;
898 948
949 my ($old_w, $old_h) = ($WIDTH, $HEIGHT);
950
899 ($WIDTH, $HEIGHT) = @{ $SDL_MODES[$CFG->{sdl_mode}] }; 951 ($WIDTH, $HEIGHT) = @{ $SDL_MODES[$CFG->{sdl_mode}] };
900 $FULLSCREEN = $CFG->{fullscreen}; 952 $FULLSCREEN = $CFG->{fullscreen};
901 $FAST = $CFG->{fast}; 953 $FAST = $CFG->{fast};
902 954
903 CFClient::SDL_SetVideoMode $WIDTH, $HEIGHT, $FULLSCREEN 955 CFClient::SDL_SetVideoMode $WIDTH, $HEIGHT, $FULLSCREEN
912 964
913 $CFClient::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d# 965 $CFClient::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d#
914 966
915 ############################################################################# 967 #############################################################################
916 968
917 unless ($DEBUG_STATUS) { 969 if ($DEBUG_STATUS) {
970 CFClient::UI::rescale_widgets $WIDTH / $old_w, $HEIGHT / $old_h;
971 } else {
918 # create the widgets 972 # create the widgets
919 973
920 $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;
921 $DEBUG_STATUS->show; 975 $DEBUG_STATUS->show;
922 976
972 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.");
973 1027
974 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
975 1029
976 $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,
977 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.");
978 $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,
979 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 :).");
980 1034
981 $BUTTONBAR->add (new CFClient::UI::Button 1035 $BUTTONBAR->add (new CFClient::UI::Button
982 text => "Save Config", 1036 text => "Save Config",
985 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; 1039 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc";
986 status "Configuration Saved"; 1040 status "Configuration Saved";
987 }, 1041 },
988 ); 1042 );
989 1043
1044 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window,
1045 tooltip => "View Documentation");
1046
990 $BUTTONBAR->add (new CFClient::UI::Button 1047 $BUTTONBAR->add (new CFClient::UI::Button
991 text => "Quit", 1048 text => "Quit",
992 tooltip => "Terminates the program", 1049 tooltip => "Terminates the program",
993 connect_activate => sub { 1050 connect_activate => sub {
994 if ($CONN) { 1051 if ($CONN) {
995 open_quit_dialog 1052 open_quit_dialog;
996 } else { 1053 } else {
997 exit 1 1054 exit;
998 } 1055 }
999 }, 1056 },
1000 ); 1057 );
1001 1058
1002 $BUTTONBAR->show; 1059 $BUTTONBAR->show;
1316 1373
1317 return; 1374 return;
1318 } 1375 }
1319 } 1376 }
1320 1377
1321 $self->SUPER::send_mapinfo ($data, $cb); 1378 $self->Crossfire::Protocol::send_mapinfo ($data, $cb);
1322} 1379}
1323 1380
1324# this method does a "flood fill" into every tile direction 1381# this method does a "flood fill" into every tile direction
1325# it assumes that tiles are arranged in a rectangular grid, 1382# it assumes that tiles are arranged in a rectangular grid,
1326# 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.
1439gotid: 1496gotid:
1440 $face->{id} = $id; 1497 $face->{id} = $id;
1441 $MAP->set_face ($facenum => $id); 1498 $MAP->set_face ($facenum => $id);
1442 $self->{faceid}[$facenum] = $id;#d# 1499 $self->{faceid}[$facenum] = $id;#d#
1443 1500
1444 $TILECACHE->get ($id) || do { 1501 my $face = $TILECACHE->get ($id);
1502
1503 if ($face) {
1504 #$self->face_prefetch;
1505 $face
1506 } else {
1445 my $tex = $self->{noface}; 1507 my $tex = $self->{noface};
1446 $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}});
1447 undef 1509 undef
1448 }; 1510 };
1449} 1511}
1496 title => "Query", 1558 title => "Query",
1497 child => my $vbox = new CFClient::UI::VBox; 1559 child => my $vbox = new CFClient::UI::VBox;
1498 1560
1499 $vbox->add (new CFClient::UI::Label 1561 $vbox->add (new CFClient::UI::Label
1500 max_w => $::WIDTH * 0.4, 1562 max_w => $::WIDTH * 0.4,
1563 ellipsise => 0,
1501 text => $prompt); 1564 text => $prompt);
1502 1565
1503 if ($flags & Crossfire::Protocol::CS_QUERY_YESNO) { 1566 if ($flags & Crossfire::Protocol::CS_QUERY_YESNO) {
1504 $vbox->add (my $hbox = new CFClient::HBox); 1567 $vbox->add (my $hbox = new CFClient::HBox);
1505 $hbox->add (new CFClient::Button 1568 $hbox->add (new CFClient::Button
1513 $hbox->add (new CFClient::Button 1576 $hbox->add (new CFClient::Button
1514 text => "Yes", 1577 text => "Yes",
1515 connect_activate => sub { 1578 connect_activate => sub {
1516 $self->send ("reply y"); 1579 $self->send ("reply y");
1517 $dialog->destroy; 1580 $dialog->destroy;
1518 $MAPWIDGET->focus_in;
1519 }, 1581 },
1520 ); 1582 );
1521 1583
1522 $dialog->focus_in; 1584 $dialog->focus_in;
1523 1585
1525 $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)";
1526 $vbox->add (my $entry = new CFClient::UI::Entry 1588 $vbox->add (my $entry = new CFClient::UI::Entry
1527 connect_changed => sub { 1589 connect_changed => sub {
1528 $self->send ("reply $_[1]"); 1590 $self->send ("reply $_[1]");
1529 $dialog->destroy; 1591 $dialog->destroy;
1530 $MAPWIDGET->focus_in;
1531 }, 1592 },
1532 ); 1593 );
1533 1594
1534 $entry->focus_in; 1595 $entry->focus_in;
1535 1596
1539 $vbox->add (my $entry = new CFClient::UI::Entry 1600 $vbox->add (my $entry = new CFClient::UI::Entry
1540 $flags & Crossfire::Protocol::CS_QUERY_HIDEINPUT ? (hiddenchar => "*") : (), 1601 $flags & Crossfire::Protocol::CS_QUERY_HIDEINPUT ? (hiddenchar => "*") : (),
1541 connect_activate => sub { 1602 connect_activate => sub {
1542 $self->send ("reply $_[1]"); 1603 $self->send ("reply $_[1]");
1543 $dialog->destroy; 1604 $dialog->destroy;
1544 $MAPWIDGET->focus_in;
1545 }, 1605 },
1546 ); 1606 );
1547 1607
1548 $entry->focus_in; 1608 $entry->focus_in;
1549 } 1609 }
1580 join "\n", map "$time $_", split /\n/, $text); 1640 join "\n", map "$time $_", split /\n/, $text);
1581 1641
1582 $STATUSBOX->add ($text, 1642 $STATUSBOX->add ($text,
1583 group => $text, 1643 group => $text,
1584 fg => $color[$color], 1644 fg => $color[$color],
1585 timeout => 60, 1645 timeout => 10,
1586 tooltip_font => $::FONT_FIXED, 1646 tooltip_font => $::FONT_FIXED,
1587 ); 1647 );
1588} 1648}
1589 1649
1590sub conn::drawextinfo { 1650sub conn::drawextinfo {
1635 $MAPWIDGET->clr_commands; 1695 $MAPWIDGET->clr_commands;
1636 1696
1637 stop_game; 1697 stop_game;
1638} 1698}
1639 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} }, + 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# this should, of course, only run on demand, but
1736# SDL forces worse things on us....
1737
1738Event->timer (after => 1, interval => 0.25, cb => sub {
1739 $CONN->face_prefetch
1740 if $CONN;
1741});
1742
1640sub update_floorbox { 1743sub update_floorbox {
1641 $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { 1744 $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub {
1642 return unless $CONN; 1745 return unless $CONN;
1643 1746
1644 $FLOORBOX->clear; 1747 $FLOORBOX->clear;
1645 $FLOORBOX->add (new CFClient::UI::Empty expand => 1); 1748 $FLOORBOX->add (new CFClient::UI::Empty expand => 1);
1646 1749
1647 my $count = 4; 1750 my $count = 7;
1648 for (@{ $CONN->{container}{0} }) { 1751 for (@{ $CONN->{container}{0} }) {
1649 if (--$count) { 1752 if (--$count) {
1650 $FLOORBOX->add (new CFClient::UI::InventoryItem item => $_); 1753 $FLOORBOX->add (new CFClient::UI::InventoryItem item => $_);
1651 } else { 1754 } else {
1652 $FLOORBOX->add (new CFClient::UI::Label text => "More..."); 1755 $FLOORBOX->add (new CFClient::UI::Label text => "More...");
1815 host => "crossfire.schmorp.de", 1918 host => "crossfire.schmorp.de",
1816 say_command => 'say', 1919 say_command => 'say',
1817 audio_enable => 1, 1920 audio_enable => 1,
1818 bgm_enable => 1, 1921 bgm_enable => 1,
1819 bgm_volume => 0.25, 1922 bgm_volume => 0.25,
1923 face_prefetch => 0,
1820 output_sync => 1, 1924 output_sync => 1,
1821 output_count => 1, 1925 output_count => 1,
1822 ); 1926 );
1823 1927
1824 while (my ($k, $v) = each %DEF_CFG) { 1928 while (my ($k, $v) = each %DEF_CFG) {
1876 1980
1877Event::loop; 1981Event::loop;
1878 1982
1879END { CFClient::SDL_Quit } 1983END { CFClient::SDL_Quit }
1880 1984
1985=head1 NAME
1986
1881=head1 pclient - Crossfire+ and Crossfire game client 1987pclient - A Crossfire+ and Crossfire game client
1882 1988
1883Pclient is a Crossfire+ and Crossfire game client. 1989=head1 SYNOPSIS
1884 1990
1885=head2 Features 1991Just run it - no commandline arguments are supported.
1886
1887=over 4
1888
1889=item Fullscreen Map
1890
1891PClient can uses a fullscreen map, which greatly enhances how much of the
1892game world you can see.
1893
1894=item Persistent Map Cache (Crossfire+ only)
1895
1896PClient can persistently cache all map data it received from the
1897server. This not only allows it to display an overview map, but also
1898ensures that once-explored areas will be available the next time you want
1899to explore more.
1900
1901=item Hardware acceleration
1902
1903Unlike most Crossfire clients, PClient take advantage of OpenGL hardware
1904acceleration. Most modern graphics cards have difficulties with 2D
1905acceleration, while 3D graphics is accelerated well.
1906
1907=item No arbitrary limits
1908
1909Unlike other Crossfire clients, pclient does not suffer from arbitrary
1910limits (like a fixed amount of face numbers). There are still limits, but
1911they are not arbitrarily low :)
1912
1913=back
1914 1992
1915=head1 USAGE 1993=head1 USAGE
1916 1994
1917=head2 The Map 1995Pclient utilises OpenGL for all UI elements and the game. It is supposed to be used
1918 1996fullscreen and interactively.
1919The map is always displayed in the background, behind all other windows and UI elements.
1920
1921#TODO# middle-click scrolls
1922#
1923# keys:
1924#
1925# a apply
1926# keypad moves, kp_5 applies ranged attack to self
1927
1928Starting to type enters the I<completion mode>. In that mode, you can type
1929abbreviations or commands and have them executed as soon as they match a
1930valid command. This is best explained by a few examples:
1931
1932Typing B<climb> will display a list of commands with I<climb> in their
1933name, such as I<ready_skill climbing> and I<use_skill climbing>.
1934
1935You can abbreviate commands by typing only the first character of every
1936word (or even characters within the word - the client will try to make
1937a good guess, as long as the characters are in order). For example,
1938typing I<iwor> will likely select I<invoke word of recall>, while I<ccfo>
1939will select I<cast create food>. Likewise, I<rscli> will likely select
1940I<ready_skill climbing> and I<usl> will give you I<use_skill levitation>.
1941
1942You can enter space and other text as arguemnt to the command. For
1943example, C<cfoo waybread> will expand to C<cast create food waybread>.
1944
1945=head2 The map overview
1946
1947#TODO#
1948
1949=head2 The Status area in the lower right corner
1950
1951#TODO#
1952
1953=head2 The I<Statistics>/I>Stats> window
1954
1955#TODO#
1956
1957=head1 FAQ
1958
1959=over 4
1960
1961=item The client is very sluggish and slow, what can I do about this?
1962
1963Most likely, you don't have accelerated OpenGL support. Try to find a
1964newer driver, or a driver from your hardware vendor, that features OpenGL
1965support.
1966
1967If this is not an option, the following Setup options reduce the load and
1968will likely make the client playable with sofwtare rendering (it will
1969still be slow, though):
1970
1971=over 4
1972
1973=item B<Video Mode> should be set as low as possible (e.g. 640x480)
1974
1975=item Enable B<Fast & Ugly> mode
1976
1977=item Disable B<Fog of War>
1978
1979=item Increase B<Map Scale>
1980
1981=back
1982
1983=back
1984 1997
1985=head1 AUTHOR 1998=head1 AUTHOR
1986 1999
1987Marc Lehmann <crossfire@schmorp.de>, Robin Redeker <elmex@ta-sa.org> 2000Marc Lehmann <crossfire@schmorp.de>, Robin Redeker <elmex@ta-sa.org>
1988 2001

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines