def run(self, ticks): SceneClient.run(self, ticks) if not self.wizardStarted: self.wizardStarted = True if not self.songName: while True: self.libraryName, self.songName = \ Dialogs.chooseSong(self.engine, \ selectedLibrary = Config.get("game", "selected_library"), selectedSong = Config.get("game", "selected_song")) if not self.songName: self.session.world.finishGame() return Config.set("game", "selected_library", self.libraryName) Config.set("game", "selected_song", self.songName) info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName) d = Dialogs.chooseItem(self.engine, info.difficulties, _("Choose a difficulty:"), selected = self.player.difficulty) if d: self.player.difficulty = d break else: info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName) # Make sure the difficulty we chose is available if not self.player.difficulty in info.difficulties: self.player.difficulty = info.difficulties[0] self.session.world.deleteScene(self) self.session.world.createScene("GuitarScene", libraryName = self.libraryName, songName = self.songName)
def run(self, ticks): SceneClient.run(self, ticks) self.time += ticks / 50.0 self.counter += ticks if self.offset != None: self.offset -= ticks / 20000.0 if self.pauseScroll != None: self.pauseScroll += ticks / 20000.0 if self.counter > 5000 and self.taunt: #self.taunt.setVolume(self.engine.config.get("audio", "guitarvol")) self.taunt.setVolume(self.engine.config.get( "audio", "SFX_volume")) #MFH - sound effect level self.taunt.play() self.taunt = None #MFH - add counter here to play another crowd cheer before the one playing ends for an endless cheering loop if self.engine.data.cheerSoundFound > 0 and self.resultCheerLoop > 0: if self.resultCheerLoop == 2 or ( self.resultCheerLoop == 1 and self.engine.data.cheerSoundFound == 2): self.cheerLoopCounter += 1 if self.cheerLoopCounter >= self.cheerLoopDelay: self.cheerLoopCounter = 0 self.engine.data.crowdSound.play()
def run(self, ticks): SceneClient.run(self, ticks) pos = self.getSongPosition() # update song if self.song: # update stage self.stage.run(pos, self.guitar.currentPeriod) if self.countdown <= 0 and not self.song.isPlaying() and not self.done: self.goToResults() return if self.autoPlay: notes = self.guitar.getRequiredNotes(self.song, pos) notes = [note.number for time, note in notes] changed = False held = 0 for n, k in enumerate(KEYS): if n in notes and not self.controls.getState(k): changed = True self.controls.toggle(k, True) elif not n in notes and self.controls.getState(k): changed = True self.controls.toggle(k, False) if self.controls.getState(k): held += 1 if changed and held: self.doPick() self.song.update(ticks) if self.countdown > 0: self.guitar.setBPM(self.song.bpm) self.countdown = max(self.countdown - ticks / self.song.period, 0) if not self.countdown: self.engine.collectGarbage() self.song.setGuitarVolume(self.guitarVolume) self.song.setBackgroundVolume(self.songVolume) self.song.setRhythmVolume(self.rhythmVolume) self.song.play() # update board if not self.guitar.run(ticks, pos, self.controls): # done playing the current notes self.endPick() # missed some notes? if self.guitar.getMissedNotes(self.song, pos) and not self.guitar.playedNotes: self.song.setGuitarVolume(0.0) self.player.streak = 0 # late pick if self.keyBurstTimeout is not None and self.engine.timer.time > self.keyBurstTimeout: self.keyBurstTimeout = None notes = self.guitar.getRequiredNotes(self.song, pos) if self.guitar.controlsMatchNotes(self.controls, notes): self.doPick()
def run(self, ticks): SceneClient.run(self, ticks) pos = self.getSongPosition() # update song if self.song: # update stage self.stage.run(pos, self.guitar.currentPeriod) if self.countdown <= 0 and not self.song.isPlaying() and not self.done: self.goToResults() return if self.autoPlay: notes = self.guitar.getRequiredNotes(self.song, pos) notes = [note.number for time, note in notes] changed = False held = 0 for n, k in enumerate(KEYS): if n in notes and not self.controls.getState(k): changed = True self.controls.toggle(k, True) elif not n in notes and self.controls.getState(k): changed = True self.controls.toggle(k, False) if self.controls.getState(k): held += 1 if changed and held: self.doPick() self.song.update(ticks) if self.countdown > 0: self.guitar.setBPM(self.song.bpm) self.countdown = max(self.countdown - ticks / self.song.period, 0) if not self.countdown: self.engine.collectGarbage() self.song.setGuitarVolume(self.guitarVolume) self.song.setBackgroundVolume(self.songVolume) self.song.setRhythmVolume(self.rhythmVolume) self.song.play() # update board if not self.guitar.run(ticks, pos, self.controls): # done playing the current notes self.endPick() # missed some notes? if self.guitar.getMissedNotes(self.song, pos) and not self.guitar.playedNotes: self.song.setGuitarVolume(0.0) self.player.streak = 0 # late pick if self.keyBurstTimeout is not None and self.engine.timer.time > self.keyBurstTimeout: self.keyBurstTimeout = None notes = self.guitar.getRequiredNotes(self.song, pos) if self.guitar.controlsMatchNotes(self.controls, notes): self.doPick()
def run(self, ticks): SceneClient.run(self, ticks) self.time += ticks / 50.0 self.counter += ticks if self.counter > 5000 and self.taunt: self.taunt.setVolume(self.engine.config.get("audio", "guitarvol")) self.taunt.play() self.taunt = None
def run(self, ticks): SceneClient.run(self, ticks) self.time += ticks / 50.0 self.counter += ticks if self.offset != None: self.offset -= ticks / 20000.0 if self.pauseScroll != None: self.pauseScroll += ticks / 20000.0 if self.counter > 5000 and self.taunt: #self.taunt.setVolume(self.engine.config.get("audio", "guitarvol")) self.taunt.setVolume(self.engine.config.get("audio", "SFX_volume")) #MFH - sound effect level self.taunt.play() self.taunt = None
def run(self, ticks): SceneClient.run(self, ticks) self.time += ticks / 50.0 self.counter += ticks if self.offset != None: self.offset -= ticks / 20000.0 if self.pauseScroll != None: self.pauseScroll += ticks / 20000.0 if self.counter > 5000 and self.taunt: #self.taunt.setVolume(self.engine.config.get("audio", "guitarvol")) self.taunt.setVolume(self.engine.config.get( "audio", "SFX_volume")) #MFH - sound effect level self.taunt.play() self.taunt = None
def run(self, ticks): SceneClient.run(self, ticks) self.time += ticks / 50.0 self.counter += ticks if self.offset != None: self.offset -= ticks / 20000.0 if self.pauseScroll != None: self.pauseScroll += ticks / 20000.0 if self.counter > 5000 and self.taunt: #self.taunt.setVolume(self.engine.config.get("audio", "guitarvol")) self.taunt.setVolume(self.engine.config.get("audio", "SFX_volume")) #MFH - sound effect level self.taunt.play() self.taunt = None #MFH - add counter here to play another crowd cheer before the one playing ends for an endless cheering loop if self.engine.data.cheerSoundFound > 0 and self.resultCheerLoop > 0: if self.resultCheerLoop == 2 or (self.resultCheerLoop == 1 and self.engine.data.cheerSoundFound == 2): self.cheerLoopCounter += 1 if self.cheerLoopCounter >= self.cheerLoopDelay: self.cheerLoopCounter = 0 self.engine.data.crowdSound.play()
def run(self, ticks): SceneClient.run(self, ticks) players = 1 if not self.wizardStarted: self.wizardStarted = True if self.engine.cmdPlay == 1: self.songName = Config.get("game", "selected_song") self.libraryName = Config.get("game", "selected_library") self.engine.cmdPlay = 2 if not self.songName: while True: self.libraryName, self.songName = \ Dialogs.chooseSong(self.engine, \ selectedLibrary = Config.get("game", "selected_library"), selectedSong = Config.get("game", "selected_song")) if self.libraryName == None: newPath = Dialogs.chooseFile(self.engine, masks = ["*/songs"], prompt = _("Choose a new songs directory."), dirSelect = True) if newPath != None: Config.set("game", "base_library", os.path.dirname(newPath)) Config.set("game", "selected_library", "songs") Config.set("game", "selected_song", "") if not self.songName: self.session.world.finishGame() return Config.set("game", "selected_library", self.libraryName) Config.set("game", "selected_song", self.songName) info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName) selected = False escape = False escaped = False while True: if len(info.parts) > 1: p = Dialogs.chooseItem(self.engine, info.parts, "%s \n %s" % (info.name, _("Player 1 Choose a part:")), selected = self.player.part) else: p = info.parts[0] if p: self.player.part = p else: break; while True: if len(info.difficulties) > 1: d = Dialogs.chooseItem(self.engine, info.difficulties, "%s \n %s" % (info.name, _("Player 1 Choose a difficulty:")), selected = self.player.difficulty) else: d = info.difficulties[0] if d: self.player.difficulty = d else: if len(info.parts) <= 1: escape = True break while True: if self.engine.config.get("game", "players") > 1: p = Dialogs.chooseItem(self.engine, info.parts + ["Party Mode"] + ["No Player 2"], "%s \n %s" % (info.name, _("Player 2 Choose a part:")), selected = self.player2.part) if p and p == "No Player 2": players = 1 selected = True self.player2.part = p break elif p and p == "Party Mode": players = -1 selected = True self.player2.part = p break elif p and p != "No Player 2" and p != "Party Mode": players = 2 self.player2.part = p else: if len(info.difficulties) <= 1: escaped = True if len(info.parts) <= 1: escape = True break while True: if len(info.difficulties) > 1: d = Dialogs.chooseItem(self.engine, info.difficulties, "%s \n %s" % (info.name, _("Player 2 Choose a difficulty:")), selected = self.player2.difficulty) else: d = info.difficulties[0] if d: self.player2.difficulty = d else: break selected = True break else: selected = True break if selected: break if selected or escaped: break if selected or escape: break if (not selected) or escape: continue break else: info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName) if self.engine.cmdPlay == 2: if len(info.difficulties) >= self.engine.cmdDiff: self.player.difficulty = info.difficulties[self.engine.cmdDiff] if len(info.parts) >= self.engine.cmdPart: self.player.part = info.parts[self.engine.cmdPart] # Make sure the difficulty we chose is available if not self.player.difficulty in info.difficulties: self.player.difficulty = info.difficulties[0] if not self.player.part in info.parts: self.player.part = info.parts[0] if not self.player.difficulty in info.difficulties: self.player.difficulty = info.difficulties[0] if not self.player.part in info.parts: self.player.part = info.parts[0] self.session.world.deleteScene(self) self.session.world.createScene("GuitarScene", libraryName = self.libraryName, songName = self.songName, Players = players)
def run(self, ticks): SceneClient.run(self, ticks) players = 1 if not self.wizardStarted: self.wizardStarted = True if not self.songName: while 1: if self.engine.cmdPlay == 2: self.songName = Config.get("game", "selected_song") self.libraryName = Config.get("game", "selected_library") else: self.mode = 1 self.libraryName, self.songName = \ Dialogs.chooseSong(self.engine, \ selectedLibrary = Config.get("game", "selected_library"), selectedSong = Config.get("game", "selected_song")) if self.libraryName == None: newPath = Dialogs.chooseFile( self.engine, masks=["*/songs"], prompt=_("Choose a new songs directory."), dirSelect=True) if newPath != None: Config.set("game", "base_library", os.path.dirname(newPath)) Config.set("game", "selected_library", "songs") Config.set("game", "selected_song", "") self.engine.resource.refreshBaseLib( ) #myfingershurt - to let user continue with new songpath without restart if not self.songName: self.session.world.finishGame() return if not self.tut: Config.set("game", "selected_library", self.libraryName) Config.set("game", "selected_song", self.songName) self.mode = 2 info = Song.loadSongInfo(self.engine, self.songName, library=self.libraryName) selected = False escape = False escaped = False #while True: #this nesting is now useless #MFH - add "Practice" mode, which will activate a section selection menu before "part" #racer: main menu instead of second menu practice #self.player.practiceMode = Player.PracticeSet #MFH - parameters for newLocalGame: #players = -1 (party mode), 1, 2 #mode1p = 0 (quickplay), 1 (practice), 2 (career) #mode2p = 0 (face-off), 1 (pro face-off) #Config.define("game", "players", int, 1) #Config.define("game","game_mode", int, 0) #Config.define("game","multiplayer_mode", int, 0) if Config.get("game", "game_mode") == 1 and Config.get( "game", "players") == 1: #practice mode self.player.practiceMode = True else: self.player.practiceMode = False slowDownDivisor = Config.get("audio", "speed_factor") while 1: #new nesting for Practice Mode - section / start time selection if self.player.practiceMode: values, options = Config.getOptions( "audio", "speed_factor") if self.subMenuPosTuple: slowdown = Dialogs.chooseItem( self.engine, options, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName( info.name), _("Speed Select:")), pos=self.subMenuPosTuple) else: slowdown = Dialogs.chooseItem( self.engine, options, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName( info.name), _("Speed Select:"))) for i in range(len(values)): if options[i] == slowdown: self.player.practiceSpeed = values[i] slowDownDivisor = values[i] break if self.player.practiceMode and slowDownDivisor == 1: #self.engine.resource.load(self, "song", lambda: Song.loadSong(self.engine, songName, library = self.libraryName, notesOnly = True, part = [player.part for player in self.playerList]), onLoad = self.songLoaded) #startTime = Dialogs.chooseItem(self.engine, info.sections, "%s \n %s" % (info.name, _("Start Section:"))) sectionLabels = [ sLabel for sLabel, sPos in info.sections ] if self.subMenuPosTuple: startLabel = Dialogs.chooseItem( self.engine, sectionLabels, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName( info.name), _("Start Section:")), pos=self.subMenuPosTuple) else: startLabel = Dialogs.chooseItem( self.engine, sectionLabels, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName( info.name), _("Start Section:"))) if startLabel: Log.debug("Practice start section selected: " + startLabel) else: startLabel = "Gig" if startLabel: self.player.practiceSection = startLabel #find start position in array: try: tempStart = [ sPos for sLabel, sPos in info.sections if sLabel == startLabel ] if tempStart == []: self.player.startPos = 0.0 else: self.player.startPos = tempStart[0] Log.debug( "Practice start position retrieved: " + str(self.player.startPos)) except: Log.error("Cannot retrieve start position!") self.player.startPos = 0.0 break else: #self.player.startPos = 0.0 break #if not self.player.practiceMode: #selected = True #this causes "gig" mode to start song with all defaults #escape = True #this causes "gig" mode to exit out to the song selection #escaped = True #this does nothing :( #break; guitars = [] drums = [] vocals = [] autoPart = None for part in info.parts: if part.id == 4: drums.append(part) elif part.id == 5: vocals.append(part) else: guitars.append(part) if self.engine.cmdPlay == 2 and self.engine.cmdPart is not None and len( self.playerList) == 1: if self.engine.cmdPart == part.id: Log.debug("Command-line mode: Part found!") if part.id == 4 and self.engine.input.gameDrums > 0: autoPart = part.id elif part.id == 5 and self.engine.input.gameMics > 0: autoPart = part.id elif self.engine.input.gameGuitars > 0: autoPart = part.id if autoPart is None: if len(drums ) == 0 and self.engine.input.gameDrums > 0: Dialogs.showMessage( self.engine, _("There are no drum parts in this song. Change your controllers to play." )) escaped = True if self.engine.cmdPlay == 2: self.engine.cmdPlay = 0 break if len( guitars ) == 0 and self.engine.input.gameGuitars > 0: Dialogs.showMessage( self.engine, _("There are no guitar parts in this song. Change your controllers to play." )) escaped = True if self.engine.cmdPlay == 2: self.engine.cmdPlay = 0 break if len(vocals ) == 0 and self.engine.input.gameMics > 0: Dialogs.showMessage( self.engine, _("There are no vocal parts in this song. Change your controllers to play." )) escaped = True if self.engine.cmdPlay == 2: self.engine.cmdPlay = 0 break for i, player in enumerate(self.playerList): while 1: #new nesting for Practice Mode selection selectedPlayer = False choose = [] if player.controlType == 2 or player.controlType == 3: choose = drums elif player.controlType == 5: choose = vocals else: choose = guitars if len(choose) > 1: if self.subMenuPosTuple: p = Dialogs.chooseItem( self.engine, choose, "%s \n %s" % (Dialogs. removeSongOrderPrefixFromName( info.name), _("%s Choose a part:") % player.name), selected=player.part, pos=self.subMenuPosTuple) else: p = Dialogs.chooseItem( self.engine, choose, "%s \n %s" % (Dialogs. removeSongOrderPrefixFromName( info.name), _("%s Choose a part:") % player.name), selected=player.part) else: p = choose[0] if p: player.part = p else: if not player.practiceMode: escaped = True break while 1: if len(info.partDifficulties[ p.id]) > 1: if self.subMenuPosTuple: d = Dialogs.chooseItem( self.engine, info.partDifficulties[ p.id], "%s \n %s" % (Dialogs. removeSongOrderPrefixFromName( info.name), _("%s Choose a difficulty:" ) % player.name), selected=player.difficulty, pos=self.subMenuPosTuple) else: d = Dialogs.chooseItem( self.engine, info.partDifficulties[ p.id], "%s \n %s" % (Dialogs. removeSongOrderPrefixFromName( info.name), _("%s Choose a difficulty:" ) % player.name), selected=player.difficulty) else: d = info.partDifficulties[p.id][0] if d: player.difficulty = d selectedPlayer = True else: if len(choose) <= 1: #escape = True escaped = True break if selectedPlayer: break if selectedPlayer or escaped: break #if selected or escaped: #new nesting for Practice Mode selection if selected or escaped: #new nesting for Practice Mode selection break else: selected = True if selected or escaped: #new nesting for Practice Mode section selection break else: self.playerList[0].part = Song.parts[autoPart] for diff in info.partDifficulties[autoPart]: if self.engine.cmdDiff == diff.id: self.playerList[0].difficulty = diff break else: self.playerList[ 0].difficulty = info.partDifficulties[ autoPart][0] selected = True break #useless practice mode nesting #if selected or escape: # break if (not selected) or escape: continue break else: #evilynux - Fixes Practice Mode from the cmdline if Config.get("game", "game_mode") == 1 and Config.get( "game", "players") == 1: self.player.practiceMode = True info = Song.loadSongInfo(self.engine, self.songName, library=self.libraryName) if self.engine.cmdPlay == 3: if len(info.parts) >= self.engine.cmdPart: self.player.part = info.parts[self.engine.cmdPart] if len(info.partDifficulties[ self.player.part.id]) >= self.engine.cmdDiff: self.player.difficulty = info.partDifficulties[ self.player.part.id][self.engine.cmdDiff] # Make sure the difficulty we chose is available if not self.player.part in info.parts: self.player.part = info.parts[0] if not self.player.difficulty in info.partDifficulties[ self.player.part.id]: self.player.difficulty = info.partDifficulties[ self.player.part.id][0] if not self.engine.createdGuitarScene: if self.engine.cmdPlay > 0: self.engine.cmdPlay = 3 #self.engine.createdGuitarScene = True self.session.world.deleteScene(self) self.session.world.createScene("GuitarScene", libraryName=self.libraryName, songName=self.songName, Players=players)
def run(self, ticks): SceneClient.run(self, ticks) players = 1 if not self.wizardStarted: self.wizardStarted = True if self.engine.cmdPlay == 1: self.songName = Config.get("game", "selected_song") self.libraryName = Config.get("game", "selected_library") self.engine.cmdPlay = 2 if not self.songName: while True: self.libraryName, self.songName = \ Dialogs.chooseSong(self.engine, \ selectedLibrary = Config.get("game", "selected_library"), selectedSong = Config.get("game", "selected_song")) if self.libraryName == None: newPath = Dialogs.chooseFile( self.engine, masks=["*/songs"], prompt=_("Choose a new songs directory."), dirSelect=True) if newPath != None: Config.set("game", "base_library", os.path.dirname(newPath)) Config.set("game", "selected_library", "songs") Config.set("game", "selected_song", "") self.engine.resource.refreshBaseLib( ) #myfingershurt - to let user continue with new songpath without restart if not self.songName: self.session.world.finishGame() return if not self.tut: Config.set("game", "selected_library", self.libraryName) Config.set("game", "selected_song", self.songName) info = Song.loadSongInfo(self.engine, self.songName, library=self.libraryName) selected = False escape = False escaped = False #while True: #this nesting is now useless #MFH - add "Practice" mode, which will activate a section selection menu before "part" #racer: main menu instead of second menu practice #self.player.practiceMode = Player.PracticeSet #MFH - parameters for newLocalGame: #players = -1 (party mode), 1, 2 #mode1p = 0 (quickplay), 1 (practice), 2 (career) #mode2p = 0 (face-off), 1 (pro face-off) #Config.define("game", "players", int, 1) #Config.define("player0","mode_1p", int, 0) #Config.define("player1","mode_2p", int, 0) if Config.get("player0", "mode_1p") == 1 and Config.get( "game", "players") == 1: #practice mode self.player.practiceMode = True else: self.player.practiceMode = False slowDownDivisor = Config.get("audio", "speed_factor") while True: #new nesting for Practice Mode - section / start time selection if self.player.practiceMode: values, options = Config.getOptions( "audio", "speed_factor") if self.subMenuPosTuple: slowdown = Dialogs.chooseItem( self.engine, options, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName( info.name), _("Speed Select:")), pos=self.subMenuPosTuple) else: slowdown = Dialogs.chooseItem( self.engine, options, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName( info.name), _("Speed Select:"))) for i in range(len(values)): if options[i] == slowdown: Config.set("audio", "speed_factor", values[i]) slowDownDivisor = values[i] break if self.player.practiceMode and slowDownDivisor == 1: #self.engine.resource.load(self, "song", lambda: Song.loadSong(self.engine, songName, library = self.libraryName, notesOnly = True, part = [player.part for player in self.playerList]), onLoad = self.songLoaded) #startTime = Dialogs.chooseItem(self.engine, info.sections, "%s \n %s" % (info.name, _("Start Section:"))) sectionLabels = [ sLabel for sLabel, sPos in info.sections ] if self.subMenuPosTuple: startLabel = Dialogs.chooseItem( self.engine, sectionLabels, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName( info.name), _("Start Section:")), pos=self.subMenuPosTuple) else: startLabel = Dialogs.chooseItem( self.engine, sectionLabels, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName( info.name), _("Start Section:"))) if startLabel: Log.debug("Practice start section selected: " + startLabel) else: startLabel = "Gig" if startLabel: self.player.practiceSection = startLabel #find start position in array: self.player.startPos = [ sPos for sLabel, sPos in info.sections if sLabel == startLabel ] Log.debug("Practice start position retrieved: " + str(self.player.startPos)) else: #self.player.startPos = [0] break #if not self.player.practiceMode: #selected = True #this causes "gig" mode to start song with all defaults #escape = True #this causes "gig" mode to exit out to the song selection #escaped = True #this does nothing :( #break; while True: #new nesting for Practice Mode selection if len(info.parts) > 1: if self.subMenuPosTuple: p = Dialogs.chooseItem( self.engine, info.parts, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName( info.name), _("Player 1 Choose a part:")), selected=self.player.part, pos=self.subMenuPosTuple) else: p = Dialogs.chooseItem( self.engine, info.parts, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName( info.name), _("Player 1 Choose a part:")), selected=self.player.part) else: p = info.parts[0] if p: self.player.part = p else: if not self.player.practiceMode: escaped = True break while True: if len(info.difficulties) > 1: if self.subMenuPosTuple: d = Dialogs.chooseItem( self.engine, info.difficulties, "%s \n %s" % (Dialogs. removeSongOrderPrefixFromName( info.name), _("Player 1 Choose a difficulty:") ), selected=self.player.difficulty, pos=self.subMenuPosTuple) else: d = Dialogs.chooseItem( self.engine, info.difficulties, "%s \n %s" % (Dialogs. removeSongOrderPrefixFromName( info.name), _("Player 1 Choose a difficulty:") ), selected=self.player.difficulty) else: d = info.difficulties[0] if d: self.player.difficulty = d else: if len(info.parts) <= 1: #escape = True escaped = True break while True: if self.engine.config.get( "game", "players") > 1: #p = Dialogs.chooseItem(self.engine, info.parts + ["Party Mode"] + ["No Player 2"], "%s \n %s" % (info.name, _("Player 2 Choose a part:")), selected = self.player2.part) if self.subMenuPosTuple: p = Dialogs.chooseItem( self.engine, info.parts, "%s \n %s" % (Dialogs. removeSongOrderPrefixFromName( info.name), _("Player 2 Choose a part:")), selected=self.player2.part, pos=self.subMenuPosTuple) else: p = Dialogs.chooseItem( self.engine, info.parts, "%s \n %s" % (Dialogs. removeSongOrderPrefixFromName( info.name), _("Player 2 Choose a part:")), selected=self.player2.part) #if p and p == "No Player 2": # players = 1 # selected = True # self.player2.part = p # break #elif p and p == "Party Mode": # players = -1 # selected = True # self.player2.part = p # break #elif p and p != "No Player 2" and p != "Party Mode": if p: players = 2 self.player2.part = p else: if len(info.difficulties) <= 1: escaped = True if len(info.parts) <= 1: escape = True break while True: if len(info.difficulties) > 1: if self.subMenuPosTuple: d = Dialogs.chooseItem( self.engine, info.difficulties, "%s \n %s" % (Dialogs. removeSongOrderPrefixFromName( info.name), _("Player 2 Choose a difficulty:" )), selected=self.player2. difficulty, pos=self. subMenuPosTuple) else: d = Dialogs.chooseItem( self.engine, info.difficulties, "%s \n %s" % (Dialogs. removeSongOrderPrefixFromName( info.name), _("Player 2 Choose a difficulty:" )), selected=self.player2. difficulty) else: d = info.difficulties[0] if d: self.player2.difficulty = d else: break selected = True break else: selected = True break if selected: break if selected or escaped: break #if selected or escaped: #new nesting for Practice Mode selection if selected or escaped: #new nesting for Practice Mode selection break if selected or escaped: #new nesting for Practice Mode section selection break #useless practice mode nesting #if selected or escape: # break if (not selected) or escape: continue break else: #evilynux - Fixes Practice Mode from the cmdline if Config.get("player0", "mode_1p") == 1 and Config.get( "game", "players") == 1: self.player.practiceMode = True info = Song.loadSongInfo(self.engine, self.songName, library=self.libraryName) if self.engine.cmdPlay == 2: if len(info.difficulties) >= self.engine.cmdDiff: self.player.difficulty = info.difficulties[ self.engine.cmdDiff] if len(info.parts) >= self.engine.cmdPart: self.player.part = info.parts[self.engine.cmdPart] # Make sure the difficulty we chose is available if not self.player.difficulty in info.difficulties: self.player.difficulty = info.difficulties[0] if not self.player.part in info.parts: self.player.part = info.parts[0] if not self.player.difficulty in info.difficulties: self.player.difficulty = info.difficulties[0] if not self.player.part in info.parts: self.player.part = info.parts[0] if not self.engine.createdGuitarScene: #self.engine.createdGuitarScene = True self.session.world.deleteScene(self) self.session.world.createScene("GuitarScene", libraryName=self.libraryName, songName=self.songName, Players=players)
def run(self, ticks): SceneClient.run(self, ticks) players = 1 if not self.wizardStarted: self.wizardStarted = True if self.engine.cmdPlay == 1: self.songName = Config.get("game", "selected_song") self.libraryName = Config.get("game", "selected_library") self.engine.cmdPlay = 2 if not self.songName: while True: self.libraryName, self.songName = \ Dialogs.chooseSong(self.engine, \ selectedLibrary = Config.get("game", "selected_library"), selectedSong = Config.get("game", "selected_song")) if self.libraryName == None: newPath = Dialogs.chooseFile(self.engine, masks = ["*/songs"], prompt = _("Choose a new songs directory."), dirSelect = True) if newPath != None: Config.set("game", "base_library", os.path.dirname(newPath)) Config.set("game", "selected_library", "songs") Config.set("game", "selected_song", "") self.engine.resource.refreshBaseLib() #myfingershurt - to let user continue with new songpath without restart if not self.songName: self.session.world.finishGame() return Config.set("game", "selected_library", self.libraryName) Config.set("game", "selected_song", self.songName) info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName) selected = False escape = False escaped = False #while True: #this nesting is now useless #MFH - add "Practice" mode, which will activate a section selection menu before "part" #racer: main menu instead of second menu practice #self.player.practiceMode = Player.PracticeSet #MFH - parameters for newLocalGame: #players = -1 (party mode), 1, 2 #mode1p = 0 (quickplay), 1 (practice), 2 (career) #mode2p = 0 (face-off), 1 (pro face-off) #Config.define("game", "players", int, 1) #Config.define("player0","mode_1p", int, 0) #Config.define("player1","mode_2p", int, 0) if Config.get("player0","mode_1p") == 1 and Config.get("game","players") == 1: #practice mode self.player.practiceMode = True else: self.player.practiceMode = False while True: #new nesting for Practice Mode - section / start time selection if self.player.practiceMode: #self.engine.resource.load(self, "song", lambda: Song.loadSong(self.engine, songName, library = self.libraryName, notesOnly = True, part = [player.part for player in self.playerList]), onLoad = self.songLoaded) #startTime = Dialogs.chooseItem(self.engine, info.sections, "%s \n %s" % (info.name, _("Start Section:"))) sectionLabels = [sLabel for sLabel,sPos in info.sections] startLabel = Dialogs.chooseItem(self.engine, sectionLabels, "%s \n %s" % (info.name, _("Start Section:"))) if startLabel: Log.debug("Practice start section selected: " + startLabel) else: startLabel = "Gig" if startLabel: self.player.practiceSection = startLabel #find start position in array: self.player.startPos = [sPos for sLabel,sPos in info.sections if sLabel == startLabel] Log.debug("Practice start position retrieved: " + str(self.player.startPos) ) else: break; #if not self.player.practiceMode: #selected = True #this causes "gig" mode to start song with all defaults #escape = True #this causes "gig" mode to exit out to the song selection #escaped = True #this does nothing :( #break; while True: #new nesting for Practice Mode selection if len(info.parts) > 1: p = Dialogs.chooseItem(self.engine, info.parts, "%s \n %s" % (info.name, _("Player 1 Choose a part:")), selected = self.player.part) else: p = info.parts[0] if p: self.player.part = p else: if not self.player.practiceMode: escaped = True break; while True: if len(info.difficulties) > 1: d = Dialogs.chooseItem(self.engine, info.difficulties, "%s \n %s" % (info.name, _("Player 1 Choose a difficulty:")), selected = self.player.difficulty) else: d = info.difficulties[0] if d: self.player.difficulty = d else: if len(info.parts) <= 1: #escape = True escaped = True break while True: if self.engine.config.get("game", "players") > 1: #p = Dialogs.chooseItem(self.engine, info.parts + ["Party Mode"] + ["No Player 2"], "%s \n %s" % (info.name, _("Player 2 Choose a part:")), selected = self.player2.part) p = Dialogs.chooseItem(self.engine, info.parts, "%s \n %s" % (info.name, _("Player 2 Choose a part:")), selected = self.player2.part) #if p and p == "No Player 2": # players = 1 # selected = True # self.player2.part = p # break #elif p and p == "Party Mode": # players = -1 # selected = True # self.player2.part = p # break #elif p and p != "No Player 2" and p != "Party Mode": if p: players = 2 self.player2.part = p else: if len(info.difficulties) <= 1: escaped = True if len(info.parts) <= 1: escape = True break while True: if len(info.difficulties) > 1: d = Dialogs.chooseItem(self.engine, info.difficulties, "%s \n %s" % (info.name, _("Player 2 Choose a difficulty:")), selected = self.player2.difficulty) else: d = info.difficulties[0] if d: self.player2.difficulty = d else: break selected = True break else: selected = True break if selected: break if selected or escaped: break #if selected or escaped: #new nesting for Practice Mode selection if selected or escaped: #new nesting for Practice Mode selection break if selected or escaped: #new nesting for Practice Mode section selection break #useless practice mode nesting #if selected or escape: # break if (not selected) or escape: continue break else: #evilynux - Fixes Practice Mode from the cmdline if Config.get("player0","mode_1p") == 1 and Config.get("game","players") == 1: self.player.practiceMode = True info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName) if self.engine.cmdPlay == 2: if len(info.difficulties) >= self.engine.cmdDiff: self.player.difficulty = info.difficulties[self.engine.cmdDiff] if len(info.parts) >= self.engine.cmdPart: self.player.part = info.parts[self.engine.cmdPart] # Make sure the difficulty we chose is available if not self.player.difficulty in info.difficulties: self.player.difficulty = info.difficulties[0] if not self.player.part in info.parts: self.player.part = info.parts[0] if not self.player.difficulty in info.difficulties: self.player.difficulty = info.difficulties[0] if not self.player.part in info.parts: self.player.part = info.parts[0] self.session.world.deleteScene(self) self.session.world.createScene("GuitarScene", libraryName = self.libraryName, songName = self.songName, Players = players)
def run(self, ticks): SceneClient.run(self, ticks) players = 1 if not self.wizardStarted: self.wizardStarted = True if not self.songName: while 1: if self.engine.cmdPlay == 2: self.songName = Config.get("game", "selected_song") self.libraryName = Config.get("game", "selected_library") else: self.mode = 1 self.libraryName, self.songName = \ Dialogs.chooseSong(self.engine, \ selectedLibrary = Config.get("game", "selected_library"), selectedSong = Config.get("game", "selected_song")) if self.libraryName == None: newPath = Dialogs.chooseFile(self.engine, masks = ["*/songs"], prompt = _("Choose a new songs directory."), dirSelect = True) if newPath != None: Config.set("game", "base_library", os.path.dirname(newPath)) Config.set("game", "selected_library", "songs") Config.set("game", "selected_song", "") self.engine.resource.refreshBaseLib() #myfingershurt - to let user continue with new songpath without restart if not self.songName: self.session.world.finishGame() return if not self.tut: Config.set("game", "selected_library", self.libraryName) Config.set("game", "selected_song", self.songName) self.mode = 2 info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName) selected = False escape = False escaped = False #while True: #this nesting is now useless #MFH - add "Practice" mode, which will activate a section selection menu before "part" #racer: main menu instead of second menu practice #self.player.practiceMode = Player.PracticeSet #MFH - parameters for newLocalGame: #players = -1 (party mode), 1, 2 #mode1p = 0 (quickplay), 1 (practice), 2 (career) #mode2p = 0 (face-off), 1 (pro face-off) #Config.define("game", "players", int, 1) #Config.define("game","game_mode", int, 0) #Config.define("game","multiplayer_mode", int, 0) if Config.get("game","game_mode") == 1 and Config.get("game","players") == 1: #practice mode self.player.practiceMode = True else: self.player.practiceMode = False slowDownDivisor = Config.get("audio", "speed_factor") while 1: #new nesting for Practice Mode - section / start time selection if self.player.practiceMode: values, options = Config.getOptions("audio", "speed_factor") if self.subMenuPosTuple: slowdown = Dialogs.chooseItem(self.engine, options, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("Speed Select:")), pos = self.subMenuPosTuple) else: slowdown = Dialogs.chooseItem(self.engine, options, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("Speed Select:"))) for i in range(len(values)): if options[i] == slowdown: self.player.practiceSpeed = values[i] slowDownDivisor = values[i] break if self.player.practiceMode: sectionLabels = [sLabel for sLabel,sPos in info.sections] if self.subMenuPosTuple: startLabel = Dialogs.chooseItem(self.engine, sectionLabels, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("Start Section:")), pos = self.subMenuPosTuple) else: startLabel = Dialogs.chooseItem(self.engine, sectionLabels, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("Start Section:"))) if startLabel: Log.debug("Practice start section selected: " + startLabel) else: startLabel = "Gig" if startLabel: self.player.practiceSection = startLabel #find start position in array: try: tempStart = [sPos for sLabel,sPos in info.sections if sLabel == startLabel] if tempStart == []: self.player.startPos = 0.0 else: self.player.startPos = tempStart[0] Log.debug("Practice start position retrieved: " + str(self.player.startPos)) except: Log.error("Cannot retrieve start position!") self.player.startPos = 0.0 break else: #self.player.startPos = 0.0 break; guitars = [] drums = [] vocals = [] autoPart = None for part in info.parts: if part.id == 4: drums.append(part) elif part.id == 5: vocals.append(part) else: guitars.append(part) if self.engine.cmdPlay == 2 and self.engine.cmdPart is not None and len(self.playerList) == 1: if self.engine.cmdPart == part.id: Log.debug("Command-line mode: Part found!") if part.id == 4 and self.engine.input.gameDrums > 0: autoPart = part.id elif part.id == 5 and self.engine.input.gameMics > 0: autoPart = part.id elif self.engine.input.gameGuitars > 0: autoPart = part.id if autoPart is None: if len(drums) == 0 and self.engine.input.gameDrums > 0: Dialogs.showMessage(self.engine, _("There are no drum parts in this song. Change your controllers to play.")) escaped = True if self.engine.cmdPlay == 2: self.engine.cmdPlay = 0 break if len(guitars) == 0 and self.engine.input.gameGuitars > 0: Dialogs.showMessage(self.engine, _("There are no guitar parts in this song. Change your controllers to play.")) escaped = True if self.engine.cmdPlay == 2: self.engine.cmdPlay = 0 break if len(vocals) == 0 and self.engine.input.gameMics > 0: Dialogs.showMessage(self.engine, _("There are no vocal parts in this song. Change your controllers to play.")) escaped = True if self.engine.cmdPlay == 2: self.engine.cmdPlay = 0 break for i, player in enumerate(self.playerList): while 1: #new nesting for Practice Mode selection selectedPlayer = False choose = [] if player.controlType == 2 or player.controlType == 3: choose = drums elif player.controlType == 5: choose = vocals else: choose = guitars if len(choose) > 1: if self.subMenuPosTuple: p = Dialogs.chooseItem(self.engine, choose, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("%s Choose a part:") % player.name), selected = player.part, pos = self.subMenuPosTuple) else: p = Dialogs.chooseItem(self.engine, choose, "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("%s Choose a part:") % player.name), selected = player.part) else: p = choose[0] if p: player.part = p else: if not player.practiceMode: escaped = True break; while 1: if len(info.partDifficulties[p.id]) > 1: if self.subMenuPosTuple: d = Dialogs.chooseItem(self.engine, info.partDifficulties[p.id], "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("%s Choose a difficulty:") % player.name), selected = player.difficulty, pos = self.subMenuPosTuple) else: d = Dialogs.chooseItem(self.engine, info.partDifficulties[p.id], "%s \n %s" % (Dialogs.removeSongOrderPrefixFromName(info.name), _("%s Choose a difficulty:") % player.name), selected = player.difficulty) else: try: d = info.partDifficulties[p.id][0] except: # Bug : nothing inside... d = None pass if d: player.difficulty = d selectedPlayer = True else: if len(choose) <= 1: #escape = True escaped = True break if selectedPlayer: break if selectedPlayer or escaped: break #if selected or escaped: #new nesting for Practice Mode selection if selected or escaped: #new nesting for Practice Mode selection break else: selected = True if selected or escaped: #new nesting for Practice Mode section selection break else: self.playerList[0].part = Song.parts[autoPart] for diff in info.partDifficulties[autoPart]: if self.engine.cmdDiff == diff.id: self.playerList[0].difficulty = diff break else: self.playerList[0].difficulty = info.partDifficulties[autoPart][0] selected = True break if (not selected) or escape: continue break else: #evilynux - Fixes Practice Mode from the cmdline if Config.get("game","game_mode") == 1 and Config.get("game","players") == 1: self.player.practiceMode = True info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName) if self.engine.cmdPlay == 3: if len(info.parts) >= self.engine.cmdPart: self.player.part = info.parts[self.engine.cmdPart] if len(info.partDifficulties[self.player.part.id]) >= self.engine.cmdDiff: self.player.difficulty = info.partDifficulties[self.player.part.id][self.engine.cmdDiff] # Make sure the difficulty we chose is available if not self.player.part in info.parts: self.player.part = info.parts[0] if not self.player.difficulty in info.partDifficulties[self.player.part.id]: self.player.difficulty = info.partDifficulties[self.player.part.id][0] if not self.engine.createdGuitarScene: if self.engine.cmdPlay > 0: self.engine.cmdPlay = 3 #self.engine.createdGuitarScene = True self.session.world.deleteScene(self) self.session.world.createScene("GuitarScene", libraryName = self.libraryName, songName = self.songName, Players = players)