def showLevelDialog(self): """ Loads the level choosing dialog, along with sending the level data to loadLevel() """ levelSelect = ChooseLevelDialog(self.levelList) if levelSelect.exec_(): if levelSelect.absolutePath: path = levelSelect.stageName name = levelSelect.stageNamePath print('ok so path is ' + path) print('and our name is ' + name) custom = 1 else: path = self.gamePath + '/Pack/Static/Map/' + levelSelect.stageName + '.szs' custom = 0 if os.path.isfile(path): with open(path, 'rb') as f: data = f.read() if custom == 0: self.levelData = byml.BYML(sarc.extract(yaz0.decompress(data), levelSelect.stageName + '.byaml')) self.loadLevel(self.levelData.rootNode) self.setWindowTitle('Splat3D ALPHA v0.2 ' + os.path.basename(path) + ' (' + levelName(levelSelect.stageName) + ')') if custom == 1: self.levelData = byml.BYML(sarc.extract(yaz0.decompress(data), levelSelect.stageNamePath + '.byaml')) self.loadLevel(self.levelData.rootNode) self.setWindowTitle('Splat3D ALPHA v0.2 ' + os.path.basename(path) + ' (' + levelName(levelSelect.stageName[:-4]) + ')')
def loadModel(self,newname): if self.inkGender == 1: gen = 1 else: gen = 0 if newname == 'StartPos' and gen == 1: newname = 'Player01' if newname == 'StartPos' and gen == 0: newname = 'Player00' name = ReplaceModel(newname, gen) paths = ('/Model/', '/Pack/Obj/Model/', '/Pack/ObjSmall/Model/', '/Pack/Enemy/Model/', '/Pack/Player/Model/') for objpath in paths: base = window.gamePath + str(objpath) + str(name) if os.path.isfile(str(base) + '.sarc'): ext = '.sarc' elif os.path.isfile(str(base) + '.szs'): ext = '.szs' else: kind = '(skipped)' continue if base == window.gamePath + '/Pack/ObjSmall/Model/Obj_DemoPlayer': return self.cubeList if os.path.isfile(str(base) + str(ext)): with open(base + ext, 'rb') as f: data = f.read() print('Loading model ' + name + '!') if data.startswith(b'Yaz0'): print('Decompressing Yaz0...') yaz0archive = yaz0.decompress(data) if b"Output.bfres" in yaz0archive: bfres = sarc.extract(yaz0archive, 'Output.bfres') model = fmdl.parse(bfres) return self.generateList(model) else: return self.cubeList else: print('Skipping yaz0 decompression') sarchive = data if b"Output.bfres" in sarchive: bfres = sarc.extract(sarchive, 'Output.bfres') model = fmdl.parse(bfres) return self.generateList(model) else: return self.cubeList break else: return self.cubeList
def loadModel(self, newname): if self.inkGender == 1: gen = 1 else: gen = 0 if newname == 'StartPos' and gen == 1: newname = 'Player01' if newname == 'StartPos' and gen == 0: newname = 'Player00' name = ReplaceModel(newname, gen) paths = ('/Model/', '/Pack/Obj/Model/', '/Pack/ObjSmall/Model/', '/Pack/Enemy/Model/', '/Pack/Player/Model/') for objpath in paths: base = window.gamePath + str(objpath) + str(name) if os.path.isfile(str(base) + '.sarc'): ext = '.sarc' elif os.path.isfile(str(base) + '.szs'): ext = '.szs' else: kind = '(skipped)' continue if base == window.gamePath + '/Pack/ObjSmall/Model/Obj_DemoPlayer': return self.cubeList if os.path.isfile(str(base) + str(ext)): with open(base + ext, 'rb') as f: data = f.read() print('Loading model ' + name + '!') if data.startswith(b'Yaz0'): print('Decompressing Yaz0...') yaz0archive = yaz0.decompress(data) if b"Output.bfres" in yaz0archive: bfres = sarc.extract(yaz0archive, 'Output.bfres') model = fmdl.parse(bfres) return self.generateList(model) else: return self.cubeList else: print('Skipping yaz0 decompression') sarchive = data if b"Output.bfres" in sarchive: bfres = sarc.extract(sarchive, 'Output.bfres') model = fmdl.parse(bfres) return self.generateList(model) else: return self.cubeList break else: return self.cubeList
def showLevelDialog(self): if self.levelSelect.exec_(): with open( self.gamePath + '/StageData/' + self.levelSelect.currentLevel + 'Map1.szs', 'rb') as f: data = f.read() self.levelData = byml.BYML( sarc.extract(yaz0.decompress(data), self.levelSelect.currentLevel + 'Map.byml')) self.loadLevel(self.levelData.rootNode)
def loadModel(self,name): if not os.path.isfile(window.gamePath+'/ObjectData/'+name+'.szs'): return self.cubeList with open(window.gamePath+'/ObjectData/'+name+'.szs','rb') as f: data = f.read() sarchive = yaz0.decompress(data) if sarc.contains(sarchive,name+'.bfres'): bfres = sarc.extract(sarchive,name+'.bfres') model = fmdl.parse(bfres) return self.generateList(model) return self.cubeList
def showLevelDialog(self): """ Loads the level choosing dialog, along with sending the level data to loadLevel() """ levelSelect = ChooseLevelDialog(self.levelList) if levelSelect.exec_(): if levelSelect.absolutePath: path = levelSelect.stageName name = levelSelect.stageNamePath print('ok so path is ' + path) print('and our name is ' + name) custom = 1 else: path = self.gamePath + '/Pack/Static/Map/' + levelSelect.stageName + '.szs' custom = 0 if os.path.isfile(path): with open(path, 'rb') as f: data = f.read() if custom == 0: self.levelData = byml.BYML( sarc.extract(yaz0.decompress(data), levelSelect.stageName + '.byaml')) self.loadLevel(self.levelData.rootNode) self.setWindowTitle('Splat3D ALPHA v0.2 ' + os.path.basename(path) + ' (' + levelName(levelSelect.stageName) + ')') if custom == 1: self.levelData = byml.BYML( sarc.extract(yaz0.decompress(data), levelSelect.stageNamePath + '.byaml')) self.loadLevel(self.levelData.rootNode) self.setWindowTitle('Splat3D ALPHA v0.2 ' + os.path.basename(path) + ' (' + levelName(levelSelect.stageName[:-4]) + ')')
def showLevelDialog(self): if self.levelSelect.exec_(): with open(self.gamePath+'/StageData/'+self.levelSelect.currentLevel+'Map1.szs','rb') as f: data = f.read() self.levelData = byml.BYML(sarc.extract(yaz0.decompress(data),self.levelSelect.currentLevel+'Map.byml')) self.loadLevel(self.levelData.rootNode)
def loadStageList(self): with open(self.gamePath+'/SystemData/StageList.szs','rb') as f: data = f.read() self.worldList = byml.BYML(sarc.extract(yaz0.decompress(data),'StageList.byml')).rootNode