Omgifol

Omgifol is a Python library for WAD files. It is open source software originally written by Fredrik Johansson and currently maintained by Devin Acker (Revenant), and is released under the terms of the. The most recent official version, 0.5.0, was released November 19, 2022.

In September 2015 Fredrik confirmed that the original library was no longer being maintained, and recommended to use a more actively maintained fork by Revenant. In November of the same year, this fork was given Fredrik's blessing to become the basis of a new release, and nearly two years later it was finally published to the Python Package Index as version 0.3.0.

As of version 0.3.0, the library aimed for out-of-the-box compatibility with both Python 2.7 and Python 3, but 2.7 support was eventually dropped in January 2022. In the summer of 2022, cyclopsian and Revenant implemented support for UDMF maps with testing support by Frans P. de Vries (Xymph) and this feature was merged on August 19, to be included in the 0.5.0 release.

Features

 * Basic lump management (copying, moving, renaming, saving to files, etc)
 * Editing the following special lumps: COLORMAP, PLAYPAL, TEXTURE1/PNAMES
 * Saving/loading most common image and sound formats
 * Editing maps
 * Encoding/decoding linedef types (including Boom types)

Code example
, a demo script that mirrors maps in a WAD, which is included in the 0.2 release: from sys import argv from omg import * from omg.mapedit import *

def mirror(map): ed = MapEditor(map) for v in ed.vertexes: v.x = -v.x   for l in ed.linedefs: l.vx_a, l.vx_b = l.vx_b, l.vx_a for t in ed.things: t.x = -t.x       t.angle = (180 - t.angle) % 360 ed.nodes.data = "" return ed.to_lumps

def main(args): if (len(args) < 2): print "   Omgifol script: mirror maps\n" print "   Usage:" print "   mirror.py input.wad output.wad [pattern]\n" print "   Mirror all maps or those whose name match the given pattern" print "   (eg E?M4 or MAP*)." print "   Note: nodes will have to be rebuilt externally.\n" else: print "Loading %s..." % args[0] inwad = WAD outwad = WAD inwad.from_file(args[0]) pattern = "*" if (len(args) == 3): pattern = args[2] for name in inwad.maps.find(pattern): print "Mirroring %s" % name outwad.maps[name] = mirror(inwad.maps[name]) print "Saving %s..." % args[1] outwad.to_file(args[1])

if __name__ == "__main__": main(argv[1:])

Drawing maps
Another included demo script is to save map preview images. This script is one of the tools most suitable for creating on Doom Wiki. After the initial v0.2 release, Fredrik made further improvements to its handling of the specified image dimensions.

In April 2016, Xymph added support for a scale parameter that is applied to all requested map images, and for optional verbose logging. The following example command renders all DOOM2.WAD maps at the same scale (with only the largest maps sized down to fit within 1600 pixels) so the viewer gets a good impression of the size differences between them: python drawmaps.py DOOM2.WAD MAP* 1600 4.0

A subsequent addition in September/October 2018 was to optionally render numbered spawn points for deathmatch starts (in green) and Capture the Flag/Capture the Chalice starts (in blue and red), allowing such map views to illustrate multiplayer map analysis and tactics.

Another variant in the fork by Alex Mayfield (AlexMax) adds drawing small squares for all things.

wad2image, a Python tool by Steven Elliott, builds upon Omgifol to generate more featureful map images, including Yadex rendering style and color-coded or animated differences between two map versions.

Trivia
"OMGIFOL" stands for "Oh My God! It's Full Of Lumps!"