Beispiel #1
0
def main():
    args = parse_args()

    print "Loading %s..." % args.source_wad
    inwad = wad.WAD()
    inwad.from_file(args.source_wad)

    if args.list:
        print "Found %d maps:" % len(inwad.maps)
        for mapName in inwad.maps.keys():
            print "  %s" % mapName
        sys.exit(0)

    # lets make sure all output files are written here
    os.chdir(args.output)

    # export the textures first, so we know all their sizes
    textureNames, textureSizes = writemtl(inwad)

    maps = util.find(inwad.maps, args.maps)
    if len(maps) == 0:
        print "No maps matching pattern '%s' were found." % (args.maps)
    else:
        print "Found %d maps matching pattern '%s'" % (len(maps), args.maps)
        for name in maps:
            objfile = name+".obj"
            print "Writing %s" % objfile
            objmap(inwad, name, objfile, textureNames, textureSizes, args.center)
Beispiel #2
0
def main():
    args = parse_args()

    print "Loading %s..." % args.filepath
    inwad = wad.WAD()
    inwad.from_file(args.filepath)

    textureNames, textureSizes = writemtl(inwad)

    maps = util.find(inwad.maps, args.pattern)
    print "Found %d maps matching pattern '%s'" % (len(maps), args.pattern)
    for name in maps:
        objfile = name+".obj"
        print "Writing %s" % objfile
        objmap(inwad, name, objfile, textureNames, textureSizes)
Beispiel #3
0
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.WAD()
        outwad = wad.WAD()
        inwad.from_file(args[0])
        pattern = "*"
        if (len(args) == 3):
            pattern = args[2]
        for name in util.find(inwad.maps,pattern):
            print "Mirroring %s" % name
            outwad.maps[name] = mirror(inwad.maps[name])
        print "Saving %s..." % args[1]
        outwad.to_file(args[1])
Beispiel #4
0
         draw.line((p1x+1, p1y, p2x+1, p2y), fill=color)
         draw.line((p1x-1, p1y, p2x-1, p2y), fill=color)
         draw.line((p1x, p1y+1, p2x, p2y+1), fill=color)
         draw.line((p1x, p1y-1, p2x, p2y-1), fill=color)

    del draw

    im.save(filename, format)


#import psyco
#psyco.full()

if (len(sys.argv) < 5):
    print "\n    Omgifol script: draw maps to image files\n"
    print "    Usage:"
    print "    drawmaps.py source.wad pattern width format\n"
    print "    Draw all maps whose names match the given pattern (eg E?M4 or MAP*)"
    print "    to image files of a given format (PNG, BMP, etc). width specifies the"
    print "    desired width of the output images."
else:

    print "Loading %s..." % sys.argv[1]
    inwad = wad.WAD()
    inwad.from_file(sys.argv[1])
    width = int(sys.argv[3])
    format = sys.argv[4].upper()
    for name in util.find(inwad.maps, sys.argv[2]):
        print "Drawing %s" % name
        drawmap(inwad, name, name + "_map" + "." + format.lower(), width, format)
Beispiel #5
0
        draw.line((p1x - 1, p1y, p2x - 1, p2y), fill=color)
        draw.line((p1x, p1y + 1, p2x, p2y + 1), fill=color)
        draw.line((p1x, p1y - 1, p2x, p2y - 1), fill=color)

    del draw

    im.save(filename, format)


#import psyco
#psyco.full()

if (len(sys.argv) < 5):
    print "\n    Omgifol script: draw maps to image files\n"
    print "    Usage:"
    print "    drawmaps.py source.wad pattern width format\n"
    print "    Draw all maps whose names match the given pattern (eg E?M4 or MAP*)"
    print "    to image files of a given format (PNG, BMP, etc). width specifies the"
    print "    desired width of the output images."
else:

    print "Loading %s..." % sys.argv[1]
    inwad = wad.WAD()
    inwad.from_file(sys.argv[1])
    width = int(sys.argv[3])
    format = sys.argv[4].upper()
    for name in util.find(inwad.maps, sys.argv[2]):
        print "Drawing %s" % name
        drawmap(inwad, name, name + "_map" + "." + format.lower(), width,
                format)