class

WAD::Demo

Inherits WritingAdditions::Demo < Reference < Object

A doom demo which saves player input states

Constructors

parse(filename : String | Path) : Demo

Parses an file in a demo format

Reads an file and puts out a demo:

my_demo = WAD::Demo.parse("Path/To/Demo")
parse(io : IO) : Demo

Parses an io in a demo format

Reads an io and puts out a demo:

File.open("Path/To/Demo") do |file|
  my_demo = WAD::Demo.parse(file)
end

Class methods

is_demo?(io : IO)

Checks if the demo is of doom version 1,9

Returns true if an io is a demo:

File.open("Path/To/Demo") do |file|
  if WAD::Demo.is_demo(file)
    puts "Is Demo"
  else
    puts "Is not Demo"
  end

Instance methods

clone

Returns a copy of self with all instance variables cloned.

episode

Always 1 for Doom 2

episode=(episode : UInt8)

Always 1 for Doom 2

fast

non-zero value implies use of -fast

fast=(fast : Bool)

non-zero value implies use of -fast

game_version

109 for version 1.9

game_version=(game_version : UInt8)

109 for version 1.9

input_actions

A series of player actions for each tic encoded in 4 bytes.

input_actions=(input_actions : Array(InputAction))

A series of player actions for each tic encoded in 4 bytes.

map

The map

map=(map : UInt8)

The map

multiplayer_mode

1 means deathmatch, 2 altdeath, 0 is used for single-player or cooperative multi-player

multiplayer_mode=(multiplayer_mode : UInt8)

1 means deathmatch, 2 altdeath, 0 is used for single-player or cooperative multi-player

nomonsters

non-zero value implies use of -nomonsters

nomonsters=(nomonsters : Bool)

non-zero value implies use of -nomonsters

player1

Set to 1 if player 1 present

player1=(player1 : Bool)

Set to 1 if player 1 present

player2

Set to 2 if player 1 present

player2=(player2 : Bool)

Set to 2 if player 1 present

player3

Set to 3 if player 1 present

player3=(player3 : Bool)

Set to 3 if player 1 present

player4

Set to 4 if player 1 present

player4=(player4 : Bool)

Set to 4 if player 1 present

player_pov

Which player's point of view to use, zero-indexed (0 means player 1)

player_pov=(player_pov : UInt8)

Which player's point of view to use, zero-indexed (0 means player 1)

respawn

non-zero value implies use of -respawn

respawn=(respawn : Bool)

non-zero value implies use of -respawn

skill_level

Values 0 through 4 indicate "I'm too young to die" through "Nightmare!", respectively.

skill_level=(skill_level : UInt8)

Values 0 through 4 indicate "I'm too young to die" through "Nightmare!", respectively.

Nested types