--- deliantra/Deliantra-Client/DC/Protocol.pm 2008/09/09 10:27:26 1.202
+++ deliantra/Deliantra-Client/DC/Protocol.pm 2009/11/15 19:05:13 1.210
@@ -3,6 +3,8 @@
use utf8;
use strict;
+use Guard ();
+
use Deliantra::Protocol::Constants;
use DC;
@@ -20,6 +22,11 @@
our $TEX_NOFACE = new_from_resource DC::Texture
"noface.png", minify => 1, mipmap => 1;
+our $TEX_HIDDEN = new_from_resource DC::Texture
+ "hidden.png", minify => 1, mipmap => 1;
+
+sub MIN_TEXTURE_UNUSED() { 1 }#d#
+
sub new {
my ($class, %arg) = @_;
@@ -75,6 +82,7 @@
delete $self->{items};
$::INV->clear;
+ $::INVR->clear;
$::INVR_HB->clear;
$::FLOORBOX->clear;
});
@@ -92,6 +100,26 @@
$self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}});
}
+ {
+ $self->{hidden} = my $tex = $TEX_HIDDEN;
+ $self->{map}->set_texture (3, @$tex{qw(name w h s t)}, @{$tex->{minified}});
+ }
+
+# $self->{expire_count} = DC::DB::FIRST_TILE_ID; # minimum non-fixed tile id
+# $self->{expire_w} = EV::timer 1, 1, sub {
+# my $count = (int @{ $self->{texture} } / MIN_TEXTURE_UNUSED) || 1;
+#
+# for ($self->{map}->expire_textures ($self->{expire_count}, $count)) {
+# warn DC::SvREFCNT $self->{texture}[$_];
+# $self->{texture}[$_]->unload;
+# warn "expire texture $_\n";#d#
+# }
+#
+# ($self->{expire_count} += $count) < @{ $self->{texture} }
+# or $self->{expire_count} = DC::DB::FIRST_TILE_ID;
+# warn "count is $count\n";#d#
+# };
+
$self->{open_container} = 0;
# per server
@@ -261,6 +289,9 @@
tooltip => $DC::UI::TOOLTIP,
mapwidget => $::MAPWIDGET,
+ menubar => $::MENUBAR,
+ menupopup => $::MENUPOPUP,
+ pickup_enable => $::PICKUP_ENABLE,
buttonbar => $::BUTTONBAR,
metaserver => $::METASERVER,
buttonbar => $::BUTTONBAR,
@@ -287,7 +318,7 @@
help_window => $::HELP_WINDOW,
message_window => $::MESSAGE_WINDOW,
message_dist => $::MESSAGE_DIST,
- statusbox => $::SDTATUSBOX,
+ statusbox => $::STATUSBOX,
inv => $::INV,
invr => $::INVR,
@@ -494,9 +525,9 @@
$::GAUGES->{mana} ->set_value ($sp, $sp_m);
$::GAUGES->{food} ->set_value ($fo, $fo_m);
$::GAUGES->{grace} ->set_value ($gr, $gr_m);
- $::GAUGES->{exp} ->set_text ("Exp: " . (::formsep ($stats->{+CS_STAT_EXP64}))
- . " (lvl " . ($stats->{+CS_STAT_LEVEL} * 1) . ")");
- $::GAUGES->{prg} ->set_value ($stats->{+CS_STAT_LEVEL}, $stats->{+CS_STAT_EXP64});
+ $::GAUGES->{exp} ->set_label ("Exp: " . (::formsep ($stats->{+CS_STAT_EXP64}))#d#
+ . " (lvl " . ($stats->{+CS_STAT_LEVEL} * 1) . ")");
+ $::GAUGES->{exp} ->set_value ($stats->{+CS_STAT_LEVEL}, $stats->{+CS_STAT_EXP64});
$::GAUGES->{range} ->set_text ($stats->{+CS_STAT_RANGE});
my $title = $stats->{+CS_STAT_TITLE};
$title =~ s/^Player: //;
@@ -547,7 +578,7 @@
my @add = @$sw;
- my $TOOLTIP_ALL = "\n\nLeft click - ready skill\nMiddle click - use spell\nRight click - further options";
+ my $TOOLTIP_ALL = "\n\nLeft click - ready skill\nMiddle click - use skill\nRight click - further options";
my @TOOLTIP_LVL = (tooltip => "Level. The level of the skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
my @TOOLTIP_EXP = (tooltip => "Experience. The experience points you have in this skill.$TOOLTIP_ALL", can_events => 1, can_hover => 1);
@@ -619,8 +650,8 @@
$sw->[1]->set_text ($val->[0] * 1);
$sw->[2]->set_value (@$val);
- $::GAUGES->{sklprg}->set_label ("$name %d%%");
- $::GAUGES->{sklprg}->set_value (@$val);
+ $::GAUGES->{skillexp}->set_label ("$name %d%%");
+ $::GAUGES->{skillexp}->set_value (@$val);
}
}
@@ -657,12 +688,12 @@
$delay = 1;
- if (my $tex = $::CONN->{texture}[$tile]) {
+ if (my $tex = $self->{texture}[$tile]) {
$tex->upload;
} else {
$self->{delay}{$tile} = 1;
- # we assume the face is in-flight and will eventually come
+ # we assume the face is in-flight and will eventually arrive
push @{$self->{tile_cb}{$tile}}, sub {
delete $self->{delay}{$tile};
$_[0]->upload;
@@ -671,7 +702,7 @@
}
if ($delay) {
- # delay the map drawing a tiny bit in the hope of getting the missing fetched
+ # delay the map drawing a tiny bit in the hope of getting the missing tiles fetched
EV::once undef, 0, 0.03, sub {
$self->{map_widget}->update
if $self->{map_widget};
@@ -969,7 +1000,7 @@
new DC::Texture
tile => $tile,
image => $data, delete_image => 1,
- minify => 1, mipmap => 1;
+ minify => 1;
if (my $cbs = delete $self->{tile_cb}{$tile}) {
$_->($tex) for @$cbs;
@@ -984,7 +1015,7 @@
push @{$self->{face_cb}{$num}}, $cb;
defined wantarray
- ? DC::guard {
+ ? Guard::guard {
@{$self->{face_cb}{$num}}
= grep $_ != $cb,
@{$self->{face_cb}{$num}};
@@ -1367,7 +1398,7 @@
$self->update_server_info;
$self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0;
- $self->send_command ("pickup $::CFG->{pickup}");
+ $self->send_pickup ($::CFG->{pickup});
$self->send_exti_msg (clientlog => sprintf "OpenGL Info: %s [%s]",
DC::OpenGL::gl_vendor, DC::OpenGL::gl_version);#d#
@@ -1544,7 +1575,12 @@
sub send {
my ($self, $msg) = @_;
- $self->{textview}->add_paragraph ({ markup => "\n" . DC::asxml $msg });
+ $self->{textview}->add_paragraph ({
+ markup =>
+ "\n"
+ . (DC::asxml $msg)
+ . ""
+ });
$self->{textview}->scroll_to_bottom;
$self->{conn}->send_ext_msg (npc_dialog_tell => $self->{id}, $msg);