Class: D3MPQ::ModCode

Inherits:
BinData::Record
  • Object
show all
Defined in:
lib/d3_mpq/mod_code.rb

Defined Under Namespace

Classes: Stack

Instance Method Summary collapse

Instance Method Details

#baseObject

HACK Returns: Instance of BinData::Record that respond to :variable_content



21
22
23
# File 'lib/d3_mpq/mod_code.rb', line 21

def base
  parent.parent.parent.parent
end

#countObject



29
30
31
# File 'lib/d3_mpq/mod_code.rb', line 29

def count
  mod_length / 4
end

#dataObject



33
34
35
# File 'lib/d3_mpq/mod_code.rb', line 33

def data
  base.variable_content[index, count]
end

#empty?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/d3_mpq/mod_code.rb', line 37

def empty?
  mod_length == 0
end

#idObject

Returns: nil if mod_code is 0xFFFFFFFF, mod_code otherwise



15
16
17
# File 'lib/d3_mpq/mod_code.rb', line 15

def id
  self.mod_code == 0xFFFFFFFF ? nil : self.mod_code.to_i
end

#indexObject



25
26
27
# File 'lib/d3_mpq/mod_code.rb', line 25

def index
  (mod_offset - base.data_num_bytes - base.data_offset) / 4
end

#maxObject



45
46
47
# File 'lib/d3_mpq/mod_code.rb', line 45

def max
  stack.max || 0.0
end

#minObject



41
42
43
# File 'lib/d3_mpq/mod_code.rb', line 41

def min
  stack.min || 0.0
end

#stackObject



53
54
55
# File 'lib/d3_mpq/mod_code.rb', line 53

def stack
  @stack ||= Stack.new(data)
end

#traceObject



49
50
51
# File 'lib/d3_mpq/mod_code.rb', line 49

def trace
  stack.trace
end