ElixirDoom.Level (elixir_doom v0.1.0)

Copy Markdown View Source

A Doom level read from a WAD into a Cauldron2D.Sectors.Map, with the things placed in it.

{:ok, level} = ElixirDoom.Level.load(wad, graphics, "E1M1")
level.map
level.things

Wall and flat names are resolved to picture ids in graphics. The level keeps the BSP its WAD carries; bsp: :build builds one from the lines instead.

A thing is %{x:, y:, angle:, type:, flags:}: the angle in radians and flags Doom's bits — 1 easy, 2 medium, 4 hard, 8 deaf, 16 multiplayer only.

Line flags become the engine's names — :blocks, :blocks_walkers, :upper_unpegged, :lower_unpegged, :secret, :blocks_sound, :hidden, :mapped — and Doom's own numbered specials and tags are kept as they are.

Summary

Functions

Read level name ("E1M1", "MAP01") from wad.

Types

t()

@type t() :: %ElixirDoom.Level{
  map: Cauldron2D.Sectors.Map.t(),
  name: String.t(),
  sky: String.t(),
  things: [thing()]
}

thing()

@type thing() :: %{
  x: float(),
  y: float(),
  angle: float(),
  type: integer(),
  flags: integer()
}

Functions

load(wad, graphics, name, opts \\ [])

@spec load(ElixirDoom.Wad.t(), ElixirDoom.Graphics.t(), String.t(), keyword()) ::
  {:ok, t()} | {:error, term()}

Read level name ("E1M1", "MAP01") from wad.