Doom's pictures read out of a WAD into one Cauldron2D.Sectors.Pictures set: the
composed wall textures, the floor flats, every patch — sprites, the status bar, the
weapons — and the palettes and light tables to draw them with.
graphics = ElixirDoom.Graphics.load(wad)
ElixirDoom.Graphics.wall(graphics, "STARTAN3")
ElixirDoom.Graphics.sprite(graphics, "TROO", 0, 3)Pictures are named {:wall, name}, {:flat, name} and {:patch, name} in the set.
palettes holds the WAD's fourteen 768-byte palettes in order: 0 normal, 1..8
hurt, 9..12 picking up, 13 the radiation suit.
Summary
Functions
The picture id of flat name, or nil.
Read every picture in wad. native: false keeps the pictures in Elixir.
Palette index of the fourteen.
The picture id of patch name, or nil.
A patch's %{left:, top:, width:, height:}.
The picture of sprite name at frame (0 for A) seen from rotation (0 for
the front, counting round anticlockwise in eighths): {picture_id, flip?, lump}, or
nil where the WAD lacks it.
The picture id of wall texture name, or nil for "-" or an unknown name.
Types
@type t() :: %ElixirDoom.Graphics{ flats: [String.t()], palettes: tuple(), patches: %{ required(String.t()) => %{ left: integer(), top: integer(), width: pos_integer(), height: pos_integer() } }, pictures: Cauldron2D.Sectors.Pictures.t(), sprites: %{required(String.t()) => %{required(non_neg_integer()) => tuple()}}, textures: [String.t()] }
Functions
@spec flat(t(), String.t()) :: non_neg_integer() | nil
The picture id of flat name, or nil.
@spec load(ElixirDoom.Wad.t(), keyword()) :: t()
Read every picture in wad. native: false keeps the pictures in Elixir.
Palette index of the fourteen.
@spec patch(t(), String.t()) :: non_neg_integer() | nil
The picture id of patch name, or nil.
A patch's %{left:, top:, width:, height:}.
@spec sprite(t(), String.t(), non_neg_integer(), 0..7) :: {non_neg_integer(), boolean(), String.t()} | nil
The picture of sprite name at frame (0 for A) seen from rotation (0 for
the front, counting round anticlockwise in eighths): {picture_id, flip?, lump}, or
nil where the WAD lacks it.
@spec wall(t(), String.t()) :: non_neg_integer() | nil
The picture id of wall texture name, or nil for "-" or an unknown name.