… | |
… | |
25 | # need to do it again because that pile of garbage called PAR nukes it before main |
25 | # need to do it again because that pile of garbage called PAR nukes it before main |
26 | unshift @INC, $ENV{PAR_TEMP} |
26 | unshift @INC, $ENV{PAR_TEMP} |
27 | if %PAR::LibCache; |
27 | if %PAR::LibCache; |
28 | |
28 | |
29 | use Time::HiRes 'time'; |
29 | use Time::HiRes 'time'; |
30 | use Pod::POM; |
|
|
31 | use Event; |
30 | use Event; |
32 | |
31 | |
33 | use Crossfire; |
32 | use Crossfire; |
34 | use Crossfire::Protocol::Constants; |
33 | use Crossfire::Protocol::Constants; |
35 | |
34 | |
… | |
… | |
38 | use CFClient; |
37 | use CFClient; |
39 | use CFClient::OpenGL (); |
38 | use CFClient::OpenGL (); |
40 | use CFClient::Protocol; |
39 | use CFClient::Protocol; |
41 | use CFClient::UI; |
40 | use CFClient::UI; |
42 | use CFClient::MapWidget; |
41 | use CFClient::MapWidget; |
|
|
42 | |
|
|
43 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
43 | |
44 | |
44 | $Event::DIED = sub { |
45 | $Event::DIED = sub { |
45 | # TODO: display dialog box or so |
46 | # TODO: display dialog box or so |
46 | Carp::confess $_[1];#d#TODO: remove when stable |
47 | Carp::confess $_[1];#d#TODO: remove when stable |
47 | CFClient::error $_[1]; |
48 | CFClient::error $_[1]; |
… | |
… | |
711 | my $dialog = new CFClient::UI::FancyFrame |
712 | my $dialog = new CFClient::UI::FancyFrame |
712 | title => "Server List", |
713 | title => "Server List", |
713 | name => 'metaserver_dialog', |
714 | name => 'metaserver_dialog', |
714 | x => 'center', |
715 | x => 'center', |
715 | y => 'center', |
716 | y => 'center', |
|
|
717 | z => 3, |
716 | child => (my $vbox = new CFClient::UI::VBox), |
718 | child => (my $vbox = new CFClient::UI::VBox), |
717 | on_visibility_change => sub { |
719 | on_visibility_change => sub { |
718 | update_metaserver if $_[1]; |
720 | update_metaserver if $_[1]; |
719 | }, |
721 | }, |
720 | ; |
722 | ; |
… | |
… | |
903 | sub open_quit_dialog { |
905 | sub open_quit_dialog { |
904 | unless ($QUIT_DIALOG) { |
906 | unless ($QUIT_DIALOG) { |
905 | $QUIT_DIALOG = new CFClient::UI::FancyFrame |
907 | $QUIT_DIALOG = new CFClient::UI::FancyFrame |
906 | x => "center", |
908 | x => "center", |
907 | y => "center", |
909 | y => "center", |
|
|
910 | z => 50, |
908 | title => "Really Quit?", |
911 | title => "Really Quit?", |
909 | ; |
912 | ; |
910 | |
913 | |
911 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
914 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
912 | |
915 | |
… | |
… | |
934 | sub autopickup_setup { |
937 | sub autopickup_setup { |
935 | my $table = new CFClient::UI::Table; |
938 | my $table = new CFClient::UI::Table; |
936 | |
939 | |
937 | for ( |
940 | for ( |
938 | ["General", 0, 0, |
941 | ["General", 0, 0, |
939 | ["Enable autopickup" => CFClient::Pickup::PU_NEWMODE], |
942 | ["Enable autopickup" => PICKUP_NEWMODE], |
940 | ["Inhibit autopickup" => CFClient::Pickup::PU_INHIBIT], |
943 | ["Inhibit autopickup" => PICKUP_INHIBIT], |
941 | ["Stop before pickup" => CFClient::Pickup::PU_STOP], |
944 | ["Stop before pickup" => PICKUP_STOP], |
942 | ["Debug autopickup" => CFClient::Pickup::PU_DEBUG], |
945 | ["Debug autopickup" => PICKUP_DEBUG], |
943 | ], |
946 | ], |
944 | ["Weapons", 0, 6, |
947 | ["Weapons", 0, 6, |
945 | ["All weapons" => CFClient::Pickup::PU_ALLWEAPON], |
948 | ["All weapons" => PICKUP_ALLWEAPON], |
946 | ["Missile weapons" => CFClient::Pickup::PU_MISSILEWEAPON], |
949 | ["Missile weapons" => PICKUP_MISSILEWEAPON], |
947 | ["Bows" => CFClient::Pickup::PU_BOW], |
950 | ["Bows" => PICKUP_BOW], |
948 | ["Arrows" => CFClient::Pickup::PU_ARROW], |
951 | ["Arrows" => PICKUP_ARROW], |
949 | ], |
952 | ], |
950 | ["Armour", 0, 12, |
953 | ["Armour", 0, 12, |
951 | ["Helmets" => CFClient::Pickup::PU_HELMET], |
954 | ["Helmets" => PICKUP_HELMET], |
952 | ["Shields" => CFClient::Pickup::PU_SHIELD], |
955 | ["Shields" => PICKUP_SHIELD], |
953 | ["Body Armour" => CFClient::Pickup::PU_ARMOUR], |
956 | ["Body Armour" => PICKUP_ARMOUR], |
954 | ["Boots" => CFClient::Pickup::PU_BOOTS], |
957 | ["Boots" => PICKUP_BOOTS], |
955 | ["Gloves" => CFClient::Pickup::PU_GLOVES], |
958 | ["Gloves" => PICKUP_GLOVES], |
956 | ["Cloaks" => CFClient::Pickup::PU_CLOAK], |
959 | ["Cloaks" => PICKUP_CLOAK], |
957 | ], |
960 | ], |
958 | |
961 | |
959 | ["Readables", 2, 2, |
962 | ["Readables", 2, 2, |
960 | ["Spellbooks" => CFClient::Pickup::PU_SPELLBOOK], |
963 | ["Spellbooks" => PICKUP_SPELLBOOK], |
961 | ["Skillscrolls" => CFClient::Pickup::PU_SKILLSCROLL], |
964 | ["Skillscrolls" => PICKUP_SKILLSCROLL], |
962 | ["Normal Books/Scrolls" => CFClient::Pickup::PU_READABLES], |
965 | ["Normal Books/Scrolls" => PICKUP_READABLES], |
963 | ], |
966 | ], |
964 | ["Misc", 2, 7, |
967 | ["Misc", 2, 7, |
965 | ["Food" => CFClient::Pickup::PU_FOOD], |
968 | ["Food" => PICKUP_FOOD], |
966 | ["Drinks" => CFClient::Pickup::PU_DRINK], |
969 | ["Drinks" => PICKUP_DRINK], |
967 | ["Valuables (Money, Gems)" => CFClient::Pickup::PU_VALUABLES], |
970 | ["Valuables (Money, Gems)" => PICKUP_VALUABLES], |
968 | ["Keys" => CFClient::Pickup::PU_KEY], |
971 | ["Keys" => PICKUP_KEY], |
969 | ["Magical Items" => CFClient::Pickup::PU_MAGICAL], |
972 | ["Magical Items" => PICKUP_MAGICAL], |
970 | ["Potions" => CFClient::Pickup::PU_POTION], |
973 | ["Potions" => PICKUP_POTION], |
971 | ["Magic Devices" => CFClient::Pickup::PU_MAGIC_DEVICE], |
974 | ["Magic Devices" => PICKUP_MAGIC_DEVICE], |
972 | ["Ignore cursed" => CFClient::Pickup::PU_NOT_CURSED], |
975 | ["Ignore cursed" => PICKUP_NOT_CURSED], |
973 | ["Jewelery" => CFClient::Pickup::PU_JEWELS], |
976 | ["Jewelery" => PICKUP_JEWELS], |
974 | ], |
977 | ], |
975 | ) |
978 | ) |
976 | { |
979 | { |
977 | my ($title, $x, $y, @bits) = @$_; |
980 | my ($title, $x, $y, @bits) = @$_; |
978 | $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); |
981 | $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); |
… | |
… | |
1125 | |
1128 | |
1126 | sub make_help_window { |
1129 | sub make_help_window { |
1127 | my $win = new CFClient::UI::FancyFrame |
1130 | my $win = new CFClient::UI::FancyFrame |
1128 | x => 'center', |
1131 | x => 'center', |
1129 | y => 'center', |
1132 | y => 'center', |
|
|
1133 | z => 2, |
1130 | name => 'doc_browser', |
1134 | name => 'doc_browser', |
1131 | force_w => int $WIDTH * 7/8, |
1135 | force_w => int $WIDTH * 7/8, |
1132 | force_h => int $HEIGHT * 7/8, |
1136 | force_h => int $HEIGHT * 7/8, |
1133 | title => "Documentation"; |
1137 | title => "Documentation"; |
1134 | |
1138 | |
… | |
… | |
1146 | my ($pod, $label) = @$_; |
1150 | my ($pod, $label) = @$_; |
1147 | |
1151 | |
1148 | $buttons->add (new CFClient::UI::Button |
1152 | $buttons->add (new CFClient::UI::Button |
1149 | text => $label, |
1153 | text => $label, |
1150 | on_activate => sub { |
1154 | on_activate => sub { |
1151 | my $parser = new Pod::POM; |
1155 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1152 | my $pom = $parser->parse_file (CFClient::find_rcfile "pod/$pod.pod"); |
1156 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1153 | |
1157 | |
1154 | $viewer->clear; |
1158 | $viewer->clear; |
1155 | |
1159 | |
1156 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1160 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1157 | for @{ CFClient::pod_to_pango_list $pom }; |
1161 | for @$pom; |
1158 | |
1162 | |
1159 | $viewer->set_offset (0); |
1163 | $viewer->set_offset (0); |
1160 | }, |
1164 | }, |
1161 | ); |
1165 | ); |
1162 | } |
1166 | } |
… | |
… | |
1271 | filter => new CFClient::UI::ScrolledWindow xxx => 1, expand => 1, scroll_y => 1); |
1275 | filter => new CFClient::UI::ScrolledWindow xxx => 1, expand => 1, scroll_y => 1); |
1272 | |
1276 | |
1273 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
1277 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
1274 | "Configure the server to play on, your username, password and other server-related options."); |
1278 | "Configure the server to play on, your username, password and other server-related options."); |
1275 | $SETUP_NOTEBOOK->add (Pickup => autopickup_setup, |
1279 | $SETUP_NOTEBOOK->add (Pickup => autopickup_setup, |
1276 | "Configure autopicking stetings, i.e. which items you will pick up automatically when walking over them."); |
1280 | "Configure autopickup settings, i.e. which items you will pick up automatically when walking (or running) over them."); |
1277 | $SETUP_NOTEBOOK->add (Graphics => graphics_setup, |
1281 | $SETUP_NOTEBOOK->add (Graphics => graphics_setup, |
1278 | "Configure the video mode, performance, fonts and other graphical aspects of the game."); |
1282 | "Configure the video mode, performance, fonts and other graphical aspects of the game."); |
1279 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
1283 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
1280 | "Configure the use of audio, sound effects and background music."); |
1284 | "Configure the use of audio, sound effects and background music."); |
1281 | $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, |
1285 | $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, |
… | |
… | |
1286 | . "After pressing the combo the binding will be saved automatically and the " |
1290 | . "After pressing the combo the binding will be saved automatically and the " |
1287 | . "binding editor closes"); |
1291 | . "binding editor closes"); |
1288 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1292 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1289 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
1293 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
1290 | |
1294 | |
1291 | $BUTTONBAR = new CFClient::UI::HBox x => 0, y => 0; |
1295 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1292 | |
1296 | |
1293 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1297 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1294 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
1298 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
1295 | |
1299 | |
1296 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window, |
1300 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window, |