ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/gde/GCE/Util.pm
(Generate patch)

Comparing deliantra/gde/GCE/Util.pm (file contents):
Revision 1.5 by elmex, Thu Mar 16 11:59:34 2006 UTC vs.
Revision 1.7 by elmex, Fri Mar 17 01:18:01 2006 UTC

16use List::Util qw(min max); 16use List::Util qw(min max);
17 17
18use Crossfire; 18use Crossfire;
19use Crossfire::MapWidget; 19use Crossfire::MapWidget;
20 20
21our @EXPORT = qw(insert_arch_stack_layer replace_arch_stack_layer new_arch_pb fill_pb_from_arch arch_is_floor stack_find_floor stack_find_wall stack_find arch_is_wall arch_is_monster add_table_widget quick_msg def); 21our @EXPORT = qw(insert_arch_stack_layer replace_arch_stack_layer new_arch_pb fill_pb_from_arch arch_is_floor stack_find_floor stack_find_wall stack_find arch_is_wall arch_is_monster add_table_widget quick_msg def arch_is_exit);
22 22
23sub def($$) { 23sub def($$) {
24 return defined ($_[0]) ? $_[0] : $_[1]; 24 return defined ($_[0]) ? $_[0] : $_[1];
25} 25}
26 26
52 my $pb = new Gtk2::Gdk::Pixbuf 'rgb', 1, 8, TILESIZE, TILESIZE; 52 my $pb = new Gtk2::Gdk::Pixbuf 'rgb', 1, 8, TILESIZE, TILESIZE;
53 return $pb; 53 return $pb;
54} 54}
55 55
56sub fill_pb_from_arch { 56sub fill_pb_from_arch {
57 my ($pb, $arch) = @_; 57 my ($pb, $a) = @_;
58
59 my $o = $Crossfire::ARCH{$a->{_name}};
60 my $face = $Crossfire::FACE{$a->{face} || $o->{face} || "blank.111"}
61 or warn "no gfx found for arch '$a->{_name}' at ($x|$y)\n";
62
63 $face or return;
58 64
59 $pb->fill (0x00000000); 65 $pb->fill (0x00000000);
60 $TILE->composite ($pb, 66 $TILE->composite ($pb,
61 0, 0, 67 0, 0,
62 TILESIZE, TILESIZE, 68 TILESIZE, TILESIZE,
63 - ($arch->{_face} % 64) * TILESIZE, - TILESIZE * int $arch->{_face} / 64, 69 - ($face->{idx} % 64) * TILESIZE, - TILESIZE * int $face->{idx} / 64,
64 1, 1, 'nearest', 255 70 1, 1, 'nearest', 255
65 ); 71 );
66} 72}
67 73
68sub classify_arch_layer { 74sub classify_arch_layer {
78 84
79 } else { # $arch->{is_floor} and all other arches are 'between' monsters and floor 85 } else { # $arch->{is_floor} and all other arches are 'between' monsters and floor
80 86
81 return 'between'; 87 return 'between';
82 } 88 }
89}
90
91sub arch_is_exit {
92 my ($a) = @_;
93 my $type = $Crossfire::ARCH{$a->{_name}}->{type};
94 return $type eq '66' || $type eq '41';
83} 95}
84 96
85sub arch_is_floor { 97sub arch_is_floor {
86 my ($a) = @_; 98 my ($a) = @_;
87 return $Crossfire::ARCH{$a->{_name}}->{is_floor}; 99 return $Crossfire::ARCH{$a->{_name}}->{is_floor};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines