… | |
… | |
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 | |
… | |
… | |
174 | } |
173 | } |
175 | } |
174 | } |
176 | |
175 | |
177 | sub stop_game { |
176 | sub stop_game { |
178 | $LOGIN_BUTTON->set_text ("Login"); |
177 | $LOGIN_BUTTON->set_text ("Login"); |
|
|
178 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
179 | $SETUP_DIALOG->show; |
179 | $SETUP_DIALOG->show; |
180 | $INV_WINDOW->hide; |
180 | $INV_WINDOW->hide; |
181 | $LOGVIEW->hide; |
|
|
182 | |
181 | |
183 | return unless $CONN; |
182 | return unless $CONN; |
184 | |
183 | |
185 | status "connection closed"; |
184 | status "connection closed"; |
186 | |
185 | |
… | |
… | |
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 | |
… | |
… | |
1100 | $SETUP_DIALOG->show; |
1101 | $SETUP_DIALOG->show; |
1101 | }, |
1102 | }, |
1102 | sub { |
1103 | sub { |
1103 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1104 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1104 | $SETUP_DIALOG->show; |
1105 | $SETUP_DIALOG->show; |
1105 | }); |
1106 | }, |
|
|
1107 | ); |
1106 | $SETUP_DIALOG->hide; |
1108 | $SETUP_DIALOG->hide; |
1107 | $::BIND_EDITOR->show; |
1109 | $::BIND_EDITOR->show; |
1108 | }, |
1110 | }, |
1109 | ); |
1111 | ); |
1110 | |
1112 | |
… | |
… | |
1124 | |
1126 | |
1125 | sub make_help_window { |
1127 | sub make_help_window { |
1126 | my $win = new CFClient::UI::FancyFrame |
1128 | my $win = new CFClient::UI::FancyFrame |
1127 | x => 'center', |
1129 | x => 'center', |
1128 | y => 'center', |
1130 | y => 'center', |
|
|
1131 | z => 2, |
1129 | name => 'doc_browser', |
1132 | name => 'doc_browser', |
1130 | force_w => int $WIDTH * 7/8, |
1133 | force_w => int $WIDTH * 7/8, |
1131 | force_h => int $HEIGHT * 7/8, |
1134 | force_h => int $HEIGHT * 7/8, |
1132 | title => "Documentation"; |
1135 | title => "Documentation"; |
1133 | |
1136 | |
… | |
… | |
1145 | my ($pod, $label) = @$_; |
1148 | my ($pod, $label) = @$_; |
1146 | |
1149 | |
1147 | $buttons->add (new CFClient::UI::Button |
1150 | $buttons->add (new CFClient::UI::Button |
1148 | text => $label, |
1151 | text => $label, |
1149 | on_activate => sub { |
1152 | on_activate => sub { |
1150 | my $parser = new Pod::POM; |
1153 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1151 | my $pom = $parser->parse_file (CFClient::find_rcfile "pod/$pod.pod"); |
1154 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1152 | |
1155 | |
1153 | $viewer->clear; |
1156 | $viewer->clear; |
1154 | |
1157 | |
1155 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1158 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1156 | for @{ CFClient::pod_to_pango_list $pom }; |
1159 | for @$pom; |
1157 | |
1160 | |
1158 | $viewer->set_offset (0); |
1161 | $viewer->set_offset (0); |
1159 | }, |
1162 | }, |
1160 | ); |
1163 | ); |
1161 | } |
1164 | } |
… | |
… | |
1208 | $DEBUG_STATUS->show; |
1211 | $DEBUG_STATUS->show; |
1209 | |
1212 | |
1210 | $BIND_EDITOR = new CFClient::UI::BindEditor (x => "max", y => 0); |
1213 | $BIND_EDITOR = new CFClient::UI::BindEditor (x => "max", y => 0); |
1211 | |
1214 | |
1212 | $STATUSBOX = new CFClient::UI::Statusbox; |
1215 | $STATUSBOX = new CFClient::UI::Statusbox; |
1213 | $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]); |
1214 | |
1217 | |
1215 | (new CFClient::UI::Frame |
1218 | (new CFClient::UI::Frame |
1216 | bg => [0, 0, 0, 0.4], |
1219 | bg => [0, 0, 0, 0.4], |
1217 | force_x => 0, |
1220 | force_x => 0, |
1218 | force_y => "max", |
1221 | force_y => "max", |
… | |
… | |
1259 | $SETUP_DIALOG = new CFClient::UI::FancyFrame |
1262 | $SETUP_DIALOG = new CFClient::UI::FancyFrame |
1260 | title => "Setup", |
1263 | title => "Setup", |
1261 | name => "setup_dialog", |
1264 | name => "setup_dialog", |
1262 | x => 'center', |
1265 | x => 'center', |
1263 | y => 'center', |
1266 | y => 'center', |
|
|
1267 | z => 2, |
1264 | force_w => $::WIDTH * 0.6, |
1268 | force_w => $::WIDTH * 0.6, |
1265 | force_h => $::HEIGHT * 0.6, |
1269 | force_h => $::HEIGHT * 0.6, |
1266 | ; |
1270 | ; |
1267 | |
1271 | |
1268 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1, |
1272 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1, |
… | |
… | |
1276 | "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."); |
1277 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
1281 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
1278 | "Configure the use of audio, sound effects and background music."); |
1282 | "Configure the use of audio, sound effects and background music."); |
1279 | $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, |
1283 | $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, |
1280 | "Lets you define, edit and delete bindings." |
1284 | "Lets you define, edit and delete bindings." |
1281 | . "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 " |
1282 | . "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 " |
1283 | . "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. " |
1284 | . "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 " |
1285 | . "binding editor closes"); |
1289 | . "binding editor closes"); |
1286 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1290 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1287 | "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."); |
1288 | |
1292 | |
1289 | $BUTTONBAR = new CFClient::UI::HBox x => 0, y => 0; |
1293 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1290 | |
1294 | |
1291 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1295 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1292 | 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."); |
1293 | |
1297 | |
1294 | $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, |