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

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.20 by elmex, Sat Apr 8 17:21:01 2006 UTC vs.
Revision 1.21 by root, Sat Apr 8 18:15:59 2006 UTC

421 421
422sub key_up { 422sub key_up {
423} 423}
424 424
425sub _draw { 425sub _draw {
426 my ($self) = @_;
427
426 glEnable GL_TEXTURE_2D; 428 glEnable GL_TEXTURE_2D;
427 glEnable GL_BLEND; 429 glEnable GL_BLEND;
428 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; 430 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE;
429 431
430 my $map = $::CONN->{map}; 432 my $map = $::CONN->{map};
431 433
432 for my $x (0 .. $::CONN->{mapw} - 1) { 434 for my $x (0 .. int $::WIDTH / 32) {
433 for my $y (0 .. $::CONN->{maph} - 1) { 435 for my $y (0 .. int $::HEIGHT / 32) {
434 436
435 my $cell = $map->[$x][$y] 437 my $cell = $map->[$x + $::CONN->{mapx}]
438 [$y + $::CONN->{mapy}]
436 or next; 439 or next;
437 440
438 my $darkness = $cell->[3] * (1 / 255); 441 my $darkness = $cell->[0] * (1 / 255);
442 if ($darkness < 0) {
443 $darkness = 0.5;
444 }
439 glColor $darkness, $darkness, $darkness; 445 glColor $darkness, $darkness, $darkness;
440 446
441 for my $num (grep $_, $cell->[0], $cell->[1], $cell->[2]) { 447 for my $num (grep $_, @$cell[1,2,3]) {
442 my $tex = $::CONN->{face}[$num]{texture} || next; 448 my $tex = $::CONN->{face}[$num]{texture} || next;
443 449
444 glBindTexture GL_TEXTURE_2D, $tex->{name}; 450 glBindTexture GL_TEXTURE_2D, $tex->{name};
445 451
446 my $w = $tex->{width}; 452 my $w = $tex->{width};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines