Skip to content

Ignore the mesh lightmapped byte and keyword, as the game does - #107

Merged
plenarius merged 1 commit into
mainfrom
fix/lightmapped-byte
Oct 21, 2026
Merged

plenarius merged 1 commit into
mainfrom
fix/lightmapped-byte

Conversation

@plenarius

Copy link
Copy Markdown
Owner

The game's compiler leaves the mesh lightmapped byte (+500) uninitialised, and its ASCII parser reads no lightmapped keyword (nwn-mdl-spec MDL-BIN-051, MDL-ASCII-070). cleanmodels decompiled the garbage byte to a lightmapped N line (often 253) and compiled it back.

Now:

  • the decompiler skips the byte, and the writer emits no lightmapped line;
  • the parser accepts the keyword and ignores it, as it does center (no warning: every ASCII file older cleanmodels versions wrote has the line);
  • the compiler writes 0.

Ported to python/.

Testing (in-game test waived by the user; the game never reads the byte):

  • go test ./... passes, plus TestLightmappedIgnored: a lightmapped 253 line changes nothing in the compiled bytes, and nothing is decompiled back.
  • Corpus parity on the game's 32,832 models passes: decompile, parse and compile. Go and Python give the same decompile warnings and notes on all 25,597 binaries.
  • Against v4.11.0's decompile, 651 files change. The only change is 4,555 removed lightmapped lines.

The game's compiler leaves the lightmapped byte (+500) uninitialised and its
ASCII parser reads no lightmapped keyword (nwn-mdl-spec MDL-BIN-051,
MDL-ASCII-070). cleanmodels decompiled the garbage byte to a "lightmapped N"
line (often 253) and compiled it back. Now the decompiler skips the byte, the
writer emits no such line, the parser accepts and ignores the keyword, and
the compiler writes 0. Ported to python/.
@plenarius
plenarius merged commit 957c1b8 into main Oct 21, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant