--- deliantra/Deliantra-Client/bin/cfplus 2006/05/31 10:15:34 1.37 +++ deliantra/Deliantra-Client/bin/cfplus 2006/06/02 16:52:49 1.45 @@ -83,6 +83,7 @@ our $METASERVER; our $LOGIN_BUTTON; our $QUIT_DIALOG; +our $HOST_ENTRY; our $SERVER_SETUP; our $FLOORBOX; @@ -108,6 +109,9 @@ our $BIND_WINDOW; our $BIND_EDITOR; +our $SPELL_LIST; +our $PICKUP_CFG; + sub status { $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); } @@ -628,21 +632,9 @@ for keys %tbl; } -sub metaserver_dialog { - my $dialog = new CFClient::UI::FancyFrame - title => "Server List", - child => (my $vbox = new CFClient::UI::VBox); - - $vbox->add ($dialog->{table} = new CFClient::UI::Table); - - $dialog -} - my $METASERVER_ATIME; sub update_metaserver { - my ($HOST) = @_; - return if $METASERVER_ATIME > time; $METASERVER_ATIME = time + 60; @@ -704,7 +696,8 @@ $table->add (0, $y, new CFClient::UI::VBox children => [ (new CFClient::UI::Button text => "Use", on_activate => sub { - $HOST->set_text ($CFG->{host} = $host); + $HOST_ENTRY->set_text ($CFG->{host} = $host); + $METASERVER->toggle_visibility; }), (new CFClient::UI::Empty expand => 1), ]); @@ -717,6 +710,23 @@ }); } +sub metaserver_dialog { + my $dialog = new CFClient::UI::FancyFrame + title => "Server List", + name => 'metaserver_dialog', + x => 'center', + y => 'center', + child => (my $vbox = new CFClient::UI::VBox), + on_visibility_change => sub { + update_metaserver if $_[1]; + }, + ; + + $vbox->add ($dialog->{table} = new CFClient::UI::Table); + + $dialog +} + sub server_setup { my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame x => "center", @@ -733,7 +743,7 @@ $table->add (1, 2, my $vbox = new CFClient::UI::VBox); $vbox->add ( - my $HOST = new CFClient::UI::Entry + $HOST_ENTRY = new CFClient::UI::Entry expand => 1, text => $CFG->{host}, tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", @@ -745,14 +755,12 @@ $METASERVER = metaserver_dialog; - $vbox->add (new CFClient::UI::Flopper - expand => 1, - text => "Server List", - other => $METASERVER, + $vbox->add (new CFClient::UI::Button + expand => 1, + text => "Server List", + other => $METASERVER, tooltip => "Show a list of available crossfire servers", - on_open => sub { - update_metaserver $HOST; - } + on_activate => sub { $METASERVER->toggle_visibility }, ); } @@ -925,6 +933,85 @@ $QUIT_DIALOG->show; } +sub make_pickup_cfg_window { + $PICKUP_CFG = new CFClient::UI::FancyFrame + title => "Autopickup configuration", + x => "center", + y => "center", + force_w => $WIDTH * 6/10, + force_h => $HEIGHT * 9/10; + + + $PICKUP_CFG->add (my $vb = new CFClient::UI::VBox); + $vb->add (my $gen_tbl = new CFClient::UI::Table expand => 1); + $vb->add (my $hb = new CFClient::UI::HBox expand => 1); + $hb->add (my $ltbl = new CFClient::UI::Table expand => 1); + $hb->add (my $rtbl = new CFClient::UI::Table expand => 1); + + my $tbl = 0; + my $tblrow = 0; + + for ( + ["General", $gen_tbl], + ["Enable autopickup" => CFClient::Pickup::PU_NEWMODE], + ["Inhibit autopickup" => CFClient::Pickup::PU_INHIBIT], + ["Stop before pickup" => CFClient::Pickup::PU_STOP], + ["Debug autopickup" => CFClient::Pickup::PU_DEBUG], + ["Weapons", $ltbl], + ["All weapons" => CFClient::Pickup::PU_ALLWEAPON], + ["Missile weapons" => CFClient::Pickup::PU_MISSILEWEAPON], + ["Bows" => CFClient::Pickup::PU_BOW], + ["Arrows" => CFClient::Pickup::PU_ARROW], + ["Armour"], + ["Helmets" => CFClient::Pickup::PU_HELMET], + ["Shields" => CFClient::Pickup::PU_SHIELD], + ["Body Armour" => CFClient::Pickup::PU_ARMOUR], + ["Boots" => CFClient::Pickup::PU_BOOTS], + ["Gloves" => CFClient::Pickup::PU_GLOVES], + ["Cloaks" => CFClient::Pickup::PU_CLOAK], + ["Readables", $rtbl], + ["Spellbooks" => CFClient::Pickup::PU_SPELLBOOK], + ["Skillscrolls" => CFClient::Pickup::PU_SKILLSCROLL], + ["Normal Books/Scrolls" => CFClient::Pickup::PU_READABLES], + ["Misc"], + ["Food" => CFClient::Pickup::PU_FOOD], + ["Drinks" => CFClient::Pickup::PU_DRINK], + ["Valuables (Money, Gems)" => CFClient::Pickup::PU_VALUABLES], + ["Keys" => CFClient::Pickup::PU_KEY], + ["Magical Items" => CFClient::Pickup::PU_MAGICAL], + ["Potions" => CFClient::Pickup::PU_POTION], + ["Magic Devices" => CFClient::Pickup::PU_MAGIC_DEVICE], + ["Ignore cursed" => CFClient::Pickup::PU_NOT_CURSED], + ["Jewelery" => CFClient::Pickup::PU_JEWELS], + ) + { + if (ref $_->[1]) { + $tbl = $_->[1]; + $tblrow = 0; + $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => -1); + } elsif (not defined $_->[1]) { + $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => -1); + } else { + my $mask = $_->[1]; + $tbl->add (0, $tblrow, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); + $tbl->add (1, $tblrow++, new CFClient::UI::CheckBox + state => $CFG->{pickup} & $mask, + on_changed => sub { + my ($box, $value) = @_; + if ($value) { + $::CFG->{pickup} |= $mask; + } else { + $::CFG->{pickup} = $::CFG->{pickup} & ~$mask; + } + $::CONN->send (sprintf "command pickup %u", $::CFG->{pickup}) + if defined $::CONN; + }); + } + } + + $PICKUP_CFG +} + sub make_inventory_window { my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame x => "center", @@ -952,6 +1039,13 @@ $invwin } +sub make_spell_list { + $SPELL_LIST = new CFClient::UI::SpellList + force_w => $WIDTH * (9/10), + force_h => $HEIGHT * (9/10); + $SPELL_LIST +} + sub make_binding_window { my $binding_list = new CFClient::UI::VBox; @@ -1049,9 +1143,12 @@ sub make_help_window { my $win = new CFClient::UI::FancyFrame - def_w => int $WIDTH * 7/8, - def_h => int $HEIGHT * 7/8, - title => "Documentation"; + x => 'center', + y => 'center', + name => 'doc_browser', + force_w => int $WIDTH * 7/8, + force_h => int $HEIGHT * 7/8, + title => "Documentation"; $win->add (my $vbox = new CFClient::UI::VBox); @@ -1142,6 +1239,8 @@ )->show; CFClient::UI::FancyFrame->new ( + title => "Mini Map", + name => "mapmap", x => 0, y => $FONTSIZE + 8, border_bg => [1, 1, 1, 192/255], @@ -1215,8 +1314,18 @@ ."with nothing set and the recording started. After doing the actions you " ."want to record press Insert and you will be asked to press a key-combo." ."After pressing the combo the binding will be saved automatically and the " - ."binding editor closes" - ); + ."binding editor closes"); + + $BUTTONBAR->add (new CFClient::UI::Flopper + text => "Spells", + other => make_spell_list, + tooltip => "The spell list"); + + $BUTTONBAR->add (new CFClient::UI::Flopper + text => "Pickup", + other => make_pickup_cfg_window, + tooltip => "The pickup dialog"); + $BUTTONBAR->add (new CFClient::UI::Button text => "Quit", @@ -1554,6 +1663,16 @@ cfplus utilises OpenGL for all UI elements and the game. It is supposed to be used fullscreen and interactively. +=head1 DEBUGGING + + +CFPLUS_DEBUG - environment variable + + 1 draw borders around widgets + 2 add low-level widget info to tooltips + 4 show fps + 8 suppress tooltips + =head1 AUTHOR Marc Lehmann , Robin Redeker