Skip to content

Instantly share code, notes, and snippets.

@Xymph
Xymph / searchSector.py
Created Jun 14, 2022
Omgifol (https://doomwiki.org/wiki/Omgifol) script to search for a sector in maps and show its sidedefs & linedefs; for DoomWiki.org
View searchSector.py
#!/usr/bin/python3
# search maps for a sector's sidedefs/linedefs, by Frans P. de Vries (Xymph)
import sys
from omg import *
def searchmap(wad, name, thesector):
edit = MapEditor(wad.maps[name])
i = 0
@Xymph
Xymph / slotfile.py
Created Feb 26, 2022
Omgifol (https://doomwiki.org/wiki/Omgifol) script to set a WAD's map slot from its filename
View slotfile.py
#!/usr/bin/python
# set WAD's map slot from filename, by Frans P. de Vries (Xymph)
import sys, re
from omg import *
if len(sys.argv) < 2:
print("\n Omgifol script: set slot from filename\n")
print(" Usage:")
print(" slotfile.py slot##.wad [-s oldslot]\n")
@Xymph
Xymph / listdir.py
Last active Feb 26, 2022
Omgifol (https://doomwiki.org/wiki/Omgifol) script to list a WAD's directory with lump names & sizes, or comprehensive info from the library itself
View listdir.py
#!/usr/bin/python
# list WAD directory with lump names/sizes or verbose info from Omgifol itself, by Frans P. de Vries (Xymph)
import sys, getopt
from omg import *
if len(sys.argv) < 2:
print("\n Omgifol script: list WAD directory\n")
print(" Usage:")
print(" listdir.py [-v] source.wad\n")
@Xymph
Xymph / searchMonstSecr.py
Last active Feb 26, 2022
Omgifol (https://doomwiki.org/wiki/Omgifol) script to search maps with no monsters nor secret sectors; for DoomWiki.org
View searchMonstSecr.py
#!/usr/bin/python
# search maps for no monsters nor secret sectors, by Frans P. de Vries (Xymph)
import sys
from omg import *
def searchmap(wad, name):
edit = MapEditor(wad.maps[name])
# normal type & generic flags
@Xymph
Xymph / searchSecrExit.py
Last active Feb 26, 2022
Omgifol (https://doomwiki.org/wiki/Omgifol) script to search for secret exit linedefs in maps and show their number/type; for DoomWiki.org
View searchSecrExit.py
#!/usr/bin/python
# search maps for secret exit linedefs, by Frans P. de Vries (Xymph)
import sys, getopt
from omg import *
def searchmap(wad, name, alwys):
edit = MapEditor(wad.maps[name])
normal = [11, 52, 197]
@Xymph
Xymph / searchThing.py
Last active Feb 26, 2022
Omgifol (https://doomwiki.org/wiki/Omgifol) script to search for specific thing type in maps and show their positions; for DoomWiki.org
View searchThing.py
#!/usr/bin/python
# search maps for things of the given type, by Frans P. de Vries (Xymph)
import sys
from omg import *
def searchmap(wad, name, thingtype):
edit = MapEditor(wad.maps[name])
i = 0
@Xymph
Xymph / searchSpecial.py
Last active Feb 26, 2022
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
# 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):
edit = MapEditor(wad.maps[name])
i = 0
@Xymph
Xymph / playpal_total.php
Last active Feb 26, 2022
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
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
Last active Feb 16, 2022
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;
unset($argv[1]);
@Xymph
Xymph / drawmaps.py
Last active Mar 28, 2022
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
# 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