ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/MapWidget.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/MapWidget.pm (file contents):
Revision 1.163 by root, Thu Oct 14 00:02:39 2010 UTC vs.
Revision 1.164 by root, Sat Aug 13 23:18:19 2011 UTC

1package DC::MapWidget; 1package DC::MapWidget;
2 2
3use common::sense; 3use common::sense;
4 4
5use List::Util qw(min max); 5use List::Util qw(min max);
6
7use AnyEvent ();
6 8
7use DC; 9use DC;
8use DC::OpenGL; 10use DC::OpenGL;
9use DC::UI; 11use DC::UI;
10use DC::Macro; 12use DC::Macro;
431sub movement_update { 433sub movement_update {
432 my ($self) = @_; 434 my ($self) = @_;
433 435
434 if ($::CFG->{smooth_movement}) { 436 if ($::CFG->{smooth_movement}) {
435 if ($self->{sdx} || $self->{sdy}) { 437 if ($self->{sdx} || $self->{sdy}) {
436 my $diff = EV::time - ($self->{last_update} || $::LAST_REFRESH); 438 my $diff = AE::time - ($self->{last_update} || $::LAST_REFRESH);
437 my $spd = $::CONN->{stat}{DC::Protocol::CS_STAT_SPEED}; 439 my $spd = $::CONN->{stat}{DC::Protocol::CS_STAT_SPEED};
438 440
439 # the minimum time for a single tile movement 441 # the minimum time for a single tile movement
440 my $mintime = DC::Protocol::TICK * DC::ceil 1 / ($spd * DC::Protocol::TICK || 1); 442 my $mintime = DC::Protocol::TICK * DC::ceil 1 / ($spd * DC::Protocol::TICK || 1);
441 443
462 } 464 }
463 } else { 465 } else {
464 $self->{sdx} = $self->{sdy} = 0; 466 $self->{sdx} = $self->{sdy} = 0;
465 } 467 }
466 468
467 $self->{last_update} = EV::time; 469 $self->{last_update} = AE::time;
468} 470}
469 471
470sub refresh_hook { 472sub refresh_hook {
471 my ($self) = @_; 473 my ($self) = @_;
472 474
620} 622}
621 623
622sub refresh_hook { 624sub refresh_hook {
623 my ($self) = @_; 625 my ($self) = @_;
624 626
625 if ($::MAP && $self->{texture_atime} < EV::now) { 627 if ($::MAP && $self->{texture_atime} < AE::now) {
626 my ($w, $h) = @$self{qw(w h)}; 628 my ($w, $h) = @$self{qw(w h)};
627 629
628 return unless $w && $h; 630 return unless $w && $h;
629 631
630 my $sw = int $::WIDTH / ($::MAPWIDGET->{tilesize} * $::CFG->{map_scale}) + 0.99; 632 my $sw = int $::WIDTH / ($::MAPWIDGET->{tilesize} * $::CFG->{map_scale}) + 0.99;
645 $self->{sh} = $sh; 647 $self->{sh} = $sh;
646 648
647 $self->{x0} = $x0; 649 $self->{x0} = $x0;
648 $self->{y0} = $y0; 650 $self->{y0} = $y0;
649 651
650 $self->{texture_atime} = EV::now + 1/2; 652 $self->{texture_atime} = AE::now + 1/2;
651 653
652 $self->{texture} = 654 $self->{texture} =
653 new DC::Texture 655 new DC::Texture
654 w => $w, 656 w => $w,
655 h => $h, 657 h => $h,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines