--- deliantra/Deliantra-Client/bin/cfplus 2007/08/09 03:40:44 1.206 +++ deliantra/Deliantra-Client/bin/cfplus 2007/08/12 01:49:09 1.210 @@ -115,7 +115,6 @@ our $FAST; # fast, low-quality mode, possibly useful for software-rendering our $WANT_REFRESH; -our $CAN_REFRESH; our @SDL_MODES; our $WIDTH; @@ -228,13 +227,7 @@ my $channel = CFPlus::Channel::find; $channel->volume ($vol * $CFG->{effects_volume} * 128 / 255); - $dx = $dx / 10 * 255; - $channel->set_panning (255 - $dx, 255 + $dx); - -# my $angle = $dx ? : $dx < 0 ? -# my $distance = -$vol; -# $channel->set_position ($angle, $distance); - + $channel->set_position_r ($dx, $dy, 20); $chunk->play ($channel); } } else { @@ -778,6 +771,18 @@ on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } ); + $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Force OpenGL 1.1"); + $table->add_at (1, $row++, new CFPlus::UI::CheckBox + state => $CFG->{opengl11}, + tooltip => "Limit CFPlus to use OpenGL 1.1 features only. This will normally result in " + . "higher memory usage and slower performance. It will, however, help tremendously on " + . "cards that claim to support a feature but fall back to software rendering. " + . "Nvidia Geforce FX cards are known to claim features the hardware doesn't support, " + . "but cards and drivers from other vendors (ATI) are often just as bad. If you " + . "experience extremely low framerates and your card should do better, try this option.", + on_changed => sub { my ($self, $value) = @_; $CFG->{opengl11} = $value; 0 } + ); + $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); $table->add_at (1, $row++, new CFPlus::UI::CheckBox state => $CFG->{fast}, @@ -813,8 +818,8 @@ $table->add_at (1, $row++, new CFPlus::UI::CheckBox state => $CFG->{map_smoothing}, tooltip => "Map Smoothing tries to make tile borders less square. " - . "This increases load on the graphics subsystem and works only with 2.x servers. " - . "Changes take effect at next connection only.", + . "This increases load on the graphics subsystem and works only with TRT servers. " + . "Changes take effect at next login only.", on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 } ); @@ -835,7 +840,8 @@ $table->add_at (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Message Fontsize"); $table->add_at (1, $row++, new CFPlus::UI::Slider range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], - tooltip => "The font size used by the message/server log window only. Changes are instant.", + tooltip => "The font size used by the message/server log window only. Changes are instant, " + . "but you still need to press apply to correctly re-layout the widget.", on_changed => sub { $MESSAGE_WINDOW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, ); @@ -2100,19 +2106,20 @@ my $fps = 9; sub force_refresh { - $fps = $fps * 0.95 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.05; - debug sprintf "%3.2f", $fps if $ENV{CFPLUS_DEBUG} & 4; + if ($ENV{CFPLUS_DEBUG} & 4) { + $fps = $fps * 0.98 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.02; + debug sprintf "%3.2f", $fps; + } $CFPlus::UI::ROOT->draw; - - $WANT_REFRESH = 0; - $CAN_REFRESH = 0; - $LAST_REFRESH = $NOW; - CFPlus::SDL_GL_SwapBuffers; + $LAST_REFRESH = $NOW; + $WANT_REFRESH->stop; } -my $refresh_watcher = Event->timer (after => 0, hard => 0, interval => 1 / $MAX_FPS, cb => sub { +$WANT_REFRESH = Event->idle (min => 0.001, max => 0.06, parked => 1, cb => \&force_refresh); + +my $input = Event->timer (after => 0, hard => 0, interval => 1 / 50, cb => sub { $NOW = time; ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) @@ -2120,13 +2127,7 @@ if (%animate_object) { $_->animate ($LAST_REFRESH - $NOW) for values %animate_object; - ++$WANT_REFRESH; - } - - if ($WANT_REFRESH) { - force_refresh; - } else { - $CAN_REFRESH = 1; + $WANT_REFRESH->start; } });