--- deliantra/Deliantra-Client/bin/cfplus 2007/08/09 03:40:44 1.206 +++ deliantra/Deliantra-Client/bin/cfplus 2007/08/11 14:41:38 1.209 @@ -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 { @@ -813,7 +806,7 @@ $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. " + . "This increases load on the graphics subsystem and works only with TRT servers. " . "Changes take effect at next connection only.", on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 } ); @@ -2100,19 +2093,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 +2114,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; } });