--- deliantra/Deliantra-Client/bin/pclient 2006/05/19 16:43:57 1.229 +++ deliantra/Deliantra-Client/bin/pclient 2006/05/22 02:23:10 1.235 @@ -468,24 +468,24 @@ my $col = 0; my %resist_names = ( - slow => "Slow (slows you down when you are hit by the spell. Monsters will have an opportunity to come near you faster and hit you more often.)", - holyw => "Holy Word (resistance you against getting the fear when someone whose god doesn't like you spells the holy word on you.)", - conf => "Confusion (If you are hit by confusion you will move into random directions, and likely into monsters.)", - fire => "Fire (just your resistance to fire spells like burning hands, dragonbreath, meteor swarm fire, ...)", - depl => "Depletion (some monsters and other effects can cause stats depletion)", - magic => "Magic (resistance to magic spells like magic missile or similar)", - drain => "Draining (some monsters (e.g. vampires) and other effects can steal experience)", - acid => "Acid (resistance to acid, acid hurts pretty much and also corrodes your weapons)", - pois => "Poison (resistance to getting poisoned)", - para => "Paralysation (this resistance affects the chance you get paralysed)", - deat => "Death (resistance against death spells)", - phys => "Physical (this is the resistance against physical attacks, like when a monster hit you in melee combat)", - blind => "Blind (blind resistance affects the chance of a successful blinding attack)", - fear => "Fear (this attack will drive you away from monsters who cast this and hit you successfully, being resistant to this helps a lot when fighting those monsters)", - tund => "Turn undead", - elec => "Electricity (resistance againt electricity, spells like large lightning, small lightning, ...)", - cold => "Cold (this is your resistance against cold spells like icestorm, snowstorm, ...)", - ghit => "Ghost hit (special attack used by ghosts and ghost-like beings)", + slow => "Slow (slows you down when you are hit by the spell. Monsters will have an opportunity to come near you faster and hit you more often.)", + holyw => "Holy Word (resistance you against getting the fear when someone whose god doesn't like you spells the holy word on you.)", + conf => "Confusion (If you are hit by confusion you will move into random directions, and likely into monsters.)", + fire => "Fire (just your resistance to fire spells like burning hands, dragonbreath, meteor swarm fire, ...)", + depl => "Depletion (some monsters and other effects can cause stats depletion)", + magic => "Magic (resistance to magic spells like magic missile or similar)", + drain => "Draining (some monsters (e.g. vampires) and other effects can steal experience)", + acid => "Acid (resistance to acid, acid hurts pretty much and also corrodes your weapons)", + pois => "Poison (resistance to getting poisoned)", + para => "Paralysation (this resistance affects the chance you get paralysed)", + deat => "Death (resistance against death spells)", + phys => "Physical (this is the resistance against physical attacks, like when a monster hit you in melee combat)", + blind => "Blind (blind resistance affects the chance of a successful blinding attack)", + fear => "Fear (this attack will drive you away from monsters who cast this and hit you successfully, being resistant to this helps a lot when fighting those monsters)", + tund => "Turn undead (affects your resistancy to various forms of 'turn undead' spells. Only relevant when you are, in fact, undead...", + elec => "Electricity (resistance against electricity, spells like large lightning, small lightning, ...)", + cold => "Cold (this is your resistance against cold spells like icestorm, snowstorm, ...)", + ghit => "Ghost hit (special attack used by ghosts and ghost-like beings)", ); for (qw/slow holyw conf fire depl magic drain acid pois para deat phys @@ -833,7 +833,7 @@ my $invwin = new CFClient::UI::FancyFrame user_w => $WIDTH * (4/5), user_h => $HEIGHT * (4/5), title => "Inventory"; - $invwin->add (my $hb = new CFClient::UI::HBox); + $invwin->add (my $hb = new CFClient::UI::HBox expand => 1); $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1); $vb1->add (my $lbl = new CFClient::UI::Label); @@ -863,7 +863,7 @@ $FAST = $CFG->{fast}; CFClient::SDL_SetVideoMode $WIDTH, $HEIGHT, $FULLSCREEN - or die "SDL_SetVideoMode failed!\n"; + or die "SDL_SetVideoMode failed: " . (CFClient::SDL_GetError) . "\n"; $SDL_ACTIVE = 1; $LAST_REFRESH = time - 0.01; @@ -1013,16 +1013,73 @@ my $fps = 9; +my %demo;#d# + sub force_refresh { $fps = $fps * 0.95 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.05; debug sprintf "%3.2f", $fps; $CFClient::UI::ROOT->draw; - CFClient::SDL_GL_SwapBuffers; $WANT_REFRESH = 0; $CAN_REFRESH = 0; $LAST_REFRESH = $NOW; + +0 && do { + # some weird model-drawing code, just a joke right now + use CFClient::OpenGL; + + $demo{t}{eye_auv} ||= new_from_file CFClient::Texture "eye2.png" or die; + $demo{t}{body_auv} ||= new_from_file CFClient::Texture "body_auv3.png" or die; + $demo{r} ||= do { + my $mod = Compress::LZF::sthaw do { local $/; open my $fh, "<:raw:perlio", "dread.lz3"; <$fh> }; + $mod->{v} = pack "f*", @{$mod->{v}}; + $_ = [scalar @$_, pack "S!*", @$_] + for values %{$mod->{g}}; + $mod + }; + + my $r = $demo{r} or die; + + glDepthMask 1; + glClear GL_DEPTH_BUFFER_BIT; + glEnable GL_TEXTURE_2D; + glEnable GL_DEPTH_TEST; + glEnable GL_CULL_FACE; + glShadeModel $::FAST ? GL_FLAT : GL_SMOOTH; + + glMatrixMode GL_PROJECTION; + glLoadIdentity; + glFrustum -1 * ($::WIDTH / $::HEIGHT), 1 * ($::WIDTH / $::HEIGHT), 1, -1, 1, 10000; + #glOrtho 0, $::WIDTH, 0, $::HEIGHT, -10000, 10000; + glMatrixMode GL_MODELVIEW; + glLoadIdentity; + + glPushMatrix; + glTranslate 0, 0, -800; + glScale 1, -1, 1; + glRotate $NOW * 1000 % 36000 / 5, 0, 1, 0; + glRotate $NOW * 1000 % 36000 / 6, 1, 0, 0; + glRotate $NOW * 1000 % 36000 / 7, 0, 0, 1; + glScale 50, 50, 50; + + glInterleavedArrays GL_T2F_N3F_V3F, 0, $r->{v}; + while (my ($k, $v) = each %{$r->{g}}) { + glBindTexture GL_TEXTURE_2D, ($demo{t}{$k}{name} or die); + glDrawElements GL_TRIANGLES, $v->[0], GL_UNSIGNED_SHORT, $v->[1]; + } + + glPopMatrix; + + glShadeModel GL_FLAT; + glDisable GL_DEPTH_TEST; + glDisable GL_TEXTURE_2D; + glDepthMask 0; + + $WANT_REFRESH++; +}; + + CFClient::SDL_GL_SwapBuffers; } my $refresh_watcher = Event->timer (after => 0, hard => 1, interval => 1 / $MAX_FPS, cb => sub { @@ -1158,13 +1215,46 @@ } } +# hardcode /world/world_xxx_xxx map names, the savings are enourmous, +# (server resource,s latency, bandwidth), so this hack is warranted. +# the right fix is to make real tiled maps with an overview file +sub conn::send_mapinfo { + my ($self, $data, $cb) = @_; + + if ($self->{map_info}[0] =~ m%^/world/world_(\d\d\d)_(\d\d\d)$%) { + my ($wx, $wy) = ($1, $2); + + if ($data =~ /^spatial ([1-4]+)$/) { + my @dx = (0, 0, 1, 0, -1); + my @dy = (0, -1, 0, 1, 0); + my ($dx, $dy); + + for (split //, $1) { + $dx += $dx[$_]; + $dy += $dy[$_]; + } + + $cb->(spatial => 15, + $self->{map_info}[1] - $MAP->ox + $dx * 50, + $self->{map_info}[2] - $MAP->oy + $dy * 50, + 50, 50, + sprintf "/world/world_%03d_%03d", $wx + $dx, $wy + $dy + ); + + return; + } + } + + $self->SUPER::send_mapinfo ($data, $cb); +} + # this method does a "flood fill" into every tile direction # it assumes that tiles are arranged in a rectangular grid, # i.e. a map is the same as the left of the right map etc. # failure to comply are harmless and result in display errors # at worst. sub conn::flood_fill { - my ($self, $gx, $gy, $path, $hash, $flags) = @_; + my ($self, $block, $gx, $gy, $path, $hash, $flags) = @_; # the server does not allow map paths > 6 return if 7 <= length $path; @@ -1172,12 +1262,15 @@ my ($x0, $y0, $x1, $y1) = @{$self->{neigh_rect}}; for ( - [1, 0, -1], - [2, 1, 0], - [3, 0, 1], - [4, -1, 0], + [1, 3, 0, -1], + [2, 4, 1, 0], + [3, 1, 0, 1], + [4, 2, -1, 0], ) { - my ($tile, $dx, $dy) = @$_; + my ($tile, $tile2, $dx, $dy) = @$_; + + next if $block & (1 << $tile); + my $block = $block | (1 << $tile2); my $gx = $gx + $dx; my $gy = $gy + $dy; @@ -1189,7 +1282,7 @@ if (my $info = $neigh->[$tile]) { my ($flags, $x, $y, $w, $h, $hash) = @$info; - $self->flood_fill ($gx, $gy, "$path$tile", $hash, $flags) + $self->flood_fill ($block, $gx, $gy, "$path$tile", $hash, $flags) if $x >= $x0 && $x + $w < $x1 && $y >= $y0 && $y + $h < $y1; } else { @@ -1200,13 +1293,13 @@ $x += $MAP->ox; $y += $MAP->oy; - + $self->load_map ($hash, $x, $y) unless $self->{neigh_map}{$hash}[5]++;#d# $neigh->[$tile] = [$flags, $x, $y, $w, $h, $hash]; - $self->flood_fill ($gx, $gy, "$path$tile", $hash, $flags) + $self->flood_fill ($block, $gx, $gy, "$path$tile", $hash, $flags) if $x >= $x0 && $x + $w < $x1 && $y >= $y0 && $y + $h < $y1; }); } @@ -1229,18 +1322,17 @@ ]; delete $self->{neigh_grid}; - $self->flood_fill (0, 0, "", $hash, $flags); $x += $ox; $y += $oy; $self->{map_info} = [$hash, $x, $y, $w, $h]; - my $map = $self->{map_info}[0]; - $map =~ s/^.*?\/([^\/]+)$/\1/; + (my $map = $hash) =~ s/^.*?\/([^\/]+)$/\1/; $STATWIDS->{map}->set_text ("Map: " . $map); $self->load_map ($hash, $x, $y); + $self->flood_fill (0, 0, 0, "", $hash, $flags); } sub conn::face_find { @@ -1442,9 +1534,22 @@ $self->send ("command output-sync $CFG->{output_sync}"); $self->send ("command output-count $CFG->{output_count}"); + my $parser = new Pod::POM; + my $pod = $parser->parse_file (CFClient::find_rcfile "pod/skill_help.pod"); + + my %skill_tooltip; + + for my $head2 ($pod->head2) { + $skill_tooltip{$head2->title} = CFClient::pod_to_pango $head2->content; + } + for my $skill (values %{$self->{skill_info}}) { - $MAPWIDGET->add_command ("ready_skill $skill", CFClient::UI::Label::escape "Ready the skill '$skill'"); - $MAPWIDGET->add_command ("use_skill $skill", CFClient::UI::Label::escape "Immediately use the skill '$skill'"); + $MAPWIDGET->add_command ("ready_skill $skill", + (CFClient::UI::Label::escape "Ready the skill '$skill'\n\n") + . $skill_tooltip{$skill}); + $MAPWIDGET->add_command ("use_skill $skill", + (CFClient::UI::Label::escape "Immediately use the skill '$skill'\n\n") + . $skill_tooltip{$skill}); } } @@ -1619,7 +1724,7 @@ height => 480, fullscreen => 0, fast => 0, - map_scale => 0.5, + map_scale => 1, fow_enable => 1, fow_intensity => 0.45, fow_smooth => 0,