#!/usr/bin/perl -w # # mkldtypes - generate a Doom level with all linedef types # AYM 2004-01-28 # # This file is copyright André Majorel 2004. # # This program is free software; you can redistribute it and/or modify it under # the terms of version 2 of the GNU General Public License as published by the # Free Software Foundation. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 59 Temple # Place, Suite 330, Boston, MA 02111-1307, USA. # mkldtypes generates a wad with a 32,768-linedef level, E1M1. If # mkldtypes is invoked with the -n option, each linedef has type # -(N + 1) (-1 through -32,768). Otherwise, each linedef has type N (0 # through 32,767). # # The level is made of blocks of 256 linedefs. There are 128 blocks (16 # rows of 8 columns). The object count per level is 32,768 sidedefs, # about 19,000 vertices, 1 sector and 0 things. # # The level is not playable and running it through a nodes builder # probably doesn't make any sense, if at all possible. It's meant to # test editors and utilities against (1) levels with large numbers of # linedefs and (2) unusual linedef types. # # The output is to be piped into wadlc from the Xwadtools package. The # version of wadlc in the latest release of Xwadtools (20010615) has a # bug that prevents it from dealing with such large levels. You have to # apply the patch at . use strict; use Getopt::Long; sub mklevel ($$$$); my $vspacing = 64; # Space between two vertices my $bspacing = 128; # Space between two blocks # Dimension of a block (256 linedefs) my $blockwv = 16; my $blockhv = 8; my $blockwu = $blockwv * $vspacing; my $blockhu = $blockhv * $vspacing; # Number of blocks (128 blocks of 256 linedefs = 32,768 linedefs) my $cols = 8; my $rows = 16; # Overall dimensions my $levelw = $cols * $blockwu + ($cols - 1) * $bspacing; my $levelh = $rows * $blockhu + ($rows - 1) * $bspacing; # Types my $type = 0; my $typestep = +1; my $mode = ''; # # Parse the command line # Getopt::Long::Configure 'bundling', 'noignorecase'; if (! GetOptions 'help' => sub { $mode = 'help' }, 'n' => sub { $type = -1; $typestep = -1 } ) { exit 1; } # # Honour --help # if ($mode eq 'help') { print < 32767)\n" if $lnum > 32767; print " $v1 $v2 : 0 $type 0 s0 0 0 - - - -\n"; $lnum++; $type += $typestep; } $vnum -= $blockwv; for (my $x = 0; $x < $blockwv; $x++, $vnum++) { my $v1 = "v$vnum"; my $v2 = "v" . ($vnum + $blockwv + 1); die "BUG: lnum = $lnum (> 32767)\n" if $lnum > 32767; print " $v1 $v2 : 0 $type 0 s0 0 0 - - - -\n"; $lnum++; $type += $typestep; } $vnum++; # Skip the 17th vertex of the row } $vnum += $blockwv; } } print "LINEDEFS_END\n"; } print "THINGS_START\n"; print "THINGS_END\n"; print "LEVEL_END\n"; }