Skip to content

Commit

Permalink
Pass GuitarScene instance into instruments, and move a couple of ofte…
Browse files Browse the repository at this point in the history
…n set instance variables to run().
  • Loading branch information
mdsitton committed Sep 15, 2015
1 parent 80fcc1f commit b0b19da
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 17 deletions.
6 changes: 3 additions & 3 deletions fofix/game/guitarscene/GuitarScene.py
Expand Up @@ -731,7 +731,7 @@ def __init__(self, engine, libraryName, songName):
for j,player in enumerate(self.players):
guitar = True
if player.part.id == Song.VOCAL_PART:
inst = Vocalist(self.engine, player, player=j)
inst = Vocalist(self.engine, player, self, player=j)
if self.coOpRB:
inst.coOpRB = True
self.instruments.append(inst)
Expand All @@ -741,13 +741,13 @@ def __init__(self, engine, libraryName, songName):
guitar = False
elif player.part.id == Song.DRUM_PART:
#myfingershurt: drums :)
inst = Drum(self.engine, player, player=j)
inst = Drum(self.engine, player, self, player=j)
self.instruments.append(inst)
else:
bass = False
if player.part.id == Song.BASS_PART:
bass = True
inst = Guitar(self.engine, player, player=j, bass = bass)
inst = Guitar(self.engine, player, self, player=j, bass = bass)
self.instruments.append(inst)
if player.part.id == Song.LEAD_PART or player.part.id == Song.GUITAR_PART: #both these selections should get guitar solos
self.instruments[j].canGuitarSolo = True
Expand Down
7 changes: 3 additions & 4 deletions fofix/game/guitarscene/instruments/Drum.py
Expand Up @@ -75,7 +75,7 @@ def __init__(self, engine, playerObj, song, player = 0):
self.lastFretWasC = False


self.matchingNotes = None
self.matchingNotes = []

#MFH - I do not understand fully how the handicap scorecard works at the moment, nor do I have the time to figure it out.
#... so for now, I'm just writing some extra code here for the early hitwindow size handicap.
Expand Down Expand Up @@ -739,9 +739,6 @@ def startPick(self, song, pos, controls, hopo = False):
if not song.readyToGo:
return

self.matchingNotes = self.getRequiredNotes(song, pos) #MFH - ignore skipped notes please!


# no self.matchingNotes?
if not self.matchingNotes:
return False
Expand Down Expand Up @@ -772,6 +769,8 @@ def run(self, ticks, pos, controls):
if not self.paused:
self.time += ticks

self.matchingNotes = self.getRequiredNotes(self.scene.song, pos)

#MFH - Determine which frame to display for starpower notes
if self.noteSpin:
self.indexCount = self.indexCount + 1
Expand Down
10 changes: 4 additions & 6 deletions fofix/game/guitarscene/instruments/Guitar.py
Expand Up @@ -45,8 +45,8 @@
from fofix.core import Log

class Guitar(Instrument):
def __init__(self, engine, playerObj, player = 0, bass = False):
super(Guitar, self).__init__(engine, playerObj, player=player)
def __init__(self, engine, playerObj, scene, player = 0, bass = False):
super(Guitar, self).__init__(engine, playerObj, scene, player=player)

self.isDrum = False
self.isBassGuitar = bass
Expand Down Expand Up @@ -721,8 +721,6 @@ def startPick(self, song, pos, controls):

self.playedNotes = []

self.matchingNotes = self.getRequiredNotes(song, pos)

if self.controlsMatchNotes(controls, self.matchingNotes):
self.pickStartPos = pos
for time, note in self.matchingNotes:
Expand Down Expand Up @@ -782,8 +780,6 @@ def startPick3(self, song, pos, controls, hopo = False):
self.lastPlayedNotes = self.playedNotes
self.playedNotes = []

self.matchingNotes = self.getRequiredNotes(song, pos)

self.controlsMatchNotes3(controls, self.matchingNotes, hopo)

#myfingershurt
Expand Down Expand Up @@ -884,6 +880,8 @@ def run(self, ticks, pos, controls):
if not self.paused:
self.time += ticks

self.matchingNotes = self.getRequiredNotes(self.scene.song, pos)

#MFH - Determine which frame to display for starpower notes
if self.noteSpin:
self.indexCount = self.indexCount + 1
Expand Down
4 changes: 3 additions & 1 deletion fofix/game/guitarscene/instruments/Instrument.py
Expand Up @@ -36,8 +36,10 @@


class Instrument(object):
def __init__(self, engine, playerObj, player = 0):
def __init__(self, engine, playerObj, scene, player = 0):
self.engine = engine
self.scene = scene
self.song = self.scene.song

self.starPowerDecreaseDivisor = 200.0/self.engine.audioSpeedFactor

Expand Down
4 changes: 2 additions & 2 deletions fofix/game/guitarscene/instruments/ProGuitar.py
Expand Up @@ -34,8 +34,8 @@


class ProGuitar(Guitar):
def __init__(self, engine, playerObj, player = 0, bass = False):
super(ProGuitar, self).__init__(engine, playerObj, player = player, bass = bass)
def __init__(self, engine, playerObj, scene, player = 0, bass = False):
super(ProGuitar, self).__init__(engine, playerObj, scene, player = player, bass = bass)

self.strings = 6

Expand Down
4 changes: 3 additions & 1 deletion fofix/game/guitarscene/instruments/Vocalist.py
Expand Up @@ -40,8 +40,10 @@
baseScores = {0: 1000, 1: 800, 2: 400, 3: 200}

class Vocalist:
def __init__(self, engine, playerObj, player = 0):
def __init__(self, engine, playerObj, scene, player = 0):
self.engine = engine
self.scene = scene
self.song = self.scene.song

self.mic = Microphone(self.engine, playerObj.controller)

Expand Down

0 comments on commit b0b19da

Please sign in to comment.