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.71 by elmex, Tue Jun 13 14:35:18 2006 UTC

84our $CONSOLE; 84our $CONSOLE;
85our $METASERVER; 85our $METASERVER;
86our $LOGIN_BUTTON; 86our $LOGIN_BUTTON;
87our $QUIT_DIALOG; 87our $QUIT_DIALOG;
88our $HOST_ENTRY; 88our $HOST_ENTRY;
89our $SERVER_INFO;
89 90
90our $SETUP_DIALOG; 91our $SETUP_DIALOG;
91our $SETUP_NOTEBOOK; 92our $SETUP_NOTEBOOK;
92our $SETUP_SERVER; 93our $SETUP_SERVER;
93our $SETUP_KEYBOARD; 94our $SETUP_KEYBOARD;
237 238
238 # center: swap stats 239 # center: swap stats
239 my ($sw1, $sw2) = map +(new CFClient::UI::Combobox 240 my ($sw1, $sw2) = map +(new CFClient::UI::Combobox
240 value => $_, 241 value => $_,
241 options => [ 242 options => [
242 [Str => 1, "Strength ($conn->{stat}{+CS_STAT_STR})"], 243 [1 => "Str", "Strength ($conn->{stat}{+CS_STAT_STR})"],
243 [Dex => 2, "Dexterity ($conn->{stat}{+CS_STAT_DEX})"], 244 [2 => "Dex", "Dexterity ($conn->{stat}{+CS_STAT_DEX})"],
244 [Con => 3, "Constitution ($conn->{stat}{+CS_STAT_CON})"], 245 [3 => "Con", "Constitution ($conn->{stat}{+CS_STAT_CON})"],
245 [Int => 4, "Intelligence ($conn->{stat}{+CS_STAT_INT})"], 246 [4 => "Int", "Intelligence ($conn->{stat}{+CS_STAT_INT})"],
246 [Wis => 5, "Wisdom ($conn->{stat}{+CS_STAT_WIS})"], 247 [5 => "Wis", "Wisdom ($conn->{stat}{+CS_STAT_WIS})"],
247 [Pow => 6, "Power ($conn->{stat}{+CS_STAT_POW})"], 248 [6 => "Pow", "Power ($conn->{stat}{+CS_STAT_POW})"],
248 [Cha => 7, "Charisma ($conn->{stat}{+CS_STAT_CHA})"], 249 [7 => "Cha", "Charisma ($conn->{stat}{+CS_STAT_CHA})"],
249 ], 250 ],
250 ), 1 .. 2; 251 ), 1 .. 2;
251 252
252 $table->add (2, 0, new CFClient::UI::Button 253 $table->add (2, 0, new CFClient::UI::Button
253 text => "Swap Stats", 254 text => "Swap Stats",
362sub stop_game { 363sub stop_game {
363 $LOGIN_BUTTON->set_text ("Login"); 364 $LOGIN_BUTTON->set_text ("Login");
364 $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); 365 $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER);
365 $SETUP_DIALOG->show; 366 $SETUP_DIALOG->show;
366 $INV_WINDOW->hide; 367 $INV_WINDOW->hide;
368 $SETUP_SPELLS->clear_spells;
367 369
368 return unless $CONN; 370 return unless $CONN;
369 371
370 status "connection closed"; 372 status "connection closed";
371 373
625 &set_gauge_window_fontsize; 627 &set_gauge_window_fontsize;
626 628
627 $win 629 $win
628} 630}
629 631
632sub debug_setup {
633 my $table = new CFClient::UI::Table;
634
635 $table->add (0, 0, new CFClient::UI::Label text => "Widget Borders");
636 $table->add (1, 0, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 1 });
637 $table->add (0, 1, new CFClient::UI::Label text => "Tooltip Widget Info");
638 $table->add (1, 1, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2 });
639 $table->add (0, 2, new CFClient::UI::Label text => "Show FPS");
640 $table->add (1, 2, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4 });
641 $table->add (0, 3, new CFClient::UI::Label text => "Suppress Tooltips");
642 $table->add (1, 3, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8 });
643
644 my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05);
645
646 for my $x (0..2) {
647 for my $y (0 .. 2) {
648 $table->add ($x + 3, $y,
649 new CFClient::UI::Entry
650 text => $default_smooth[$x * 3 + $y],
651 on_changed => sub { $MAP->{smooth_matrix}[$x * 3 + $y] = $_[1] if $MAP; 0 },
652 );
653 }
654 }
655
656
657 $table
658}
630 659
631sub stats_window { 660sub stats_window {
632 my $tgw = new CFClient::UI::FancyFrame 661 my $tgw = new CFClient::UI::FancyFrame
633 y => $HEIGHT * (2/8), 662 y => $HEIGHT * (2/8),
634 x => "max", 663 x => "max",
1049 my ($self, $value) = @_; 1078 my ($self, $value) = @_;
1050 $CFG->{say_command} = $value; 1079 $CFG->{say_command} = $value;
1051 } 1080 }
1052 ); 1081 );
1053 1082
1083 $vbox->add (new CFClient::UI::Label
1084 text => "Server Info",
1085 fontsize => 1.2,
1086 padding_y => 8,
1087 fg => [1, 1, 0, 1],
1088 );
1089
1090 $vbox->add ($SERVER_INFO = new CFClient::UI::Label ellipsise => 0);
1091
1054 $vbox 1092 $vbox
1055} 1093}
1056 1094
1057sub message_window { 1095sub message_window {
1058 my $window = new CFClient::UI::FancyFrame 1096 my $window = new CFClient::UI::FancyFrame
1182 ["Potions" => PICKUP_POTION], 1220 ["Potions" => PICKUP_POTION],
1183 ["Magic Devices" => PICKUP_MAGIC_DEVICE], 1221 ["Magic Devices" => PICKUP_MAGIC_DEVICE],
1184 ["Ignore cursed" => PICKUP_NOT_CURSED], 1222 ["Ignore cursed" => PICKUP_NOT_CURSED],
1185 ["Jewelery" => PICKUP_JEWELS], 1223 ["Jewelery" => PICKUP_JEWELS],
1186 ], 1224 ],
1225 ["Weight/Value ratio", 2, 17]
1187 ) 1226 )
1188 { 1227 {
1189 my ($title, $x, $y, @bits) = @$_; 1228 my ($title, $x, $y, @bits) = @$_;
1190 $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); 1229 $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]);
1191 1230
1196 $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); 1235 $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1);
1197 $table->add ($x+1, $y, new CFClient::UI::CheckBox 1236 $table->add ($x+1, $y, new CFClient::UI::CheckBox
1198 state => $CFG->{pickup} & $mask, 1237 state => $CFG->{pickup} & $mask,
1199 on_changed => sub { 1238 on_changed => sub {
1200 my ($box, $value) = @_; 1239 my ($box, $value) = @_;
1240
1201 if ($value) { 1241 if ($value) {
1202 $::CFG->{pickup} |= $mask; 1242 $::CFG->{pickup} |= $mask;
1203 } else { 1243 } else {
1204 $::CFG->{pickup} = $::CFG->{pickup} & ~$mask; 1244 $::CFG->{pickup} &= ~$mask;
1205 } 1245 }
1246
1206 $::CONN->send (sprintf "command pickup %u", $::CFG->{pickup}) 1247 $::CONN->send_command ("pickup $::CFG->{pickup}")
1207 if defined $::CONN; 1248 if defined $::CONN;
1208 }); 1249 });
1209 } 1250 }
1210 } 1251 }
1252
1253 $table->add (2, 18, new CFClient::UI::ValSlider
1254 range => [0, 0, 16, 1, 1],
1255 to_value => sub { ">= " . 5 * $_[0] },
1256 on_changed => sub {
1257 my ($slider, $value) = @_;
1258
1259 $::CFG->{pickup} &= ~0x7;
1260 $::CFG->{pickup} |= int $value
1261 if $value;
1262 1;
1263 });
1264 $table->add (3, 18, new CFClient::UI::Button
1265 text => "set",
1266 on_activate => sub {
1267 $::CONN->send_command ("pickup $::CFG->{pickup}")
1268 if defined $::CONN;
1269 1;
1270 });
1211 1271
1212 $table 1272 $table
1213} 1273}
1214 1274
1215sub inventory_window { 1275sub inventory_window {
1293 } 1353 }
1294 } 1354 }
1295 }; 1355 };
1296 1356
1297 my $vb = new CFClient::UI::VBox; 1357 my $vb = new CFClient::UI::VBox;
1358 $vb->add (my $hb = new CFClient::UI::HBox);
1359 $hb->add (new CFClient::UI::Label text => "only shift-up stops fire");
1360 $hb->add (new CFClient::UI::CheckBox
1361 expand => 1,
1362 state => $CFG->{shift_fire_stop},
1363 tooltip => "If this checkbox is enabled you will stop fire only if you stop pressing shift",
1364 on_changed => sub {
1365 my ($cbox, $value) = @_;
1366 $CFG->{shift_fire_stop} = $value;
1367 });
1368
1298 $vb->add ($binding_list); 1369 $vb->add ($binding_list);
1299 $vb->add (my $hb = new CFClient::UI::HBox); 1370 $vb->add (my $hb = new CFClient::UI::HBox);
1300 1371
1301 $hb->add (new CFClient::UI::Button 1372 $hb->add (new CFClient::UI::Button
1302 text => "record new", 1373 text => "record new",
1333 $refresh->(); 1404 $refresh->();
1334 1405
1335 $vb 1406 $vb
1336} 1407}
1337 1408
1338sub make_help_window { 1409sub help_window {
1339 my $win = new CFClient::UI::FancyFrame 1410 my $win = new CFClient::UI::FancyFrame
1340 x => 'center', 1411 x => 'center',
1341 y => 'center', 1412 y => 'center',
1342 z => 2, 1413 z => 2,
1343 name => 'doc_browser', 1414 name => 'doc_browser',
1346 title => "Documentation"; 1417 title => "Documentation";
1347 1418
1348 $win->add (my $vbox = new CFClient::UI::VBox); 1419 $win->add (my $vbox = new CFClient::UI::VBox);
1349 1420
1350 $vbox->add (my $buttons = new CFClient::UI::HBox); 1421 $vbox->add (my $buttons = new CFClient::UI::HBox);
1351 $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); 1422 $vbox->add (my $viewer = new CFClient::UI::TextScroller
1423 expand => 1, fontsize => 0.8, padding_x => 4);
1352 1424
1353 for ( 1425 $buttons->add (new CFClient::UI::Label text => "Choose a document to display: ");
1426 $buttons->add (my $combo = new CFClient::UI::Combobox
1427 value => undef,
1428 options => [
1354 [intro => "Introduction"], 1429 [intro => "Introduction"],
1355 [manual => "Manual"], 1430 [manual => "Manual"],
1431 [skill_help => "Skills"],
1356 [command_help => "Commands"], 1432 [command_help => "Commands"],
1357 [skill_help => "Skills"], 1433 [dmcommand_help => "DM Commands"],
1358 ) { 1434 [COPYING => "License Terms"],
1359 my ($pod, $label) = @$_; 1435 ],
1436 on_changed => sub {
1437 my ($self, $pod) = @_;
1360 1438
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", 1439 my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod",
1365 doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; 1440 doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] };
1366 1441
1367 $viewer->clear; 1442 $viewer->clear;
1368 1443
1369 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) 1444 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0])
1370 for @$pom; 1445 for @$pom;
1371 1446
1372 $viewer->set_offset (0); 1447 $viewer->set_offset (0);
1373 }, 1448 },
1449 on_visibility_change => sub {
1450 my ($self, $visible) = @_;
1451 return unless $visible;
1452 return if $self->{value};
1453 $self->set_value ("intro");
1454 },
1374 ); 1455 );
1375 }
1376
1377 $viewer->add_paragraph ([1, 1, 0, 1], "<big>Use one of the buttons above to display a document.</big>");
1378 1456
1379 $win 1457 $win
1380} 1458}
1381 1459
1382sub sdl_init { 1460sub sdl_init {
1438 name => "mapmap", 1516 name => "mapmap",
1439 x => 0, 1517 x => 0,
1440 y => $FONTSIZE + 8, 1518 y => $FONTSIZE + 8,
1441 border_bg => [1, 1, 1, 192/255], 1519 border_bg => [1, 1, 1, 192/255],
1442 bg => [1, 1, 1, 0], 1520 bg => [1, 1, 1, 0],
1521 no_close_button => 1,
1443 child => ($MAPMAP = new CFClient::MapWidget::MapMap 1522 child => ($MAPMAP = new CFClient::MapWidget::MapMap
1444 tooltip => "<b>Map</b>. On servers that support this feature, this will display an overview of the surrounding areas.", 1523 tooltip => "<b>Map</b>. On servers that support this feature, this will display an overview of the surrounding areas.",
1445 ), 1524 ),
1446 )->show; 1525 )->show;
1447 1526
1459 } 1538 }
1460 }); 1539 });
1461 $MAPWIDGET->show; 1540 $MAPWIDGET->show;
1462 $MAPWIDGET->focus_in; 1541 $MAPWIDGET->focus_in;
1463 1542
1464 $LOGVIEW = new CFClient::UI::TextView 1543 $LOGVIEW = new CFClient::UI::TextScroller
1465 expand => 1, 1544 expand => 1,
1466 font => $FONT_FIXED, 1545 font => $FONT_FIXED,
1467 fontsize => $::CFG->{log_fontsize}, 1546 fontsize => $::CFG->{log_fontsize},
1468 indent => -4, 1547 indent => -4,
1469 can_hover => 1, 1548 can_hover => 1,
1499 . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " 1578 . "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 " 1579 . "After pressing the combo the binding will be saved automatically and the "
1501 . "binding editor closes"); 1580 . "binding editor closes");
1502 $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, 1581 $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup,
1503 "Displays all spells you have and lets you edit keyboard shortcuts for them."); 1582 "Displays all spells you have and lets you edit keyboard shortcuts for them.");
1583 $SETUP_NOTEBOOK->add (Debug => debug_setup,
1584 "Some debuggign options. Do not ask.");
1504 1585
1505 $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top 1586 $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top
1506 1587
1507 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, 1588 $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."); 1589 tooltip => "Toggles a dialog where you can configure all aspects of this client.");
1526 CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; 1607 CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc";
1527 status "Configuration Saved"; 1608 status "Configuration Saved";
1528 }, 1609 },
1529 ); 1610 );
1530 1611
1531 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window, 1612 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => help_window,
1532 tooltip => "View Documentation"); 1613 tooltip => "View Documentation");
1533 1614
1534 $BUTTONBAR->add (new CFClient::UI::Button 1615 $BUTTONBAR->add (new CFClient::UI::Button
1535 text => "Quit", 1616 text => "Quit",
1536 tooltip => "Terminates the program", 1617 tooltip => "Terminates the program",
1797 bgm_enable => 1, 1878 bgm_enable => 1,
1798 bgm_volume => 0.25, 1879 bgm_volume => 0.25,
1799 face_prefetch => 0, 1880 face_prefetch => 0,
1800 output_sync => 1, 1881 output_sync => 1,
1801 output_count => 1, 1882 output_count => 1,
1883 pickup => 0,
1802 ); 1884 );
1803 1885
1804 while (my ($k, $v) = each %DEF_CFG) { 1886 while (my ($k, $v) = each %DEF_CFG) {
1805 $CFG->{$k} = $v unless exists $CFG->{$k}; 1887 $CFG->{$k} = $v unless exists $CFG->{$k};
1806 } 1888 }
1853 video_init; 1935 video_init;
1854 audio_init; 1936 audio_init;
1855} 1937}
1856 1938
1857Event::loop; 1939Event::loop;
1940#CFClient::SDL_Quit;
1941#CFClient::_exit 0;
1858 1942
1859END { CFClient::SDL_Quit } 1943END { CFClient::SDL_Quit }
1860 1944
1861=head1 NAME 1945=head1 NAME
1862 1946

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines