#!/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