Beispiel #1
0
 def shown(self):
     self.engine.view.pushLayer(self.menu)
     shaders.checkIfEnabled()
     if not self.shownOnce:
         self.shownOnce = True
         if hasattr(sys, 'frozen'):
             # Check whether this is a release binary being run from an svn/git
             # working copy or whether this is an svn/git binary not being run
             # from an corresponding working copy.
             currentVcs, buildVcs = None, None
             if VFS.isdir('/gameroot/.git'):
                 currentVcs = 'git'
             elif VFS.isdir('/gameroot/src/.svn'):
                 currentVcs = 'Subversion'
             if 'git' in Version.version():
                 buildVcs = 'git'
             elif 'svn' in Version.version():
                 buildVcs = 'Subversion'
             if currentVcs != buildVcs:
                 if buildVcs is None:
                     msg = _('This binary release is being run from a %(currentVcs)s working copy. This is not the correct way to run FoFiX from %(currentVcs)s. Please see one of the following web pages to set your %(currentVcs)s working copy up correctly:') + \
                           '\n\nhttp://code.google.com/p/fofix/wiki/RunningUnderPython26' + \
                           '\nhttp://code.google.com/p/fofix/wiki/RequiredSourceModules'
                 else:
                     msg = _('This binary was built from a %(buildVcs)s working copy but is not running from one. The FoFiX Team will not provide any support whatsoever for this binary. Please see the following site for official binary releases:') + \
                           '\n\nhttp://code.google.com/p/fofix/'
                 Dialogs.showMessage(
                     self.engine, msg % {
                         'buildVcs': buildVcs,
                         'currentVcs': currentVcs
                     })
Beispiel #2
0
 def shown(self):
     self.engine.view.pushLayer(self.menu)
     shaders.checkIfEnabled()
     if not self.shownOnce:
         self.shownOnce = True
         if hasattr(sys, 'frozen'):
             # Check whether this is a release binary being run from an svn/git
             # working copy or whether this is an svn/git binary not being run
             # from an corresponding working copy.
             currentVcs, buildVcs = None, None
             if VFS.isdir('/gameroot/.git'):
                 currentVcs = 'git'
             elif VFS.isdir('/gameroot/src/.svn'):
                 currentVcs = 'Subversion'
             if 'git' in Version.version():
                 buildVcs = 'git'
             elif 'svn' in Version.version():
                 buildVcs = 'Subversion'
             if currentVcs != buildVcs:
                 if buildVcs is None:
                     msg = _('This binary release is being run from a %(currentVcs)s working copy. This is not the correct way to run FoFiX from %(currentVcs)s. Please see one of the following web pages to set your %(currentVcs)s working copy up correctly:') + \
                           '\n\nhttp://code.google.com/p/fofix/wiki/RunningUnderPython26' + \
                           '\nhttp://code.google.com/p/fofix/wiki/RequiredSourceModules'
                 else:
                     msg = _('This binary was built from a %(buildVcs)s working copy but is not running from one. The FoFiX Team will not provide any support whatsoever for this binary. Please see the following site for official binary releases:') + \
                           '\n\nhttp://code.google.com/p/fofix/'
                 Dialogs.showMessage(self.engine, msg % {'buildVcs': buildVcs, 'currentVcs': currentVcs})
Beispiel #3
0
 def deleteCharacter(self):
     tsYes = _("Yes")
     q = Dialogs.chooseItem(self.engine, [tsYes, _("No")], _("Are you sure you want to delete this player?"))
     if q == tsYes:
         if self.player:
             Player.deletePlayer(self.player)
         self.engine.view.popLayer(self)
         self.engine.input.removeKeyListener(self)
 def loadLibrary(self):
     Log.debug("Loading libraries in %s" % self.library)
     self.loaded = False
     self.tiersPresent = False
     if self.splash:
         Dialogs.changeLoadingSplashScreenText(self.engine, self.splash, _("Browsing Collection..."))
     else:
         self.splash = Dialogs.showLoadingSplashScreen(self.engine, _("Browsing Collection..."))
         self.loadStartTime = time.time()
     self.engine.resource.load(self, "libraries", lambda: Song.getAvailableLibraries(self.engine, self.library), onLoad = self.loadSongs, synch = True)
Beispiel #5
0
 def getPlayers(self):
     self.playerNames = Player.playername
     self.playerPrefs = Player.playerpref
     self.options = [_("Create New Player"), _("Saved Characters")]
     self.options.extend(self.playerNames)
     for i in range(4):
         if self.selected[i] >= len(self.options):
             self.selected[i] = len(self.options) - 1
     self.blockedItems = [1]
     for i in self.selectedItems:
         self.blockedItems.append(self.options.index(i))
     self.avatars = [None for i in self.options]
     self.avatarScale = [None for i in self.options]
     self.getStartingSelected()
Beispiel #6
0
 def getAvailableMics():
     result = {-1: _('[Default Microphone]')}
     for devnum in range(pa.get_device_count()):
         devinfo = pa.get_device_info_by_index(devnum)
         if devinfo['maxInputChannels'] > 0:
             result[devnum] = devinfo['name']
     return result
Beispiel #7
0
def init(engine):
    # define configuration keys for all available mods
    for m in getAvailableMods(engine):
        Config.define("mods",
                      "mod_" + m,
                      bool,
                      False,
                      text=m,
                      options={
                          False: _("Off"),
                          True: _("On")
                      })

    # init all active mods
    for m in getActiveMods(engine):
        activateMod(engine, m)
Beispiel #8
0
 def getAvailableMics():
     result = {-1: _('[Default Microphone]')}
     for devnum in range(pa.get_device_count()):
         devinfo = pa.get_device_info_by_index(devnum)
         if devinfo['maxInputChannels'] > 0:
             result[devnum] = devinfo['name']
     return result
Beispiel #9
0
def init(engine):
    # define configuration keys for all available mods
    for m in getAvailableMods(engine):
        Config.define("mods", "mod_" + m, bool, False, text = m,  options = {False: _("Off"), True: _("On")})

    # init all active mods
    for m in getActiveMods(engine):
        activateMod(engine, m)
Beispiel #10
0
    def __init__(self, guitarScene, configFileName):
        self.scene = guitarScene
        self.engine = guitarScene.engine
        self.config = LinedConfigParser()
        self.backgroundLayers = []
        self.foregroundLayers = []
        self.textures = {}
        self.reset()

        self.wFull = None  #MFH - needed for new stage background handling
        self.hFull = None

        # evilynux - imported myfingershurt stuff from GuitarScene
        self.mode = self.engine.config.get("game", "stage_mode")
        self.songStage = self.engine.config.get("game", "song_stage")
        self.animatedFolder = self.engine.config.get("game",
                                                     "animated_stage_folder")

        # evilynux - imported myfingershurt stuff from GuitarScene w/ minor modifs
        #MFH TODO - alter logic to accommodate separated animation and slideshow
        #           settings based on selected animated stage folder
        animationMode = self.engine.config.get("game", "stage_animate")
        slideShowMode = self.engine.config.get("game", "rotate_stages")

        if self.animatedFolder == _("None"):
            self.rotationMode = 0  #MFH: if no animated stage folders are available, disable rotation.
        elif self.animatedFolder == "Normal":
            self.rotationMode = slideShowMode
        else:
            self.rotationMode = animationMode

        self.imgArr = []  #QQstarS:random
        self.imgArrScaleFactors = []  #MFH - for precalculated scale factors
        self.rotateDelay = self.engine.config.get(
            "game", "stage_rotate_delay"
        )  #myfingershurt - user defined stage rotate delay
        self.animateDelay = self.engine.config.get(
            "game", "stage_animate_delay"
        )  #myfingershurt - user defined stage rotate delay
        self.animation = False

        self.indexCount = 0  #QQstarS:random time counter
        self.arrNum = 0  #QQstarS:random the array num
        self.arrDir = 1  #forwards

        self.config.read(configFileName)

        # evilynux - Improved stage error handling
        self.themename = self.engine.data.themeLabel
        self.path = os.path.join("themes", self.themename, "backgrounds")
        self.pathfull = self.engine.getPath(self.path)
        if not os.path.exists(self.pathfull):  # evilynux
            Log.warn("Stage folder does not exist: %s" % self.pathfull)
            self.mode = 1  # Fallback to song-specific stage

        self.loadLayers(configFileName)
Beispiel #11
0
    def showTutorial(self):
        # evilynux - Make sure tutorial exists before launching
        tutorialpath = self.engine.tutorialFolder
        if not os.path.isdir(self.engine.resource.fileName(tutorialpath)):
            Log.debug("No folder found: %s" % tutorialpath)
            Dialogs.showMessage(self.engine, _("No tutorials found!"))
            return

        self.engine.startWorld(1, None, 0, 0, tutorial=True)

        self.launchLayer(lambda: Lobby(self.engine))
Beispiel #12
0
    def showTutorial(self):
        # evilynux - Make sure tutorial exists before launching
        tutorialpath = self.engine.tutorialFolder
        if not os.path.isdir(self.engine.resource.fileName(tutorialpath)):
            Log.debug("No folder found: %s" % tutorialpath)
            Dialogs.showMessage(self.engine, _("No tutorials found!"))
            return

        self.engine.startWorld(1, None, 0, 0, tutorial = True)

        self.launchLayer(lambda: Lobby(self.engine))
Beispiel #13
0
def loadControls():
    global controllerDict
    controllers = []
    allcontrollers = VFS.listdir(controlpath)
    default = ["defaultd.ini", "defaultg.ini", "defaultm.ini"]
    for name in allcontrollers:
        if name.lower().endswith(".ini") and len(name) > 4:
            if name in default:
                continue
            controllers.append(name[0:len(name)-4])

    i = len(controllers)
    controllerDict = dict([(str(controllers[n]),controllers[n]) for n in range(0, i)])
    controllerDict["defaultg"] = _("Default Guitar")
    controllerDict["defaultd"] = _("Default Drum")
    defMic = None
    if Microphone.supported:
        controllerDict["defaultm"] = _("Default Microphone")
        defMic = "defaultm"
    tsControl    = _("Controller %d")
    tsControlTip = _("Select the controller for slot %d")
    i = 1
    Config.define("game", "control0",           str,   "defaultg", text = tsControl % 1,                options = controllerDict, tipText = tsControlTip % 1)

    controllerDict[_("None")] = None

    Config.define("game", "control1",           str,   "defaultd", text = tsControl % 2,                options = controllerDict, tipText = tsControlTip % 2)
    Config.define("game", "control2",           str,   defMic,     text = tsControl % 3,                options = controllerDict, tipText = tsControlTip % 3)
    Config.define("game", "control3",           str,   None,       text = tsControl % 4,                options = controllerDict, tipText = tsControlTip % 4)
Beispiel #14
0
    def __init__(self, guitarScene, configFileName):
        self.scene            = guitarScene
        self.engine           = guitarScene.engine
        self.config           = LinedConfigParser()
        self.backgroundLayers = []
        self.foregroundLayers = []
        self.textures         = {}
        self.reset()


        self.wFull = None   #MFH - needed for new stage background handling
        self.hFull = None

        # evilynux - imported myfingershurt stuff from GuitarScene
        self.mode = self.engine.config.get("game", "stage_mode")
        self.songStage = self.engine.config.get("game", "song_stage")
        self.animatedFolder = self.engine.config.get("game", "animated_stage_folder")

        # evilynux - imported myfingershurt stuff from GuitarScene w/ minor modifs
        #MFH TODO - alter logic to accommodate separated animation and slideshow
        #           settings based on selected animated stage folder
        animationMode = self.engine.config.get("game", "stage_animate")
        slideShowMode = self.engine.config.get("game", "rotate_stages")

        if self.animatedFolder == _("None"):
            self.rotationMode = 0   #MFH: if no animated stage folders are available, disable rotation.
        elif self.animatedFolder == "Normal":
            self.rotationMode = slideShowMode
        else:
            self.rotationMode = animationMode

        self.imgArr = [] #QQstarS:random
        self.imgArrScaleFactors = []  #MFH - for precalculated scale factors
        self.rotateDelay = self.engine.config.get("game",  "stage_rotate_delay") #myfingershurt - user defined stage rotate delay
        self.animateDelay = self.engine.config.get("game",  "stage_animate_delay") #myfingershurt - user defined stage rotate delay
        self.animation = False

        self.indexCount = 0 #QQstarS:random time counter
        self.arrNum = 0 #QQstarS:random the array num
        self.arrDir = 1 #forwards

        self.config.read(configFileName)

        # evilynux - Improved stage error handling
        self.themename = self.engine.data.themeLabel
        self.path = os.path.join("themes",self.themename,"backgrounds")
        self.pathfull = self.engine.getPath(self.path)
        if not os.path.exists(self.pathfull): # evilynux
            Log.warn("Stage folder does not exist: %s" % self.pathfull)
            self.mode = 1 # Fallback to song-specific stage

        self.loadLayers(configFileName)
 def checkParts(self):
     info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)
     guitars = []
     drums = []
     vocals = []
     for part in info.parts:
         if part.id == 4 or part.id == 7:
             drums.append(part)
         elif part.id == 5:
             vocals.append(part)
         else:
             guitars.append(part)
     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."))
         return False
     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."))
         return False
     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."))
         return False
     return True
Beispiel #16
0
 def setGameName(self):
     if self.minPlayers > 1:
         if self.gameMode == 0:
             self.gameName = _("Face-Off")
         elif self.gameMode == 1:
             self.gameName = _("Pro Face-Off")
         elif self.gameMode == 2:
             self.gameName = _("Party Mode")
         elif self.gameMode == 3:
             self.gameName = _("FoFiX Co-Op Mode")
         elif self.gameMode == 4:
             self.gameName = _("RB Co-Op Mode")
         elif self.gameMode == 5:
             self.gameName = _("GH Co-Op Mode")
         elif self.gameMode == 6:
             self.gameName = _("Battle Mode")
     else:
         if self.gameMode == 0:
             self.gameName = _("Quickplay")
         elif self.gameMode == 1:
             self.gameName = _("Practice")
         elif self.gameMode == 2:
             self.gameName = _("Career Mode")
Beispiel #17
0
 def setGameName(self):
     if self.minPlayers > 1:
         if self.gameMode == 0:
             self.gameName = _("Face-Off")
         elif self.gameMode == 1:
             self.gameName = _("Pro Face-Off")
         elif self.gameMode == 2:
             self.gameName = _("Party Mode")
         elif self.gameMode == 3:
             self.gameName = _("FoFiX Co-Op Mode")
         elif self.gameMode == 4:
             self.gameName = _("RB Co-Op Mode")
         elif self.gameMode == 5:
             self.gameName = _("GH Co-Op Mode")
         elif self.gameMode == 6:
             self.gameName = _("Battle Mode")
     else:
         if self.gameMode == 0:
             self.gameName = _("Quickplay")
         elif self.gameMode == 1:
             self.gameName = _("Practice")
         elif self.gameMode == 2:
             self.gameName = _("Career Mode")
Beispiel #18
0
 def saveCharacter(self):
     pref = self.choices[0:8]
     pref.insert(7, self.neck)
     if len(self.choices[0]) > 0:
         if self.choices[0].lower() == "default":
             Dialogs.showMessage(self.engine, _("That is a terrible name. Choose something not 'default'"))
         elif self.choices[0].lower() not in self.invalidNames or self.choices[0] == self.player:
             Player.updatePlayer(self.player, pref)
             self.updatedName  = self.choices[0]
             if self.avatar is not None:
                 shutil.copy(self.engine.resource.fileName(self.avatar),os.path.join(self.engine.data.path,"users","players",self.choices[0]+".png"))
             if self.oldName:
                 if os.path.exists(self.engine.resource.fileName(os.path.join("users","players",self.oldName+".png"))) and self.oldName != self.choices[0]:
                     if self.avatar is None:
                         os.rename(self.engine.resource.fileName(os.path.join("users","players",self.oldName+".png")), os.path.join(self.engine.data.path,"users","players",self.choices[0]+".png"))
                     else:
                         os.remove(self.engine.resource.fileName(os.path.join("users","players",self.oldName+".png")))
             self.engine.view.popLayer(self)
             self.engine.input.removeKeyListener(self)
         else:
             Dialogs.showMessage(self.engine, _("That name already exists!"))
     else:
         Dialogs.showMessage(self.engine, _("Please enter a name!"))
Beispiel #19
0
def setNewKeyMapping(engine, config, section, option, key):
    oldKey = config.get(section, option)
    config.set(section, option, key)
    keyCheckerMode = Config.get("game", "key_checker_mode")
    if key == "None" or key is None:
        return True
    b = isKeyMappingOK(config, option)
    if b != 0:
        if keyCheckerMode > 0:
            from views import Dialogs
            Dialogs.showMessage(engine, _("This key conflicts with the following keys: %s") % str(b))
        if keyCheckerMode == 2:   #enforce no conflicts!
            config.set(section, option, oldKey)
        return False
    return True
Beispiel #20
0
 def resolutionReset(self):
     Log.warn("Video setup failed. Trying default windowed resolution.")
     self.error.append(
         _("Video setup failed with your resolution settings, and so were reset to defaults."
           ))
     if self.fullscreen:
         self.flags ^= pygame.FULLSCREEN
         self.fullscreen = False
     try:
         self.screen = pygame.display.set_mode((800, 600), self.flags)
         self.default = True
     except Exception:
         if self.multisamples:
             self.multisampleReset((800, 600))
         else:
             self.screenError()
Beispiel #21
0
    def checkMapping(self, newDict, i):
        def keyName(value):
            if value in CONTROL1:
                name = "Controller 1"
                control = CONTROL1
                n = 0
            elif value in CONTROL2:
                name = "Controller 2"
                control = CONTROL2
                n = 1
            elif value in CONTROL3:
                name = "Controller 3"
                control = CONTROL3
                n = 2
            else:
                name = "Controller 4"
                control = CONTROL4
                n = 3
            for j in range(20):
                if value == control[j]:
                    if self.type[n] == 2:
                        return name + " " + drumkey4names[j]
                    elif self.type[n] == 3:
                        return name + " " + drumkey5names[j]
                    else:
                        return name + " " + guitarkeynames[j]
            else:
                Log.notice("Key value not found.")
                return "Error"

        if self.keyCheckerMode == 0:
            return newDict
        okconflict = lefts + rights + ups + downs + starts + cancels
        a = []
        for key, value in newDict.iteritems():
            if key == "None":
                continue
            if key in self.controlMapping.keys():
                if value in okconflict:
                    if self.getMapping(key) in okconflict:
                        continue
                a.append(_("%s conflicts with %s") % (keyName(value), keyName(self.getMapping(key))))
        if len(a) == 0:
            return newDict
        self.overlap.extend(a)
        return newDict
Beispiel #22
0
 def render(self, visibility, topMost):
     try:
         font = self.engine.data.fontDict[self.engine.theme.characterCreateOptionFont]
         helpFont = self.engine.data.fontDict[self.engine.theme.characterCreateHelpFont]
     except KeyError:
         font = self.engine.data.font
         helpFont = self.engine.data.loadingFont
     with self.engine.view.orthogonalProjection(normalize = True):
         v = ((1 - visibility) **2)
         w, h = self.fullView
         if self.img_creator:
             drawImage(self.img_creator, scale = (1.0, -1.0), coord = (w/2,h/2), stretched = FULL_SCREEN)
         helpFont.render(_("Player %d") % (self.playerNum + 1), pos = (.5, .1), scale = self.engine.theme.characterCreateScale, align = 1)
         for i, option in enumerate(self.options):
             r, g, b = self.engine.theme.characterCreateHelpColor
             glColor3f(r, g, b)
             cursor = ""
             if self.selected == i:
                 wText, hText = helpFont.getStringSize(option[1], scale = self.engine.theme.characterCreateScale)
                 helpFont.render(option[1], (self.engine.theme.characterCreateHelpX-(wText/2), self.engine.theme.characterCreateHelpY-hText), scale = self.engine.theme.characterCreateHelpScale)
                 r, g, b = self.engine.theme.characterCreateSelectColor
                 glColor3f(r, g, b)
                 cursor = self.cursor
             else:
                 r, g, b = self.engine.theme.characterCreateFontColor
                 glColor3f(r, g, b)
             wText, hText = font.getStringSize(option[0], scale = self.engine.theme.characterCreateScale)
             font.render(option[0], (self.engine.theme.characterCreateX, self.engine.theme.characterCreateY+self.engine.theme.characterCreateSpace*i), scale = self.engine.theme.characterCreateScale)
             if self.active and self.selected == i:
                 self.engine.theme.setSelectedColor(1-v)
             if i == 0 or i > 6:
                 wText, hText = font.getStringSize(self.choices[i], scale = self.engine.theme.characterCreateScale)
                 font.render(self.choices[i]+cursor, (self.engine.theme.characterCreateOptionX-wText, self.engine.theme.characterCreateY+self.engine.theme.characterCreateSpace*i), scale = self.engine.theme.characterCreateScale)
             else:
                 if i == self.selected:
                     str = "< %s >" % self.values[i-1][self.choices[i]]
                 else:
                     str = self.values[i-1][self.choices[i]]
                 wText, hText = font.getStringSize(str, scale = self.engine.theme.characterCreateScale)
                 font.render(str, (self.engine.theme.characterCreateOptionX-wText, self.engine.theme.characterCreateY+self.engine.theme.characterCreateSpace*i), scale = self.engine.theme.characterCreateScale)
         if self.img_creator_top:
             drawImage(self.img_creator_top, scale = (1.0, -1.0), coord = (w/2,h/2), stretched = FULL_SCREEN)
    def loadItemLabel(self, i, preload = False):
        # Load the item label if it isn't yet loaded
        item = self.items[i]
        if self.itemLabels[i] is None:
            if isinstance(item, Song.SongInfo):
                if self.labelType == 1: #CD covers
                    f = "label.png"
                else:
                    f = "album.png"
                if self.texturedLabels:
                    label = self.engine.resource.fileName(item.libraryNam, item.songName, f)
                    if os.path.exists(label):
                        self.itemLabels[i] = Texture(label)
                    else:
                        self.itemLabels[i] = False
                else:
                    self.itemLabels[i] = self.engine.loadImgDrawing(None, "label", os.path.join(item.libraryNam, item.songName, f))

            elif isinstance(item, Song.LibraryInfo):
                if self.texturedLabels:
                    label = self.engine.resource.fileName(item.libraryName, "label.png")
                    if os.path.exists(label):
                        self.itemLabels[i] = Texture(label)
                    else:
                        self.itemLabels[i] = False
                else:
                    self.itemLabels[i] = self.engine.loadImgDrawing(None, "label", os.path.join(item.libraryName, "label.png"))
            elif isinstance(item, Song.RandomSongInfo):
                self.itemLabels[i] = "Random"
            else:
                return
            if preload:
                if time.time() - self.loadStartTime > 3:
                    self.loadStartTime = time.time()
                    percent = (i*100)/len(self.items)
                    Dialogs.changeLoadingSplashScreenText(self.engine, self.splash, _("Loading Album Artwork...") + " %d%%" % percent)
    def __init__(self, engine, libraryName = None, songName = None):
        Scene.__init__(self, engine)

        self.engine.world.sceneName = "SongChoosingScene"

        Song.updateSongDatabase(self.engine)

        self.wizardStarted = False
        self.libraryName   = libraryName
        self.songName      = songName
        if not self.libraryName:
            self.libraryName = self.engine.config.get("setlist", "selected_library")
            if not self.libraryName:
                self.libraryName = Song.DEFAULT_LIBRARY
        if not self.songName:
            self.songName = self.engine.config.get("setlist", "selected_song")
        self.gameMode = self.engine.world.gameMode
        self.careerMode = (self.gameMode == CAREER)
        self.practiceMode = (self.gameMode == PRACTICE)
        self.gameMode2p = self.engine.world.multiMode
        self.autoPreview = not self.engine.config.get("audio", "disable_preview")
        self.sortOrder   = self.engine.config.get("game", "sort_order")
        self.tut = self.engine.world.tutorial
        self.playerList  = self.players

        self.gameStarted = False

        self.gamePlayers = len(self.playerList)
        self.parts = [None for i in self.playerList]
        self.diffs = [None for i in self.playerList]

        self.time       = 0
        self.lastTime   = 0
        self.mode       = 0
        self.moreInfo   = False
        self.moreInfoTime = 0
        self.miniLobbyTime = 0
        self.selected   = 0
        self.camera     = Camera()
        self.cameraOffset = 0.0
        self.song       = None
        self.songLoader = None
        self.loaded     = False
        text            = _("Initializing Setlist...")
        if self.engine.cmdPlay == 2:
            text = _("Checking Command-Line Settings...")
        elif len(self.engine.world.songQueue) > 0:
            text = _("Checking Setlist Settings...")
        elif len(self.engine.world.songQueue) == 0:
            self.engine.world.playingQueue = False
        self.splash     = Dialogs.showLoadingSplashScreen(self.engine, text)
        self.items      = []
        self.cmdPlay    = False
        self.queued     = True

        self.loadStartTime = time.time()

        if self.tut == True:
            self.library = self.engine.tutorialFolder
        else:
            self.library    = os.path.join(self.engine.config.get("setlist", "base_library"), self.libraryName)
            if not os.path.isdir(self.engine.resource.fileName(self.library)):
                self.library = self.engine.resource.fileName(os.path.join(self.engine.config.get("setlist", "base_library"), Song.DEFAULT_LIBRARY))

        self.searchText = ""

        #user configurables and input management
        self.listingMode       = 0     #with libraries or List All
        self.preloadSongLabels = False
        self.showCareerTiers   = 1+(self.careerMode and 1 or 0) #0-Never; 1-Career Only; 2-Always
        self.scrolling        = 0
        self.scrollDelay      = self.engine.config.get("game", "scroll_delay")
        self.scrollRate       = self.engine.config.get("game", "scroll_rate")
        self.scrollTime       = 0
        self.scroller         = [lambda: None, self.scrollUp, self.scrollDown]
        self.scoreDifficulty  = Song.difficulties[self.engine.config.get("game", "songlist_difficulty")]
        self.scorePart        = Song.parts[self.engine.config.get("game", "songlist_instrument")]
        self.sortOrder        = self.engine.config.get("game", "sort_order")
        self.queueFormat      = self.engine.config.get("game", "queue_format")
        self.queueOrder       = self.engine.config.get("game", "queue_order")
        self.queueParts       = self.engine.config.get("game", "queue_parts")
        self.queueDiffs       = self.engine.config.get("game", "queue_diff")
        self.nilShowNextScore = self.engine.config.get("songlist",  "nil_show_next_score")

        #theme information
        self.themename = self.engine.data.themeLabel
        self.theme = self.engine.data.theme

        #theme configurables
        self.setlistStyle      = self.engine.theme.setlist.setlistStyle    #0 = Normal; 1 = List; 2 = Circular
        self.headerSkip        = self.engine.theme.setlist.headerSkip      #items taken up by header (non-static only)
        self.footerSkip        = self.engine.theme.setlist.footerSkip      #items taken up by footer (non-static only)
        self.itemSize          = self.engine.theme.setlist.itemSize        #delta (X, Y) (0..1) for each item (non-static only)
        self.labelType         = self.engine.theme.setlist.labelType       #Album covers (0) or CD labels (1)
        self.labelDistance     = self.engine.theme.setlist.labelDistance   #number of labels away to preload
        self.showMoreLabels    = self.engine.theme.setlist.showMoreLabels  #whether or not additional unselected labels are rendered on-screen
        self.texturedLabels    = self.engine.theme.setlist.texturedLabels  #render the art as a texture?
        self.itemsPerPage      = self.engine.theme.setlist.itemsPerPage    #number of items to show on screen
        self.followItemPos     = (self.itemsPerPage+1)/2
        self.showLockedSongs   = self.engine.theme.setlist.showLockedSongs #whether or not to even show locked songs
        self.showSortTiers     = self.engine.theme.setlist.showSortTiers   #whether or not to show sorting tiers - career tiers take precedence.
        self.selectTiers       = self.engine.theme.setlist.selectTiers     #whether or not tiers should be selectable as a quick setlist.

        if self.engine.cmdPlay == 2:
            self.songName = Config.get("setlist", "selected_song")
            self.libraryName = Config.get("setlist", "selected_library")
            self.cmdPlay = self.checkCmdPlay()
            if self.cmdPlay:
                Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
                return
        elif len(self.engine.world.songQueue) > 0:
            Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
            return

        #variables for setlist management (Not that this is necessary here - just to see what exists.)
        self.songLoader       = None #preview handling
        self.tiersPresent     = False
        self.startingSelected = self.songName
        self.selectedIndex    = 0
        self.selectedItem     = None
        self.selectedOffset   = 0.0
        self.previewDelay     = 1000
        self.previewLoaded    = False
        self.itemRenderAngles = [0.0]
        self.itemLabels       = [None]
        self.xPos             = 0
        self.yPos             = 0
        self.pos              = 0

        self.infoPage         = 0

        self.menu_force_reload   = False
        self.menu_text_color     = (1, 1, 1)
        self.menu_selected_color = (.66, .66, 0)
        self.menu_text_pos       = (.2, .31)
        self.menu = Menu(self.engine, [ConfigChoice(self.engine, self.engine.config, "game", "queue_format", autoApply = True),
                                       ConfigChoice(self.engine, self.engine.config, "game", "queue_order", autoApply = True),
                                       ConfigChoice(self.engine, self.engine.config, "game", "queue_parts", autoApply = True),
                                       ConfigChoice(self.engine, self.engine.config, "game", "queue_diff", autoApply = True),
                                       ActiveConfigChoice(self.engine, self.engine.config, "game", "sort_order", onChange = self.forceReload),
                                       ActiveConfigChoice(self.engine, self.engine.config, "game", "sort_direction", onChange = self.forceReload),
                                       ActiveConfigChoice(self.engine, self.engine.config, "game", "songlist_instrument", onChange = self.forceReload),
                                       ActiveConfigChoice(self.engine, self.engine.config, "game", "songlist_difficulty", onChange = self.forceReload),
                                       ], name = "setlist", fadeScreen = False, onClose = self.resetQueueVars, font = self.engine.data.pauseFont, \
                         pos = self.menu_text_pos, textColor = self.menu_text_color, selectedColor = self.menu_selected_color)

        #now, load the first library
        self.loadLibrary()

        #load the images
        self.loadImages()
 def checkCmdPlay(self):
     info = Song.loadSongInfo(self.engine, self.songName, library = self.libraryName)
     guitars = []
     drums = []
     vocals = []
     autoPart = None
     for part in info.parts:
         if part.id == 4 or part.id == 7:
             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:
             if self.splash:
                 Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
                 self.splash = None
             Dialogs.showMessage(self.engine, _("There are no drum parts in this song. Change your controllers to play."))
             if self.engine.cmdPlay == 2:
                 self.engine.cmdPlay = 0
                 return False
         if len(guitars) == 0 and self.engine.input.gameGuitars > 0:
             if self.splash:
                 Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
                 self.splash = None
             Dialogs.showMessage(self.engine, _("There are no guitar parts in this song. Change your controllers to play."))
             if self.engine.cmdPlay == 2:
                 self.engine.cmdPlay = 0
                 return False
         if len(vocals) == 0 and self.engine.input.gameMics > 0:
             if self.splash:
                 Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
                 self.splash = None
             Dialogs.showMessage(self.engine, _("There are no vocal parts in this song. Change your controllers to play."))
             if self.engine.cmdPlay == 2:
                 self.engine.cmdPlay = 0
                 return False
     # Make sure the difficulty we chose is available
     p = self.playerList[0].part
     player = self.playerList[0]
     if self.engine.cmdDiff is not None:
         diff = Song.difficulties[self.engine.cmdDiff]
         if diff in info.partDifficulties[p.id]:
             self.playerList[0].difficulty = diff
         else:
             self.playerList[0].difficulty = info.partDifficulties[p.id][0]
     else:
         if self.splash:
             Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
             self.splash = None
         self.playerList[0].difficulty = Dialogs.chooseItem(self.engine, info.partDifficulties[p.id],
                               "%s \n %s" % (Song.removeSongOrderPrefixFromName(info.name), _("%s Choose a difficulty:") % player.name), selected = player.difficulty)
     return True
    def prepareSetlist(self, songs):
        if self.songLoader:
            self.songLoader.stop()
        msg = self.engine.setlistMsg
        self.engine.setlistMsg = None
        self.selectedIndex = 0
        if self.listingMode == 0 or self.careerMode:
            self.items = self.libraries + self.songs
        else:
            self.items = self.songs
        self.itemRenderAngles = [0.0]  * len(self.items)
        self.itemLabels       = [None] * len(self.items)
        self.searching        = False
        self.searchText       = ""

        shownItems = []
        for item in self.items: #remove things we don't want to see. Some redundancy, but that's okay.
            if isinstance(item, Song.TitleInfo) or isinstance(item, Song.SortTitleInfo):
                if self.showCareerTiers == 2:
                    if isinstance(item, Song.TitleInfo):
                        if len(shownItems) > 0:
                            if isinstance(shownItems[-1], Song.TitleInfo):
                                shownItems.pop()
                        shownItems.append(item)
                    elif isinstance(item, Song.SortTitleInfo):
                        continue
                else:
                    if isinstance(item, Song.TitleInfo):
                        continue
                    elif isinstance(item, Song.SortTitleInfo):
                        if not self.showSortTiers:
                            continue
                        if len(shownItems) > 0:
                            if isinstance(shownItems[-1], Song.SortTitleInfo):
                                shownItems.pop()
                        shownItems.append(item)
            elif isinstance(item, Song.SongInfo):
                if self.careerMode and (not self.showLockedSongs) and item.getLocked():
                    continue
                else:
                    shownItems.append(item)
            else:
                shownItems.append(item)
        if len(shownItems) > 0:
            if isinstance(shownItems[-1], Song.TitleInfo) or isinstance(shownItems[-1], Song.SortTitleInfo):
                shownItems.pop()

        if len(self.items) > 0 and len(shownItems) == 0:
            msg = _("No songs in this setlist are available to play!")
            if self.careerMode:
                msg = msg + " " + _("Make sure you have a working career pack!")
            Dialogs.showMessage(self.engine, msg)
        elif len(shownItems) > 0:
            for item in shownItems:
                if isinstance(item, Song.SongInfo) or isinstance(item, Song.LibraryInfo):
                    self.items = shownItems #make sure at least one item is selectable
                    break
            else:
                msg = _("No songs in this setlist are available to play!")
                if self.careerMode:
                    msg = msg + " " + _("Make sure you have a working career pack!")
                Dialogs.showMessage(self.engine, msg)
                self.items = []

        if self.items == []:    #MFH: Catch when there ain't a damn thing in the current folder - back out!
            if self.library != Song.DEFAULT_LIBRARY:
                Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
                self.splash = None
                self.startingSelected = self.library
                self.library     = os.path.dirname(self.library)
                self.selectedItem = None
                self.loadLibrary()
                return

        Log.debug("Setlist loaded.")

        self.loaded           = True

        if self.setlistStyle == 1:
            for i in range(self.headerSkip):
                self.items.insert(0, Song.BlankSpaceInfo())
            for i in range(self.footerSkip):
                self.items.append(Song.BlankSpaceInfo())

        if self.startingSelected is not None:
            for i, item in enumerate(self.items):
                if isinstance(item, Song.SongInfo) and self.startingSelected == item.songName: #TODO: SongDB
                    self.selectedIndex =  i
                    break
                elif isinstance(item, Song.LibraryInfo) and self.startingSelected == item.libraryName:
                    self.selectedIndex =  i
                    break

        for item in self.items:
            if isinstance(item, Song.SongInfo):
                item.name = Song.removeSongOrderPrefixFromName(item.name) #TODO: I don't like this.
            elif not self.tiersPresent and (isinstance(item, Song.TitleInfo) or isinstance(item, Song.SortTitleInfo)):
                self.tiersPresent = True

        while isinstance(self.items[self.selectedIndex], Song.BlankSpaceInfo) or ((isinstance(self.items[self.selectedIndex], Song.TitleInfo) or isinstance(self.items[self.selectedIndex], Song.SortTitleInfo)) and not self.selectTiers):
            self.selectedIndex += 1
            if self.selectedIndex >= len(self.items):
                self.selectedIndex = 0

        self.itemRenderAngles = [0.0]  * len(self.items)
        self.itemLabels       = [None] * len(self.items)

        if self.preloadSongLabels:
            for i in range(len(self.items)):
                self.loadStartTime = time.time()
                Dialogs.changeLoadingSplashScreenText(self.engine, self.splash, _("Loading Album Artwork..."))
                self.loadItemLabel(i, preload = True)

        self.updateSelection()
        Dialogs.hideLoadingSplashScreen(self.engine, self.splash)
        self.splash = None
 def progressCallback(self, percent):
     if time.time() - self.loadStartTime > 7:
         Dialogs.changeLoadingSplashScreenText(self.engine, self.splash, _("Browsing Collection...") + ' (%d%%)' % (percent*100))
Beispiel #28
0
    def __init__(self, engine):
        self.engine = engine

        self.logClassInits = Config.get("game", "log_class_inits")
        if self.logClassInits == 1:
            Log.debug("MainMenu class init (MainMenu.py)...")

        self.time = 0.0
        self.nextLayer = None
        self.visibility = 0.0
        self.active = False

        self.showStartupMessages = False

        self.gfxVersionTag = Config.get("game", "gfx_version_tag")

        self.chosenNeck = Config.get("game", "default_neck")
        exists = 0

        if engine.loadImgDrawing(
                self, "ok", os.path.join("necks", self.chosenNeck + ".png")):
            exists = 1
        elif engine.loadImgDrawing(
                self, "ok",
                os.path.join("necks", "Neck_" + self.chosenNeck + ".png")):
            exists = 1

        #MFH - fallback logic now supports a couple valid default neck filenames
        #MFH - check for Neck_1
        if exists == 0:
            if engine.loadImgDrawing(self, "ok",
                                     os.path.join("necks", "Neck_1.png")):
                Config.set("game", "default_neck", "1")
                Log.warn(
                    "Default chosen neck not valid; fallback Neck_1.png forced."
                )
                exists = 1

        #MFH - check for defaultneck
        if exists == 0:
            if engine.loadImgDrawing(self, "ok",
                                     os.path.join("necks", "defaultneck.png")):
                Log.warn(
                    "Default chosen neck not valid; fallback defaultneck.png forced."
                )
                Config.set("game", "default_neck", "defaultneck")
                exists = 1
            else:
                Log.error(
                    "Default chosen neck not valid; fallbacks Neck_1.png and defaultneck.png also not valid!"
                )

        #Get theme
        self.theme = self.engine.data.theme
        self.themeCoOp = self.engine.data.themeCoOp
        self.themename = self.engine.data.themeLabel
        self.useSoloMenu = self.engine.theme.use_solo_submenu

        allowMic = True

        self.menux = self.engine.theme.menuPos[0]
        self.menuy = self.engine.theme.menuPos[1]

        self.rbmenu = self.engine.theme.menuRB

        #MFH
        self.main_menu_scale = self.engine.theme.main_menu_scaleVar
        self.main_menu_vspacing = self.engine.theme.main_menu_vspacingVar

        if not self.engine.loadImgDrawing(
                self, "background",
                os.path.join("themes", self.themename, "menu", "mainbg.png")):
            self.background = None
        self.engine.loadImgDrawing(
            self, "BGText",
            os.path.join("themes", self.themename, "menu", "maintext.png"))
        self.engine.loadImgDrawing(
            self, "optionsBG",
            os.path.join("themes", self.themename, "menu", "optionsbg.png"))
        self.engine.loadImgDrawing(
            self, "optionsPanel",
            os.path.join("themes", self.themename, "menu", "optionspanel.png"))

        #racer: added version tag
        if self.gfxVersionTag or self.engine.theme.versiontag == True:
            if not self.engine.loadImgDrawing(
                    self, "version",
                    os.path.join("themes", self.themename, "menu",
                                 "versiontag.png")):
                if not self.engine.loadImgDrawing(
                        self, "version", "versiontag.png"
                ):  #falls back on default versiontag.png in data\ folder
                    self.version = None
        else:
            self.version = None

        #myfingershurt: random main menu music function, menu.ogg and menuXX.ogg (any filename with "menu" as the first 4 letters)
        self.files = None
        filepath = self.engine.getPath(
            os.path.join("themes", self.themename, "sounds"))
        if os.path.isdir(filepath):
            self.files = []
            allfiles = os.listdir(filepath)
            for name in allfiles:
                if os.path.splitext(name)[1] == ".ogg":
                    if string.find(name, "menu") > -1:
                        self.files.append(name)

        if self.files:
            i = random.randint(0, len(self.files) - 1)
            filename = self.files[i]
            sound = os.path.join("themes", self.themename, "sounds", filename)
            self.menumusic = True
            engine.menuMusic = True

            self.song = Audio.Music(self.engine.resource.fileName(sound))
            self.song.setVolume(self.engine.config.get("audio", "menu_volume"))
            self.song.play(0)  #no loop
        else:
            self.menumusic = False

        self.opt_text_color = self.engine.theme.opt_text_colorVar
        self.opt_selected_color = self.engine.theme.opt_selected_colorVar

        trainingMenu = [
            (_("Tutorials"), self.showTutorial),
            (_("Practice"), lambda: self.newLocalGame(mode1p=1)),
        ]

        self.opt_bkg_size = [float(i) for i in self.engine.theme.opt_bkg_size]
        self.opt_text_color = self.engine.theme.hexToColor(
            self.engine.theme.opt_text_colorVar)
        self.opt_selected_color = self.engine.theme.hexToColor(
            self.engine.theme.opt_selected_colorVar)

        if self.BGText:
            strCareer = ""
            strQuickplay = ""
            strSolo = ""
            strMultiplayer = ""
            strTraining = ""
            strSettings = ""
            strQuit = ""
        else:
            strCareer = "Career"
            strQuickplay = "Quickplay"
            strSolo = "Solo"
            strMultiplayer = "Multiplayer"
            strTraining = "Training"
            strSettings = "Settings"
            strQuit = "Quit"

        multPlayerMenu = [
            (_("Face-Off"),
             lambda: self.newLocalGame(players=2, maxplayers=4)),
            (_("Pro Face-Off"),
             lambda: self.newLocalGame(players=2, mode2p=1, maxplayers=4)),
            (_("Party Mode"), lambda: self.newLocalGame(mode2p=2)),
            (_("FoFiX Co-Op"), lambda: self.newLocalGame(
                players=2, mode2p=3, maxplayers=4, allowMic=allowMic)),
            (_("RB Co-Op"), lambda: self.newLocalGame(
                players=2, mode2p=4, maxplayers=4, allowMic=allowMic)),
            (_("GH Co-Op"),
             lambda: self.newLocalGame(players=2, mode2p=5, maxplayers=4)),
            (_("GH Battle"),
             lambda: self.newLocalGame(players=2, mode2p=6, allowDrum=False)
             ),  #akedrou- so you can block drums
        ]

        if not self.useSoloMenu:

            mainMenu = [
                (strCareer,
                 lambda: self.newLocalGame(mode1p=2, allowMic=allowMic)),
                (strQuickplay, lambda: self.newLocalGame(allowMic=allowMic)),
                ((strMultiplayer, "multiplayer"), multPlayerMenu),
                ((strTraining, "training"), trainingMenu),
                ((strSettings, "settings"), self.settingsMenu),
                (strQuit, self.quit),
            ]

        else:

            soloMenu = [
                (_("Solo Tour"),
                 lambda: self.newLocalGame(mode1p=2, allowMic=allowMic)),
                (_("Quickplay"), lambda: self.newLocalGame(allowMic=allowMic)),
            ]

            mainMenu = [
                ((strSolo, "solo"), soloMenu),
                ((strMultiplayer, "multiplayer"), multPlayerMenu),
                ((strTraining, "training"), trainingMenu),
                ((strSettings, "settings"), self.settingsMenu),
                (strQuit, self.quit),
            ]

        w, h, = self.engine.view.geometry[2:4]

        self.menu = Menu(self.engine,
                         mainMenu,
                         onClose=lambda: self.engine.view.popLayer(self),
                         pos=(self.menux, .75 - (.75 * self.menuy)))

        engine.mainMenu = self  #Points engine.mainMenu to the one and only MainMenu object instance

        ## whether the main menu has come into view at least once
        self.shownOnce = False
Beispiel #29
0
i = len(themes)
if i == 0:
    if os.name == 'posix':
        Log.error("No valid theme found!\n"+\
                  "Make sure theme files are properly cased "+\
                  "e.g. notes.png works, Notes.png doesn't\n")
    else:
        Log.error("No valid theme found!")
    sys.exit(1);

if defaultTheme is None:
    defaultTheme = themes[0]    #myfingershurt

#myfingershurt: default theme must be an existing one!
Config.define("coffee", "themename",           str,   defaultTheme,      text = _("Theme"),                options = dict([(str(themes[n]),themes[n]) for n in range(0, i)]), tipText = _("Sets the overall graphical feel of the game. You can find and download many more at fretsonfire.net"))

##Alarian: End Get unlimited themes by foldername
Player.loadControls()



class FullScreenSwitcher(KeyListener):
    """
    A keyboard listener that looks for special built-in key combinations,
    such as the fullscreen toggle (Alt-Enter).
    """
    def __init__(self, engine):
        self.engine = engine
        self.altStatus = False
Beispiel #30
0
    def __init__(self, engine):
        if not engine.world:
            raise WorldNotStarted
        self.engine         = engine
        self.minPlayers     = self.engine.world.minPlayers
        self.maxPlayers     = self.engine.world.maxPlayers
        self.tutorial       = self.engine.world.tutorial
        self.gameMode       = self.engine.world.gameMode
        self.multiMode      = self.engine.world.multiMode
        self.time           = 0.0
        self.keyControl     = 0
        self.keyGrab        = False
        self.scrolling      = [0,0,0,0]
        self.rate           = [0,0,0,0]
        self.delay          = [0,0,0,0]
        self.scroller       = [0, self.scrollUp, self.scrollDown]
        self.gameStarted    = False
        self.done           = True
        self.active         = False
        self.blockedItems   = [1]
        self.selectedItems  = []
        self.blockedPlayers = []
        self.selectedPlayers = []
        self.playerList     = [None for i in range(4)]
        self.fullView     = self.engine.view.geometry[2:4]
        self.music        = True
        self.creator      = CreateCharacter(self.engine)

        #key vars
        self.fontDict         = self.engine.data.fontDict
        self.geometry         = self.engine.view.geometry[2:4]
        self.fontScreenBottom = self.engine.data.fontScreenBottom
        self.aspectRatio      = self.engine.view.aspectRatio
        self.drawStarScore    = self.engine.drawStarScore

        self.gameModeText = self.engine.world.gameName

        self.yes        = []
        self.no         = []
        self.conf       = []
        self.up         = []
        self.down       = []
        self.controls   = [j for j in self.engine.input.controls.controls]
        self.types      = []
        self.allowed    = [True for i in range(4)]
        for i, type in enumerate(self.engine.input.controls.type):
            self.types.append(type)
            if type in GUITARTYPES:
                if not self.engine.world.allowGuitar:
                    self.allowed[i] = False
                else:
                    self.yes.extend([Player.CONTROLS[i][Player.KEY1], Player.CONTROLS[i][Player.KEY1A], Player.CONTROLS[i][Player.START]])
                    self.no.extend([Player.CONTROLS[i][Player.KEY2], Player.CONTROLS[i][Player.KEY2A], Player.CONTROLS[i][Player.CANCEL]])
                    self.conf.extend([Player.CONTROLS[i][Player.KEY3], Player.CONTROLS[i][Player.KEY3A]])
                    self.up.extend([Player.CONTROLS[i][Player.ACTION1], Player.CONTROLS[i][Player.UP]])
                    self.down.extend([Player.CONTROLS[i][Player.ACTION2], Player.CONTROLS[i][Player.DOWN]])
            elif type in DRUMTYPES:
                if not self.engine.world.allowDrum:
                    self.allowed[i] = False
                else:
                    self.yes.extend([Player.CONTROLS[i][Player.DRUM5], Player.CONTROLS[i][Player.DRUM5A], Player.CONTROLS[i][Player.START]])
                    self.no.extend([Player.CONTROLS[i][Player.DRUM1], Player.CONTROLS[i][Player.DRUM1A], Player.CONTROLS[i][Player.CANCEL]])
                    self.conf.extend([Player.CONTROLS[i][Player.DRUMBASS], Player.CONTROLS[i][Player.DRUMBASSA]])
                    self.up.extend([Player.CONTROLS[i][Player.DRUM2], Player.CONTROLS[i][Player.DRUM2A], Player.CONTROLS[i][Player.UP]])
                    self.down.extend([Player.CONTROLS[i][Player.DRUM3], Player.CONTROLS[i][Player.DRUM3A], Player.CONTROLS[i][Player.DOWN]])
            elif type in MICTYPES:
                if not self.engine.world.allowMic:
                    self.allowed[i] = False
                else:
                    self.yes.extend([Player.CONTROLS[i][Player.START]])
                    self.no.extend([Player.CONTROLS[i][Player.CANCEL]])
                    self.up.extend([Player.CONTROLS[i][Player.UP]])
                    self.down.extend([Player.CONTROLS[i][Player.DOWN]])

        for i, control in enumerate(self.engine.input.controls.controls):
            if control == "None":
                self.controls[i] = _("No Controller")
                self.blockedPlayers.append(i)
            elif self.allowed[i] == False:
                self.controls[i] = _("Disabled Controller")
                self.blockedPlayers.append(i)
            elif control == "defaultg":
                self.controls[i] = _("Default Guitar")
            elif control == "defaultd":
                self.controls[i] = _("Default Drums")
            elif control == "defaultm":
                self.controls[i] = _("Default Microphone")

        if 4 - len(self.blockedPlayers) < self.minPlayers:
            Dialogs.showMessage(self.engine, _("Your controls are not properly set up for this mode. Please check your settings."))
            #FIXME: Go back to the main menu (or the control menu) without screwing up the layers.
        self.engine.input.activeGameControls = [i for i in range(4) if i not in self.blockedPlayers]
        self.engine.input.pluginControls()
        self.panelOrder = range(4)
        self.oldOrder   = range(4)

        themename  = self.engine.data.themeLabel
        self.theme = self.engine.theme

        self.engine.data.loadAllImages(self, os.path.join("themes",themename,"lobby"))
        self.partImages     = self.engine.data.partImages

        if not self.img_default_av:
            self.engine.data.loadImgDrawing(self, "img_default_av", os.path.join("users", "players", "default.png"))
        if not self.img_newchar_av:
            self.engine.data.loadImgDrawing(self, "img_newchar_av", os.path.join("users", "players", "newchar_av.png"))

        if self.img_default_av:
            imgheight = self.img_default_av.height1()
            imgwidth  = self.img_default_av.width1()
            hFactor = self.theme.lobbyPanelAvatarDimension[1]/imgheight
            wFactor = self.theme.lobbyPanelAvatarDimension[0]/imgwidth
            self.defaultAvScale = min(hFactor, wFactor)
        if self.img_newchar_av:
            imgheight = self.img_newchar_av.height1()
            imgwidth  = self.img_newchar_av.width1()
            hFactor = self.theme.lobbyPanelAvatarDimension[1]/imgheight
            wFactor = self.theme.lobbyPanelAvatarDimension[0]/imgwidth
            self.newCharAvScale = min(hFactor, wFactor)

        self.tsChooseChar = _("Choose Your Character")
        self.tsPlayerStr  = _("Player %d")
        self.playerNum  = 0
        self.tsDrumFlip = (_("Regular Drums"), _("Flipped Drums"))
        self.tsAutoKick = (_("Pedal-Using"), _("Footless"))
        self.tsAssist   = (_("Assist Mode Off"), _("Easy Assist"), _("Medium Assist"))
        self.tsTwoChord = (_("Chordmaster"), _("Two Notes Max"))
        self.tsInfo     = _("Information:")
        self.tsList     = [("0","1"), self.tsDrumFlip, self.tsAutoKick, self.tsAssist, self.tsTwoChord]

        self.controlDict = Player.controlDict
        self.selected = [0,0,0,0]
        self.panelMode = [0,0,0,0] #panel mode: 0 = select; 1 = create/edit
        self.screenOptions = self.engine.theme.lobbySelectLength
        self.pos = [(0, self.screenOptions), (0, self.screenOptions), (0, self.screenOptions), (0, self.screenOptions)]
        self.getPlayers()
Beispiel #31
0
 def getAvailableMics():
     return {-1: _('[Microphones not supported]')}
Beispiel #32
0
 def getAvailableMics():
     return {-1: _('[Microphones not supported]')}
Beispiel #33
0
CONTROLLER1DRUMS = [CONTROL1[DRUM1], CONTROL1[DRUM1A], CONTROL1[DRUM2], CONTROL1[DRUM2A], CONTROL1[DRUM3], CONTROL1[DRUM3A], CONTROL1[DRUM4], CONTROL1[DRUM4A], CONTROL1[DRUM5], CONTROL1[DRUM5A], CONTROL1[DRUMBASS], CONTROL1[DRUMBASSA]]
CONTROLLER2DRUMS = [CONTROL2[DRUM1], CONTROL2[DRUM1A], CONTROL2[DRUM2], CONTROL2[DRUM2A], CONTROL2[DRUM3], CONTROL2[DRUM3A], CONTROL2[DRUM4], CONTROL2[DRUM4A], CONTROL2[DRUM5], CONTROL2[DRUM5A], CONTROL2[DRUMBASS], CONTROL2[DRUMBASSA]]
CONTROLLER3DRUMS = [CONTROL3[DRUM1], CONTROL3[DRUM1A], CONTROL3[DRUM2], CONTROL3[DRUM2A], CONTROL3[DRUM3], CONTROL3[DRUM3A], CONTROL3[DRUM4], CONTROL3[DRUM4A], CONTROL3[DRUM5], CONTROL3[DRUM5A], CONTROL3[DRUMBASS], CONTROL3[DRUMBASSA]]
CONTROLLER4DRUMS = [CONTROL4[DRUM1], CONTROL4[DRUM1A], CONTROL4[DRUM2], CONTROL4[DRUM2A], CONTROL4[DRUM3], CONTROL4[DRUM3A], CONTROL4[DRUM4], CONTROL4[DRUM4A], CONTROL4[DRUM5], CONTROL4[DRUM5A], CONTROL4[DRUMBASS], CONTROL4[DRUMBASSA]]

SCORE_MULTIPLIER = [0, 10, 20, 30]
BASS_GROOVE_SCORE_MULTIPLIER = [0, 10, 20, 30, 40, 50]

player0 = []
player1 = []
player2 = []
player3 = []
playerkeys = []

# define configuration keys
Config.define("controller", "name",          str, tipText = _("Name your controller."))
Config.define("controller", "key_left",      str, "K_LEFT",     text = _("Move left"))
Config.define("controller", "key_right",     str, "K_RIGHT",    text = _("Move right"))
Config.define("controller", "key_up",        str, "K_UP",       text = _("Move up"))
Config.define("controller", "key_down",      str, "K_DOWN",     text = _("Move down"))
Config.define("controller", "key_action1",   str, "K_RETURN",   text = (_("Pick"), _("Bass Drum")))
Config.define("controller", "key_action2",   str, "K_RSHIFT",   text = (_("Secondary Pick"), _("Bass Drum 2")))
Config.define("controller", "key_1",         str, "K_F1",       text = (_("Fret #1"), _("Drum #4"), _("Drum #5")))
Config.define("controller", "key_2",         str, "K_F2",       text = (_("Fret #2"), _("Drum #1")))
Config.define("controller", "key_3",         str, "K_F3",       text = (_("Fret #3"), _("Drum #2"), _("Cymbal #2")))
Config.define("controller", "key_4",         str, "K_F4",       text = (_("Fret #4"), _("Drum #3")))
Config.define("controller", "key_5",         str, "K_F5",       text = (_("Fret #5"), None, _("Cymbal #4")))
Config.define("controller", "key_1a",        str, "K_F6",       text = (_("Solo Fret #1"), _("Solo Key"), _("Drum #4"), _("Drum #5"), _("Analog Slider")))
Config.define("controller", "key_2a",        str, "K_F7",       text = (_("Solo Fret #2"), _("Drum #1")))
Config.define("controller", "key_3a",        str, "K_F8",       text = (_("Solo Fret #3"), _("Drum #2"), _("Cymbal #2")))
Config.define("controller", "key_4a",        str, "K_F9",       text = (_("Solo Fret #4"), _("Drum #3")))
Beispiel #34
0
    def __init__(self, engine):
        self.engine              = engine

        self.logClassInits = Config.get("game", "log_class_inits")
        if self.logClassInits == 1:
            Log.debug("MainMenu class init (MainMenu.py)...")

        self.time                = 0.0
        self.nextLayer           = None
        self.visibility          = 0.0
        self.active              = False

        self.showStartupMessages = False

        self.gfxVersionTag = Config.get("game", "gfx_version_tag")

        self.chosenNeck = Config.get("game", "default_neck")
        exists = 0

        if engine.loadImgDrawing(self, "ok", os.path.join("necks",self.chosenNeck+".png")):
            exists = 1
        elif engine.loadImgDrawing(self, "ok", os.path.join("necks","Neck_"+self.chosenNeck+".png")):
            exists = 1

        #MFH - fallback logic now supports a couple valid default neck filenames
        #MFH - check for Neck_1
        if exists == 0:
            if engine.loadImgDrawing(self, "ok", os.path.join("necks","Neck_1.png")):
                Config.set("game", "default_neck", "1")
                Log.warn("Default chosen neck not valid; fallback Neck_1.png forced.")
                exists = 1

        #MFH - check for defaultneck
        if exists == 0:
            if engine.loadImgDrawing(self, "ok", os.path.join("necks","defaultneck.png")):
                Log.warn("Default chosen neck not valid; fallback defaultneck.png forced.")
                Config.set("game", "default_neck", "defaultneck")
                exists = 1
            else:
                Log.error("Default chosen neck not valid; fallbacks Neck_1.png and defaultneck.png also not valid!")

        #Get theme
        self.theme       = self.engine.data.theme
        self.themeCoOp   = self.engine.data.themeCoOp
        self.themename   = self.engine.data.themeLabel
        self.useSoloMenu = self.engine.theme.use_solo_submenu

        allowMic = True

        self.menux = self.engine.theme.menuPos[0]
        self.menuy = self.engine.theme.menuPos[1]

        self.rbmenu = self.engine.theme.menuRB

        #MFH
        self.main_menu_scale = self.engine.theme.main_menu_scaleVar
        self.main_menu_vspacing = self.engine.theme.main_menu_vspacingVar

        if not self.engine.loadImgDrawing(self, "background", os.path.join("themes",self.themename,"menu","mainbg.png")):
            self.background = None
        self.engine.loadImgDrawing(self, "BGText", os.path.join("themes",self.themename,"menu","maintext.png"))
        self.engine.loadImgDrawing(self, "optionsBG", os.path.join("themes",self.themename,"menu","optionsbg.png"))
        self.engine.loadImgDrawing(self, "optionsPanel", os.path.join("themes",self.themename,"menu","optionspanel.png"))

        #racer: added version tag
        if self.gfxVersionTag or self.engine.theme.versiontag == True:
            if not self.engine.loadImgDrawing(self, "version", os.path.join("themes",self.themename,"menu","versiontag.png")):
                if not self.engine.loadImgDrawing(self, "version", "versiontag.png"): #falls back on default versiontag.png in data\ folder
                    self.version = None
        else:
            self.version = None

        #myfingershurt: random main menu music function, menu.ogg and menuXX.ogg (any filename with "menu" as the first 4 letters)
        self.files = None
        filepath = self.engine.getPath(os.path.join("themes",self.themename,"sounds"))
        if os.path.isdir(filepath):
            self.files = []
            allfiles = os.listdir(filepath)
            for name in allfiles:
                if os.path.splitext(name)[1] == ".ogg":
                    if string.find(name,"menu") > -1:
                        self.files.append(name)


        if self.files:
            i = random.randint(0,len(self.files)-1)
            filename = self.files[i]
            sound = os.path.join("themes",self.themename,"sounds",filename)
            self.menumusic = True
            engine.menuMusic = True

            self.song = Audio.Music(self.engine.resource.fileName(sound))
            self.song.setVolume(self.engine.config.get("audio", "menu_volume"))
            self.song.play(0)  #no loop
        else:
            self.menumusic = False

        self.opt_text_color     = self.engine.theme.opt_text_colorVar
        self.opt_selected_color = self.engine.theme.opt_selected_colorVar

        trainingMenu = [
          (_("Tutorials"), self.showTutorial),
          (_("Practice"), lambda: self.newLocalGame(mode1p = 1)),
        ]

        self.opt_bkg_size = [float(i) for i in self.engine.theme.opt_bkg_size]
        self.opt_text_color = self.engine.theme.hexToColor(self.engine.theme.opt_text_colorVar)
        self.opt_selected_color = self.engine.theme.hexToColor(self.engine.theme.opt_selected_colorVar)

        if self.BGText:
            strCareer = ""
            strQuickplay = ""
            strSolo = ""
            strMultiplayer = ""
            strTraining = ""
            strSettings = ""
            strQuit = ""
        else:
            strCareer = "Career"
            strQuickplay = "Quickplay"
            strSolo = "Solo"
            strMultiplayer = "Multiplayer"
            strTraining = "Training"
            strSettings = "Settings"
            strQuit = "Quit"

        multPlayerMenu = [
            (_("Face-Off"),     lambda: self.newLocalGame(players = 2,             maxplayers = 4)),
            (_("Pro Face-Off"), lambda: self.newLocalGame(players = 2, mode2p = 1, maxplayers = 4)),
            (_("Party Mode"),   lambda: self.newLocalGame(             mode2p = 2)),
            (_("FoFiX Co-Op"),  lambda: self.newLocalGame(players = 2, mode2p = 3, maxplayers = 4, allowMic = allowMic)),
            (_("RB Co-Op"),     lambda: self.newLocalGame(players = 2, mode2p = 4, maxplayers = 4, allowMic = allowMic)),
            (_("GH Co-Op"),     lambda: self.newLocalGame(players = 2, mode2p = 5, maxplayers = 4)),
            (_("GH Battle"),    lambda: self.newLocalGame(players = 2, mode2p = 6, allowDrum = False)), #akedrou- so you can block drums
          ]

        if not self.useSoloMenu:

            mainMenu = [
              (strCareer, lambda:   self.newLocalGame(mode1p = 2, allowMic = allowMic)),
              (strQuickplay, lambda:        self.newLocalGame(allowMic = allowMic)),
              ((strMultiplayer,"multiplayer"), multPlayerMenu),
              ((strTraining,"training"),    trainingMenu),
              ((strSettings,"settings"),  self.settingsMenu),
              (strQuit,        self.quit),
            ]

        else:

            soloMenu = [
              (_("Solo Tour"), lambda: self.newLocalGame(mode1p = 2, allowMic = allowMic)),
              (_("Quickplay"), lambda: self.newLocalGame(allowMic = allowMic)),
            ]

            mainMenu = [
              ((strSolo,"solo"), soloMenu),
              ((strMultiplayer,"multiplayer"), multPlayerMenu),
              ((strTraining,"training"),    trainingMenu),
              ((strSettings,"settings"),  self.settingsMenu),
              (strQuit,        self.quit),
            ]


        w, h, = self.engine.view.geometry[2:4]

        self.menu = Menu(self.engine, mainMenu, onClose = lambda: self.engine.view.popLayer(self), pos = (self.menux, .75-(.75*self.menuy)))

        engine.mainMenu = self    #Points engine.mainMenu to the one and only MainMenu object instance

        ## whether the main menu has come into view at least once
        self.shownOnce = False
Beispiel #35
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     #
# GNU General Public License for more details.                      #
#                                                                   #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software       #
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,        #
# MA  02110-1301, USA.                                              #
#####################################################################

from core.Language import _
from game import Song
from util import Log
from configuration import Config

HANDICAPS = [.75, 1.0, .8, .9, .75, .8, 1.05, 1.1, 1.03, 1.02, 1.01, .95, .9, .85, .7, .95, 0.0, .5, .7, .7]
HANDICAP_NAMES = [_("Auto Kick Bass"), _("Medium Assist Mode"), _("Easy Assist Mode"), _("Jurgen Played!"), \
                  _("Effects Saved SP"), _("All Tapping"), _("HOPO Frequency: Most"), _("HOPO Frequency: Even More"), \
                  _("HOPO Frequency: More"), _("HOPO Frequency: Less"), _("HOPO Frequency: Least"), _("HOPO Disabled!"), \
                  _("Hit Window: Tightest!"), _("Hit Window: Tight!"), _("Hit Window: Wider"), _("Hit Window: Widest"), \
                  _("Two Note Chords"), _("No Fail Mode"), "Scalable Cheat", _("Sloppy Mode!")]
SCALABLE_NAMES = [_("Song Slowdown"), _("Early Hit Window Adjustment")]
SCORE_MULTIPLIER = [0, 10, 20, 30]
BASS_GROOVE_SCORE_MULTIPLIER = [0, 10, 20, 30, 40, 50]

class ScoreCard(object):
    def __init__(self, instrument, coOpType = False):
        self.coOpType = coOpType
        logClassInits = Config.get("game", "log_class_inits")
        if logClassInits == 1:
            Log.debug("ScoreCard class init...")
        self.starScoring = Config.get("game", "star_scoring")
Beispiel #36
0
    def __init__(self, engine, songName=None):
        self.engine = engine
        self.time = 0.0
        self.offset = 0.5  # akedrou - this seems to fix the delay issue, but I'm not sure why. Return here!
        self.speedDiv = 20000.0
        self.speedDir = 1.0
        self.doneList = []
        self.themename = Config.get("coffee", "themename")

        nf = self.engine.data.font
        ns = 0.002
        bs = 0.001
        hs = 0.003
        c1 = (1, 1, 0.5, 1)
        c2 = (1, 0.75, 0, 1)
        self.text_size = nf.getLineSpacing(scale=hs)

        # akedrou - Translatable Strings:
        self.bank = {}
        self.bank["intro"] = [
            _("Frets on Fire X is a progression of MFH-mod,"),
            _("which was built on Alarian's mod,"),
            _("which was built on UltimateCoffee's Ultimate mod,"),
            _("which was built on RogueF's RF_mod 4.15,"),
            _("which was, of course, built on Frets on Fire 1.2.451,"),
            _("which was created by Unreal Voodoo"),
        ]
        self.bank["noOrder"] = [_("No particular order")]
        self.bank["accessOrder"] = [_("In order of project commit access")]
        self.bank["coders"] = [_("Active Coders")]
        self.bank["otherCoding"] = [_("Programming")]
        self.bank["graphics"] = [_("Graphic Design")]
        self.bank["3d"] = [_("3D Textures")]
        self.bank["logo"] = [_("FoFiX Logo Design")]
        self.bank["hollowmind"] = [_("Hollowmind Necks")]
        self.bank["themes"] = [_("Included Themes")]
        self.bank["shaders"] = [_("Shaders")]
        self.bank["sounds"] = [_("Sound Design")]
        self.bank["translators"] = [_("Translators")]
        self.bank["honorary"] = [_("Honorary Credits")]
        self.bank["codeHonor"] = [_("Without whom this game would not exist")]
        self.bank["giveThanks"] = [_("Special Thanks to")]
        self.bank["community"] = [_("nwru and all of the community at fretsonfire.net")]
        self.bank["other"] = [_("Other Contributors:")]
        self.bank["tutorial"] = [
            _("Jurgen FoF tutorial inspired by adam02"),
            _("Drum test song tutorial by Heka"),
            _("Drum Rolls practice tutorial by venom426"),
        ]
        self.bank["disclaimer"] = [
            _("If you have contributed to this game and are not credited,"),
            _("please let us know what and when you contributed."),
        ]
        self.bank["thanks"] = [_("Thank you for your contribution.")]
        self.bank["oversight"] = [
            _("Please keep in mind that it is not easy to trace down and"),
            _("credit every single person who contributed; if your name is"),
            _("not included, it was not meant to slight you."),
            _("It was an oversight."),
        ]
        # evilynux - Theme strings
        self.bank["themeCreators"] = [_("%s theme credits:") % self.themename]
        self.bank["themeThanks"] = [_("%s theme specific thanks:") % self.themename]
        # Languages
        self.bank["french"] = [_("French")]
        self.bank["french90"] = [_("French (reform 1990)")]
        self.bank["german"] = [_("German")]
        self.bank["italian"] = [_("Italian")]
        self.bank["piglatin"] = [_("Pig Latin")]
        self.bank["portuguese-b"] = [_("Portuguese (Brazilian)")]
        self.bank["russian"] = [_("Russian")]
        self.bank["spanish"] = [_("Spanish")]
        self.bank["swedish"] = [_("Swedish")]

        self.videoLayer = False
        self.background = None

        vidSource = os.path.join(Version.dataPath(), "themes", self.themename, "menu", "credits.ogv")
        if os.path.isfile(vidSource):
            try:
                self.vidPlayer = VideoLayer(self.engine, vidSource, mute=True, loop=True)
            except (IOError, VideoPlayerError):
                Log.error("Error loading credits video:")
            else:
                self.vidPlayer.play()
                self.engine.view.pushLayer(self.vidPlayer)
                self.videoLayer = True

        if not self.videoLayer and not self.engine.loadImgDrawing(
            self, "background", os.path.join("themes", self.themename, "menu", "credits.png")
        ):
            self.background = None

        if not self.engine.loadImgDrawing(
            self, "topLayer", os.path.join("themes", self.themename, "menu", "creditstop.png")
        ):
            self.topLayer = None

        space = Text(nf, hs, c1, "center", " ")
        self.credits = [
            Picture(self.engine, "fofix_logo.png", 0.10),
            Text(nf, ns, c1, "center", "%s" % Version.version()),
            space,
        ]

        # evilynux: Main FoFiX credits (taken from CREDITS).
        self.parseText("CREDITS")
        self.credits.extend([space, space, space])
        # evilynux: Theme credits (taken from data/themes/<theme name>/CREDITS).
        self.parseText(os.path.join("data", "themes", self.themename, "CREDITS"))

        self.credits.extend(
            [
                space,
                space,
                Text(nf, ns, c1, "left", _("Made with:")),
                Text(
                    nf, ns, c2, "right", "Python " + sys.version.split(" ")[0]
                ),  # stump: the version that's actually in use
                Text(nf, bs, c2, "right", "http://www.python.org"),
                space,
                Text(
                    nf, ns, c2, "right", "PyGame " + pygame.version.ver.replace("release", "")
                ),  # stump: the version that's actually in use
                Text(nf, bs, c2, "right", "http://www.pygame.org"),
                space,
                Text(
                    nf, ns, c2, "right", "PyOpenGL " + OpenGL.__version__
                ),  # evilynux: the version that's actually in use
                Text(nf, bs, c2, "right", "http://pyopengl.sourceforge.net"),
                space,
                Text(nf, ns, c2, "right", "Illusoft Collada module 0.3.159"),
                Text(nf, bs, c2, "right", "http://colladablender.illusoft.com"),
                space,
                Text(nf, ns, c2, "right", "MXM Python Midi Package 0.1.4"),
                Text(nf, bs, c2, "right", "http://www.mxm.dk/products/public/pythonmidi"),
                space,
                space,
                Text(nf, bs, c1, "center", _("Source Code available under the GNU General Public License")),
                Text(nf, bs, c2, "center", "http://code.google.com/p/fofix"),
                space,
                space,
                Text(nf, bs, c1, "center", _("Copyright 2006, 2007 by Unreal Voodoo")),
                Text(nf, bs, c1, "center", _("Copyright 2008-2013 by Team FoFiX")),
                space,
                space,
            ]
        )
Beispiel #37
0
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software       #
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,        #
# MA  02110-1301, USA.                                              #
#####################################################################

from core.Language import _
from game import Song
from util import Log
from configuration import Config

HANDICAPS = [
    .75, 1.0, .8, .9, .75, .8, 1.05, 1.1, 1.03, 1.02, 1.01, .95, .9, .85, .7,
    .95, 0.0, .5, .7, .7
]
HANDICAP_NAMES = [_("Auto Kick Bass"), _("Medium Assist Mode"), _("Easy Assist Mode"), _("Jurgen Played!"), \
                  _("Effects Saved SP"), _("All Tapping"), _("HOPO Frequency: Most"), _("HOPO Frequency: Even More"), \
                  _("HOPO Frequency: More"), _("HOPO Frequency: Less"), _("HOPO Frequency: Least"), _("HOPO Disabled!"), \
                  _("Hit Window: Tightest!"), _("Hit Window: Tight!"), _("Hit Window: Wider"), _("Hit Window: Widest"), \
                  _("Two Note Chords"), _("No Fail Mode"), "Scalable Cheat", _("Sloppy Mode!")]
SCALABLE_NAMES = [_("Song Slowdown"), _("Early Hit Window Adjustment")]
SCORE_MULTIPLIER = [0, 10, 20, 30]
BASS_GROOVE_SCORE_MULTIPLIER = [0, 10, 20, 30, 40, 50]


class ScoreCard(object):
    def __init__(self, instrument, coOpType=False):
        self.coOpType = coOpType
        logClassInits = Config.get("game", "log_class_inits")
        if logClassInits == 1:
            Log.debug("ScoreCard class init...")
Beispiel #38
0
 def __init__(self, engine):
     self.engine    = engine
     self.time      = 0.0
     self.blink     = 0
     self.cursor    = ""
     self.name      = ""
     self.active    = False
     self.oldValue  = None
     self.oldName   = None
     self.selected  = 0
     self.scrolling = 0
     self.scrollRate  = self.engine.scrollRate
     self.scrollDelay = self.engine.scrollDelay
     self.delay       = 0
     self.rate        = 0
     sfxVolume = self.engine.config.get("audio", "SFX_volume")
     self.engine.data.selectSound.setVolume(sfxVolume)
     self.engine.data.acceptSound.setVolume(sfxVolume)  #MFH
     self.engine.data.cancelSound.setVolume(sfxVolume)  #MFH
     self.fullView  = self.engine.view.geometry[2:4]
     self.invalidNames = []
     for i in Player.playername:
         self.invalidNames.append(i.lower())
     self.newChar   = True
     self.choices   = []
     self.avatar    = None
     self.player    = None
     self.playerNum = 0
     self.neck      = None
     self.updatedName = None
     self.loadPlayer(0)
     self.dictEnDisable = {0: _("Disabled"), 1: _("Enabled")}
     self.lefty     = {0: 1, 1: -1}
     neckDict       = {0: _("Default Neck"), 1: _("Theme Neck"), 2: _("Select a Neck")}
     self.values    = (self.dictEnDisable, self.dictEnDisable, self.dictEnDisable, {0: _("Disabled"), 1: _("Easy Assist"), 2: _("Medium Assist")}, self.dictEnDisable, neckDict)
     self.options   = [(_("Name"),             _("Name your character!")), \
                       (_("Lefty Mode"),       _("Flip the guitar frets for left-handed playing!")), \
                       (_("Drum Flip"),        _("Flip the drum sounds - snare becomes crash, and so on")), \
                       (_("Auto-Kick Bass"),   _("Feet uncooperative? Broke your pedal? Not to worry!")), \
                       (_("Assist Mode"),      _("Play hard and expert, even when you're not that good!")), \
                       (_("Two-Chord Max"),    _("For those still playing with uncooperative keyboards.")), \
                       (_("Neck"),             _("Give the endless procession of notes a bit of flair!")), \
                       (_("Upload Name"),      _("To the internet, you are GUITARGOD23047124!")), \
                       (_("Choose Avatar"),    _("A 256x256 window into your soul.")), \
                       (_("Delete Character"), _("Quitter.")), \
                       (_("Done"),             _("All finished? Let's do this thing!"))]
     themename = self.engine.data.themeLabel
     self.engine.data.loadAllImages(self, os.path.join("themes",themename,"lobby","creator"))
Beispiel #39
0
 def __str__(self):
     return _("World error. Please try again.")
Beispiel #40
0
    def __init__(self, engine, songName = None):
        self.engine      = engine
        self.time        = 0.0
        self.offset      = 0.5 # akedrou - this seems to fix the delay issue, but I'm not sure why. Return here!
        self.speedDiv    = 20000.0
        self.speedDir    = 1.0
        self.doneList    = []
        self.themename = Config.get("coffee", "themename")

        nf = self.engine.data.font
        ns = 0.002
        bs = 0.001
        hs = 0.003
        c1 = (1, 1, .5, 1)
        c2 = (1, .75, 0, 1)
        self.text_size = nf.getLineSpacing(scale = hs)

        #akedrou - Translatable Strings:
        self.bank = {}
        self.bank['intro']      = [_("Frets on Fire X is a progression of MFH-mod,"),
                                   _("which was built on Alarian's mod,"),
                                   _("which was built on UltimateCoffee's Ultimate mod,"),
                                   _("which was built on RogueF's RF_mod 4.15,"),
                                   _("which was, of course, built on Frets on Fire 1.2.451,"),
                                   _("which was created by Unreal Voodoo")]
        self.bank['noOrder']    = [_("No particular order")]
        self.bank['accessOrder']= [_("In order of project commit access")]
        self.bank['coders']     = [_("Active Coders")]
        self.bank['otherCoding']= [_("Programming")]
        self.bank['graphics']   = [_("Graphic Design")]
        self.bank['3d']         = [_("3D Textures")]
        self.bank['logo']       = [_("FoFiX Logo Design")]
        self.bank['hollowmind'] = [_("Hollowmind Necks")]
        self.bank['themes']     = [_("Included Themes")]
        self.bank['shaders']    = [_("Shaders")]
        self.bank['sounds']     = [_("Sound Design")]
        self.bank['translators']= [_("Translators")]
        self.bank['honorary']   = [_("Honorary Credits")]
        self.bank['codeHonor']  = [_("Without whom this game would not exist")]
        self.bank['giveThanks'] = [_("Special Thanks to")]
        self.bank['community']  = [_("nwru and all of the community at fretsonfire.net")]
        self.bank['other']      = [_("Other Contributors:")]
        self.bank['tutorial']   = [_("Jurgen FoF tutorial inspired by adam02"),
                                   _("Drum test song tutorial by Heka"),
                                   _("Drum Rolls practice tutorial by venom426")]
        self.bank['disclaimer'] = [_("If you have contributed to this game and are not credited,"),
                                   _("please let us know what and when you contributed.")]
        self.bank['thanks']     = [_("Thank you for your contribution.")]
        self.bank['oversight']  = [_("Please keep in mind that it is not easy to trace down and"),
                                   _("credit every single person who contributed; if your name is"),
                                   _("not included, it was not meant to slight you."),
                                   _("It was an oversight.")]
        # evilynux - Theme strings
        self.bank['themeCreators'] = [_("%s theme credits:") % self.themename]
        self.bank['themeThanks']   = [_("%s theme specific thanks:") % self.themename]
        # Languages
        self.bank['french']        = [_("French")]
        self.bank['french90']      = [_("French (reform 1990)")]
        self.bank['german']        = [_("German")]
        self.bank['italian']       = [_("Italian")]
        self.bank['piglatin']      = [_("Pig Latin")]
        self.bank['portuguese-b']  = [_("Portuguese (Brazilian)")]
        self.bank['russian']       = [_("Russian")]
        self.bank['spanish']       = [_("Spanish")]
        self.bank['swedish']       = [_("Swedish")]

        self.videoLayer = False
        self.background = None

        vidSource = os.path.join(Version.dataPath(), 'themes', self.themename, \
                                 'menu', 'credits.ogv')
        if os.path.isfile(vidSource):
            try:
                self.vidPlayer = VideoLayer(self.engine, vidSource, mute = True, loop = True)
            except (IOError, VideoPlayerError):
                Log.error('Error loading credits video:')
            else:
                self.vidPlayer.play()
                self.engine.view.pushLayer(self.vidPlayer)
                self.videoLayer = True

        if not self.videoLayer and \
           not self.engine.loadImgDrawing(self, 'background', os.path.join('themes', self.themename, 'menu', 'credits.png')):
            self.background = None

        if not self.engine.loadImgDrawing(self, 'topLayer', os.path.join('themes', self.themename, 'menu', 'creditstop.png')):
            self.topLayer = None

        space = Text(nf, hs, c1, "center", " ")
        self.credits = [
          Picture(self.engine, "fofix_logo.png", .10),
          Text(nf, ns, c1, "center", "%s" % Version.version()), space]

        # evilynux: Main FoFiX credits (taken from CREDITS).
        self.parseText("CREDITS")
        self.credits.extend([space, space, space])
        # evilynux: Theme credits (taken from data/themes/<theme name>/CREDITS).
        self.parseText(os.path.join('data', 'themes', self.themename, 'CREDITS'))

        self.credits.extend( [
          space, space,
          Text(nf, ns, c1, "left",   _("Made with:")),
          Text(nf, ns, c2, "right",  "Python " + sys.version.split(' ')[0]),  #stump: the version that's actually in use
          Text(nf, bs, c2, "right",  "http://www.python.org"),
          space,
          Text(nf, ns, c2, "right",  "PyGame " + pygame.version.ver.replace('release', '')),  #stump: the version that's actually in use
          Text(nf, bs, c2, "right",  "http://www.pygame.org"),
          space,
          Text(nf, ns, c2, "right",  "PyOpenGL " + OpenGL.__version__), #evilynux: the version that's actually in use
          Text(nf, bs, c2, "right",  "http://pyopengl.sourceforge.net"),
          space,
          Text(nf, ns, c2, "right",  "Illusoft Collada module 0.3.159"),
          Text(nf, bs, c2, "right",  "http://colladablender.illusoft.com"),
          space,
          Text(nf, ns, c2, "right",  "MXM Python Midi Package 0.1.4"),
          Text(nf, bs, c2, "right",  "http://www.mxm.dk/products/public/pythonmidi"),
          space,
          space,
          Text(nf, bs, c1, "center", _("Source Code available under the GNU General Public License")),
          Text(nf, bs, c2, "center", "http://code.google.com/p/fofix"),
          space,
          space,
          Text(nf, bs, c1, "center", _("Copyright 2006, 2007 by Unreal Voodoo")),
          Text(nf, bs, c1, "center", _("Copyright 2008-2013 by Team FoFiX")),
          space,
          space
        ])
Beispiel #41
0
    #Lysdestic - Alter theme from CLI
    if theme is not None:
        Config.set("coffee", "themename", theme)

    engine = GameEngine(config)
    engine.cmdPlay = 0

    # Check for a valid invocation of one-shot mode.
    if playing is not None:
        Log.debug('Validating song directory for one-shot mode.')
        library = Config.get("setlist","base_library")
        basefolder = os.path.join(Version.dataPath(),library,"songs",playing)
        if not (os.path.exists(os.path.join(basefolder, "song.ini")) and (os.path.exists(os.path.join(basefolder, "notes.mid")) or os.path.exists(os.path.join(basefolder, "notes-unedited.mid"))) and (os.path.exists(os.path.join(basefolder, "song.ogg")) or os.path.exists(os.path.join(basefolder, "guitar.ogg")))):
            Log.warn("Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode." % playing)
            engine.startupMessages.append(_("Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode.") % playing)
            playing = None

    # Set up one-shot mode if the invocation is valid for it.
    if playing is not None:
        Log.debug('Entering one-shot mode.')
        Config.set("setlist", "selected_song", playing)
        engine.cmdPlay = 1
        if difficulty is not None:
            engine.cmdDiff = int(difficulty)
        if part is not None:
            engine.cmdPart = int(part)
        #evilynux - Multiplayer and mode selection support
        if nbrplayers == 1:
            engine.cmdMode = nbrplayers, mode, 0
        else:
Beispiel #42
0
    def __init__(self, config = None):

        Log.debug("GameEngine class init (GameEngine.py)...")
        self.mainMenu = None    #placeholder for main menu object - to prevent reinstantiation

        self.currentScene = None

        self.versionString = version  #stump: other version stuff moved to allow full version string to be retrieved without instantiating GameEngine
        self.uploadVersion = "%s-4.0" % Version.PROGRAM_NAME #akedrou - the version passed to the upload site.

        self.dataPath = Version.dataPath()
        Log.debug(self.versionString + " starting up...")
        Log.debug("Python version: " + sys.version.split(' ')[0])
        Log.debug("Pygame version: " + str(pygame.version.ver) )
        Log.debug("PyOpenGL version: " + OpenGL.__version__)
        Log.debug("Numpy version: " + np.__version__)
        Log.debug("PIL version: " + Image.VERSION)
        Log.debug("sys.argv: " + repr(sys.argv))
        Log.debug("os.name: " + os.name)
        Log.debug("sys.platform: " + sys.platform)
        if os.name == 'nt':
            import win32api
            Log.debug("win32api.GetVersionEx(1): " + repr(win32api.GetVersionEx(1)))
        elif os.name == 'posix':
            Log.debug("os.uname(): " + repr(os.uname()))

        """
        Constructor.
        @param config:  L{Config} instance for settings
        """

        self.tutorialFolder = "tutorials"

        if not config:
            config = Config.load()

        self.config  = config

        fps          = self.config.get("video", "fps")

        self.tasks = []
        self.frameTasks = []
        self.fps = fps
        self.currentTask = None
        self.paused = []
        self.running = True
        self.clock = pygame.time.Clock()

        self.title             = self.versionString
        self.restartRequested  = False

        # evilynux - Check if theme icon exists first, then fallback on FoFiX icon.
        themename = self.config.get("coffee", "themename")
        themeicon = os.path.join(Version.dataPath(), "themes", themename, "icon.png")
        fofixicon = os.path.join(Version.dataPath(), "fofix_icon.png")
        icon = None
        if os.path.exists(themeicon):
            icon = themeicon
        elif os.path.exists(fofixicon):
            icon = fofixicon

        self.video             = Video(self.title, icon)
        if self.config.get("video", "disable_screensaver"):
            self.video.disableScreensaver()

        self.audio             = Audio()
        self.frames            = 0
        self.fpsEstimate       = 0
        self.priority          = self.config.get("engine", "highpriority")
        self.show_fps          = self.config.get("video", "show_fps")
        self.advSettings       = self.config.get("game", "adv_settings")
        self.restartRequired   = False
        self.quicksetRestart   = False
        self.quicksetPerf      = self.config.get("quickset", "performance")
        self.scrollRate        = self.config.get("game", "scroll_rate")
        self.scrollDelay       = self.config.get("game", "scroll_delay")

        Log.debug("Initializing audio.")
        frequency    = self.config.get("audio", "frequency")
        bits         = self.config.get("audio", "bits")
        stereo       = self.config.get("audio", "stereo")
        bufferSize   = self.config.get("audio", "buffersize")
        self.audio.open(frequency = frequency, bits = bits, stereo = stereo, bufferSize = bufferSize)

        self.cmdPlay           = 0
        self.cmdMode           = None
        self.cmdDiff           = None
        self.cmdPart           = None

        self.gameStarted       = False
        self.world             = None

        self.audioSpeedFactor  = 1.0

        Log.debug("Initializing video.")
        #myfingershurt: ensuring windowed mode starts up in center of the screen instead of cascading positions:
        os.environ['SDL_VIDEO_WINDOW_POS'] = 'center'

        width, height = [int(s) for s in self.config.get("video", "resolution").split("x")]
        fullscreen    = self.config.get("video", "fullscreen")
        multisamples  = self.config.get("video", "multisamples")
        self.video.setMode((width, height), fullscreen = fullscreen, multisamples = multisamples)
        Log.debug("OpenGL version: " + glGetString(GL_VERSION))
        Log.debug("OpenGL vendor: " + glGetString(GL_VENDOR))
        Log.debug("OpenGL renderer: " + glGetString(GL_RENDERER))
        Log.debug("OpenGL extensions: " + ' '.join(sorted(glGetString(GL_EXTENSIONS).split())))

        if self.video.default:
            self.config.set("video", "fullscreen", False)
            self.config.set("video", "resolution", "800x600")

        if self.config.get("video", "shader_use"):
            shaders.set(os.path.join(Version.dataPath(), "shaders"))

        # Enable the high priority timer if configured
        if self.priority:
            Log.debug("Enabling high priority timer.")
            self.fps = 0 # High priority

        # evilynux - This was generating an error on the first pass (at least under
        #            GNU/Linux) as the Viewport was not set yet.
        try:
            viewport = glGetIntegerv(GL_VIEWPORT)
        except:
            viewport = [0, 0, width, height]
        h = viewport[3] - viewport[1]
        w = viewport[2] - viewport[0]
        geometry = (0, 0, w, h)
        self.svg = SvgContext(geometry)
        glViewport(int(viewport[0]), int(viewport[1]), int(viewport[2]), int(viewport[3]))

        self.startupMessages   = self.video.error
        self.input     = Input()
        self.view      = View(self, geometry)
        self.resizeScreen(w, h)

        self.resource  = Resource(Version.dataPath())
        self.mainloop  = self.loading
        self.menuMusic = False

        self.setlistMsg = None


        # Load game modifications
        Mod.init(self)
        self.addTask(self.input, synchronized = False)

        self.addTask(self.view, synchronized = False)

        self.addTask(self.resource, synchronized = False)

        self.data = Data(self.resource, self.svg)

        ##MFH: Animated stage folder selection option
        #<themename>\Stages still contains the backgrounds for when stage rotation is off, and practice.png
        #subfolders under Stages\ will each be treated as a separate animated stage set

        self.stageFolders = []
        currentTheme = themename

        stagespath = os.path.join(Version.dataPath(), "themes", currentTheme, "backgrounds")
        themepath  = os.path.join(Version.dataPath(), "themes", currentTheme)
        if os.path.exists(stagespath):
            self.stageFolders = []
            allFolders = os.listdir(stagespath)   #this also includes all the stage files - so check to see if there is at least one .png file inside each folder to be sure it's an animated stage folder
            for name in allFolders:
                aniStageFolderListing = []
                thisIsAnAnimatedStageFolder = False
                try:
                    aniStageFolderListing = os.listdir(os.path.join(stagespath,name))
                except Exception:
                    thisIsAnAnimatedStageFolder = False
                for aniFile in aniStageFolderListing:
                    if os.path.splitext(aniFile)[1] == ".png" or os.path.splitext(aniFile)[1] ==  ".jpg" or os.path.splitext(aniFile)[1] == ".jpeg":  #we've found at least one .png file here, chances are this is a valid animated stage folder
                        thisIsAnAnimatedStageFolder = True
                if thisIsAnAnimatedStageFolder:
                    self.stageFolders.append(name)


            i = len(self.stageFolders)
            if i > 0: #only set default to first animated subfolder if one exists - otherwise use Normal!
                defaultAniStage = str(self.stageFolders[0])
            else:
                defaultAniStage = "Normal"
            Log.debug("Default animated stage for " + currentTheme + " theme = " + defaultAniStage)
            aniStageOptions = dict([(str(self.stageFolders[n]),self.stageFolders[n]) for n in range(0, i)])
            aniStageOptions.update({"Normal":_("Slideshow")})
            if i > 1:   #only add Random setting if more than one animated stage exists
                aniStageOptions.update({"Random":_("Random")})
            Config.define("game", "animated_stage_folder", str, defaultAniStage, text = _("Animated Stage"), options = aniStageOptions )

            #MFH: here, need to track and check a new ini entry for last theme - so when theme changes we can re-default animated stage to first found
            lastTheme = self.config.get("game","last_theme")
            if lastTheme == "" or lastTheme != currentTheme:   #MFH - no last theme, and theme just changed:
                self.config.set("game","animated_stage_folder",defaultAniStage)   #force defaultAniStage
            self.config.set("game","last_theme",currentTheme)

            selectedAnimatedStage = self.config.get("game", "animated_stage_folder")
            if selectedAnimatedStage != "Normal" and selectedAnimatedStage != "Random":
                if not os.path.exists(os.path.join(stagespath,selectedAnimatedStage)):
                    Log.warn("Selected animated stage folder " + selectedAnimatedStage + " does not exist, forcing Normal.")
                    self.config.set("game","animated_stage_folder","Normal") #MFH: force "Standard" currently selected animated stage folder is invalid
        else:
            Config.define("game", "animated_stage_folder", str, "None", text = _("Animated Stage"), options = ["None",_("None")])
            Log.warn("No stages\ folder found, forcing None setting for Animated Stage.")
            self.config.set("game","animated_stage_folder", "None") #MFH: force "None" when Stages folder can't be found



        try:
            fp, pathname, description = imp.find_module("CustomTheme",[themepath])
            theme = imp.load_module("CustomTheme", fp, pathname, description)
            self.theme = theme.CustomTheme(themepath, themename)
        except ImportError:
            self.theme = Theme(themepath, themename)

        self.addTask(self.theme)


        self.input.addKeyListener(FullScreenSwitcher(self), priority = True)
        self.input.addSystemEventListener(SystemEventHandler(self))

        self.debugLayer         = None
        self.startupLayer       = None
        self.loadingScreenShown = False
        self.graphicMenuShown   = False

        Log.debug("Ready.")