… | |
… | |
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", |
… | |
… | |
1196 | $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); |
1196 | $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); |
1197 | $table->add ($x+1, $y, new CFClient::UI::CheckBox |
1197 | $table->add ($x+1, $y, new CFClient::UI::CheckBox |
1198 | state => $CFG->{pickup} & $mask, |
1198 | state => $CFG->{pickup} & $mask, |
1199 | on_changed => sub { |
1199 | on_changed => sub { |
1200 | my ($box, $value) = @_; |
1200 | my ($box, $value) = @_; |
|
|
1201 | |
1201 | if ($value) { |
1202 | if ($value) { |
1202 | $::CFG->{pickup} |= $mask; |
1203 | $::CFG->{pickup} |= $mask; |
1203 | } else { |
1204 | } else { |
1204 | $::CFG->{pickup} = $::CFG->{pickup} & ~$mask; |
1205 | $::CFG->{pickup} &= ~$mask; |
1205 | } |
1206 | } |
|
|
1207 | |
1206 | $::CONN->send (sprintf "command pickup %u", $::CFG->{pickup}) |
1208 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1207 | if defined $::CONN; |
1209 | if defined $::CONN; |
1208 | }); |
1210 | }); |
1209 | } |
1211 | } |
1210 | } |
1212 | } |
1211 | |
1213 | |
… | |
… | |
1333 | $refresh->(); |
1335 | $refresh->(); |
1334 | |
1336 | |
1335 | $vb |
1337 | $vb |
1336 | } |
1338 | } |
1337 | |
1339 | |
1338 | sub make_help_window { |
1340 | sub help_window { |
1339 | my $win = new CFClient::UI::FancyFrame |
1341 | my $win = new CFClient::UI::FancyFrame |
1340 | x => 'center', |
1342 | x => 'center', |
1341 | y => 'center', |
1343 | y => 'center', |
1342 | z => 2, |
1344 | z => 2, |
1343 | name => 'doc_browser', |
1345 | name => 'doc_browser', |
… | |
… | |
1346 | title => "Documentation"; |
1348 | title => "Documentation"; |
1347 | |
1349 | |
1348 | $win->add (my $vbox = new CFClient::UI::VBox); |
1350 | $win->add (my $vbox = new CFClient::UI::VBox); |
1349 | |
1351 | |
1350 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1352 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1351 | $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); |
1353 | $vbox->add (my $viewer = new CFClient::UI::TextScroller |
|
|
1354 | expand => 1, fontsize => 0.8, padding_x => 4); |
1352 | |
1355 | |
1353 | for ( |
1356 | $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); |
|
|
1357 | $buttons->add (my $combo = new CFClient::UI::Combobox |
|
|
1358 | value => undef, |
|
|
1359 | options => [ |
1354 | [intro => "Introduction"], |
1360 | [intro => "Introduction"], |
1355 | [manual => "Manual"], |
1361 | [manual => "Manual"], |
|
|
1362 | [skill_help => "Skills"], |
1356 | [command_help => "Commands"], |
1363 | [command_help => "Commands"], |
1357 | [skill_help => "Skills"], |
1364 | [dmcommand_help => "DM Commands"], |
1358 | ) { |
1365 | [COPYING => "License Terms"], |
1359 | my ($pod, $label) = @$_; |
1366 | ], |
|
|
1367 | on_changed => sub { |
|
|
1368 | my ($self, $pod) = @_; |
1360 | |
1369 | |
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", |
1370 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1365 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1371 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1366 | |
1372 | |
1367 | $viewer->clear; |
1373 | $viewer->clear; |
1368 | |
1374 | |
1369 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1375 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1370 | for @$pom; |
1376 | for @$pom; |
1371 | |
1377 | |
1372 | $viewer->set_offset (0); |
1378 | $viewer->set_offset (0); |
1373 | }, |
1379 | }, |
|
|
1380 | on_visibility_change => sub { |
|
|
1381 | my ($self, $visible) = @_; |
|
|
1382 | return unless $visible; |
|
|
1383 | return if $self->{value}; |
|
|
1384 | $self->set_value ("intro"); |
|
|
1385 | }, |
1374 | ); |
1386 | ); |
1375 | } |
|
|
1376 | |
|
|
1377 | $viewer->add_paragraph ([1, 1, 0, 1], "<big>Use one of the buttons above to display a document.</big>"); |
|
|
1378 | |
1387 | |
1379 | $win |
1388 | $win |
1380 | } |
1389 | } |
1381 | |
1390 | |
1382 | sub sdl_init { |
1391 | sub sdl_init { |
… | |
… | |
1459 | } |
1468 | } |
1460 | }); |
1469 | }); |
1461 | $MAPWIDGET->show; |
1470 | $MAPWIDGET->show; |
1462 | $MAPWIDGET->focus_in; |
1471 | $MAPWIDGET->focus_in; |
1463 | |
1472 | |
1464 | $LOGVIEW = new CFClient::UI::TextView |
1473 | $LOGVIEW = new CFClient::UI::TextScroller |
1465 | expand => 1, |
1474 | expand => 1, |
1466 | font => $FONT_FIXED, |
1475 | font => $FONT_FIXED, |
1467 | fontsize => $::CFG->{log_fontsize}, |
1476 | fontsize => $::CFG->{log_fontsize}, |
1468 | indent => -4, |
1477 | indent => -4, |
1469 | can_hover => 1, |
1478 | can_hover => 1, |
… | |
… | |
1526 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1535 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1527 | status "Configuration Saved"; |
1536 | status "Configuration Saved"; |
1528 | }, |
1537 | }, |
1529 | ); |
1538 | ); |
1530 | |
1539 | |
1531 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window, |
1540 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => help_window, |
1532 | tooltip => "View Documentation"); |
1541 | tooltip => "View Documentation"); |
1533 | |
1542 | |
1534 | $BUTTONBAR->add (new CFClient::UI::Button |
1543 | $BUTTONBAR->add (new CFClient::UI::Button |
1535 | text => "Quit", |
1544 | text => "Quit", |
1536 | tooltip => "Terminates the program", |
1545 | tooltip => "Terminates the program", |
… | |
… | |
1797 | bgm_enable => 1, |
1806 | bgm_enable => 1, |
1798 | bgm_volume => 0.25, |
1807 | bgm_volume => 0.25, |
1799 | face_prefetch => 0, |
1808 | face_prefetch => 0, |
1800 | output_sync => 1, |
1809 | output_sync => 1, |
1801 | output_count => 1, |
1810 | output_count => 1, |
|
|
1811 | pickup => 0, |
1802 | ); |
1812 | ); |
1803 | |
1813 | |
1804 | while (my ($k, $v) = each %DEF_CFG) { |
1814 | while (my ($k, $v) = each %DEF_CFG) { |
1805 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
1815 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
1806 | } |
1816 | } |