From a81d85ef7085d1340d09572bd71508ea7fca0737 Mon Sep 17 00:00:00 2001 From: nhydock Date: Fri, 24 Jun 2011 14:53:06 -0400 Subject: [PATCH 1/3] Adds pro_drum tag for song.ini --- src/Song.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Song.py b/src/Song.py index 1b06f21ac..6a50cb423 100644 --- a/src/Song.py +++ b/src/Song.py @@ -557,6 +557,12 @@ def eighthNoteHopo(self): @property def lyrics(self): return self._get("lyrics") + + @property + #because of how RB3 pro drums are formatted, this tag + #detects a way to properly read the cymbals notes in the midi + def prodrum(self): + return self._get("pro_drum") def getHighscoresWithPartString(self, difficulty, part = str(parts[GUITAR_PART])): return self.getHighscores(difficulty, part) From 74d3af3d4f8aa8f50f73da9bae1c4ffc6d82f08e Mon Sep 17 00:00:00 2001 From: nhydock Date: Fri, 24 Jun 2011 16:27:03 -0400 Subject: [PATCH 2/3] Songs can now have their own loading screens (named loading.png in the song's folder), loading_overlay.png appears over it. --- src/Dialogs.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/GuitarScene.py | 3 ++- 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/Dialogs.py b/src/Dialogs.py index 5ff2a17ee..0e766fae0 100644 --- a/src/Dialogs.py +++ b/src/Dialogs.py @@ -2087,12 +2087,57 @@ def render(self, visibility, topMost): else: wrapCenteredText(font, (x,y), self.text, scale = self.fScale, rightMargin = self.rMargin, linespace = self.lspacing) +#nhydock - expanding on LoadingSplashScreen so there can be overlay and song dependant backgrounds +class SongLoadingSplashScreen(LoadingSplashScreen): + def __init__(self, engine, text, songName, libraryName): + super(SongLoadingSplashScreen, self).__init__(engine, text) + + self.engine.loadImgDrawing(self, "loadingImg", os.path.join("themes", self.engine.data.themeLabel, "loading_overlay.png")) + self.engine.loadImgDrawing(self, "songBack", os.path.join(libraryName, songName, "loading.png")) + print self.songBack + def render(self, visibility, topMost): + self.engine.view.setViewport(1,0) + font = self.engine.data.loadingFont #MFH - new font support + + if not font: + return + + with self.engine.view.orthogonalProjection(normalize = True): + v = (1 - visibility) ** 2 + fadeScreen(v) + w, h = self.engine.view.geometry[2:4] + + self.engine.theme.setBaseColor(1 - v) + self.engine.drawImage(self.songBack, scale = (1.0,-1.0), coord = (w/2,h/2), stretched = 3) + self.engine.drawImage(self.loadingImg, scale = (1.0,-1.0), coord = (w/2,h/2), stretched = 3) + w, h = font.getStringSize(self.text, scale=self.fScale) + + x = self.loadingx + y = self.loadingy - h / 2 + v * .5 + + #akedrou - support for Loading Text Color + c1,c2,c3 = self.textColor + glColor3f(c1,c2,c3) + + # evilynux - Made text about 2 times smaller (as requested by worldrave) + if self.allowtext: + if self.theme == 1: + wrapCenteredText(font, (x,y), self.text, scale = self.fScale, rightMargin = self.rMargin, linespace = self.lspacing, allowshadowoffset = True, shadowoffset = (self.engine.theme.shadowoffsetx, self.engine.theme.shadowoffsety)) + else: + wrapCenteredText(font, (x,y), self.text, scale = self.fScale, rightMargin = self.rMargin, linespace = self.lspacing) + def showLoadingSplashScreen(engine, text = _("Loading...")): splash = LoadingSplashScreen(engine, text) engine.view.pushLayer(splash) engine.run() return splash +def showSongLoadingSplashScreen(engine, songName, libraryName, text = _("Loading...")): + splash = SongLoadingSplashScreen(engine, text, songName, libraryName) + engine.view.pushLayer(splash) + engine.run() + return splash + def changeLoadingSplashScreenText(engine, splash, text=_("Loading...")): splash.text = text engine.run() diff --git a/src/GuitarScene.py b/src/GuitarScene.py index c66d7c9fa..629a06545 100644 --- a/src/GuitarScene.py +++ b/src/GuitarScene.py @@ -88,7 +88,8 @@ def __init__(self, engine, libraryName, songName): phrase = self.sinfo.loadingPhrase if phrase == "": phrase = random.choice(self.engine.theme.loadingPhrase) - splash = Dialogs.showLoadingSplashScreen(self.engine, phrase + " \n " + _("Initializing...")) + #splash = Dialogs.showLoadingSplashScreen(self.engine, phrase + " \n " + _("Initializing...")) + splash = Dialogs.showSongLoadingSplashScreen(self.engine, songName, libraryName, phrase + " \n " + _("Initializing...")) Dialogs.changeLoadingSplashScreenText(self.engine, splash, phrase + " \n " + _("Initializing...")) From 0db470c382fd55b06b8bd41a7354313d60945348 Mon Sep 17 00:00:00 2001 From: nhydock Date: Fri, 24 Jun 2011 17:13:55 -0400 Subject: [PATCH 3/3] Tracks and Songs now keep track of their length --- src/Song.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/Song.py b/src/Song.py index 6a50cb423..dc7d705e3 100644 --- a/src/Song.py +++ b/src/Song.py @@ -563,7 +563,7 @@ def lyrics(self): #detects a way to properly read the cymbals notes in the midi def prodrum(self): return self._get("pro_drum") - + def getHighscoresWithPartString(self, difficulty, part = str(parts[GUITAR_PART])): return self.getHighscores(difficulty, part) @@ -1105,13 +1105,22 @@ def __init__(self, engine): if self.logClassInits == 1: Log.debug("Track class init (song.py)...") - def __getitem__(self, index): return self.allEvents[index] def __len__(self): return len(self.allEvents) + @property + def length(self): + lastTime = 0 + for time, event in self.getAllEvents(): + if not isinstance(event, Note) and not isinstance(event, VocalPhrase): + continue + if time + event.length > lastTime: + lastTime = time + event.length + return round((lastTime+1000.0) / 1000.0) * 1000.0 + def addEvent(self, time, event): for t in range(int(time / self.granularity), int((time + event.length) / self.granularity) + 1): if len(self.events) < t + 1: @@ -2263,6 +2272,16 @@ def __init__(self, engine, infoFileName, songTrackName, guitarTrackName, rhythmT scriptReader = ScriptReader(self, open(scriptFileName)) scriptReader.read() + @property + def length(self): + length = 0 + for t in self.tracks: + for n in t: #note/vocal tracks + if n.length > length: + length += (n.length - length) + length += 3000.0 + return length + #myfingershurt: new function to re-retrieve the a/v delay setting so it can be changed in-game: def refreshAudioDelay(self): self.delay = self.engine.config.get("audio", "delay")