merge ws/quake

This commit is contained in:
4DBug committed 2026-11-01 20:08:48 -06:00
commit 58df9e8a3a
39 files changed
+10044 -1413

No files matched your search

+22
View File
@@ -233,6 +233,28 @@ assert(buffer.tostring(assert(F.save(raw, nil, { format = "art" }))) == buffer.t
Doom's graphics come from WAD lumps rather than files: `F.format("wad").image(wad, name)` (see
[archive.md](archive.md#game-archives)).
Quake's `.lmp` pictures (qpics), `palette.lmp` and `colormap.lmp`, and Quake / Half-Life sprites (`.spr`) load
too. Quake pictures and sprites are 8-bit images over Quake's palette, which is not redistributable: pass it as
`palette` (768 bytes) or as `gfx/palette.lmp` through `files` / `resolve` (without it they load grey,
`meta.source.palette = false`). Half-Life sprites carry their own palette. Sprite frames are `img.frames` on one
canvas around the sprite's origin (`meta.origin`); frame groups give the delays.
```luau
local disc = assert(F.image.load(discLmpBytes, { name = "disc.lmp", palette = quakePaletteBytes }))
assert(disc.width == 24 and disc.meta.source.palette) -- index 255 is transparent
local pal = assert(F.image.load(quakePaletteBytes, { format = "lmp" })) -- a 16 x 16 swatch
assert(#pal.meta.palette == 256)
local back = assert(F.save(disc, nil, { format = "lmp", palette = quakePaletteBytes }))
assert(buffer.len(back) == buffer.len(discLmpBytes))
local flame = assert(F.image.load(flameSprBytes)) -- Half-Life: its own palette
assert(#flame.frames == 3 and flame.meta.source.texFormat == "alphatest")
local spr = assert(F.save(flame, nil, { format = "spr" })) -- version 2; version = 1 (Quake) needs palette
assert(#F.image.load(spr).frames == 3)
```
Doom's graphics come from WAD lumps rather than files: `F.format("wad").image(wad, name)`, and Quake / Half-Life
textures from WAD2 / WAD3: `F.format("wad2").image(wad, name)` (see [archive.md](archive.md#game-archives)).
## Formats