Skip to content

Commit

Permalink
Merge branch 'master' into menu-edits
Browse files Browse the repository at this point in the history
  • Loading branch information
akedrou committed May 17, 2011
2 parents 0dcd5b1 + 1de04a1 commit 7733bb3
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 172 deletions.
106 changes: 38 additions & 68 deletions src/Neck.py
Expand Up @@ -317,25 +317,19 @@ def loadImage(name, file):
self.ocount = 0
self.paused = False

def project(self, beat):
return 0.125 * beat / self.beatsPerUnit # glorandwarf: was 0.12

def renderIncomingNeck(self, visibility, song, pos, time, neckTexture): #MFH - attempt to "scroll" an incoming guitar solo neck towards the player
if not song:
return
if not song.readyToGo:
return

def project(beat):
return 0.125 * beat / self.beatsPerUnit # glorandwarf: was 0.12

v = visibility
w = self.boardWidth
l = self.boardLength

offset = 0

z = ((time - pos) / self.currentPeriod) / self.beatsPerUnit

color = (1,1,1)

glEnable(GL_TEXTURE_2D)

board_vtx = np.array([[-w / 2, 0, z],
Expand All @@ -347,14 +341,14 @@ def project(beat):
[-w / 2, 0, z + 2 + l],
[w / 2, 0, z + 2 + l]], dtype=np.float32)

board_tex = np.array([[0.0, project(offset - 2 * self.beatsPerUnit)],
[1.0, project(offset - 2 * self.beatsPerUnit)],
[0.0, project(offset - 1 * self.beatsPerUnit)],
[1.0, project(offset - 1 * self.beatsPerUnit)],
[0.0, project(offset + l * self.beatsPerUnit * .7)],
[1.0, project(offset + l * self.beatsPerUnit * .7)],
[0.0, project(offset + l * self.beatsPerUnit)],
[1.0, project(offset + l * self.beatsPerUnit)]], dtype=np.float32)
board_tex = np.array([[0.0, self.project(-2 * self.beatsPerUnit)],
[1.0, self.project(-2 * self.beatsPerUnit)],
[0.0, self.project(-1 * self.beatsPerUnit)],
[1.0, self.project(-1 * self.beatsPerUnit)],
[0.0, self.project(l * self.beatsPerUnit * .7)],
[1.0, self.project(l * self.beatsPerUnit * .7)],
[0.0, self.project(l * self.beatsPerUnit)],
[1.0, self.project(l * self.beatsPerUnit)]], dtype=np.float32)

if neckTexture:
neckTexture.texture.bind()
Expand Down Expand Up @@ -428,27 +422,22 @@ def renderIncomingNecks(self, visibility, song, pos):


def renderNeckMethod(self, visibility, offset, neck, alpha = False): #blazingamer: New neck rendering method

def project(beat):
return 0.125 * beat / self.beatsPerUnit # glorandwarf: was 0.12
if self.instrument.starPowerActive and (self.theme == 0 or self.theme == 1):#8bit
color = self.engine.theme.spNoteColor #self.spColor #(.3,.7,.9)
else:
color = (1,1,1)

color = (1,1,1)

v = visibility
l = self.boardLength

glEnable(GL_TEXTURE_2D)

board_tex = np.array([[0.0, project(offset - 2 * self.beatsPerUnit)],
[1.0, project(offset - 2 * self.beatsPerUnit)],
[0.0, project(offset - 1 * self.beatsPerUnit)],
[1.0, project(offset - 1 * self.beatsPerUnit)],
[0.0, project(offset + l * self.beatsPerUnit * .7)],
[1.0, project(offset + l * self.beatsPerUnit * .7)],
[0.0, project(offset + l * self.beatsPerUnit)],
[1.0, project(offset + l * self.beatsPerUnit)]], dtype=np.float32)
board_tex = np.array([[0.0, self.project(offset - 2 * self.beatsPerUnit)],
[1.0, self.project(offset - 2 * self.beatsPerUnit)],
[0.0, self.project(offset - 1 * self.beatsPerUnit)],
[1.0, self.project(offset - 1 * self.beatsPerUnit)],
[0.0, self.project(offset + l * self.beatsPerUnit * .7)],
[1.0, self.project(offset + l * self.beatsPerUnit * .7)],
[0.0, self.project(offset + l * self.beatsPerUnit)],
[1.0, self.project(offset + l * self.beatsPerUnit)]], dtype=np.float32)

#must be separate for neck flashing.
board_col = np.array([[color[0],color[1],color[2], 0],
Expand Down Expand Up @@ -478,8 +467,6 @@ def renderNeck(self, visibility, song, pos):
return

v = visibility
w = self.boardWidth
l = self.boardLength

offset = (pos - self.lastBpmChange) / self.currentPeriod + self.baseBeat

Expand Down Expand Up @@ -580,26 +567,21 @@ def drawTrack(self, visibility, song, pos):
if not song.readyToGo:
return

def project(beat):
return 0.125 * beat / self.beatsPerUnit # glorandwarf: was 0.12

v = visibility
w = self.boardWidth
l = self.boardLength

if self.staticStrings:
offset = 0
else:
offset = (pos - self.lastBpmChange) / self.currentPeriod + self.baseBeat

track_tex = np.array([[0.0, project(offset - 2 * self.beatsPerUnit)],
[1.0, project(offset - 2 * self.beatsPerUnit)],
[0.0, project(offset - 1 * self.beatsPerUnit)],
[1.0, project(offset - 1 * self.beatsPerUnit)],
[0.0, project(offset + l * self.beatsPerUnit * .7)],
[1.0, project(offset + l * self.beatsPerUnit * .7)],
[0.0, project(offset + l * self.beatsPerUnit)],
[1.0, project(offset + l * self.beatsPerUnit)]], dtype=np.float32)
track_tex = np.array([[0.0, self.project(offset - 2 * self.beatsPerUnit)],
[1.0, self.project(offset - 2 * self.beatsPerUnit)],
[0.0, self.project(offset - 1 * self.beatsPerUnit)],
[1.0, self.project(offset - 1 * self.beatsPerUnit)],
[0.0, self.project(offset + l * self.beatsPerUnit * .7)],
[1.0, self.project(offset + l * self.beatsPerUnit * .7)],
[0.0, self.project(offset + l * self.beatsPerUnit)],
[1.0, self.project(offset + l * self.beatsPerUnit)]], dtype=np.float32)

glEnable(GL_TEXTURE_2D)

Expand All @@ -625,9 +607,6 @@ def drawSideBars(self, visibility, song, pos):
if not song.readyToGo:
return

def project(beat):
return 0.125 * beat / self.beatsPerUnit # glorandwarf: was 0.12

color = (1,1,1)

v = visibility
Expand All @@ -636,16 +615,14 @@ def project(beat):

offset = (pos - self.lastBpmChange) / self.currentPeriod + self.baseBeat

c = (1,1,1)

board_tex = np.array([[0.0, project(offset - 2 * self.beatsPerUnit)],
[1.0, project(offset - 2 * self.beatsPerUnit)],
[0.0, project(offset - 1 * self.beatsPerUnit)],
[1.0, project(offset - 1 * self.beatsPerUnit)],
[0.0, project(offset + l * self.beatsPerUnit * .7)],
[1.0, project(offset + l * self.beatsPerUnit * .7)],
[0.0, project(offset + l * self.beatsPerUnit)],
[1.0, project(offset + l * self.beatsPerUnit)]], dtype=np.float32)
board_tex = np.array([[0.0, self.project(offset - 2 * self.beatsPerUnit)],
[1.0, self.project(offset - 2 * self.beatsPerUnit)],
[0.0, self.project(offset - 1 * self.beatsPerUnit)],
[1.0, self.project(offset - 1 * self.beatsPerUnit)],
[0.0, self.project(offset + l * self.beatsPerUnit * .7)],
[1.0, self.project(offset + l * self.beatsPerUnit * .7)],
[0.0, self.project(offset + l * self.beatsPerUnit)],
[1.0, self.project(offset + l * self.beatsPerUnit)]], dtype=np.float32)

#must be separate for sidebar flashing.
board_col = np.array([[color[0],color[1],color[2], 0],
Expand All @@ -672,7 +649,7 @@ def project(beat):
if shaders.enable("sololight"):
shaders.modVar("color",shaders.var["solocolor"])
shaders.setVar("offset",(-3.5,-w/2))
cmgl.drawArrays(GL_TRIANGLE_STRIP, verticeses=self.soloLightVtx1)
cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=self.soloLightVtx1)
shaders.setVar("offset",(-3.5,w/2))
shaders.setVar("time",shaders.time()+0.5)
cmgl.drawArrays(GL_TRIANGLE_STRIP, vertices=self.soloLightVtx2)
Expand All @@ -699,15 +676,8 @@ def drawBPM(self, visibility, song, pos):

glPushMatrix()
z = ((time - pos) / self.currentPeriod) / self.beatsPerUnit
z2 = ((time + event.length - pos) / self.currentPeriod) / self.beatsPerUnit
sw = 0.1 #width

if z > self.boardLength:
f = (self.boardLength - z) / (self.boardLength * .2)
elif z < 0:
f = min(1, max(0, 1 + z2))
else:
f = 1.0


bpm_vtx = np.array([[-(w / 2), 0, z + sw],
Expand Down
148 changes: 44 additions & 104 deletions src/Song.py
Expand Up @@ -109,9 +109,10 @@
}

class Part:
def __init__(self, id, text):
def __init__(self, id, text, trackName):
self.id = id
self.text = text
self.trackName = trackName #name of which the part is called in the midi

def __cmp__(self, other):
if isinstance(other, Part):
Expand All @@ -126,14 +127,14 @@ def __repr__(self):
return self.text

parts = {
GUITAR_PART: Part(GUITAR_PART, _("Guitar")),
RHYTHM_PART: Part(RHYTHM_PART, _("Rhythm")),
BASS_PART: Part(BASS_PART, _("Bass")),
LEAD_PART: Part(LEAD_PART, _("Lead")),
DRUM_PART: Part(DRUM_PART, _("Drums")),
VOCAL_PART: Part(VOCAL_PART, _("Vocals")),
PRO_GUITAR_PART: Part(PRO_GUITAR_PART, _("Pro Guitar")),
PRO_DRUM_PART: Part(PRO_DRUM_PART, _("Pro Drum"))
GUITAR_PART: Part(GUITAR_PART, _("Guitar"), ["PART GUITAR", "T1 GEMS" "Click", "Midi Out"]),
RHYTHM_PART: Part(RHYTHM_PART, _("Rhythm"), ["PART RHYTHM"]),
BASS_PART: Part(BASS_PART, _("Bass"), ["PART BASS"]),
LEAD_PART: Part(LEAD_PART, _("Lead"), ["PART LEAD"]),
DRUM_PART: Part(DRUM_PART, _("Drums"), ["PART DRUMS", "PART DRUM"]),
VOCAL_PART: Part(VOCAL_PART, _("Vocals"), ["PART VOCALS"]),
PRO_GUITAR_PART: Part(PRO_GUITAR_PART, _("Pro Guitar"), ["PART REAL GUITAR"]),
PRO_DRUM_PART: Part(PRO_DRUM_PART, _("Pro Drum"), ["PART REAL DRUM"])
}

class Difficulty:
Expand Down Expand Up @@ -2801,46 +2802,26 @@ def sequence_name(self, text):

tempText = "Found sequence_name in MIDI: " + text + ", recognized as "
tempText2 = ""
if (text == "PART GUITAR" or text == "T1 GEMS" or text == "Click" or text == "MIDI out") and parts[GUITAR_PART] in self.song.parts:
self.partnumber = parts[GUITAR_PART]
if self.logSections == 1:
tempText2 = "GUITAR_PART"
elif text == "PART RHYTHM" and parts[RHYTHM_PART] in self.song.parts:
self.partnumber = parts[RHYTHM_PART]
if self.logSections == 1:
tempText2 = "RHYTHM_PART"
elif text == "PART BASS" and parts[BASS_PART] in self.song.parts:
self.partnumber = parts[BASS_PART]
if self.logSections == 1:
tempText2 = "BASS_PART"
elif text == "PART GUITAR COOP" and parts[LEAD_PART] in self.song.parts:
self.partnumber = parts[LEAD_PART]
if self.logSections == 1:
tempText2 = "LEAD_PART"
elif text == "REAL GUITAR" and parts[PRO_GUITAR_PART] in self.song.parts:
self.partnumber = parts[PRO_GUITAR_PART]
if self.logSections == 1:
tempText2 = "PRO_GUITAR_PART"
elif (text == "PART DRUM" or text == "PART DRUMS") and parts[DRUM_PART] in self.song.parts:
self.partnumber = parts[DRUM_PART]
if self.logSections == 1:
tempText2 = "DRUM_PART"
elif text == "PART VOCALS": # MFH
self.partnumber = parts[VOCAL_PART]
self.vocalTrack = True
if self.partnumber in self.song.parts:
self.useVocalTrack = True
else:
self.useVocalTrack = False
else:
self.vocalTrack = False


for part in self.song.parts:
if text in part.trackName:
if (part.id == VOCAL_PART):
self.vocalTrack = True
self.useVocalTrack = True
self.partnumber = part
if self.logSections == 1:
tempText2 = name.replace(" ", "_")
break #should only have one instance of an instrument
break #end the searching

if text in parts[VOCAL_PART].trackName and parts[VOCAL_PART] not in self.song.parts:
self.useVocalTrack = False

if self.logSections == 1:
Log.debug(tempText + tempText2)

self.guitarSoloIndex = 0
self.guitarSoloActive = False


def note_on(self, channel, note, velocity):
if self.partnumber == None:
Expand Down Expand Up @@ -3302,66 +3283,25 @@ def sequence_name(self, text):
tempText = "MIDI sequence_name found: " + text + ", recognized and added to list as "
tempText2 = ""

if text == "PART GUITAR" or text == "T1 GEMS" or text == "Click":
if not parts[GUITAR_PART] in self.parts:
self.nextPart = parts[GUITAR_PART]
self.currentPart = self.nextPart.id
self.notesFound = [0, 0, 0, 0]
if self.logSections == 1:
tempText2 = "GUITAR_PART"
Log.debug(tempText + tempText2)

elif text == "PART RHYTHM":
if not parts[RHYTHM_PART] in self.parts:
self.nextPart = parts[RHYTHM_PART]
self.currentPart = self.nextPart.id
self.notesFound = [0, 0, 0, 0]
if self.logSections == 1:
tempText2 = "RHYTHM_PART"
Log.debug(tempText + tempText2)

elif text == "PART BASS":
if not parts[BASS_PART] in self.parts:
self.nextPart = parts[BASS_PART]
self.currentPart = self.nextPart.id
self.notesFound = [0, 0, 0, 0]
if self.logSections == 1:
tempText2 = "BASS_PART"
Log.debug(tempText + tempText2)

elif text == "PART GUITAR COOP":
if not parts[LEAD_PART] in self.parts:
self.nextPart = parts[LEAD_PART]
self.currentPart = self.nextPart.id
self.notesFound = [0, 0, 0, 0]
if self.logSections == 1:
tempText2 = "LEAD_PART"
Log.debug(tempText + tempText2)

#myfingershurt: drums, rock band rip compatible :)
elif text == "PART DRUM" or text == "PART DRUMS":
if not parts[DRUM_PART] in self.parts:
self.nextPart = parts[DRUM_PART]
self.currentPart = self.nextPart.id
self.notesFound = [0, 0, 0, 0]
self._drumFound = True #drum parts appear to be obligatory in WT songs, even if phantom.
if self.logSections == 1:
tempText2 = "DRUM_PART"
Log.debug(tempText + tempText2)

elif text == "PART VOCALS":
if not parts[VOCAL_PART] in self.parts:
part = parts[VOCAL_PART]
self.parts.append(part)
self.nextPart = None
self.currentPart = part.id
self.difficulties[part.id] = difficulties.values()
if self.logSections == 1:
tempText2 = "VOCAL_PART"
Log.debug(tempText + tempText2)

else:
self.currentPart = -1
for part in parts.values():
if text in part.trackName:
if part not in self.song.parts:
if part.id == VOCAL_PART:
self.parts.append(part)
self.nextPart = None
self.currentPart = part.id
self.difficulties[part.id] = difficulties.values()
else:
self.nextPart = part
self.currentPart = self.nextPart.id
self.notesFound = [0, 0, 0, 0]
if part.id == DRUM_PART:
self._drumFound = True
if self.logSections == 1:
tempText2 = part.trackName[0].replace(" ", "_")
Log.debug(tempText + tempText2)
return
self.currentPart = -1

def addPart(self):
self.parts.append(self.nextPart)
Expand Down

0 comments on commit 7733bb3

Please sign in to comment.