From: Rudolf Polzer Date: Sun, 5 Dec 2010 15:04:08 +0000 (+0100) Subject: entities.def -> .ent converter script (beginning) X-Git-Tag: xonotic-v0.1.0preview~12 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=96fbd27;p=xonotic%2Fxonotic-maps.pk3dir.git entities.def -> .ent converter script (beginning) --- diff --git a/scripts/entities.def2ent b/scripts/entities.def2ent new file mode 100644 index 00000000..9de5aa2c --- /dev/null +++ b/scripts/entities.def2ent @@ -0,0 +1,55 @@ +#!/usr/bin/perl + +use strict; +use warnings; + +print < + +EOF + +my $closetag; +my @spawnflags; +while() +{ + chomp; + s/&/&/g; + s//>/g; + s/"/"/g; + if(/^\/\*QUAKED (\S+) \((\S+ \S+ \S+)\) \((\S+ \S+ \S+)\) \((\S+ \S+ \S+)\) ?(.*)/) + { + print "\n"; + $closetag = ""; + @spawnflags = split / /, $5; + } + elsif(/^\/\*QUAKED (\S+) \((\S+ \S+ \S+)\) \? ?(.*)/) + { + print "\n"; + $closetag = ""; + @spawnflags = split / /, $3; + } + elsif(/^\*\/$/) + { + print "$closetag\n"; + } + elsif(/^([0-9a-z_]*): +(.*)/) + { + print "$2\n"; + } + elsif(/^([0-9A-Z_]*): +(.*)/) + { + my $bit = [grep { $spawnflags[$_] eq $1; } 0..@spawnflags-1]->[0]; + warn "Cannot find bit $1 in @spawnflags\n" + if not defined $bit; + print "$2\n"; + } + else + { + print "$_\n"; + } +} + +print < +EOF