… | |
… | |
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; |
… | |
… | |
154 | $hbox->add (new CFClient::UI::Button |
155 | $hbox->add (new CFClient::UI::Button |
155 | text => "No", |
156 | text => "No", |
156 | on_activate => sub { |
157 | on_activate => sub { |
157 | $conn->send ("reply n"); |
158 | $conn->send ("reply n"); |
158 | $dialog->destroy; |
159 | $dialog->destroy; |
|
|
160 | 0 |
159 | } |
161 | } |
160 | ); |
162 | ); |
161 | $hbox->add (new CFClient::UI::Button |
163 | $hbox->add (new CFClient::UI::Button |
162 | text => "Yes", |
164 | text => "Yes", |
163 | on_activate => sub { |
165 | on_activate => sub { |
164 | $conn->send ("reply y"); |
166 | $conn->send ("reply y"); |
165 | destroy_query_dialog $conn; |
167 | destroy_query_dialog $conn; |
|
|
168 | 0 |
166 | }, |
169 | }, |
167 | ); |
170 | ); |
168 | |
171 | |
169 | $dialog->focus_in; |
172 | $dialog->grab_focus; |
170 | |
173 | |
171 | } elsif ($flags & CS_QUERY_SINGLECHAR) { |
174 | } elsif ($flags & CS_QUERY_SINGLECHAR) { |
172 | $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)"; |
173 | |
176 | |
174 | 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) { |
… | |
… | |
184 | $table->add (0, 0, new CFClient::UI::Button |
187 | $table->add (0, 0, new CFClient::UI::Button |
185 | text => "Next Race", |
188 | text => "Next Race", |
186 | on_activate => sub { |
189 | on_activate => sub { |
187 | $conn->send ("reply n"); |
190 | $conn->send ("reply n"); |
188 | destroy_query_dialog $conn; |
191 | destroy_query_dialog $conn; |
|
|
192 | 0 |
189 | }, |
193 | }, |
190 | ); |
194 | ); |
191 | $table->add (2, 0, new CFClient::UI::Button |
195 | $table->add (2, 0, new CFClient::UI::Button |
192 | text => "Accept", |
196 | text => "Accept", |
193 | on_activate => sub { |
197 | on_activate => sub { |
194 | $conn->send ("reply d"); |
198 | $conn->send ("reply d"); |
195 | destroy_query_dialog $conn; |
199 | destroy_query_dialog $conn; |
|
|
200 | 0 |
196 | }, |
201 | }, |
197 | ); |
202 | ); |
198 | |
203 | |
199 | unshift @dialog, new CFClient::UI::Label |
204 | unshift @dialog, new CFClient::UI::Label |
200 | max_w => $::WIDTH * 0.4, |
205 | max_w => $::WIDTH * 0.4, |
… | |
… | |
230 | $table->add (0, 0, new CFClient::UI::Button |
235 | $table->add (0, 0, new CFClient::UI::Button |
231 | text => "Roll Again", |
236 | text => "Roll Again", |
232 | on_activate => sub { |
237 | on_activate => sub { |
233 | $conn->send ("reply y"); |
238 | $conn->send ("reply y"); |
234 | destroy_query_dialog $conn; |
239 | destroy_query_dialog $conn; |
|
|
240 | 0 |
235 | }, |
241 | }, |
236 | ); |
242 | ); |
237 | |
243 | |
238 | # center: swap stats |
244 | # center: swap stats |
239 | my ($sw1, $sw2) = map +(new CFClient::UI::Combobox |
245 | my ($sw1, $sw2) = map +(new CFClient::UI::Combobox |
… | |
… | |
253 | text => "Swap Stats", |
259 | text => "Swap Stats", |
254 | on_activate => sub { |
260 | on_activate => sub { |
255 | $conn->{stat_change_with} = $sw2->{value}; |
261 | $conn->{stat_change_with} = $sw2->{value}; |
256 | $conn->send ("reply $sw1->{value}"); |
262 | $conn->send ("reply $sw1->{value}"); |
257 | destroy_query_dialog $conn; |
263 | destroy_query_dialog $conn; |
|
|
264 | 0 |
258 | }, |
265 | }, |
259 | ); |
266 | ); |
260 | $table->add (2, 1, new CFClient::UI::HBox children => [$sw1, $sw2]); |
267 | $table->add (2, 1, new CFClient::UI::HBox children => [$sw1, $sw2]); |
261 | |
268 | |
262 | # right: accept |
269 | # right: accept |
… | |
… | |
264 | text => "Accept", |
271 | text => "Accept", |
265 | on_activate => sub { |
272 | on_activate => sub { |
266 | $conn->send ("reply n"); |
273 | $conn->send ("reply n"); |
267 | $STATS_WINDOW->hide; |
274 | $STATS_WINDOW->hide; |
268 | destroy_query_dialog $conn; |
275 | destroy_query_dialog $conn; |
|
|
276 | 0 |
269 | }, |
277 | }, |
270 | ); |
278 | ); |
271 | |
279 | |
272 | unshift @dialog, new CFClient::UI::Label |
280 | unshift @dialog, new CFClient::UI::Label |
273 | max_w => $::WIDTH * 0.4, |
281 | max_w => $::WIDTH * 0.4, |
… | |
… | |
283 | |
291 | |
284 | push @dialog, my $entry = new CFClient::UI::Entry |
292 | push @dialog, my $entry = new CFClient::UI::Entry |
285 | on_changed => sub { |
293 | on_changed => sub { |
286 | $conn->send ("reply $_[1]"); |
294 | $conn->send ("reply $_[1]"); |
287 | destroy_query_dialog $conn; |
295 | destroy_query_dialog $conn; |
|
|
296 | 0 |
288 | }, |
297 | }, |
289 | ; |
298 | ; |
290 | |
299 | |
291 | $entry->focus_in; |
300 | $entry->grab_focus; |
292 | |
301 | |
293 | } else { |
302 | } else { |
294 | $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)"; |
295 | |
304 | |
296 | push @dialog, my $entry = new CFClient::UI::Entry |
305 | push @dialog, my $entry = new CFClient::UI::Entry |
297 | $flags & CS_QUERY_HIDEINPUT ? (hidden => "*") : (), |
306 | $flags & CS_QUERY_HIDEINPUT ? (hidden => "*") : (), |
298 | on_activate => sub { |
307 | on_activate => sub { |
299 | $conn->send ("reply $_[1]"); |
308 | $conn->send ("reply $_[1]"); |
300 | destroy_query_dialog $conn; |
309 | destroy_query_dialog $conn; |
|
|
310 | 0 |
301 | }, |
311 | }, |
302 | ; |
312 | ; |
303 | |
313 | |
304 | $entry->focus_in; |
314 | $entry->grab_focus; |
305 | } |
315 | } |
306 | |
316 | |
307 | $vbox->add (@dialog); |
317 | $vbox->add (@dialog); |
308 | $dialog->show; |
318 | $dialog->show; |
309 | } |
319 | } |
… | |
… | |
314 | $LOGIN_BUTTON->set_text ("Logout"); |
324 | $LOGIN_BUTTON->set_text ("Logout"); |
315 | $SETUP_DIALOG->hide; |
325 | $SETUP_DIALOG->hide; |
316 | |
326 | |
317 | my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; |
327 | my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; |
318 | |
328 | |
319 | my ($host, $port) = split /:/, $CFG->{host}; |
329 | my ($host, $port) = split /:/, $CFG->{profile}{default}{host}; |
320 | |
330 | |
321 | $MAP = new CFClient::Map $mapsize, $mapsize; |
331 | $MAP = new CFClient::Map $mapsize, $mapsize; |
322 | |
332 | |
323 | $CONN = eval { |
333 | $CONN = eval { |
324 | new CFClient::Protocol |
334 | new CFClient::Protocol |
325 | host => $host, |
335 | host => $host, |
326 | port => $port || 13327, |
336 | port => $port || 13327, |
327 | user => $CFG->{user}, |
337 | user => $CFG->{profile}{default}{user}, |
328 | pass => $CFG->{password}, |
338 | pass => $CFG->{profile}{default}{password}, |
329 | mapw => $mapsize, |
339 | mapw => $mapsize, |
330 | maph => $mapsize, |
340 | maph => $mapsize, |
331 | |
341 | |
332 | map_widget => $MAPWIDGET, |
342 | map_widget => $MAPWIDGET, |
333 | logview => $LOGVIEW, |
343 | logview => $LOGVIEW, |
… | |
… | |
362 | sub stop_game { |
372 | sub stop_game { |
363 | $LOGIN_BUTTON->set_text ("Login"); |
373 | $LOGIN_BUTTON->set_text ("Login"); |
364 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
374 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
365 | $SETUP_DIALOG->show; |
375 | $SETUP_DIALOG->show; |
366 | $INV_WINDOW->hide; |
376 | $INV_WINDOW->hide; |
|
|
377 | $SETUP_SPELLS->clear_spells; |
367 | |
378 | |
368 | return unless $CONN; |
379 | return unless $CONN; |
369 | |
380 | |
370 | status "connection closed"; |
381 | status "connection closed"; |
371 | |
382 | |
… | |
… | |
397 | |
408 | |
398 | $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"); |
399 | $table->add (1, $row++, new CFClient::UI::CheckBox |
410 | $table->add (1, $row++, new CFClient::UI::CheckBox |
400 | state => $CFG->{fullscreen}, |
411 | state => $CFG->{fullscreen}, |
401 | tooltip => "Bring the client into fullscreen mode.", |
412 | tooltip => "Bring the client into fullscreen mode.", |
402 | on_changed => sub { |
413 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
403 | my ($self, $value) = @_; |
|
|
404 | $CFG->{fullscreen} = $value; |
|
|
405 | } |
|
|
406 | ); |
414 | ); |
407 | |
415 | |
408 | $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"); |
409 | $table->add (1, $row++, new CFClient::UI::CheckBox |
417 | $table->add (1, $row++, new CFClient::UI::CheckBox |
410 | state => $CFG->{fast}, |
418 | state => $CFG->{fast}, |
411 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
419 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
412 | on_changed => sub { |
420 | on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } |
413 | my ($self, $value) = @_; |
|
|
414 | $CFG->{fast} = $value; |
|
|
415 | } |
|
|
416 | ); |
421 | ); |
417 | |
422 | |
418 | $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"); |
419 | $table->add (1, $row++, new CFClient::UI::Slider |
424 | $table->add (1, $row++, new CFClient::UI::Slider |
420 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
425 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
421 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
426 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
422 | on_changed => sub { |
427 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } |
423 | my ($self, $value) = @_; |
|
|
424 | $CFG->{map_scale} = 2 ** $value; |
|
|
425 | } |
|
|
426 | ); |
428 | ); |
427 | |
429 | |
428 | $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"); |
429 | $table->add (1, $row++, new CFClient::UI::CheckBox |
431 | $table->add (1, $row++, new CFClient::UI::CheckBox |
430 | state => $CFG->{fow_enable}, |
432 | state => $CFG->{fow_enable}, |
431 | 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.", |
432 | on_changed => sub { |
434 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_enable} = $value; 0 } |
433 | my ($self, $value) = @_; |
|
|
434 | $CFG->{fow_enable} = $value; |
|
|
435 | } |
|
|
436 | ); |
435 | ); |
437 | |
436 | |
438 | $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"); |
439 | $table->add (1, $row++, new CFClient::UI::Slider |
438 | $table->add (1, $row++, new CFClient::UI::Slider |
440 | range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], |
439 | range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], |
441 | 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.", |
442 | on_changed => sub { |
441 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_intensity} = $value; 0 } |
443 | my ($self, $value) = @_; |
|
|
444 | $CFG->{fow_intensity} = $value; |
|
|
445 | } |
|
|
446 | ); |
442 | ); |
447 | |
443 | |
448 | $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"); |
449 | $table->add (1, $row++, new CFClient::UI::CheckBox |
445 | $table->add (1, $row++, new CFClient::UI::CheckBox |
450 | state => $CFG->{fow_smooth}, |
446 | state => $CFG->{fow_smooth}, |
451 | 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.", |
452 | on_changed => sub { |
448 | on_changed => sub { |
453 | my ($self, $value) = @_; |
449 | my ($self, $value) = @_; |
454 | $CFG->{fow_smooth} = $value; |
450 | $CFG->{fow_smooth} = $value; |
455 | 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 |
456 | } |
453 | } |
457 | ); |
454 | ); |
458 | |
455 | |
459 | $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"); |
460 | $table->add (1, $row++, new CFClient::UI::Slider |
457 | $table->add (1, $row++, new CFClient::UI::Slider |
461 | range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1], |
458 | range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1], |
462 | 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.", |
463 | on_changed => sub { $CFG->{gui_fontsize} = $_[1] }, |
460 | on_changed => sub { $CFG->{gui_fontsize} = $_[1]; 0 }, |
464 | ); |
461 | ); |
465 | |
462 | |
466 | $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"); |
467 | $table->add (1, $row++, new CFClient::UI::Slider |
464 | $table->add (1, $row++, new CFClient::UI::Slider |
468 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
465 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
469 | 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.", |
470 | on_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]) }, |
467 | on_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, |
471 | ); |
468 | ); |
472 | |
469 | |
473 | $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"); |
474 | |
471 | |
475 | $table->add (1, $row++, new CFClient::UI::Slider |
472 | $table->add (1, $row++, new CFClient::UI::Slider |
476 | range => [$CFG->{stat_fontsize}, 0.5, 2, 0, 0.1], |
473 | range => [$CFG->{stat_fontsize}, 0.5, 2, 0, 0.1], |
477 | 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.", |
478 | on_changed => sub { |
475 | on_changed => sub { |
479 | $CFG->{stat_fontsize} = $_[1]; |
476 | $CFG->{stat_fontsize} = $_[1]; |
480 | &set_stats_window_fontsize; |
477 | &set_stats_window_fontsize; |
|
|
478 | 0 |
481 | } |
479 | } |
482 | ); |
480 | ); |
483 | |
481 | |
484 | $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"); |
485 | $table->add (1, $row++, new CFClient::UI::Slider |
483 | $table->add (1, $row++, new CFClient::UI::Slider |
486 | range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], |
484 | range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], |
487 | 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.", |
488 | on_changed => sub { |
486 | on_changed => sub { |
489 | $CFG->{gauge_fontsize} = $_[1]; |
487 | $CFG->{gauge_fontsize} = $_[1]; |
490 | &set_gauge_window_fontsize; |
488 | &set_gauge_window_fontsize; |
|
|
489 | 0 |
491 | } |
490 | } |
492 | ); |
491 | ); |
493 | |
492 | |
494 | $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"); |
495 | $table->add (1, $row++, new CFClient::UI::Slider |
494 | $table->add (1, $row++, new CFClient::UI::Slider |
496 | range => [$CFG->{gauge_size}, 0.2, 0.8], |
495 | range => [$CFG->{gauge_size}, 0.2, 0.8], |
497 | 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.", |
498 | on_changed => sub { |
497 | on_changed => sub { |
499 | $CFG->{gauge_size} = $_[1]; |
498 | $CFG->{gauge_size} = $_[1]; |
500 | $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size}); |
499 | $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size}); |
|
|
500 | 0 |
501 | } |
501 | } |
502 | ); |
502 | ); |
503 | |
503 | |
504 | $table->add (1, $row++, new CFClient::UI::Button |
504 | $table->add (1, $row++, new CFClient::UI::Button |
505 | expand => 1, align => 0, text => "Apply", |
505 | expand => 1, align => 0, text => "Apply", |
506 | tooltip => "Apply the video settings", |
506 | tooltip => "Apply the video settings", |
507 | on_activate => sub { |
507 | on_activate => sub { |
508 | video_shutdown (); |
508 | video_shutdown (); |
509 | video_init (); |
509 | video_init (); |
|
|
510 | 0 |
510 | } |
511 | } |
511 | ); |
512 | ); |
512 | |
513 | |
513 | $vbox |
514 | $vbox |
514 | } |
515 | } |
… | |
… | |
522 | |
523 | |
523 | $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"); |
524 | $table->add (1, $row++, new CFClient::UI::CheckBox |
525 | $table->add (1, $row++, new CFClient::UI::CheckBox |
525 | state => $CFG->{audio_enable}, |
526 | state => $CFG->{audio_enable}, |
526 | 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.", |
527 | on_changed => sub { |
528 | on_changed => sub { $CFG->{audio_enable} = $_[1]; 0 } |
528 | $CFG->{audio_enable} = $_[1]; |
|
|
529 | } |
|
|
530 | ); |
529 | ); |
531 | # $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"); |
532 | # $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 { |
533 | # $CFG->{effects_volume} = $_[1]; |
532 | # $CFG->{effects_volume} = $_[1]; |
534 | # }); |
533 | # }); |
535 | $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"); |
536 | $table->add (1, $row++, my $hbox = new CFClient::UI::HBox); |
535 | $table->add (1, $row++, my $hbox = new CFClient::UI::HBox); |
537 | $hbox->add (new CFClient::UI::CheckBox |
536 | $hbox->add (new CFClient::UI::CheckBox |
538 | expand => 1, state => $CFG->{bgm_enable}, |
537 | expand => 1, state => $CFG->{bgm_enable}, |
539 | 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.", |
540 | on_changed => sub { |
539 | on_changed => sub { $CFG->{bgm_enable} = $_[1]; 0 } |
541 | $CFG->{bgm_enable} = $_[1]; |
|
|
542 | } |
|
|
543 | ); |
540 | ); |
544 | $hbox->add (new CFClient::UI::Slider |
541 | $hbox->add (new CFClient::UI::Slider |
545 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], |
542 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], |
546 | tooltip => "The volume of the background music. Changes are instant.", |
543 | tooltip => "The volume of the background music. Changes are instant.", |
547 | on_changed => sub { |
544 | on_changed => sub { $CFG->{bgm_volume} = $_[1]; CFClient::MixMusic::volume $_[1] * 128; 0 } |
548 | $CFG->{bgm_volume} = $_[1]; |
|
|
549 | CFClient::MixMusic::volume $_[1] * 128; |
|
|
550 | } |
|
|
551 | ); |
545 | ); |
552 | |
546 | |
553 | $table->add (1, $row++, new CFClient::UI::Button |
547 | $table->add (1, $row++, new CFClient::UI::Button |
554 | expand => 1, align => 0, text => "Apply", |
548 | expand => 1, align => 0, text => "Apply", |
555 | tooltip => "Apply the audio settings", |
549 | tooltip => "Apply the audio settings", |
556 | on_activate => sub { |
550 | on_activate => sub { |
557 | audio_shutdown (); |
551 | audio_shutdown (); |
558 | audio_init (); |
552 | audio_init (); |
|
|
553 | 0 |
559 | } |
554 | } |
560 | ); |
555 | ); |
561 | |
556 | |
562 | $vbox |
557 | $vbox |
563 | } |
558 | } |
… | |
… | |
629 | |
624 | |
630 | sub debug_setup { |
625 | sub debug_setup { |
631 | my $table = new CFClient::UI::Table; |
626 | my $table = new CFClient::UI::Table; |
632 | |
627 | |
633 | $table->add (0, 0, new CFClient::UI::Label text => "Widget Borders"); |
628 | $table->add (0, 0, new CFClient::UI::Label text => "Widget Borders"); |
634 | $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 }); |
635 | $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"); |
636 | $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 }); |
637 | $table->add (0, 2, new CFClient::UI::Label text => "Show FPS"); |
632 | $table->add (0, 2, new CFClient::UI::Label text => "Show FPS"); |
638 | $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 }); |
639 | $table->add (0, 3, new CFClient::UI::Label text => "Suppress Tooltips"); |
634 | $table->add (0, 3, new CFClient::UI::Label text => "Suppress Tooltips"); |
640 | $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 }); |
641 | |
636 | |
642 | 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); |
643 | |
638 | |
644 | for my $x (0..2) { |
639 | for my $x (0..2) { |
645 | for my $y (0 .. 2) { |
640 | for my $y (0 .. 2) { |
… | |
… | |
658 | sub stats_window { |
653 | sub stats_window { |
659 | my $tgw = new CFClient::UI::FancyFrame |
654 | my $tgw = new CFClient::UI::FancyFrame |
660 | y => $HEIGHT * (2/8), |
655 | y => $HEIGHT * (2/8), |
661 | x => "max", |
656 | x => "max", |
662 | title => "Stats", |
657 | title => "Stats", |
663 | name => "stats_window"; |
658 | name => "stats_window", |
|
|
659 | has_close_button => 1; |
664 | |
660 | |
665 | $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); |
666 | $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, |
667 | can_hover => 1, can_events => 1, |
663 | can_hover => 1, can_events => 1, |
668 | 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."); |
… | |
… | |
814 | $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); |
810 | $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); |
815 | $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}); |
816 | |
812 | |
817 | $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); |
818 | |
814 | |
819 | # TODO: replace by CS_STAT_RES_xxx constants |
|
|
820 | my %tbl = ( |
815 | my %tbl = ( |
821 | phys => 100, |
816 | phys => CS_STAT_RES_PHYS, |
822 | magic => 101, |
817 | magic => CS_STAT_RES_MAG, |
823 | fire => 102, |
818 | fire => CS_STAT_RES_FIRE, |
824 | elec => 103, |
819 | elec => CS_STAT_RES_ELEC, |
825 | cold => 104, |
820 | cold => CS_STAT_RES_COLD, |
826 | conf => 105, |
821 | conf => CS_STAT_RES_CONF, |
827 | acid => 106, |
822 | acid => CS_STAT_RES_ACID, |
828 | drain => 107, |
823 | drain => CS_STAT_RES_DRAIN, |
829 | ghit => 108, |
824 | ghit => CS_STAT_RES_GHOSTHIT, |
830 | pois => 109, |
825 | pois => CS_STAT_RES_POISON, |
831 | slow => 110, |
826 | slow => CS_STAT_RES_SLOW, |
832 | para => 111, |
827 | para => CS_STAT_RES_PARA, |
833 | tund => 112, |
828 | tund => CS_STAT_TURN_UNDEAD, |
834 | fear => 113, |
829 | fear => CS_STAT_RES_FEAR, |
835 | depl => 113, |
830 | depl => CS_STAT_RES_DEPLETE, |
836 | deat => 115, |
831 | deat => CS_STAT_RES_DEATH, |
837 | holyw => 116, |
832 | holyw => CS_STAT_RES_HOLYWORD, |
838 | blind => 117, |
833 | blind => CS_STAT_RES_BLIND, |
839 | ); |
834 | ); |
840 | |
835 | |
841 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) |
836 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) |
842 | for keys %tbl; |
837 | for keys %tbl; |
843 | } |
838 | } |
… | |
… | |
917 | $table->add (scalar @$m, $y, new CFClient::UI::VBox children => [ |
912 | $table->add (scalar @$m, $y, new CFClient::UI::VBox children => [ |
918 | (new CFClient::UI::Button |
913 | (new CFClient::UI::Button |
919 | text => "Use", |
914 | text => "Use", |
920 | tooltip => "Put this server into the <b>Host:Port</b> field", |
915 | tooltip => "Put this server into the <b>Host:Port</b> field", |
921 | on_activate => sub { |
916 | on_activate => sub { |
922 | $HOST_ENTRY->set_text ($CFG->{host} = $host); |
917 | $HOST_ENTRY->set_text ($CFG->{profile}{default}{host} = $host); |
923 | $METASERVER->hide; |
918 | $METASERVER->hide; |
|
|
919 | 0 |
924 | }, |
920 | }, |
925 | ), |
921 | ), |
926 | (new CFClient::UI::Empty expand => 1), |
922 | (new CFClient::UI::Empty expand => 1), |
927 | ]); |
923 | ]); |
928 | |
924 | |
… | |
… | |
949 | z => 3, |
945 | z => 3, |
950 | force_h => $::HEIGHT * 0.4, |
946 | force_h => $::HEIGHT * 0.4, |
951 | child => (my $vbox = new CFClient::UI::VBox), |
947 | child => (my $vbox = new CFClient::UI::VBox), |
952 | on_visibility_change => sub { |
948 | on_visibility_change => sub { |
953 | update_metaserver if $_[1]; |
949 | update_metaserver if $_[1]; |
|
|
950 | 0 |
954 | }, |
951 | }, |
955 | ; |
952 | ; |
956 | |
953 | |
957 | $dialog->{table} = new CFClient::UI::Table; |
954 | $dialog->{table} = new CFClient::UI::Table; |
958 | |
955 | |
… | |
… | |
971 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
968 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
972 | |
969 | |
973 | $vbox->add ( |
970 | $vbox->add ( |
974 | $HOST_ENTRY = new CFClient::UI::Entry |
971 | $HOST_ENTRY = new CFClient::UI::Entry |
975 | expand => 1, |
972 | expand => 1, |
976 | text => $CFG->{host}, |
973 | text => $CFG->{profile}{default}{host}, |
977 | 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", |
978 | on_changed => sub { |
975 | on_changed => sub { |
979 | my ($self, $value) = @_; |
976 | my ($self, $value) = @_; |
980 | $CFG->{host} = $value; |
977 | $CFG->{profile}{default}{host} = $value; |
|
|
978 | 0 |
981 | } |
979 | } |
982 | ); |
980 | ); |
983 | |
981 | |
984 | $METASERVER = metaserver_dialog; |
982 | $METASERVER = metaserver_dialog; |
985 | |
983 | |
986 | $vbox->add (new CFClient::UI::Button |
984 | $vbox->add (new CFClient::UI::Button |
987 | expand => 1, |
985 | expand => 1, |
988 | text => "Server List", |
986 | text => "Server List", |
989 | other => $METASERVER, |
987 | other => $METASERVER, |
990 | tooltip => "Show a list of available crossfire servers", |
988 | tooltip => "Show a list of available crossfire servers", |
991 | on_activate => sub { $METASERVER->toggle_visibility }, |
989 | on_activate => sub { $METASERVER->toggle_visibility; 0 }, |
992 | on_visibility_change => sub { $METASERVER->hide unless $_[1] }, |
990 | on_visibility_change => sub { $METASERVER->hide unless $_[1]; 0 }, |
993 | ); |
991 | ); |
994 | } |
992 | } |
995 | |
993 | |
996 | $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"); |
997 | $table->add (1, 4, new CFClient::UI::Entry |
995 | $table->add (1, 4, new CFClient::UI::Entry |
998 | text => $CFG->{user}, |
996 | text => $CFG->{profile}{default}{user}, |
999 | tooltip => "The name of your character on the server", |
997 | tooltip => "The name of your character on the server", |
1000 | on_changed => sub { |
998 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value } |
1001 | my ($self, $value) = @_; |
|
|
1002 | $CFG->{user} = $value; |
|
|
1003 | } |
|
|
1004 | ); |
999 | ); |
1005 | |
1000 | |
1006 | $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"); |
1007 | $table->add (1, 5, new CFClient::UI::Entry |
1002 | $table->add (1, 5, new CFClient::UI::Entry |
1008 | text => $CFG->{password}, |
1003 | text => $CFG->{profile}{default}{password}, |
1009 | hidden => 1, |
1004 | hidden => 1, |
1010 | tooltip => "The password for your character", |
1005 | tooltip => "The password for your character", |
1011 | on_changed => sub { |
1006 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value } |
1012 | my ($self, $value) = @_; |
|
|
1013 | $CFG->{password} = $value; |
|
|
1014 | } |
|
|
1015 | ); |
1007 | ); |
1016 | |
1008 | |
1017 | $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"); |
1018 | $table->add (1, 7, new CFClient::UI::Slider |
1010 | $table->add (1, 7, new CFClient::UI::Slider |
1019 | force_w => 100, |
1011 | force_w => 100, |
1020 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
1012 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
1021 | 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. " |
1022 | . "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, " |
1023 | . "but you also increase bandwidth requirements and latency. " |
1015 | . "but you also increase bandwidth requirements and latency. " |
1024 | . "This option is only used once at log-in.", |
1016 | . "This option is only used once at log-in.", |
1025 | on_changed => sub { |
1017 | on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 0 }, |
1026 | my ($self, $value) = @_; |
|
|
1027 | |
|
|
1028 | $CFG->{mapsize} = $self->{range}[0] = $value = int $value; |
|
|
1029 | }, |
|
|
1030 | ); |
1018 | ); |
1031 | |
1019 | |
1032 | $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"); |
1033 | $table->add (1, 8, new CFClient::UI::CheckBox |
1021 | $table->add (1, 8, new CFClient::UI::CheckBox |
1034 | state => $CFG->{face_prefetch}, |
1022 | state => $CFG->{face_prefetch}, |
… | |
… | |
1037 | . "This might increase or create lag, but increases the chances " |
1025 | . "This might increase or create lag, but increases the chances " |
1038 | . "of faces being ready for display when you encounter them. " |
1026 | . "of faces being ready for display when you encounter them. " |
1039 | . "It also uses up server bandwidth on every connect, " |
1027 | . "It also uses up server bandwidth on every connect, " |
1040 | . "so only set it if you really need to prefetch images. " |
1028 | . "so only set it if you really need to prefetch images. " |
1041 | . "This option can be set and unset any time.", |
1029 | . "This option can be set and unset any time.", |
1042 | on_changed => sub { $CFG->{face_prefetch} = $_[1] }, |
1030 | on_changed => sub { $CFG->{face_prefetch} = $_[1]; 0 }, |
1043 | ); |
1031 | ); |
1044 | |
1032 | |
1045 | $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"); |
1046 | $table->add (1, 9, new CFClient::UI::Entry |
1034 | $table->add (1, 9, new CFClient::UI::Entry |
1047 | text => $CFG->{output_count}, |
1035 | text => $CFG->{output_count}, |
1048 | 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.", |
1049 | on_changed => sub { $CFG->{output_count} = $_[1] }, |
1037 | on_changed => sub { $CFG->{output_count} = $_[1]; 0 }, |
1050 | ); |
1038 | ); |
1051 | |
1039 | |
1052 | $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"); |
1053 | $table->add (1, 10, new CFClient::UI::Entry |
1041 | $table->add (1, 10, new CFClient::UI::Entry |
1054 | text => $CFG->{output_sync}, |
1042 | text => $CFG->{output_sync}, |
1055 | 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.", |
1056 | on_changed => sub { $CFG->{output_sync} = $_[1] }, |
1044 | on_changed => sub { $CFG->{output_sync} = $_[1]; 0 }, |
1057 | ); |
1045 | ); |
1058 | |
1046 | |
1059 | $table->add (1, 11, $LOGIN_BUTTON = new CFClient::UI::Button |
1047 | $table->add (1, 11, $LOGIN_BUTTON = new CFClient::UI::Button |
1060 | expand => 1, |
1048 | expand => 1, |
1061 | align => 0, |
1049 | align => 0, |
1062 | text => "Login", |
1050 | text => "Login", |
1063 | on_activate => sub { |
1051 | on_activate => sub { |
1064 | $CONN ? stop_game |
1052 | $CONN ? stop_game |
1065 | : start_game; |
1053 | : start_game; |
|
|
1054 | 0 |
1066 | }, |
1055 | }, |
1067 | ); |
1056 | ); |
1068 | |
1057 | |
1069 | $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"); |
1070 | $table->add (1, 12, my $saycmd = new CFClient::UI::Entry |
1059 | $table->add (1, 12, my $saycmd = new CFClient::UI::Entry |
… | |
… | |
1073 | . "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. " |
1074 | . "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.", |
1075 | on_changed => sub { |
1064 | on_changed => sub { |
1076 | my ($self, $value) = @_; |
1065 | my ($self, $value) = @_; |
1077 | $CFG->{say_command} = $value; |
1066 | $CFG->{say_command} = $value; |
|
|
1067 | 0 |
1078 | } |
1068 | } |
1079 | ); |
1069 | ); |
|
|
1070 | |
|
|
1071 | $vbox->add (new CFClient::UI::Label |
|
|
1072 | text => "Server Info", |
|
|
1073 | fontsize => 1.2, |
|
|
1074 | padding_y => 8, |
|
|
1075 | fg => [1, 1, 0, 1], |
|
|
1076 | ); |
|
|
1077 | |
|
|
1078 | $vbox->add ($SERVER_INFO = new CFClient::UI::Label ellipsise => 0); |
1080 | |
1079 | |
1081 | $vbox |
1080 | $vbox |
1082 | } |
1081 | } |
1083 | |
1082 | |
1084 | sub message_window { |
1083 | sub message_window { |
… | |
… | |
1089 | bg => [0, 0, 0, 0.75], |
1088 | bg => [0, 0, 0, 0.75], |
1090 | x => "max", |
1089 | x => "max", |
1091 | y => 0, |
1090 | y => 0, |
1092 | force_w => $::WIDTH * 0.4, |
1091 | force_w => $::WIDTH * 0.4, |
1093 | force_h => $::HEIGHT * 0.5, |
1092 | force_h => $::HEIGHT * 0.5, |
1094 | child => (my $vbox = new CFClient::UI::VBox); |
1093 | child => (my $vbox = new CFClient::UI::VBox), |
|
|
1094 | has_close_button => 1; |
1095 | |
1095 | |
1096 | $vbox->add ($LOGVIEW); |
1096 | $vbox->add ($LOGVIEW); |
1097 | |
1097 | |
1098 | $vbox->add (my $input = new CFClient::UI::Entry |
1098 | $vbox->add (my $input = new CFClient::UI::Entry |
1099 | 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> " |
… | |
… | |
1107 | |
1107 | |
1108 | if ($prev_focus == $MAPWIDGET && $input->{auto_activated}) { |
1108 | if ($prev_focus == $MAPWIDGET && $input->{auto_activated}) { |
1109 | $input->{refocus_map} = 1; |
1109 | $input->{refocus_map} = 1; |
1110 | } |
1110 | } |
1111 | delete $input->{auto_activated}; |
1111 | delete $input->{auto_activated}; |
|
|
1112 | |
|
|
1113 | 0 |
1112 | }, |
1114 | }, |
1113 | on_activate => sub { |
1115 | on_activate => sub { |
1114 | my ($input, $text) = @_; |
1116 | my ($input, $text) = @_; |
1115 | $input->set_text (''); |
1117 | $input->set_text (''); |
1116 | |
1118 | |
… | |
… | |
1122 | } |
1124 | } |
1123 | if ($input->{refocus_map}) { |
1125 | if ($input->{refocus_map}) { |
1124 | delete $input->{refocus_map}; |
1126 | delete $input->{refocus_map}; |
1125 | $MAPWIDGET->focus_in |
1127 | $MAPWIDGET->focus_in |
1126 | } |
1128 | } |
|
|
1129 | |
|
|
1130 | 0 |
1127 | }, |
1131 | }, |
1128 | on_escape => sub { |
1132 | on_escape => sub { |
1129 | $MAPWIDGET->focus_in |
1133 | $MAPWIDGET->grab_focus; |
|
|
1134 | |
|
|
1135 | 0 |
1130 | }, |
1136 | }, |
1131 | ); |
1137 | ); |
1132 | |
1138 | |
1133 | $CONSOLE = { |
1139 | $CONSOLE = { |
1134 | window => $window, |
1140 | window => $window, |
… | |
… | |
1156 | ); |
1162 | ); |
1157 | $vb->add (my $hb = new CFClient::UI::HBox expand => 1); |
1163 | $vb->add (my $hb = new CFClient::UI::HBox expand => 1); |
1158 | $hb->add (new CFClient::UI::Button |
1164 | $hb->add (new CFClient::UI::Button |
1159 | text => "Ok", |
1165 | text => "Ok", |
1160 | expand => 1, |
1166 | expand => 1, |
1161 | on_activate => sub { $QUIT_DIALOG->hide }, |
1167 | on_activate => sub { $QUIT_DIALOG->hide; 0 }, |
1162 | ); |
1168 | ); |
1163 | $hb->add (new CFClient::UI::Button |
1169 | $hb->add (new CFClient::UI::Button |
1164 | text => "Quit anyway", |
1170 | text => "Quit anyway", |
1165 | expand => 1, |
1171 | expand => 1, |
1166 | on_activate => sub { exit }, |
1172 | on_activate => sub { exit }, |
… | |
… | |
1209 | ["Potions" => PICKUP_POTION], |
1215 | ["Potions" => PICKUP_POTION], |
1210 | ["Magic Devices" => PICKUP_MAGIC_DEVICE], |
1216 | ["Magic Devices" => PICKUP_MAGIC_DEVICE], |
1211 | ["Ignore cursed" => PICKUP_NOT_CURSED], |
1217 | ["Ignore cursed" => PICKUP_NOT_CURSED], |
1212 | ["Jewelery" => PICKUP_JEWELS], |
1218 | ["Jewelery" => PICKUP_JEWELS], |
1213 | ], |
1219 | ], |
|
|
1220 | ["Weight/Value ratio", 2, 17] |
1214 | ) |
1221 | ) |
1215 | { |
1222 | { |
1216 | my ($title, $x, $y, @bits) = @$_; |
1223 | my ($title, $x, $y, @bits) = @$_; |
1217 | $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); |
1224 | $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); |
1218 | |
1225 | |
… | |
… | |
1232 | $::CFG->{pickup} &= ~$mask; |
1239 | $::CFG->{pickup} &= ~$mask; |
1233 | } |
1240 | } |
1234 | |
1241 | |
1235 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1242 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1236 | if defined $::CONN; |
1243 | if defined $::CONN; |
|
|
1244 | |
|
|
1245 | 0 |
1237 | }); |
1246 | }); |
1238 | } |
1247 | } |
1239 | } |
1248 | } |
|
|
1249 | |
|
|
1250 | $table->add (2, 18, new CFClient::UI::ValSlider |
|
|
1251 | range => [0, 0, 16, 1, 1], |
|
|
1252 | to_value => sub { ">= " . 5 * $_[0] }, |
|
|
1253 | on_changed => sub { |
|
|
1254 | my ($slider, $value) = @_; |
|
|
1255 | |
|
|
1256 | $::CFG->{pickup} &= ~0x7; |
|
|
1257 | $::CFG->{pickup} |= int $value |
|
|
1258 | if $value; |
|
|
1259 | 1; |
|
|
1260 | }); |
|
|
1261 | $table->add (3, 18, new CFClient::UI::Button |
|
|
1262 | text => "set", |
|
|
1263 | on_activate => sub { |
|
|
1264 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
|
|
1265 | if defined $::CONN; |
|
|
1266 | 0 |
|
|
1267 | }); |
1240 | |
1268 | |
1241 | $table |
1269 | $table |
1242 | } |
1270 | } |
1243 | |
1271 | |
1244 | sub inventory_window { |
1272 | sub inventory_window { |
… | |
… | |
1246 | x => "center", |
1274 | x => "center", |
1247 | y => "center", |
1275 | y => "center", |
1248 | force_w => $WIDTH * 9/10, |
1276 | force_w => $WIDTH * 9/10, |
1249 | force_h => $HEIGHT * 9/10, |
1277 | force_h => $HEIGHT * 9/10, |
1250 | title => "Inventory", |
1278 | title => "Inventory", |
|
|
1279 | has_close_button => 1, |
1251 | ; |
1280 | ; |
1252 | |
1281 | |
1253 | $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); |
1282 | $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); |
1254 | |
1283 | |
1255 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
1284 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
… | |
… | |
1277 | |
1306 | |
1278 | my $refresh; |
1307 | my $refresh; |
1279 | $refresh = sub { |
1308 | $refresh = sub { |
1280 | $binding_list->clear (); |
1309 | $binding_list->clear (); |
1281 | |
1310 | |
1282 | for my $mod (keys %{$::CFG->{bindings}}) { |
1311 | for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) { |
1283 | for my $sym (keys %{$::CFG->{bindings}->{$mod}}) { |
1312 | for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { |
1284 | my $cmds = $::CFG->{bindings}->{$mod}->{$sym}; |
1313 | my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1285 | next unless ref $cmds eq 'ARRAY' and @$cmds > 0; |
1314 | next unless ref $cmds eq 'ARRAY' and @$cmds > 0; |
1286 | |
1315 | |
1287 | my $lbl = join "; ", @$cmds; |
1316 | my $lbl = join "; ", @$cmds; |
1288 | my $nam = CFClient::Binder::keycombo_to_name ($mod, $sym); |
1317 | my $nam = CFClient::Binder::keycombo_to_name ($mod, $sym); |
1289 | $binding_list->add (my $hb = new CFClient::UI::HBox); |
1318 | $binding_list->add (my $hb = new CFClient::UI::HBox); |
1290 | $hb->add (new CFClient::UI::Button |
1319 | $hb->add (new CFClient::UI::Button |
1291 | text => "delete", |
1320 | text => "delete", |
1292 | tooltip => "Deletes the binding", |
1321 | tooltip => "Deletes the binding", |
1293 | on_activate => sub { |
1322 | on_activate => sub { |
1294 | $binding_list->remove ($hb); |
1323 | $binding_list->remove ($hb); |
1295 | delete $::CFG->{bindings}->{$mod}->{$sym}; |
1324 | delete $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
|
|
1325 | 0 |
1296 | }); |
1326 | }); |
1297 | |
1327 | |
1298 | $hb->add (new CFClient::UI::Button |
1328 | $hb->add (new CFClient::UI::Button |
1299 | text => "edit", |
1329 | text => "edit", |
1300 | tooltip => "Edits the binding", |
1330 | tooltip => "Edits the binding", |
1301 | on_activate => sub { |
1331 | on_activate => sub { |
1302 | $::BIND_EDITOR->set_binding ( |
1332 | $::BIND_EDITOR->set_binding ( |
1303 | $mod, $sym, $::CFG->{bindings}->{$mod}->{$sym}, |
1333 | $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym}, |
1304 | sub { |
1334 | sub { |
1305 | my ($nmod, $nsym, $ncmds) = @_; |
1335 | my ($nmod, $nsym, $ncmds) = @_; |
1306 | delete $::CFG->{bindings}->{$mod}->{$sym}; |
1336 | delete $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1307 | $::CFG->{bindings}->{$nmod}->{$nsym} = $ncmds; |
1337 | $::CFG->{profile}{default}{bindings}{$nmod}{$nsym} = $ncmds; |
1308 | $refresh->(); |
1338 | $refresh->(); |
1309 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1339 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1310 | $SETUP_DIALOG->show; |
1340 | $SETUP_DIALOG->show; |
1311 | }, |
1341 | }, |
1312 | sub { |
1342 | sub { |
1313 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1343 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1314 | $SETUP_DIALOG->show; |
1344 | $SETUP_DIALOG->show; |
1315 | }); |
1345 | }); |
1316 | $::BIND_EDITOR->show; |
1346 | $::BIND_EDITOR->show; |
1317 | $SETUP_DIALOG->hide; |
1347 | $SETUP_DIALOG->hide; |
|
|
1348 | 0 |
1318 | }); |
1349 | }); |
1319 | |
1350 | |
1320 | $hb->add (new CFClient::UI::Label text => "(Key: $nam)"); |
1351 | $hb->add (new CFClient::UI::Label text => "(Key: $nam)"); |
1321 | $hb->add (new CFClient::UI::Label text => $lbl, expand => 1); |
1352 | $hb->add (new CFClient::UI::Label text => $lbl, expand => 1); |
1322 | } |
1353 | } |
1323 | } |
1354 | } |
1324 | }; |
1355 | }; |
1325 | |
1356 | |
1326 | 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 | |
1327 | $vb->add ($binding_list); |
1370 | $vb->add ($binding_list); |
1328 | $vb->add (my $hb = new CFClient::UI::HBox); |
1371 | $vb->add (my $hb = new CFClient::UI::HBox); |
1329 | |
1372 | |
1330 | $hb->add (new CFClient::UI::Button |
1373 | $hb->add (new CFClient::UI::Button |
1331 | text => "record new", |
1374 | text => "record new", |
… | |
… | |
1333 | tooltip => "This button opens the binding editor with an empty binding.", |
1376 | tooltip => "This button opens the binding editor with an empty binding.", |
1334 | on_activate => sub { |
1377 | on_activate => sub { |
1335 | $::BIND_EDITOR->set_binding (undef, undef, [], |
1378 | $::BIND_EDITOR->set_binding (undef, undef, [], |
1336 | sub { |
1379 | sub { |
1337 | my ($mod, $sym, $cmds) = @_; |
1380 | my ($mod, $sym, $cmds) = @_; |
1338 | $::CFG->{bindings}->{$mod}->{$sym} = $cmds; |
1381 | $::CFG->{profile}{default}{bindings}{$mod}{$sym} = $cmds; |
1339 | $refresh->(); |
1382 | $refresh->(); |
1340 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1383 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1341 | $SETUP_DIALOG->show; |
1384 | $SETUP_DIALOG->show; |
1342 | }, |
1385 | }, |
1343 | sub { |
1386 | sub { |
… | |
… | |
1345 | $SETUP_DIALOG->show; |
1388 | $SETUP_DIALOG->show; |
1346 | }, |
1389 | }, |
1347 | ); |
1390 | ); |
1348 | $SETUP_DIALOG->hide; |
1391 | $SETUP_DIALOG->hide; |
1349 | $::BIND_EDITOR->show; |
1392 | $::BIND_EDITOR->show; |
|
|
1393 | 0 |
1350 | }, |
1394 | }, |
1351 | ); |
1395 | ); |
1352 | |
1396 | |
1353 | $hb->add (new CFClient::UI::Button |
1397 | $hb->add (new CFClient::UI::Button |
1354 | text => "close", |
1398 | text => "close", |
1355 | tooltip => "Closes the binding window", |
1399 | tooltip => "Closes the binding window", |
1356 | expand => 1, |
1400 | expand => 1, |
1357 | on_activate => sub { |
1401 | on_activate => sub { |
1358 | $SETUP_DIALOG->hide; |
1402 | $SETUP_DIALOG->hide; |
|
|
1403 | 0 |
1359 | } |
1404 | } |
1360 | ); |
1405 | ); |
1361 | |
1406 | |
1362 | $refresh->(); |
1407 | $refresh->(); |
1363 | |
1408 | |
… | |
… | |
1401 | |
1446 | |
1402 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1447 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1403 | for @$pom; |
1448 | for @$pom; |
1404 | |
1449 | |
1405 | $viewer->set_offset (0); |
1450 | $viewer->set_offset (0); |
|
|
1451 | 0 |
1406 | }, |
1452 | }, |
1407 | on_visibility_change => sub { |
1453 | on_visibility_change => sub { |
1408 | my ($self, $visible) = @_; |
1454 | my ($self, $visible) = @_; |
1409 | return unless $visible; |
1455 | return unless $visible; |
1410 | return if $self->{value}; |
1456 | return if $self->{value}; |
1411 | $self->set_value ("intro"); |
1457 | $self->set_value ("intro"); |
|
|
1458 | 0 |
1412 | }, |
1459 | }, |
1413 | ); |
1460 | ); |
1414 | |
1461 | |
1415 | $win |
1462 | $win |
1416 | } |
1463 | } |
… | |
… | |
1485 | $MAPWIDGET->connect (activate_console => sub { |
1532 | $MAPWIDGET->connect (activate_console => sub { |
1486 | my ($mapwidget, $preset) = @_; |
1533 | my ($mapwidget, $preset) = @_; |
1487 | |
1534 | |
1488 | if ($CONSOLE) { |
1535 | if ($CONSOLE) { |
1489 | $CONSOLE->{input}->{auto_activated} = 1; |
1536 | $CONSOLE->{input}->{auto_activated} = 1; |
1490 | $CONSOLE->{input}->focus_in; |
1537 | $CONSOLE->{input}->grab_focus; |
1491 | |
1538 | |
1492 | if ($preset && $CONSOLE->{input}->get_text eq '') { |
1539 | if ($preset && $CONSOLE->{input}->get_text eq '') { |
1493 | $CONSOLE->{input}->set_text ($preset); |
1540 | $CONSOLE->{input}->set_text ($preset); |
1494 | } |
1541 | } |
1495 | } |
1542 | } |
1496 | }); |
1543 | }); |
1497 | $MAPWIDGET->show; |
1544 | $MAPWIDGET->show; |
1498 | $MAPWIDGET->focus_in; |
1545 | $MAPWIDGET->grab_focus; |
1499 | |
1546 | |
1500 | $LOGVIEW = new CFClient::UI::TextScroller |
1547 | $LOGVIEW = new CFClient::UI::TextScroller |
1501 | expand => 1, |
1548 | expand => 1, |
1502 | font => $FONT_FIXED, |
1549 | font => $FONT_FIXED, |
1503 | fontsize => $::CFG->{log_fontsize}, |
1550 | fontsize => $::CFG->{log_fontsize}, |
… | |
… | |
1513 | x => 'center', |
1560 | x => 'center', |
1514 | y => 'center', |
1561 | y => 'center', |
1515 | z => 2, |
1562 | z => 2, |
1516 | force_w => $::WIDTH * 0.6, |
1563 | force_w => $::WIDTH * 0.6, |
1517 | force_h => $::HEIGHT * 0.6, |
1564 | force_h => $::HEIGHT * 0.6, |
|
|
1565 | has_close_button => 1, |
1518 | ; |
1566 | ; |
1519 | |
1567 | |
1520 | $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, |
1521 | filter => new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1569 | filter => new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1522 | |
1570 | |
… | |
… | |
1527 | $SETUP_NOTEBOOK->add (Graphics => graphics_setup, |
1575 | $SETUP_NOTEBOOK->add (Graphics => graphics_setup, |
1528 | "Configure the video mode, performance, fonts and other graphical aspects of the game."); |
1576 | "Configure the video mode, performance, fonts and other graphical aspects of the game."); |
1529 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
1577 | $SETUP_NOTEBOOK->add (Audio => audio_setup, |
1530 | "Configure the use of audio, sound effects and background music."); |
1578 | "Configure the use of audio, sound effects and background music."); |
1531 | $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, |
1579 | $SETUP_NOTEBOOK->add (Keyboard => $SETUP_KEYBOARD = keyboard_setup, |
1532 | "Lets you define, edit and delete bindings." |
1580 | "Lets you define, edit and delete key bindings." |
1533 | . "There is a shortcut for making bindings: <b>Left Control + Insert</b> opens the binding editor " |
1581 | . "There is a shortcut for making bindings: <b>Control-Insert</b> opens the binding editor " |
1534 | . "with nothing set and the recording started. After doing the actions you " |
1582 | . "with nothing set and the recording started. After doing the actions you " |
1535 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1583 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1536 | . "After pressing the combo the binding will be saved automatically and the " |
1584 | . "After pressing the combo the binding will be saved automatically and the " |
1537 | . "binding editor closes"); |
1585 | . "binding editor closes"); |
1538 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1586 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1539 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
1587 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
1540 | $SETUP_NOTEBOOK->add (Debug => debug_setup, |
1588 | $SETUP_NOTEBOOK->add (Debug => debug_setup, |
1541 | "Some debuggign options. Do not ask."); |
1589 | "Some debuggin' options. Do not ask."); |
1542 | |
1590 | |
1543 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1591 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1544 | |
1592 | |
1545 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1593 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1546 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
1594 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
… | |
… | |
1561 | 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.", |
1562 | on_activate => sub { |
1610 | on_activate => sub { |
1563 | $::CFG->{layout} = CFClient::UI::get_layout; |
1611 | $::CFG->{layout} = CFClient::UI::get_layout; |
1564 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1612 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1565 | status "Configuration Saved"; |
1613 | status "Configuration Saved"; |
|
|
1614 | 0 |
1566 | }, |
1615 | }, |
1567 | ); |
1616 | ); |
1568 | |
1617 | |
1569 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => help_window, |
1618 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => help_window, |
1570 | tooltip => "View Documentation"); |
1619 | tooltip => "View Documentation"); |
… | |
… | |
1576 | if ($CONN) { |
1625 | if ($CONN) { |
1577 | open_quit_dialog; |
1626 | open_quit_dialog; |
1578 | } else { |
1627 | } else { |
1579 | exit; |
1628 | exit; |
1580 | } |
1629 | } |
|
|
1630 | 0 |
1581 | }, |
1631 | }, |
1582 | ); |
1632 | ); |
1583 | |
1633 | |
1584 | $BUTTONBAR->show; |
1634 | $BUTTONBAR->show; |
1585 | $SETUP_DIALOG->show; |
1635 | $SETUP_DIALOG->show; |
… | |
… | |
1587 | |
1637 | |
1588 | $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]); |
1589 | } |
1639 | } |
1590 | |
1640 | |
1591 | sub video_shutdown { |
1641 | sub video_shutdown { |
|
|
1642 | CFClient::OpenGL::shutdown; |
|
|
1643 | |
1592 | undef $SDL_ACTIVE; |
1644 | undef $SDL_ACTIVE; |
1593 | } |
1645 | } |
1594 | |
1646 | |
1595 | 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# |
1596 | my $bgmusic;#TODO#hack#d# |
1648 | my $bgmusic;#TODO#hack#d# |
… | |
… | |
1812 | |
1864 | |
1813 | CFClient::read_cfg "$Crossfire::VARDIR/cfplusrc"; |
1865 | CFClient::read_cfg "$Crossfire::VARDIR/cfplusrc"; |
1814 | CFClient::UI::set_layout ($::CFG->{layout}); |
1866 | CFClient::UI::set_layout ($::CFG->{layout}); |
1815 | |
1867 | |
1816 | my %DEF_CFG = ( |
1868 | my %DEF_CFG = ( |
1817 | sdl_mode => 0, |
1869 | sdl_mode => 0, |
1818 | width => 640, |
1870 | width => 640, |
1819 | height => 480, |
1871 | height => 480, |
1820 | fullscreen => 0, |
1872 | fullscreen => 0, |
1821 | fast => 0, |
1873 | fast => 0, |
1822 | map_scale => 1, |
1874 | map_scale => 1, |
1823 | fow_enable => 1, |
1875 | fow_enable => 1, |
1824 | fow_intensity => 0.45, |
1876 | fow_intensity => 0.45, |
1825 | fow_smooth => 0, |
1877 | fow_smooth => 0, |
1826 | gui_fontsize => 1, |
1878 | gui_fontsize => 1, |
1827 | log_fontsize => 0.7, |
1879 | log_fontsize => 0.7, |
1828 | gauge_fontsize=> 1, |
1880 | gauge_fontsize => 1, |
1829 | gauge_size => 0.35, |
1881 | gauge_size => 0.35, |
1830 | stat_fontsize => 0.7, |
1882 | stat_fontsize => 0.7, |
1831 | mapsize => 100, |
1883 | mapsize => 100, |
1832 | host => "crossfire.schmorp.de", |
|
|
1833 | say_command => 'say', |
1884 | say_command => 'say', |
1834 | audio_enable => 1, |
1885 | audio_enable => 1, |
1835 | bgm_enable => 1, |
1886 | bgm_enable => 1, |
1836 | bgm_volume => 0.25, |
1887 | bgm_volume => 0.25, |
1837 | face_prefetch => 0, |
1888 | face_prefetch => 0, |
1838 | output_sync => 1, |
1889 | output_sync => 1, |
1839 | output_count => 1, |
1890 | output_count => 1, |
1840 | pickup => 0, |
1891 | pickup => 0, |
|
|
1892 | default => "profile", # default profile |
|
|
1893 | ); |
1841 | ); |
1894 | |
1842 | |
|
|
1843 | while (my ($k, $v) = each %DEF_CFG) { |
1895 | while (my ($k, $v) = each %DEF_CFG) { |
1844 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
1896 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
1845 | } |
1897 | } |
|
|
1898 | |
|
|
1899 | $CFG->{profile}{default}{host} ||= "crossfire.schmorp.de"; |
1846 | |
1900 | |
1847 | sdl_init; |
1901 | sdl_init; |
1848 | |
1902 | |
1849 | @SDL_MODES = reverse |
1903 | @SDL_MODES = reverse |
1850 | grep $_->[0] >= 640 && $_->[1] >= 480, |
1904 | grep $_->[0] >= 640 && $_->[1] >= 480, |
… | |
… | |
1892 | video_init; |
1946 | video_init; |
1893 | audio_init; |
1947 | audio_init; |
1894 | } |
1948 | } |
1895 | |
1949 | |
1896 | Event::loop; |
1950 | Event::loop; |
|
|
1951 | #CFClient::SDL_Quit; |
|
|
1952 | #CFClient::_exit 0; |
1897 | |
1953 | |
1898 | END { CFClient::SDL_Quit } |
1954 | END { CFClient::SDL_Quit } |
1899 | |
1955 | |
1900 | =head1 NAME |
1956 | =head1 NAME |
1901 | |
1957 | |