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