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.84 by root, Wed Feb 7 00:22:34 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,
230 glacium => 260, 232 glacium => 260,
231 blood => 544, 233 blood => 544,
232; 234;
233 235
234# object as in "Object xxx", i.e. archetypes 236# object as in "Object xxx", i.e. archetypes
303 if (defined (my $v = delete $ob->{slow_move})) { 305 if (defined (my $v = delete $ob->{slow_move})) {
304 $ob->{move_slow} |= MOVE_WALK; 306 $ob->{move_slow} |= MOVE_WALK;
305 $ob->{move_slow_penalty} = $v; 307 $ob->{move_slow_penalty} = $v;
306 } 308 }
307 if (defined (my $v = delete $ob->{walk_on})) { 309 if (defined (my $v = delete $ob->{walk_on})) {
308 $ob->{move_on} = MOVE_ALL unless exists $ob->{move_on}; 310 $ob->{move_on} = 0 unless exists $ob->{move_on};
309 $ob->{move_on} = $v ? $ob->{move_on} | MOVE_WALK 311 $ob->{move_on} = $v ? $ob->{move_on} | MOVE_WALK
310 : $ob->{move_on} & ~MOVE_WALK; 312 : $ob->{move_on} & ~MOVE_WALK;
311 } 313 }
312 if (defined (my $v = delete $ob->{walk_off})) { 314 if (defined (my $v = delete $ob->{walk_off})) {
313 $ob->{move_off} = MOVE_ALL unless exists $ob->{move_off}; 315 $ob->{move_off} = 0 unless exists $ob->{move_off};
314 $ob->{move_off} = $v ? $ob->{move_off} | MOVE_WALK 316 $ob->{move_off} = $v ? $ob->{move_off} | MOVE_WALK
315 : $ob->{move_off} & ~MOVE_WALK; 317 : $ob->{move_off} & ~MOVE_WALK;
316 } 318 }
317 if (defined (my $v = delete $ob->{fly_on})) { 319 if (defined (my $v = delete $ob->{fly_on})) {
318 $ob->{move_on} = MOVE_ALL unless exists $ob->{move_on}; 320 $ob->{move_on} = 0 unless exists $ob->{move_on};
319 $ob->{move_on} = $v ? $ob->{move_on} | MOVE_FLY_LOW 321 $ob->{move_on} = $v ? $ob->{move_on} | MOVE_FLY_LOW
320 : $ob->{move_on} & ~MOVE_FLY_LOW; 322 : $ob->{move_on} & ~MOVE_FLY_LOW;
321 } 323 }
322 if (defined (my $v = delete $ob->{fly_off})) { 324 if (defined (my $v = delete $ob->{fly_off})) {
323 $ob->{move_off} = MOVE_ALL unless exists $ob->{move_off}; 325 $ob->{move_off} = 0 unless exists $ob->{move_off};
324 $ob->{move_off} = $v ? $ob->{move_off} | MOVE_FLY_LOW 326 $ob->{move_off} = $v ? $ob->{move_off} | MOVE_FLY_LOW
325 : $ob->{move_off} & ~MOVE_FLY_LOW; 327 : $ob->{move_off} & ~MOVE_FLY_LOW;
326 } 328 }
327 if (defined (my $v = delete $ob->{flying})) { 329 if (defined (my $v = delete $ob->{flying})) {
328 $ob->{move_type} = MOVE_ALL unless exists $ob->{move_type}; 330 $ob->{move_type} = 0 unless exists $ob->{move_type};
329 $ob->{move_type} = $v ? $ob->{move_type} | MOVE_FLY_LOW 331 $ob->{move_type} = $v ? $ob->{move_type} | MOVE_FLY_LOW
330 : $ob->{move_type} & ~MOVE_FLY_LOW; 332 : $ob->{move_type} & ~MOVE_FLY_LOW;
331 } 333 }
332 334
333 # convert idiotic event_xxx things into objects 335 # convert idiotic event_xxx things into objects
566 568
567 my $inv = delete $a{inventory}; 569 my $inv = delete $a{inventory};
568 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
569 my $anim = delete $a{anim}; 571 my $anim = delete $a{anim};
570 572
573 if ($a{_atype} eq 'object') {
574 $str .= join "\n", "anim", @$anim, "mina\n"
575 if $anim;
576 }
577
571 my @kv; 578 my @kv;
572 579
573 for ($a{_name} eq "map" 580 for ($a{_name} eq "map"
574 ? @Crossfire::FIELD_ORDER_MAP 581 ? @Crossfire::FIELD_ORDER_MAP
575 : @Crossfire::FIELD_ORDER) { 582 : @Crossfire::FIELD_ORDER) {
619 } 626 }
620 } 627 }
621 628
622 if ($inv) { 629 if ($inv) {
623 $append->($_) for @$inv; 630 $append->($_) for @$inv;
624 }
625
626 if ($a{_atype} eq 'object') {
627 $str .= join "\n", "anim", @$anim, "mina\n"
628 if $anim;
629 } 631 }
630 632
631 $str .= "end\n"; 633 $str .= "end\n";
632 634
633 if ($a{_atype} eq 'object') { 635 if ($a{_atype} eq 'object') {
794 ]; 796 ];
795 797
796 $attr 798 $attr
797} 799}
798 800
799sub arch_edit_sections {
800# if (edit_type == IGUIConstants.TILE_EDIT_NONE)
801# edit_type = 0;
802# else if (edit_type != 0) {
803# // all flags from 'check_type' must be unset in this arch because they get recalculated now
804# edit_type &= ~check_type;
805# }
806#
807# }
808# if ((check_type & IGUIConstants.TILE_EDIT_MONSTER) != 0 &&
809# getAttributeValue("alive", defarch) == 1 &&
810# (getAttributeValue("monster", defarch) == 1 ||
811# getAttributeValue("generator", defarch) == 1)) {
812# // Monster: monsters/npcs/generators
813# edit_type |= IGUIConstants.TILE_EDIT_MONSTER;
814# }
815# if ((check_type & IGUIConstants.TILE_EDIT_WALL) != 0 &&
816# arch_type == 0 && getAttributeValue("no_pass", defarch) == 1) {
817# // Walls
818# edit_type |= IGUIConstants.TILE_EDIT_WALL;
819# }
820# if ((check_type & IGUIConstants.TILE_EDIT_CONNECTED) != 0 &&
821# getAttributeValue("connected", defarch) != 0) {
822# // Connected Objects
823# edit_type |= IGUIConstants.TILE_EDIT_CONNECTED;
824# }
825# if ((check_type & IGUIConstants.TILE_EDIT_EXIT) != 0 &&
826# arch_type == 66 || arch_type == 41 || arch_type == 95) {
827# // Exit: teleporter/exit/trapdoors
828# edit_type |= IGUIConstants.TILE_EDIT_EXIT;
829# }
830# if ((check_type & IGUIConstants.TILE_EDIT_TREASURE) != 0 &&
831# getAttributeValue("no_pick", defarch) == 0 && (arch_type == 4 ||
832# arch_type == 5 || arch_type == 36 || arch_type == 60 ||
833# arch_type == 85 || arch_type == 111 || arch_type == 123 ||
834# arch_type == 124 || arch_type == 130)) {
835# // Treasure: randomtreasure/money/gems/potions/spellbooks/scrolls
836# edit_type |= IGUIConstants.TILE_EDIT_TREASURE;
837# }
838# if ((check_type & IGUIConstants.TILE_EDIT_DOOR) != 0 &&
839# arch_type == 20 || arch_type == 23 || arch_type == 26 ||
840# arch_type == 91 || arch_type == 21 || arch_type == 24) {
841# // Door: door/special door/gates + keys
842# edit_type |= IGUIConstants.TILE_EDIT_DOOR;
843# }
844# if ((check_type & IGUIConstants.TILE_EDIT_EQUIP) != 0 &&
845# getAttributeValue("no_pick", defarch) == 0 && ((arch_type >= 13 &&
846# arch_type <= 16) || arch_type == 33 || arch_type == 34 ||
847# arch_type == 35 || arch_type == 39 || arch_type == 70 ||
848# arch_type == 87 || arch_type == 99 || arch_type == 100 ||
849# arch_type == 104 || arch_type == 109 || arch_type == 113 ||
850# arch_type == 122 || arch_type == 3)) {
851# // Equipment: weapons/armour/wands/rods
852# edit_type |= IGUIConstants.TILE_EDIT_EQUIP;
853# }
854#
855# return(edit_type);
856#
857#
858}
859
860sub cache_file($$&&) { 801sub cache_file($$&&) {
861 my ($src, $cache, $load, $create) = @_; 802 my ($src, $cache, $load, $create) = @_;
862 803
863 my ($size, $mtime) = (stat $src)[7,9] 804 my ($size, $mtime) = (stat $src)[7,9]
864 or Carp::croak "$src: $!"; 805 or Carp::croak "$src: $!";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines