Skip to content

Instantly share code, notes, and snippets.

@Xymph
Xymph / textmapStats.php
Last active May 22, 2021 14:39
Process an extracted TEXTMAP lump (from a Doom UDMF map) with regular expressions and a little code to generate statistics in Template:Mapdata format, along with formatted lists of secret sector numbers and deathmatch spawn points (if any), for DoomWiki.org
#!/usr/bin/php
<?php
// TEXTMAP stats script for DoomWiki.org, by Frans P. de Vries (Xymph)
$usage = "Usage: {$argv[0]} TEXTMAP-file\n";
// check input parameter
if ($argc != 2) {
echo $usage;
exit(1);
@Xymph
Xymph / textmapExtra.php
Last active February 16, 2022 22:22
Process an extracted TEXTMAP lump (from a Doom UDMF map) with regular expressions and some code to collect monster and equipment counts for single-player and cooperative modes, and lists those where the counts differ, for DoomWiki.org
#!/usr/bin/php
<?php
// TEXTMAP extra monsters & equipment script for DoomWiki.org, by Frans P. de Vries (Xymph)
$usage = "Usage: {$argv[0]} TEXTMAP-file\n";
// check input parameter
if ($argc != 2) {
echo $usage;
exit(1);
}
@Xymph
Xymph / texpackstats.py
Last active February 26, 2022 16:22
Omgifol (https://doomwiki.org/wiki/Omgifol) script to collect stats of a Doom texture pack .WAD file, for DoomWiki.org - see https://doomwiki.org/wiki/User_talk:Redneckerz#Texture.2Fpalette_automation.3F for discussion and example results
#!/usr/bin/python
# texture pack statistics, by Frans P. de Vries (Xymph)
# discussion: https://doomwiki.org/wiki/User_talk:Redneckerz#Texture.2Fpalette_automation.3F
import sys, getopt, pprint
from omg import *
from omg.txdef import *
pp = pprint.PrettyPrinter(indent=2)
class SwitchDef(WADStruct):
@Xymph
Xymph / drawmaps.py
Last active August 21, 2022 10:44
Omgifol (https://doomwiki.org/wiki/Omgifol) script to draw Doom and UDMF maps to PNG images with scale, logging and spawn points support; for DoomWiki.org
#!/usr/bin/python3
# based on https://sourceforge.net/p/omgifol/code/HEAD/tree/demo/drawmaps.py
# original by Fredrik Johansson, 2006-12-11
# updated by Frans P. de Vries, 2016-04-26/2018-09-05/2018-10-04
import sys, getopt
from omg import *
from PIL import Image, ImageDraw, ImageFont
verbose = False
@Xymph
Xymph / textmapSector.php
Last active February 16, 2022 22:22
Searches an extracted TEXTMAP lump (from a Doom UDMF map) for the vertices belonging to a specified sector number and computes its approximate center position, allowing to hover to that coordinate in the layout in an editor supporting UDMF (which DeePsea doesn't)
#!/usr/bin/php
<?php
// TEXTMAP sector position script for DoomWiki.org, by Frans P. de Vries (Xymph)
$usage = "Usage: {$argv[0]} [-v] TEXTMAP-file sector-id\n";
// check input parameters
$verbose = false;
if (isset($argv[1]) && $argv[1] == '-v') {
$verbose = true;
unset($argv[1]);
@Xymph
Xymph / playpal_total.php
Last active February 26, 2022 16:40
Process a PLAYPAL lump (https://doomwiki.org/wiki/PLAYPAL) extracted from a Doom-engine WAD and count the number of unique colors, optionally skipping unused palettes and truncating 8-bits colors to 6-bits - see https://www.doomworld.com/vb/post/1839737 for example results
#!/usr/bin/php -q
<?php
// count total number of unique colors used in palettes of Doom-engine games,
// optionally skipping unused palettes and truncating 8-bits colors to 6-bits
// by Frans P. de Vries (Xymph)
define('PALSIZE', 3 * 256);
define('USAGE', "usage: {$argv[0]} [-u] [-t] -d|-h|-x|-s PLAYPAL-file\n");
// check options & file parameter
@Xymph
Xymph / searchSpecial.py
Last active January 30, 2024 20:11
Omgifol (https://doomwiki.org/wiki/Omgifol) script to search linedefs/things in maps for an action special and ID; for DoomWiki.org
#!/usr/bin/python3
# search maps for linedefs and things invoking specials, by Frans P. de Vries (Xymph)
import sys
from omg import *
def searchmap(wad, name, special, theid):
try:
edit = UMapEditor(wad.udmfmaps[name])
except KeyError:
@Xymph
Xymph / searchThing.py
Last active August 21, 2022 10:43
Omgifol (https://doomwiki.org/wiki/Omgifol) script to search for specific thing type in maps and show their positions; for DoomWiki.org
#!/usr/bin/python3
# search maps for things of the given type, by Frans P. de Vries (Xymph)
import sys
from omg import *
def searchmap(wad, name, thingtype):
try:
edit = UMapEditor(wad.udmfmaps[name])
except KeyError:
@Xymph
Xymph / searchSecrExit.py
Last active August 21, 2022 10:43
Omgifol (https://doomwiki.org/wiki/Omgifol) script to search for secret exit linedefs in maps and show their number/type; for DoomWiki.org
#!/usr/bin/python3
# search maps for secret exit linedefs, by Frans P. de Vries (Xymph)
import sys, getopt
from omg import *
def searchmap(wad, name, alwys):
try:
edit = UMapEditor(wad.udmfmaps[name])
except KeyError:
@Xymph
Xymph / searchMonstSecr.py
Last active August 21, 2022 10:43
Omgifol (https://doomwiki.org/wiki/Omgifol) script to search maps with no monsters nor secret sectors; for DoomWiki.org
#!/usr/bin/python3
# search maps for no monsters nor secret sectors, by Frans P. de Vries (Xymph)
import sys
from omg import *
def searchmap(wad, name):
try:
edit = UMapEditor(wad.udmfmaps[name])
except KeyError: