示例#1
0
 def read(self, reader):
     ObjectLoader.read(self, reader)
     self.width = reader.readInt(True)
     self.height = reader.readInt(True)
     self.font = reader.readInt(True)
     self.color = reader.readColor()
     self.flags = reader.readInt(True)
     checkDefault(reader, reader.readInt(True), 0)
     self.items = [
         self.new(Paragraph, reader) for _ in xrange(reader.readInt(True))
     ]
示例#2
0
 def read(self, reader):
     self.controlType = reader.readInt()
     count = reader.readInt(True)  # 16
     checkDefault(reader, count, 16)
     self.up = Key(reader.readInt())
     self.down = Key(reader.readInt())
     self.left = Key(reader.readInt())
     self.right = Key(reader.readInt())
     self.button1 = Key(reader.readInt())
     self.button2 = Key(reader.readInt())
     self.button3 = Key(reader.readInt())
     self.button4 = Key(reader.readInt())
     for _ in xrange(8):
         checkDefault(reader, reader.readInt(), 0)
示例#3
0
    def read(self, reader):
        self.handle = reader.readInt()
        self.name = reader.read(reader.readInt())
        self.size = (reader.readInt(), reader.readInt())
        self.background = reader.readColor()
        self.flags.setFlags(reader.readInt(True))

        self.maxObjects = reader.readInt()
        self.password = reader.read(reader.readInt())
        checkDefault(reader, reader.readInt(), 0)

        self.lastViewedX = reader.readInt()
        self.lastViewedY = reader.readInt()

        self.palette = [reader.readColor() for _ in xrange(reader.readInt())]

        self.stampHandle = reader.readInt()

        self.activeLayer = reader.readInt()

        self.layers = [
            self.new(Layer, reader) for _ in xrange(reader.readInt())
        ]

        if reader.readByte() != 0:
            self.fadeIn = self.new(Transition, reader)

        if reader.readByte() != 0:
            self.fadeOut = self.new(Transition, reader)

        self.items = items = [
            self.new(FrameItem, reader) for _ in xrange(reader.readInt())
        ]

        self.folders = [
            self.new(ItemFolder, reader) for _ in xrange(reader.readInt(True))
        ]

        self.instances = [
            self.new(FrameInstance, reader) for _ in xrange(reader.readInt())
        ]
        self.events = self.new(Events, reader)
        self.chunks = self.new(ChunkList, reader)
示例#4
0
 def read(self, reader):
     ObjectLoader.read(self, reader)
     self.width = reader.readInt(True)
     self.height = reader.readInt(True)
     self.questionFont = reader.readInt(True)
     self.questionColor = reader.readColor()
     checkDefault(reader, reader.readInt(True), 37)
     self.questionFlags = reader.readInt(True)  # add relief?
     checkDefault(reader, reader.readInt(True), 1)  # question count?
     self.question = reader.read(reader.readInt(True))
     checkDefault(reader, reader.readInt(True), 0)
     self.answerFont = reader.readInt(True)
     self.answerColor = reader.readColor()
     checkDefault(reader, reader.readInt(True), 37)
     self.answerFlags = reader.readInt(True)  # add relief?
     self.items = [
         self.new(Paragraph, reader) for _ in xrange(reader.readInt(True))
     ]
示例#5
0
    def read(self, reader):
        if reader.read(4) != MFA_MAGIC:
            raise Exception('mfa header is invalid')
        self.mfaBuild = reader.readInt()
        self.product = reader.readInt()
        self.buildVersion = reader.readInt()
        self.settings['build'] = self.buildVersion
        if self.mfaBuild >= MFA_CURRENT_VERSION:
            self.languageId = reader.readInt()
        self.name = reader.read(reader.readInt())
        self.description = reader.read(reader.readInt())
        self.path = reader.read(reader.readInt())
        # stamp? stampSize
        self.stamp = reader.read(reader.readInt())

        if reader.read(4) != FONT_BANK:
            raise Exception('invalid font bank name')
        self.fonts = self.new(FontBank, reader, compressed=False)
        if reader.read(4) != SOUND_BANK:
            raise Exception('invalid sound bank name')
        self.sounds = self.new(SoundBank, reader, compressed=False)
        if reader.read(4) != MUSIC_BANK:
            raise Exception('invalid music bank name')
        self.music = self.new(MusicBank, reader, compressed=False)
        if reader.read(4) != IMAGE_BANK:
            raise Exception('invalid icon bank name')
        self.icons = self.new(AGMIBank, reader)
        if reader.read(4) != IMAGE_BANK:
            raise Exception('invalid image bank name')
        self.images = self.new(AGMIBank, reader)

        checkDefault(reader, reader.read(reader.readInt()), self.name)
        self.author = reader.read(reader.readInt())
        checkDefault(reader, reader.read(reader.readInt()), self.description)
        self.copyright = reader.read(reader.readInt())
        self.company = reader.read(reader.readInt())
        self.version = reader.read(reader.readInt())

        self.windowSize = (reader.readInt(), reader.readInt())
        self.borderColor = reader.readColor()

        self.displaySettings.setFlags(reader.readInt(True))
        self.graphicSettings.setFlags(reader.readInt(True))

        self.helpFile = reader.read(reader.readInt())
        self.vitalizePreview = reader.read(reader.readInt())
        self.initialScore = reader.readInt(True)
        self.initialLifes = reader.readInt(True)
        self.frameRate = reader.readInt()
        self.buildType = reader.readInt()
        self.buildPath = reader.read(reader.readInt())
        checkDefault(reader, reader.readInt(), 0)
        self.commandLine = reader.read(reader.readInt())
        self.aboutBox = reader.read(reader.readInt())
        checkDefault(reader, reader.readInt(), 0)

        self.binaryFiles = [
            reader.read(reader.readInt()) for _ in xrange(reader.readInt())
        ]

        self.controls = self.new(Controls, reader)

        menuSize = reader.readInt(True)
        currentPosition = reader.tell()
        self.menu = self.new(AppMenu, reader)
        reader.seek(currentPosition + menuSize)

        self.windowMenuIndex = reader.readInt()

        self.menuImages = menuImages = {}
        for i in xrange(reader.readInt()):
            id = reader.readInt()
            menuImages[id] = reader.readInt()

        self.globalValues = ValueList(reader)
        self.globalStrings = ValueList(reader)

        self.globalEvents = reader.read(reader.readInt())

        self.graphicMode = reader.readInt()

        self.iconImages = [reader.readInt() for _ in xrange(reader.readInt())]

        self.customQualifiers = qualifiers = []
        for _ in xrange(reader.readInt()):
            name = reader.read(reader.readInt())
            handle = reader.readInt()
            qualifiers.append((name, handle))

        for _ in xrange(reader.readInt()):
            handle = reader.readInt()
            filename = reader.read(reader.readInt())
            name = reader.read(reader.readInt())
            # KPX_MAGICNUMBER
            magic = reader.readInt()
            subType = reader.read(reader.readInt())
            self.extensions.append((handle, filename, name, magic, subType))

        frameOffsets = [reader.readInt() for _ in xrange(reader.readInt())]
        nextOffset = reader.readInt()

        for offset in frameOffsets:
            reader.seek(offset)
            self.frames.append(self.new(Frame, reader))

        reader.seek(nextOffset)

        self.chunks = self.new(ChunkList, reader)