node-wad
Version:
A Doom WAD parser and writer.
16 lines (13 loc) • 450 B
text/coffeescript
class WHeader
constructor: () ->
write: (bf) =>
for c in (if .bPWAD then "PWAD" else "IWAD")
bf.writeUInt8((new Buffer(c, 'ascii')).readUInt8())
bf
.writeUInt32LE(.lumps.length)
.writeUInt32LE((
.lumps
.map((l) -> l.getSize())
.reduce((a, b) -> a + b)
) + 12)
module.exports = WHeader