… | |
… | |
466 | |
466 | |
467 | my $row = 0; |
467 | my $row = 0; |
468 | my $col = 0; |
468 | my $col = 0; |
469 | |
469 | |
470 | my %resist_names = ( |
470 | my %resist_names = ( |
471 | 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.)", |
471 | slow => "<b>Slow</b> (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.)", |
472 | holyw => "Holy Word (resistance you against getting the fear when someone whose god doesn't like you spells the holy word on you.)", |
472 | holyw => "<b>Holy Word</b> (resistance you against getting the fear when someone whose god doesn't like you spells the holy word on you.)", |
473 | conf => "Confusion (If you are hit by confusion you will move into random directions, and likely into monsters.)", |
473 | conf => "<b>Confusion</b> (If you are hit by confusion you will move into random directions, and likely into monsters.)", |
474 | fire => "Fire (just your resistance to fire spells like burning hands, dragonbreath, meteor swarm fire, ...)", |
474 | fire => "<b>Fire</b> (just your resistance to fire spells like burning hands, dragonbreath, meteor swarm fire, ...)", |
475 | depl => "Depletion (some monsters and other effects can cause stats depletion)", |
475 | depl => "<b>Depletion</b> (some monsters and other effects can cause stats depletion)", |
476 | magic => "Magic (resistance to magic spells like magic missile or similar)", |
476 | magic => "<b>Magic</b> (resistance to magic spells like magic missile or similar)", |
477 | drain => "Draining (some monsters (e.g. vampires) and other effects can steal experience)", |
477 | drain => "<b>Draining</b> (some monsters (e.g. vampires) and other effects can steal experience)", |
478 | acid => "Acid (resistance to acid, acid hurts pretty much and also corrodes your weapons)", |
478 | acid => "<b>Acid</b> (resistance to acid, acid hurts pretty much and also corrodes your weapons)", |
479 | pois => "Poison (resistance to getting poisoned)", |
479 | pois => "<b>Poison</b> (resistance to getting poisoned)", |
480 | para => "Paralysation (this resistance affects the chance you get paralysed)", |
480 | para => "<b>Paralysation</b> (this resistance affects the chance you get paralysed)", |
481 | deat => "Death (resistance against death spells)", |
481 | deat => "<b>Death</b> (resistance against death spells)", |
482 | phys => "Physical (this is the resistance against physical attacks, like when a monster hit you in melee combat)", |
482 | phys => "<b>Physical</b> (this is the resistance against physical attacks, like when a monster hit you in melee combat)", |
483 | blind => "Blind (blind resistance affects the chance of a successful blinding attack)", |
483 | blind => "<b>Blind</b> (blind resistance affects the chance of a successful blinding attack)", |
484 | 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)", |
484 | fear => "<b>Fear</b> (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)", |
485 | tund => "Turn undead", |
485 | tund => "<b>Turn undead</b> (affects your resistancy to various forms of 'turn undead' spells. Only relevant when you are, in fact, undead...", |
486 | elec => "Electricity (resistance againt electricity, spells like large lightning, small lightning, ...)", |
486 | elec => "<b>Electricity</b> (resistance against electricity, spells like large lightning, small lightning, ...)", |
487 | cold => "Cold (this is your resistance against cold spells like icestorm, snowstorm, ...)", |
487 | cold => "<b>Cold</b> (this is your resistance against cold spells like icestorm, snowstorm, ...)", |
488 | ghit => "Ghost hit (special attack used by ghosts and ghost-like beings)", |
488 | ghit => "<b>Ghost hit</b> (special attack used by ghosts and ghost-like beings)", |
489 | ); |
489 | ); |
490 | for (qw/slow holyw conf fire depl magic |
490 | for (qw/slow holyw conf fire depl magic |
491 | drain acid pois para deat phys |
491 | drain acid pois para deat phys |
492 | blind fear tund elec cold ghit/) |
492 | blind fear tund elec cold ghit/) |
493 | { |
493 | { |
… | |
… | |
1043 | |
1043 | |
1044 | glDepthMask 1; |
1044 | glDepthMask 1; |
1045 | glClear GL_DEPTH_BUFFER_BIT; |
1045 | glClear GL_DEPTH_BUFFER_BIT; |
1046 | glEnable GL_TEXTURE_2D; |
1046 | glEnable GL_TEXTURE_2D; |
1047 | glEnable GL_DEPTH_TEST; |
1047 | glEnable GL_DEPTH_TEST; |
1048 | glDisable GL_CULL_FACE; |
1048 | glEnable GL_CULL_FACE; |
1049 | glShadeModel $::FAST ? GL_FLAT : GL_SMOOTH; |
1049 | glShadeModel $::FAST ? GL_FLAT : GL_SMOOTH; |
1050 | |
1050 | |
1051 | glMatrixMode GL_PROJECTION; |
1051 | glMatrixMode GL_PROJECTION; |
1052 | glLoadIdentity; |
1052 | glLoadIdentity; |
1053 | #glFrustum -100, 100, 100, -100, 1, 1000; |
1053 | glFrustum -1 * ($::WIDTH / $::HEIGHT), 1 * ($::WIDTH / $::HEIGHT), 1, -1, 1, 10000; |
1054 | glOrtho 0, $::WIDTH, 0, $::HEIGHT, -10000, 10000; |
1054 | #glOrtho 0, $::WIDTH, 0, $::HEIGHT, -10000, 10000; |
1055 | glMatrixMode GL_MODELVIEW; |
1055 | glMatrixMode GL_MODELVIEW; |
1056 | glLoadIdentity; |
1056 | glLoadIdentity; |
1057 | |
1057 | |
1058 | glPushMatrix; |
1058 | glPushMatrix; |
1059 | glTranslate $::WIDTH * 0.5, $::HEIGHT * 0.5, -100; |
1059 | glTranslate 0, 0, -800; |
|
|
1060 | glScale 1, -1, 1; |
1060 | glRotate $NOW * 1000 % 36000 / 20, 0, 1, 0; |
1061 | glRotate $NOW * 1000 % 36000 / 5, 0, 1, 0; |
|
|
1062 | glRotate $NOW * 1000 % 36000 / 6, 1, 0, 0; |
|
|
1063 | glRotate $NOW * 1000 % 36000 / 7, 0, 0, 1; |
1061 | glScale 50, 50, 50; |
1064 | glScale 50, 50, 50; |
1062 | |
1065 | |
1063 | glInterleavedArrays GL_T2F_N3F_V3F, 0, $r->{v}; |
1066 | glInterleavedArrays GL_T2F_N3F_V3F, 0, $r->{v}; |
1064 | while (my ($k, $v) = each %{$r->{g}}) { |
1067 | while (my ($k, $v) = each %{$r->{g}}) { |
1065 | glBindTexture GL_TEXTURE_2D, ($demo{t}{$k}{name} or die); |
1068 | glBindTexture GL_TEXTURE_2D, ($demo{t}{$k}{name} or die); |
… | |
… | |
1210 | $self->set_texture ($id => $data); |
1213 | $self->set_texture ($id => $data); |
1211 | } |
1214 | } |
1212 | } |
1215 | } |
1213 | } |
1216 | } |
1214 | |
1217 | |
|
|
1218 | # hardcode /world/world_xxx_xxx map names, the savings are enourmous, |
|
|
1219 | # (server resource,s latency, bandwidth), so this hack is warranted. |
|
|
1220 | # the right fix is to make real tiled maps with an overview file |
|
|
1221 | sub conn::send_mapinfo { |
|
|
1222 | my ($self, $data, $cb) = @_; |
|
|
1223 | |
|
|
1224 | if ($self->{map_info}[0] =~ m%^/world/world_(\d\d\d)_(\d\d\d)$%) { |
|
|
1225 | my ($wx, $wy) = ($1, $2); |
|
|
1226 | |
|
|
1227 | if ($data =~ /^spatial ([1-4]+)$/) { |
|
|
1228 | my @dx = (0, 0, 1, 0, -1); |
|
|
1229 | my @dy = (0, -1, 0, 1, 0); |
|
|
1230 | my ($dx, $dy); |
|
|
1231 | |
|
|
1232 | for (split //, $1) { |
|
|
1233 | $dx += $dx[$_]; |
|
|
1234 | $dy += $dy[$_]; |
|
|
1235 | } |
|
|
1236 | |
|
|
1237 | $cb->(spatial => 15, |
|
|
1238 | $self->{map_info}[1] - $MAP->ox + $dx * 50, |
|
|
1239 | $self->{map_info}[2] - $MAP->oy + $dy * 50, |
|
|
1240 | 50, 50, |
|
|
1241 | sprintf "/world/world_%03d_%03d", $wx + $dx, $wy + $dy |
|
|
1242 | ); |
|
|
1243 | |
|
|
1244 | return; |
|
|
1245 | } |
|
|
1246 | } |
|
|
1247 | |
|
|
1248 | $self->SUPER::send_mapinfo ($data, $cb); |
|
|
1249 | } |
|
|
1250 | |
1215 | # this method does a "flood fill" into every tile direction |
1251 | # this method does a "flood fill" into every tile direction |
1216 | # it assumes that tiles are arranged in a rectangular grid, |
1252 | # it assumes that tiles are arranged in a rectangular grid, |
1217 | # i.e. a map is the same as the left of the right map etc. |
1253 | # i.e. a map is the same as the left of the right map etc. |
1218 | # failure to comply are harmless and result in display errors |
1254 | # failure to comply are harmless and result in display errors |
1219 | # at worst. |
1255 | # at worst. |
1220 | sub conn::flood_fill { |
1256 | sub conn::flood_fill { |
1221 | my ($self, $gx, $gy, $path, $hash, $flags) = @_; |
1257 | my ($self, $block, $gx, $gy, $path, $hash, $flags) = @_; |
1222 | |
1258 | |
1223 | # the server does not allow map paths > 6 |
1259 | # the server does not allow map paths > 6 |
1224 | return if 7 <= length $path; |
1260 | return if 7 <= length $path; |
1225 | |
1261 | |
1226 | my ($x0, $y0, $x1, $y1) = @{$self->{neigh_rect}}; |
1262 | my ($x0, $y0, $x1, $y1) = @{$self->{neigh_rect}}; |
1227 | |
1263 | |
1228 | for ( |
1264 | for ( |
1229 | [1, 0, -1], |
1265 | [1, 3, 0, -1], |
1230 | [2, 1, 0], |
1266 | [2, 4, 1, 0], |
1231 | [3, 0, 1], |
1267 | [3, 1, 0, 1], |
1232 | [4, -1, 0], |
1268 | [4, 2, -1, 0], |
1233 | ) { |
1269 | ) { |
1234 | my ($tile, $dx, $dy) = @$_; |
1270 | my ($tile, $tile2, $dx, $dy) = @$_; |
|
|
1271 | |
|
|
1272 | next if $block & (1 << $tile); |
|
|
1273 | my $block = $block | (1 << $tile2); |
1235 | |
1274 | |
1236 | my $gx = $gx + $dx; |
1275 | my $gx = $gx + $dx; |
1237 | my $gy = $gy + $dy; |
1276 | my $gy = $gy + $dy; |
1238 | |
1277 | |
1239 | next unless $flags & (1 << ($tile - 1)); |
1278 | next unless $flags & (1 << ($tile - 1)); |
… | |
… | |
1241 | |
1280 | |
1242 | my $neigh = $self->{neigh_map}{$hash} ||= []; |
1281 | my $neigh = $self->{neigh_map}{$hash} ||= []; |
1243 | if (my $info = $neigh->[$tile]) { |
1282 | if (my $info = $neigh->[$tile]) { |
1244 | my ($flags, $x, $y, $w, $h, $hash) = @$info; |
1283 | my ($flags, $x, $y, $w, $h, $hash) = @$info; |
1245 | |
1284 | |
1246 | $self->flood_fill ($gx, $gy, "$path$tile", $hash, $flags) |
1285 | $self->flood_fill ($block, $gx, $gy, "$path$tile", $hash, $flags) |
1247 | if $x >= $x0 && $x + $w < $x1 && $y >= $y0 && $y + $h < $y1; |
1286 | if $x >= $x0 && $x + $w < $x1 && $y >= $y0 && $y + $h < $y1; |
1248 | |
1287 | |
1249 | } else { |
1288 | } else { |
1250 | $self->send_mapinfo ("spatial $path$tile", sub { |
1289 | $self->send_mapinfo ("spatial $path$tile", sub { |
1251 | my ($mode, $flags, $x, $y, $w, $h, $hash) = @_; |
1290 | my ($mode, $flags, $x, $y, $w, $h, $hash) = @_; |
1252 | |
1291 | |
1253 | return if $mode ne "spatial"; |
1292 | return if $mode ne "spatial"; |
1254 | |
1293 | |
1255 | $x += $MAP->ox; |
1294 | $x += $MAP->ox; |
1256 | $y += $MAP->oy; |
1295 | $y += $MAP->oy; |
1257 | |
1296 | |
1258 | $self->load_map ($hash, $x, $y) |
1297 | $self->load_map ($hash, $x, $y) |
1259 | unless $self->{neigh_map}{$hash}[5]++;#d# |
1298 | unless $self->{neigh_map}{$hash}[5]++;#d# |
1260 | |
1299 | |
1261 | $neigh->[$tile] = [$flags, $x, $y, $w, $h, $hash]; |
1300 | $neigh->[$tile] = [$flags, $x, $y, $w, $h, $hash]; |
1262 | |
1301 | |
1263 | $self->flood_fill ($gx, $gy, "$path$tile", $hash, $flags) |
1302 | $self->flood_fill ($block, $gx, $gy, "$path$tile", $hash, $flags) |
1264 | if $x >= $x0 && $x + $w < $x1 && $y >= $y0 && $y + $h < $y1; |
1303 | if $x >= $x0 && $x + $w < $x1 && $y >= $y0 && $y + $h < $y1; |
1265 | }); |
1304 | }); |
1266 | } |
1305 | } |
1267 | } |
1306 | } |
1268 | } |
1307 | } |
… | |
… | |
1281 | $ox - $mapmapw * 0.5, $oy - $mapmapw * 0.5, |
1320 | $ox - $mapmapw * 0.5, $oy - $mapmapw * 0.5, |
1282 | $ox + $mapmapw * 0.5 + $w, $oy + $mapmapw * 0.5 + $h, |
1321 | $ox + $mapmapw * 0.5 + $w, $oy + $mapmapw * 0.5 + $h, |
1283 | ]; |
1322 | ]; |
1284 | |
1323 | |
1285 | delete $self->{neigh_grid}; |
1324 | delete $self->{neigh_grid}; |
1286 | $self->flood_fill (0, 0, "", $hash, $flags); |
|
|
1287 | |
1325 | |
1288 | $x += $ox; |
1326 | $x += $ox; |
1289 | $y += $oy; |
1327 | $y += $oy; |
1290 | |
1328 | |
1291 | $self->{map_info} = [$hash, $x, $y, $w, $h]; |
1329 | $self->{map_info} = [$hash, $x, $y, $w, $h]; |
1292 | |
1330 | |
1293 | my $map = $self->{map_info}[0]; |
|
|
1294 | $map =~ s/^.*?\/([^\/]+)$/\1/; |
1331 | (my $map = $hash) =~ s/^.*?\/([^\/]+)$/\1/; |
1295 | $STATWIDS->{map}->set_text ("Map: " . $map); |
1332 | $STATWIDS->{map}->set_text ("Map: " . $map); |
1296 | |
1333 | |
1297 | $self->load_map ($hash, $x, $y); |
1334 | $self->load_map ($hash, $x, $y); |
|
|
1335 | $self->flood_fill (0, 0, 0, "", $hash, $flags); |
1298 | } |
1336 | } |
1299 | |
1337 | |
1300 | sub conn::face_find { |
1338 | sub conn::face_find { |
1301 | my ($self, $facenum, $face) = @_; |
1339 | my ($self, $facenum, $face) = @_; |
1302 | |
1340 | |
… | |
… | |
1494 | my ($self) = @_; |
1532 | my ($self) = @_; |
1495 | |
1533 | |
1496 | $self->send ("command output-sync $CFG->{output_sync}"); |
1534 | $self->send ("command output-sync $CFG->{output_sync}"); |
1497 | $self->send ("command output-count $CFG->{output_count}"); |
1535 | $self->send ("command output-count $CFG->{output_count}"); |
1498 | |
1536 | |
|
|
1537 | my $parser = new Pod::POM; |
|
|
1538 | my $pod = $parser->parse_file (CFClient::find_rcfile "pod/skill_help.pod"); |
|
|
1539 | |
|
|
1540 | my %skill_tooltip; |
|
|
1541 | |
|
|
1542 | for my $head2 ($pod->head2) { |
|
|
1543 | $skill_tooltip{$head2->title} = CFClient::pod_to_pango $head2->content; |
|
|
1544 | } |
|
|
1545 | |
1499 | for my $skill (values %{$self->{skill_info}}) { |
1546 | for my $skill (values %{$self->{skill_info}}) { |
1500 | $MAPWIDGET->add_command ("ready_skill $skill", CFClient::UI::Label::escape "Ready the skill '$skill'"); |
1547 | $MAPWIDGET->add_command ("ready_skill $skill", |
1501 | $MAPWIDGET->add_command ("use_skill $skill", CFClient::UI::Label::escape "Immediately use the skill '$skill'"); |
1548 | (CFClient::UI::Label::escape "Ready the skill '$skill'\n\n") |
|
|
1549 | . $skill_tooltip{$skill}); |
|
|
1550 | $MAPWIDGET->add_command ("use_skill $skill", |
|
|
1551 | (CFClient::UI::Label::escape "Immediately use the skill '$skill'\n\n") |
|
|
1552 | . $skill_tooltip{$skill}); |
1502 | } |
1553 | } |
1503 | } |
1554 | } |
1504 | |
1555 | |
1505 | sub conn::eof { |
1556 | sub conn::eof { |
1506 | $MAPWIDGET->clr_commands; |
1557 | $MAPWIDGET->clr_commands; |