ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/cfplus
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.62 by root, Tue Jun 6 08:35:22 2006 UTC vs.
Revision 1.65 by root, Thu Jun 8 01:51:32 2006 UTC

237 237
238 # center: swap stats 238 # center: swap stats
239 my ($sw1, $sw2) = map +(new CFClient::UI::Combobox 239 my ($sw1, $sw2) = map +(new CFClient::UI::Combobox
240 value => $_, 240 value => $_,
241 options => [ 241 options => [
242 [Str => 1, "Strength ($conn->{stat}{+CS_STAT_STR})"], 242 [1 => "Str", "Strength ($conn->{stat}{+CS_STAT_STR})"],
243 [Dex => 2, "Dexterity ($conn->{stat}{+CS_STAT_DEX})"], 243 [2 => "Dex", "Dexterity ($conn->{stat}{+CS_STAT_DEX})"],
244 [Con => 3, "Constitution ($conn->{stat}{+CS_STAT_CON})"], 244 [3 => "Con", "Constitution ($conn->{stat}{+CS_STAT_CON})"],
245 [Int => 4, "Intelligence ($conn->{stat}{+CS_STAT_INT})"], 245 [4 => "Int", "Intelligence ($conn->{stat}{+CS_STAT_INT})"],
246 [Wis => 5, "Wisdom ($conn->{stat}{+CS_STAT_WIS})"], 246 [5 => "Wis", "Wisdom ($conn->{stat}{+CS_STAT_WIS})"],
247 [Pow => 6, "Power ($conn->{stat}{+CS_STAT_POW})"], 247 [6 => "Pow", "Power ($conn->{stat}{+CS_STAT_POW})"],
248 [Cha => 7, "Charisma ($conn->{stat}{+CS_STAT_CHA})"], 248 [7 => "Cha", "Charisma ($conn->{stat}{+CS_STAT_CHA})"],
249 ], 249 ],
250 ), 1 .. 2; 250 ), 1 .. 2;
251 251
252 $table->add (2, 0, new CFClient::UI::Button 252 $table->add (2, 0, new CFClient::UI::Button
253 text => "Swap Stats", 253 text => "Swap Stats",
625 &set_gauge_window_fontsize; 625 &set_gauge_window_fontsize;
626 626
627 $win 627 $win
628} 628}
629 629
630sub debug_setup {
631 my $table = new CFClient::UI::Table;
632
633 $table->add (0, 0, new CFClient::UI::Label text => "Widget Borders");
634 $table->add (1, 0, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 1 });
635 $table->add (0, 1, new CFClient::UI::Label text => "Tooltip Widget Info");
636 $table->add (1, 1, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2 });
637 $table->add (0, 2, new CFClient::UI::Label text => "Show FPS");
638 $table->add (1, 2, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4 });
639 $table->add (0, 3, new CFClient::UI::Label text => "Suppress Tooltips");
640 $table->add (1, 3, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8 });
641
642 my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05);
643
644 for my $x (0..2) {
645 for my $y (0 .. 2) {
646 $table->add ($x + 3, $y,
647 new CFClient::UI::Entry
648 text => $default_smooth[$x * 3 + $y],
649 on_changed => sub { $MAP->{smooth_matrix}[$x * 3 + $y] = $_[1] if $MAP; 0 },
650 );
651 }
652 }
653
654
655 $table
656}
630 657
631sub stats_window { 658sub stats_window {
632 my $tgw = new CFClient::UI::FancyFrame 659 my $tgw = new CFClient::UI::FancyFrame
633 y => $HEIGHT * (2/8), 660 y => $HEIGHT * (2/8),
634 x => "max", 661 x => "max",
1196 $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); 1223 $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1);
1197 $table->add ($x+1, $y, new CFClient::UI::CheckBox 1224 $table->add ($x+1, $y, new CFClient::UI::CheckBox
1198 state => $CFG->{pickup} & $mask, 1225 state => $CFG->{pickup} & $mask,
1199 on_changed => sub { 1226 on_changed => sub {
1200 my ($box, $value) = @_; 1227 my ($box, $value) = @_;
1228
1201 if ($value) { 1229 if ($value) {
1202 $::CFG->{pickup} |= $mask; 1230 $::CFG->{pickup} |= $mask;
1203 } else { 1231 } else {
1204 $::CFG->{pickup} = $::CFG->{pickup} & ~$mask; 1232 $::CFG->{pickup} &= ~$mask;
1205 } 1233 }
1234
1206 $::CONN->send (sprintf "command pickup %u", $::CFG->{pickup}) 1235 $::CONN->send_command ("pickup $::CFG->{pickup}")
1207 if defined $::CONN; 1236 if defined $::CONN;
1208 }); 1237 });
1209 } 1238 }
1210 } 1239 }
1211 1240
1333 $refresh->(); 1362 $refresh->();
1334 1363
1335 $vb 1364 $vb
1336} 1365}
1337 1366
1338sub make_help_window { 1367sub help_window {
1339 my $win = new CFClient::UI::FancyFrame 1368 my $win = new CFClient::UI::FancyFrame
1340 x => 'center', 1369 x => 'center',
1341 y => 'center', 1370 y => 'center',
1342 z => 2, 1371 z => 2,
1343 name => 'doc_browser', 1372 name => 'doc_browser',
1346 title => "Documentation"; 1375 title => "Documentation";
1347 1376
1348 $win->add (my $vbox = new CFClient::UI::VBox); 1377 $win->add (my $vbox = new CFClient::UI::VBox);
1349 1378
1350 $vbox->add (my $buttons = new CFClient::UI::HBox); 1379 $vbox->add (my $buttons = new CFClient::UI::HBox);
1351 $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); 1380 $vbox->add (my $viewer = new CFClient::UI::TextScroller
1381 expand => 1, fontsize => 0.8, padding_x => 4);
1352 1382
1353 for ( 1383 $buttons->add (new CFClient::UI::Label text => "Choose a document to display: ");
1384 $buttons->add (my $combo = new CFClient::UI::Combobox
1385 value => undef,
1386 options => [
1354 [intro => "Introduction"], 1387 [intro => "Introduction"],
1355 [manual => "Manual"], 1388 [manual => "Manual"],
1389 [skill_help => "Skills"],
1356 [command_help => "Commands"], 1390 [command_help => "Commands"],
1357 [skill_help => "Skills"], 1391 [dmcommand_help => "DM Commands"],
1358 ) { 1392 [COPYING => "License Terms"],
1359 my ($pod, $label) = @$_; 1393 ],
1394 on_changed => sub {
1395 my ($self, $pod) = @_;
1360 1396
1361 $buttons->add (new CFClient::UI::Button
1362 text => $label,
1363 on_activate => sub {
1364 my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", 1397 my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod",
1365 doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; 1398 doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] };
1366 1399
1367 $viewer->clear; 1400 $viewer->clear;
1368 1401
1369 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) 1402 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0])
1370 for @$pom; 1403 for @$pom;
1371 1404
1372 $viewer->set_offset (0); 1405 $viewer->set_offset (0);
1373 }, 1406 },
1407 on_visibility_change => sub {
1408 my ($self, $visible) = @_;
1409 return unless $visible;
1410 return if $self->{value};
1411 $self->set_value ("intro");
1412 },
1374 ); 1413 );
1375 }
1376
1377 $viewer->add_paragraph ([1, 1, 0, 1], "<big>Use one of the buttons above to display a document.</big>");
1378 1414
1379 $win 1415 $win
1380} 1416}
1381 1417
1382sub sdl_init { 1418sub sdl_init {
1459 } 1495 }
1460 }); 1496 });
1461 $MAPWIDGET->show; 1497 $MAPWIDGET->show;
1462 $MAPWIDGET->focus_in; 1498 $MAPWIDGET->focus_in;
1463 1499
1464 $LOGVIEW = new CFClient::UI::TextView 1500 $LOGVIEW = new CFClient::UI::TextScroller
1465 expand => 1, 1501 expand => 1,
1466 font => $FONT_FIXED, 1502 font => $FONT_FIXED,
1467 fontsize => $::CFG->{log_fontsize}, 1503 fontsize => $::CFG->{log_fontsize},
1468 indent => -4, 1504 indent => -4,
1469 can_hover => 1, 1505 can_hover => 1,
1499 . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " 1535 . "want to record press <b>Insert</b> and you will be asked to press a key-combo. "
1500 . "After pressing the combo the binding will be saved automatically and the " 1536 . "After pressing the combo the binding will be saved automatically and the "
1501 . "binding editor closes"); 1537 . "binding editor closes");
1502 $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, 1538 $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup,
1503 "Displays all spells you have and lets you edit keyboard shortcuts for them."); 1539 "Displays all spells you have and lets you edit keyboard shortcuts for them.");
1540 $SETUP_NOTEBOOK->add (Debug => debug_setup,
1541 "Some debuggign options. Do not ask.");
1504 1542
1505 $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top 1543 $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top
1506 1544
1507 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, 1545 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG,
1508 tooltip => "Toggles a dialog where you can configure all aspects of this client."); 1546 tooltip => "Toggles a dialog where you can configure all aspects of this client.");
1526 CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; 1564 CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc";
1527 status "Configuration Saved"; 1565 status "Configuration Saved";
1528 }, 1566 },
1529 ); 1567 );
1530 1568
1531 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window, 1569 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => help_window,
1532 tooltip => "View Documentation"); 1570 tooltip => "View Documentation");
1533 1571
1534 $BUTTONBAR->add (new CFClient::UI::Button 1572 $BUTTONBAR->add (new CFClient::UI::Button
1535 text => "Quit", 1573 text => "Quit",
1536 tooltip => "Terminates the program", 1574 tooltip => "Terminates the program",
1797 bgm_enable => 1, 1835 bgm_enable => 1,
1798 bgm_volume => 0.25, 1836 bgm_volume => 0.25,
1799 face_prefetch => 0, 1837 face_prefetch => 0,
1800 output_sync => 1, 1838 output_sync => 1,
1801 output_count => 1, 1839 output_count => 1,
1840 pickup => 0,
1802 ); 1841 );
1803 1842
1804 while (my ($k, $v) = each %DEF_CFG) { 1843 while (my ($k, $v) = each %DEF_CFG) {
1805 $CFG->{$k} = $v unless exists $CFG->{$k}; 1844 $CFG->{$k} = $v unless exists $CFG->{$k};
1806 } 1845 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines