--- deliantra/Deliantra-Client/bin/pclient 2006/05/23 20:00:55 1.239 +++ deliantra/Deliantra-Client/bin/pclient 2006/05/24 03:29:20 1.243 @@ -177,7 +177,7 @@ $table->add (0, 0, new CFClient::UI::Label valign => 0, align => 1, text => "Video Mode"); $table->add (1, 0, my $hbox = new CFClient::UI::HBox); - $hbox->add (my $mode_slider = new CFClient::UI::Slider expand => 1, req_w => 100, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 1, 1]); + $hbox->add (my $mode_slider = new CFClient::UI::Slider expand => 1, req_w => 100, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1]); $hbox->add (my $mode_label = new CFClient::UI::Label align => 0, valign => 0, height => 0.8, template => "9999x9999"); $mode_slider->connect (changed => sub { @@ -212,11 +212,11 @@ $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Map Scale"); $table->add (1, $row++, new CFClient::UI::Slider - range => [$CFG->{map_scale}, 0.25, 2, 0.05, 0.05], - tooltip => "Enlarge or shrink the displayed map", + range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], + tooltip => "Enlarge or shrink the displayed map", connect_changed => sub { my ($self, $value) = @_; - $CFG->{map_scale} = $value; + $CFG->{map_scale} = 2 ** $value; } ); @@ -232,7 +232,7 @@ $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity"); $table->add (1, $row++, new CFClient::UI::Slider - range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], + range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], tooltip => "The higher the intensity, the lighter the Fog-of-War color", connect_changed => sub { my ($self, $value) = @_; @@ -253,14 +253,14 @@ $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); $table->add (1, $row++, new CFClient::UI::Slider - range => [$CFG->{gui_fontsize}, 0.5, 2, 0.1, 0.1], + range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1], tooltip => "The font size used by most GUI elements", connect_changed => sub { $CFG->{gui_fontsize} = $_[1] }, ); $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize"); $table->add (1, $row++, new CFClient::UI::Slider - range => [$CFG->{log_fontsize}, 0.5, 2, 0.1, 0.1], + range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], tooltip => "The font size used by the server log window only", connect_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]) }, ); @@ -268,7 +268,7 @@ $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize"); $table->add (1, $row++, new CFClient::UI::Slider - range => [$CFG->{stat_fontsize}, 0.5, 2, 0.1, 0.1], + range => [$CFG->{stat_fontsize}, 0.5, 2, 0, 0.1], tooltip => "The font size used by the statistics window only", connect_changed => sub { $CFG->{stat_fontsize} = $_[1]; @@ -276,23 +276,23 @@ } ); - $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size"); + $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); $table->add (1, $row++, new CFClient::UI::Slider - range => [$CFG->{gauge_size}, 0.2, 0.8, 0.02], - tooltip => "Adjust the size of the stats gauges at the bottom right", + range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], + tooltip => "Adjusts the fontsize of the gauges at the bottom right", connect_changed => sub { - $CFG->{gauge_size} = $_[1]; - $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size}); + $CFG->{gauge_fontsize} = $_[1]; + &set_gauge_window_fontsize; } ); - $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); + $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size"); $table->add (1, $row++, new CFClient::UI::Slider - range => [$CFG->{gauge_fontsize}, 0.5, 2.0, 0.1, 0.1], - tooltip => "Adjusts the fontsize of the gauges at the bottom right", + range => [$CFG->{gauge_size}, 0.2, 0.8], + tooltip => "Adjust the size of the stats gauges at the bottom right", connect_changed => sub { - $CFG->{gauge_fontsize} = $_[1]; - &set_gauge_window_fontsize; + $CFG->{gauge_size} = $_[1]; + $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size}); } ); @@ -327,7 +327,7 @@ } ); $hbox->add (new CFClient::UI::Slider - expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0.1], + expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], tooltip => "The volume of the background music", connect_changed => sub { $CFG->{bgm_volume} = $_[1]; @@ -427,7 +427,7 @@ } sub make_stats_window { - my $tgw = new CFClient::UI::FancyFrame x => $WIDTH * 2/5, y => 0, title => "Stats"; + my $tgw = new CFClient::UI::FancyFrame title => "Stats"; $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, @@ -440,7 +440,7 @@ $vb->add (my $hb = new CFClient::UI::HBox expand => 1); $hb->add (my $tbl = new CFClient::UI::Table expand => 1); - my $black = [0, 0, 0]; + my $color2 = [1, 1, 0]; for ( [0, 0, st_str => "Str", 30, "Physical Strength, determines damage dealt with weapons, how much you can carry, and how often you can attack"], @@ -463,7 +463,7 @@ $tbl->add ($col , $row, $STATWIDS->{$id} = new CFClient::UI::Label font => $FONT_FIXED, can_hover => 1, can_events => 1, valign => 0, align => +1, template => $template, tooltip => $tooltip); $tbl->add ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new CFClient::UI::Label - font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $black, valign => 0, align => -1, text => $label, tooltip => $tooltip); + font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2, valign => 0, align => -1, text => $label, tooltip => $tooltip); } $hb->add (my $tbl2 = new CFClient::UI::Table expand => 1); @@ -746,9 +746,9 @@ $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); $table->add (1, 7, new CFClient::UI::Slider req_w => 100, - range => [$CFG->{mapsize}, 10, 100 + 1, 1, 1], + range => [$CFG->{mapsize}, 10, 100, 0, 1], tooltip => "This is the size of the portion of the map update the server sends you. " - ."If you set this to a high value you will be able to see further for example.", + . "If you set this to a high value you will be able to see further for example.", connect_changed => sub { my ($self, $value) = @_; @@ -886,6 +886,43 @@ $invwin } +sub make_help_window { + my $win = new CFClient::UI::FancyFrame + user_w => $WIDTH * (7/8), user_h => $HEIGHT * (7/8), title => "Documentation"; + + $win->add (my $vbox = new CFClient::UI::VBox); + + $vbox->add (my $buttons = new CFClient::UI::HBox); + $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); + + for ( + [intro => "Introduction"], + [command_help => "Commands"], + [skill_help => "Skills"], + ) { + my ($pod, $label) = @$_; + + $buttons->add (new CFClient::UI::Button + text => $label, + connect_activate => sub { + my $parser = new Pod::POM; + my $pom = $parser->parse_file (CFClient::find_rcfile "pod/$pod.pod"); + + $viewer->clear; + + $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) + for @{ CFClient::pod_to_pango_list $pom }; + + $viewer->set_offset (0); + }, + ); + } + + $viewer->add_paragraph ([1, 1, 0, 1], "Use one of the buttons above to display a document."); + + $win +} + sub sdl_init { CFClient::SDL_Init and die "SDL::Init failed!\n"; @@ -987,14 +1024,17 @@ }, ); + $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window, + tooltip => "View Documentation"); + $BUTTONBAR->add (new CFClient::UI::Button text => "Quit", tooltip => "Terminates the program", connect_activate => sub { if ($CONN) { - open_quit_dialog + open_quit_dialog; } else { - exit 1 + exit; } }, ); @@ -1040,6 +1080,12 @@ if ($CFG->{audio_enable}) { if (open my $fh, "<", CFClient::find_rcfile "sounds/config") { $SDL_MIXER = !CFClient::Mix_OpenAudio; + + unless ($SDL_MIXER) { + status "Unable to open sound device: there will be no sound"; + return; + } + CFClient::Mix_AllocateChannels 8; CFClient::MixMusic::volume $CFG->{bgm_volume} * 128; @@ -1203,6 +1249,9 @@ } } + $self->{noface} = new_from_file CFClient::Texture + CFClient::find_rcfile "noface.png", minify => 1, mipmap => 1; + $self } @@ -1408,12 +1457,12 @@ unless ($id) { # create new id for face - # i love transactions + # I love transactions for (1..100) { my $txn = $CFClient::DB_ENV->txn_begin; my $status = $FACEMAP->db_get (id => $id, BerkeleyDB::DB_RMW); if ($status == 0 || $status == BerkeleyDB::DB_NOTFOUND) { - $id++; + $id = ($id || 16) + 1; if ($FACEMAP->put (id => $id) == 0 && $FACEMAP->put ($hash => $id) == 0) { $txn->txn_commit; @@ -1431,7 +1480,12 @@ $face->{id} = $id; $MAP->set_face ($facenum => $id); $self->{faceid}[$facenum] = $id;#d# - $TILECACHE->get ($id) + + $TILECACHE->get ($id) || do { + my $tex = $self->{noface}; + $MAP->set_texture ($id, @$tex{qw(name w h s t)}, @{$tex->{minified}}); + undef + }; } sub conn::face_update { @@ -1630,7 +1684,7 @@ $FLOORBOX->clear; $FLOORBOX->add (new CFClient::UI::Empty expand => 1); - my $count = 4; + my $count = 7; for (@{ $CONN->{container}{0} }) { if (--$count) { $FLOORBOX->add (new CFClient::UI::InventoryItem item => $_); @@ -1864,109 +1918,18 @@ END { CFClient::SDL_Quit } -=head1 pclient - Crossfire+ and Crossfire game client - -Pclient is a Crossfire+ and Crossfire game client. - -=head2 Features - -=over 4 - -=item Fullscreen Map - -PClient can uses a fullscreen map, which greatly enhances how much of the -game world you can see. - -=item Persistent Map Cache (Crossfire+ only) +=head1 NAME -PClient can persistently cache all map data it received from the -server. This not only allows it to display an overview map, but also -ensures that once-explored areas will be available the next time you want -to explore more. +pclient - A Crossfire+ and Crossfire game client -=item Hardware acceleration +=head1 SYNOPSIS -Unlike most Crossfire clients, PClient take advantage of OpenGL hardware -acceleration. Most modern graphics cards have difficulties with 2D -acceleration, while 3D graphics is accelerated well. - -=item No arbitrary limits - -Unlike other Crossfire clients, pclient does not suffer from arbitrary -limits (like a fixed amount of face numbers). There are still limits, but -they are not arbitrarily low :) - -=back +Just run it - no commandline arguments are supported. =head1 USAGE -=head2 The Map - -The map is always displayed in the background, behind all other windows and UI elements. - -#TODO# middle-click scrolls -# -# keys: -# -# a apply -# keypad moves, kp_5 applies ranged attack to self - -Starting to type enters the I. In that mode, you can type -abbreviations or commands and have them executed as soon as they match a -valid command. This is best explained by a few examples: - -Typing B will display a list of commands with I in their -name, such as I and I. - -You can abbreviate commands by typing only the first character of every -word (or even characters within the word - the client will try to make -a good guess, as long as the characters are in order). For example, -typing I will likely select I, while I -will select I. Likewise, I will likely select -I and I will give you I. - -You can enter space and other text as arguemnt to the command. For -example, C will expand to C. - -=head2 The map overview - -#TODO# - -=head2 The Status area in the lower right corner - -#TODO# - -=head2 The I/I>Stats> window - -#TODO# - -=head1 FAQ - -=over 4 - -=item The client is very sluggish and slow, what can I do about this? - -Most likely, you don't have accelerated OpenGL support. Try to find a -newer driver, or a driver from your hardware vendor, that features OpenGL -support. - -If this is not an option, the following Setup options reduce the load and -will likely make the client playable with sofwtare rendering (it will -still be slow, though): - -=over 4 - -=item B