… | |
… | |
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; |
… | |
… | |
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", |
… | |
… | |
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 | } |
… | |
… | |
846 | |
874 | |
847 | utf8::decode $buf if utf8::valid $buf; |
875 | utf8::decode $buf if utf8::valid $buf; |
848 | |
876 | |
849 | $table->clear; |
877 | $table->clear; |
850 | |
878 | |
|
|
879 | my @tip = ( |
|
|
880 | "The current number of users logged in on the server.", |
|
|
881 | "The hostname of the server.", |
|
|
882 | "The time this server has been running without being restarted.", |
|
|
883 | "The server software version - a '+' indicates a Crossfire+ server.", |
|
|
884 | "Short information about this server provided by its admins.", |
|
|
885 | ); |
851 | my @col = qw(Use #Users Host Uptime Version Description); |
886 | my @col = qw(#Users Host Uptime Version Description); |
852 | $table->add ($_, 0, new CFClient::UI::Label align => 0, fg => [1, 1, 0], text => $col[$_]) |
887 | $table->add ($_, 0, new CFClient::UI::Label |
|
|
888 | can_hover => 1, can_events => 1, |
|
|
889 | align => 0, fg => [1, 1, 0], |
|
|
890 | text => $col[$_], tooltip => $tip[$_]) |
853 | for 0 .. $#col; |
891 | for 0 .. $#col; |
854 | |
892 | |
855 | my @align = qw(1 0 1 1 -1); |
893 | my @align = qw(1 0 1 1 -1); |
856 | |
894 | |
857 | my $y = 0; |
895 | my $y = 0; |
858 | for my $m (sort { $b->[3] <=> $a->[3] } map [split /\|/], split /\015?\012/, $buf) { |
896 | for my $m (sort { $b->[3] <=> $a->[3] } map [split /\|/], split /\015?\012/, $buf) { |
… | |
… | |
875 | |
913 | |
876 | $m = [$users, $host, $uptime, $version, $desc]; |
914 | $m = [$users, $host, $uptime, $version, $desc]; |
877 | |
915 | |
878 | $y++; |
916 | $y++; |
879 | |
917 | |
880 | $table->add (0, $y, new CFClient::UI::VBox children => [ |
918 | $table->add (scalar @$m, $y, new CFClient::UI::VBox children => [ |
881 | (new CFClient::UI::Button text => "Use", on_activate => sub { |
919 | (new CFClient::UI::Button |
|
|
920 | text => "Use", |
|
|
921 | tooltip => "Put this server into the <b>Host:Port</b> field", |
|
|
922 | on_activate => sub { |
882 | $HOST_ENTRY->set_text ($CFG->{host} = $host); |
923 | $HOST_ENTRY->set_text ($CFG->{host} = $host); |
883 | $METASERVER->toggle_visibility; |
924 | $METASERVER->hide; |
|
|
925 | }, |
884 | }), |
926 | ), |
885 | (new CFClient::UI::Empty expand => 1), |
927 | (new CFClient::UI::Empty expand => 1), |
886 | ]); |
928 | ]); |
887 | |
929 | |
888 | $table->add ($_ + 1, $y, new CFClient::UI::Label |
930 | $table->add ($_, $y, new CFClient::UI::Label |
889 | ellipsise => 0, align => $align[$_], text => $m->[$_], fontsize => 0.8) |
931 | ellipsise => 0, |
|
|
932 | align => $align[$_], |
|
|
933 | text => $m->[$_], |
|
|
934 | tooltip => $tip[$_], |
|
|
935 | can_hover => 1, |
|
|
936 | can_events => 1, |
|
|
937 | fontsize => 0.8) |
890 | for 0 .. $#$m; |
938 | for 0 .. $#$m; |
891 | } |
939 | } |
892 | } |
940 | } |
893 | }); |
941 | }); |
894 | } |
942 | } |
895 | |
943 | |
896 | sub metaserver_dialog { |
944 | sub metaserver_dialog { |
897 | my $dialog = new CFClient::UI::FancyFrame |
945 | my $dialog = new CFClient::UI::FancyFrame |
898 | title => "Server List", |
946 | title => "Server List", |
899 | name => 'metaserver_dialog', |
947 | name => 'metaserver_dialog', |
900 | x => 'center', |
948 | x => 'center', |
901 | y => 'center', |
949 | y => 'center', |
902 | z => 3, |
950 | z => 3, |
|
|
951 | force_h => $::HEIGHT * 0.4, |
903 | child => (my $vbox = new CFClient::UI::VBox), |
952 | child => (my $vbox = new CFClient::UI::VBox), |
904 | on_visibility_change => sub { |
953 | on_visibility_change => sub { |
905 | update_metaserver if $_[1]; |
954 | update_metaserver if $_[1]; |
906 | }, |
955 | }, |
907 | ; |
956 | ; |
908 | |
957 | |
909 | $vbox->add ($dialog->{table} = new CFClient::UI::Table); |
958 | $dialog->{table} = new CFClient::UI::Table; |
|
|
959 | |
|
|
960 | $vbox->add (new CFClient::UI::ScrolledWindow expand => 1, child => $dialog->{table}); |
910 | |
961 | |
911 | $dialog |
962 | $dialog |
912 | } |
963 | } |
913 | |
964 | |
914 | sub server_setup { |
965 | sub server_setup { |
… | |
… | |
937 | expand => 1, |
988 | expand => 1, |
938 | text => "Server List", |
989 | text => "Server List", |
939 | other => $METASERVER, |
990 | other => $METASERVER, |
940 | tooltip => "Show a list of available crossfire servers", |
991 | tooltip => "Show a list of available crossfire servers", |
941 | on_activate => sub { $METASERVER->toggle_visibility }, |
992 | on_activate => sub { $METASERVER->toggle_visibility }, |
|
|
993 | on_visibility_change => sub { $METASERVER->hide unless $_[1] }, |
942 | ); |
994 | ); |
943 | } |
995 | } |
944 | |
996 | |
945 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); |
997 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); |
946 | $table->add (1, 4, new CFClient::UI::Entry |
998 | $table->add (1, 4, new CFClient::UI::Entry |
… | |
… | |
1024 | on_changed => sub { |
1076 | on_changed => sub { |
1025 | my ($self, $value) = @_; |
1077 | my ($self, $value) = @_; |
1026 | $CFG->{say_command} = $value; |
1078 | $CFG->{say_command} = $value; |
1027 | } |
1079 | } |
1028 | ); |
1080 | ); |
|
|
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); |
1029 | |
1090 | |
1030 | $vbox |
1091 | $vbox |
1031 | } |
1092 | } |
1032 | |
1093 | |
1033 | sub message_window { |
1094 | sub message_window { |
… | |
… | |
1158 | ["Potions" => PICKUP_POTION], |
1219 | ["Potions" => PICKUP_POTION], |
1159 | ["Magic Devices" => PICKUP_MAGIC_DEVICE], |
1220 | ["Magic Devices" => PICKUP_MAGIC_DEVICE], |
1160 | ["Ignore cursed" => PICKUP_NOT_CURSED], |
1221 | ["Ignore cursed" => PICKUP_NOT_CURSED], |
1161 | ["Jewelery" => PICKUP_JEWELS], |
1222 | ["Jewelery" => PICKUP_JEWELS], |
1162 | ], |
1223 | ], |
|
|
1224 | ["Weight/Value ratio", 2, 17] |
1163 | ) |
1225 | ) |
1164 | { |
1226 | { |
1165 | my ($title, $x, $y, @bits) = @$_; |
1227 | my ($title, $x, $y, @bits) = @$_; |
1166 | $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]); |
1167 | |
1229 | |
… | |
… | |
1172 | $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); |
1234 | $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); |
1173 | $table->add ($x+1, $y, new CFClient::UI::CheckBox |
1235 | $table->add ($x+1, $y, new CFClient::UI::CheckBox |
1174 | state => $CFG->{pickup} & $mask, |
1236 | state => $CFG->{pickup} & $mask, |
1175 | on_changed => sub { |
1237 | on_changed => sub { |
1176 | my ($box, $value) = @_; |
1238 | my ($box, $value) = @_; |
|
|
1239 | |
1177 | if ($value) { |
1240 | if ($value) { |
1178 | $::CFG->{pickup} |= $mask; |
1241 | $::CFG->{pickup} |= $mask; |
1179 | } else { |
1242 | } else { |
1180 | $::CFG->{pickup} = $::CFG->{pickup} & ~$mask; |
1243 | $::CFG->{pickup} &= ~$mask; |
1181 | } |
1244 | } |
|
|
1245 | |
1182 | $::CONN->send (sprintf "command pickup %u", $::CFG->{pickup}) |
1246 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1183 | if defined $::CONN; |
1247 | if defined $::CONN; |
1184 | }); |
1248 | }); |
1185 | } |
1249 | } |
1186 | } |
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 | }); |
1187 | |
1270 | |
1188 | $table |
1271 | $table |
1189 | } |
1272 | } |
1190 | |
1273 | |
1191 | sub inventory_window { |
1274 | sub inventory_window { |
… | |
… | |
1269 | } |
1352 | } |
1270 | } |
1353 | } |
1271 | }; |
1354 | }; |
1272 | |
1355 | |
1273 | 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 | |
1274 | $vb->add ($binding_list); |
1368 | $vb->add ($binding_list); |
1275 | $vb->add (my $hb = new CFClient::UI::HBox); |
1369 | $vb->add (my $hb = new CFClient::UI::HBox); |
1276 | |
1370 | |
1277 | $hb->add (new CFClient::UI::Button |
1371 | $hb->add (new CFClient::UI::Button |
1278 | text => "record new", |
1372 | text => "record new", |
… | |
… | |
1309 | $refresh->(); |
1403 | $refresh->(); |
1310 | |
1404 | |
1311 | $vb |
1405 | $vb |
1312 | } |
1406 | } |
1313 | |
1407 | |
1314 | sub make_help_window { |
1408 | sub help_window { |
1315 | my $win = new CFClient::UI::FancyFrame |
1409 | my $win = new CFClient::UI::FancyFrame |
1316 | x => 'center', |
1410 | x => 'center', |
1317 | y => 'center', |
1411 | y => 'center', |
1318 | z => 2, |
1412 | z => 2, |
1319 | name => 'doc_browser', |
1413 | name => 'doc_browser', |
… | |
… | |
1322 | title => "Documentation"; |
1416 | title => "Documentation"; |
1323 | |
1417 | |
1324 | $win->add (my $vbox = new CFClient::UI::VBox); |
1418 | $win->add (my $vbox = new CFClient::UI::VBox); |
1325 | |
1419 | |
1326 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1420 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1327 | $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); |
1421 | $vbox->add (my $viewer = new CFClient::UI::TextScroller |
|
|
1422 | expand => 1, fontsize => 0.8, padding_x => 4); |
1328 | |
1423 | |
1329 | for ( |
1424 | $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); |
|
|
1425 | $buttons->add (my $combo = new CFClient::UI::Combobox |
|
|
1426 | value => undef, |
|
|
1427 | options => [ |
1330 | [intro => "Introduction"], |
1428 | [intro => "Introduction"], |
1331 | [manual => "Manual"], |
1429 | [manual => "Manual"], |
|
|
1430 | [skill_help => "Skills"], |
1332 | [command_help => "Commands"], |
1431 | [command_help => "Commands"], |
1333 | [skill_help => "Skills"], |
1432 | [dmcommand_help => "DM Commands"], |
1334 | ) { |
1433 | [COPYING => "License Terms"], |
1335 | my ($pod, $label) = @$_; |
1434 | ], |
|
|
1435 | on_changed => sub { |
|
|
1436 | my ($self, $pod) = @_; |
1336 | |
1437 | |
1337 | $buttons->add (new CFClient::UI::Button |
|
|
1338 | text => $label, |
|
|
1339 | on_activate => sub { |
|
|
1340 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1438 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1341 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1439 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1342 | |
1440 | |
1343 | $viewer->clear; |
1441 | $viewer->clear; |
1344 | |
1442 | |
1345 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1443 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1346 | for @$pom; |
1444 | for @$pom; |
1347 | |
1445 | |
1348 | $viewer->set_offset (0); |
1446 | $viewer->set_offset (0); |
1349 | }, |
1447 | }, |
|
|
1448 | on_visibility_change => sub { |
|
|
1449 | my ($self, $visible) = @_; |
|
|
1450 | return unless $visible; |
|
|
1451 | return if $self->{value}; |
|
|
1452 | $self->set_value ("intro"); |
|
|
1453 | }, |
1350 | ); |
1454 | ); |
1351 | } |
|
|
1352 | |
|
|
1353 | $viewer->add_paragraph ([1, 1, 0, 1], "<big>Use one of the buttons above to display a document.</big>"); |
|
|
1354 | |
1455 | |
1355 | $win |
1456 | $win |
1356 | } |
1457 | } |
1357 | |
1458 | |
1358 | sub sdl_init { |
1459 | sub sdl_init { |
… | |
… | |
1414 | name => "mapmap", |
1515 | name => "mapmap", |
1415 | x => 0, |
1516 | x => 0, |
1416 | y => $FONTSIZE + 8, |
1517 | y => $FONTSIZE + 8, |
1417 | border_bg => [1, 1, 1, 192/255], |
1518 | border_bg => [1, 1, 1, 192/255], |
1418 | bg => [1, 1, 1, 0], |
1519 | bg => [1, 1, 1, 0], |
|
|
1520 | no_close_button => 1, |
1419 | child => ($MAPMAP = new CFClient::MapWidget::MapMap |
1521 | child => ($MAPMAP = new CFClient::MapWidget::MapMap |
1420 | 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.", |
1421 | ), |
1523 | ), |
1422 | )->show; |
1524 | )->show; |
1423 | |
1525 | |
… | |
… | |
1435 | } |
1537 | } |
1436 | }); |
1538 | }); |
1437 | $MAPWIDGET->show; |
1539 | $MAPWIDGET->show; |
1438 | $MAPWIDGET->focus_in; |
1540 | $MAPWIDGET->focus_in; |
1439 | |
1541 | |
1440 | $LOGVIEW = new CFClient::UI::TextView |
1542 | $LOGVIEW = new CFClient::UI::TextScroller |
1441 | expand => 1, |
1543 | expand => 1, |
1442 | font => $FONT_FIXED, |
1544 | font => $FONT_FIXED, |
1443 | fontsize => $::CFG->{log_fontsize}, |
1545 | fontsize => $::CFG->{log_fontsize}, |
1444 | indent => -4, |
1546 | indent => -4, |
1445 | can_hover => 1, |
1547 | can_hover => 1, |
… | |
… | |
1475 | . "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. " |
1476 | . "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 " |
1477 | . "binding editor closes"); |
1579 | . "binding editor closes"); |
1478 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1580 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1479 | "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."); |
1480 | |
1584 | |
1481 | $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 |
1482 | |
1586 | |
1483 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1587 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1484 | 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."); |
… | |
… | |
1502 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1606 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1503 | status "Configuration Saved"; |
1607 | status "Configuration Saved"; |
1504 | }, |
1608 | }, |
1505 | ); |
1609 | ); |
1506 | |
1610 | |
1507 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window, |
1611 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => help_window, |
1508 | tooltip => "View Documentation"); |
1612 | tooltip => "View Documentation"); |
1509 | |
1613 | |
1510 | $BUTTONBAR->add (new CFClient::UI::Button |
1614 | $BUTTONBAR->add (new CFClient::UI::Button |
1511 | text => "Quit", |
1615 | text => "Quit", |
1512 | tooltip => "Terminates the program", |
1616 | tooltip => "Terminates the program", |
… | |
… | |
1525 | |
1629 | |
1526 | $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]); |
1527 | } |
1631 | } |
1528 | |
1632 | |
1529 | sub video_shutdown { |
1633 | sub video_shutdown { |
|
|
1634 | CFClient::OpenGL::shutdown; |
|
|
1635 | |
1530 | undef $SDL_ACTIVE; |
1636 | undef $SDL_ACTIVE; |
1531 | } |
1637 | } |
1532 | |
1638 | |
1533 | 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# |
1534 | my $bgmusic;#TODO#hack#d# |
1640 | my $bgmusic;#TODO#hack#d# |
… | |
… | |
1773 | bgm_enable => 1, |
1879 | bgm_enable => 1, |
1774 | bgm_volume => 0.25, |
1880 | bgm_volume => 0.25, |
1775 | face_prefetch => 0, |
1881 | face_prefetch => 0, |
1776 | output_sync => 1, |
1882 | output_sync => 1, |
1777 | output_count => 1, |
1883 | output_count => 1, |
|
|
1884 | pickup => 0, |
1778 | ); |
1885 | ); |
1779 | |
1886 | |
1780 | while (my ($k, $v) = each %DEF_CFG) { |
1887 | while (my ($k, $v) = each %DEF_CFG) { |
1781 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
1888 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
1782 | } |
1889 | } |
… | |
… | |
1829 | video_init; |
1936 | video_init; |
1830 | audio_init; |
1937 | audio_init; |
1831 | } |
1938 | } |
1832 | |
1939 | |
1833 | Event::loop; |
1940 | Event::loop; |
|
|
1941 | #CFClient::SDL_Quit; |
|
|
1942 | #CFClient::_exit 0; |
1834 | |
1943 | |
1835 | END { CFClient::SDL_Quit } |
1944 | END { CFClient::SDL_Quit } |
1836 | |
1945 | |
1837 | =head1 NAME |
1946 | =head1 NAME |
1838 | |
1947 | |