module Documentation::C_Usage::B_UsingWadData
Overview
Getting data from a WAD
is fairly simple.
Everything in a WAD
is stored in either a hash or
just as the object it is storing:
my_wad.sounds # => A hash of all sounds in the WAD
my_wad.playpal # => A variable assigned to the playpal in the WAD
Here is a list of every variable in the WAD
class
with a link to its full explanation on the doom wiki
WAD#type : WAD::Type
- The type of the WAD
- Wiki
WAD#directories_count : UInt32
- The amount of lumps in the WAD
- Wiki
WAD#directory_pointer : UInt32
- The location of the start of the directories in bytes - Wiki
WAD#maps : Hash(String, Map)
- A hash that maps a name to a WAD::Map
- Wiki
WAD#pcsounds : Hash(String, PcSound)
- A hash that maps a name to a WAD::PcSound
- Wiki
WAD#sounds : Hash(String, Sound)
- A hash that maps a name to a WAD::Sound
- Wiki
WAD#music : Hash(String, Music)
- A hash that maps a name to a WAD::Music
- Wiki
WAD#genmidi : WAD::Genmidi
- The genmidi of the WAD
- Wiki
WAD#dmxgus : WAD::Dmxgus
- The dmxgus of the WAD
- Wiki
WAD#playpal : WAD::Playpal
- The playpal of the WAD
- Wiki
WAD#colormap : WAD::Colormap
- The colormap of the WAD
- Wiki
WAD#endoom : WAD::EnDoom
- The EnDoom of the WAD
- Wiki
WAD#texmaps : Hash(String, TextureX)
- A hash that maps a name to a WAD::TextureX
- Wiki
WAD#pnames : WAD::Pnames
- The pnames of the WAD
- Wiki
WAD#graphics : Hash(String, Graphic)
- A hash that maps a name to a WAD::Graphic
- Wiki
WAD#sprites : Hash(String, Graphic)
- A hash that maps a name to a WAD::Graphic
- Wiki
WAD#flats : Hash(String, Flat)
- A hash that maps a name to a WAD::Flat
- Wiki
WAD#demos : Hash(String, Demo)
- A hash that maps a name to a WAD::Demo
- Wiki
WAD#directories : Array(Directory)
- An array of all the WAD::Directory
's in the WAD
- Wiki
NOTE WAD#texmaps
maps a name to a WAD::TextureX
, not a "WAD::TexMap
".
The reason for this class name is because a texture map's file name will always
have the format "TextureX" where X is a number, which the class' name reflects.
It also helps to prevent confusion when talking about a texture map, since
the data inside a texture map/TextureX are called texture maps - Wiki
Here are a few examples of how to access WAD
's data:
my_wad = WAD.read("Path/To/Wad") # => Reads in the wad
my_sound = my_wad.sounds["MySound"] # => Returns the sound "MySound" out of *my_wad*
my_map = my_wad.maps["MyMap"] # => Returns the map "MyMap" out of *my_wad*
my_linedef = my_map.linedefs[0] # => Returns the first linedef out of *my_map*
my_linedef_sector_tag = my_linedef.sector_tag # => Returns the sector tag of the linedef
You can alter WAD::Graphic
and WAD::Flat
pixel data with .set_pixel(x, y, value)
:
NOTE value does not refer to an rgb value, but to an index in the colors of a WAD::Playpal::Palette
my_wad = WAD.read("Path/To/Wad") # => Reads in the wad
my_graphic = my_wad.graphics["MyGraphic"] # => Sets *my_graphic* to be a graphic in *my_wad*
my_flat = my_wad.flats["MyFlat"] # => Sets *my_flat* to be a flat in *my_wad*
my_graphic.set_pixel(2, 5, 125) # => Sets the pixel at x=2 y=5 of *my_graphic* to be 125
my_flat.set_pixel(10, 9, 245) # => Sets the pixel at x=10 y=9 of *my_flat* to be 245