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

Comparing deliantra/Deliantra/Deliantra.pm (file contents):
Revision 1.57 by root, Thu Mar 23 08:55:54 2006 UTC vs.
Revision 1.60 by root, Mon Mar 27 17:23:35 2006 UTC

36our %FIELD_MULTILINE = ( 36our %FIELD_MULTILINE = (
37 msg => "endmsg", 37 msg => "endmsg",
38 lore => "endlore", 38 lore => "endlore",
39 maplore => "endmaplore", 39 maplore => "endmaplore",
40); 40);
41
42# movement bit type, PITA
43our %FIELD_MOVEMENT = map +($_ => undef),
44 qw(move_type move_block move_allow move_on move_off move_slow);
41 45
42# same as in server save routine, to (hopefully) be compatible 46# same as in server save routine, to (hopefully) be compatible
43# to the other editors. 47# to the other editors.
44our @FIELD_ORDER_MAP = (qw( 48our @FIELD_ORDER_MAP = (qw(
45 name swap_time reset_timeout fixed_resettime difficulty region 49 name swap_time reset_timeout fixed_resettime difficulty region
55 59
56 name name_pl custom_name title race 60 name name_pl custom_name title race
57 slaying skill msg lore other_arch face 61 slaying skill msg lore other_arch face
58 #todo-events 62 #todo-events
59 animation is_animated 63 animation is_animated
60 Str Dex Con Wis Pow Cha Int 64 str dex con wis pow cha int
61 hp maxhp sp maxsp grace maxgrace 65 hp maxhp sp maxsp grace maxgrace
62 exp perm_exp expmul 66 exp perm_exp expmul
63 food dam luck wc ac x y speed speed_left move_state attack_movement 67 food dam luck wc ac x y speed speed_left move_state attack_movement
64 nrof level direction type subtype 68 nrof level direction type subtype attacktype
65 69
66 resist_physical resist_magic resist_fire resist_electricity 70 resist_physical resist_magic resist_fire resist_electricity
67 resist_cold resist_confusion resist_acid resist_drain 71 resist_cold resist_confusion resist_acid resist_drain
68 resist_weaponmagic resist_ghosthit resist_poison resist_slow 72 resist_weaponmagic resist_ghosthit resist_poison resist_slow
69 resist_paralyze resist_turn_undead resist_fear resist_cancellation 73 resist_paralyze resist_turn_undead resist_fear resist_cancellation
104sub MOVE_FLY_LOW (){ 0x02 } 108sub MOVE_FLY_LOW (){ 0x02 }
105sub MOVE_FLY_HIGH (){ 0x04 } 109sub MOVE_FLY_HIGH (){ 0x04 }
106sub MOVE_FLYING (){ 0x06 } 110sub MOVE_FLYING (){ 0x06 }
107sub MOVE_SWIM (){ 0x08 } 111sub MOVE_SWIM (){ 0x08 }
108sub MOVE_BOAT (){ 0x10 } 112sub MOVE_BOAT (){ 0x10 }
113sub MOVE_KNOWN (){ 0x1f } # all of above
109sub MOVE_ALL (){ 0xff } 114sub MOVE_ALLBIT (){ 0x10000 }
115sub MOVE_ALL (){ 0x1001f } # very special value, more PITA
110 116
111sub load_ref($) { 117sub load_ref($) {
112 my ($path) = @_; 118 my ($path) = @_;
113 119
114 open my $fh, "<", $path 120 open my $fh, "<", $path
137 delete $ob->{$_} for qw( 143 delete $ob->{$_} for qw(
138 can_knockback can_parry can_impale can_cut can_dam_armour 144 can_knockback can_parry can_impale can_cut can_dam_armour
139 can_apply pass_thru can_pass_thru 145 can_apply pass_thru can_pass_thru
140 ); 146 );
141 147
142 for my $attr (qw(move_type move_block move_allow move_on move_off move_slow)) { 148 for my $attr (keys %FIELD_MOVEMENT) {
143 next unless exists $ob->{$attr}; 149 next unless exists $ob->{$attr};
150
151 $ob->{$attr} = MOVE_ALL if $ob->{$attr} == 255; #d# compatibility
152
144 next if $ob->{$attr} =~ /^\d+$/; 153 next if $ob->{$attr} =~ /^\d+$/;
145 154
146 my $flags = 0; 155 my $flags = 0;
147 156
148 # assume list 157 # assume list
619 cache_file "$LIB/crossfire.0", "$VARDIR/tilecache.pst", sub { 628 cache_file "$LIB/crossfire.0", "$VARDIR/tilecache.pst", sub {
620 $TILE = new_from_file Gtk2::Gdk::Pixbuf "$VARDIR/tilecache.png" 629 $TILE = new_from_file Gtk2::Gdk::Pixbuf "$VARDIR/tilecache.png"
621 or die "$VARDIR/tilecache.png: $!"; 630 or die "$VARDIR/tilecache.png: $!";
622 *FACE = $_[0]; 631 *FACE = $_[0];
623 }, sub { 632 }, sub {
624 require File::Temp;
625
626 my $tile = read_pak "$LIB/crossfire.0"; 633 my $tile = read_pak "$LIB/crossfire.0";
627 634
628 my %cache; 635 my %cache;
629 636
630 my $idx = 0; 637 my $idx = 0;
631 638
632 for my $name (sort keys %$tile) { 639 for my $name (sort keys %$tile) {
633 my ($fh, $filename) = File::Temp::tempfile (); 640 my $pb = new Gtk2::Gdk::PixbufLoader;
634 print $fh $tile->{$name}; 641 $pb->write ($tile->{$name});
635 close $fh; 642 $pb->close;
636 my $pb = new_from_file Gtk2::Gdk::Pixbuf $filename; 643 my $pb = $pb->get_pixbuf;
637 unlink $filename;
638 644
639 my $tile = $cache{$name} = { 645 my $tile = $cache{$name} = {
640 pb => $pb, 646 pb => $pb,
641 idx => $idx, 647 idx => $idx,
642 w => int $pb->get_width / TILESIZE, 648 w => int $pb->get_width / TILESIZE,
660 $pb, ($idx % 64) * TILESIZE, TILESIZE * int $idx / 64); 666 $pb, ($idx % 64) * TILESIZE, TILESIZE * int $idx / 64);
661 } 667 }
662 } 668 }
663 } 669 }
664 670
665 $pb->save ("$VARDIR/tilecache.png", "png"); 671 $pb->save ("$VARDIR/tilecache.png", "png", compression => 1);
666 672
667 \%cache 673 \%cache
668 }; 674 };
669} 675}
670 676

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines