Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/stump/fofix
Browse files Browse the repository at this point in the history
  • Loading branch information
erodozer committed Jun 24, 2011
2 parents c514fbe + 0db470c commit 4c3fd9f
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 3 deletions.
45 changes: 45 additions & 0 deletions src/Dialogs.py
Expand Up @@ -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()
Expand Down
3 changes: 2 additions & 1 deletion src/GuitarScene.py
Expand Up @@ -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..."))


Expand Down
29 changes: 27 additions & 2 deletions src/Song.py
Expand Up @@ -557,7 +557,13 @@ 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)

Expand Down Expand Up @@ -1099,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:
Expand Down Expand Up @@ -2257,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")
Expand Down

0 comments on commit 4c3fd9f

Please sign in to comment.