You can subscribe to this list here.
| 2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(25) |
Jul
(288) |
Aug
(119) |
Sep
(31) |
Oct
(59) |
Nov
(458) |
Dec
(359) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(268) |
Feb
(26) |
Mar
(36) |
Apr
(48) |
May
(119) |
Jun
(37) |
Jul
(173) |
Aug
(429) |
Sep
(137) |
Oct
(156) |
Nov
(59) |
Dec
(45) |
| 2011 |
Jan
(398) |
Feb
(257) |
Mar
(49) |
Apr
(5) |
May
(34) |
Jun
(11) |
Jul
(38) |
Aug
(12) |
Sep
(1) |
Oct
(49) |
Nov
(5) |
Dec
(10) |
| 2012 |
Jan
(21) |
Feb
(32) |
Mar
(20) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(173) |
Aug
|
Sep
(25) |
Oct
(6) |
Nov
(44) |
Dec
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:54
|
Module: performous
Branch: dance
Commit: 0a06ddc7ce7262d75674b09b962c4e9a9bb0746f
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun Nov 1 03:29:54 2009 +0200
Disable switching between drums and guitars, do not use string keys and lookup all the time
---
game/guitargraph.cc | 51 +++++++++++++++++++++++++++++----------------------
game/guitargraph.hh | 10 ++++++----
2 files changed, 35 insertions(+), 26 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 8c9e51f..8bf38c3 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -54,6 +54,7 @@ GuitarGraph::GuitarGraph(Audio& audio, Song const& song, std::string track):
m_cx(0.0, 0.2),
m_width(0.5, 0.4),
m_stream(),
+ m_track_index(m_track_map.end()),
m_level(),
m_dead(1000),
m_text(getThemePath("sing_timetxt.svg"), config["graphic/text_lod"].f()),
@@ -81,19 +82,23 @@ GuitarGraph::GuitarGraph(Audio& audio, Song const& song, std::string track):
unsigned int i = 0;
for (TrackMap::const_iterator it = m_song.track_map.begin(); it != m_song.track_map.end(); ++it,++i) {
std::string index = it->first;
- m_track_map.insert(make_pair(index, &it->second));
- if( index == track ) m_track_index = index;
-
- // load required textures (even the unused)
- if (index == "drums") m_necks.insert(index, new Texture("drumneck.svg"));
- else if (index == "bass") m_necks.insert(index, new Texture("bassneck.svg"));
- else m_necks.insert(index, new Texture("guitarneck.svg"));
+ TrackMapConstPtr::const_iterator it2 = m_track_map.insert(std::make_pair(index, &it->second)).first;
+ if (index == track) m_track_index = it2;
}
- if( m_track_index.empty() ) throw std::runtime_error("Could not find track \"" + track + "\"");
+ if (m_track_index == m_track_map.end()) throw std::runtime_error("Could not find track \"" + track + "\"");
for (int i = 0; i < 6; ++i) m_hit[i].setRate(5.0);
for (int i = 0; i < 5; ++i) m_holds[i] = 0;
if (m_track_map.empty()) throw std::runtime_error("No track");
difficultyAuto();
+ updateNeck();
+}
+
+void GuitarGraph::updateNeck() {
+ // TODO: Optimize with texture cache
+ std::string index = m_track_index->first;
+ if (index == "drums") m_neck.reset(new Texture("drumneck.svg"));
+ else if (index == "bass") m_neck.reset(new Texture("bassneck.svg"));
+ else m_neck.reset(new Texture("guitarneck.svg"));
}
void GuitarGraph::engine() {
@@ -117,15 +122,7 @@ void GuitarGraph::engine() {
else if (ev.type == input::Event::PICK) m_hit[0].setValue(1.0);
if (time < -0.5) {
if (ev.type == input::Event::PICK || (m_drums && ev.type == input::Event::PRESS)) {
- if (m_drums ? ev.pressed[0] : ev.pressed[4]) {
- // lets find the next track
- TrackMapConstPtr::iterator track_it = m_track_map.find(m_track_index);
- if( track_it != m_track_map.end() ) {
- ++track_it;
- m_track_index = (track_it != m_track_map.end() ? track_it : m_track_map.begin())->first;
- }
- if (!difficulty(m_level)) difficultyAuto();
- }
+ if (!m_drums && ev.pressed[4]) nextTrack();
if (ev.pressed[0 + m_drums]) difficulty(DIFFICULTY_SUPAEASY);
else if (ev.pressed[1 + m_drums]) difficulty(DIFFICULTY_EASY);
else if (ev.pressed[2 + m_drums]) difficulty(DIFFICULTY_MEDIUM);
@@ -299,13 +296,23 @@ void GuitarGraph::guitarPlay(double time, input::Event const& ev) {
}
}
-void GuitarGraph::difficultyAuto() {
+void GuitarGraph::nextTrack() {
+ while (1) {
+ if (++m_track_index == m_track_map.end()) m_track_index = m_track_map.begin();
+ if (m_track_index->first != "drums") break; // Only accept non-drum tracks
+ }
+ difficultyAuto();
+ updateNeck();
+}
+
+void GuitarGraph::difficultyAuto(bool tryKeep) {
+ if (tryKeep && difficulty(Difficulty(m_level))) return;
for (int level = 0; level < DIFFICULTYCOUNT; ++level) if (difficulty(Difficulty(level))) return;
throw std::runtime_error("No difficulty levels found");
}
bool GuitarGraph::difficulty(Difficulty level) {
- Track const& track = *m_track_map.find(m_track_index)->second;
+ Track const& track = *m_track_index->second;
// Find the stream number
for (TrackMap::const_iterator it = m_song.track_map.begin(); it != m_song.track_map.end(); ++it) {
if (&track == &it->second) break;
@@ -345,7 +352,7 @@ void GuitarGraph::draw(double time) {
// Draw scores
if (time < -0.5) {
std::string txt;
- txt += m_track_map.find(m_track_index)->first + "\n" + diffv[m_level].name;
+ txt += m_track_index->first + "\n" + diffv[m_level].name;
m_text.dimensions.screenBottom(-0.05).middle(-0.1 + offsetX);
m_text.draw(txt);
} else {
@@ -363,7 +370,7 @@ void GuitarGraph::draw(double time) {
{ float s = dimensions.w() / 5.0f; glScalef(s, s, s); }
// Draw the neck
{
- UseTexture tex(*m_necks.find(m_track_index)->second);
+ UseTexture tex(*m_neck);
glutil::Begin block(GL_TRIANGLE_STRIP);
float w = (m_drums ? 2.0f : 2.5f);
float texCoord = 0.0f;
@@ -502,7 +509,7 @@ void GuitarGraph::updateChords() {
Durations::size_type pos[5] = {}, size[5] = {};
Durations const* durations[5] = {};
for (int fret = 0; fret < 5; ++fret) {
- NoteMap const& nm = m_track_map.find(m_track_index)->second->nm;
+ NoteMap const& nm = m_track_index->second->nm;
int basepitch = diffv[m_level].basepitch;
NoteMap::const_iterator it = nm.find(basepitch + fret);
if (it == nm.end()) continue;
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index e0eb849..c20b95e 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -49,13 +49,14 @@ class GuitarGraph {
/** draws GuitarGraph
* @param time at which time to draw
*/
+ void updateNeck();
void draw(double time);
void engine();
void position(double cx, double width) { m_cx.setTarget(cx); m_width.setTarget(width); }
double dead(double time) const { return time > -0.5 && m_dead > 50; }
unsigned stream() const { return m_stream; }
double correctness() const { return m_correctness.get(); }
- std::string getTrackIndex() const { return m_track_index; }
+ std::string getTrackIndex() const { return m_track_index->first; }
int getScore() const { return m_score * m_scoreFactor; }
private:
void fail(double time, int fret);
@@ -67,12 +68,12 @@ class GuitarGraph {
Texture m_button_l;
Surface m_tap;
AnimValue m_hit[6];
- boost::ptr_map<std::string,Texture> m_necks;
+ boost::scoped_ptr<Texture> m_neck;
bool m_drums;
AnimValue m_cx, m_width;
- std::string m_track_index;
std::size_t m_stream;
TrackMapConstPtr m_track_map;
+ TrackMapConstPtr::const_iterator m_track_index;
void drumHit(double time, int pad);
void guitarPlay(double time, input::Event const& ev);
enum Difficulty {
@@ -99,7 +100,8 @@ class GuitarGraph {
glutil::Color const& color(int fret) const;
void drawBar(double time, float h);
void drawNote(int fret, glutil::Color, float tBeg, float tEnd, float whammy = 0);
- void difficultyAuto();
+ void nextTrack();
+ void difficultyAuto(bool tryKeepCurrent = false);
bool difficulty(Difficulty level);
SvgTxtTheme m_text;
void updateChords();
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:52
|
Module: performous
Branch: dance
Commit: a6c9f3bb541f0ccec3afdfc6b1b63088b64ba7d8
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun Nov 1 02:55:14 2009 +0200
Remove unused typedefs
---
game/notes.hh | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/game/notes.hh b/game/notes.hh
index 59c3fc6..e5caf5a 100644
--- a/game/notes.hh
+++ b/game/notes.hh
@@ -52,9 +52,6 @@ struct Track {
NoteMap nm;
};
-// TODO: remove the following two types
-typedef std::vector<Track> TrackVector;
-typedef std::vector<Track const*> TrackVectorConstPtr;
// keep these ones
typedef std::map<std::string,Track> TrackMap;
typedef std::map<std::string,Track const*> TrackMapConstPtr; // this one really needed ? can't we save only the map key for comparison ?
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:51
|
Module: performous
Branch: dance
Commit: 7f743aa0dfc40ab9961c0ebdaca9f9d2fedec8a4
Author: Lasse Karkkainen <tro...@tr...>
Date: Sun Nov 1 02:35:07 2009 +0200
Make SELECT button quit from singing screen
---
game/screen_sing.cc | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index b1bc46f..397b543 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -182,7 +182,11 @@ void ScreenSing::manageEvent(SDL_Event event) {
}
} else if (event.type == SDL_JOYBUTTONDOWN) {
int button = event.jbutton.button;
- if (button == 8 || button == 9) m_audio.togglePause();
+ if (button == 9 /* START */) m_audio.togglePause();
+ if (button == 8 /* SELECT */) {
+ ScreenManager::getSingletonPtr()->activateScreen("Songs");
+ return;
+ }
}
}
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:49
|
Module: performous Branch: dance Commit: 8b1c6e77c3dfab9517555f67f25d92a66e598ab4 Author: Lasse Karkkainen <tro...@tr...> Date: Fri Oct 30 19:37:15 2009 +0200 Merge branch 'master' of ssh://tronic@git.performous.org/gitroot/performous/performous --- |
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:47
|
Module: performous
Branch: dance
Commit: eb42d079490e031cf8722fc7ec41c4c9859cddb1
Author: Lasse Karkkainen <tro...@tr...>
Date: Fri Oct 30 19:35:40 2009 +0200
Fix the bad_alloc issue that has been around for a long time, even in 0.3 series.
---
game/engine.hh | 16 +++++++++++-----
game/song.cc | 2 ++
game/song.hh | 1 +
game/songparser.hh | 2 ++
4 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/game/engine.hh b/game/engine.hh
index 49b401c..ee00df9 100644
--- a/game/engine.hh
+++ b/game/engine.hh
@@ -19,6 +19,8 @@ namespace {
size_t playerColorsSize = sizeof(playerColors) / sizeof(*playerColors);
}
+#include <iostream>
+
/// performous engine
class Engine {
Audio& m_audio;
@@ -44,11 +46,15 @@ class Engine {
// clear old player information
m_players.cur.clear();
m_players.scores.clear();
-
- size_t frames = m_audio.getLength() / Engine::TIMESTEP;
- while (anBegin != anEnd) m_players.cur.push_back(Player(song, *anBegin++, frames));
- size_t player = 0;
- for (std::list<Player>::iterator it = m_players.cur.begin(); it != m_players.cur.end(); ++it, ++player) it->m_color = playerColors[player % playerColorsSize];
+ // Only add players if the vocal track has sensible length (not NaN or extremely long)
+ std::cout << "Endtime: " << song.endTime << std::endl;
+ if (song.endTime < 10000.0) {
+ // Calculate the space required for pitch frames
+ size_t frames = song.endTime / Engine::TIMESTEP;
+ while (anBegin != anEnd) m_players.cur.push_back(Player(song, *anBegin++, frames));
+ size_t player = 0;
+ for (std::list<Player>::iterator it = m_players.cur.begin(); it != m_players.cur.end(); ++it, ++player) it->m_color = playerColors[player % playerColorsSize];
+ }
m_thread.reset(new boost::thread(boost::ref(*this)));
}
~Engine() { kill(); }
diff --git a/game/song.cc b/game/song.cc
index 1bf5b4f..d75d92a 100644
--- a/game/song.cc
+++ b/game/song.cc
@@ -1,6 +1,7 @@
#include "song.hh"
#include "songparser.hh"
+#include "util.hh"
#include <limits>
#include <algorithm>
@@ -25,6 +26,7 @@ void Song::reload(bool errorIgnore) {
noteMax = std::numeric_limits<int>::min();
videoGap = 0.0;
start = 0.0;
+ beginTime = endTime = getNaN();
m_scoreFactor = 0.0;
try { SongParser(*this); } catch (...) { if (!errorIgnore) throw; }
collateUpdate();
diff --git a/game/song.hh b/game/song.hh
index dd3e9df..f02bf87 100644
--- a/game/song.hh
+++ b/game/song.hh
@@ -73,6 +73,7 @@ class Song: boost::noncopyable {
std::vector<double> pitchPitchGraph; ///< pitch of pitch graph
std::vector<double> volumePitchGraph; ///< volume of pitch graph
std::vector<bool> drawPitchGraph; ///< if pitch graph should be drawn
+ double beginTime, endTime; ///< the period where there are notes
double m_scoreFactor; ///< Normalization factor for the scoring system
};
diff --git a/game/songparser.hh b/game/songparser.hh
index 7be9ee4..d17b147 100644
--- a/game/songparser.hh
+++ b/game/songparser.hh
@@ -76,6 +76,8 @@ class SongParser {
it->notePrev += shift;
}
}
+ // Set begin/end times
+ if (!s.notes.empty()) s.beginTime = s.notes.front().begin, s.endTime = s.notes.back().end;
m_song.m_scoreFactor = 1.0 / m_maxScore;
}
private:
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:45
|
Module: performous
Branch: dance
Commit: 16cc19c81d94cb0db32ec8a4fef071b6e582d5ed
Author: Vincent Le Ligeour <yo...@us...>
Date: Fri Oct 30 17:29:00 2009 +0100
Added installation directory to background directory list
---
game/backgrounds.cc | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/game/backgrounds.cc b/game/backgrounds.cc
index 14b4090..8450234 100644
--- a/game/backgrounds.cc
+++ b/game/backgrounds.cc
@@ -16,7 +16,13 @@
void Backgrounds::reload() {
if (m_loading) return;
// Copy backgrounddirs from config into m_bgdirs
- ConfigItem::StringList const& sd = config["system/path_backgrounds"].sl();
+ ConfigItem::StringList sd = config["system/path_backgrounds"].sl();
+ char const* env_data_dir = getenv("PERFORMOUS_DATA_DIR");
+ if (env_data_dir) {
+ std::string background_dir(env_data_dir);
+ background_dir.append("/backgrounds/");
+ sd.push_back(background_dir);
+ }
m_bgs.clear();
std::transform(sd.begin(), sd.end(), std::inserter(m_bgdirs, m_bgdirs.end()), pathMangle);
// Run loading thread
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:44
|
Module: performous Branch: dance Commit: 5714c647100c4a14f556e9b758f8680b79230a5d Author: Tapio Vierros <tap...@gm...> Date: Fri Oct 30 16:07:55 2009 +0200 Added some dummy files. --- game/dancegraph.cc | 1 + game/dancegraph.hh | 1 + game/songparser-sm.cc | 1 + 3 files changed, 3 insertions(+), 0 deletions(-) diff --git a/game/dancegraph.cc b/game/dancegraph.cc new file mode 100644 index 0000000..46e002f --- /dev/null +++ b/game/dancegraph.cc @@ -0,0 +1 @@ +#include "dancegraph.hh" diff --git a/game/dancegraph.hh b/game/dancegraph.hh new file mode 100644 index 0000000..6f70f09 --- /dev/null +++ b/game/dancegraph.hh @@ -0,0 +1 @@ +#pragma once diff --git a/game/songparser-sm.cc b/game/songparser-sm.cc new file mode 100644 index 0000000..e318b61 --- /dev/null +++ b/game/songparser-sm.cc @@ -0,0 +1 @@ +#include "songparser.hh" |
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:42
|
Module: performous
Branch: dance
Commit: 25703d0bb7eb185dc9f66c3226f45b54f9d45adc
Author: Tapio Vierros <tap...@gm...>
Date: Fri Oct 30 00:42:51 2009 +0200
Added fancy exception to Backgrounds' getRandom.
---
game/backgrounds.cc | 4 ++++
game/backgrounds.hh | 5 +----
game/screen_sing.cc | 3 ++-
3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/game/backgrounds.cc b/game/backgrounds.cc
index 365d741..14b4090 100644
--- a/game/backgrounds.cc
+++ b/game/backgrounds.cc
@@ -71,4 +71,8 @@ void Backgrounds::reload_internal(fs::path const& parent) {
}
}
+std::string Backgrounds::getRandom() {
+ if (m_bgs.empty()) throw std::runtime_error("No random backgrounds available");
+ return m_bgs.at((++m_bgiter) % m_bgs.size());
+}
diff --git a/game/backgrounds.hh b/game/backgrounds.hh
index a193c6d..f25e2aa 100644
--- a/game/backgrounds.hh
+++ b/game/backgrounds.hh
@@ -31,10 +31,7 @@ class Backgrounds: boost::noncopyable {
/// true if empty
int empty() const { return m_bgs.empty(); };
/// returns random background
- std::string getRandom() {
- if (!m_bgs.empty()) return m_bgs.at((++m_bgiter) % m_bgs.size());
- else return "";
- }
+ std::string getRandom();
private:
typedef std::set<fs::path> BGDirs;
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 94061c5..b1bc46f 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -34,7 +34,8 @@ void ScreenSing::enter() {
}
if (foundbg == false) {
try {
- m_background.reset(new Surface(m_backgrounds.getRandom(), true));
+ std::string bgpath = m_backgrounds.getRandom();
+ m_background.reset(new Surface(bgpath, true));
} catch (std::exception& e) {
std::cerr << e.what() << std::endl;
}
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:40
|
Module: performous
Branch: dance
Commit: 27e2ac715817b138440abb81fa0eebd9e91ba8b7
Author: Tapio Vierros <tap...@gm...>
Date: Fri Oct 30 00:18:20 2009 +0200
Removed a debug message and elaborated scanning message.
---
game/backgrounds.cc | 2 +-
game/backgrounds.hh | 1 -
2 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/game/backgrounds.cc b/game/backgrounds.cc
index 14816f8..365d741 100644
--- a/game/backgrounds.cc
+++ b/game/backgrounds.cc
@@ -31,7 +31,7 @@ void Backgrounds::reload_internal() {
m_dirty = true;
}
for (BGDirs::const_iterator it = m_bgdirs.begin(); m_loading && it != m_bgdirs.end(); ++it) {
- if (!fs::is_directory(*it)) { std::cout << ">>> Not scanning: " << *it << " (no such directory)" << std::endl; continue; }
+ if (!fs::is_directory(*it)) { std::cout << ">>> Not scanning for backgrounds: " << *it << " (no such directory)" << std::endl; continue; }
std::cout << ">>> Scanning " << *it << " (for backgrounds)" << std::endl;
size_t count = m_bgs.size();
reload_internal(*it);
diff --git a/game/backgrounds.hh b/game/backgrounds.hh
index 5d85da6..a193c6d 100644
--- a/game/backgrounds.hh
+++ b/game/backgrounds.hh
@@ -16,7 +16,6 @@ class Backgrounds: boost::noncopyable {
/// constructor
Backgrounds(): m_bgiter(0), m_dirty(false), m_loading(false)
{
- std::cout << "BACKGROUNDS!" << std::endl;
reload();
}
~Backgrounds() {
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:38
|
Module: performous Branch: dance Commit: 9456748677e73b3d0355f2184a47d519ab49735d Author: Tapio Vierros <tap...@gm...> Date: Fri Oct 30 00:04:04 2009 +0200 Added one background for testing. --- data/CMakeLists.txt | 3 + data/backgrounds/default_bg.svg | 388 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 391 insertions(+), 0 deletions(-) |
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:37
|
Module: performous
Branch: dance
Commit: e10f75822df68bb103fc0d4d4e58f4f18b86c9dc
Author: Tapio Vierros <tap...@gm...>
Date: Thu Oct 29 23:51:18 2009 +0200
Integrated backgrounds class to the game.
---
game/main.cc | 4 +++-
game/screen_sing.cc | 14 +++++++++++++-
game/screen_sing.hh | 6 ++++--
3 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index 92aae16..d593777 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -4,6 +4,7 @@
#include "screen.hh"
#include "joystick.hh"
#include "songs.hh"
+#include "backgrounds.hh"
#include "xtime.hh"
#include "video_driver.hh"
@@ -139,13 +140,14 @@ void mainLoop() {
Capture capture;
Audio audio;
audioSetup(capture, audio);
+ Backgrounds backgrounds;
Songs songs(songlist);
Players players(getHomeDir() / ".config" / "performous" / "players.xml");
ScreenManager sm;
Window window(config["graphic/window_width"].i(), config["graphic/window_height"].i(), config["graphic/fullscreen"].b());
sm.addScreen(new ScreenIntro("Intro", audio, capture));
sm.addScreen(new ScreenSongs("Songs", audio, songs));
- sm.addScreen(new ScreenSing("Sing", audio, capture, players));
+ sm.addScreen(new ScreenSing("Sing", audio, capture, players, backgrounds));
sm.addScreen(new ScreenPractice("Practice", audio, capture));
sm.addScreen(new ScreenConfiguration("Configuration", audio));
sm.addScreen(new ScreenPlayers("Players", audio, players));
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 0e682f0..94061c5 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -19,14 +19,26 @@ namespace {
void ScreenSing::enter() {
theme.reset(new ThemeSing());
+ bool foundbg = false;
if (!m_song->background.empty()) {
try {
m_background.reset(new Surface(m_song->path + m_song->background, true));
+ foundbg = true;
} catch (std::exception& e) {
std::cerr << e.what() << std::endl;
}
}
- if (!m_song->video.empty() && config["graphic/video"].b()) m_video.reset(new Video(m_song->path + m_song->video, m_song->videoGap));
+ if (!m_song->video.empty() && config["graphic/video"].b()) {
+ m_video.reset(new Video(m_song->path + m_song->video, m_song->videoGap));
+ foundbg = true;
+ }
+ if (foundbg == false) {
+ try {
+ m_background.reset(new Surface(m_backgrounds.getRandom(), true));
+ } catch (std::exception& e) {
+ std::cerr << e.what() << std::endl;
+ }
+ }
m_pause_icon.reset(new Surface(getThemePath("sing_pause.svg")));
m_help.reset(new Surface(getThemePath("instrumenthelp.svg")));
m_progress.reset(new ProgressBar(getThemePath("sing_progressbg.svg"), getThemePath("sing_progressfg.svg"), ProgressBar::HORIZONTAL, 0.01f, 0.01f, true));
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index a14a7b8..98d3fb5 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -8,6 +8,7 @@
#include "engine.hh"
#include "guitargraph.hh"
#include "screen.hh"
+#include "backgrounds.hh"
#include "theme.hh"
#include "video.hh"
#include "surface.hh"
@@ -42,8 +43,8 @@ class ScoreWindow {
class ScreenSing: public Screen {
public:
/// constructor
- ScreenSing(std::string const& name, Audio& audio, Capture& capture, Players & players):
- Screen(name), m_audio(audio), m_capture(capture), m_players(players), m_latencyAV()
+ ScreenSing(std::string const& name, Audio& audio, Capture& capture, Players& players, Backgrounds& bgs):
+ Screen(name), m_audio(audio), m_capture(capture), m_players(players), m_backgrounds(bgs), m_latencyAV()
{}
void enter();
void exit();
@@ -67,6 +68,7 @@ class ScreenSing: public Screen {
Audio& m_audio;
Capture& m_capture;
Players& m_players;
+ Backgrounds& m_backgrounds;
boost::shared_ptr<Song> m_song; /// Pointer to the current song
boost::scoped_ptr<ScoreWindow> m_score_window;
boost::scoped_ptr<ProgressBar> m_progress;
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:35
|
Module: performous Branch: dance Commit: e389a7bb6c898206451338f81b81c4d91055d0dc Author: Tapio Vierros <tap...@gm...> Date: Thu Oct 29 23:50:54 2009 +0200 Added some background dirs to the config xml. --- data/schema.xml | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/data/schema.xml b/data/schema.xml index 55981f0..400fe54 100644 --- a/data/schema.xml +++ b/data/schema.xml @@ -249,4 +249,14 @@ to save the current settings to XML. <long>Where to look for pictures of players.</long> </locale> </entry> + <entry name="system/path_backgrounds" type="string_list"> + <stringvalue>/usr/local/share/games/performous/backgrounds</stringvalue> + <stringvalue>/usr/share/games/performous/backgrounds</stringvalue> + <stringvalue>../backgrounds/</stringvalue><!-- For Windows where the program is started in bin/ --> + <stringvalue>~/.performous/backgrounds/</stringvalue> + <locale name="C"> + <short>Random background folders</short> + <long>Where to look for default backgrounds.</long> + </locale> + </entry> </performous> |
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:33
|
Module: performous
Branch: dance
Commit: c52eb54050375c73ea973019eb057146e35a584a
Author: Tapio Vierros <tap...@gm...>
Date: Thu Oct 29 23:49:41 2009 +0200
New class for handling random backgrounds for songs that haven't their own.
---
game/backgrounds.cc | 74 +++++++++++++++++++++++++++++++++++++++++++++++++++
game/backgrounds.hh | 53 ++++++++++++++++++++++++++++++++++++
2 files changed, 127 insertions(+), 0 deletions(-)
diff --git a/game/backgrounds.cc b/game/backgrounds.cc
new file mode 100644
index 0000000..14816f8
--- /dev/null
+++ b/game/backgrounds.cc
@@ -0,0 +1,74 @@
+#include "backgrounds.hh"
+
+#include "configuration.hh"
+#include "fs.hh"
+
+#include <boost/bind.hpp>
+#include <boost/format.hpp>
+#include <boost/lexical_cast.hpp>
+#include <boost/regex.hpp>
+#include <algorithm>
+#include <iostream>
+#include <sstream>
+#include <stdexcept>
+#include <cstdlib>
+
+void Backgrounds::reload() {
+ if (m_loading) return;
+ // Copy backgrounddirs from config into m_bgdirs
+ ConfigItem::StringList const& sd = config["system/path_backgrounds"].sl();
+ m_bgs.clear();
+ std::transform(sd.begin(), sd.end(), std::inserter(m_bgdirs, m_bgdirs.end()), pathMangle);
+ // Run loading thread
+ m_loading = true;
+ m_thread.reset(new boost::thread(boost::bind(&Backgrounds::reload_internal, boost::ref(*this))));
+}
+
+void Backgrounds::reload_internal() {
+ {
+ boost::mutex::scoped_lock l(m_mutex);
+ m_bgs.clear();
+ m_dirty = true;
+ }
+ for (BGDirs::const_iterator it = m_bgdirs.begin(); m_loading && it != m_bgdirs.end(); ++it) {
+ if (!fs::is_directory(*it)) { std::cout << ">>> Not scanning: " << *it << " (no such directory)" << std::endl; continue; }
+ std::cout << ">>> Scanning " << *it << " (for backgrounds)" << std::endl;
+ size_t count = m_bgs.size();
+ reload_internal(*it);
+ size_t diff = m_bgs.size() - count;
+ if (diff > 0 && m_loading) std::cout << diff << " backgrounds loaded" << std::endl;
+ }
+ m_loading = false;
+ {
+ boost::mutex::scoped_lock l(m_mutex);
+ random_shuffle(m_bgs.begin(), m_bgs.end());
+ m_dirty = false;
+ m_bgiter = 0;
+ }
+}
+
+void Backgrounds::reload_internal(fs::path const& parent) {
+ namespace fs = fs;
+ if (std::distance(parent.begin(), parent.end()) > 20) { std::cout << ">>> Not scanning: " << parent.string() << " (maximum depth reached, possibly due to cyclic symlinks)" << std::endl; return; }
+ try {
+ boost::regex expression("(.*\\.(png|jpeg|jpg|svg|bmp|gif))$", boost::regex_constants::icase);
+ boost::cmatch match;
+ for (fs::directory_iterator dirIt(parent), dirEnd; m_loading && dirIt != dirEnd; ++dirIt) {
+ fs::path p = dirIt->path();
+ if (fs::is_directory(p)) { reload_internal(p); continue; }
+ std::string name = p.leaf(); // File basename
+ std::string path = p.directory_string(); // Path without filename
+ path.erase(path.size() - name.size());
+ if (!regex_match(name.c_str(), match, expression)) continue;
+ {
+ boost::mutex::scoped_lock l(m_mutex);
+ m_bgs.push_back(path + name);
+ m_dirty = true;
+ }
+ }
+ } catch (std::exception const& e) {
+ std::cout << "Error accessing " << parent << std::endl;
+ }
+}
+
+
diff --git a/game/backgrounds.hh b/game/backgrounds.hh
new file mode 100644
index 0000000..5d85da6
--- /dev/null
+++ b/game/backgrounds.hh
@@ -0,0 +1,53 @@
+#pragma once
+
+#include "animvalue.hh"
+#include "fs.hh"
+#include "song.hh"
+#include <boost/shared_ptr.hpp>
+#include <boost/scoped_ptr.hpp>
+#include <boost/thread/mutex.hpp>
+#include <boost/thread/thread.hpp>
+#include <set>
+#include <vector>
+
+/// songs class for songs screen
+class Backgrounds: boost::noncopyable {
+ public:
+ /// constructor
+ Backgrounds(): m_bgiter(0), m_dirty(false), m_loading(false)
+ {
+ std::cout << "BACKGROUNDS!" << std::endl;
+ reload();
+ }
+ ~Backgrounds() {
+ m_loading = false; // Terminate loading if currently in progress
+ m_thread->join();
+ }
+ /// reloads backgrounds list
+ void reload();
+ /// array access
+ std::string& operator[](std::size_t pos) { return m_bgs.at(pos); }
+ /// number of backgrounds
+ int size() const { return m_bgs.size(); };
+ /// true if empty
+ int empty() const { return m_bgs.empty(); };
+ /// returns random background
+ std::string getRandom() {
+ if (!m_bgs.empty()) return m_bgs.at((++m_bgiter) % m_bgs.size());
+ else return "";
+ }
+
+ private:
+ typedef std::set<fs::path> BGDirs;
+ typedef std::vector<std::string> BGVector;
+ BGDirs m_bgdirs;
+ BGVector m_bgs;
+ int m_bgiter;
+ void reload_internal();
+ void reload_internal(fs::path const& p);
+ volatile bool m_dirty;
+ volatile bool m_loading;
+ boost::scoped_ptr<boost::thread> m_thread;
+ mutable boost::mutex m_mutex;
+};
+
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:31
|
Module: performous
Branch: dance
Commit: c9cff8e1aa97a33d77d994e3418e0830fdbf7901
Author: Vincent Le Ligeour <yo...@us...>
Date: Thu Oct 29 15:27:59 2009 +0100
Removed MacOSX incompatible gcc warning / Added comment on gcc 4.0.1 bug / Used static_cast instead of C-style cast
---
game/CMakeLists.txt | 2 +-
game/player.cc | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
index a64bcf6..20b0f94 100644
--- a/game/CMakeLists.txt
+++ b/game/CMakeLists.txt
@@ -30,7 +30,7 @@ endif(PortMidi_FOUND)
if(CMAKE_COMPILER_IS_GNUCXX)
message(STATUS "GCC detected, adding compile flags")
# -pedantic cannot be used because ffmpeg headers are b0rked
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++98 -Wall -Wextra -Wno-ignored-qualifiers")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++98 -Wall -Wextra")
# Needed for ffmpeg.cc to compile cleanly on OSX (it's a (unsigned long) long story)
add_definitions("-D__STDC_CONSTANT_MACROS")
endif(CMAKE_COMPILER_IS_GNUCXX)
diff --git a/game/player.cc b/game/player.cc
index 0ec9186..618ed3f 100644
--- a/game/player.cc
+++ b/game/player.cc
@@ -40,7 +40,8 @@ void Player::calcRowRank() {
// Calculate max score of the completed row
Notes::const_reverse_iterator maxScoreIt(m_scoreIt);
// FIXME: MacOSX needs the following cast to compile correctly
- while ((maxScoreIt != (Notes::const_reverse_iterator)m_song.notes.rend()) && (maxScoreIt->type != Note::SLEEP)) {
+ // it is related to the fact that OSX default compiler is 4.0.1 that is buggy when not casting
+ while ((maxScoreIt != static_cast<Notes::const_reverse_iterator>(m_song.notes.rend())) && (maxScoreIt->type != Note::SLEEP)) {
m_maxLineScore += m_song.m_scoreFactor * maxScoreIt->maxScore();
maxScoreIt++;
}
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:30
|
Module: performous
Branch: dance
Commit: a5bbc72266b88d3867599d157e075e52d1f049af
Author: Tapio Vierros <tap...@gm...>
Date: Thu Oct 29 15:54:09 2009 +0200
Now also last line of lyrics gets graded.
---
game/player.cc | 38 +++++++++++++++++++++-----------------
game/player.hh | 2 ++
2 files changed, 23 insertions(+), 17 deletions(-)
diff --git a/game/player.cc b/game/player.cc
index e5dcfdf..0ec9186 100644
--- a/game/player.cc
+++ b/game/player.cc
@@ -23,29 +23,33 @@ void Player::update() {
}
// If a row of lyrics ends, calculate how well it went
if (m_scoreIt->type == Note::SLEEP) {
- if (m_maxLineScore == 0) { // Has the maximum already been calculated for this SLEEP?
- m_prevLineScore = m_lineScore;
- // Calculate max score of the completed row
- Notes::const_reverse_iterator maxScoreIt(m_scoreIt);
- // FIXME: MacOSX needs the following cast to compile correctly
- while ((maxScoreIt != (Notes::const_reverse_iterator)m_song.notes.rend()) && (maxScoreIt->type != Note::SLEEP)) {
- m_maxLineScore += m_song.m_scoreFactor * maxScoreIt->maxScore();
- maxScoreIt++;
- }
- if (m_maxLineScore > 0) {
- m_prevLineScore /= m_maxLineScore;
- m_feedbackFader.setValue(1.0);
- } else {
- m_prevLineScore = -1;
- }
- m_lineScore = 0;
- }
+ calcRowRank();
} else {
m_maxLineScore = 0; // Not in SLEEP note anymore, so reset maximum
}
if (endTime < m_scoreIt->end) break;
++m_scoreIt;
}
+ if (m_scoreIt == m_song.notes.end()) calcRowRank();
m_score = clamp(m_score, 0.0, 1.0);
}
+void Player::calcRowRank() {
+ if (m_maxLineScore == 0) { // Has the maximum already been calculated for this SLEEP?
+ m_prevLineScore = m_lineScore;
+ // Calculate max score of the completed row
+ Notes::const_reverse_iterator maxScoreIt(m_scoreIt);
+ // FIXME: MacOSX needs the following cast to compile correctly
+ while ((maxScoreIt != (Notes::const_reverse_iterator)m_song.notes.rend()) && (maxScoreIt->type != Note::SLEEP)) {
+ m_maxLineScore += m_song.m_scoreFactor * maxScoreIt->maxScore();
+ maxScoreIt++;
+ }
+ if (m_maxLineScore > 0) {
+ m_prevLineScore /= m_maxLineScore;
+ m_feedbackFader.setValue(1.0);
+ } else {
+ m_prevLineScore = -1;
+ }
+ m_lineScore = 0;
+ }
+}
diff --git a/game/player.hh b/game/player.hh
index 6e5d552..25f0775 100644
--- a/game/player.hh
+++ b/game/player.hh
@@ -44,6 +44,8 @@ struct Player {
void prepare() { m_analyzer.process(); }
/// updates player stats
void update();
+ /// calculate how well last lyrics row went
+ void calcRowRank();
/// player activity singing
float activity() const { return m_activitytimer / 300.0; }
/// get player's score
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:30
|
Module: performous
Branch: dance
Commit: 3b7b339729609656cd4eee9916072e6fb8dde403
Author: Lasse Karkkainen <tro...@tr...>
Date: Thu Oct 29 02:15:44 2009 +0200
Skip score window if there are no players
---
game/screen_sing.cc | 10 ++++++++--
game/screen_sing.hh | 2 +-
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 04d4070..0e682f0 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -243,10 +243,16 @@ void ScreenSing::draw() {
}
} else {
if (m_score_window.get()) {
- if (m_quitTimer.get() == 0.0 && !m_audio.isPaused()) { activateNextScreen(); return; }
- m_score_window->draw();
+ // Score window has been created (we are near the end)
+ if (m_score_window->empty()) { // No players to display scores for
+ if (!m_audio.isPlaying()) { activateNextScreen(); return; }
+ } else { // Window being displayed
+ if (m_quitTimer.get() == 0.0 && !m_audio.isPaused()) { activateNextScreen(); return; }
+ m_score_window->draw();
+ }
}
else if (!m_audio.isPlaying() || (status == Song::FINISHED && m_audio.getLength() - time < 3.0)) {
+ // Time to create the score window
m_quitTimer.setValue(QUIT_TIMEOUT);
m_score_window.reset(new ScoreWindow(*m_engine, m_players));
}
diff --git a/game/screen_sing.hh b/game/screen_sing.hh
index d195bd5..a14a7b8 100644
--- a/game/screen_sing.hh
+++ b/game/screen_sing.hh
@@ -27,7 +27,7 @@ class ScoreWindow {
ScoreWindow(Engine & e, Players & players);
/// draws ScoreWindow
void draw();
-
+ bool empty() { return m_players.cur.empty(); }
private:
Players & m_players;
AnimValue m_pos;
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:28
|
Module: performous
Branch: dance
Commit: 0fc816ebb2f2907d4262396e8b4c6c3734cce61f
Author: Vincent Le Ligeour <yo...@us...>
Date: Thu Oct 29 14:20:54 2009 +0100
Removed Boost "type qualifiers ignored on function return type" warnings
---
game/CMakeLists.txt | 2 +-
game/video_driver.cc | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
index 20b0f94..a64bcf6 100644
--- a/game/CMakeLists.txt
+++ b/game/CMakeLists.txt
@@ -30,7 +30,7 @@ endif(PortMidi_FOUND)
if(CMAKE_COMPILER_IS_GNUCXX)
message(STATUS "GCC detected, adding compile flags")
# -pedantic cannot be used because ffmpeg headers are b0rked
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++98 -Wall -Wextra")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -std=c++98 -Wall -Wextra -Wno-ignored-qualifiers")
# Needed for ffmpeg.cc to compile cleanly on OSX (it's a (unsigned long) long story)
add_definitions("-D__STDC_CONSTANT_MACROS")
endif(CMAKE_COMPILER_IS_GNUCXX)
diff --git a/game/video_driver.cc b/game/video_driver.cc
index 3f53f5a..dcb0f5a 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -96,7 +96,8 @@ void Window::resize() {
// Set model-view matrix
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
- glFrustum(-0.5f, 0.5f, 0.5f * h, -0.5f * h, near, far);
+ const float f = 0.9f; // Avoid texture surface being exactly at the near plane (MacOSX fix)
+ glFrustum(-0.5f * f, 0.5f * f, 0.5f * h * f, -0.5f * h * f, f * near, far);
glTranslatef(0.0f, 0.0f, -near); // So that z = 0.0f is still on monitor surface
}
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:26
|
Module: performous
Branch: dance
Commit: ec301334c628ed44a89e4009d10588b01903bec2
Author: Vincent Le Ligeour <yo...@us...>
Date: Thu Oct 29 11:49:04 2009 +0100
Fixed some MacOSX compilation/runtime errors
---
cmake/performous.sh.cmake | 2 +-
game/player.cc | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/cmake/performous.sh.cmake b/cmake/performous.sh.cmake
index 06a4c9e..a8896b2 100644
--- a/cmake/performous.sh.cmake
+++ b/cmake/performous.sh.cmake
@@ -1,4 +1,4 @@
#!/bin/sh
-env LD_LIBRARY_PATH='@CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@:$LD_LIBRARY_PATH' PERFORMOUS_DATA_DIR='@CMAKE_INSTALL_PREFIX@/@SHARE_INSTALL@' PLUGIN_PATH='@PERFORMOUS_PLUGIN_PATH@' '@PERFORMOUS_EXECUTABLE@' "$@"
+env DYLD_LIBRARY_PATH='@CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@:$DYLD_LIBRARY_PATH' LD_LIBRARY_PATH='@CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@:$LD_LIBRARY_PATH' PERFORMOUS_DATA_DIR='@CMAKE_INSTALL_PREFIX@/@SHARE_INSTALL@' PLUGIN_PATH='@PERFORMOUS_PLUGIN_PATH@' '@PERFORMOUS_EXECUTABLE@' "$@"
diff --git a/game/player.cc b/game/player.cc
index 5a71639..e5dcfdf 100644
--- a/game/player.cc
+++ b/game/player.cc
@@ -27,7 +27,8 @@ void Player::update() {
m_prevLineScore = m_lineScore;
// Calculate max score of the completed row
Notes::const_reverse_iterator maxScoreIt(m_scoreIt);
- while (maxScoreIt != m_song.notes.rend() && maxScoreIt->type != Note::SLEEP) {
+ // FIXME: MacOSX needs the following cast to compile correctly
+ while ((maxScoreIt != (Notes::const_reverse_iterator)m_song.notes.rend()) && (maxScoreIt->type != Note::SLEEP)) {
m_maxLineScore += m_song.m_scoreFactor * maxScoreIt->maxScore();
maxScoreIt++;
}
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:25
|
Module: performous
Branch: dance
Commit: 29c2db5ec3a85bfda98386bd944e98cc6a8c8549
Author: Lasse Karkkainen <tro...@tr...>
Date: Thu Oct 29 03:26:14 2009 +0200
Rank system fine tuning. Colors now based on player colors.
---
game/layout_singer.cc | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
diff --git a/game/layout_singer.cc b/game/layout_singer.cc
index 980e091..d648f89 100644
--- a/game/layout_singer.cc
+++ b/game/layout_singer.cc
@@ -34,7 +34,10 @@ void LayoutSinger::drawScore(Position position) {
for (std::list<Player>::const_iterator p = m_players.cur.begin(); p != m_players.cur.end(); ++p, ++i) {
float act = p->activity();
if (act == 0.0f) continue;
- glColor4f(p->m_color.r, p->m_color.g, p->m_color.b,act);
+ float r = p->m_color.r;
+ float g = p->m_color.g;
+ float b = p->m_color.b;
+ glColor4f(r, g, b,act);
switch(position) {
case LayoutSinger::BOTTOM:
m_player_icon->dimensions.left(-0.5 + 0.01 + 0.25 * i).fixedWidth(0.075).screenTop(0.055);
@@ -58,12 +61,15 @@ void LayoutSinger::drawScore(Position position) {
float fact = p->m_feedbackFader.get();
if (p->m_prevLineScore > 0.5 && fact > 0) {
std::string prevLineRank;
- float fzoom = 2.0 / (1.0 + fact);
- if (p->m_prevLineScore > 0.95) { prevLineRank = "Perfect"; glColor4f(0.5, 1.0, 0.0, fact); }
- else if (p->m_prevLineScore > 0.9) { prevLineRank = "Super"; glColor4f(0.4, 0.9, 0.0, fact); }
- else if (p->m_prevLineScore > 0.8) { prevLineRank = "Excellent"; glColor4f(0.2, 0.8, 0.2, fact); }
- else if (p->m_prevLineScore > 0.6) { prevLineRank = "Good"; glColor4f(0.6, 1.0, 0.2, fact); }
- else if (p->m_prevLineScore > 0.5) { prevLineRank = "Ok"; glColor4f(0.6, 1.0, 0.2, fact); }
+ float fzoom = 3.0 / (2.0 + fact);
+ float rank = 0.0f;
+ if (p->m_prevLineScore > 0.95) { prevLineRank = "Perfect"; rank = 1.0f; }
+ else if (p->m_prevLineScore > 0.9) { prevLineRank = "Excellent"; rank = 0.8f; }
+ else if (p->m_prevLineScore > 0.8) { prevLineRank = "Great"; rank = 0.6f; }
+ else if (p->m_prevLineScore > 0.6) { prevLineRank = "Good"; rank = 0.3f; }
+ else if (p->m_prevLineScore > 0.4) { prevLineRank = "OK"; rank = 0.0f; }
+ float base = 0.2f * (1.0f - rank);
+ glColor4f(base + r * rank, base + g * rank, base + b * rank, fact);
m_line_rank_text[i%4]->render(prevLineRank);
switch(position) {
case LayoutSinger::BOTTOM:
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:21
|
Module: performous
Branch: dance
Commit: 045d044735accbe35a66721022ad2d550e9519d5
Author: Lasse Karkkainen <tro...@tr...>
Date: Thu Oct 29 02:03:27 2009 +0200
Trying different effect for grading
---
game/layout_singer.cc | 5 +++--
game/player.hh | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/game/layout_singer.cc b/game/layout_singer.cc
index 99c8bb9..980e091 100644
--- a/game/layout_singer.cc
+++ b/game/layout_singer.cc
@@ -9,7 +9,8 @@
#include <list>
#include <boost/format.hpp>
-LayoutSinger::LayoutSinger(Song &_song, Players& _players, boost::shared_ptr<ThemeSing> _theme): m_song(_song), m_noteGraph(_song),m_lyricit(_song.notes.begin()), m_lyrics(), m_players(_players), m_theme(_theme) {
+LayoutSinger::LayoutSinger(Song &_song, Players& _players, boost::shared_ptr<ThemeSing> _theme):
+ m_song(_song), m_noteGraph(_song),m_lyricit(_song.notes.begin()), m_lyrics(), m_players(_players), m_theme(_theme) {
m_score_text[0].reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
m_score_text[1].reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
m_score_text[2].reset(new SvgTxtThemeSimple(getThemePath("sing_score_text.svg"), config["graphic/text_lod"].f()));
@@ -57,7 +58,7 @@ void LayoutSinger::drawScore(Position position) {
float fact = p->m_feedbackFader.get();
if (p->m_prevLineScore > 0.5 && fact > 0) {
std::string prevLineRank;
- float fzoom = fact / 2.0 + 0.5;
+ float fzoom = 2.0 / (1.0 + fact);
if (p->m_prevLineScore > 0.95) { prevLineRank = "Perfect"; glColor4f(0.5, 1.0, 0.0, fact); }
else if (p->m_prevLineScore > 0.9) { prevLineRank = "Super"; glColor4f(0.4, 0.9, 0.0, fact); }
else if (p->m_prevLineScore > 0.8) { prevLineRank = "Excellent"; glColor4f(0.2, 0.8, 0.2, fact); }
diff --git a/game/player.hh b/game/player.hh
index 5b75fd1..6e5d552 100644
--- a/game/player.hh
+++ b/game/player.hh
@@ -39,7 +39,7 @@ struct Player {
Player(Song& song, Analyzer& analyzer, size_t frames):
m_song(song), m_analyzer(analyzer), m_pitch(frames, std::make_pair(getNaN(),
-getInf())), m_pos(), m_score(), m_lineScore(), m_maxLineScore(), m_prevLineScore(-1),
- m_feedbackFader(0.0, 0.5), m_activitytimer(), m_scoreIt(m_song.notes.begin()) {}
+ m_feedbackFader(0.0, 2.0), m_activitytimer(), m_scoreIt(m_song.notes.begin()) {}
/// prepares analyzer
void prepare() { m_analyzer.process(); }
/// updates player stats
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:19
|
Module: performous Branch: dance Commit: 0b5390f85bcec037f49cbaf8bdf78670c0a2e0fb Author: Lasse Karkkainen <tro...@tr...> Date: Thu Oct 29 01:26:23 2009 +0200 Renamed all config files, now config schema is schema.xml and config files are stored in performous folders under system config paths as config.xml. Use Ctrl+Alt+S to save system config (requires write access to /etc) and Ctrl+Alt+R to reset to factory default (rather than to system default). Config system improved so that it doesn't leave extra files behind and that it tracks the default values of factory and system configs separately. Added a catcher for runtime errors in main loop. For now it just prints to console, but eventually when Performous gets "flash message" support, they should be displayed as such. --- data/CMakeLists.txt | 3 +- data/schema.xml | 8 +++--- game/configuration.cc | 59 ++++++++++++++++++++++++++++------------- game/configuration.hh | 14 ++++++--- game/main.cc | 32 +++++++++++++---------- game/players.cc | 2 + game/screen_configuration.cc | 4 +- 7 files changed, 77 insertions(+), 45 deletions(-) |
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:17
|
Module: performous
Branch: dance
Commit: d8a38c0dbaf3d8e12dce4367cf54c9c7451fe138
Author: Lasse Karkkainen <tro...@tr...>
Date: Thu Oct 29 01:26:17 2009 +0200
Less clutter in highscore dialog
---
data/{performous.xml => schema.xml} | 0
game/screen_players.cc | 3 +--
2 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/data/performous.xml b/data/schema.xml
similarity index 100%
rename from data/performous.xml
rename to data/schema.xml
diff --git a/game/screen_players.cc b/game/screen_players.cc
index ae8b620..595c11f 100644
--- a/game/screen_players.cc
+++ b/game/screen_players.cc
@@ -112,8 +112,7 @@ void ScreenPlayers::draw() {
// Format the song information text
if (m_search.text.empty()) {
oss_song << "No players found!";
- oss_order << "Check " << m_players.file() << "\n";
- oss_order << "directory for players\n";
+ // oss_order << "Check " << m_players.file() << "\n" << "directory for players\n";
oss_order << "Enter a name to create a new player.";
} else {
oss_song << "Press enter to create player!";
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:16
|
Module: performous
Branch: dance
Commit: b90a83f550bd0fd6811a0953d7e90e222bbbe7a3
Author: Tapio Vierros <tap...@gm...>
Date: Wed Oct 28 23:25:47 2009 +0200
Singer text feedback is now only display for good grades. It also zooms and fades away.
---
game/layout_singer.cc | 19 ++++++++++---------
game/layout_singer.hh | 1 +
game/player.cc | 7 +++++--
game/player.hh | 5 ++++-
4 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/game/layout_singer.cc b/game/layout_singer.cc
index 97fcc50..99c8bb9 100644
--- a/game/layout_singer.cc
+++ b/game/layout_singer.cc
@@ -54,21 +54,22 @@ void LayoutSinger::drawScore(Position position) {
}
m_score_text[i%4]->draw();
// Give some feedback on how well the last lyrics row went
- if (p->m_prevLineScore >= 0) {
+ float fact = p->m_feedbackFader.get();
+ if (p->m_prevLineScore > 0.5 && fact > 0) {
std::string prevLineRank;
- if (p->m_prevLineScore > 0.9) { prevLineRank = "Perfect"; glColor4f(0.5, 1.0, 0.0, act); }
- else if (p->m_prevLineScore > 0.8) { prevLineRank = "Excellent"; glColor4f(0.2, 0.8, 0.2, act); }
- else if (p->m_prevLineScore > 0.6) { prevLineRank = "Good"; glColor4f(0.6, 1.0, 0.2, act); }
- else if (p->m_prevLineScore > 0.5) { prevLineRank = "Ok"; glColor4f(0.6, 1.0, 0.2, act); }
- else if (p->m_prevLineScore > 0.3) { prevLineRank = "Poor"; glColor4f(0.6, 0.8, 0.2, act); }
- else { prevLineRank = "Horrible"; glColor4f(0.5, 0.5, 0.3, act); }
+ float fzoom = fact / 2.0 + 0.5;
+ if (p->m_prevLineScore > 0.95) { prevLineRank = "Perfect"; glColor4f(0.5, 1.0, 0.0, fact); }
+ else if (p->m_prevLineScore > 0.9) { prevLineRank = "Super"; glColor4f(0.4, 0.9, 0.0, fact); }
+ else if (p->m_prevLineScore > 0.8) { prevLineRank = "Excellent"; glColor4f(0.2, 0.8, 0.2, fact); }
+ else if (p->m_prevLineScore > 0.6) { prevLineRank = "Good"; glColor4f(0.6, 1.0, 0.2, fact); }
+ else if (p->m_prevLineScore > 0.5) { prevLineRank = "Ok"; glColor4f(0.6, 1.0, 0.2, fact); }
m_line_rank_text[i%4]->render(prevLineRank);
switch(position) {
case LayoutSinger::BOTTOM:
- m_line_rank_text[i%4]->dimensions().middle(-0.350 + 0.01 + 0.25 * i).fixedHeight(0.055).screenTop(0.11);
+ m_line_rank_text[i%4]->dimensions().middle(-0.350 + 0.01 + 0.25 * i).fixedHeight(0.055*fzoom).screenTop(0.11);
break;
case LayoutSinger::MIDDLE:
- m_line_rank_text[i%4]->dimensions().right(0.45).fixedHeight(0.04).screenTop(0.060 + 0.050 * i);
+ m_line_rank_text[i%4]->dimensions().right(0.45).fixedHeight(0.04*fzoom).screenTop(0.060 + 0.050 * i);
break;
}
m_line_rank_text[i%4]->draw();
diff --git a/game/layout_singer.hh b/game/layout_singer.hh
index 85823a1..d03a341 100644
--- a/game/layout_singer.hh
+++ b/game/layout_singer.hh
@@ -64,4 +64,5 @@ class LayoutSinger {
boost::scoped_ptr<SvgTxtThemeSimple> m_line_rank_text[4];
Players& m_players;
boost::shared_ptr<ThemeSing> m_theme;
+ AnimValue m_feedbackFader;
};
diff --git a/game/player.cc b/game/player.cc
index fa3a751..5a71639 100644
--- a/game/player.cc
+++ b/game/player.cc
@@ -31,9 +31,12 @@ void Player::update() {
m_maxLineScore += m_song.m_scoreFactor * maxScoreIt->maxScore();
maxScoreIt++;
}
- if (m_maxLineScore > 0)
+ if (m_maxLineScore > 0) {
m_prevLineScore /= m_maxLineScore;
- else m_prevLineScore = -1;
+ m_feedbackFader.setValue(1.0);
+ } else {
+ m_prevLineScore = -1;
+ }
m_lineScore = 0;
}
} else {
diff --git a/game/player.hh b/game/player.hh
index 340326b..5b75fd1 100644
--- a/game/player.hh
+++ b/game/player.hh
@@ -3,6 +3,7 @@
#include "color.hh"
#include "pitch.hh"
#include "util.hh"
+#include "animvalue.hh"
#include <vector>
@@ -28,6 +29,8 @@ struct Player {
double m_maxLineScore;
/// score for the previous line (normalized [0,1])
double m_prevLineScore;
+ /// fader for text feedback display
+ AnimValue m_feedbackFader;
/// activity timer
unsigned m_activitytimer;
/// score iterator
@@ -36,7 +39,7 @@ struct Player {
Player(Song& song, Analyzer& analyzer, size_t frames):
m_song(song), m_analyzer(analyzer), m_pitch(frames, std::make_pair(getNaN(),
-getInf())), m_pos(), m_score(), m_lineScore(), m_maxLineScore(), m_prevLineScore(-1),
- m_activitytimer(), m_scoreIt(m_song.notes.begin()) {}
+ m_feedbackFader(0.0, 0.5), m_activitytimer(), m_scoreIt(m_song.notes.begin()) {}
/// prepares analyzer
void prepare() { m_analyzer.process(); }
/// updates player stats
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:15
|
Module: performous
Branch: dance
Commit: 41d457c53f1b05c46b5c980a308cbc2d745a4281
Author: Lasse Karkkainen <tro...@tr...>
Date: Wed Oct 28 22:55:19 2009 +0200
Revert "Added debug for OSX testing"
This reverts commit b3da5bce553e47bc288dbce6bd3b3664cf0f8028.
---
libs/libda/plugins/audio_dev_jack.cpp | 7 -------
libs/plugin++/include/plugin++/loader.hpp | 2 --
2 files changed, 0 insertions(+), 9 deletions(-)
diff --git a/libs/libda/plugins/audio_dev_jack.cpp b/libs/libda/plugins/audio_dev_jack.cpp
index e9b25eb..aea5a24 100644
--- a/libs/libda/plugins/audio_dev_jack.cpp
+++ b/libs/libda/plugins/audio_dev_jack.cpp
@@ -2,17 +2,10 @@
#include <boost/lexical_cast.hpp>
#include <jack/jack.h>
#include <algorithm>
-#include <iostream>
namespace {
using namespace da;
- struct Foo {
- Foo() {
- std::cerr << "JACK driver loading..." << std::endl;
- }
- } foo;
-
void handle_and_throw(jack_status_t status) {
if (status & JackServerFailed) throw std::runtime_error("Unable to connect to the JACK server");
if (status & JackServerError) throw std::runtime_error("Communication error with the JACK server");
diff --git a/libs/plugin++/include/plugin++/loader.hpp b/libs/plugin++/include/plugin++/loader.hpp
index 396da3a..89519e6 100644
--- a/libs/plugin++/include/plugin++/loader.hpp
+++ b/libs/plugin++/include/plugin++/loader.hpp
@@ -31,9 +31,7 @@ namespace plugin {
void load(fs::path const& path) {
for (fs::directory_iterator it(path), end; it != end; ++it) {
try {
- std::cerr << "Loading " << it->string() << std::endl;
dlls.push_back(new dll(it->string()));
- std::cerr << "Loaded." << std::endl;
} catch (std::runtime_error const& e) {
std::cerr << e.what() << std::endl;
} catch (...) {
|
|
From: Tapio V. <aa...@us...> - 2009-11-08 08:30:11
|
Module: performous Branch: dance Commit: f5f66f50c387093e14acbfe8347e5d5e1144e325 Author: Lasse Karkkainen <tro...@tr...> Date: Wed Oct 28 22:54:50 2009 +0200 Merge branch 'master' of ssh://tronic@git.performous.org/gitroot/performous/performous --- |