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-10-29 22:06:47
|
Module: performous
Branch: master
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-10-29 22:06:42
|
Module: performous Branch: master 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-10-29 22:06:40
|
Module: performous
Branch: master
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: Yoda-JM <yo...@us...> - 2009-10-29 14:28:13
|
Module: performous
Branch: master
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-10-29 13:55:17
|
Module: performous
Branch: master
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: Yoda-JM <yo...@us...> - 2009-10-29 13:40:46
|
Module: performous
Branch: master
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: Yoda-JM <yo...@us...> - 2009-10-29 10:49:19
|
Module: performous
Branch: master
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: Lasse Kärkkäi. <tr...@us...> - 2009-10-29 01:26:18
|
Module: performous
Branch: master
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: Lasse Kärkkäi. <tr...@us...> - 2009-10-29 00:15:45
|
Module: performous
Branch: master
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: Lasse Kärkkäi. <tr...@us...> - 2009-10-29 00:03:30
|
Module: performous
Branch: master
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: Lasse Kärkkäi. <tr...@us...> - 2009-10-28 23:30:48
|
Module: performous Branch: master 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: Lasse Kärkkäi. <tr...@us...> - 2009-10-28 23:30:46
|
Module: performous
Branch: master
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: Lasse Kärkkäi. <tr...@us...> - 2009-10-28 22:00:23
|
Module: performous
Branch: master
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: Lasse Kärkkäi. <tr...@us...> - 2009-10-28 22:00:13
|
Module: performous
Branch: master
Commit: 062885a60efd4cc1dfa0247756ed6ccdff446af7
Author: Lasse Karkkainen <tro...@tr...>
Date: Wed Oct 28 22:53:17 2009 +0200
Remove -fvisibility options (they were causing trouble on OSX)
---
game/CMakeLists.txt | 2 +-
libs/libda/CMakeLists.txt | 2 +-
libs/plugin++/CMakeLists.txt | 3 ---
3 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
index 18a4c11..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 -fvisibility=hidden")
+ 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/libs/libda/CMakeLists.txt b/libs/libda/CMakeLists.txt
index e058461..3ecbe27 100644
--- a/libs/libda/CMakeLists.txt
+++ b/libs/libda/CMakeLists.txt
@@ -13,7 +13,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
message(STATUS "GCC detected, adding compile flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -Wall -Wextra")
if(NOT WIN32)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -fvisibility=hidden -fvisibility-inlines-hidden")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
endif(NOT WIN32)
endif(CMAKE_COMPILER_IS_GNUCXX)
diff --git a/libs/plugin++/CMakeLists.txt b/libs/plugin++/CMakeLists.txt
index ee49943..1d215a4 100644
--- a/libs/plugin++/CMakeLists.txt
+++ b/libs/plugin++/CMakeLists.txt
@@ -6,9 +6,6 @@ include_directories(include)
if(CMAKE_COMPILER_IS_GNUCXX)
message(STATUS "GCC detected, adding compile flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++98 -Wall -Wextra")
- if(NOT WIN32)
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
- endif(NOT WIN32)
endif(CMAKE_COMPILER_IS_GNUCXX)
if (WIN32)
|
|
From: Tapio V. <aa...@us...> - 2009-10-28 21:27:38
|
Module: performous
Branch: master
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: Lasse Kärkkäi. <tr...@us...> - 2009-10-28 20:55:06
|
Module: performous Branch: master 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 --- |
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-10-28 20:54:57
|
Module: performous
Branch: master
Commit: e61eac19c40835ecbc5dc89da806e0c4a5f27619
Author: Lasse Karkkainen <tro...@tr...>
Date: Wed Oct 28 22:52:45 2009 +0200
Slightly better handling of very short notes
---
game/guitargraph.cc | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index d170864..8c9e51f 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -457,7 +457,8 @@ void GuitarGraph::drawNote(int fret, glutil::Color c, float tBeg, float tEnd, fl
}
float yBeg = time2y(tBeg);
float yEnd = time2y(tEnd);
- if (yBeg - 3 * fretWid >= yEnd) {
+ if (yBeg - 2 * fretWid >= yEnd) {
+ if (yEnd > yBeg - 3 * fretWid) yEnd = yBeg - 3 * fretWid; // Short note: render minimum renderable length
UseTexture tblock(m_button_l);
glutil::Begin block(GL_TRIANGLE_STRIP);
c.a = time2a(tBeg); glColor4fv(c);
@@ -480,6 +481,7 @@ void GuitarGraph::drawNote(int fret, glutil::Color c, float tBeg, float tEnd, fl
vertexPair(x, y, c, 0.25f);
vertexPair(x, yEnd, c, 0.0f);
} else {
+ // Too short note: only render the ring
c.a = time2a(tBeg); glColor4fv(c);
m_button.dimensions.center(time2y(tBeg)).middle(x);
m_button.draw();
|
|
From: Tapio V. <aa...@us...> - 2009-10-28 20:39:28
|
Module: performous
Branch: master
Commit: 4c72ef20e159068c294a06bc7b558ca5da800d44
Author: Tapio Vierros <tap...@gm...>
Date: Wed Oct 28 22:35:50 2009 +0200
Fixed a couple of bugs in singer textual feedback.
Now the first lyrics row is also evaluated correctly and the text is updated even if there is no singing.
---
game/layout_singer.cc | 4 ++--
game/player.cc | 41 +++++++++++++++++++++++++----------------
game/player.hh | 9 ++++++---
3 files changed, 33 insertions(+), 21 deletions(-)
diff --git a/game/layout_singer.cc b/game/layout_singer.cc
index e99c79b..97fcc50 100644
--- a/game/layout_singer.cc
+++ b/game/layout_singer.cc
@@ -53,8 +53,8 @@ void LayoutSinger::drawScore(Position position) {
break;
}
m_score_text[i%4]->draw();
- // Give some feedback on how well the last lyricss row went
- if (p->m_maxLineScore > 0) {
+ // Give some feedback on how well the last lyrics row went
+ if (p->m_prevLineScore >= 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); }
diff --git a/game/player.cc b/game/player.cc
index 02df7d9..fa3a751 100644
--- a/game/player.cc
+++ b/game/player.cc
@@ -4,35 +4,44 @@
void Player::update() {
if (m_pos == m_pitch.size()) return; // End of song already
+ double beginTime = Engine::TIMESTEP * m_pos;
Tone const* t = m_analyzer.findTone();
if (t) {
m_activitytimer = 1000;
- double beginTime = Engine::TIMESTEP * m_pos;
m_pitch[m_pos++] = std::make_pair(t->freq, t->stabledb);
- double endTime = Engine::TIMESTEP * m_pos;
- while (m_scoreIt != m_song.notes.end()) {
+ } else {
+ if (m_activitytimer > 0) --m_activitytimer;
+ m_pitch[m_pos++] = std::make_pair(getNaN(), -getInf());
+ }
+ double endTime = Engine::TIMESTEP * m_pos;
+ while (m_scoreIt != m_song.notes.end()) {
+ if (t) {
+ // Add score
double score_addition = m_song.m_scoreFactor * m_scoreIt->score(m_song.scale.getNote(t->freq), beginTime, endTime);
m_score += score_addition;
m_lineScore += score_addition;
- // If a row of lyrics ends, calculate how well it went
- if (m_scoreIt->type == Note::SLEEP && m_lineScore > 0) {
+ }
+ // 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;
- if (m_maxLineScore > 0) m_prevLineScore /= m_maxLineScore;
- m_lineScore = 0;
- m_maxLineScore = 0;
- Notes::const_iterator maxScoreIt = m_scoreIt + 1;
- while (maxScoreIt != m_song.notes.end() && maxScoreIt->type != Note::SLEEP) {
+ // Calculate max score of the completed row
+ Notes::const_reverse_iterator maxScoreIt(m_scoreIt);
+ while (maxScoreIt != 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;
+ else m_prevLineScore = -1;
+ m_lineScore = 0;
}
- if (endTime < m_scoreIt->end) break;
- ++m_scoreIt;
+ } else {
+ m_maxLineScore = 0; // Not in SLEEP note anymore, so reset maximum
}
- m_score = clamp(m_score, 0.0, 1.0);
- } else {
- if (m_activitytimer > 0) --m_activitytimer;
- m_pitch[m_pos++] = std::make_pair(getNaN(), -getInf());
+ if (endTime < m_scoreIt->end) break;
+ ++m_scoreIt;
}
+ m_score = clamp(m_score, 0.0, 1.0);
}
diff --git a/game/player.hh b/game/player.hh
index 48c2588..340326b 100644
--- a/game/player.hh
+++ b/game/player.hh
@@ -24,16 +24,19 @@ struct Player {
double m_score;
/// score for current line
double m_lineScore;
- /// maximum score for the current line
+ /// maximum score for the previous line
double m_maxLineScore;
- /// score for the previous line (normalized)
+ /// score for the previous line (normalized [0,1])
double m_prevLineScore;
/// activity timer
unsigned m_activitytimer;
/// score iterator
Notes::const_iterator m_scoreIt;
/// constructor
- 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_activitytimer(), m_scoreIt(m_song.notes.begin()) {}
+ 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()) {}
/// prepares analyzer
void prepare() { m_analyzer.process(); }
/// updates player stats
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-10-28 17:51:06
|
Module: performous
Branch: master
Commit: b3da5bce553e47bc288dbce6bd3b3664cf0f8028
Author: Lasse Karkkainen <tro...@tr...>
Date: Wed Oct 28 19:50:55 2009 +0200
Added debug for OSX testing
---
libs/libda/plugins/audio_dev_jack.cpp | 7 +++++++
libs/plugin++/include/plugin++/loader.hpp | 2 ++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/libs/libda/plugins/audio_dev_jack.cpp b/libs/libda/plugins/audio_dev_jack.cpp
index aea5a24..e9b25eb 100644
--- a/libs/libda/plugins/audio_dev_jack.cpp
+++ b/libs/libda/plugins/audio_dev_jack.cpp
@@ -2,10 +2,17 @@
#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 89519e6..396da3a 100644
--- a/libs/plugin++/include/plugin++/loader.hpp
+++ b/libs/plugin++/include/plugin++/loader.hpp
@@ -31,7 +31,9 @@ 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: Lasse Kärkkäi. <tr...@us...> - 2009-10-28 17:12:12
|
Module: web Branch: master Commit: 4703b87a20bf2a8c668d46d0e4a5e62bbc68e737 Author: Lasse Kärkkäinen <tronic@Kaidenn.(none)> Date: Wed Oct 28 19:11:12 2009 +0200 Status update --- htdocs-source/index.txt | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/htdocs-source/index.txt b/htdocs-source/index.txt index 3ecf552..c74b208 100644 --- a/htdocs-source/index.txt +++ b/htdocs-source/index.txt @@ -1,5 +1,12 @@ Announcements +:h2:2009-10-28 - Status update +The development has been quiet during the last two months, but we have done various smaller fixes. The guitar support has been improved with pull-off support and new scoring. MIDI drum support is in the works. We decided not to release 0.4 yet, even though it would bring major new features, as the sound code has some regressions that may hurt users who don't even need the band game features. A release will be made once these issues have been fixed. + +In other news, we have three new developers working on a dance game feature in a separate branch. If all goes well, that should be available in the 0.5 release in January or so. + +The current band game graphics suck, so we are desperately looking for talented SVG graphicians. If you think you can work fluently in Inkscape or some other SVG software, and think you can help, please contact us (preferrably on IRC channel #performous on Freenode). + :h2:2009-08-23 - Git repository address changed SF.net now supports multiple repositories and because of that the address has changed. Use <strong>git config remote.origin.url git://git.performous.org/gitroot/performous/performous</strong> to set the new URL in your existing repository. |
|
From: Tapio V. <aa...@us...> - 2009-10-28 16:08:29
|
Module: performous
Branch: dance
Commit: 91d606e8b50fc2fbfb4371fab682773098653f41
Author: Tapio Vierros <tap...@gm...>
Date: Tue Oct 27 22:33:08 2009 +0200
Score normalization to 0-10000 range for instruments.
---
game/guitargraph.cc | 13 +++++++++----
game/guitargraph.hh | 4 +++-
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index f8dfc74..d170864 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -59,6 +59,7 @@ GuitarGraph::GuitarGraph(Audio& audio, Song const& song, std::string track):
m_text(getThemePath("sing_timetxt.svg"), config["graphic/text_lod"].f()),
m_correctness(0.0, 5.0),
m_score(),
+ m_scoreFactor(),
m_streak(),
m_longestStreak()
{
@@ -218,9 +219,9 @@ void GuitarGraph::drumHit(double time, int fret) {
m_chordIt->score += score;
m_score += score;
if (m_chordIt->status == m_chordIt->polyphony) {
- m_score -= m_chordIt->score;
- m_chordIt->score *= m_chordIt->polyphony;
- m_score += m_chordIt->score;
+ //m_score -= m_chordIt->score;
+ //m_chordIt->score *= m_chordIt->polyphony;
+ //m_score += m_chordIt->score;
m_streak += 1;
if (m_streak > m_longestStreak) m_longestStreak = m_streak;
std::cout << "FULL HIT!" << std::endl;
@@ -349,7 +350,7 @@ void GuitarGraph::draw(double time) {
m_text.draw(txt);
} else {
m_text.dimensions.screenBottom(-0.30).middle(0.32 * dimensions.w() + offsetX);
- m_text.draw(boost::lexical_cast<std::string>(unsigned(m_score)));
+ m_text.draw(boost::lexical_cast<std::string>(unsigned(getScore())));
m_text.dimensions.screenBottom(-0.27).middle(0.32 * dimensions.w() + offsetX);
m_text.draw(boost::lexical_cast<std::string>(unsigned(m_streak)) + "/"
+ boost::lexical_cast<std::string>(unsigned(m_longestStreak)));
@@ -495,6 +496,7 @@ void GuitarGraph::drawBar(double time, float h) {
void GuitarGraph::updateChords() {
m_chords.clear();
+ m_scoreFactor = 0;
Durations::size_type pos[5] = {}, size[5] = {};
Durations const* durations[5] = {};
for (int fret = 0; fret < 5; ++fret) {
@@ -532,6 +534,8 @@ void GuitarGraph::updateChords() {
tapfret = fret;
++c.polyphony;
++pos[fret];
+ m_scoreFactor += 50;
+ if (d.end - d.begin > 0.0) m_scoreFactor += 50.0 * (d.end - d.begin);
}
// Check if the chord is tappable
if (!m_drums && c.polyphony == 1) {
@@ -543,5 +547,6 @@ void GuitarGraph::updateChords() {
m_chords.push_back(c);
}
m_chordIt = m_chords.begin();
+ m_scoreFactor = 10000.0 / m_scoreFactor; // normalize maximum score factor
}
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index e0c007b..e0eb849 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -55,7 +55,8 @@ class GuitarGraph {
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; }
+ int getScore() const { return m_score * m_scoreFactor; }
private:
void fail(double time, int fret);
void endHold(int fret);
@@ -109,6 +110,7 @@ class GuitarGraph {
NoteStatus m_notes;
AnimValue m_correctness;
double m_score;
+ double m_scoreFactor;
int m_streak;
int m_longestStreak;
};
|
|
From: Tapio V. <aa...@us...> - 2009-10-27 20:35:31
|
Module: performous
Branch: master
Commit: 91d606e8b50fc2fbfb4371fab682773098653f41
Author: Tapio Vierros <tap...@gm...>
Date: Tue Oct 27 22:33:08 2009 +0200
Score normalization to 0-10000 range for instruments.
---
game/guitargraph.cc | 13 +++++++++----
game/guitargraph.hh | 4 +++-
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index f8dfc74..d170864 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -59,6 +59,7 @@ GuitarGraph::GuitarGraph(Audio& audio, Song const& song, std::string track):
m_text(getThemePath("sing_timetxt.svg"), config["graphic/text_lod"].f()),
m_correctness(0.0, 5.0),
m_score(),
+ m_scoreFactor(),
m_streak(),
m_longestStreak()
{
@@ -218,9 +219,9 @@ void GuitarGraph::drumHit(double time, int fret) {
m_chordIt->score += score;
m_score += score;
if (m_chordIt->status == m_chordIt->polyphony) {
- m_score -= m_chordIt->score;
- m_chordIt->score *= m_chordIt->polyphony;
- m_score += m_chordIt->score;
+ //m_score -= m_chordIt->score;
+ //m_chordIt->score *= m_chordIt->polyphony;
+ //m_score += m_chordIt->score;
m_streak += 1;
if (m_streak > m_longestStreak) m_longestStreak = m_streak;
std::cout << "FULL HIT!" << std::endl;
@@ -349,7 +350,7 @@ void GuitarGraph::draw(double time) {
m_text.draw(txt);
} else {
m_text.dimensions.screenBottom(-0.30).middle(0.32 * dimensions.w() + offsetX);
- m_text.draw(boost::lexical_cast<std::string>(unsigned(m_score)));
+ m_text.draw(boost::lexical_cast<std::string>(unsigned(getScore())));
m_text.dimensions.screenBottom(-0.27).middle(0.32 * dimensions.w() + offsetX);
m_text.draw(boost::lexical_cast<std::string>(unsigned(m_streak)) + "/"
+ boost::lexical_cast<std::string>(unsigned(m_longestStreak)));
@@ -495,6 +496,7 @@ void GuitarGraph::drawBar(double time, float h) {
void GuitarGraph::updateChords() {
m_chords.clear();
+ m_scoreFactor = 0;
Durations::size_type pos[5] = {}, size[5] = {};
Durations const* durations[5] = {};
for (int fret = 0; fret < 5; ++fret) {
@@ -532,6 +534,8 @@ void GuitarGraph::updateChords() {
tapfret = fret;
++c.polyphony;
++pos[fret];
+ m_scoreFactor += 50;
+ if (d.end - d.begin > 0.0) m_scoreFactor += 50.0 * (d.end - d.begin);
}
// Check if the chord is tappable
if (!m_drums && c.polyphony == 1) {
@@ -543,5 +547,6 @@ void GuitarGraph::updateChords() {
m_chords.push_back(c);
}
m_chordIt = m_chords.begin();
+ m_scoreFactor = 10000.0 / m_scoreFactor; // normalize maximum score factor
}
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index e0c007b..e0eb849 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -55,7 +55,8 @@ class GuitarGraph {
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; }
+ int getScore() const { return m_score * m_scoreFactor; }
private:
void fail(double time, int fret);
void endHold(int fret);
@@ -109,6 +110,7 @@ class GuitarGraph {
NoteStatus m_notes;
AnimValue m_correctness;
double m_score;
+ double m_scoreFactor;
int m_streak;
int m_longestStreak;
};
|
|
From: Tapio V. <aa...@us...> - 2009-10-27 20:00:42
|
Module: performous
Branch: master
Commit: c6b7c94d3950f4748b3e60f6ae11cbc2d90ab302
Author: Tapio Vierros <tap...@gm...>
Date: Tue Oct 27 21:57:08 2009 +0200
Simple graphical effect for guitar's whammy bar (use with hold notes).
Keyboard binding is backspace.
---
game/guitargraph.cc | 27 ++++++++++++++++++++++-----
game/guitargraph.hh | 5 +++--
game/joystick.cc | 25 +++++++++++++++++++++++--
game/joystick.hh | 2 +-
4 files changed, 49 insertions(+), 10 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 93fac15..f8dfc74 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -104,12 +104,14 @@ void GuitarGraph::engine() {
if (m_input.pressed(i)) m_hit[i + 1].setValue(1.0);
}
}
+ double whammy = 0;
// Handle all events
for (input::Event ev; m_input.tryPoll(ev);) {
m_dead = false;
if (!m_drums && ev.type == input::Event::RELEASE) {
endHold(ev.button);
}
+ if (!m_drums && ev.type == input::Event::WHAMMY) whammy = (1.0 + ev.button) / 2.0;
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 (time < -0.5) {
@@ -154,6 +156,11 @@ void GuitarGraph::engine() {
if (!m_holds[fret]) continue;
Event& ev = m_events[m_holds[fret] - 1];
ev.glow.setTarget(1.0, true);
+ ev.whammy.setTarget(whammy);
+ if (whammy > 0) {
+ ev.whammy.move(0.5);
+ if (ev.whammy.get() > 1.0) ev.whammy.setValue(1.0);
+ }
double last = std::min(time, ev.dur->end);
double t = last - ev.holdTime;
if (t > 0) {
@@ -168,6 +175,7 @@ void GuitarGraph::engine() {
void GuitarGraph::endHold(int fret) {
if (!m_holds[fret]) return;
m_events[m_holds[fret] - 1].glow.setTarget(0.0);
+ m_events[m_holds[fret] - 1].whammy.setTarget(0.0, true);
m_holds[fret] = 0;
}
@@ -384,7 +392,11 @@ void GuitarGraph::draw(double time) {
//drawNote(fret, color(fret), tBeg, tEnd);
unsigned event = m_notes[it->dur[fret]];
float glow = 0.0f;
- if (event > 0) glow = m_events[event - 1].glow.get();
+ float whammy = 0.0f;
+ if (event > 0) {
+ glow = m_events[event - 1].glow.get();
+ whammy = m_events[event - 1].whammy.get();
+ }
/*
if (glow > 0.0f) {
glBlendFunc(GL_ONE, GL_ONE);
@@ -396,7 +408,7 @@ void GuitarGraph::draw(double time) {
c.r += glow;
c.g += glow;
c.b += glow;
- drawNote(fret, c, tBeg, tEnd);
+ drawNote(fret, c, tBeg, tEnd, whammy);
if (it->tappable) {
float l = std::max(0.5, m_correctness.get());
@@ -434,7 +446,7 @@ namespace {
}
}
-void GuitarGraph::drawNote(int fret, glutil::Color c, float tBeg, float tEnd) {
+void GuitarGraph::drawNote(int fret, glutil::Color c, float tBeg, float tEnd, float whammy) {
float x = -2.0f + fret;
if (m_drums) x -= 0.5f;
if (m_drums && fret == 0) {
@@ -454,8 +466,13 @@ void GuitarGraph::drawNote(int fret, glutil::Color c, float tBeg, float tEnd) {
y -= 2 * fretWid;
vertexPair(x, y, c, 0.5f);
// Render the middle
- while ((y -= 10.0) > yEnd + fretWid) {
- vertexPair(x, y, c, 0.5f);
+ while ((y -= fretWid) > yEnd + fretWid) {
+ if (whammy < 0.1) {
+ vertexPair(x, y, c, 0.5f);
+ } else {
+ // The sin formula is pure magic
+ vertexPair(x+sin((whammy-0.75)*6.0 + (yBeg-tEnd)/y)/3.0, y, c, 0.5f);
+ }
}
// Render the end
y = yEnd + fretWid;
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index 288aed4..e0c007b 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -84,11 +84,12 @@ class GuitarGraph {
struct Event {
double time;
AnimValue glow;
+ AnimValue whammy;
int type; // 0 = miss (pick), 1 = tap, 2 = pick
int fret;
Duration const* dur;
double holdTime;
- Event(double t, int ty, int f = -1, Duration const* d = NULL): time(t), glow(0.0, 5.0), type(ty), fret(f), dur(d), holdTime(d ? d->begin : getNaN()) { if (type > 0) glow.setValue(1.0); }
+ Event(double t, int ty, int f = -1, Duration const* d = NULL): time(t), glow(0.0, 5.0), whammy(0.0, 0.4), type(ty), fret(f), dur(d), holdTime(d ? d->begin : getNaN()) { if (type > 0) glow.setValue(1.0); }
};
typedef std::vector<Event> Events;
Events m_events;
@@ -96,7 +97,7 @@ class GuitarGraph {
int m_dead;
glutil::Color const& color(int fret) const;
void drawBar(double time, float h);
- void drawNote(int fret, glutil::Color, float tBeg, float tEnd);
+ void drawNote(int fret, glutil::Color, float tBeg, float tEnd, float whammy = 0);
void difficultyAuto();
bool difficulty(Difficulty level);
SvgTxtTheme m_text;
diff --git a/game/joystick.cc b/game/joystick.cc
index d79396e..afbca00 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -198,6 +198,14 @@ bool input::SDL::pushEvent(SDL_Event _e) {
}
devices[joy_id].addEvent(event);
return true;
+ case SDLK_BACKSPACE:
+ event.type = input::Event::WHAMMY;
+ event.button = 1;
+ for( unsigned int i = 0 ; i < BUTTONS ; ++i ) {
+ event.pressed[i] = devices[joy_id].pressed(i);
+ }
+ devices[joy_id].addEvent(event);
+ return true;
case SDLK_F5: case SDLK_5:
button++;
case SDLK_F4: case SDLK_4:
@@ -229,6 +237,14 @@ bool input::SDL::pushEvent(SDL_Event _e) {
switch(_e.key.keysym.sym) {
case SDLK_RETURN: pickPressed[0] = false; return true;
case SDLK_RSHIFT: pickPressed[1] = false; return true;
+ case SDLK_BACKSPACE:
+ event.type = input::Event::WHAMMY;
+ event.button = 0;
+ for( unsigned int i = 0 ; i < BUTTONS ; ++i ) {
+ event.pressed[i] = devices[joy_id].pressed(i);
+ }
+ devices[joy_id].addEvent(event);
+ return true;
case SDLK_F5: case SDLK_5:
button++;
case SDLK_F4: case SDLK_4:
@@ -254,8 +270,13 @@ bool input::SDL::pushEvent(SDL_Event _e) {
case SDL_JOYAXISMOTION:
joy_id = _e.jaxis.which;
if(!devices[joy_id].assigned()) return false;
- if (_e.jaxis.axis != 5 && _e.jaxis.axis != 6) return false;
- event.type = input::Event::PICK;
+ if (_e.jaxis.axis == 5 || _e.jaxis.axis == 6) {
+ event.type = input::Event::PICK;
+ } else if (_e.jaxis.axis == 2) {
+ event.type = input::Event::WHAMMY;
+ } else {
+ return false;
+ }
for( unsigned int i = 0 ; i < BUTTONS ; ++i ) {
event.pressed[i] = devices[joy_id].pressed(i);
}
diff --git a/game/joystick.hh b/game/joystick.hh
index 7499232..f3ee06b 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -21,7 +21,7 @@ namespace input {
static const std::size_t BUTTONS = 6;
struct Event {
- enum Type { PRESS, RELEASE, PICK };
+ enum Type { PRESS, RELEASE, PICK, WHAMMY };
Type type;
int button; // Translated button number for press/release events. 0 for pick down, 1 for pick up (NOTE: these are NOT pick press/release events but rather different directions)
bool pressed[BUTTONS]; // All events tell the button state right after the event happened
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-10-27 00:07:26
|
Module: performous
Branch: master
Commit: 361708d28962973a1da3de7bc32029dfa687d732
Author: Lasse Kärkkäinen <tro...@tr...>
Date: Tue Oct 27 02:07:12 2009 +0200
Add pull-offs, makes guitar playing much nicer (especially Canon Rock on Amazing)
---
game/guitargraph.cc | 20 ++++++++++++++++----
1 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index d69bfb2..93fac15 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -131,7 +131,7 @@ void GuitarGraph::engine() {
} else if (m_drums) {
if (ev.type == input::Event::PRESS) drumHit(time, ev.button);
} else {
- if (ev.type == input::Event::PRESS || ev.type == input::Event::PICK) guitarPlay(time, ev);
+ guitarPlay(time, ev);
}
if (m_score < 0) m_score = 0;
}
@@ -225,7 +225,7 @@ void GuitarGraph::drumHit(double time, int fret) {
void GuitarGraph::guitarPlay(double time, input::Event const& ev) {
bool picked = (ev.type == input::Event::PICK);
- bool frets[5] = {};
+ bool frets[5] = {}; // The combination about to be played
if (picked) {
for (int fret = 0; fret < 5; ++fret) {
frets[fret] = ev.pressed[fret];
@@ -233,8 +233,20 @@ void GuitarGraph::guitarPlay(double time, input::Event const& ev) {
}
} else {
if (m_correctness.get() < 0.5) return; // Hammering not possible at the moment
- frets[ev.button] = true;
- for (int fret = ev.button + 1; fret < 5; ++fret) if (ev.pressed[fret]) return; // Extra buttons on right side
+ for (int fret = ev.button + 1; fret < 5; ++fret) {
+ if (ev.pressed[fret]) return; // Extra buttons on right side
+ }
+ if (ev.type == input::Event::PRESS) {
+ // Hammer-on, the fret pressed is played
+ frets[ev.button] = true;
+ } else {
+ // Pull off, find the note to played that way
+ int fret = ev.button;
+ do {
+ if (--fret < 0) return; // No frets pressed -> not a pull off
+ } while (!ev.pressed[fret]);
+ frets[fret] = true;
+ }
}
// Find any suitable note within the tolerance
double tolerance = maxTolerance;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2009-10-27 00:07:22
|
Module: performous
Branch: master
Commit: 4f60a9454f51b2a8eb70fda7c7d6d40d734aed4c
Author: Lasse Kärkkäinen <tro...@tr...>
Date: Tue Oct 27 01:29:52 2009 +0200
Avoid unnecessary if-elses (there are plenty nested already)
---
game/guitargraph.cc | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 34bbc42..d69bfb2 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -119,11 +119,7 @@ void GuitarGraph::engine() {
TrackMapConstPtr::iterator track_it = m_track_map.find(m_track_index);
if( track_it != m_track_map.end() ) {
++track_it;
- if(track_it != m_track_map.end()) {
- m_track_index = track_it->first;
- } else {
- m_track_index = m_track_map.begin()->first;
- }
+ m_track_index = (track_it != m_track_map.end() ? track_it : m_track_map.begin())->first;
}
if (!difficulty(m_level)) difficultyAuto();
}
|