Skip to content

Instantly share code, notes, and snippets.

@Xymph
Xymph / searchSpecial.py
Created Oct 14, 2021
Omgifol (https://doomwiki.org/wiki/Omgifol) script to search linedefs/things in maps for an action special and ID; for DoomWiki.org
View searchSpecial.py
#!/usr/bin/python -W ignore::DeprecationWarning
import sys, getopt
from omg import *
def searchmap(wad, name, special, theid):
edit = MapEditor(wad.maps[name])
i = 0
for line in edit.linedefs:
@Xymph
Xymph / playpal_total.php
Created May 22, 2021
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
View playpal_total.php
#!/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 / textmapSector.php
Created May 22, 2021
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)
View textmapSector.php
#!/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;
@Xymph
Xymph / drawmaps.py
Last active May 22, 2021
Omgifol (https://doomwiki.org/wiki/Omgifol) script to draw Doom-format maps (not UDMF) to PNG images with scale, logging and spawn points support; for DoomWiki.org
View drawmaps.py
#!/usr/bin/python -W ignore::DeprecationWarning
# 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 (Xymph), 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 / texpackstats.py
Created May 22, 2021
Omgifol (https://doomwiki.org/wiki/Omgifol) script to collect stats of a Doom texture pack .WAD file, for DoomWiki.org
View texpackstats.py
#!/usr/bin/python -W ignore::DeprecationWarning
# texture pack statistics, by Frans P. de Vries (Xymph)
import sys, getopt, pprint
from omg import *
from omg.txdef import *
pp = pprint.PrettyPrinter(indent=2)
SwitchDef = make_struct(
"SwitchDef", """Class for switches lump""",
@Xymph
Xymph / textmapExtra.php
Last active May 22, 2021
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
View textmapExtra.php
#!/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 / textmapStats.php
Last active May 22, 2021
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
View textmapStats.php
#!/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);