Class: Doom::Map::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/doom/map/data.rb

Defined Under Namespace

Classes: BBox

Constant Summary collapse

SUBSECTOR_FLAG =
0x8000

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x, y, dx, dy, bbox_right, bbox_left, child_right, child_left) ⇒ Node

Returns a new instance of Node.



50
51
52
53
54
55
56
57
58
59
# File 'lib/doom/map/data.rb', line 50

def initialize(x, y, dx, dy, bbox_right, bbox_left, child_right, child_left)
  @x = x
  @y = y
  @dx = dx
  @dy = dy
  @bbox_right = bbox_right
  @bbox_left = bbox_left
  @child_right = child_right
  @child_left = child_left
end

Instance Attribute Details

#bbox_leftObject (readonly)

Returns the value of attribute bbox_left.



46
47
48
# File 'lib/doom/map/data.rb', line 46

def bbox_left
  @bbox_left
end

#bbox_rightObject (readonly)

Returns the value of attribute bbox_right.



46
47
48
# File 'lib/doom/map/data.rb', line 46

def bbox_right
  @bbox_right
end

#child_leftObject (readonly)

Returns the value of attribute child_left.



46
47
48
# File 'lib/doom/map/data.rb', line 46

def child_left
  @child_left
end

#child_rightObject (readonly)

Returns the value of attribute child_right.



46
47
48
# File 'lib/doom/map/data.rb', line 46

def child_right
  @child_right
end

#dxObject (readonly)

Returns the value of attribute dx.



46
47
48
# File 'lib/doom/map/data.rb', line 46

def dx
  @dx
end

#dyObject (readonly)

Returns the value of attribute dy.



46
47
48
# File 'lib/doom/map/data.rb', line 46

def dy
  @dy
end

#xObject (readonly)

Returns the value of attribute x.



46
47
48
# File 'lib/doom/map/data.rb', line 46

def x
  @x
end

#yObject (readonly)

Returns the value of attribute y.



46
47
48
# File 'lib/doom/map/data.rb', line 46

def y
  @y
end

Instance Method Details

#left_indexObject



73
74
75
# File 'lib/doom/map/data.rb', line 73

def left_index
  @child_left & ~SUBSECTOR_FLAG
end

#left_is_subsector?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/doom/map/data.rb', line 65

def left_is_subsector?
  (@child_left & SUBSECTOR_FLAG) != 0
end

#right_indexObject



69
70
71
# File 'lib/doom/map/data.rb', line 69

def right_index
  @child_right & ~SUBSECTOR_FLAG
end

#right_is_subsector?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/doom/map/data.rb', line 61

def right_is_subsector?
  (@child_right & SUBSECTOR_FLAG) != 0
end