module Documentation::C_Usage::D_ReadingLumps

Overview

A Wad is a file that contains Lumps.
A Lump is a chunk of data. It can be a Graphic, a Sound, Map data, etc.

While you can read Wads in, you can also directly read Lumps in:

NOTE "LMP or lmp is the file extension for lump files" - Wiki

my_graphic_lump = WAD::Graphic.parse("Path/To/MyGraphic.lmp") # => Returns the parsed graphic
my_sound_lump = WAD::Sound.parse("Path/To/MySound.lmp")       # => Returns the parsed sound

You can also read lumps directly into a WAD with WAD#add(name, type, file):

NOTE Types you can add are ("PcSound", "Sound", "Music", "TextureX", "Graphic", "Flat", "Demo")

my_new_wad = WAD.new(WAD::Type::Internal) # => Creates a new WAD with type internal

# Adds a graphic to *my_new_wad* with the name "MyGraphic"
my_new_wad.add("MyGraphic", "Graphic", "Path/To/MyGraphic.lmp"))

# Adds a sound to *my_new_wad* with the name "MySound"
my_new_wad.add("MySound", "Sound", "Path/To/MySound.lmp")

Defined in:

wa-cr/docs/c_usage/usage_d_reading_lumps.cr