|
From: Tapio V. <aa...@us...> - 2010-03-15 10:12:01
|
Module: performous
Branch: hitglow
Commit: 4a160b3dffc5cf2f7eb245189da9d96ce13ab7e5
Author: Tapio Vierros <tap...@gm...>
Date: Sun Jan 31 11:17:10 2010 +0200
WIP
---
game/guitargraph.cc | 28 ++++++---
game/guitargraph.hh | 18 +++---
themes/default/hit_glow.svg | 144 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 174 insertions(+), 16 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index d4f1b9f..aff2993 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -54,13 +54,14 @@ GuitarGraph::GuitarGraph(Audio& audio, Song const& song, bool drums, int number)
m_audio(audio),
m_input(drums ? input::DRUMS : input::GUITAR),
m_song(song),
- m_button(getThemePath("button.svg")),
m_tail(getThemePath("tail.svg")),
m_tail_glow(getThemePath("tail_glow.svg")),
m_tail_drumfill(getThemePath("tail_drumfill.svg")),
m_flame(getThemePath("flame.svg")),
m_flame_godmode(getThemePath("flame_godmode.svg")),
+ m_button(getThemePath("button.svg")),
m_tap(getThemePath("tap.svg")),
+ m_hitglow(getThemePath("hit_glow.svg")),
m_neckglow(getThemePath("neck_glow.svg")),
m_neckglowColor(),
m_drums(drums),
@@ -118,8 +119,11 @@ GuitarGraph::GuitarGraph(Audio& audio, Song const& song, bool drums, int number)
m_samples.push_back(Sample(getPath("sounds/guitar_fail5.ogg"), sr));
m_samples.push_back(Sample(getPath("sounds/guitar_fail6.ogg"), sr));
}
- for (int i = 0; i < 6; ++i) m_hit[i].setRate(5.0);
- for (int i = 0; i < 5; ++i) m_holds[i] = 0;
+ for (int i = 0; i < 6; ++i) m_press[i].setRate(5.0);
+ for (int i = 0; i < 5; ++i) {
+ m_holds[i] = 0;
+ m_hit[i] = AnimValue(0.0, 1.0);
+ }
m_track_index = m_track_map.begin();
while (number--) nextTrack(true);
difficultyAuto();
@@ -189,7 +193,7 @@ void GuitarGraph::engine() {
// Handle key markers
if (!m_drums) {
for (int i = 0; i < 5; ++i) {
- if (m_input.pressed(i)) m_hit[i + 1].setValue(1.0);
+ if (m_input.pressed(i)) m_press[i + 1].setValue(1.0);
}
}
if (!m_drumfills.empty()) updateDrumFill(time); // Drum Fills / BREs
@@ -219,8 +223,8 @@ void GuitarGraph::engine() {
if (ev.type == input::Event::WHAMMY) whammy = (1.0 + ev.button + 2.0*(rand()/double(RAND_MAX))) / 4.0;
}
// Keypress anims
- if (ev.type == input::Event::PRESS) m_hit[!m_drums + ev.button].setValue(1.0);
- else if (ev.type == input::Event::PICK) m_hit[0].setValue(1.0);
+ if (ev.type == input::Event::PRESS) m_press[!m_drums + ev.button].setValue(1.0);
+ else if (ev.type == input::Event::PICK) m_press[0].setValue(1.0);
// Difficulty and track selection
if (time < m_jointime) {
if (ev.type == input::Event::PICK || ev.type == input::Event::PRESS) {
@@ -621,13 +625,13 @@ void GuitarGraph::draw(double time) {
}
// Draw the cursor
- float level = m_hit[0].get();
+ float level = m_press[0].get();
glColor3f(level, level, level);
drawBar(0.0, 0.01f);
// Fret buttons on cursor
for (int fret = m_drums; fret < 5; ++fret) {
float x = -2.0f + fret - 0.5f * m_drums;
- float l = m_hit[fret + !m_drums].get();
+ float l = m_press[fret + !m_drums].get();
// Get a color for the fret and adjust it if GodMode is on
glColor4fv(colorize(color(fret), time));
m_button.dimensions.center(time2y(0.0)).middle(x);
@@ -635,6 +639,14 @@ void GuitarGraph::draw(double time) {
glColor3f(l, l, l);
m_tap.dimensions = m_button.dimensions;
m_tap.draw();
+
+ // Glow
+ if (m_drums || !m_holds[fret]) continue;
+ Event& ev = m_events[m_holds[fret] - 1];
+ float glow = ev.glow.get();
+ glColor3f(glow, glow, glow);
+ m_hitglow.dimensions.center(time2y(0.0)).middle(x).fixedWidth(3*fretWid);
+ m_hitglow.draw();
}
// Draw the notes
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index 3236464..c431764 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -76,18 +76,20 @@ class GuitarGraph {
Audio& m_audio;
input::InputDev m_input; /// input device (guitar/drums/keyboard)
Song const& m_song;
- Surface m_button;
- Texture m_tail;
- Texture m_tail_glow;
- Texture m_tail_drumfill;
- Texture m_flame;
- Texture m_flame_godmode;
+ Texture m_tail; /// hold note tail
+ Texture m_tail_glow; /// hold note tail when hitting
+ Texture m_tail_drumfill; /// drum fill note texture
+ Texture m_flame; /// hit flame
+ Texture m_flame_godmode; /// hit flame for godmode
+ Surface m_button; /// 2d note / cursor
Surface m_tap; /// image for 2d HOPO note cap
+ Surface m_hitglow; /// hit flame for godmode
Surface m_neckglow; /// image for the glow from the bottom of the neck
- glutil::Color m_neckglowColor;
+ glutil::Color m_neckglowColor; /// holds the current color for the glow from the bottom of the neck
Object3d m_fretObj; /// 3d object for regular note
Object3d m_tappableObj; /// 3d object for the HOPO note cap
- AnimValue m_hit[6];
+ AnimValue m_press[6]; /// key pressing animation
+ AnimValue m_hit[5]; /// note hitting animation for cursor
std::vector<Sample> m_samples; /// sound effects
boost::scoped_ptr<Texture> m_neck; /// necks
bool m_drums; /// are we using drums?
diff --git a/themes/default/hit_glow.svg b/themes/default/hit_glow.svg
new file mode 100644
index 0000000..bb62da9
--- /dev/null
+++ b/themes/default/hit_glow.svg
@@ -0,0 +1,144 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="64"
+ height="64"
+ id="svg2463"
+ sodipodi:version="0.32"
+ inkscape:version="0.47 r22583"
+ version="1.0"
+ sodipodi:docname="hit_glow.svg"
+ inkscape:output_extension="org.inkscape.output.svg.inkscape">
+ <defs
+ id="defs2465">
+ <linearGradient
+ id="linearGradient3600">
+ <stop
+ style="stop-color:#ffffff;stop-opacity:0.78431374;"
+ offset="0"
+ id="stop3602" />
+ <stop
+ style="stop-color:#ffff00;stop-opacity:0.25098041;"
+ offset="1"
+ id="stop3604" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3262">
+ <stop
+ style="stop-color:#f5f5f5;stop-opacity:0.22680412;"
+ offset="0"
+ id="stop3264" />
+ <stop
+ style="stop-color:#f5f5f5;stop-opacity:0.96078432;"
+ offset="1"
+ id="stop3266" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3751"
+ inkscape:collect="always">
+ <stop
+ id="stop3753"
+ offset="0"
+ style="stop-color:black;stop-opacity:1;" />
+ <stop
+ id="stop3755"
+ offset="1"
+ style="stop-color:black;stop-opacity:0;" />
+ </linearGradient>
+ <inkscape:perspective
+ sodipodi:type="inkscape:persp3d"
+ inkscape:vp_x="0 : 526.18109 : 1"
+ inkscape:vp_y="0 : 1000 : 0"
+ inkscape:vp_z="744.09448 : 526.18109 : 1"
+ inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
+ id="perspective2471" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3751"
+ id="linearGradient3272"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.3868046,0,0,0.3868046,40.335717,481.59837)"
+ x1="665.12128"
+ y1="684.16162"
+ x2="381.28015"
+ y2="449.80624" />
+ <linearGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3751"
+ id="linearGradient2406"
+ gradientUnits="userSpaceOnUse"
+ gradientTransform="matrix(0.3868046,0,0,0.3868046,43.114888,485.8841)"
+ x1="665.12128"
+ y1="684.16162"
+ x2="381.28015"
+ y2="449.80624" />
+ <radialGradient
+ inkscape:collect="always"
+ xlink:href="#linearGradient3600"
+ id="radialGradient3606"
+ cx="38.125"
+ cy="37.30357"
+ fx="38.125"
+ fy="37.30357"
+ r="20.446428"
+ gradientTransform="matrix(1,0,0,0.50218342,0,18.570335)"
+ gradientUnits="userSpaceOnUse" />
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#f5f5f5"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="5.6"
+ inkscape:cx="20.407018"
+ inkscape:cy="40.003406"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="false"
+ inkscape:window-width="1021"
+ inkscape:window-height="720"
+ inkscape:window-x="87"
+ inkscape:window-y="34"
+ inkscape:window-maximized="0" />
+ <metadata
+ id="metadata2468">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(-110.35967,-771.51188)">
+ <path
+ sodipodi:type="arc"
+ style="fill:url(#radialGradient3606);fill-opacity:1;fill-rule:nonzero;stroke:none"
+ id="path3598"
+ sodipodi:cx="38.125"
+ sodipodi:cy="37.30357"
+ sodipodi:rx="20.446428"
+ sodipodi:ry="10.267858"
+ d="m 58.571428,37.30357 a 20.446428,10.267858 0 1 1 -40.892856,0 20.446428,10.267858 0 1 1 40.892856,0 z"
+ transform="matrix(1.5650655,0,0,3.1165216,82.691547,687.2545)" />
+ </g>
+</svg>
|