class WAD::Demo

Overview

A doom demo which saves player input states

Included Modules

Defined in:

wa-cr/wad/wad-data/demo.cr
write.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module WritingAdditions::Demo

write(file : String | Path) : UInt32
write(io : IO) : UInt32
write

Constructor Detail

def self.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")

def self.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 Method Detail

def self.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 Method Detail

def clone #

Returns a copy of self with all instance variables cloned.


def episode : UInt8 #

Always 1 for Doom 2


def episode=(episode : UInt8) #

Always 1 for Doom 2


def fast : Bool #

non-zero value implies use of -fast


def fast=(fast : Bool) #

non-zero value implies use of -fast


def game_version : UInt8 #

109 for version 1.9


def game_version=(game_version : UInt8) #

109 for version 1.9


def input_actions : Array(InputAction) #

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


def input_actions=(input_actions : Array(InputAction)) #

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


def map : UInt8 #

The map


def map=(map : UInt8) #

The map


def multiplayer_mode : UInt8 #

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


def multiplayer_mode=(multiplayer_mode : UInt8) #

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


def nomonsters : Bool #

non-zero value implies use of -nomonsters


def nomonsters=(nomonsters : Bool) #

non-zero value implies use of -nomonsters


def player1 : Bool #

Set to 1 if player 1 present


def player1=(player1 : Bool) #

Set to 1 if player 1 present


def player2 : Bool #

Set to 2 if player 1 present


def player2=(player2 : Bool) #

Set to 2 if player 1 present


def player3 : Bool #

Set to 3 if player 1 present


def player3=(player3 : Bool) #

Set to 3 if player 1 present


def player4 : Bool #

Set to 4 if player 1 present


def player4=(player4 : Bool) #

Set to 4 if player 1 present


def player_pov : UInt8 #

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


def player_pov=(player_pov : UInt8) #

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


def respawn : Bool #

non-zero value implies use of -respawn


def respawn=(respawn : Bool) #

non-zero value implies use of -respawn


def skill_level : UInt8 #

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


def skill_level=(skill_level : UInt8) #

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