… | |
… | |
65 | } |
65 | } |
66 | |
66 | |
67 | sub start_game { |
67 | sub start_game { |
68 | status "logging in..."; |
68 | status "logging in..."; |
69 | |
69 | |
70 | my $mapsize = List::Util::min 64, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; |
70 | my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; |
71 | |
71 | |
72 | $MAP = new CFClient::Map $mapsize, $mapsize; |
72 | $MAP = new CFClient::Map $mapsize, $mapsize; |
73 | |
73 | |
74 | $CONN = new conn |
74 | $CONN = new conn |
75 | host => $CFG->{host}, |
75 | host => $CFG->{host}, |
… | |
… | |
137 | $table->add (1, 5, new CFClient::UI::CheckBox state => $CFG->{fow_smooth}, connect_changed => sub { |
137 | $table->add (1, 5, new CFClient::UI::CheckBox state => $CFG->{fow_smooth}, connect_changed => sub { |
138 | my ($self, $value) = @_; |
138 | my ($self, $value) = @_; |
139 | $CFG->{fow_smooth} = $value; |
139 | $CFG->{fow_smooth} = $value; |
140 | }); |
140 | }); |
141 | |
141 | |
|
|
142 | $table->add (0, 5, new CFClient::UI::Label align => 1, text => "Log Fontsize"); |
|
|
143 | $table->add (1, 5, new CFClient::UI::Slider range => [$CFG->{log_fontsize}, 8, 30, 1], connect_changed => sub { |
|
|
144 | my ($self, $value) = @_; |
|
|
145 | $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = int $value); |
|
|
146 | }); |
|
|
147 | |
142 | $table->add (1, 6, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { |
148 | $table->add (1, 6, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { |
143 | destroy_screen (); |
149 | destroy_screen (); |
144 | init_screen (); |
150 | init_screen (); |
145 | }); |
151 | }); |
146 | |
152 | |
… | |
… | |
203 | |
209 | |
204 | sub console_window { |
210 | sub console_window { |
205 | my $window = new CFClient::UI::FancyFrame |
211 | my $window = new CFClient::UI::FancyFrame |
206 | border_bg => [1, 1, 1, 0.5], |
212 | border_bg => [1, 1, 1, 0.5], |
207 | bg => [0.3, 0.3, 0.3, 0.8], |
213 | bg => [0.3, 0.3, 0.3, 0.8], |
|
|
214 | user_w => $::WIDTH/4, |
|
|
215 | user_h => $::HEIGHT, |
208 | child => (my $vbox = new CFClient::UI::VBox); |
216 | child => (my $vbox = new CFClient::UI::VBox); |
209 | |
217 | |
210 | $vbox->add ($LOGVIEW = new CFClient::UI::TextView expand => 1); |
218 | $vbox->add ($LOGVIEW = new CFClient::UI::TextView |
|
|
219 | expand => 1, |
|
|
220 | fontsize => $::CFG->{log_fontsize}, |
|
|
221 | ); |
|
|
222 | |
211 | $vbox->add (my $input = new CFClient::UI::LineEntry); |
223 | $vbox->add (my $input = new CFClient::UI::LineEntry); |
212 | $input->connect (activate => sub { |
224 | $input->connect (activate => sub { |
213 | my ($input, $text) = @_; |
225 | my ($input, $text) = @_; |
214 | $input->set_text (''); |
226 | $input->set_text (''); |
215 | |
227 | |
… | |
… | |
296 | $CFClient::UI::TOPLEVEL->add ($ALT_ENTER_MESSAGE); |
308 | $CFClient::UI::TOPLEVEL->add ($ALT_ENTER_MESSAGE); |
297 | |
309 | |
298 | $CFClient::UI::TOPLEVEL->add ($MAPWIDGET = new CFClient::UI::MapWidget); |
310 | $CFClient::UI::TOPLEVEL->add ($MAPWIDGET = new CFClient::UI::MapWidget); |
299 | $MAPWIDGET->focus_in; |
311 | $MAPWIDGET->focus_in; |
300 | $MAPWIDGET->connect (activate_console => sub { |
312 | $MAPWIDGET->connect (activate_console => sub { |
|
|
313 | my ($mapwidget, $preset) = @_; |
|
|
314 | |
301 | if ($CONSOLE) { |
315 | if ($CONSOLE) { |
302 | $CONSOLE->{input}->focus_in; |
316 | $CONSOLE->{input}->focus_in; |
|
|
317 | |
|
|
318 | if ($preset && $CONSOLE->{input}->get_text eq '') { |
|
|
319 | $CONSOLE->{input}->set_text ($preset); |
|
|
320 | } |
303 | } |
321 | } |
304 | }); |
322 | }); |
305 | |
323 | |
306 | $CFClient::UI::TOPLEVEL->add ($BUTTONBAR = new CFClient::UI::HBox); |
324 | $CFClient::UI::TOPLEVEL->add ($BUTTONBAR = new CFClient::UI::HBox); |
307 | |
325 | |
… | |
… | |
328 | $fps = $fps * 0.95 + 1 / ($NOW - $LAST_REFRESH) * 0.05; |
346 | $fps = $fps * 0.95 + 1 / ($NOW - $LAST_REFRESH) * 0.05; |
329 | debug sprintf "%3.2f", $fps; |
347 | debug sprintf "%3.2f", $fps; |
330 | |
348 | |
331 | $want_refresh = 0; |
349 | $want_refresh = 0; |
332 | $can_refresh = 0; |
350 | $can_refresh = 0; |
333 | |
|
|
334 | glViewport 0, 0, $WIDTH, $HEIGHT; |
|
|
335 | |
|
|
336 | glMatrixMode GL_PROJECTION; |
|
|
337 | glLoadIdentity; |
|
|
338 | glOrtho 0, $WIDTH, $HEIGHT, 0, -10000 , 10000; |
|
|
339 | glMatrixMode GL_MODELVIEW; |
|
|
340 | glLoadIdentity; |
|
|
341 | |
|
|
342 | glClearColor +($CFG->{fow_intensity}) x 3, 1; |
|
|
343 | glClear GL_COLOR_BUFFER_BIT; |
|
|
344 | |
351 | |
345 | $CFClient::UI::TOPLEVEL->draw; |
352 | $CFClient::UI::TOPLEVEL->draw; |
346 | |
353 | |
347 | SDL::GLSwapBuffers; |
354 | SDL::GLSwapBuffers; |
348 | |
355 | |
… | |
… | |
425 | |
432 | |
426 | $FACECACHE->{"$face->{chksum},$face->{name}"} = $face->{image}; |
433 | $FACECACHE->{"$face->{chksum},$face->{name}"} = $face->{image}; |
427 | |
434 | |
428 | my $tex = $face->{texture} = new_from_image CFClient::Texture delete $face->{image}; |
435 | my $tex = $face->{texture} = new_from_image CFClient::Texture delete $face->{image}; |
429 | |
436 | |
430 | $MAP->set_texture ($facenum, @$tex{qw(name w h s t)}); |
437 | $MAP->set_texture ($facenum, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
431 | $MAPWIDGET->update; |
438 | $MAPWIDGET->update; |
432 | } |
439 | } |
433 | |
440 | |
434 | sub conn::query { |
441 | sub conn::query { |
435 | my ($self, $flags, $prompt) = @_; |
442 | my ($self, $flags, $prompt) = @_; |
… | |
… | |
499 | ############################################################################# |
506 | ############################################################################# |
500 | |
507 | |
501 | CFClient::read_cfg "$Crossfire::VARDIR/pclientrc"; |
508 | CFClient::read_cfg "$Crossfire::VARDIR/pclientrc"; |
502 | |
509 | |
503 | my %DEF_CFG = ( |
510 | my %DEF_CFG = ( |
|
|
511 | sdl_mode => 0, |
504 | width => 640, |
512 | width => 640, |
505 | height => 480, |
513 | height => 480, |
|
|
514 | fullscreen => 0, |
506 | fast => 0, |
515 | fast => 0, |
507 | fow_enable => 1, |
516 | fow_enable => 1, |
508 | fow_intensity => 0.45, |
517 | fow_intensity => 0.45, |
509 | fow_smooth => 0, |
518 | fow_smooth => 0, |
510 | fullscreen => 0, |
519 | log_fontsize => 14, |
511 | sdl_mode => 0, |
|
|
512 | mapsize => 100, |
520 | mapsize => 100, |
513 | host => "crossfire.schmorp.de", |
521 | host => "crossfire.schmorp.de", |
514 | port => 13327, |
522 | port => 13327, |
515 | say_command => 'say', |
523 | say_command => 'say', |
516 | ); |
524 | ); |