Class: Bayonetta::BoneIndexTranslateTable

Inherits:
LibBin::Structure
  • Object
show all
Defined in:
lib/bayonetta/wmb.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#tableObject

attr_accessor :second_levels attr_accessor :third_levels



581
582
583
# File 'lib/bayonetta/wmb.rb', line 581

def table
  @table
end

Instance Method Details

#__convert(input, output, input_big, output_big, parent, index, level = 1) ⇒ Object



604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
# File 'lib/bayonetta/wmb.rb', line 604

def __convert(input, output, input_big, output_big, parent, index, level = 1)
  __set_convert_state(input, output, input_big, output_big, parent, index)
  __convert_fields
  if level == 1
    @second_levels = []
    @offsets.each { |o|
      if o != -1
        t = self.class::new
        t.__convert(input, output, input_big, output_big, self, nil, level+1)
        @second_levels.push t
      end
    }
    @third_levels = []
    @second_levels.each { |l|
      l.offsets.each { |o|
        if o != -1
          t = self.class::new
          t.__convert(input, output, input_big, output_big, self, nil, level+2)
          @third_levels.push t
        end
      }
    }
    decode
  else
    @second_levels = nil
    @third_levels = nil
  end
  __unset_convert_state
  self
end

#__dump(output, output_big, parent, index, level = 1) ⇒ Object



717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
# File 'lib/bayonetta/wmb.rb', line 717

def __dump(output, output_big, parent, index, level = 1)
  __set_dump_state(output, output_big, parent, index)
  encode if level == 1
  __dump_fields
  if @second_levels
    @second_levels.each { |e|
      e.__dump(output, output_big, self, nil, level+1)
    }
  end
  if @third_levels
    @third_levels.each { |e|
      e.__dump(output, output_big, self, nil, level+2)
    }
  end
  __unset_dump_state
end

#__load(input, input_big, parent, index, level = 1) ⇒ Object



635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
# File 'lib/bayonetta/wmb.rb', line 635

def __load(input, input_big, parent, index, level = 1)
  __set_load_state(input, input_big, parent, index)
  __load_fields
  if level == 1
    @second_levels = []
    @offsets.each { |o|
      if o != -1
        t = self.class::new
        t.__load(input, input_big, self, nil, level+1)
        @second_levels.push t
      end
    }
    @third_levels = []
    @second_levels.each { |l|
      l.offsets.each { |o|
        if o != -1
          t = self.class::new
          t.__load(input, input_big, self, nil, level+2)
          @third_levels.push t
        end
      }
    }
    decode
  else
    @second_levels = nil
    @third_levels = nil
  end
  __unset_load_state
  self
end

#__size(position = 0, parent = nil, index = nil) ⇒ Object



589
590
591
592
593
594
595
596
597
598
599
600
601
602
# File 'lib/bayonetta/wmb.rb', line 589

def __size(position = 0, parent = nil, index = nil)
  sz = super()
  if @second_levels
    @second_levels.each { |e|
      sz += e.__size(position, parent, index)
    }
  end
  if @third_levels
    @third_levels.each { |e|
      sz += e.__size(position, parent, index)
    }
  end
  sz
end