… | |
… | |
155 | $hbox->add (new CFClient::UI::Button |
155 | $hbox->add (new CFClient::UI::Button |
156 | text => "No", |
156 | text => "No", |
157 | on_activate => sub { |
157 | on_activate => sub { |
158 | $conn->send ("reply n"); |
158 | $conn->send ("reply n"); |
159 | $dialog->destroy; |
159 | $dialog->destroy; |
|
|
160 | 0 |
160 | } |
161 | } |
161 | ); |
162 | ); |
162 | $hbox->add (new CFClient::UI::Button |
163 | $hbox->add (new CFClient::UI::Button |
163 | text => "Yes", |
164 | text => "Yes", |
164 | on_activate => sub { |
165 | on_activate => sub { |
165 | $conn->send ("reply y"); |
166 | $conn->send ("reply y"); |
166 | destroy_query_dialog $conn; |
167 | destroy_query_dialog $conn; |
|
|
168 | 0 |
167 | }, |
169 | }, |
168 | ); |
170 | ); |
169 | |
171 | |
170 | $dialog->focus_in; |
172 | $dialog->grab_focus; |
171 | |
173 | |
172 | } elsif ($flags & CS_QUERY_SINGLECHAR) { |
174 | } elsif ($flags & CS_QUERY_SINGLECHAR) { |
173 | $dialog->{tooltip} = "Press a key (click on the entry to make sure it has keyboard focus)"; |
175 | $dialog->{tooltip} = "Press a key (click on the entry to make sure it has keyboard focus)"; |
174 | |
176 | |
175 | if ($prompt =~ /Now choose a character|Press any key for the next race/i) { |
177 | if ($prompt =~ /Now choose a character|Press any key for the next race/i) { |
… | |
… | |
185 | $table->add (0, 0, new CFClient::UI::Button |
187 | $table->add (0, 0, new CFClient::UI::Button |
186 | text => "Next Race", |
188 | text => "Next Race", |
187 | on_activate => sub { |
189 | on_activate => sub { |
188 | $conn->send ("reply n"); |
190 | $conn->send ("reply n"); |
189 | destroy_query_dialog $conn; |
191 | destroy_query_dialog $conn; |
|
|
192 | 0 |
190 | }, |
193 | }, |
191 | ); |
194 | ); |
192 | $table->add (2, 0, new CFClient::UI::Button |
195 | $table->add (2, 0, new CFClient::UI::Button |
193 | text => "Accept", |
196 | text => "Accept", |
194 | on_activate => sub { |
197 | on_activate => sub { |
195 | $conn->send ("reply d"); |
198 | $conn->send ("reply d"); |
196 | destroy_query_dialog $conn; |
199 | destroy_query_dialog $conn; |
|
|
200 | 0 |
197 | }, |
201 | }, |
198 | ); |
202 | ); |
199 | |
203 | |
200 | unshift @dialog, new CFClient::UI::Label |
204 | unshift @dialog, new CFClient::UI::Label |
201 | max_w => $::WIDTH * 0.4, |
205 | max_w => $::WIDTH * 0.4, |
… | |
… | |
231 | $table->add (0, 0, new CFClient::UI::Button |
235 | $table->add (0, 0, new CFClient::UI::Button |
232 | text => "Roll Again", |
236 | text => "Roll Again", |
233 | on_activate => sub { |
237 | on_activate => sub { |
234 | $conn->send ("reply y"); |
238 | $conn->send ("reply y"); |
235 | destroy_query_dialog $conn; |
239 | destroy_query_dialog $conn; |
|
|
240 | 0 |
236 | }, |
241 | }, |
237 | ); |
242 | ); |
238 | |
243 | |
239 | # center: swap stats |
244 | # center: swap stats |
240 | my ($sw1, $sw2) = map +(new CFClient::UI::Combobox |
245 | my ($sw1, $sw2) = map +(new CFClient::UI::Combobox |
… | |
… | |
254 | text => "Swap Stats", |
259 | text => "Swap Stats", |
255 | on_activate => sub { |
260 | on_activate => sub { |
256 | $conn->{stat_change_with} = $sw2->{value}; |
261 | $conn->{stat_change_with} = $sw2->{value}; |
257 | $conn->send ("reply $sw1->{value}"); |
262 | $conn->send ("reply $sw1->{value}"); |
258 | destroy_query_dialog $conn; |
263 | destroy_query_dialog $conn; |
|
|
264 | 0 |
259 | }, |
265 | }, |
260 | ); |
266 | ); |
261 | $table->add (2, 1, new CFClient::UI::HBox children => [$sw1, $sw2]); |
267 | $table->add (2, 1, new CFClient::UI::HBox children => [$sw1, $sw2]); |
262 | |
268 | |
263 | # right: accept |
269 | # right: accept |
… | |
… | |
265 | text => "Accept", |
271 | text => "Accept", |
266 | on_activate => sub { |
272 | on_activate => sub { |
267 | $conn->send ("reply n"); |
273 | $conn->send ("reply n"); |
268 | $STATS_WINDOW->hide; |
274 | $STATS_WINDOW->hide; |
269 | destroy_query_dialog $conn; |
275 | destroy_query_dialog $conn; |
|
|
276 | 0 |
270 | }, |
277 | }, |
271 | ); |
278 | ); |
272 | |
279 | |
273 | unshift @dialog, new CFClient::UI::Label |
280 | unshift @dialog, new CFClient::UI::Label |
274 | max_w => $::WIDTH * 0.4, |
281 | max_w => $::WIDTH * 0.4, |
… | |
… | |
284 | |
291 | |
285 | push @dialog, my $entry = new CFClient::UI::Entry |
292 | push @dialog, my $entry = new CFClient::UI::Entry |
286 | on_changed => sub { |
293 | on_changed => sub { |
287 | $conn->send ("reply $_[1]"); |
294 | $conn->send ("reply $_[1]"); |
288 | destroy_query_dialog $conn; |
295 | destroy_query_dialog $conn; |
|
|
296 | 0 |
289 | }, |
297 | }, |
290 | ; |
298 | ; |
291 | |
299 | |
292 | $entry->focus_in; |
300 | $entry->grab_focus; |
293 | |
301 | |
294 | } else { |
302 | } else { |
295 | $dialog->{tooltip} = "Enter the reply and press return (click on the entry to make sure it has keyboard focus)"; |
303 | $dialog->{tooltip} = "Enter the reply and press return (click on the entry to make sure it has keyboard focus)"; |
296 | |
304 | |
297 | push @dialog, my $entry = new CFClient::UI::Entry |
305 | push @dialog, my $entry = new CFClient::UI::Entry |
298 | $flags & CS_QUERY_HIDEINPUT ? (hidden => "*") : (), |
306 | $flags & CS_QUERY_HIDEINPUT ? (hidden => "*") : (), |
299 | on_activate => sub { |
307 | on_activate => sub { |
300 | $conn->send ("reply $_[1]"); |
308 | $conn->send ("reply $_[1]"); |
301 | destroy_query_dialog $conn; |
309 | destroy_query_dialog $conn; |
|
|
310 | 0 |
302 | }, |
311 | }, |
303 | ; |
312 | ; |
304 | |
313 | |
305 | $entry->focus_in; |
314 | $entry->grab_focus; |
306 | } |
315 | } |
307 | |
316 | |
308 | $vbox->add (@dialog); |
317 | $vbox->add (@dialog); |
309 | $dialog->show; |
318 | $dialog->show; |
310 | } |
319 | } |
… | |
… | |
399 | |
408 | |
400 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen"); |
409 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fullscreen"); |
401 | $table->add (1, $row++, new CFClient::UI::CheckBox |
410 | $table->add (1, $row++, new CFClient::UI::CheckBox |
402 | state => $CFG->{fullscreen}, |
411 | state => $CFG->{fullscreen}, |
403 | tooltip => "Bring the client into fullscreen mode.", |
412 | tooltip => "Bring the client into fullscreen mode.", |
404 | on_changed => sub { |
413 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
405 | my ($self, $value) = @_; |
|
|
406 | $CFG->{fullscreen} = $value; |
|
|
407 | } |
|
|
408 | ); |
414 | ); |
409 | |
415 | |
410 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
416 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
411 | $table->add (1, $row++, new CFClient::UI::CheckBox |
417 | $table->add (1, $row++, new CFClient::UI::CheckBox |
412 | state => $CFG->{fast}, |
418 | state => $CFG->{fast}, |
413 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
419 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
414 | on_changed => sub { |
420 | on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } |
415 | my ($self, $value) = @_; |
|
|
416 | $CFG->{fast} = $value; |
|
|
417 | } |
|
|
418 | ); |
421 | ); |
419 | |
422 | |
420 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Map Scale"); |
423 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Map Scale"); |
421 | $table->add (1, $row++, new CFClient::UI::Slider |
424 | $table->add (1, $row++, new CFClient::UI::Slider |
422 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
425 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
423 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
426 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
424 | on_changed => sub { |
427 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } |
425 | my ($self, $value) = @_; |
|
|
426 | $CFG->{map_scale} = 2 ** $value; |
|
|
427 | } |
|
|
428 | ); |
428 | ); |
429 | |
429 | |
430 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); |
430 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); |
431 | $table->add (1, $row++, new CFClient::UI::CheckBox |
431 | $table->add (1, $row++, new CFClient::UI::CheckBox |
432 | state => $CFG->{fow_enable}, |
432 | state => $CFG->{fow_enable}, |
433 | tooltip => "<b>Fog-of-War</b> marks areas that cannot be seen by the player. Changes are instant.", |
433 | tooltip => "<b>Fog-of-War</b> marks areas that cannot be seen by the player. Changes are instant.", |
434 | on_changed => sub { |
434 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_enable} = $value; 0 } |
435 | my ($self, $value) = @_; |
|
|
436 | $CFG->{fow_enable} = $value; |
|
|
437 | } |
|
|
438 | ); |
435 | ); |
439 | |
436 | |
440 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity"); |
437 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity"); |
441 | $table->add (1, $row++, new CFClient::UI::Slider |
438 | $table->add (1, $row++, new CFClient::UI::Slider |
442 | range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], |
439 | range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], |
443 | tooltip => "<b>Fog of War Lightness.</b> The higher the intensity, the lighter the Fog-of-War color. Changes are instant.", |
440 | tooltip => "<b>Fog of War Lightness.</b> The higher the intensity, the lighter the Fog-of-War color. Changes are instant.", |
444 | on_changed => sub { |
441 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_intensity} = $value; 0 } |
445 | my ($self, $value) = @_; |
|
|
446 | $CFG->{fow_intensity} = $value; |
|
|
447 | } |
|
|
448 | ); |
442 | ); |
449 | |
443 | |
450 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth"); |
444 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth"); |
451 | $table->add (1, $row++, new CFClient::UI::CheckBox |
445 | $table->add (1, $row++, new CFClient::UI::CheckBox |
452 | state => $CFG->{fow_smooth}, |
446 | state => $CFG->{fow_smooth}, |
453 | tooltip => "Smooth the Fog-of-War a bit to make it more realistic. Changes are instant.", |
447 | tooltip => "Smooth the Fog-of-War a bit to make it more realistic. Changes are instant.", |
454 | on_changed => sub { |
448 | on_changed => sub { |
455 | my ($self, $value) = @_; |
449 | my ($self, $value) = @_; |
456 | $CFG->{fow_smooth} = $value; |
450 | $CFG->{fow_smooth} = $value; |
457 | status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::OpenGL::GL_VERSION < 1.2; |
451 | status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::OpenGL::GL_VERSION < 1.2; |
|
|
452 | 0 |
458 | } |
453 | } |
459 | ); |
454 | ); |
460 | |
455 | |
461 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
456 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
462 | $table->add (1, $row++, new CFClient::UI::Slider |
457 | $table->add (1, $row++, new CFClient::UI::Slider |
463 | range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1], |
458 | range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1], |
464 | tooltip => "The base font size used by most GUI elements that do not have their own setting.", |
459 | tooltip => "The base font size used by most GUI elements that do not have their own setting.", |
465 | on_changed => sub { $CFG->{gui_fontsize} = $_[1] }, |
460 | on_changed => sub { $CFG->{gui_fontsize} = $_[1]; 0 }, |
466 | ); |
461 | ); |
467 | |
462 | |
468 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Message Fontsize"); |
463 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Message Fontsize"); |
469 | $table->add (1, $row++, new CFClient::UI::Slider |
464 | $table->add (1, $row++, new CFClient::UI::Slider |
470 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
465 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
471 | tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant.", |
466 | tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant.", |
472 | on_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]) }, |
467 | on_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, |
473 | ); |
468 | ); |
474 | |
469 | |
475 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize"); |
470 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize"); |
476 | |
471 | |
477 | $table->add (1, $row++, new CFClient::UI::Slider |
472 | $table->add (1, $row++, new CFClient::UI::Slider |
478 | range => [$CFG->{stat_fontsize}, 0.5, 2, 0, 0.1], |
473 | range => [$CFG->{stat_fontsize}, 0.5, 2, 0, 0.1], |
479 | tooltip => "The font size used by the <b>statistics window</b> only. Changes are instant.", |
474 | tooltip => "The font size used by the <b>statistics window</b> only. Changes are instant.", |
480 | on_changed => sub { |
475 | on_changed => sub { |
481 | $CFG->{stat_fontsize} = $_[1]; |
476 | $CFG->{stat_fontsize} = $_[1]; |
482 | &set_stats_window_fontsize; |
477 | &set_stats_window_fontsize; |
|
|
478 | 0 |
483 | } |
479 | } |
484 | ); |
480 | ); |
485 | |
481 | |
486 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); |
482 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); |
487 | $table->add (1, $row++, new CFClient::UI::Slider |
483 | $table->add (1, $row++, new CFClient::UI::Slider |
488 | range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], |
484 | range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], |
489 | tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.", |
485 | tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.", |
490 | on_changed => sub { |
486 | on_changed => sub { |
491 | $CFG->{gauge_fontsize} = $_[1]; |
487 | $CFG->{gauge_fontsize} = $_[1]; |
492 | &set_gauge_window_fontsize; |
488 | &set_gauge_window_fontsize; |
|
|
489 | 0 |
493 | } |
490 | } |
494 | ); |
491 | ); |
495 | |
492 | |
496 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size"); |
493 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size"); |
497 | $table->add (1, $row++, new CFClient::UI::Slider |
494 | $table->add (1, $row++, new CFClient::UI::Slider |
498 | range => [$CFG->{gauge_size}, 0.2, 0.8], |
495 | range => [$CFG->{gauge_size}, 0.2, 0.8], |
499 | tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.", |
496 | tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.", |
500 | on_changed => sub { |
497 | on_changed => sub { |
501 | $CFG->{gauge_size} = $_[1]; |
498 | $CFG->{gauge_size} = $_[1]; |
502 | $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size}); |
499 | $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size}); |
|
|
500 | 0 |
503 | } |
501 | } |
504 | ); |
502 | ); |
505 | |
503 | |
506 | $table->add (1, $row++, new CFClient::UI::Button |
504 | $table->add (1, $row++, new CFClient::UI::Button |
507 | expand => 1, align => 0, text => "Apply", |
505 | expand => 1, align => 0, text => "Apply", |
508 | tooltip => "Apply the video settings", |
506 | tooltip => "Apply the video settings", |
509 | on_activate => sub { |
507 | on_activate => sub { |
510 | video_shutdown (); |
508 | video_shutdown (); |
511 | video_init (); |
509 | video_init (); |
|
|
510 | 0 |
512 | } |
511 | } |
513 | ); |
512 | ); |
514 | |
513 | |
515 | $vbox |
514 | $vbox |
516 | } |
515 | } |
… | |
… | |
524 | |
523 | |
525 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable"); |
524 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable"); |
526 | $table->add (1, $row++, new CFClient::UI::CheckBox |
525 | $table->add (1, $row++, new CFClient::UI::CheckBox |
527 | state => $CFG->{audio_enable}, |
526 | state => $CFG->{audio_enable}, |
528 | tooltip => "<b>Master Audio Enable.</b> If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", |
527 | tooltip => "<b>Master Audio Enable.</b> If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", |
529 | on_changed => sub { |
528 | on_changed => sub { $CFG->{audio_enable} = $_[1]; 0 } |
530 | $CFG->{audio_enable} = $_[1]; |
|
|
531 | } |
|
|
532 | ); |
529 | ); |
533 | # $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume"); |
530 | # $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume"); |
534 | # $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], on_changed => sub { |
531 | # $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], on_changed => sub { |
535 | # $CFG->{effects_volume} = $_[1]; |
532 | # $CFG->{effects_volume} = $_[1]; |
536 | # }); |
533 | # }); |
537 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music"); |
534 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music"); |
538 | $table->add (1, $row++, my $hbox = new CFClient::UI::HBox); |
535 | $table->add (1, $row++, my $hbox = new CFClient::UI::HBox); |
539 | $hbox->add (new CFClient::UI::CheckBox |
536 | $hbox->add (new CFClient::UI::CheckBox |
540 | expand => 1, state => $CFG->{bgm_enable}, |
537 | expand => 1, state => $CFG->{bgm_enable}, |
541 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", |
538 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", |
542 | on_changed => sub { |
539 | on_changed => sub { $CFG->{bgm_enable} = $_[1]; 0 } |
543 | $CFG->{bgm_enable} = $_[1]; |
|
|
544 | } |
|
|
545 | ); |
540 | ); |
546 | $hbox->add (new CFClient::UI::Slider |
541 | $hbox->add (new CFClient::UI::Slider |
547 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], |
542 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], |
548 | tooltip => "The volume of the background music. Changes are instant.", |
543 | tooltip => "The volume of the background music. Changes are instant.", |
549 | on_changed => sub { |
544 | on_changed => sub { $CFG->{bgm_volume} = $_[1]; CFClient::MixMusic::volume $_[1] * 128; 0 } |
550 | $CFG->{bgm_volume} = $_[1]; |
|
|
551 | CFClient::MixMusic::volume $_[1] * 128; |
|
|
552 | } |
|
|
553 | ); |
545 | ); |
554 | |
546 | |
555 | $table->add (1, $row++, new CFClient::UI::Button |
547 | $table->add (1, $row++, new CFClient::UI::Button |
556 | expand => 1, align => 0, text => "Apply", |
548 | expand => 1, align => 0, text => "Apply", |
557 | tooltip => "Apply the audio settings", |
549 | tooltip => "Apply the audio settings", |
558 | on_activate => sub { |
550 | on_activate => sub { |
559 | audio_shutdown (); |
551 | audio_shutdown (); |
560 | audio_init (); |
552 | audio_init (); |
|
|
553 | 0 |
561 | } |
554 | } |
562 | ); |
555 | ); |
563 | |
556 | |
564 | $vbox |
557 | $vbox |
565 | } |
558 | } |
… | |
… | |
631 | |
624 | |
632 | sub debug_setup { |
625 | sub debug_setup { |
633 | my $table = new CFClient::UI::Table; |
626 | my $table = new CFClient::UI::Table; |
634 | |
627 | |
635 | $table->add (0, 0, new CFClient::UI::Label text => "Widget Borders"); |
628 | $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 }); |
629 | $table->add (1, 0, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 1; 0 }); |
637 | $table->add (0, 1, new CFClient::UI::Label text => "Tooltip Widget Info"); |
630 | $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 }); |
631 | $table->add (1, 1, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2; 0 }); |
639 | $table->add (0, 2, new CFClient::UI::Label text => "Show FPS"); |
632 | $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 }); |
633 | $table->add (1, 2, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); |
641 | $table->add (0, 3, new CFClient::UI::Label text => "Suppress Tooltips"); |
634 | $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 }); |
635 | $table->add (1, 3, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); |
643 | |
636 | |
644 | my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05); |
637 | my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05); |
645 | |
638 | |
646 | for my $x (0..2) { |
639 | for my $x (0..2) { |
647 | for my $y (0 .. 2) { |
640 | for my $y (0 .. 2) { |
… | |
… | |
660 | sub stats_window { |
653 | sub stats_window { |
661 | my $tgw = new CFClient::UI::FancyFrame |
654 | my $tgw = new CFClient::UI::FancyFrame |
662 | y => $HEIGHT * (2/8), |
655 | y => $HEIGHT * (2/8), |
663 | x => "max", |
656 | x => "max", |
664 | title => "Stats", |
657 | title => "Stats", |
665 | name => "stats_window"; |
658 | name => "stats_window", |
|
|
659 | has_close_button => 1; |
666 | |
660 | |
667 | $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); |
661 | $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); |
668 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
662 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
669 | can_hover => 1, can_events => 1, |
663 | can_hover => 1, can_events => 1, |
670 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
664 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
… | |
… | |
816 | $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); |
810 | $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); |
817 | $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP}); |
811 | $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP}); |
818 | |
812 | |
819 | $STATWIDS->{m_weight}->set_text (sprintf "Max weight: %.1fkg", $stats->{+CS_STAT_WEIGHT_LIM} / 1000); |
813 | $STATWIDS->{m_weight}->set_text (sprintf "Max weight: %.1fkg", $stats->{+CS_STAT_WEIGHT_LIM} / 1000); |
820 | |
814 | |
821 | # TODO: replace by CS_STAT_RES_xxx constants |
|
|
822 | my %tbl = ( |
815 | my %tbl = ( |
823 | phys => 100, |
816 | phys => CS_STAT_RES_PHYS, |
824 | magic => 101, |
817 | magic => CS_STAT_RES_MAG, |
825 | fire => 102, |
818 | fire => CS_STAT_RES_FIRE, |
826 | elec => 103, |
819 | elec => CS_STAT_RES_ELEC, |
827 | cold => 104, |
820 | cold => CS_STAT_RES_COLD, |
828 | conf => 105, |
821 | conf => CS_STAT_RES_CONF, |
829 | acid => 106, |
822 | acid => CS_STAT_RES_ACID, |
830 | drain => 107, |
823 | drain => CS_STAT_RES_DRAIN, |
831 | ghit => 108, |
824 | ghit => CS_STAT_RES_GHOSTHIT, |
832 | pois => 109, |
825 | pois => CS_STAT_RES_POISON, |
833 | slow => 110, |
826 | slow => CS_STAT_RES_SLOW, |
834 | para => 111, |
827 | para => CS_STAT_RES_PARA, |
835 | tund => 112, |
828 | tund => CS_STAT_TURN_UNDEAD, |
836 | fear => 113, |
829 | fear => CS_STAT_RES_FEAR, |
837 | depl => 113, |
830 | depl => CS_STAT_RES_DEPLETE, |
838 | deat => 115, |
831 | deat => CS_STAT_RES_DEATH, |
839 | holyw => 116, |
832 | holyw => CS_STAT_RES_HOLYWORD, |
840 | blind => 117, |
833 | blind => CS_STAT_RES_BLIND, |
841 | ); |
834 | ); |
842 | |
835 | |
843 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) |
836 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) |
844 | for keys %tbl; |
837 | for keys %tbl; |
845 | } |
838 | } |
… | |
… | |
921 | text => "Use", |
914 | text => "Use", |
922 | tooltip => "Put this server into the <b>Host:Port</b> field", |
915 | tooltip => "Put this server into the <b>Host:Port</b> field", |
923 | on_activate => sub { |
916 | on_activate => sub { |
924 | $HOST_ENTRY->set_text ($CFG->{host} = $host); |
917 | $HOST_ENTRY->set_text ($CFG->{host} = $host); |
925 | $METASERVER->hide; |
918 | $METASERVER->hide; |
|
|
919 | 0 |
926 | }, |
920 | }, |
927 | ), |
921 | ), |
928 | (new CFClient::UI::Empty expand => 1), |
922 | (new CFClient::UI::Empty expand => 1), |
929 | ]); |
923 | ]); |
930 | |
924 | |
… | |
… | |
951 | z => 3, |
945 | z => 3, |
952 | force_h => $::HEIGHT * 0.4, |
946 | force_h => $::HEIGHT * 0.4, |
953 | child => (my $vbox = new CFClient::UI::VBox), |
947 | child => (my $vbox = new CFClient::UI::VBox), |
954 | on_visibility_change => sub { |
948 | on_visibility_change => sub { |
955 | update_metaserver if $_[1]; |
949 | update_metaserver if $_[1]; |
|
|
950 | 0 |
956 | }, |
951 | }, |
957 | ; |
952 | ; |
958 | |
953 | |
959 | $dialog->{table} = new CFClient::UI::Table; |
954 | $dialog->{table} = new CFClient::UI::Table; |
960 | |
955 | |
… | |
… | |
978 | text => $CFG->{host}, |
973 | text => $CFG->{host}, |
979 | tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", |
974 | tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", |
980 | on_changed => sub { |
975 | on_changed => sub { |
981 | my ($self, $value) = @_; |
976 | my ($self, $value) = @_; |
982 | $CFG->{host} = $value; |
977 | $CFG->{host} = $value; |
|
|
978 | 0 |
983 | } |
979 | } |
984 | ); |
980 | ); |
985 | |
981 | |
986 | $METASERVER = metaserver_dialog; |
982 | $METASERVER = metaserver_dialog; |
987 | |
983 | |
988 | $vbox->add (new CFClient::UI::Button |
984 | $vbox->add (new CFClient::UI::Button |
989 | expand => 1, |
985 | expand => 1, |
990 | text => "Server List", |
986 | text => "Server List", |
991 | other => $METASERVER, |
987 | other => $METASERVER, |
992 | tooltip => "Show a list of available crossfire servers", |
988 | tooltip => "Show a list of available crossfire servers", |
993 | on_activate => sub { $METASERVER->toggle_visibility }, |
989 | on_activate => sub { $METASERVER->toggle_visibility; 0 }, |
994 | on_visibility_change => sub { $METASERVER->hide unless $_[1] }, |
990 | on_visibility_change => sub { $METASERVER->hide unless $_[1]; 0 }, |
995 | ); |
991 | ); |
996 | } |
992 | } |
997 | |
993 | |
998 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); |
994 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); |
999 | $table->add (1, 4, new CFClient::UI::Entry |
995 | $table->add (1, 4, new CFClient::UI::Entry |
1000 | text => $CFG->{user}, |
996 | text => $CFG->{user}, |
1001 | tooltip => "The name of your character on the server", |
997 | tooltip => "The name of your character on the server", |
1002 | on_changed => sub { |
998 | on_changed => sub { my ($self, $value) = @_; $CFG->{user} = $value; 0 } |
1003 | my ($self, $value) = @_; |
|
|
1004 | $CFG->{user} = $value; |
|
|
1005 | } |
|
|
1006 | ); |
999 | ); |
1007 | |
1000 | |
1008 | $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "Password"); |
1001 | $table->add (0, 5, new CFClient::UI::Label valign => 0, align => 1, text => "Password"); |
1009 | $table->add (1, 5, new CFClient::UI::Entry |
1002 | $table->add (1, 5, new CFClient::UI::Entry |
1010 | text => $CFG->{password}, |
1003 | text => $CFG->{password}, |
1011 | hidden => 1, |
1004 | hidden => 1, |
1012 | tooltip => "The password for your character", |
1005 | tooltip => "The password for your character", |
1013 | on_changed => sub { |
1006 | on_changed => sub { my ($self, $value) = @_; $CFG->{password} = $value; 0 } |
1014 | my ($self, $value) = @_; |
|
|
1015 | $CFG->{password} = $value; |
|
|
1016 | } |
|
|
1017 | ); |
1007 | ); |
1018 | |
1008 | |
1019 | $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); |
1009 | $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); |
1020 | $table->add (1, 7, new CFClient::UI::Slider |
1010 | $table->add (1, 7, new CFClient::UI::Slider |
1021 | force_w => 100, |
1011 | force_w => 100, |
1022 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
1012 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
1023 | tooltip => "This is the size of the portion of the map update the server sends you. " |
1013 | tooltip => "This is the size of the portion of the map update the server sends you. " |
1024 | . "If you set this to a high value you will be able to see further, " |
1014 | . "If you set this to a high value you will be able to see further, " |
1025 | . "but you also increase bandwidth requirements and latency. " |
1015 | . "but you also increase bandwidth requirements and latency. " |
1026 | . "This option is only used once at log-in.", |
1016 | . "This option is only used once at log-in.", |
1027 | on_changed => sub { |
1017 | on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 0 }, |
1028 | my ($self, $value) = @_; |
|
|
1029 | |
|
|
1030 | $CFG->{mapsize} = $self->{range}[0] = $value = int $value; |
|
|
1031 | }, |
|
|
1032 | ); |
1018 | ); |
1033 | |
1019 | |
1034 | $table->add (0, 8, new CFClient::UI::Label valign => 0, align => 1, text => "Face Prefetch"); |
1020 | $table->add (0, 8, new CFClient::UI::Label valign => 0, align => 1, text => "Face Prefetch"); |
1035 | $table->add (1, 8, new CFClient::UI::CheckBox |
1021 | $table->add (1, 8, new CFClient::UI::CheckBox |
1036 | state => $CFG->{face_prefetch}, |
1022 | state => $CFG->{face_prefetch}, |
… | |
… | |
1039 | . "This might increase or create lag, but increases the chances " |
1025 | . "This might increase or create lag, but increases the chances " |
1040 | . "of faces being ready for display when you encounter them. " |
1026 | . "of faces being ready for display when you encounter them. " |
1041 | . "It also uses up server bandwidth on every connect, " |
1027 | . "It also uses up server bandwidth on every connect, " |
1042 | . "so only set it if you really need to prefetch images. " |
1028 | . "so only set it if you really need to prefetch images. " |
1043 | . "This option can be set and unset any time.", |
1029 | . "This option can be set and unset any time.", |
1044 | on_changed => sub { $CFG->{face_prefetch} = $_[1] }, |
1030 | on_changed => sub { $CFG->{face_prefetch} = $_[1]; 0 }, |
1045 | ); |
1031 | ); |
1046 | |
1032 | |
1047 | $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Count"); |
1033 | $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Count"); |
1048 | $table->add (1, 9, new CFClient::UI::Entry |
1034 | $table->add (1, 9, new CFClient::UI::Entry |
1049 | text => $CFG->{output_count}, |
1035 | text => $CFG->{output_count}, |
1050 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1036 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1051 | on_changed => sub { $CFG->{output_count} = $_[1] }, |
1037 | on_changed => sub { $CFG->{output_count} = $_[1]; 0 }, |
1052 | ); |
1038 | ); |
1053 | |
1039 | |
1054 | $table->add (0, 10, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Sync"); |
1040 | $table->add (0, 10, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Sync"); |
1055 | $table->add (1, 10, new CFClient::UI::Entry |
1041 | $table->add (1, 10, new CFClient::UI::Entry |
1056 | text => $CFG->{output_sync}, |
1042 | text => $CFG->{output_sync}, |
1057 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1043 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1058 | on_changed => sub { $CFG->{output_sync} = $_[1] }, |
1044 | on_changed => sub { $CFG->{output_sync} = $_[1]; 0 }, |
1059 | ); |
1045 | ); |
1060 | |
1046 | |
1061 | $table->add (1, 11, $LOGIN_BUTTON = new CFClient::UI::Button |
1047 | $table->add (1, 11, $LOGIN_BUTTON = new CFClient::UI::Button |
1062 | expand => 1, |
1048 | expand => 1, |
1063 | align => 0, |
1049 | align => 0, |
1064 | text => "Login", |
1050 | text => "Login", |
1065 | on_activate => sub { |
1051 | on_activate => sub { |
1066 | $CONN ? stop_game |
1052 | $CONN ? stop_game |
1067 | : start_game; |
1053 | : start_game; |
|
|
1054 | 0 |
1068 | }, |
1055 | }, |
1069 | ); |
1056 | ); |
1070 | |
1057 | |
1071 | $table->add (0, 12, new CFClient::UI::Label valign => 0, align => 1, text => "Chat Command"); |
1058 | $table->add (0, 12, new CFClient::UI::Label valign => 0, align => 1, text => "Chat Command"); |
1072 | $table->add (1, 12, my $saycmd = new CFClient::UI::Entry |
1059 | $table->add (1, 12, my $saycmd = new CFClient::UI::Entry |
… | |
… | |
1075 | . "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. " |
1062 | . "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. " |
1076 | . "But you could also set it to <b>tell <i>playername</i></b> to only chat with that user.", |
1063 | . "But you could also set it to <b>tell <i>playername</i></b> to only chat with that user.", |
1077 | on_changed => sub { |
1064 | on_changed => sub { |
1078 | my ($self, $value) = @_; |
1065 | my ($self, $value) = @_; |
1079 | $CFG->{say_command} = $value; |
1066 | $CFG->{say_command} = $value; |
|
|
1067 | 0 |
1080 | } |
1068 | } |
1081 | ); |
1069 | ); |
1082 | |
1070 | |
1083 | $vbox->add (new CFClient::UI::Label |
1071 | $vbox->add (new CFClient::UI::Label |
1084 | text => "Server Info", |
1072 | text => "Server Info", |
… | |
… | |
1100 | bg => [0, 0, 0, 0.75], |
1088 | bg => [0, 0, 0, 0.75], |
1101 | x => "max", |
1089 | x => "max", |
1102 | y => 0, |
1090 | y => 0, |
1103 | force_w => $::WIDTH * 0.4, |
1091 | force_w => $::WIDTH * 0.4, |
1104 | force_h => $::HEIGHT * 0.5, |
1092 | force_h => $::HEIGHT * 0.5, |
1105 | child => (my $vbox = new CFClient::UI::VBox); |
1093 | child => (my $vbox = new CFClient::UI::VBox), |
|
|
1094 | has_close_button => 1; |
1106 | |
1095 | |
1107 | $vbox->add ($LOGVIEW); |
1096 | $vbox->add ($LOGVIEW); |
1108 | |
1097 | |
1109 | $vbox->add (my $input = new CFClient::UI::Entry |
1098 | $vbox->add (my $input = new CFClient::UI::Entry |
1110 | tooltip => "<b>Chat Box</b>. If you enter a text and press return/enter here, the current <i>communication command</i> " |
1099 | tooltip => "<b>Chat Box</b>. If you enter a text and press return/enter here, the current <i>communication command</i> " |
… | |
… | |
1118 | |
1107 | |
1119 | if ($prev_focus == $MAPWIDGET && $input->{auto_activated}) { |
1108 | if ($prev_focus == $MAPWIDGET && $input->{auto_activated}) { |
1120 | $input->{refocus_map} = 1; |
1109 | $input->{refocus_map} = 1; |
1121 | } |
1110 | } |
1122 | delete $input->{auto_activated}; |
1111 | delete $input->{auto_activated}; |
|
|
1112 | |
|
|
1113 | 0 |
1123 | }, |
1114 | }, |
1124 | on_activate => sub { |
1115 | on_activate => sub { |
1125 | my ($input, $text) = @_; |
1116 | my ($input, $text) = @_; |
1126 | $input->set_text (''); |
1117 | $input->set_text (''); |
1127 | |
1118 | |
… | |
… | |
1133 | } |
1124 | } |
1134 | if ($input->{refocus_map}) { |
1125 | if ($input->{refocus_map}) { |
1135 | delete $input->{refocus_map}; |
1126 | delete $input->{refocus_map}; |
1136 | $MAPWIDGET->focus_in |
1127 | $MAPWIDGET->focus_in |
1137 | } |
1128 | } |
|
|
1129 | |
|
|
1130 | 0 |
1138 | }, |
1131 | }, |
1139 | on_escape => sub { |
1132 | on_escape => sub { |
1140 | $MAPWIDGET->focus_in |
1133 | $MAPWIDGET->grab_focus; |
|
|
1134 | |
|
|
1135 | 0 |
1141 | }, |
1136 | }, |
1142 | ); |
1137 | ); |
1143 | |
1138 | |
1144 | $CONSOLE = { |
1139 | $CONSOLE = { |
1145 | window => $window, |
1140 | window => $window, |
… | |
… | |
1167 | ); |
1162 | ); |
1168 | $vb->add (my $hb = new CFClient::UI::HBox expand => 1); |
1163 | $vb->add (my $hb = new CFClient::UI::HBox expand => 1); |
1169 | $hb->add (new CFClient::UI::Button |
1164 | $hb->add (new CFClient::UI::Button |
1170 | text => "Ok", |
1165 | text => "Ok", |
1171 | expand => 1, |
1166 | expand => 1, |
1172 | on_activate => sub { $QUIT_DIALOG->hide }, |
1167 | on_activate => sub { $QUIT_DIALOG->hide; 0 }, |
1173 | ); |
1168 | ); |
1174 | $hb->add (new CFClient::UI::Button |
1169 | $hb->add (new CFClient::UI::Button |
1175 | text => "Quit anyway", |
1170 | text => "Quit anyway", |
1176 | expand => 1, |
1171 | expand => 1, |
1177 | on_activate => sub { exit }, |
1172 | on_activate => sub { exit }, |
… | |
… | |
1244 | $::CFG->{pickup} &= ~$mask; |
1239 | $::CFG->{pickup} &= ~$mask; |
1245 | } |
1240 | } |
1246 | |
1241 | |
1247 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1242 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1248 | if defined $::CONN; |
1243 | if defined $::CONN; |
|
|
1244 | |
|
|
1245 | 0 |
1249 | }); |
1246 | }); |
1250 | } |
1247 | } |
1251 | } |
1248 | } |
1252 | |
1249 | |
1253 | $table->add (2, 18, new CFClient::UI::ValSlider |
1250 | $table->add (2, 18, new CFClient::UI::ValSlider |
… | |
… | |
1264 | $table->add (3, 18, new CFClient::UI::Button |
1261 | $table->add (3, 18, new CFClient::UI::Button |
1265 | text => "set", |
1262 | text => "set", |
1266 | on_activate => sub { |
1263 | on_activate => sub { |
1267 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1264 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1268 | if defined $::CONN; |
1265 | if defined $::CONN; |
1269 | 1; |
1266 | 0 |
1270 | }); |
1267 | }); |
1271 | |
1268 | |
1272 | $table |
1269 | $table |
1273 | } |
1270 | } |
1274 | |
1271 | |
… | |
… | |
1277 | x => "center", |
1274 | x => "center", |
1278 | y => "center", |
1275 | y => "center", |
1279 | force_w => $WIDTH * 9/10, |
1276 | force_w => $WIDTH * 9/10, |
1280 | force_h => $HEIGHT * 9/10, |
1277 | force_h => $HEIGHT * 9/10, |
1281 | title => "Inventory", |
1278 | title => "Inventory", |
|
|
1279 | has_close_button => 1, |
1282 | ; |
1280 | ; |
1283 | |
1281 | |
1284 | $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); |
1282 | $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); |
1285 | |
1283 | |
1286 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
1284 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
… | |
… | |
1322 | text => "delete", |
1320 | text => "delete", |
1323 | tooltip => "Deletes the binding", |
1321 | tooltip => "Deletes the binding", |
1324 | on_activate => sub { |
1322 | on_activate => sub { |
1325 | $binding_list->remove ($hb); |
1323 | $binding_list->remove ($hb); |
1326 | delete $::CFG->{bindings}->{$mod}->{$sym}; |
1324 | delete $::CFG->{bindings}->{$mod}->{$sym}; |
|
|
1325 | 0 |
1327 | }); |
1326 | }); |
1328 | |
1327 | |
1329 | $hb->add (new CFClient::UI::Button |
1328 | $hb->add (new CFClient::UI::Button |
1330 | text => "edit", |
1329 | text => "edit", |
1331 | tooltip => "Edits the binding", |
1330 | tooltip => "Edits the binding", |
… | |
… | |
1344 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1343 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1345 | $SETUP_DIALOG->show; |
1344 | $SETUP_DIALOG->show; |
1346 | }); |
1345 | }); |
1347 | $::BIND_EDITOR->show; |
1346 | $::BIND_EDITOR->show; |
1348 | $SETUP_DIALOG->hide; |
1347 | $SETUP_DIALOG->hide; |
|
|
1348 | 0 |
1349 | }); |
1349 | }); |
1350 | |
1350 | |
1351 | $hb->add (new CFClient::UI::Label text => "(Key: $nam)"); |
1351 | $hb->add (new CFClient::UI::Label text => "(Key: $nam)"); |
1352 | $hb->add (new CFClient::UI::Label text => $lbl, expand => 1); |
1352 | $hb->add (new CFClient::UI::Label text => $lbl, expand => 1); |
1353 | } |
1353 | } |
1354 | } |
1354 | } |
1355 | }; |
1355 | }; |
1356 | |
1356 | |
1357 | my $vb = new CFClient::UI::VBox; |
1357 | my $vb = new CFClient::UI::VBox; |
|
|
1358 | $vb->add (my $hb = new CFClient::UI::HBox); |
|
|
1359 | $hb->add (new CFClient::UI::Label text => "only shift-up stops fire"); |
|
|
1360 | $hb->add (new CFClient::UI::CheckBox |
|
|
1361 | expand => 1, |
|
|
1362 | state => $CFG->{shift_fire_stop}, |
|
|
1363 | tooltip => "If this checkbox is enabled you will stop fire only if you stop pressing shift", |
|
|
1364 | on_changed => sub { |
|
|
1365 | my ($cbox, $value) = @_; |
|
|
1366 | $CFG->{shift_fire_stop} = $value; |
|
|
1367 | 0 |
|
|
1368 | }); |
|
|
1369 | |
1358 | $vb->add ($binding_list); |
1370 | $vb->add ($binding_list); |
1359 | $vb->add (my $hb = new CFClient::UI::HBox); |
1371 | $vb->add (my $hb = new CFClient::UI::HBox); |
1360 | |
1372 | |
1361 | $hb->add (new CFClient::UI::Button |
1373 | $hb->add (new CFClient::UI::Button |
1362 | text => "record new", |
1374 | text => "record new", |
… | |
… | |
1376 | $SETUP_DIALOG->show; |
1388 | $SETUP_DIALOG->show; |
1377 | }, |
1389 | }, |
1378 | ); |
1390 | ); |
1379 | $SETUP_DIALOG->hide; |
1391 | $SETUP_DIALOG->hide; |
1380 | $::BIND_EDITOR->show; |
1392 | $::BIND_EDITOR->show; |
|
|
1393 | 0 |
1381 | }, |
1394 | }, |
1382 | ); |
1395 | ); |
1383 | |
1396 | |
1384 | $hb->add (new CFClient::UI::Button |
1397 | $hb->add (new CFClient::UI::Button |
1385 | text => "close", |
1398 | text => "close", |
1386 | tooltip => "Closes the binding window", |
1399 | tooltip => "Closes the binding window", |
1387 | expand => 1, |
1400 | expand => 1, |
1388 | on_activate => sub { |
1401 | on_activate => sub { |
1389 | $SETUP_DIALOG->hide; |
1402 | $SETUP_DIALOG->hide; |
|
|
1403 | 0 |
1390 | } |
1404 | } |
1391 | ); |
1405 | ); |
1392 | |
1406 | |
1393 | $refresh->(); |
1407 | $refresh->(); |
1394 | |
1408 | |
… | |
… | |
1432 | |
1446 | |
1433 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1447 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1434 | for @$pom; |
1448 | for @$pom; |
1435 | |
1449 | |
1436 | $viewer->set_offset (0); |
1450 | $viewer->set_offset (0); |
|
|
1451 | 0 |
1437 | }, |
1452 | }, |
1438 | on_visibility_change => sub { |
1453 | on_visibility_change => sub { |
1439 | my ($self, $visible) = @_; |
1454 | my ($self, $visible) = @_; |
1440 | return unless $visible; |
1455 | return unless $visible; |
1441 | return if $self->{value}; |
1456 | return if $self->{value}; |
1442 | $self->set_value ("intro"); |
1457 | $self->set_value ("intro"); |
|
|
1458 | 0 |
1443 | }, |
1459 | }, |
1444 | ); |
1460 | ); |
1445 | |
1461 | |
1446 | $win |
1462 | $win |
1447 | } |
1463 | } |
… | |
… | |
1516 | $MAPWIDGET->connect (activate_console => sub { |
1532 | $MAPWIDGET->connect (activate_console => sub { |
1517 | my ($mapwidget, $preset) = @_; |
1533 | my ($mapwidget, $preset) = @_; |
1518 | |
1534 | |
1519 | if ($CONSOLE) { |
1535 | if ($CONSOLE) { |
1520 | $CONSOLE->{input}->{auto_activated} = 1; |
1536 | $CONSOLE->{input}->{auto_activated} = 1; |
1521 | $CONSOLE->{input}->focus_in; |
1537 | $CONSOLE->{input}->grab_focus; |
1522 | |
1538 | |
1523 | if ($preset && $CONSOLE->{input}->get_text eq '') { |
1539 | if ($preset && $CONSOLE->{input}->get_text eq '') { |
1524 | $CONSOLE->{input}->set_text ($preset); |
1540 | $CONSOLE->{input}->set_text ($preset); |
1525 | } |
1541 | } |
1526 | } |
1542 | } |
1527 | }); |
1543 | }); |
1528 | $MAPWIDGET->show; |
1544 | $MAPWIDGET->show; |
1529 | $MAPWIDGET->focus_in; |
1545 | $MAPWIDGET->grab_focus; |
1530 | |
1546 | |
1531 | $LOGVIEW = new CFClient::UI::TextScroller |
1547 | $LOGVIEW = new CFClient::UI::TextScroller |
1532 | expand => 1, |
1548 | expand => 1, |
1533 | font => $FONT_FIXED, |
1549 | font => $FONT_FIXED, |
1534 | fontsize => $::CFG->{log_fontsize}, |
1550 | fontsize => $::CFG->{log_fontsize}, |
… | |
… | |
1544 | x => 'center', |
1560 | x => 'center', |
1545 | y => 'center', |
1561 | y => 'center', |
1546 | z => 2, |
1562 | z => 2, |
1547 | force_w => $::WIDTH * 0.6, |
1563 | force_w => $::WIDTH * 0.6, |
1548 | force_h => $::HEIGHT * 0.6, |
1564 | force_h => $::HEIGHT * 0.6, |
|
|
1565 | has_close_button => 1, |
1549 | ; |
1566 | ; |
1550 | |
1567 | |
1551 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1, |
1568 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1, |
1552 | filter => new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1569 | filter => new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1553 | |
1570 | |
… | |
… | |
1592 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
1609 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
1593 | on_activate => sub { |
1610 | on_activate => sub { |
1594 | $::CFG->{layout} = CFClient::UI::get_layout; |
1611 | $::CFG->{layout} = CFClient::UI::get_layout; |
1595 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1612 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1596 | status "Configuration Saved"; |
1613 | status "Configuration Saved"; |
|
|
1614 | 0 |
1597 | }, |
1615 | }, |
1598 | ); |
1616 | ); |
1599 | |
1617 | |
1600 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => help_window, |
1618 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => help_window, |
1601 | tooltip => "View Documentation"); |
1619 | tooltip => "View Documentation"); |
… | |
… | |
1607 | if ($CONN) { |
1625 | if ($CONN) { |
1608 | open_quit_dialog; |
1626 | open_quit_dialog; |
1609 | } else { |
1627 | } else { |
1610 | exit; |
1628 | exit; |
1611 | } |
1629 | } |
|
|
1630 | 0 |
1612 | }, |
1631 | }, |
1613 | ); |
1632 | ); |
1614 | |
1633 | |
1615 | $BUTTONBAR->show; |
1634 | $BUTTONBAR->show; |
1616 | $SETUP_DIALOG->show; |
1635 | $SETUP_DIALOG->show; |
… | |
… | |
1618 | |
1637 | |
1619 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
1638 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
1620 | } |
1639 | } |
1621 | |
1640 | |
1622 | sub video_shutdown { |
1641 | sub video_shutdown { |
|
|
1642 | CFClient::OpenGL::shutdown; |
|
|
1643 | |
1623 | undef $SDL_ACTIVE; |
1644 | undef $SDL_ACTIVE; |
1624 | } |
1645 | } |
1625 | |
1646 | |
1626 | my @bgmusic = qw(game1.ogg game2.ogg game3.ogg game5.ogg game6.ogg ross1.ogg ross2.ogg ross3.ogg ross4.ogg ross5.ogg); #d# |
1647 | my @bgmusic = qw(game1.ogg game2.ogg game3.ogg game5.ogg game6.ogg ross1.ogg ross2.ogg ross3.ogg ross4.ogg ross5.ogg); #d# |
1627 | my $bgmusic;#TODO#hack#d# |
1648 | my $bgmusic;#TODO#hack#d# |