From 96fbd27e83b6dfe14a6e3e5b76bcd9b380c608c1 Mon Sep 17 00:00:00 2001 From: Rudolf Polzer Date: Sun, 5 Dec 2010 16:04:08 +0100 Subject: [PATCH 1/1] entities.def -> .ent converter script (beginning) --- scripts/entities.def2ent | 55 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 scripts/entities.def2ent 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 -- 2.39.2