Class: Sector

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-doom.rb

Constant Summary collapse

FORMAT =
"ss88sss"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSector

Returns a new instance of Sector.



421
422
423
# File 'lib/ruby-doom.rb', line 421

def initialize
  @floor_height, @ceiling_height, @floor_texture, @ceiling_texture, @light_level, @special, @tag = 0, 128, "FLAT14", "FLAT14", 160, 0, 0
end

Instance Attribute Details

#ceiling_heightObject

Returns the value of attribute ceiling_height.



420
421
422
# File 'lib/ruby-doom.rb', line 420

def ceiling_height
  @ceiling_height
end

#ceiling_textureObject

Returns the value of attribute ceiling_texture.



420
421
422
# File 'lib/ruby-doom.rb', line 420

def ceiling_texture
  @ceiling_texture
end

#floor_heightObject

Returns the value of attribute floor_height.



420
421
422
# File 'lib/ruby-doom.rb', line 420

def floor_height
  @floor_height
end

#floor_textureObject

Returns the value of attribute floor_texture.



420
421
422
# File 'lib/ruby-doom.rb', line 420

def floor_texture
  @floor_texture
end

#idObject

Returns the value of attribute id.



420
421
422
# File 'lib/ruby-doom.rb', line 420

def id
  @id
end

#light_levelObject

Returns the value of attribute light_level.



420
421
422
# File 'lib/ruby-doom.rb', line 420

def light_level
  @light_level
end

#specialObject

Returns the value of attribute special.



420
421
422
# File 'lib/ruby-doom.rb', line 420

def special
  @special
end

#tagObject

Returns the value of attribute tag.



420
421
422
# File 'lib/ruby-doom.rb', line 420

def tag
  @tag
end

Instance Method Details

#read(bytes) ⇒ Object



424
425
426
# File 'lib/ruby-doom.rb', line 424

def read(bytes)
  @floor_height, @ceiling_height, @floor_texture, @ceiling_texture, @light_level, @special, @tag = Codec.decode(FORMAT, bytes)
end

#to_sObject



430
431
432
# File 'lib/ruby-doom.rb', line 430

def to_s
  " Sector floor/ceiling heights " + @floor_height.to_s + "/" + @ceiling_height.to_s + "; floor/ceiling textures " + @floor_texture.to_s + "/" + @ceiling_texture.to_s + "; light = " + @light_level.to_s + "; special = " + @special.to_s + "; tag = " + @tag.to_s
end

#writeObject



427
428
429
# File 'lib/ruby-doom.rb', line 427

def write
  Codec.encode(FORMAT, [@floor_height, @ceiling_height, @floor_texture, @ceiling_texture, @light_level, @special, @tag])
end