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.83 by root, Wed Feb 7 00:14:48 2007 UTC vs.
Revision 1.89 by root, Tue Feb 27 23:29:59 2007 UTC

58 qw(move_type move_block move_allow move_on move_off move_slow); 58 qw(move_type move_block move_allow move_on move_off move_slow);
59 59
60# same as in server save routine, to (hopefully) be compatible 60# same as in server save routine, to (hopefully) be compatible
61# to the other editors. 61# to the other editors.
62our @FIELD_ORDER_MAP = (qw( 62our @FIELD_ORDER_MAP = (qw(
63 file_format_version
63 name attach swap_time reset_timeout fixed_resettime difficulty region 64 name attach swap_time reset_timeout fixed_resettime difficulty region
64 shopitems shopgreed shopmin shopmax shoprace 65 shopitems shopgreed shopmin shopmax shoprace
65 darkness width height enter_x enter_y msg maplore 66 darkness width height enter_x enter_y msg maplore
66 unique template 67 unique template
67 outdoor temp pressure humid windspeed winddir sky nosmooth 68 outdoor temp pressure humid windspeed winddir sky nosmooth
225 ice => 68, 226 ice => 68,
226 stone => 70, 227 stone => 70,
227 stone => 80, 228 stone => 80,
228 cloth => 136, 229 cloth => 136,
229 ironwood => 144, 230 ironwood => 144,
231 adamantium => 258,
232 glacium => 260,
230 blood => 544, 233 blood => 544,
231; 234;
232 235
233# object as in "Object xxx", i.e. archetypes 236# object as in "Object xxx", i.e. archetypes
234sub normalize_object($) { 237sub normalize_object($) {
302 if (defined (my $v = delete $ob->{slow_move})) { 305 if (defined (my $v = delete $ob->{slow_move})) {
303 $ob->{move_slow} |= MOVE_WALK; 306 $ob->{move_slow} |= MOVE_WALK;
304 $ob->{move_slow_penalty} = $v; 307 $ob->{move_slow_penalty} = $v;
305 } 308 }
306 if (defined (my $v = delete $ob->{walk_on})) { 309 if (defined (my $v = delete $ob->{walk_on})) {
307 $ob->{move_on} = MOVE_ALL unless exists $ob->{move_on}; 310 $ob->{move_on} = 0 unless exists $ob->{move_on};
308 $ob->{move_on} = $v ? $ob->{move_on} | MOVE_WALK 311 $ob->{move_on} = $v ? $ob->{move_on} | MOVE_WALK
309 : $ob->{move_on} & ~MOVE_WALK; 312 : $ob->{move_on} & ~MOVE_WALK;
310 } 313 }
311 if (defined (my $v = delete $ob->{walk_off})) { 314 if (defined (my $v = delete $ob->{walk_off})) {
312 $ob->{move_off} = MOVE_ALL unless exists $ob->{move_off}; 315 $ob->{move_off} = 0 unless exists $ob->{move_off};
313 $ob->{move_off} = $v ? $ob->{move_off} | MOVE_WALK 316 $ob->{move_off} = $v ? $ob->{move_off} | MOVE_WALK
314 : $ob->{move_off} & ~MOVE_WALK; 317 : $ob->{move_off} & ~MOVE_WALK;
315 } 318 }
316 if (defined (my $v = delete $ob->{fly_on})) { 319 if (defined (my $v = delete $ob->{fly_on})) {
317 $ob->{move_on} = MOVE_ALL unless exists $ob->{move_on}; 320 $ob->{move_on} = 0 unless exists $ob->{move_on};
318 $ob->{move_on} = $v ? $ob->{move_on} | MOVE_FLY_LOW 321 $ob->{move_on} = $v ? $ob->{move_on} | MOVE_FLY_LOW
319 : $ob->{move_on} & ~MOVE_FLY_LOW; 322 : $ob->{move_on} & ~MOVE_FLY_LOW;
320 } 323 }
321 if (defined (my $v = delete $ob->{fly_off})) { 324 if (defined (my $v = delete $ob->{fly_off})) {
322 $ob->{move_off} = MOVE_ALL unless exists $ob->{move_off}; 325 $ob->{move_off} = 0 unless exists $ob->{move_off};
323 $ob->{move_off} = $v ? $ob->{move_off} | MOVE_FLY_LOW 326 $ob->{move_off} = $v ? $ob->{move_off} | MOVE_FLY_LOW
324 : $ob->{move_off} & ~MOVE_FLY_LOW; 327 : $ob->{move_off} & ~MOVE_FLY_LOW;
325 } 328 }
326 if (defined (my $v = delete $ob->{flying})) { 329 if (defined (my $v = delete $ob->{flying})) {
327 $ob->{move_type} = MOVE_ALL unless exists $ob->{move_type}; 330 $ob->{move_type} = 0 unless exists $ob->{move_type};
328 $ob->{move_type} = $v ? $ob->{move_type} | MOVE_FLY_LOW 331 $ob->{move_type} = $v ? $ob->{move_type} | MOVE_FLY_LOW
329 : $ob->{move_type} & ~MOVE_FLY_LOW; 332 : $ob->{move_type} & ~MOVE_FLY_LOW;
330 } 333 }
331 334
332 # convert idiotic event_xxx things into objects 335 # convert idiotic event_xxx things into objects
565 568
566 my $inv = delete $a{inventory}; 569 my $inv = delete $a{inventory};
567 my $more = delete $a{more}; # arches do not support 'more', but old maps can contain some 570 my $more = delete $a{more}; # arches do not support 'more', but old maps can contain some
568 my $anim = delete $a{anim}; 571 my $anim = delete $a{anim};
569 572
573 if ($a{_atype} eq 'object') {
574 $str .= join "\n", "anim", @$anim, "mina\n"
575 if $anim;
576 }
577
570 my @kv; 578 my @kv;
571 579
572 for ($a{_name} eq "map" 580 for ($a{_name} eq "map"
573 ? @Crossfire::FIELD_ORDER_MAP 581 ? @Crossfire::FIELD_ORDER_MAP
574 : @Crossfire::FIELD_ORDER) { 582 : @Crossfire::FIELD_ORDER) {
618 } 626 }
619 } 627 }
620 628
621 if ($inv) { 629 if ($inv) {
622 $append->($_) for @$inv; 630 $append->($_) for @$inv;
623 }
624
625 if ($a{_atype} eq 'object') {
626 $str .= join "\n", "anim", @$anim, "mina\n"
627 if $anim;
628 } 631 }
629 632
630 $str .= "end\n"; 633 $str .= "end\n";
631 634
632 if ($a{_atype} eq 'object') { 635 if ($a{_atype} eq 'object') {
793 ]; 796 ];
794 797
795 $attr 798 $attr
796} 799}
797 800
798sub arch_edit_sections {
799# if (edit_type == IGUIConstants.TILE_EDIT_NONE)
800# edit_type = 0;
801# else if (edit_type != 0) {
802# // all flags from 'check_type' must be unset in this arch because they get recalculated now
803# edit_type &= ~check_type;
804# }
805#
806# }
807# if ((check_type & IGUIConstants.TILE_EDIT_MONSTER) != 0 &&
808# getAttributeValue("alive", defarch) == 1 &&
809# (getAttributeValue("monster", defarch) == 1 ||
810# getAttributeValue("generator", defarch) == 1)) {
811# // Monster: monsters/npcs/generators
812# edit_type |= IGUIConstants.TILE_EDIT_MONSTER;
813# }
814# if ((check_type & IGUIConstants.TILE_EDIT_WALL) != 0 &&
815# arch_type == 0 && getAttributeValue("no_pass", defarch) == 1) {
816# // Walls
817# edit_type |= IGUIConstants.TILE_EDIT_WALL;
818# }
819# if ((check_type & IGUIConstants.TILE_EDIT_CONNECTED) != 0 &&
820# getAttributeValue("connected", defarch) != 0) {
821# // Connected Objects
822# edit_type |= IGUIConstants.TILE_EDIT_CONNECTED;
823# }
824# if ((check_type & IGUIConstants.TILE_EDIT_EXIT) != 0 &&
825# arch_type == 66 || arch_type == 41 || arch_type == 95) {
826# // Exit: teleporter/exit/trapdoors
827# edit_type |= IGUIConstants.TILE_EDIT_EXIT;
828# }
829# if ((check_type & IGUIConstants.TILE_EDIT_TREASURE) != 0 &&
830# getAttributeValue("no_pick", defarch) == 0 && (arch_type == 4 ||
831# arch_type == 5 || arch_type == 36 || arch_type == 60 ||
832# arch_type == 85 || arch_type == 111 || arch_type == 123 ||
833# arch_type == 124 || arch_type == 130)) {
834# // Treasure: randomtreasure/money/gems/potions/spellbooks/scrolls
835# edit_type |= IGUIConstants.TILE_EDIT_TREASURE;
836# }
837# if ((check_type & IGUIConstants.TILE_EDIT_DOOR) != 0 &&
838# arch_type == 20 || arch_type == 23 || arch_type == 26 ||
839# arch_type == 91 || arch_type == 21 || arch_type == 24) {
840# // Door: door/special door/gates + keys
841# edit_type |= IGUIConstants.TILE_EDIT_DOOR;
842# }
843# if ((check_type & IGUIConstants.TILE_EDIT_EQUIP) != 0 &&
844# getAttributeValue("no_pick", defarch) == 0 && ((arch_type >= 13 &&
845# arch_type <= 16) || arch_type == 33 || arch_type == 34 ||
846# arch_type == 35 || arch_type == 39 || arch_type == 70 ||
847# arch_type == 87 || arch_type == 99 || arch_type == 100 ||
848# arch_type == 104 || arch_type == 109 || arch_type == 113 ||
849# arch_type == 122 || arch_type == 3)) {
850# // Equipment: weapons/armour/wands/rods
851# edit_type |= IGUIConstants.TILE_EDIT_EQUIP;
852# }
853#
854# return(edit_type);
855#
856#
857}
858
859sub cache_file($$&&) { 801sub cache_file($$&&) {
860 my ($src, $cache, $load, $create) = @_; 802 my ($src, $cache, $load, $create) = @_;
861 803
862 my ($size, $mtime) = (stat $src)[7,9] 804 my ($size, $mtime) = (stat $src)[7,9]
863 or Carp::croak "$src: $!"; 805 or Carp::croak "$src: $!";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines