Skip to content

Commit

Permalink
Adds theme settings for controlling how the color of power is used fo…
Browse files Browse the repository at this point in the history
…r themes
  • Loading branch information
mdsitton committed Sep 17, 2011
1 parent 91e59a1 commit 9adb235
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 32 deletions.
77 changes: 45 additions & 32 deletions src/Instrument.py
Expand Up @@ -99,13 +99,15 @@ def __init__(self, engine, playerObj, player = 0):

self.tempoBpm = 120 #MFH - default is NEEDED here...

self.beatsPerBoard = 5.0
self.boardWidth = self.engine.theme.neckWidth
self.boardLength = self.engine.theme.neckLength
self.beatsPerUnit = self.beatsPerBoard / self.boardLength
self.fretColors = self.engine.theme.noteColors
self.spColor = self.engine.theme.spNoteColor
self.useFretColors = self.engine.theme.use_fret_colors
self.beatsPerBoard = 5.0
self.boardWidth = self.engine.theme.neckWidth
self.boardLength = self.engine.theme.neckLength
self.beatsPerUnit = self.beatsPerBoard / self.boardLength
self.fretColors = self.engine.theme.noteColors
self.spColor = self.engine.theme.spNoteColor
self.useFretColors = self.engine.theme.use_fret_colors
self.powerActiveColorToggle = self.engine.theme.powerActiveColorToggle
self.powerGainColorToggle = self.engine.theme.powerGainColorToggle

if not self.engine.theme.killNoteColor == "frets":
kC = self.engine.theme.killNoteColor
Expand Down Expand Up @@ -865,7 +867,10 @@ def renderHitTrails(self, controls):
flameColorMod = (1.19, 1.97, 10.59)
flamecol = tuple([color[ifc]*flameColorMod[ifc] for ifc in range(3)])

if self.starPowerActive or self.spNote == True:
if self.starPowerActive and self.powerActiveColorToggle:
flamecol = self.spColor

elif self.spNote and self.powerGainColorToggle:
flamecol = self.spColor

self.engine.draw3Dtex(self.hitglowDrawing, coord = (x, y + .15, z), rot = self.hitGlowsRotation,
Expand All @@ -881,8 +886,12 @@ def renderHitTrails(self, controls):
flameColorMod = (1.19, 1.78, 12.22)
flamecol = tuple([color[ifc]*flameColorMod[ifc] for ifc in range(3)])

if self.starPowerActive or self.spNote == True:
if self.starPowerActive and self.powerActiveColorToggle:
flamecol = self.spColor

elif self.spNote and self.powerGainColorToggle:
flamecol = self.spColor

self.engine.draw3Dtex(self.hitglow2Drawing, coord = (x, y, z), rot = self.hitGlowsRotation,
scale = (.40 + .6 * ms * ff, 1.5 + .6 * ms * ff, 1 + .6 * ms * ff),
vertex = (-vtx,-vtx,vtx,vtx), texcoord = (0.0,0.0,1.0,1.0),
Expand Down Expand Up @@ -993,8 +1002,10 @@ def renderFlames(self, song, pos):
x = (self.strings / 2 - event.number) * w
flameColor = self.flameColors[event.number]

if self.starPowerActive:
flameColor = self.spColor
if self.starPowerActive and self.powerActiveColorToggle:
flamecol = self.spColor
elif event.star and self.powerGainColorToggle:
flamecol = self.spColor

ms = math.sin(self.time) * .25 + 1

Expand Down Expand Up @@ -1262,6 +1273,8 @@ def renderNotes(self, visibility, song, pos):
else:
continue #can't break. Tempo.

self.spNote = False

if self.isDrum:
x = (self.strings / 2 - .5 - (event.number - 1)) * w
isOpen = False
Expand Down Expand Up @@ -1318,8 +1331,6 @@ def renderNotes(self, visibility, song, pos):
elif self.spRefillMode == 2 and song.midiStyle != 1: #mode 2 = refill based on MIDI type
self.spEnabled = False

self.spNote = False

if event.star:
self.starNotesInView = True
if event.finalStar:
Expand All @@ -1328,8 +1339,8 @@ def renderNotes(self, visibility, song, pos):

if event.star and self.spEnabled:
self.spNote = True

if event.finalStar and self.spEnabled:
self.spNote = True
if event.played or event.hopod:
if event.flameCount < 1 and not self.starPowerGained:
if self.starPower < 50 and self.isDrum: #not enough starpower to activate yet, kill existing drumfills
Expand Down Expand Up @@ -1704,8 +1715,11 @@ def project(beat):
if not self.simpleTails: #Seperate Tail images dont color the images
tailcol = (1,1,1,1)

elif spNote == True: #Power colored
tailcol = (self.spColor)
elif self.starPowerActive and self.powerActiveColorToggle:
tailcol = self.spColor

elif spNote and self.powerGainColorToggle:
tailcol = self.spColor

elif big == False and tailOnly == True: #grey because the note was missed
tailcol = (.6, .6, .6, color[3])
Expand Down Expand Up @@ -1740,7 +1754,11 @@ def project(beat):
tex1 = self.kill1
tex2 = self.kill2
else:
if self.starPowerActive and not color == (0,0,0,1):
if self.starPowerActive and self.powerActiveColorToggle and not color == (0,0,0,1):
tex1 = self.btail6
tex2 = self.btaile6

elif spNote and self.powerGainColorToggle and not color == (0,0,0,1):
tex1 = self.btail6
tex2 = self.btaile6
else:
Expand All @@ -1752,7 +1770,10 @@ def project(beat):
tex1 = self.tail0
tex2 = self.taile0
else:
if self.starPowerActive and not color == (0,0,0,1):
if self.starPowerActive and self.powerActiveColorToggle and not color == (0,0,0,1):
tex1 = self.tail6
tex2 = self.taile6
elif spNote and self.powerGainColorToggle and not color == (0,0,0,1):
tex1 = self.tail6
tex2 = self.taile6
else:
Expand Down Expand Up @@ -2024,14 +2045,12 @@ def renderTails(self, visibility, song, pos, killswitch):
length = 0
tailOnly = False

spNote = False

#myfingershurt: user setting for starpower refill / replenish notes

if event.star and self.spEnabled:
spNote = True
if event.finalStar and self.spEnabled:
spNote = True
if self.spEnabled and (event.star or event.finalStar):
spNote = event.star
else:
spNote = False

if event.tappable < 2:
isTappable = False
Expand Down Expand Up @@ -2139,19 +2158,13 @@ def waveForm(t):
f2 = min((s - t) / (6 * step), 1.0)
a1 = waveForm(t) * f1
a2 = waveForm(t - step) * f2
if self.starPowerActive and self.theme != 2:#8bit
glColor4f(self.spColor[0],self.spColor[1],self.spColor[2],1) #(.3,.7,.9,1)
else:
glColor4f(c[0], c[1], c[2], .5)
glColor4f(c[0], c[1], c[2], .5)
glVertex3f(x - a1, 0, z)
glVertex3f(x - a2, 0, z - zStep)
glColor4f(1, 1, 1, .75)
glVertex3f(x, 0, z)
glVertex3f(x, 0, z - zStep)
if self.starPowerActive and self.theme != 2:#8bit
glColor4f(self.spColor[0],self.spColor[1],self.spColor[2],1) #(.3,.7,.9,1)
else:
glColor4f(c[0], c[1], c[2], .5)
glColor4f(c[0], c[1], c[2], .5)
glVertex3f(x + a1, 0, z)
glVertex3f(x + a2, 0, z - zStep)
glVertex3f(x + a2, 0, z - zStep)
Expand Down
4 changes: 4 additions & 0 deletions src/Theme.py
Expand Up @@ -175,6 +175,10 @@ def get(value, type = str, default = None):
self.noteColors = [get("fret%d_color" % i, "color", default_color[i]) for i in range(6)]
self.spNoteColor = get("fretS_color", "color", "#4CB2E5")

#Specifies how the power color is used in-game for both Active power and gaining power
self.powerGainColorToggle = get("power_color_gain_toggle", bool, True)
self.powerActiveColorToggle = get("power_color_active_toggle", bool, False)

#Color of the tails when whammied, default is set to the colors of the frets
self.killNoteColor = get("fretK_color", str, "frets")
if not self.killNoteColor == "frets":
Expand Down

0 comments on commit 9adb235

Please sign in to comment.