# Docs inputs for the id Tech sections of the scene / tilemap / archive pages (tools/fixtures.py; tools/docs_check.py # explains the inputs), a hand-written Doom 3 .map, and inputs made by the format fixtures' writers: the hand-written UDMF room (udmf.py), a dmap-layout # .proc (proc.py), a VSWAP and a one-map GAMEMAPS + MAPHEAD with a random palette (wolf3d.py). # tests/gen/docs_idtech.luau { files = { [name] = bytes }, vars = { udmfText = "room.udmf", ... } } import importlib.util, os, struct INPUTS = ["tools/docs_check.py", "tools/fixtures/udmf.py", "tools/fixtures/proc.py", "tools/fixtures/wolf3d.py"] D3MAP = """Version 2 // entity 0 { "classname" "worldspawn" // primitive 0 { brushDef3 { ( 0 0 -1 -16 ) ( ( 0.0078125 0 0 ) ( 0 0.0078125 0 ) ) "textures/base_floor/a_sofloor1_d" 0 0 0 ( 0 0 1 0 ) ( ( 0.0078125 0 0 ) ( 0 0.0078125 0 ) ) "textures/base_floor/a_sofloor1_d" 0 0 0 ( 0 -1 0 -128 ) ( ( 0.0078125 0 0 ) ( 0 0.0078125 0 ) ) "textures/common/caulk" 0 0 0 ( 1 0 0 -128 ) ( ( 0.0078125 0 0 ) ( 0 0.0078125 0 ) ) "textures/common/caulk" 0 0 0 ( 0 1 0 -128 ) ( ( 0.0078125 0 0 ) ( 0 0.0078125 0 ) ) "textures/common/caulk" 0 0 0 ( -1 0 0 -128 ) ( ( 0.0078125 0 0 ) ( 0 0.0078125 0 ) ) "textures/common/caulk" 0 0 0 } } } // entity 1 { "classname" "info_player_start" "name" "info_player_start_1" "origin" "0 0 1" "angle" "90" } """ def mod(ctx, name): spec = importlib.util.spec_from_file_location("fx_" + name, os.path.join(ctx.root, "tools", name + ".py") if name == "docs_check" else os.path.join(ctx.root, "tools", "fixtures", name + ".py")) m = importlib.util.module_from_spec(spec) spec.loader.exec_module(m) return m def generate(ctx): check = mod(ctx, "docs_check") P = mod(ctx, "proc") models, portals, nodes, areas, shadow = P.level(ctx.rng(2), False) files = {"room.udmf": mod(ctx, "udmf").ROOM.encode(), "level.proc": P.write(models, portals, nodes, areas, shadow, "mapProcFile003", False).encode()} W = mod(ctx, "wolf3d") rng = ctx.rng(5) pal = bytes(rng.randrange(64) for _ in range(768)) files["VSWAP.WL6"], _ = W.vswap(rng, pal) files["wolf.pal"] = pal g = W.grid(rng, 16, 16, 0) planes = [W.plane(g), W.plane([0] * 256), W.plane([0] * 256)] body = bytearray(b"TED5v1.0") starts = [] for pl in planes: starts.append(len(body)) body += pl head = len(body) body += struct.pack("