Exemplo n.º 1
0
    def pack(self, pat0, binfile):
        super().pack(pat0, binfile)
        textures = pat0.getTextures()
        anims = pat0.mat_anims
        binfile.write('I4HI', 0, pat0.framecount, len(anims), len(textures), 0,
                      pat0.loop)
        binfile.createRef()  # section 0: data
        folder = Folder(binfile)  # index group
        for x in anims:
            folder.addEntry(x.name)
        folder.pack(binfile)
        packing = []
        for x in anims:  # Headers/flags
            folder.createEntryRefI()
            packing.append(PackPat0Animation(x, binfile))
        for x in packing:  # key frame lists
            x.pack_frames(binfile, textures)

        binfile.createRef()  # section 1: textures
        binfile.start()
        for x in textures:
            binfile.storeNameRef(x)
        binfile.end()
        binfile.createRef()  # section 2: palettes
        binfile.createRef()  # section 3: nulls
        binfile.advance(len(textures) * 4)
        binfile.createRef()  # section 4: palette ptr table
        binfile.end()
Exemplo n.º 2
0
 def pack(self, clr0, binfile):
     super().pack(clr0, binfile)
     animations = clr0.animations
     binfile.write('i2Hi', 0, clr0.framecount, len(animations), clr0.loop)
     binfile.createRef()  # section 0
     folder = Folder(binfile)
     for x in animations:
         folder.addEntry(x.name)
     folder.pack(binfile)
     for x in animations:
         folder.createEntryRefI()
         self.PackSub(x, binfile)
     binfile.end()
Exemplo n.º 3
0
 def pack(self, chr0, binfile):
     super().pack(chr0, binfile)
     binfile.write('I2H2I', 0, chr0.framecount, len(chr0.animations),
                   chr0.loop, chr0.scaling_rule)
     f = Folder(binfile)
     for x in chr0.animations:
         f.addEntry(x.name)
     binfile.createRef()
     f.pack(binfile)
     binfile.writeRemaining(chr0.data)
     for x in chr0.animations:  # hackish way of overwriting the string offsets
         binfile.offset = binfile.beginOffset + x.offset
         f.createEntryRefI()
         binfile.storeNameRef(x.name)
     binfile.end()
Exemplo n.º 4
0
 def pack_root(self, scn0, binfile, packing_items):
     binfile.createRef()  # section root
     root = Folder(binfile)
     index_groups = []
     for i in range(5):
         if packing_items[i]:
             root.addEntry(scn0.FOLDERS[i])
             f = Folder(binfile, scn0.FOLDERS[i])
             index_groups.append(f)
             for item in packing_items[i]:
                 f.addEntry(item.name)
     root.pack(binfile)
     for x in index_groups:
         root.createEntryRefI()
         x.pack(binfile)  # doesn't create data pointers
     return index_groups
Exemplo n.º 5
0
 def pack(self, shp0, binfile):
     super().pack(shp0, binfile)
     binfile.write('I2HI', 0, shp0.framecount, len(shp0.strings), shp0.loop)
     binfile.createRef()  # section 0
     folder = Folder(binfile)
     for x in shp0.animations:
         folder.addEntry(x.name)
     folder.pack(binfile)
     for x in shp0.animations:
         folder.createEntryRefI()
         self.PackSub(x, binfile)
     binfile.createRef()  # section 1
     binfile.start()
     for x in shp0.strings:
         binfile.storeNameRef(x)
     binfile.end()
     binfile.end()
Exemplo n.º 6
0
 def pack(self, srt0, binfile):
     """ Packs the data for SRT file """
     super().pack(srt0, binfile)
     binfile.write("I2H2I", 0, srt0.framecount, len(srt0.matAnimations),
                   srt0.matrixmode, srt0.loop)
     binfile.createRef()  # create ref to section 0
     # create index group
     folder = Folder(binfile, "srt0root")
     for x in srt0.matAnimations:
         folder.addEntry(x.name)
     folder.pack(binfile)
     packers = []
     for x in srt0.matAnimations:
         folder.createEntryRefI()
         packers.append(PackSrt0Material(x, binfile))
     # Now for key frames
     key_frame_lists = {}  # map of offsets to frame lists
     for x in packers:
         x.consolidate(binfile, key_frame_lists)
     # binfile.createRef()  # section 1 (unknown)
     # binfile.writeRemaining(self.section1)
     binfile.end()