… | |
… | |
84 | our $CONSOLE; |
84 | our $CONSOLE; |
85 | our $METASERVER; |
85 | our $METASERVER; |
86 | our $LOGIN_BUTTON; |
86 | our $LOGIN_BUTTON; |
87 | our $QUIT_DIALOG; |
87 | our $QUIT_DIALOG; |
88 | our $HOST_ENTRY; |
88 | our $HOST_ENTRY; |
|
|
89 | our $SERVER_INFO; |
89 | |
90 | |
90 | our $SETUP_DIALOG; |
91 | our $SETUP_DIALOG; |
91 | our $SETUP_NOTEBOOK; |
92 | our $SETUP_NOTEBOOK; |
92 | our $SETUP_SERVER; |
93 | our $SETUP_SERVER; |
93 | our $SETUP_KEYBOARD; |
94 | our $SETUP_KEYBOARD; |
… | |
… | |
362 | sub stop_game { |
363 | sub 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 | |
|
|
632 | sub 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 | |
631 | sub stats_window { |
660 | sub 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", |
… | |
… | |
787 | $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); |
816 | $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); |
788 | $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP}); |
817 | $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP}); |
789 | |
818 | |
790 | $STATWIDS->{m_weight}->set_text (sprintf "Max weight: %.1fkg", $stats->{+CS_STAT_WEIGHT_LIM} / 1000); |
819 | $STATWIDS->{m_weight}->set_text (sprintf "Max weight: %.1fkg", $stats->{+CS_STAT_WEIGHT_LIM} / 1000); |
791 | |
820 | |
792 | # TODO: replace by CS_STAT_RES_xxx constants |
|
|
793 | my %tbl = ( |
821 | my %tbl = ( |
794 | phys => 100, |
822 | phys => CS_STAT_RES_PHYS, |
795 | magic => 101, |
823 | magic => CS_STAT_RES_MAG, |
796 | fire => 102, |
824 | fire => CS_STAT_RES_FIRE, |
797 | elec => 103, |
825 | elec => CS_STAT_RES_ELEC, |
798 | cold => 104, |
826 | cold => CS_STAT_RES_COLD, |
799 | conf => 105, |
827 | conf => CS_STAT_RES_CONF, |
800 | acid => 106, |
828 | acid => CS_STAT_RES_ACID, |
801 | drain => 107, |
829 | drain => CS_STAT_RES_DRAIN, |
802 | ghit => 108, |
830 | ghit => CS_STAT_RES_GHOSTHIT, |
803 | pois => 109, |
831 | pois => CS_STAT_RES_POISON, |
804 | slow => 110, |
832 | slow => CS_STAT_RES_SLOW, |
805 | para => 111, |
833 | para => CS_STAT_RES_PARA, |
806 | tund => 112, |
834 | tund => CS_STAT_TURN_UNDEAD, |
807 | fear => 113, |
835 | fear => CS_STAT_RES_FEAR, |
808 | depl => 113, |
836 | depl => CS_STAT_RES_DEPLETE, |
809 | deat => 115, |
837 | deat => CS_STAT_RES_DEATH, |
810 | holyw => 116, |
838 | holyw => CS_STAT_RES_HOLYWORD, |
811 | blind => 117, |
839 | blind => CS_STAT_RES_BLIND, |
812 | ); |
840 | ); |
813 | |
841 | |
814 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) |
842 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) |
815 | for keys %tbl; |
843 | for keys %tbl; |
816 | } |
844 | } |
… | |
… | |
1049 | my ($self, $value) = @_; |
1077 | my ($self, $value) = @_; |
1050 | $CFG->{say_command} = $value; |
1078 | $CFG->{say_command} = $value; |
1051 | } |
1079 | } |
1052 | ); |
1080 | ); |
1053 | |
1081 | |
|
|
1082 | $vbox->add (new CFClient::UI::Label |
|
|
1083 | text => "Server Info", |
|
|
1084 | fontsize => 1.2, |
|
|
1085 | padding_y => 8, |
|
|
1086 | fg => [1, 1, 0, 1], |
|
|
1087 | ); |
|
|
1088 | |
|
|
1089 | $vbox->add ($SERVER_INFO = new CFClient::UI::Label ellipsise => 0); |
|
|
1090 | |
1054 | $vbox |
1091 | $vbox |
1055 | } |
1092 | } |
1056 | |
1093 | |
1057 | sub message_window { |
1094 | sub message_window { |
1058 | my $window = new CFClient::UI::FancyFrame |
1095 | my $window = new CFClient::UI::FancyFrame |
… | |
… | |
1182 | ["Potions" => PICKUP_POTION], |
1219 | ["Potions" => PICKUP_POTION], |
1183 | ["Magic Devices" => PICKUP_MAGIC_DEVICE], |
1220 | ["Magic Devices" => PICKUP_MAGIC_DEVICE], |
1184 | ["Ignore cursed" => PICKUP_NOT_CURSED], |
1221 | ["Ignore cursed" => PICKUP_NOT_CURSED], |
1185 | ["Jewelery" => PICKUP_JEWELS], |
1222 | ["Jewelery" => PICKUP_JEWELS], |
1186 | ], |
1223 | ], |
|
|
1224 | ["Weight/Value ratio", 2, 17] |
1187 | ) |
1225 | ) |
1188 | { |
1226 | { |
1189 | my ($title, $x, $y, @bits) = @$_; |
1227 | my ($title, $x, $y, @bits) = @$_; |
1190 | $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); |
1228 | $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); |
1191 | |
1229 | |
… | |
… | |
1208 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1246 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1209 | if defined $::CONN; |
1247 | if defined $::CONN; |
1210 | }); |
1248 | }); |
1211 | } |
1249 | } |
1212 | } |
1250 | } |
|
|
1251 | |
|
|
1252 | $table->add (2, 18, new CFClient::UI::ValSlider |
|
|
1253 | range => [0, 0, 16, 1, 1], |
|
|
1254 | to_value => sub { ">= " . 5 * $_[0] }, |
|
|
1255 | on_changed => sub { |
|
|
1256 | my ($slider, $value) = @_; |
|
|
1257 | |
|
|
1258 | $::CFG->{pickup} &= ~0x7; |
|
|
1259 | $::CFG->{pickup} |= int $value |
|
|
1260 | if $value; |
|
|
1261 | 1; |
|
|
1262 | }); |
|
|
1263 | $table->add (3, 18, new CFClient::UI::Button |
|
|
1264 | text => "set", |
|
|
1265 | on_activate => sub { |
|
|
1266 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
|
|
1267 | if defined $::CONN; |
|
|
1268 | 1; |
|
|
1269 | }); |
1213 | |
1270 | |
1214 | $table |
1271 | $table |
1215 | } |
1272 | } |
1216 | |
1273 | |
1217 | sub inventory_window { |
1274 | sub inventory_window { |
… | |
… | |
1295 | } |
1352 | } |
1296 | } |
1353 | } |
1297 | }; |
1354 | }; |
1298 | |
1355 | |
1299 | my $vb = new CFClient::UI::VBox; |
1356 | my $vb = new CFClient::UI::VBox; |
|
|
1357 | $vb->add (my $hb = new CFClient::UI::HBox); |
|
|
1358 | $hb->add (new CFClient::UI::Label text => "only shift-up stops fire"); |
|
|
1359 | $hb->add (new CFClient::UI::CheckBox |
|
|
1360 | expand => 1, |
|
|
1361 | state => $CFG->{shift_fire_stop}, |
|
|
1362 | tooltip => "If this checkbox is enabled you will stop fire only if you stop pressing shift", |
|
|
1363 | on_changed => sub { |
|
|
1364 | my ($cbox, $value) = @_; |
|
|
1365 | $CFG->{shift_fire_stop} = $value; |
|
|
1366 | }); |
|
|
1367 | |
1300 | $vb->add ($binding_list); |
1368 | $vb->add ($binding_list); |
1301 | $vb->add (my $hb = new CFClient::UI::HBox); |
1369 | $vb->add (my $hb = new CFClient::UI::HBox); |
1302 | |
1370 | |
1303 | $hb->add (new CFClient::UI::Button |
1371 | $hb->add (new CFClient::UI::Button |
1304 | text => "record new", |
1372 | text => "record new", |
… | |
… | |
1447 | name => "mapmap", |
1515 | name => "mapmap", |
1448 | x => 0, |
1516 | x => 0, |
1449 | y => $FONTSIZE + 8, |
1517 | y => $FONTSIZE + 8, |
1450 | border_bg => [1, 1, 1, 192/255], |
1518 | border_bg => [1, 1, 1, 192/255], |
1451 | bg => [1, 1, 1, 0], |
1519 | bg => [1, 1, 1, 0], |
|
|
1520 | no_close_button => 1, |
1452 | child => ($MAPMAP = new CFClient::MapWidget::MapMap |
1521 | child => ($MAPMAP = new CFClient::MapWidget::MapMap |
1453 | tooltip => "<b>Map</b>. On servers that support this feature, this will display an overview of the surrounding areas.", |
1522 | tooltip => "<b>Map</b>. On servers that support this feature, this will display an overview of the surrounding areas.", |
1454 | ), |
1523 | ), |
1455 | )->show; |
1524 | )->show; |
1456 | |
1525 | |
… | |
… | |
1508 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1577 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1509 | . "After pressing the combo the binding will be saved automatically and the " |
1578 | . "After pressing the combo the binding will be saved automatically and the " |
1510 | . "binding editor closes"); |
1579 | . "binding editor closes"); |
1511 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1580 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1512 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
1581 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
|
|
1582 | $SETUP_NOTEBOOK->add (Debug => debug_setup, |
|
|
1583 | "Some debuggign options. Do not ask."); |
1513 | |
1584 | |
1514 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1585 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1515 | |
1586 | |
1516 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1587 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1517 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
1588 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
… | |
… | |
1558 | |
1629 | |
1559 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
1630 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
1560 | } |
1631 | } |
1561 | |
1632 | |
1562 | sub video_shutdown { |
1633 | sub video_shutdown { |
|
|
1634 | CFClient::OpenGL::shutdown; |
|
|
1635 | |
1563 | undef $SDL_ACTIVE; |
1636 | undef $SDL_ACTIVE; |
1564 | } |
1637 | } |
1565 | |
1638 | |
1566 | my @bgmusic = qw(game1.ogg game2.ogg game3.ogg game5.ogg game6.ogg ross1.ogg ross2.ogg ross3.ogg ross4.ogg ross5.ogg); #d# |
1639 | my @bgmusic = qw(game1.ogg game2.ogg game3.ogg game5.ogg game6.ogg ross1.ogg ross2.ogg ross3.ogg ross4.ogg ross5.ogg); #d# |
1567 | my $bgmusic;#TODO#hack#d# |
1640 | my $bgmusic;#TODO#hack#d# |
… | |
… | |
1863 | video_init; |
1936 | video_init; |
1864 | audio_init; |
1937 | audio_init; |
1865 | } |
1938 | } |
1866 | |
1939 | |
1867 | Event::loop; |
1940 | Event::loop; |
|
|
1941 | #CFClient::SDL_Quit; |
|
|
1942 | #CFClient::_exit 0; |
1868 | |
1943 | |
1869 | END { CFClient::SDL_Quit } |
1944 | END { CFClient::SDL_Quit } |
1870 | |
1945 | |
1871 | =head1 NAME |
1946 | =head1 NAME |
1872 | |
1947 | |