merge ws/quake
This commit is contained in:
commit
58df9e8a3a
39 files changed
+10044
-1413
No files matched your search
@@ -232,6 +232,28 @@ local data = assert(Wad.mapData(wad, "E1M1"))
|
||||
assert(#data.sectors == 2 and #data.things == 2)
|
||||
```
|
||||
|
||||
Quake's and Half-Life's texture WADs (WAD2 / WAD3, format `wad2`; Doom's IWAD / PWAD is `wad`) list their lumps
|
||||
by name; `image` decodes miptex textures (any mip level), qpic pictures, the console font and the palette lump. Quake 1
|
||||
lumps use the WAD's own `palette` lump (gfx.wad), `palette` or `gfx/palette.lmp` through `files` / `resolve` (Quake's
|
||||
palette is not redistributable, so rosetta never embeds it); WAD3 lumps carry their own. `addImage` writes images
|
||||
back as lumps (WAD3: with a palette made by median cut):
|
||||
|
||||
```luau
|
||||
local Wad2 = F.format("wad2")
|
||||
local gfx = assert(F.archive.load(gfxWadBytes))
|
||||
assert(gfx.format == "wad2" and gfx.meta.source.variant == "wad2")
|
||||
local brick = assert(Wad2.image(gfx, "brick")) -- through the WAD's palette lump
|
||||
local small = assert(Wad2.image(gfx, "brick", { mip = 2 })) -- 8 x 8
|
||||
assert(brick.width == 32 and small.width == 8)
|
||||
local disc = assert(Wad2.image(gfx, "disc")) -- a qpic: index 255 transparent
|
||||
assert(disc.meta.source.kind == "qpic")
|
||||
|
||||
local hl = Wad2.new("wad3")
|
||||
assert(Wad2.addImage(hl, "{FENCE", brick)) -- '{' textures key index 255
|
||||
local wad3 = assert(F.save(hl))
|
||||
assert(F.archive.load(wad3).meta.source.variant == "wad3")
|
||||
```
|
||||
|
||||
VPK directories (`pak01_dir.vpk`) hold small files themselves and point to numbered part files for the rest; pass
|
||||
those through `files` or `resolve` (loading a path does it for you):
|
||||
|
||||
|
||||
Reference in new issue
Block a user