… | |
… | |
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 | |
… | |
… | |
711 | my $dialog = new CFClient::UI::FancyFrame |
710 | my $dialog = new CFClient::UI::FancyFrame |
712 | title => "Server List", |
711 | title => "Server List", |
713 | name => 'metaserver_dialog', |
712 | name => 'metaserver_dialog', |
714 | x => 'center', |
713 | x => 'center', |
715 | y => 'center', |
714 | y => 'center', |
|
|
715 | z => 3, |
716 | child => (my $vbox = new CFClient::UI::VBox), |
716 | child => (my $vbox = new CFClient::UI::VBox), |
717 | on_visibility_change => sub { |
717 | on_visibility_change => sub { |
718 | update_metaserver if $_[1]; |
718 | update_metaserver if $_[1]; |
719 | }, |
719 | }, |
720 | ; |
720 | ; |
… | |
… | |
903 | sub open_quit_dialog { |
903 | sub open_quit_dialog { |
904 | unless ($QUIT_DIALOG) { |
904 | unless ($QUIT_DIALOG) { |
905 | $QUIT_DIALOG = new CFClient::UI::FancyFrame |
905 | $QUIT_DIALOG = new CFClient::UI::FancyFrame |
906 | x => "center", |
906 | x => "center", |
907 | y => "center", |
907 | y => "center", |
|
|
908 | z => 50, |
908 | title => "Really Quit?", |
909 | title => "Really Quit?", |
909 | ; |
910 | ; |
910 | |
911 | |
911 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
912 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
912 | |
913 | |
… | |
… | |
934 | sub autopickup_setup { |
935 | sub autopickup_setup { |
935 | my $table = new CFClient::UI::Table; |
936 | my $table = new CFClient::UI::Table; |
936 | |
937 | |
937 | for ( |
938 | for ( |
938 | ["General", 0, 0, |
939 | ["General", 0, 0, |
939 | ["Enable autopickup" => CFClient::Pickup::PU_NEWMODE], |
940 | ["Enable autopickup" => PICKUP_NEWMODE], |
940 | ["Inhibit autopickup" => CFClient::Pickup::PU_INHIBIT], |
941 | ["Inhibit autopickup" => PICKUP_INHIBIT], |
941 | ["Stop before pickup" => CFClient::Pickup::PU_STOP], |
942 | ["Stop before pickup" => PICKUP_STOP], |
942 | ["Debug autopickup" => CFClient::Pickup::PU_DEBUG], |
943 | ["Debug autopickup" => PICKUP_DEBUG], |
943 | ], |
944 | ], |
944 | ["Weapons", 0, 6, |
945 | ["Weapons", 0, 6, |
945 | ["All weapons" => CFClient::Pickup::PU_ALLWEAPON], |
946 | ["All weapons" => PICKUP_ALLWEAPON], |
946 | ["Missile weapons" => CFClient::Pickup::PU_MISSILEWEAPON], |
947 | ["Missile weapons" => PICKUP_MISSILEWEAPON], |
947 | ["Bows" => CFClient::Pickup::PU_BOW], |
948 | ["Bows" => PICKUP_BOW], |
948 | ["Arrows" => CFClient::Pickup::PU_ARROW], |
949 | ["Arrows" => PICKUP_ARROW], |
949 | ], |
950 | ], |
950 | ["Armour", 0, 12, |
951 | ["Armour", 0, 12, |
951 | ["Helmets" => CFClient::Pickup::PU_HELMET], |
952 | ["Helmets" => PICKUP_HELMET], |
952 | ["Shields" => CFClient::Pickup::PU_SHIELD], |
953 | ["Shields" => PICKUP_SHIELD], |
953 | ["Body Armour" => CFClient::Pickup::PU_ARMOUR], |
954 | ["Body Armour" => PICKUP_ARMOUR], |
954 | ["Boots" => CFClient::Pickup::PU_BOOTS], |
955 | ["Boots" => PICKUP_BOOTS], |
955 | ["Gloves" => CFClient::Pickup::PU_GLOVES], |
956 | ["Gloves" => PICKUP_GLOVES], |
956 | ["Cloaks" => CFClient::Pickup::PU_CLOAK], |
957 | ["Cloaks" => PICKUP_CLOAK], |
957 | ], |
958 | ], |
958 | |
959 | |
959 | ["Readables", 2, 2, |
960 | ["Readables", 2, 2, |
960 | ["Spellbooks" => CFClient::Pickup::PU_SPELLBOOK], |
961 | ["Spellbooks" => PICKUP_SPELLBOOK], |
961 | ["Skillscrolls" => CFClient::Pickup::PU_SKILLSCROLL], |
962 | ["Skillscrolls" => PICKUP_SKILLSCROLL], |
962 | ["Normal Books/Scrolls" => CFClient::Pickup::PU_READABLES], |
963 | ["Normal Books/Scrolls" => PICKUP_READABLES], |
963 | ], |
964 | ], |
964 | ["Misc", 2, 7, |
965 | ["Misc", 2, 7, |
965 | ["Food" => CFClient::Pickup::PU_FOOD], |
966 | ["Food" => PICKUP_FOOD], |
966 | ["Drinks" => CFClient::Pickup::PU_DRINK], |
967 | ["Drinks" => PICKUP_DRINK], |
967 | ["Valuables (Money, Gems)" => CFClient::Pickup::PU_VALUABLES], |
968 | ["Valuables (Money, Gems)" => PICKUP_VALUABLES], |
968 | ["Keys" => CFClient::Pickup::PU_KEY], |
969 | ["Keys" => PICKUP_KEY], |
969 | ["Magical Items" => CFClient::Pickup::PU_MAGICAL], |
970 | ["Magical Items" => PICKUP_MAGICAL], |
970 | ["Potions" => CFClient::Pickup::PU_POTION], |
971 | ["Potions" => PICKUP_POTION], |
971 | ["Magic Devices" => CFClient::Pickup::PU_MAGIC_DEVICE], |
972 | ["Magic Devices" => PICKUP_MAGIC_DEVICE], |
972 | ["Ignore cursed" => CFClient::Pickup::PU_NOT_CURSED], |
973 | ["Ignore cursed" => PICKUP_NOT_CURSED], |
973 | ["Jewelery" => CFClient::Pickup::PU_JEWELS], |
974 | ["Jewelery" => PICKUP_JEWELS], |
974 | ], |
975 | ], |
975 | ) |
976 | ) |
976 | { |
977 | { |
977 | my ($title, $x, $y, @bits) = @$_; |
978 | my ($title, $x, $y, @bits) = @$_; |
978 | $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); |
979 | $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); |
… | |
… | |
1125 | |
1126 | |
1126 | sub make_help_window { |
1127 | sub make_help_window { |
1127 | my $win = new CFClient::UI::FancyFrame |
1128 | my $win = new CFClient::UI::FancyFrame |
1128 | x => 'center', |
1129 | x => 'center', |
1129 | y => 'center', |
1130 | y => 'center', |
|
|
1131 | z => 2, |
1130 | name => 'doc_browser', |
1132 | name => 'doc_browser', |
1131 | force_w => int $WIDTH * 7/8, |
1133 | force_w => int $WIDTH * 7/8, |
1132 | force_h => int $HEIGHT * 7/8, |
1134 | force_h => int $HEIGHT * 7/8, |
1133 | title => "Documentation"; |
1135 | title => "Documentation"; |
1134 | |
1136 | |
… | |
… | |
1146 | my ($pod, $label) = @$_; |
1148 | my ($pod, $label) = @$_; |
1147 | |
1149 | |
1148 | $buttons->add (new CFClient::UI::Button |
1150 | $buttons->add (new CFClient::UI::Button |
1149 | text => $label, |
1151 | text => $label, |
1150 | on_activate => sub { |
1152 | on_activate => sub { |
1151 | my $parser = new Pod::POM; |
1153 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1152 | my $pom = $parser->parse_file (CFClient::find_rcfile "pod/$pod.pod"); |
1154 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1153 | |
1155 | |
1154 | $viewer->clear; |
1156 | $viewer->clear; |
1155 | |
1157 | |
1156 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1158 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1157 | for @{ CFClient::pod_to_pango_list $pom }; |
1159 | for @$pom; |
1158 | |
1160 | |
1159 | $viewer->set_offset (0); |
1161 | $viewer->set_offset (0); |
1160 | }, |
1162 | }, |
1161 | ); |
1163 | ); |
1162 | } |
1164 | } |
… | |
… | |
1209 | $DEBUG_STATUS->show; |
1211 | $DEBUG_STATUS->show; |
1210 | |
1212 | |
1211 | $BIND_EDITOR = new CFClient::UI::BindEditor (x => "max", y => 0); |
1213 | $BIND_EDITOR = new CFClient::UI::BindEditor (x => "max", y => 0); |
1212 | |
1214 | |
1213 | $STATUSBOX = new CFClient::UI::Statusbox; |
1215 | $STATUSBOX = new CFClient::UI::Statusbox; |
1214 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", pri => -100, color => [1, 1, 1, 0.8]); |
1216 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]); |
1215 | |
1217 | |
1216 | (new CFClient::UI::Frame |
1218 | (new CFClient::UI::Frame |
1217 | bg => [0, 0, 0, 0.4], |
1219 | bg => [0, 0, 0, 0.4], |
1218 | force_x => 0, |
1220 | force_x => 0, |
1219 | force_y => "max", |
1221 | force_y => "max", |
… | |
… | |
1271 | filter => new CFClient::UI::ScrolledWindow xxx => 1, expand => 1, scroll_y => 1); |
1273 | filter => new CFClient::UI::ScrolledWindow xxx => 1, expand => 1, scroll_y => 1); |
1272 | |
1274 | |
1273 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
1275 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
1274 | "Configure the server to play on, your username, password and other server-related options."); |
1276 | "Configure the server to play on, your username, password and other server-related options."); |
1275 | $SETUP_NOTEBOOK->add (Pickup => autopickup_setup, |
1277 | $SETUP_NOTEBOOK->add (Pickup => autopickup_setup, |
1276 | "Configure autopicking stetings, i.e. which items you will pick up automatically when walking over them."); |
1278 | "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, |
1279 | $SETUP_NOTEBOOK->add (Graphics => graphics_setup, |
1278 | "Configure the video mode, performance, fonts and other graphical aspects of the game."); |
1280 | "Configure the video mode, performance, fonts and other graphical aspects of the game."); |
1279 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
1281 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
1280 | "Configure the use of audio, sound effects and background music."); |
1282 | "Configure the use of audio, sound effects and background music."); |
1281 | $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, |
1283 | $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, |
1282 | "Lets you define, edit and delete bindings." |
1284 | "Lets you define, edit and delete bindings." |
1283 | . "There is a shortcut for making bindings: Left Control + Insert opens the binding editor " |
1285 | . "There is a shortcut for making bindings: <b>Left Control + Insert</b> opens the binding editor " |
1284 | . "with nothing set and the recording started. After doing the actions you " |
1286 | . "with nothing set and the recording started. After doing the actions you " |
1285 | . "want to record press Insert and you will be asked to press a key-combo. " |
1287 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1286 | . "After pressing the combo the binding will be saved automatically and the " |
1288 | . "After pressing the combo the binding will be saved automatically and the " |
1287 | . "binding editor closes"); |
1289 | . "binding editor closes"); |
1288 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1290 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1289 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
1291 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
1290 | |
1292 | |
1291 | $BUTTONBAR = new CFClient::UI::HBox x => 0, y => 0; |
1293 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1292 | |
1294 | |
1293 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1295 | $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."); |
1296 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
1295 | |
1297 | |
1296 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window, |
1298 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window, |