--- deliantra/Deliantra/Deliantra.pm 2006/03/27 17:38:18 1.61 +++ deliantra/Deliantra/Deliantra.pm 2006/03/28 14:44:52 1.62 @@ -104,6 +104,21 @@ body_finger body_shoulder body_foot body_hand body_wrist body_waist )); +our %EVENT_TYPE = ( + apply => 1, + attack => 2, + death => 3, + drop => 4, + pickup => 5, + say => 6, + stop => 7, + time => 8, + throw => 9, + trigger => 10, + close => 11, + timer => 12, +); + sub MOVE_WALK (){ 0x01 } sub MOVE_FLY_LOW (){ 0x02 } sub MOVE_FLY_HIGH (){ 0x04 } @@ -137,14 +152,17 @@ or die "$path: $!"; } +# object as in "Object xxx", i.e. archetypes sub normalize_object($) { my ($ob) = @_; + # nuke outdated or never supported fields delete $ob->{$_} for qw( can_knockback can_parry can_impale can_cut can_dam_armour can_apply pass_thru can_pass_thru ); + # convert movement strings to bitsets for my $attr (keys %FIELD_MOVEMENT) { next unless exists $ob->{$attr}; @@ -176,6 +194,7 @@ $ob->{$attr} = $flags; } + # convert outdated movement flags to new movement sets if (defined (my $v = delete $ob->{no_pass})) { $ob->{move_block} = $v ? MOVE_ALL : 0; } @@ -204,9 +223,22 @@ : $ob->{move_type} & ~MOVE_FLY_LOW; } + # convert idiotic event_xxx things into objects + while (my ($event, $subtype) = each %EVENT_TYPE) { + if (exists $ob->{"event_${event}_plugin"}) { + push @{$ob->{inventory}}, { + _name => "event_$event", + title => delete $ob->{"event_${event}_plugin"}, + slaying => delete $ob->{"event_${event}"}, + name => delete $ob->{"event_${event}_options"}, + }; + } + } + $ob } +# arch as in "arch xxx", ie.. objects sub normalize_arch($) { my ($ob) = @_; @@ -358,7 +390,7 @@ for (keys %ARCH) { my $arch = $ARCH{$_}; - push @{$paths{$arch->{editor_folder}}}, \$arch; + push @{$paths{$arch->{editor_folder}}}, $arch; } \%paths