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...> - 2010-01-22 08:27:14
|
Module: performous
Branch: master
Commit: 6de03c67ce98ce7fd70f04bb4c224c293dc24b85
Author: Tapio Vierros <tap...@gm...>
Date: Fri Jan 22 10:25:14 2010 +0200
Add visual indication of solos.
---
game/guitargraph.cc | 49 ++++++++++++++++++++++++++++++++++---------------
game/guitargraph.hh | 2 ++
2 files changed, 36 insertions(+), 15 deletions(-)
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index ff56820..7f17a4e 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -46,16 +46,6 @@ namespace {
const int streakStarBonus = 500;
int getNextBigStreak(int prev) { return prev + 50; }
inline float blend(float a, float b, float f) { return a*f + b*(1.0f-f); }
-
- glutil::Color starpowerColorize(glutil::Color c, float f) {
- static glutil::Color starpowerC(0.5f, 0.5f, 1.0f);
- if ( f < 0.001 ) return c;
- f = std::sqrt(std::sqrt(f));
- c.r = blend(starpowerC.r, c.r, f);
- c.g = blend(starpowerC.g, c.g, f);
- c.b = blend(starpowerC.b, c.b, f);
- return c;
- }
}
GuitarGraph::GuitarGraph(Audio& audio, Song const& song, bool drums, int number):
@@ -472,6 +462,22 @@ glutil::Color const& GuitarGraph::color(int fret) const {
return fretColors[fret];
}
+/// Modify color based on things like GodMode and solos
+glutil::Color const GuitarGraph::colorize(glutil::Color c, double time) const {
+ const static glutil::Color godmodeC(0.5f, 0.5f, 1.0f); // Color for full GodMode
+ const static glutil::Color soloC(0.2f, 0.9f, 0.2f); // Color for solo notes
+ for (Durations::const_iterator it = m_solos.begin(); it != m_solos.end(); ++it) {
+ if (time >= it->begin && time <= it->end) { c = soloC; break; }
+ }
+ double f = m_starpower.get();
+ if (f < 0.001) return c;
+ f = std::sqrt(std::sqrt(f));
+ c.r = blend(godmodeC.r, c.r, f);
+ c.g = blend(godmodeC.g, c.g, f);
+ c.b = blend(godmodeC.b, c.b, f);
+ return c;
+}
+
namespace {
const float fretWid = 0.5f; // The actual width is two times this
@@ -516,7 +522,7 @@ void GuitarGraph::draw(double time) {
tEnd = future;
}
glutil::Color c(1.0f, 1.0f, 1.0f, time2a(tEnd));
- glColor4fv(starpowerColorize(c, m_starpower.get()));
+ glColor4fv(colorize(c, time + tBeg));
glNormal3f(0.0f, 1.0f, 0.0f);
glTexCoord2f(0.0f, texCoord); glVertex2f(-w, time2y(tEnd));
glNormal3f(0.0f, 1.0f, 0.0f);
@@ -533,7 +539,7 @@ void GuitarGraph::draw(double time) {
float x = -2.0f + fret - 0.5f * m_drums;
float l = m_hit[fret + !m_drums].get();
// Get a color for the fret and adjust it if GodMode is on
- glColor4fv(starpowerColorize(color(fret), m_starpower.get()));
+ glColor4fv(colorize(color(fret), time));
m_button.dimensions.center(time2y(0.0)).middle(x);
m_button.draw();
glColor3f(l, l, l);
@@ -564,7 +570,7 @@ void GuitarGraph::draw(double time) {
whammy = m_events[event - 1].whammy.get();
}
// Get a color for the fret and adjust it if GodMode is on
- glutil::Color c = starpowerColorize(color(fret), m_starpower.get());
+ glutil::Color c = colorize(color(fret), it->begin);
if (glow > 0.1f) { ng_r+=c.r; ng_g+=c.g; ng_b+=c.b; ng_ccnt++; } // neck glow
// Further adjust the color if the note is hit
c.r += glow;
@@ -733,9 +739,18 @@ void GuitarGraph::drawInfo(double time, double offsetX, Dimensions dimensions) {
}
// Is Starpower ready?
if (canActivateStarpower()) {
- float a = (int(time * 1000.0) % 1000) / 1000.0;
+ float a = std::abs(std::fmod(time, 1.0) - 0.5f) * 2.0f;
m_text.dimensions.screenBottom(-0.02).middle(-0.12 + offsetX);
m_text.draw("God Mode Ready!", a);
+ } else {
+ // Solo?
+ for (Durations::const_iterator it = m_solos.begin(); it != m_solos.end(); ++it) {
+ if (time >= it->begin && time <= it->end) {
+ float a = std::abs(std::fmod(time, 1.0) - 0.5f) * 2.0f;
+ m_text.dimensions.screenBottom(-0.02).middle(-0.05 + offsetX);
+ m_text.draw("Solo!", a);
+ }
+ }
}
// Draw streak pop-up for long streak intervals
double streakAnim = m_streakPopup.get();
@@ -827,5 +842,9 @@ void GuitarGraph::updateChords() {
}
m_chordIt = m_chords.begin();
m_scoreFactor = 10000.0 / m_scoreFactor; // normalize maximum score factor
+
+ // Solos
+ NoteMap const& nm = m_track_index->second->nm;
+ NoteMap::const_iterator it = nm.find(103); // 103 = Expert Solo - used for every difficulty
+ if (it != nm.end()) m_solos = it->second;
}
-
diff --git a/game/guitargraph.hh b/game/guitargraph.hh
index bb2f79e..8010e22 100644
--- a/game/guitargraph.hh
+++ b/game/guitargraph.hh
@@ -95,6 +95,7 @@ class GuitarGraph {
std::vector<AnimValue> m_flames[5]; /// flame effect queues for each fret
TrackMapConstPtr m_track_map; /// tracks
TrackMapConstPtr::const_iterator m_track_index;
+ std::vector<Duration> m_solos;
void drumHit(double time, int pad);
void guitarPlay(double time, input::Event const& ev);
enum Difficulty {
@@ -118,6 +119,7 @@ class GuitarGraph {
Events m_events;
unsigned m_holds[5]; /// active hold notes
glutil::Color const& color(int fret) const;
+ glutil::Color const colorize(glutil::Color c, double time) const;
void drawBar(double time, float h);
void drawNote(int fret, glutil::Color, float tBeg, float tEnd, float whammy = 0, bool tappable = false, bool hit = false, double hitAnim = 0.0, double releaseTime = 0.0);
void drawInfo(double time, double offsetX, Dimensions dimensions);
|
|
From: Yoda-JM <yo...@us...> - 2010-01-22 00:15:55
|
Module: performous Branch: master Commit: e1051b3d17fe8f81b1711947fb518968a4621106 Author: Vincent Le Ligeour <yo...@us...> Date: Fri Jan 22 01:14:44 2010 +0100 Updated todo --- docs/TODO.txt | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/docs/TODO.txt b/docs/TODO.txt index 65746fc..3b9db0d 100644 --- a/docs/TODO.txt +++ b/docs/TODO.txt @@ -18,6 +18,8 @@ Big features: - Mic effects (reduce volume for bad singers, perfect pitch, reverb, etc) - Ingame Singstar DVD support (integrated ripping + ffmpeg feeding + XML song format) - Automatically download songs and other stuff from performous.org +- Store instrument/dancepad mappings in configurations files + Allow user to + create new mapping Features: |
|
From: Laurent C. <lor...@us...> - 2010-01-21 22:26:28
|
Module: performous
Branch: master
Commit: 33cccacbaaa3d613549b31903499d8cdf0f996fc
Author: Laurent Carlier <lor...@us...>
Date: Thu Jan 21 23:24:04 2010 +0100
Add detection for libpng 1.4.x
---
cmake/Modules/FindPng.cmake | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/cmake/Modules/FindPng.cmake b/cmake/Modules/FindPng.cmake
index 0f52098..7472c40 100644
--- a/cmake/Modules/FindPng.cmake
+++ b/cmake/Modules/FindPng.cmake
@@ -18,7 +18,7 @@ find_path(Png_INCLUDE_DIR
)
find_library(Png_LIBRARY
- NAMES png12
+ NAMES png12 png14
PATHS ${Png_PKGCONF_LIBRARY_DIRS}
)
|
|
From: Tapio V. <aa...@us...> - 2010-01-21 20:30:21
|
Module: performous
Branch: master
Commit: ab96e0bbb738ba9d83e21dc580ca7a56598cdaa2
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jan 21 22:28:27 2010 +0200
Added mapping for Hama Guitar with a PS2/USB converter.
---
game/joystick.cc | 32 +++++++++++++++++++++-----------
game/joystick.hh | 3 ++-
2 files changed, 23 insertions(+), 12 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index efb9976..2069fbd 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -42,12 +42,13 @@ void input::MidiDrums::process() {
static const unsigned SDL_BUTTONS = 16;
int input::buttonFromSDL(input::detail::Type _type, unsigned int _sdl_button) {
- static const int inputmap[10][SDL_BUTTONS] = {
+ static const int inputmap[11][SDL_BUTTONS] = {
//G R Y B O S // for guitars (S=starpower)
{ 2, 0, 1, 3, 4, 5, -1, -1, 8, 9, -1, -1, -1, -1, -1, -1 }, // Guitar Hero guitar
{ 0, 1, 3, 2, 4,-1, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1 }, // Guitar Hero X-plorer guitar
{ 3, 0, 1, 2, 4, 5, -1, -1, 8, 9, -1, -1, -1, -1, -1, -1 }, // Rock Band guitar PS3
{ 0, 1, 3, 2, 4,-1, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1 }, // Rock Band guitar XBOX360
+ { 2, 1, 3, 4,-1, 0, -1, -1, 8, 9, -1, -1, -1, -1, -1, -1 }, // Hama Wireless Guitar Controller for PS2 with converter
//K R Y B G O // for drums
{ 3, 4, 1, 2, 0, 4, -1, -1, 8, 9, -1, -1, -1, -1, -1, -1 }, // Guitar Hero drums
{ 3, 4, 1, 2, 0,-1, -1, -1, 8, 9, -1, -1, -1, -1, -1, -1 }, // Rock Band drums PS3
@@ -64,13 +65,14 @@ int input::buttonFromSDL(input::detail::Type _type, unsigned int _sdl_button) {
case GUITAR_GH_XPLORER: return inputmap[1][_sdl_button];
case GUITAR_RB_PS3: return inputmap[2][_sdl_button];
case GUITAR_RB_XB360: return inputmap[3][_sdl_button];
- case DRUMS_GH: return inputmap[4][_sdl_button];
- case DRUMS_RB_PS3: return inputmap[5][_sdl_button];
- case DRUMS_RB_XB360: return inputmap[6][_sdl_button];
+ case GUITAR_HAMA_PS2: return inputmap[4][_sdl_button];
+ case DRUMS_GH: return inputmap[5][_sdl_button];
+ case DRUMS_RB_PS3: return inputmap[6][_sdl_button];
+ case DRUMS_RB_XB360: return inputmap[7][_sdl_button];
case DRUMS_MIDI: throw std::logic_error("MIDI drums do not use SDL buttons");
- case DANCEPAD_GENERIC: return inputmap[7][_sdl_button];
- case DANCEPAD_TIGERGAME: return inputmap[8][_sdl_button];
- case DANCEPAD_EMS2: return inputmap[9][_sdl_button];
+ case DANCEPAD_GENERIC: return inputmap[8][_sdl_button];
+ case DANCEPAD_TIGERGAME: return inputmap[9][_sdl_button];
+ case DANCEPAD_EMS2: return inputmap[10][_sdl_button];
}
throw std::logic_error("Unknown instrument type in buttonFromSDL");
}
@@ -186,9 +188,9 @@ void input::SDL::init() {
std::map<unsigned int, input::detail::Type> forced_type;
using namespace boost::spirit::classic;
- rule<> type = str_p("GUITAR_GUITARHERO_XPLORER") | "GUITAR_ROCKBAND_PS3" | "GUITAR_ROCKBAND_XB360"
- | "GUITAR_GUITARHERO" | "DRUMS_GUITARHERO" | "DRUMS_ROCKBAND_PS3" | "DRUMS_ROCKBAND_XB360"
- | "DRUMS_MIDI" | "DANCEPAD_EMS2" | "DANCEPAD_GENERIC" | "DANCEPAD_TIGERGAME";
+ rule<> type = str_p("GUITAR_GUITARHERO_XPLORER") | "GUITAR_HAMA_PS2" | "GUITAR_ROCKBAND_PS3"
+ | "GUITAR_ROCKBAND_XB360" | "GUITAR_GUITARHERO" | "DRUMS_GUITARHERO" | "DRUMS_ROCKBAND_PS3"
+ | "DRUMS_ROCKBAND_XB360" | "DRUMS_MIDI" | "DANCEPAD_EMS2" | "DANCEPAD_GENERIC" | "DANCEPAD_TIGERGAME";
rule<> entry = uint_p[assign_a(sdl_id)] >> ":" >> (type)[assign_a(instrument_type)];
ConfigItem::StringList const& instruments = config["game/instruments"].sl();
@@ -201,6 +203,8 @@ void input::SDL::init() {
forced_type[sdl_id] = input::detail::GUITAR_GH;
} else if (instrument_type == "GUITAR_GUITARHERO_XPLORER") {
forced_type[sdl_id] = input::detail::GUITAR_GH_XPLORER;
+ } else if (instrument_type == "GUITAR_HAMA_PS2") {
+ forced_type[sdl_id] = input::detail::GUITAR_HAMA_PS2;
} else if (instrument_type == "DRUMS_GUITARHERO") {
forced_type[sdl_id] = input::detail::DRUMS_GH;
} else if (instrument_type == "GUITAR_ROCKBAND_PS3") {
@@ -247,6 +251,9 @@ void input::SDL::init() {
case input::detail::GUITAR_GH_XPLORER:
std::cout << " Detected as: Guitar Hero Guitar X-plorer (forced)" << std::endl;
break;
+ case input::detail::GUITAR_HAMA_PS2:
+ std::cout << " Detected as: Hama Guitar for PS2 with converter (forced)" << std::endl;
+ break;
case input::detail::DRUMS_GH:
std::cout << " Detected as: Guitar Hero Drums (forced)" << std::endl;
break;
@@ -282,6 +289,9 @@ void input::SDL::init() {
} else if( name.find("Guitar Hero X-plorer") != std::string::npos ) {
std::cout << " Detected as: Guitar Hero Guitar X-plorer" << std::endl;
input::detail::devices[i] = input::detail::InputDevPrivate(input::detail::GUITAR_GH_XPLORER);
+ } else if( name.find("PS Converter") != std::string::npos ) {
+ std::cout << " Detected as: Hama Guitar with converter (guessed)" << std::endl;
+ input::detail::devices[i] = input::detail::InputDevPrivate(input::detail::GUITAR_HAMA_PS2);
} else if( name.find("Guitar Hero4") != std::string::npos ) {
// here we can have both drumkit or guitar .... let say the drumkit
std::cout << " Detected as: Guitar Hero Drums (guessed)" << std::endl;
@@ -649,7 +659,7 @@ 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) {
+ if (_e.jaxis.axis == 5 || _e.jaxis.axis == 6 || _e.jaxis.axis == 1) {
event.type = input::Event::PICK;
} else if (_e.jaxis.axis == 2 || (devices[joy_id].type() == input::detail::GUITAR_RB_XB360
&& _e.jaxis.axis == 4)) {
diff --git a/game/joystick.hh b/game/joystick.hh
index 6d5cc7c..ef3cf20 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -33,7 +33,7 @@ namespace input {
namespace detail {
enum Type { GUITAR_RB_PS3, DRUMS_RB_PS3, GUITAR_RB_XB360, DRUMS_RB_XB360,
- GUITAR_GH, GUITAR_GH_XPLORER, DRUMS_GH, DRUMS_MIDI, DANCEPAD_TIGERGAME, DANCEPAD_GENERIC, DANCEPAD_EMS2 };
+ GUITAR_GH, GUITAR_GH_XPLORER, GUITAR_HAMA_PS2, DRUMS_GH, DRUMS_MIDI, DANCEPAD_TIGERGAME, DANCEPAD_GENERIC, DANCEPAD_EMS2 };
static unsigned int KEYBOARD_ID = UINT_MAX;
static unsigned int KEYBOARD_ID2 = KEYBOARD_ID-1;
static unsigned int KEYBOARD_ID3 = KEYBOARD_ID-2; // Three ids needed for keyboard guitar/drumkit/dancepad
@@ -82,6 +82,7 @@ namespace input {
switch (m_type) {
case GUITAR_GH:
case GUITAR_GH_XPLORER:
+ case GUITAR_HAMA_PS2:
case GUITAR_RB_PS3:
case GUITAR_RB_XB360:
return _type == GUITAR;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-01-21 11:25:26
|
Module: performous
Branch: master
Commit: e23af95441b48f5ddb808dc2dce231d2ea0353e2
Author: Lasse Karkkainen <tro...@tr...>
Date: Thu Jan 21 13:25:06 2010 +0200
Fix PortAudio driver broken by earlier commit
---
game/main.cc | 11 ++++++-----
libs/libda/plugins/audio_dev_pa19.cpp | 8 ++++----
libs/libda/plugins/portaudio.hh | 9 +++++----
3 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index 3a7cfea..40bfc9b 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -151,13 +151,12 @@ void mainLoop(std::string const& songlist) {
Window window(config["graphic/window_width"].i(), config["graphic/window_height"].i(), config["graphic/fullscreen"].b());
ScreenManager sm;
try {
- sm.flashMessage(_("Loading..."), 0.0f, 1.0f, 1.0f); // No fade-in to get it to show
- window.blank();
- sm.drawFlashMessage();
- window.swap();
+ sm.flashMessage(_("Audio capture..."), 0.0f, 1.0f, 1.0f); window.blank(); sm.drawFlashMessage(); window.swap();
Capture capture;
+ sm.flashMessage(_("Audio playback..."), 0.0f, 1.0f, 1.0f); window.blank(); sm.drawFlashMessage(); window.swap();
Audio audio;
audioSetup(capture, audio);
+ sm.flashMessage(_("Miscellaneous..."), 0.0f, 1.0f, 1.0f); window.blank(); sm.drawFlashMessage(); window.swap();
Backgrounds backgrounds;
Database database(getConfigDir() / "database.xml");
Songs songs(database, songlist);
@@ -172,10 +171,12 @@ void mainLoop(std::string const& songlist) {
sm.addScreen(new ScreenPlayers("Players", audio, database));
sm.addScreen(new ScreenHiscore("Hiscore", audio, songs, database));
sm.activateScreen("Intro");
+ sm.flashMessage(_("Main menu..."), 0.0f, 1.0f, 1.0f); window.blank(); sm.drawFlashMessage(); window.swap();
+ sm.updateScreen(); // exit/enter, any exception is fatal error
+ sm.flashMessage("");
// Main loop
boost::xtime time = now();
unsigned frames = 0;
- sm.flashMessage("");
while (!sm.isFinished()) {
if( g_take_screenshot ) {
fs::path filename;
diff --git a/libs/libda/plugins/audio_dev_pa19.cpp b/libs/libda/plugins/audio_dev_pa19.cpp
index 68b93d3..215ef1d 100644
--- a/libs/libda/plugins/audio_dev_pa19.cpp
+++ b/libs/libda/plugins/audio_dev_pa19.cpp
@@ -9,10 +9,10 @@ namespace {
settings s;
portaudio::Init init;
portaudio::Stream stream;
- public:
+ public:
pa19_record(settings& s_orig):
s(s_orig),
- stream(*this, portaudio::Params().channelCount(s.channels()).device(s.subdev()), portaudio::Params(), s.rate())
+ stream(*this, portaudio::Params().channelCount(s.channels()).device(s.subdev()), NULL, s.rate())
{
PaError err = Pa_StartStream(stream);
if( err != paNoError ) throw std::runtime_error("Cannot start PortAudio audio stream " + s.subdev() + ": " + Pa_GetErrorText(err));
@@ -35,10 +35,10 @@ namespace {
settings s;
portaudio::Init init;
portaudio::Stream stream;
- public:
+ public:
pa19_playback(settings& s_orig):
s(s_orig),
- stream(*this, portaudio::Params().channelCount(s.channels()).device(s.subdev()), portaudio::Params(), s.rate())
+ stream(*this, NULL, portaudio::Params().channelCount(s.channels()).device(s.subdev()), s.rate())
{
PaError err = Pa_StartStream(stream);
if( err != paNoError ) throw std::runtime_error("Cannot start PortAudio audio stream " + s.subdev() + ": " + Pa_GetErrorText(err));
diff --git a/libs/libda/plugins/portaudio.hh b/libs/libda/plugins/portaudio.hh
index 549dca4..3ab49b4 100644
--- a/libs/libda/plugins/portaudio.hh
+++ b/libs/libda/plugins/portaudio.hh
@@ -32,7 +32,8 @@ namespace portaudio {
struct Params {
PaStreamParameters params;
Params(PaStreamParameters const& init = PaStreamParameters()): params(init) {
- sampleFormat(paFloat32);
+ // Some useful defaults so that things just work
+ channelCount(2).sampleFormat(paFloat32).suggestedLatency(0.1);
}
Params& channelCount(int val) { params.channelCount = val; return *this; }
Params& device(PaDeviceIndex val) { params.device = val; return *this; }
@@ -42,7 +43,7 @@ namespace portaudio {
}
Params& sampleFormat(PaSampleFormat val) { params.sampleFormat = val; return *this; }
Params& suggestedLatency(PaTime val) { params.suggestedLatency = val; return *this; }
- // Params& hostAPISpecificStreamInfo(void* val) { params.hostAPISpecificStreamInfo = val; return *this; }
+ Params& hostApiSpecificStreamInfo(void* val) { params.hostApiSpecificStreamInfo = val; return *this; }
operator PaStreamParameters const*() const { return ¶ms; }
};
@@ -53,7 +54,7 @@ namespace portaudio {
class Stream {
PaStream* m_handle;
public:
- /*Stream(
+ Stream(
PaStreamParameters const* input,
PaStreamParameters const* output,
double sampleRate,
@@ -63,7 +64,7 @@ namespace portaudio {
void* userData = NULL)
{
PORTAUDIO_CHECKED(Pa_OpenStream, (&m_handle, input, output, sampleRate, framesPerBuffer, flags, callback, userData));
- }*/
+ }
template <typename Functor> Stream(
Functor& functor,
PaStreamParameters const* input,
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-01-21 08:04:28
|
Module: performous Branch: master Commit: 6fbe91b2cbbb3b2d78fa1dd5873d1a069de29019 Author: Lasse Karkkainen <tro...@tr...> Date: Thu Jan 21 10:04:09 2010 +0200 Rewritten pa19 driver (it compiles, ship it -- not tested at all) --- libs/libda/plugins/audio_dev_pa19.cpp | 128 +++++++++----------------------- libs/libda/plugins/portaudio.hh | 82 +++++++++++++++++++++ 2 files changed, 118 insertions(+), 92 deletions(-) |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-01-21 06:56:22
|
Module: performous
Branch: master
Commit: 4f46f3976bfad5346bad6d149b6928256d357575
Author: Lasse Karkkainen <tro...@tr...>
Date: Thu Jan 21 08:56:10 2010 +0200
Removed debug printout
---
game/songparser-ini.cc | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/game/songparser-ini.cc b/game/songparser-ini.cc
index d0eab06..9b28339 100644
--- a/game/songparser-ini.cc
+++ b/game/songparser-ini.cc
@@ -85,8 +85,10 @@ void SongParser::iniParse() {
testAndAdd(s, "drums", name);
} else if (regex_match(name.c_str(), match, audiofile_vocals)) {
testAndAdd(s, "vocals", name);
+#if 0 // TODO: process preview.ogg properly? In any case, do not print debug to console...
} else if (regex_match(name.c_str(), match, audiofile_other)) {
std::cout << "Found unknown ogg file: " << name << std::endl;
+#endif
}
}
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-01-21 06:54:00
|
Module: performous
Branch: master
Commit: 93ec19f080bd1185f95245b9bb110c809729d168
Author: Lasse Karkkainen <tro...@tr...>
Date: Thu Jan 21 08:53:29 2010 +0200
Avoid setjmp/longjmp warning on PNG saving function
---
game/image.hh | 72 +++++++++++++++++++++++++++++++-------------------------
1 files changed, 40 insertions(+), 32 deletions(-)
diff --git a/game/image.hh b/game/image.hh
index 903647e..fb2fd2a 100644
--- a/game/image.hh
+++ b/game/image.hh
@@ -51,31 +51,16 @@ template <typename T> void loadSVG(T& target, std::string const& filename) {
gdk_pixbuf_unref(pb);
}
-template <typename T> void loadPNG(T& target, std::string const& filename) {
- std::vector<unsigned char> image;
- std::ifstream file(filename.c_str(), std::ios::binary);
- png_structp pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
- if (!pngPtr) throw std::runtime_error("png_create_read_struct failed");
- png_infop infoPtr = NULL;
- struct Cleanup {
- png_structpp pngPP;
- png_infopp infoPP;
- Cleanup(png_structp& pngP, png_infop& infoP): pngPP(&pngP), infoPP(&infoP) {}
- ~Cleanup() { png_destroy_read_struct(pngPP, infoPP, (png_infopp)NULL); }
- } cleanup(pngPtr, infoPtr);
- infoPtr = png_create_info_struct(pngPtr);
- if (!infoPtr) throw std::runtime_error("png_create_info_struct failed");
- std::vector<png_bytep> rows;
- // There must be no C++ objects after the setjmp line! (they won't get properly destructed)
+static void loadPNG_internal(png_structp pngPtr, png_infop infoPtr, std::ifstream& file, std::vector<unsigned char>& image, std::vector<png_bytep>& rows, unsigned& w, unsigned& h, unsigned& channels) {
if (setjmp(png_jmpbuf(pngPtr))) throw std::runtime_error("Reading PNG failed");
png_set_read_fn(pngPtr,(voidp)&file, readPngHelper);
png_read_info(pngPtr, infoPtr);
png_set_expand(pngPtr);
png_set_strip_16(pngPtr);
png_set_gray_to_rgb(pngPtr);
- unsigned w = png_get_image_width(pngPtr, infoPtr);
- unsigned h = png_get_image_height(pngPtr, infoPtr);
- unsigned channels = png_get_channels(pngPtr, infoPtr);
+ w = png_get_image_width(pngPtr, infoPtr);
+ h = png_get_image_height(pngPtr, infoPtr);
+ channels = png_get_channels(pngPtr, infoPtr);
if (channels == 1) channels = 3; // Grayscale gets expanded to RGB
if (channels == 2) channels = 4; // Grayscale with alpha gets expanded to RGBA
image.resize(w * h * 4);
@@ -86,6 +71,25 @@ template <typename T> void loadPNG(T& target, std::string const& filename) {
pos += (w * channels + 3) & ~3; // Rows need to be word aligned
}
png_read_image(pngPtr, &rows[0]);
+}
+
+template <typename T> void loadPNG(T& target, std::string const& filename) {
+ std::vector<unsigned char> image;
+ std::ifstream file(filename.c_str(), std::ios::binary);
+ png_structp pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
+ if (!pngPtr) throw std::runtime_error("png_create_read_struct failed");
+ png_infop infoPtr = NULL;
+ struct Cleanup {
+ png_structpp pngPP;
+ png_infopp infoPP;
+ Cleanup(png_structp& pngP, png_infop& infoP): pngPP(&pngP), infoPP(&infoP) {}
+ ~Cleanup() { png_destroy_read_struct(pngPP, infoPP, (png_infopp)NULL); }
+ } cleanup(pngPtr, infoPtr);
+ infoPtr = png_create_info_struct(pngPtr);
+ if (!infoPtr) throw std::runtime_error("png_create_info_struct failed");
+ std::vector<png_bytep> rows;
+ unsigned w, h, channels;
+ loadPNG_internal(pngPtr, infoPtr, file, image, rows, w, h, channels);
target.load(w, h, channels == 4 ? pix::CHAR_RGBA : pix::RGB, &image[0], float(w)/h);
}
@@ -133,6 +137,22 @@ template <typename T> void loadJPEG(T& target, std::string const& filename) {
target.load(w, h, pix::RGB, &image[0], float(w)/h);
}
+static void writePNG_internal(png_structp pngPtr, png_infop infoPtr, std::ofstream& file, Image const& img, std::vector<png_bytep>& rows) {
+ // There must be no objects initialized within this function because longjmp will mess them up
+ if (setjmp(png_jmpbuf(pngPtr))) throw std::runtime_error("Writing PNG failed");
+ png_set_write_fn(pngPtr, &file, writePngHelper, NULL);
+ png_set_IHDR(pngPtr, infoPtr, img.w, img.h, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
+ png_write_info(pngPtr, infoPtr);
+ unsigned stride = (img.w * 3 + 3) & ~3; // Number of bytes per row (word-aligned)
+ unsigned pos = img.h * stride;
+ for (unsigned y = 0; y < img.h; ++y) {
+ pos -= stride;
+ rows[y] = (png_bytep)(&img.data[pos]);
+ }
+ png_write_image(pngPtr, &rows[0]);
+ png_write_end(pngPtr, NULL);
+}
+
static inline void writePNG(std::string const& filename, Image const& img) {
std::vector<png_bytep> rows(img.h);
std::ofstream file(filename.c_str(), std::ios::binary);
@@ -147,18 +167,6 @@ static inline void writePNG(std::string const& filename, Image const& img) {
} cleanup(pngPtr, infoPtr);
infoPtr = png_create_info_struct(pngPtr);
if (!infoPtr) throw std::runtime_error("png_create_info_struct failed");
- // There must be no C++ objects after the setjmp line! (they won't get properly destructed)
- if (setjmp(png_jmpbuf(pngPtr))) throw std::runtime_error("Writing PNG failed");
- png_set_write_fn(pngPtr, &file, writePngHelper, NULL);
- png_set_IHDR(pngPtr, infoPtr, img.w, img.h, 8, PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
- png_write_info(pngPtr, infoPtr);
- unsigned stride = (img.w * 3 + 3) & ~3; // Number of bytes per row (word-aligned)
- unsigned pos = img.h * stride;
- for (unsigned y = 0; y < img.h; ++y) {
- pos -= stride;
- rows[y] = (png_bytep)(&img.data[pos]);
- }
- png_write_image(pngPtr, &rows[0]);
- png_write_end(pngPtr, NULL);
+ writePNG_internal(pngPtr, infoPtr, file, img, rows);
}
|
|
From: Tapio V. <aa...@us...> - 2010-01-21 06:50:29
|
Module: performous
Branch: master
Commit: bd688a5ccb4749cb7f8ec29a69a20b7562375245
Author: Tapio Vierros <tap...@gm...>
Date: Thu Jan 21 08:46:22 2010 +0200
Don't look for bmp or gif images.
---
game/backgrounds.cc | 2 +-
game/songparser.hh | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/game/backgrounds.cc b/game/backgrounds.cc
index 15f6611..fcc7fe2 100644
--- a/game/backgrounds.cc
+++ b/game/backgrounds.cc
@@ -51,7 +51,7 @@ void Backgrounds::reload_internal(fs::path const& parent) {
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 {
// Find suitable file formats
- boost::regex expression("(.*\\.(png|jpeg|jpg|svg|bmp|gif))$", boost::regex_constants::icase);
+ boost::regex expression("(.*\\.(png|jpeg|jpg|svg))$", boost::regex_constants::icase);
boost::cmatch match;
for (fs::directory_iterator dirIt(parent), dirEnd; m_loading && dirIt != dirEnd; ++dirIt) {
fs::path p = dirIt->path();
diff --git a/game/songparser.hh b/game/songparser.hh
index 8165d94..993a3ce 100644
--- a/game/songparser.hh
+++ b/game/songparser.hh
@@ -52,8 +52,8 @@ class SongParser {
// In case no images/videos were specified, try to guess them
if (m_song.cover.empty() || (m_song.background.empty() && m_song.video.empty())) {
- boost::regex coverfile("((cover|album|label|\\[co\\])\\.(png|jpeg|jpg|svg|bmp|gif))$", boost::regex_constants::icase);
- boost::regex backgroundfile("((background|bg||\\[bg\\])\\.(png|jpeg|jpg|svg|bmp|gif))$", boost::regex_constants::icase);
+ boost::regex coverfile("((cover|album|label|\\[co\\])\\.(png|jpeg|jpg|svg))$", boost::regex_constants::icase);
+ boost::regex backgroundfile("((background|bg||\\[bg\\])\\.(png|jpeg|jpg|svg))$", boost::regex_constants::icase);
boost::regex videofile("(.*\\.(avi|mpg|mpeg|flv|mov|mp4))$", boost::regex_constants::icase);
boost::cmatch match;
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-01-21 06:47:13
|
Module: performous Branch: master Commit: 6bb79badd315304f2cd500327828b8cfa8e5b25a Author: Lasse Karkkainen <tro...@tr...> Date: Thu Jan 21 08:02:54 2010 +0200 Update fi locale --- lang/fi.po | 74 ++++++++++++++++++++++++++++++++++------------------------- 1 files changed, 43 insertions(+), 31 deletions(-) diff --git a/lang/fi.po b/lang/fi.po index 77ce656..a4bd93a 100644 --- a/lang/fi.po +++ b/lang/fi.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Performous\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-01-17 07:21+0200\n" +"POT-Creation-Date: 2010-01-21 07:58+0200\n" "PO-Revision-Date: \n" "Last-Translator: Lasse Kärkkäinen <tro...@tr...>\n" "Language-Team: \n" @@ -13,6 +13,18 @@ msgstr "" "X-Poedit-Basepath: .\n" "X-Poedit-SearchPath-0: ../game\n" +#: ../game/main.cc:141 +msgid "Loading..." +msgstr "Käynnistyy..." + +#: ../game/main.cc:171 +msgid "Screenshot taken!" +msgstr "Kuvakaappaus tallennettu!" + +#: ../game/main.cc:174 +msgid "Screenshot failed!" +msgstr "Kuvakaappaus epäonnistui!" + #: ../game/screen_players.cc:110 msgid "No players found!" msgstr "Pelaajia ei löytynyt!" @@ -93,96 +105,96 @@ msgstr "" "\n" "Säädä ääniasetuksia ennen pelaamista." -#: ../game/screen_sing.cc:322 +#: ../game/screen_sing.cc:313 msgid " ENTER to skip instrumental break" msgstr " ENTER hypätäksesi lauluosaan" -#: ../game/screen_sing.cc:323 +#: ../game/screen_sing.cc:314 msgid " Remember to wait for grading!" msgstr " Muista odottaa arvostelua!" -#: ../game/screen_sing.cc:411 +#: ../game/screen_sing.cc:402 msgid "No player!" msgstr "Pelaajia ei löytynyt!" -#: ../game/screen_sing.cc:420 +#: ../game/screen_sing.cc:411 msgid "Hit singer" msgstr "Tähti" -#: ../game/screen_sing.cc:421 +#: ../game/screen_sing.cc:412 msgid "Lead singer" msgstr "Solisti" -#: ../game/screen_sing.cc:422 -#: ../game/screen_sing.cc:428 -#: ../game/screen_sing.cc:434 +#: ../game/screen_sing.cc:413 +#: ../game/screen_sing.cc:419 +#: ../game/screen_sing.cc:425 msgid "Rising star" msgstr "Harrastaja" -#: ../game/screen_sing.cc:423 -#: ../game/screen_sing.cc:429 -#: ../game/screen_sing.cc:435 +#: ../game/screen_sing.cc:414 +#: ../game/screen_sing.cc:420 +#: ../game/screen_sing.cc:426 msgid "Amateur" msgstr "Amatööri" -#: ../game/screen_sing.cc:424 -#: ../game/screen_sing.cc:436 +#: ../game/screen_sing.cc:415 +#: ../game/screen_sing.cc:427 msgid "Tone deaf" msgstr "Lahjaton" -#: ../game/screen_sing.cc:426 +#: ../game/screen_sing.cc:417 msgid "Maniac" msgstr "Maanikko" -#: ../game/screen_sing.cc:427 +#: ../game/screen_sing.cc:418 msgid "Hoofer" msgstr "Ekspertti" -#: ../game/screen_sing.cc:430 +#: ../game/screen_sing.cc:421 msgid "Loser" msgstr "Luuseri" -#: ../game/screen_sing.cc:432 +#: ../game/screen_sing.cc:423 msgid "Virtuoso" msgstr "Virtuoosi" -#: ../game/screen_sing.cc:433 +#: ../game/screen_sing.cc:424 msgid "Rocker" msgstr "Rokkari" -#: ../game/songs.cc:181 +#: ../game/songs.cc:192 msgid "random order" msgstr "satunnainen järjestys" -#: ../game/songs.cc:182 +#: ../game/songs.cc:193 msgid "sorted by song" msgstr "järjestetty kappaleen mukaan" -#: ../game/songs.cc:183 +#: ../game/songs.cc:194 msgid "sorted by artist" msgstr "järjestetty esittäjän mukaan" -#: ../game/songs.cc:184 +#: ../game/songs.cc:195 msgid "sorted by edition" msgstr "järjestetty julkaisun mukaan" -#: ../game/songs.cc:185 +#: ../game/songs.cc:196 msgid "sorted by genre" msgstr "järjestetty lajityypin mukaan" -#: ../game/songs.cc:186 +#: ../game/songs.cc:197 msgid "sorted by path" msgstr "järjestetty polun mukaan" -#: ../game/songs.cc:187 +#: ../game/songs.cc:198 msgid "sorted by language" msgstr "järjestetty kielen mukaan" -#: ../game/screen_songs.cc:184 +#: ../game/screen_songs.cc:188 msgid "No songs found!" msgstr "Kappaleita ei löytynyt!" -#: ../game/screen_songs.cc:185 +#: ../game/screen_songs.cc:189 msgid "" "Visit performous.org\n" "for free songs" @@ -190,15 +202,15 @@ msgstr "" "Hae ilmaista musiikkia\n" "osoitteesta performous.org" -#: ../game/screen_songs.cc:187 +#: ../game/screen_songs.cc:191 msgid "no songs match search" msgstr "yksikään kappale ei vastannut hakuasi" -#: ../game/screen_songs.cc:195 +#: ../game/screen_songs.cc:199 msgid "(press END to view hiscores)" msgstr "(paina END nähdäksesi ennätykset)" -#: ../game/screen_songs.cc:196 +#: ../game/screen_songs.cc:200 msgid "<type in to search>" msgstr "<kirjoita etsiäksesi>" |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-01-21 06:47:12
|
Module: performous
Branch: master
Commit: 5571eb75c0675f8e38321487e215098e4de26044
Author: Lasse Karkkainen <tro...@tr...>
Date: Thu Jan 21 08:02:45 2010 +0200
Build locales during build instead of doing it during configure.
---
lang/CMakeLists.txt | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lang/CMakeLists.txt b/lang/CMakeLists.txt
index 781ca4d..c7c42ff 100644
--- a/lang/CMakeLists.txt
+++ b/lang/CMakeLists.txt
@@ -3,7 +3,9 @@ file(GLOB LANGUAGES *.po)
foreach(language ${LANGUAGES})
string(REGEX REPLACE "(.+(\\\\|/))+" "" language ${language})
string(REGEX REPLACE "\\.po$" "" language ${language})
- message("-- Compiling language \"${language}\"")
- execute_process(COMMAND ${Msgfmt_BIN} -v ${CMAKE_CURRENT_SOURCE_DIR}/${language}.po -o ${CMAKE_CURRENT_BINARY_DIR}/${language}.mo)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${language}.mo DESTINATION ${LOCALE_DIR_WIN32_PREFIX}${LOCALE_DIR}/${language}/LC_MESSAGES RENAME ${CMAKE_PROJECT_NAME}.mo)
+ set(pofile ${CMAKE_CURRENT_SOURCE_DIR}/${language}.po)
+ set(mofile ${CMAKE_CURRENT_BINARY_DIR}/${language}.mo)
+ add_custom_command(OUTPUT ${mofile} COMMAND ${Msgfmt_BIN} -v "${pofile}" -o ${mofile} MAIN_DEPENDENCY ${pofile} COMMENT "Building ${language} locale" VERBATIM)
+ add_custom_target(locale_${language} ALL DEPENDS ${mofile}) # Make sure the mofiles are always built
+ install(FILES ${mofile} DESTINATION ${LOCALE_DIR_WIN32_PREFIX}${LOCALE_DIR}/${language}/LC_MESSAGES RENAME ${CMAKE_PROJECT_NAME}.mo)
endforeach(language)
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-01-21 06:47:08
|
Module: performous
Branch: master
Commit: f8a18fe8a9dd9088e49aa9f375ebf485b5f53d8b
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Jan 19 08:41:24 2010 +0200
Added TODO
---
docs/TODO.txt | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/docs/TODO.txt b/docs/TODO.txt
index 02612ab..65746fc 100644
--- a/docs/TODO.txt
+++ b/docs/TODO.txt
@@ -17,6 +17,7 @@ Big features:
* Internet highscore
- Mic effects (reduce volume for bad singers, perfect pitch, reverb, etc)
- Ingame Singstar DVD support (integrated ripping + ffmpeg feeding + XML song format)
+- Automatically download songs and other stuff from performous.org
Features:
@@ -29,7 +30,6 @@ Features:
- Allow playing a single song given as commandline argument (no menus)
- Kiosk/arcade mode (disable exiting game and limit other functions)
-
Dance features:
- Colored arrows for timing
|
|
From: Yoda-JM <yo...@us...> - 2010-01-20 23:54:24
|
Module: performous
Branch: master
Commit: fa0869cccb882d98f6366a2e3769a39b3541814b
Author: Vincent Le Ligeour <yo...@us...>
Date: Thu Jan 21 00:54:02 2010 +0100
Made language generation more verbose
---
lang/CMakeLists.txt | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lang/CMakeLists.txt b/lang/CMakeLists.txt
index a4ee12e..781ca4d 100644
--- a/lang/CMakeLists.txt
+++ b/lang/CMakeLists.txt
@@ -3,6 +3,7 @@ file(GLOB LANGUAGES *.po)
foreach(language ${LANGUAGES})
string(REGEX REPLACE "(.+(\\\\|/))+" "" language ${language})
string(REGEX REPLACE "\\.po$" "" language ${language})
+ message("-- Compiling language \"${language}\"")
execute_process(COMMAND ${Msgfmt_BIN} -v ${CMAKE_CURRENT_SOURCE_DIR}/${language}.po -o ${CMAKE_CURRENT_BINARY_DIR}/${language}.mo)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${language}.mo DESTINATION ${LOCALE_DIR_WIN32_PREFIX}${LOCALE_DIR}/${language}/LC_MESSAGES RENAME ${CMAKE_PROJECT_NAME}.mo)
endforeach(language)
|
|
From: Yoda-JM <yo...@us...> - 2010-01-20 23:16:52
|
Module: performous Branch: master Commit: 841c3b2db33288396639d8dd887bbd815f39312e Author: Vincent Le Ligeour <yo...@us...> Date: Thu Jan 21 00:16:30 2010 +0100 Updated French translation --- lang/fr.po | 90 ++++++++++++++++++++++++++++++++++-------------------------- 1 files changed, 51 insertions(+), 39 deletions(-) diff --git a/lang/fr.po b/lang/fr.po index bcd50ec..d7ce21c 100644 --- a/lang/fr.po +++ b/lang/fr.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: Performous\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-01-17 23:51+0100\n" +"POT-Creation-Date: 2010-01-21 00:06+0100\n" "PO-Revision-Date: \n" "Last-Translator: Vincent Le Ligeour <yo...@us...>\n" "Language-Team: \n" @@ -13,92 +13,92 @@ msgstr "" "X-Poedit-Basepath: .\n" "X-Poedit-SearchPath-0: ../game\n" -#: ../game/screen_sing.cc:307 +#: ../game/screen_sing.cc:310 msgid " ENTER to skip instrumental break" msgstr " \"Entrée\" pour passer l'instrumental" -#: ../game/screen_sing.cc:308 +#: ../game/screen_sing.cc:311 msgid " Remember to wait for grading!" msgstr " N'oubliez pas d'attendre pour votre classement!" -#: ../game/screen_sing.cc:396 +#: ../game/screen_sing.cc:399 msgid "No player!" msgstr "Aucun joueur n'a été trouvé!" -#: ../game/screen_sing.cc:405 +#: ../game/screen_sing.cc:408 msgid "Hit singer" msgstr "Superstar" -#: ../game/screen_sing.cc:406 +#: ../game/screen_sing.cc:409 msgid "Lead singer" msgstr "Soliste" -#: ../game/screen_sing.cc:407 -#: ../game/screen_sing.cc:413 -#: ../game/screen_sing.cc:419 +#: ../game/screen_sing.cc:410 +#: ../game/screen_sing.cc:416 +#: ../game/screen_sing.cc:422 msgid "Rising star" msgstr "Etoile montante" -#: ../game/screen_sing.cc:408 -#: ../game/screen_sing.cc:414 -#: ../game/screen_sing.cc:420 +#: ../game/screen_sing.cc:411 +#: ../game/screen_sing.cc:417 +#: ../game/screen_sing.cc:423 msgid "Amateur" msgstr "Amateur" -#: ../game/screen_sing.cc:409 -#: ../game/screen_sing.cc:421 +#: ../game/screen_sing.cc:412 +#: ../game/screen_sing.cc:424 msgid "Tone deaf" msgstr "Casserole" -#: ../game/screen_sing.cc:411 +#: ../game/screen_sing.cc:414 msgid "Maniac" msgstr "Maniac" -#: ../game/screen_sing.cc:412 +#: ../game/screen_sing.cc:415 msgid "Hoofer" msgstr "Claquettiste" -#: ../game/screen_sing.cc:415 +#: ../game/screen_sing.cc:418 msgid "Loser" msgstr "Perdant" -#: ../game/screen_sing.cc:417 +#: ../game/screen_sing.cc:420 msgid "Virtuoso" msgstr "Virtuose" -#: ../game/screen_sing.cc:418 +#: ../game/screen_sing.cc:421 msgid "Rocker" msgstr "Rockeur" -#: ../game/screen_intro.cc:10 +#: ../game/screen_intro.cc:15 msgid "Perform" msgstr "Jouer" -#: ../game/screen_intro.cc:10 +#: ../game/screen_intro.cc:15 msgid "Start performing!" msgstr "Commencer une partie!" -#: ../game/screen_intro.cc:11 +#: ../game/screen_intro.cc:16 msgid "Practice" msgstr "S'exercer" -#: ../game/screen_intro.cc:11 +#: ../game/screen_intro.cc:16 msgid "Check your skills or test the microphones" msgstr "Chauffer votre voix et tester les micros" -#: ../game/screen_intro.cc:12 +#: ../game/screen_intro.cc:17 msgid "Configure" msgstr "Options" -#: ../game/screen_intro.cc:12 +#: ../game/screen_intro.cc:17 msgid "Configure game options" msgstr "Configurer les options de jeu" -#: ../game/screen_intro.cc:13 +#: ../game/screen_intro.cc:18 msgid "Quit" msgstr "Quitter" -#: ../game/screen_intro.cc:13 +#: ../game/screen_intro.cc:18 msgid "Leave the game" msgstr "Sortir du jeu" @@ -118,11 +118,11 @@ msgstr "" "\n" "Veuillez en configurer certains avant de jouer." -#: ../game/screen_songs.cc:184 +#: ../game/screen_songs.cc:186 msgid "No songs found!" msgstr "Aucun morceau trouvé!" -#: ../game/screen_songs.cc:185 +#: ../game/screen_songs.cc:187 msgid "" "Visit performous.org\n" "for free songs" @@ -130,15 +130,15 @@ msgstr "" "Visitez performous.org\n" "pour des morceaux gratuits" -#: ../game/screen_songs.cc:187 +#: ../game/screen_songs.cc:189 msgid "no songs match search" msgstr "aucun morceau ne satisfait la recherche" -#: ../game/screen_songs.cc:195 +#: ../game/screen_songs.cc:197 msgid "(press END to view hiscores)" msgstr "(presser Fin pour voir le classement)" -#: ../game/screen_songs.cc:196 +#: ../game/screen_songs.cc:198 msgid "<type in to search>" msgstr "<Entrez votre recherche>" @@ -146,6 +146,18 @@ msgstr "<Entrez votre recherche>" msgid "Hiscore for " msgstr "Records pour " +#: ../game/main.cc:154 +msgid "Loading..." +msgstr "Chargement..." + +#: ../game/main.cc:184 +msgid "Screenshot taken!" +msgstr "Capture d'écran effectuée" + +#: ../game/main.cc:187 +msgid "Screenshot failed!" +msgstr "Echec de la capture d'écran" + #: ../game/screen_players.cc:110 msgid "No players found!" msgstr "Aucun joueur n'a été trouvé!" @@ -178,31 +190,31 @@ msgstr "Entrez un nom pour créer un nouveau joueur." msgid "Search Text:" msgstr "Recherche:" -#: ../game/songs.cc:181 +#: ../game/songs.cc:192 msgid "random order" msgstr "ordre aléatoire" -#: ../game/songs.cc:182 +#: ../game/songs.cc:193 msgid "sorted by song" msgstr "classement par chanson" -#: ../game/songs.cc:183 +#: ../game/songs.cc:194 msgid "sorted by artist" msgstr "classement par artiste" -#: ../game/songs.cc:184 +#: ../game/songs.cc:195 msgid "sorted by edition" msgstr "classement par édition" -#: ../game/songs.cc:185 +#: ../game/songs.cc:196 msgid "sorted by genre" msgstr "classement par genre" -#: ../game/songs.cc:186 +#: ../game/songs.cc:197 msgid "sorted by path" msgstr "classement par chemin" -#: ../game/songs.cc:187 +#: ../game/songs.cc:198 msgid "sorted by language" msgstr "classement par langue" |
|
From: Tapio V. <aa...@us...> - 2010-01-19 20:36:00
|
Module: performous Branch: master Commit: 9d10f1bf65ea214c55f039d5e4a858771f405aa9 Author: Tapio Vierros <tap...@gm...> Date: Tue Jan 19 22:34:10 2010 +0200 Add some comments. --- game/3dobject.cc | 23 ++++++++++--------- game/3dobject.hh | 23 ++++++++++++------- game/backgrounds.cc | 12 ++++++--- game/dancegraph.cc | 15 ++++++------ game/dancegraph.hh | 42 ++++++++++++++++++------------------ game/guitargraph.cc | 10 ++++---- game/guitargraph.hh | 56 ++++++++++++++++++++++++------------------------ game/layout_singer.cc | 16 ++++++------ game/songparser-ini.cc | 9 ++++++- game/songparser-sm.cc | 5 +-- game/songparser-txt.cc | 1 + game/video_driver.cc | 3 ++ 12 files changed, 117 insertions(+), 98 deletions(-) |
|
From: Tapio V. <aa...@us...> - 2010-01-19 20:35:57
|
Module: performous
Branch: master
Commit: b912f6ca65a8dad51a770bcdfda13e667056428c
Author: Tapio Vierros <tap...@gm...>
Date: Tue Jan 19 22:22:05 2010 +0200
Get rid of auto-reversing matrix operations in favor of PushMatrix.
---
game/3dobject.hh | 3 +--
game/dancegraph.cc | 9 ++++-----
game/glutil.hh | 27 ---------------------------
game/guitargraph.cc | 20 +++++++-------------
game/notegraph.cc | 5 +++--
5 files changed, 15 insertions(+), 49 deletions(-)
diff --git a/game/3dobject.hh b/game/3dobject.hh
index 11f3840..ecb7b56 100644
--- a/game/3dobject.hh
+++ b/game/3dobject.hh
@@ -64,13 +64,12 @@ class Object3d: boost::noncopyable {
}
/// draws the object
void draw(float x = 0, float y = 0, float z = 0, float s = 1.0) const {
+ glutil::PushMatrix pm;
glTranslatef(x, y, z);
if (s != 1.0) glScalef(s,s,s);
if (m_texture) {
UseTexture tex(*m_texture);
glCallList(m_displist);
} else glCallList(m_displist);
- if (s != 1.0) { float ss = 1.0/s; glScalef(ss,ss,ss); }
- glTranslatef(-x, -y, -z);
}
};
diff --git a/game/dancegraph.cc b/game/dancegraph.cc
index baa27e1..3192726 100644
--- a/game/dancegraph.cc
+++ b/game/dancegraph.cc
@@ -313,7 +313,8 @@ namespace {
/// Draw a dance pad icon using the given texture
void DanceGraph::drawArrow(int arrow_i, Texture& tex, float x, float y, float scale, float ty1, float ty2) {
- glutil::Translation tr(x, y, 0.0f);
+ glutil::PushMatrix pm;
+ glTranslatef(x, y, 0.0f);
if (scale != 1.0f) glScalef(scale, scale, scale);
{
UseTexture tblock(tex);
@@ -321,17 +322,15 @@ void DanceGraph::drawArrow(int arrow_i, Texture& tex, float x, float y, float sc
vertexPair(arrow_i, 0.0f, -arrowSize, ty1);
vertexPair(arrow_i, 0.0f, arrowSize, ty2);
}
- if (scale != 1.0f) glScalef(1.0f/scale, 1.0f/scale, 1.0f/scale);
}
/// Draw a mine note
void DanceGraph::drawMine(float x, float y, float rot, float scale) {
- glutil::Translation tr(x, y, 0.0f);
+ glutil::PushMatrix pm;
+ glTranslatef(x, y, 0.0f);
if (scale != 1.0f) glScalef(scale, scale, scale);
if (rot != 0.0f) glRotatef(rot, 0.0f, 0.0f, 1.0f);
m_mine.draw();
- if (rot != 0.0f) glRotatef(-rot, 0.0f, 0.0f, 1.0f);
- if (scale != 1.0f) glScalef(1.0f/scale, 1.0f/scale, 1.0f/scale);
}
/// Draws the dance graph
diff --git a/game/glutil.hh b/game/glutil.hh
index 2d20d83..ad7f309 100644
--- a/game/glutil.hh
+++ b/game/glutil.hh
@@ -56,33 +56,6 @@ namespace glutil {
}
};
- /// auto-reversing translation
- struct Translation {
- Translation(float _x, float _y, float _z = 0.0f): m_x(_x), m_y(_y), m_z(_z)
- { glTranslatef(m_x, m_y, m_z); }
- ~Translation() { glTranslatef(-m_x, -m_y, -m_z); }
- private:
- float m_x, m_y, m_z;
- };
-
- /// auto-reversing rotation
- struct Rotation {
- Rotation(float _a, float _x, float _y, float _z): m_a(_a), m_x(_x), m_y(_y), m_z(_z)
- { glRotatef(m_a, m_x, m_y, m_z); }
- ~Rotation() { glRotatef(-m_a, m_x, m_y, m_z); }
- private:
- float m_a, m_x, m_y, m_z;
- };
-
- /// auto-reversing scaling
- struct Scale {
- Scale(float _x, float _y, float _z): m_x(_x), m_y(_y), m_z(_z)
- { glScalef(m_x, m_y, m_z); }
- ~Scale() { glScalef(1.0/m_x, 1.0/m_y, 1.0/m_z); }
- private:
- float m_x, m_y, m_z;
- };
-
/// struct to store color information
struct Color {
float r, ///< red component
diff --git a/game/guitargraph.cc b/game/guitargraph.cc
index 9cc0163..150805d 100644
--- a/game/guitargraph.cc
+++ b/game/guitargraph.cc
@@ -492,14 +492,13 @@ void GuitarGraph::draw(double time) {
float ng_r = 0, ng_g = 0, ng_b = 0; // neck glow color components
int ng_ccnt = 0; // neck glow color count
{ // Translate, rotate and scale to place
- // The scope blocks are there so that the actions are automatically reversed
- glutil::PushMatrixMode pmm(GL_PROJECTION); {
- glutil::Translation tr1(frac * 2.0 * offsetX, 0.0f, 0.0f); {
- glutil::PushMatrixMode pmb(GL_MODELVIEW); {
- glutil::Translation tr2((1.0 - frac) * offsetX, dimensions.y2(), 0.0f); {
- glutil::Rotation rot1(g_angle, 1.0f, 0.0f, 0.0f); {
+ glutil::PushMatrixMode pmm(GL_PROJECTION);
+ glTranslatef(frac * 2.0 * offsetX, 0.0f, 0.0f);
+ glutil::PushMatrixMode pmb(GL_MODELVIEW);
+ glTranslatef((1.0 - frac) * offsetX, dimensions.y2(), 0.0f);
+ glRotatef(g_angle, 1.0f, 0.0f, 0.0f);
float temp_s = dimensions.w() / 5.0f;
- glutil::Scale sc1(temp_s, temp_s, temp_s);
+ glScalef(temp_s, temp_s, temp_s);
// Draw the neck
{
@@ -606,12 +605,7 @@ void GuitarGraph::draw(double time) {
++it;
}
}
- } //< reverse scale sc1
- } //< reverse rot rot1
- } //< reverse trans tr2
- } //< reverse push pmb
- } //< reverse trans tr1
- } //< reverse push pmm
+ }
// Bottom neck glow
if (ng_ccnt > 0) {
diff --git a/game/notegraph.cc b/game/notegraph.cc
index c9afd9c..7ae5fad 100644
--- a/game/notegraph.cc
+++ b/game/notegraph.cc
@@ -114,8 +114,9 @@ void NoteGraph::draw(double time, Database const& database, Position position) {
float centerx = x + w - 1.2 * hh; // Star is 1.2 units from end
float rot = fmod(time * 360, 360); // They rotate!
float zoom = (std::abs((rot-180) / 360.0f) * 0.8f + 0.6f) * (position == NoteGraph::TOP ? 2.3 : 2.0) * hh;
- glutil::Translation tr(centerx, centery);
- glutil::Rotation rt(rot, 0.0f, 0.0f, 1.0f);
+ glutil::PushMatrix pm;
+ glTranslatef(centerx, centery, 0.0f);
+ glRotatef(rot, 0.0f, 0.0f, 1.0f);
m_star.draw(Dimensions().stretch(zoom, zoom).center().middle(), TexCoords());
}
|
|
From: Tapio V. <aa...@us...> - 2010-01-19 19:58:36
|
Module: performous
Branch: master
Commit: 5d80cfb434b57aadd7ed5a230e5912c00d587842
Author: Tapio Vierros <tap...@gm...>
Date: Tue Jan 19 21:57:37 2010 +0200
Moved in-game volume control to main.cc and added flash messages.
---
game/joystick.cc | 5 +++--
game/main.cc | 15 ++++++++++++++-
game/screen_configuration.cc | 2 --
game/screen_intro.cc | 2 --
game/screen_practice.cc | 2 --
game/screen_sing.cc | 3 ---
game/screen_songs.cc | 2 --
7 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index c514abf..efb9976 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -94,8 +94,9 @@ input::NavButton input::getNav(SDL_Event const &e) {
else if (k == SDLK_PAGEUP) return input::MOREUP;
else if (k == SDLK_PAGEDOWN) return input::MOREDOWN;
else if (k == SDLK_PAUSE || (k == SDLK_p && mod & KMOD_CTRL)) return input::PAUSE;
- else if (k == SDLK_UP && mod & KMOD_CTRL) return input::VOLUME_UP;
- else if (k == SDLK_DOWN && mod & KMOD_CTRL) return input::VOLUME_DOWN;
+ // Volume control is currently handled in main.cc
+ //else if (k == SDLK_UP && mod & KMOD_CTRL) return input::VOLUME_UP;
+ //else if (k == SDLK_DOWN && mod & KMOD_CTRL) return input::VOLUME_DOWN;
} else if (e.type == SDL_JOYBUTTONDOWN) {
// Joystick buttons
unsigned int joy_id = e.jbutton.which;
diff --git a/game/main.cc b/game/main.cc
index 5968199..3a7cfea 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -64,12 +64,25 @@ static void checkEvents_SDL(ScreenManager& sm, Window& window) {
}
if (keypressed == SDLK_PRINT || keypressed == SDLK_F12) {
g_take_screenshot = true;
- continue;
+ continue; // Already handled here...
}
if (keypressed == SDLK_F4 && modifier & KMOD_ALT) {
sm.finished();
continue; // Already handled here...
}
+ // Volume control
+ if ((keypressed == SDLK_UP || keypressed == SDLK_DOWN) && modifier & KMOD_CTRL) {
+ std::string curS = sm.getCurrentScreen()->getName();
+ // Pick proper setting
+ std::string which_vol = (curS == "Sing" || curS == "Practice")
+ ? "audio/music_volume" : "audio/preview_volume";
+ // Adjust value
+ if (keypressed == SDLK_UP) ++config[which_vol];
+ else --config[which_vol];
+ // Show message
+ sm.flashMessage(config[which_vol].getShortDesc() + ": " + config[which_vol].getValue());
+ continue; // Already handled here...
+ }
break;
}
// Forward to screen even if the input system takes it (ignoring pushEvent return value)
diff --git a/game/screen_configuration.cc b/game/screen_configuration.cc
index 3f1f653..b9d50bf 100644
--- a/game/screen_configuration.cc
+++ b/game/screen_configuration.cc
@@ -32,8 +32,6 @@ void ScreenConfiguration::manageEvent(SDL_Event event) {
else if (nav == input::DOWN && selected + 1 < configuration.size()) ++selected;
else if (nav == input::LEFT) --*ci;
else if (nav == input::RIGHT) ++*ci;
- else if (nav == input::VOLUME_DOWN) --config["audio/preview_volume"];
- else if (nav == input::VOLUME_UP) ++config["audio/preview_volume"];
} else if (event.type == SDL_KEYDOWN) {
int key = event.key.keysym.sym;
SDLMod modifier = event.key.keysym.mod;
diff --git a/game/screen_intro.cc b/game/screen_intro.cc
index 670172f..2b488a5 100755
--- a/game/screen_intro.cc
+++ b/game/screen_intro.cc
@@ -41,8 +41,6 @@ void ScreenIntro::manageEvent(SDL_Event event) {
if (nav == input::CANCEL) selected = m_menuOptions.size() - 1; // Move cursor to quit
else if (nav == input::DOWN || nav == input::RIGHT || nav == input::MOREDOWN) ++selected;
else if (nav == input::UP || nav == input::LEFT || nav == input::MOREUP) --selected;
- else if (nav == input::VOLUME_DOWN) --config["audio/preview_volume"];
- else if (nav == input::VOLUME_UP) ++config["audio/preview_volume"];
else if (nav == input::START) {
std::string screen = m_menuOptions[selected].screen;
if (screen.empty()) sm->finished(); else sm->activateScreen(screen);
diff --git a/game/screen_practice.cc b/game/screen_practice.cc
index 63e7b01..4d0720a 100644
--- a/game/screen_practice.cc
+++ b/game/screen_practice.cc
@@ -38,8 +38,6 @@ void ScreenPractice::manageEvent(SDL_Event event) {
input::NavButton nav(input::getNav(event));
if (nav == input::CANCEL || nav == input::START || nav == input::SELECT) sm->activateScreen("Intro");
else if (nav == input::PAUSE) m_audio.togglePause();
- else if (nav == input::VOLUME_DOWN) --config["audio/music_volume"];
- else if (nav == input::VOLUME_UP) ++config["audio/music_volume"];
// FIXME: This should not use stuff from input::detail namespace!
else if (event.type == SDL_JOYBUTTONDOWN // Play drum sounds here
&& input::detail::devices[event.jbutton.which].type_match(input::DRUMS)) {
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index 1e7f280..ef0d8ec 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -216,9 +216,6 @@ void ScreenSing::manageEvent(SDL_Event event) {
}
}
}
- // Volume control
- if (nav == input::VOLUME_UP) dispInFlash(++config["audio/music_volume"]);
- if (nav == input::VOLUME_DOWN) dispInFlash(--config["audio/music_volume"]);
}
// Ctrl combinations that can be used while performing (not when score dialog is displayed)
if (event.type == SDL_KEYDOWN && (event.key.keysym.mod & KMOD_CTRL) && !m_score_window.get()) {
diff --git a/game/screen_songs.cc b/game/screen_songs.cc
index 838586e..3f5c619 100644
--- a/game/screen_songs.cc
+++ b/game/screen_songs.cc
@@ -83,8 +83,6 @@ void ScreenSongs::manageEvent(SDL_Event event) {
else if (nav == input::DOWN) m_songs.sortChange(1);
else if (nav == input::MOREUP) m_songs.advance(-10);
else if (nav == input::MOREDOWN) m_songs.advance(10);
- else if (nav == input::VOLUME_DOWN) --config["audio/preview_volume"];
- else if (nav == input::VOLUME_UP) ++config["audio/preview_volume"];
else manageSharedKey(nav);
// Handle less common, keyboard only keys
} else if (event.type == SDL_KEYDOWN) {
|
|
From: Tapio V. <aa...@us...> - 2010-01-19 19:37:36
|
Module: performous
Branch: master
Commit: 5723a95f6428e1f6672742d0cf407a492a626487
Author: Tapio Vierros <tap...@gm...>
Date: Tue Jan 19 21:35:42 2010 +0200
Fix a couple of typos in latest joystick addition.
---
game/joystick.cc | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index e2ebc77..c514abf 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -55,7 +55,7 @@ int input::buttonFromSDL(input::detail::Type _type, unsigned int _sdl_button) {
// Left Down Up Right DownL DownR UpL UpR Start Select
{ 0, 1, 2, 3, 6, 7, 4, 5, 9, 8, -1, -1, -1, -1, -1, -1 }, // generic dance pad
{ 9, 8, -1, -1, -1, -1, -1, -1, 0, 3, 1, 2, -1, -1, -1, -1 }, // TigerGame dance pad
- { 4, 7, 6, 5, -1, -1, -1, -1, 9, 8, -1, -1, 2, 3, 1, 0 } // generic2 dance pad; with ems ps2/pc adaptater
+ { 4, 7, 6, 5, -1, -1, -1, -1, 9, 8, -1, -1, 2, 3, 1, 0 } // dance pad with ems ps2/pc adapter
};
if( _sdl_button >= SDL_BUTTONS ) return -1;
using namespace detail;
@@ -271,7 +271,7 @@ void input::SDL::init() {
std::cout << " Detected as: Generic dance pad (forced)" << std::endl;
break;
case input::detail::DANCEPAD_EMS2:
- std::cout << " Detected as: EMS2 dance pad controller converter(forced)" << std::endl;
+ std::cout << " Detected as: EMS2 dance pad controller converter (forced)" << std::endl;
break;
}
input::detail::devices[i] = input::detail::InputDevPrivate(forced_type[i]);
@@ -325,7 +325,7 @@ void input::SDL::init() {
input::detail::devices[i] = input::detail::InputDevPrivate(input::detail::DANCEPAD_GENERIC);
} else if( name.find("0b43:0003") != std::string::npos ) {
std::cout << " Detected as: EMS2 Dance Pad controller converter (guessed)" << std::endl;
- input::detail::devices[i] = input::detail::InputDevPrivate(input::detail::DANCEPAD_GENERIC);
+ input::detail::devices[i] = input::detail::InputDevPrivate(input::detail::DANCEPAD_EMS2);
} else {
std::cout << " Detected as: Unknown (please report the name; use config to force detection)" << std::endl;
SDL_JoystickClose(joy);
|
|
From: Tapio V. <aa...@us...> - 2010-01-19 19:31:09
|
Module: performous
Branch: master
Commit: 917e9fa3f5059fafdd045069d3f3f9c6b72d381e
Author: Tapio Vierros <tap...@gm...>
Date: Tue Jan 19 21:25:54 2010 +0200
Modified flash message system, fading now works again.
---
game/main.cc | 18 ++++++------
game/screen.hh | 19 ++++---------
game/screen_sing.cc | 2 +-
game/screenmanager.cc | 72 +++++++++++++-----------------------------------
4 files changed, 36 insertions(+), 75 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index b32ee38..5968199 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -138,9 +138,9 @@ void mainLoop(std::string const& songlist) {
Window window(config["graphic/window_width"].i(), config["graphic/window_height"].i(), config["graphic/fullscreen"].b());
ScreenManager sm;
try {
- sm.FlashMessage(_("Loading..."));
+ sm.flashMessage(_("Loading..."), 0.0f, 1.0f, 1.0f); // No fade-in to get it to show
window.blank();
- sm.FlashMessages();
+ sm.drawFlashMessage();
window.swap();
Capture capture;
Audio audio;
@@ -162,16 +162,16 @@ void mainLoop(std::string const& songlist) {
// Main loop
boost::xtime time = now();
unsigned frames = 0;
- sm.FlashMessage("");
+ sm.flashMessage("");
while (!sm.isFinished()) {
if( g_take_screenshot ) {
fs::path filename;
try {
window.screenshot();
- sm.FlashMessage(_("Screenshot taken!"));
+ sm.flashMessage(_("Screenshot taken!"));
} catch (std::exception& e) {
std::cerr << "ERROR: " << e.what() << std::endl;
- sm.FlashMessage(_("Screenshot failed!"));
+ sm.flashMessage(_("Screenshot failed!"));
}
g_take_screenshot = false;
}
@@ -180,7 +180,7 @@ void mainLoop(std::string const& songlist) {
// Draw
window.blank();
sm.getCurrentScreen()->draw();
- sm.FlashMessages();
+ sm.drawFlashMessage();
// Display (and wait until next frame)
window.swap();
if (config["graphic/fps"].b()) {
@@ -200,14 +200,14 @@ void mainLoop(std::string const& songlist) {
checkEvents_SDL(sm, window);
} catch (std::runtime_error& e) {
std::cerr << "ERROR: " << e.what() << std::endl;
- sm.FlashMessage(std::string("ERROR: ") + e.what());
+ sm.flashMessage(std::string("ERROR: ") + e.what());
}
}
} catch (std::exception& e) {
std::cerr << "FATAL ERROR: " << e.what() << std::endl;
- sm.FlashMessage(std::string("FATAL ERROR: ") + e.what());
+ sm.flashMessage(std::string("FATAL ERROR: ") + e.what(), 0.0f); // No fade-in to get it to show
window.blank();
- sm.FlashMessages();
+ sm.drawFlashMessage();
window.swap();
boost::thread::sleep(now() + 2.0);
} catch (QuitNow&) {
diff --git a/game/screen.hh b/game/screen.hh
index 118d309..481744e 100644
--- a/game/screen.hh
+++ b/game/screen.hh
@@ -47,18 +47,10 @@ class ScreenManager: public Singleton <ScreenManager> {
/// returns pointer to Screen for given name
Screen* getScreen(std::string const& name);
- /// Get time to fade in/out the message
- float getFadeTime();
- /// Get time the message have to been showned
- float getShowTime();
- /// Set time to fade in/out the message
- bool setFadeTime(float fadeTime);
- /// Set time the message have to been showned
- bool setShowTime(float showTime);
- /// Set a messag to flash in current screen
- void FlashMessage(std::string const& name);
- /// Flash messages in current screen
- void FlashMessages();
+ /// Set a message to flash in current screen
+ void flashMessage(std::string const& name, float fadeIn=0.5f, float hold=1.5f, float fadeOut=1.0f);
+ /// Draw flash messages in current screen
+ void drawFlashMessage();
/// sets finished to true
void finished() { m_finished=true; };
@@ -67,7 +59,8 @@ class ScreenManager: public Singleton <ScreenManager> {
private:
bool m_finished;
- float m_timeToFade;
+ float m_timeToFadeIn;
+ float m_timeToFadeOut;
float m_timeToShow;
typedef boost::ptr_map<std::string, Screen> screenmap_t;
screenmap_t screens;
diff --git a/game/screen_sing.cc b/game/screen_sing.cc
index f6269e5..1e7f280 100644
--- a/game/screen_sing.cc
+++ b/game/screen_sing.cc
@@ -24,7 +24,7 @@ namespace {
/// Add a flash message about the state of a config item
void dispInFlash(ConfigItem& ci) {
ScreenManager* sm = ScreenManager::getSingletonPtr();
- sm->FlashMessage(ci.getShortDesc() + ": " + ci.getValue());
+ sm->flashMessage(ci.getShortDesc() + ": " + ci.getValue());
}
}
diff --git a/game/screenmanager.cc b/game/screenmanager.cc
index bfa17d9..ddf6279 100644
--- a/game/screenmanager.cc
+++ b/game/screenmanager.cc
@@ -6,10 +6,6 @@
template<> ScreenManager* Singleton<ScreenManager>::ms_Singleton = NULL;
ScreenManager::ScreenManager(): m_finished(false), currentScreen(), m_messagePopup(0.0, 1.0), m_textMessage(getThemePath("message_text.svg")) {
- m_timeToFade = 0.0f;
- m_timeToShow = 3.0f;
-
- m_messagePopup.setTarget(100.0);
m_textMessage.dimensions.middle().screenTop(0.05);
}
@@ -34,57 +30,29 @@ Screen* ScreenManager::getScreen(std::string const& name) {
}
}
-float ScreenManager::getFadeTime(){ return m_timeToFade; }
-float ScreenManager::getShowTime(){ return m_timeToFade; }
-
-bool ScreenManager::setFadeTime(float fadeTime){
- if (fadeTime * 2 > m_timeToShow){ //fade in + fade out
- m_timeToFade = m_timeToShow / 2;
- return false;
- } else {
- m_timeToFade = fadeTime;
- return true;
- }
-}
-
-bool ScreenManager::setShowTime(float showTime){
- if (showTime < m_timeToFade * 2){
- m_timeToShow = m_timeToFade / 2;
- return false;
- } else {
- m_timeToShow = showTime;
- return true;
- }
-}
-
-void ScreenManager::FlashMessages() {
+void ScreenManager::drawFlashMessage() {
double time = m_messagePopup.get();
- if (time > 0.0){
- bool haveToFadeIn = time < (m_timeToFade);
- bool haveToFadeOut = time > (m_messagePopup.getTarget() - m_timeToFade);
- bool haveToStop = time > (m_messagePopup.getTarget() - 0.001);
- float fadeValue = 1.0f;
- if (haveToFadeOut){
- fadeValue = float((m_messagePopup.getTarget() - time) / m_timeToFade);
- glColor4f(1.0f, 1.0f, 1.0f, (fadeValue));
-
- if(haveToStop){
- m_messagePopup.setTarget(0.0, true);
- }
- }else if (haveToFadeIn){
- fadeValue = float(time / m_timeToFade);
-
- glColor4f(1.0f, 1.0f, 1.0f, fadeValue);
- }
-
- m_textMessage.draw(m_message, fadeValue);
-
- if (haveToFadeIn || haveToFadeOut) glColor3f(1.0f, 1.0f, 1.0f);
+ if (time == 0.0) return;
+ bool haveToFadeIn = time <= (m_timeToFadeIn); // Is this fade in?
+ bool haveToFadeOut = time >= (m_messagePopup.getTarget() - m_timeToFadeOut); // Is this fade out?
+ float fadeValue = 1.0f;
+
+ if (haveToFadeIn) { // Fade in
+ fadeValue = float(time / m_timeToFadeIn); // Calculate animation value
+ } else if (haveToFadeOut) { // Fade out
+ fadeValue = float((m_messagePopup.getTarget() - time) / m_timeToFadeOut); // Calculate animation value
+ if (time >= m_messagePopup.getTarget()) m_messagePopup.setTarget(0.0, true); // Reset if fade out finished
}
+
+ m_textMessage.draw(m_message, fadeValue); // Draw the message
+ if (haveToFadeIn || haveToFadeOut) glColor3f(1.0f, 1.0f, 1.0f); // Reset alpha
}
-void ScreenManager::FlashMessage(std::string const& message) {
- m_messagePopup.setTarget(m_timeToShow);
- m_messagePopup.setValue(0);
+void ScreenManager::flashMessage(std::string const& message, float fadeIn, float hold, float fadeOut) {
m_message = message;
+ m_timeToFadeIn = fadeIn;
+ m_timeToShow = hold;
+ m_timeToFadeOut = fadeOut;
+ m_messagePopup.setTarget(fadeIn + hold + fadeOut);
+ m_messagePopup.setValue(0.0);
}
|
|
From: Laurent C. <lor...@us...> - 2010-01-19 16:41:10
|
Module: performous
Branch: master
Commit: 27909534fc273c125fe7b8fd370ab1cef5e8ffa6
Author: Laurent Carlier <lor...@us...>
Date: Tue Jan 19 17:37:44 2010 +0100
- Rename DANCEPAD_GENERIC2 to DANCEPAD_EMS2
- Add autodetect for EMS2 adaptater
---
game/joystick.cc | 15 +++++++++------
game/joystick.hh | 4 ++--
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index e76db23..e2ebc77 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -70,7 +70,7 @@ int input::buttonFromSDL(input::detail::Type _type, unsigned int _sdl_button) {
case DRUMS_MIDI: throw std::logic_error("MIDI drums do not use SDL buttons");
case DANCEPAD_GENERIC: return inputmap[7][_sdl_button];
case DANCEPAD_TIGERGAME: return inputmap[8][_sdl_button];
- case DANCEPAD_GENERIC2: return inputmap[9][_sdl_button];
+ case DANCEPAD_EMS2: return inputmap[9][_sdl_button];
}
throw std::logic_error("Unknown instrument type in buttonFromSDL");
}
@@ -187,7 +187,7 @@ void input::SDL::init() {
using namespace boost::spirit::classic;
rule<> type = str_p("GUITAR_GUITARHERO_XPLORER") | "GUITAR_ROCKBAND_PS3" | "GUITAR_ROCKBAND_XB360"
| "GUITAR_GUITARHERO" | "DRUMS_GUITARHERO" | "DRUMS_ROCKBAND_PS3" | "DRUMS_ROCKBAND_XB360"
- | "DRUMS_MIDI" | "DANCEPAD_GENERIC2" | "DANCEPAD_GENERIC" | "DANCEPAD_TIGERGAME";
+ | "DRUMS_MIDI" | "DANCEPAD_EMS2" | "DANCEPAD_GENERIC" | "DANCEPAD_TIGERGAME";
rule<> entry = uint_p[assign_a(sdl_id)] >> ":" >> (type)[assign_a(instrument_type)];
ConfigItem::StringList const& instruments = config["game/instruments"].sl();
@@ -216,8 +216,8 @@ void input::SDL::init() {
forced_type[sdl_id] = input::detail::DANCEPAD_GENERIC;
} else if (instrument_type == "DANCEPAD_TIGERGAME") {
forced_type[sdl_id] = input::detail::DANCEPAD_TIGERGAME;
- } else if (instrument_type == "DANCEPAD_GENERIC2") {
- forced_type[sdl_id] = input::detail::DANCEPAD_GENERIC2;
+ } else if (instrument_type == "DANCEPAD_EMS2") {
+ forced_type[sdl_id] = input::detail::DANCEPAD_EMS2;
}
}
}
@@ -270,8 +270,8 @@ void input::SDL::init() {
case input::detail::DANCEPAD_GENERIC:
std::cout << " Detected as: Generic dance pad (forced)" << std::endl;
break;
- case input::detail::DANCEPAD_GENERIC2:
- std::cout << " Detected as: Generic2 dance pad (forced)" << std::endl;
+ case input::detail::DANCEPAD_EMS2:
+ std::cout << " Detected as: EMS2 dance pad controller converter(forced)" << std::endl;
break;
}
input::detail::devices[i] = input::detail::InputDevPrivate(forced_type[i]);
@@ -323,6 +323,9 @@ void input::SDL::init() {
} else if( name.find("Joypad to USB converter") != std::string::npos ) {
std::cout << " Detected as: Generic Dance Pad (guessed)" << std::endl;
input::detail::devices[i] = input::detail::InputDevPrivate(input::detail::DANCEPAD_GENERIC);
+ } else if( name.find("0b43:0003") != std::string::npos ) {
+ std::cout << " Detected as: EMS2 Dance Pad controller converter (guessed)" << std::endl;
+ input::detail::devices[i] = input::detail::InputDevPrivate(input::detail::DANCEPAD_GENERIC);
} else {
std::cout << " Detected as: Unknown (please report the name; use config to force detection)" << std::endl;
SDL_JoystickClose(joy);
diff --git a/game/joystick.hh b/game/joystick.hh
index 827bc34..6d5cc7c 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -33,7 +33,7 @@ namespace input {
namespace detail {
enum Type { GUITAR_RB_PS3, DRUMS_RB_PS3, GUITAR_RB_XB360, DRUMS_RB_XB360,
- GUITAR_GH, GUITAR_GH_XPLORER, DRUMS_GH, DRUMS_MIDI, DANCEPAD_TIGERGAME, DANCEPAD_GENERIC, DANCEPAD_GENERIC2 };
+ GUITAR_GH, GUITAR_GH_XPLORER, DRUMS_GH, DRUMS_MIDI, DANCEPAD_TIGERGAME, DANCEPAD_GENERIC, DANCEPAD_EMS2 };
static unsigned int KEYBOARD_ID = UINT_MAX;
static unsigned int KEYBOARD_ID2 = KEYBOARD_ID-1;
static unsigned int KEYBOARD_ID3 = KEYBOARD_ID-2; // Three ids needed for keyboard guitar/drumkit/dancepad
@@ -91,7 +91,7 @@ namespace input {
case DRUMS_RB_XB360:
return _type == DRUMS;
case DANCEPAD_GENERIC:
- case DANCEPAD_GENERIC2:
+ case DANCEPAD_EMS2:
case DANCEPAD_TIGERGAME:
return _type == DANCEPAD;
}
|
|
From: Laurent C. <lor...@us...> - 2010-01-19 16:41:02
|
Module: performous Branch: master Commit: 8e2d670a13fd2ce4a205ac4a8fec055a98e8f754 Author: Laurent Carlier <lor...@us...> Date: Tue Jan 19 17:40:09 2010 +0100 Merge branch 'master' of git.performous.org:/gitroot/performous/performous --- |
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-01-19 13:04:44
|
Module: performous
Branch: master
Commit: fbf6a8b09625d699ef55541ffffe5dd5e828f25f
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Jan 19 14:59:28 2010 +0200
Load menuitems only on load
---
game/screen_intro.cc | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/game/screen_intro.cc b/game/screen_intro.cc
index a49057a..670172f 100755
--- a/game/screen_intro.cc
+++ b/game/screen_intro.cc
@@ -7,15 +7,15 @@
#include "joystick.hh"
ScreenIntro::ScreenIntro(std::string const& name, Audio& audio, Capture& capture): Screen(name), m_audio(audio), m_capture(capture), selected(), m_first(true) {
- m_menuOptions.push_back(new MenuOption(_("Perform"), "Songs", "intro_sing.svg", _("Start performing!")));
- m_menuOptions.push_back(new MenuOption(_("Practice"), "Practice", "intro_practice.svg", _("Check your skills or test the microphones")));
- m_menuOptions.push_back(new MenuOption(_("Configure"), "Configuration", "intro_configure.svg", _("Configure game options")));
- m_menuOptions.push_back(new MenuOption(_("Quit"), "", "intro_quit.svg", _("Leave the game")));
}
void ScreenIntro::enter() {
m_audio.playMusic(getThemePath("menu.ogg"), true);
theme.reset(new ThemeIntro());
+ m_menuOptions.push_back(new MenuOption(_("Perform"), "Songs", "intro_sing.svg", _("Start performing!")));
+ m_menuOptions.push_back(new MenuOption(_("Practice"), "Practice", "intro_practice.svg", _("Check your skills or test the microphones")));
+ m_menuOptions.push_back(new MenuOption(_("Configure"), "Configuration", "intro_configure.svg", _("Configure game options")));
+ m_menuOptions.push_back(new MenuOption(_("Quit"), "", "intro_quit.svg", _("Leave the game")));
if( m_first ) {
std::string msg;
if (!m_audio.isOpen()) msg = _("No playback devices could be used.\n");
@@ -28,6 +28,7 @@ void ScreenIntro::enter() {
}
void ScreenIntro::exit() {
+ m_menuOptions.clear();
theme.reset();
m_dialog.reset();
}
|
|
From: Laurent C. <lor...@us...> - 2010-01-19 12:16:38
|
Module: performous
Branch: master
Commit: ff3bdbe1ce311d51323cec72430b9126e56761ae
Author: Laurent Carlier <lor...@us...>
Date: Tue Jan 19 13:13:28 2010 +0100
- Changed max sdl buttons support to 16
- Add support for EMS/PS2 adaptater, can be forced with DANCEPAD_GENERIC2
---
game/joystick.cc | 31 +++++++++++++++++++------------
game/joystick.hh | 3 ++-
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/game/joystick.cc b/game/joystick.cc
index 588ac4c..e76db23 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -39,22 +39,23 @@ void input::MidiDrums::process() {
}
#endif
-static const unsigned SDL_BUTTONS = 12;
+static const unsigned SDL_BUTTONS = 16;
int input::buttonFromSDL(input::detail::Type _type, unsigned int _sdl_button) {
- static const int inputmap[9][SDL_BUTTONS] = {
+ static const int inputmap[10][SDL_BUTTONS] = {
//G R Y B O S // for guitars (S=starpower)
- { 2, 0, 1, 3, 4, 5, -1, -1, 8, 9, -1, -1 }, // Guitar Hero guitar
- { 0, 1, 3, 2, 4,-1, 8, 9, -1, -1, -1, -1 }, // Guitar Hero X-plorer guitar
- { 3, 0, 1, 2, 4, 5, -1, -1, 8, 9, -1, -1 }, // Rock Band guitar PS3
- { 0, 1, 3, 2, 4,-1, 8, 9, -1, -1, -1, -1 }, // Rock Band guitar XBOX360
+ { 2, 0, 1, 3, 4, 5, -1, -1, 8, 9, -1, -1, -1, -1, -1, -1 }, // Guitar Hero guitar
+ { 0, 1, 3, 2, 4,-1, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1 }, // Guitar Hero X-plorer guitar
+ { 3, 0, 1, 2, 4, 5, -1, -1, 8, 9, -1, -1, -1, -1, -1, -1 }, // Rock Band guitar PS3
+ { 0, 1, 3, 2, 4,-1, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1 }, // Rock Band guitar XBOX360
//K R Y B G O // for drums
- { 3, 4, 1, 2, 0, 4, -1, -1, 8, 9, -1, -1 }, // Guitar Hero drums
- { 3, 4, 1, 2, 0,-1, -1, -1, 8, 9, -1, -1 }, // Rock Band drums PS3
- { 4, 1, 3, 2, 0,-1, 8, 9, -1, -1, -1, -1 }, // Rock Band drums XBOX360
+ { 3, 4, 1, 2, 0, 4, -1, -1, 8, 9, -1, -1, -1, -1, -1, -1 }, // Guitar Hero drums
+ { 3, 4, 1, 2, 0,-1, -1, -1, 8, 9, -1, -1, -1, -1, -1, -1 }, // Rock Band drums PS3
+ { 4, 1, 3, 2, 0,-1, 8, 9, -1, -1, -1, -1, -1, -1, -1, -1 }, // Rock Band drums XBOX360
// Left Down Up Right DownL DownR UpL UpR Start Select
- { 0, 1, 2, 3, 6, 7, 4, 5, 9, 8, -1, -1 }, // generic dance pad
- { 9, 8, -1, -1, -1, -1, -1, -1, 0, 3, 1, 2 } // TigerGame dance pad
+ { 0, 1, 2, 3, 6, 7, 4, 5, 9, 8, -1, -1, -1, -1, -1, -1 }, // generic dance pad
+ { 9, 8, -1, -1, -1, -1, -1, -1, 0, 3, 1, 2, -1, -1, -1, -1 }, // TigerGame dance pad
+ { 4, 7, 6, 5, -1, -1, -1, -1, 9, 8, -1, -1, 2, 3, 1, 0 } // generic2 dance pad; with ems ps2/pc adaptater
};
if( _sdl_button >= SDL_BUTTONS ) return -1;
using namespace detail;
@@ -69,6 +70,7 @@ int input::buttonFromSDL(input::detail::Type _type, unsigned int _sdl_button) {
case DRUMS_MIDI: throw std::logic_error("MIDI drums do not use SDL buttons");
case DANCEPAD_GENERIC: return inputmap[7][_sdl_button];
case DANCEPAD_TIGERGAME: return inputmap[8][_sdl_button];
+ case DANCEPAD_GENERIC2: return inputmap[9][_sdl_button];
}
throw std::logic_error("Unknown instrument type in buttonFromSDL");
}
@@ -185,7 +187,7 @@ void input::SDL::init() {
using namespace boost::spirit::classic;
rule<> type = str_p("GUITAR_GUITARHERO_XPLORER") | "GUITAR_ROCKBAND_PS3" | "GUITAR_ROCKBAND_XB360"
| "GUITAR_GUITARHERO" | "DRUMS_GUITARHERO" | "DRUMS_ROCKBAND_PS3" | "DRUMS_ROCKBAND_XB360"
- | "DRUMS_MIDI" | "DANCEPAD_GENERIC" | "DANCEPAD_TIGERGAME";
+ | "DRUMS_MIDI" | "DANCEPAD_GENERIC2" | "DANCEPAD_GENERIC" | "DANCEPAD_TIGERGAME";
rule<> entry = uint_p[assign_a(sdl_id)] >> ":" >> (type)[assign_a(instrument_type)];
ConfigItem::StringList const& instruments = config["game/instruments"].sl();
@@ -214,6 +216,8 @@ void input::SDL::init() {
forced_type[sdl_id] = input::detail::DANCEPAD_GENERIC;
} else if (instrument_type == "DANCEPAD_TIGERGAME") {
forced_type[sdl_id] = input::detail::DANCEPAD_TIGERGAME;
+ } else if (instrument_type == "DANCEPAD_GENERIC2") {
+ forced_type[sdl_id] = input::detail::DANCEPAD_GENERIC2;
}
}
}
@@ -266,6 +270,9 @@ void input::SDL::init() {
case input::detail::DANCEPAD_GENERIC:
std::cout << " Detected as: Generic dance pad (forced)" << std::endl;
break;
+ case input::detail::DANCEPAD_GENERIC2:
+ std::cout << " Detected as: Generic2 dance pad (forced)" << std::endl;
+ break;
}
input::detail::devices[i] = input::detail::InputDevPrivate(forced_type[i]);
} else if( name.find("Guitar Hero3") != std::string::npos ) {
diff --git a/game/joystick.hh b/game/joystick.hh
index 45adb38..827bc34 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -33,7 +33,7 @@ namespace input {
namespace detail {
enum Type { GUITAR_RB_PS3, DRUMS_RB_PS3, GUITAR_RB_XB360, DRUMS_RB_XB360,
- GUITAR_GH, GUITAR_GH_XPLORER, DRUMS_GH, DRUMS_MIDI, DANCEPAD_TIGERGAME, DANCEPAD_GENERIC };
+ GUITAR_GH, GUITAR_GH_XPLORER, DRUMS_GH, DRUMS_MIDI, DANCEPAD_TIGERGAME, DANCEPAD_GENERIC, DANCEPAD_GENERIC2 };
static unsigned int KEYBOARD_ID = UINT_MAX;
static unsigned int KEYBOARD_ID2 = KEYBOARD_ID-1;
static unsigned int KEYBOARD_ID3 = KEYBOARD_ID-2; // Three ids needed for keyboard guitar/drumkit/dancepad
@@ -91,6 +91,7 @@ namespace input {
case DRUMS_RB_XB360:
return _type == DRUMS;
case DANCEPAD_GENERIC:
+ case DANCEPAD_GENERIC2:
case DANCEPAD_TIGERGAME:
return _type == DANCEPAD;
}
|
|
From: Yoda-JM <yo...@us...> - 2010-01-19 09:50:19
|
Module: performous
Branch: master
Commit: d970cce1c0bbc0e125a724e733a042854415e0a5
Author: Vincent Le Ligeour <yo...@us...>
Date: Tue Jan 19 10:49:53 2010 +0100
Fixed compilation without PortMidi
---
game/joystick.hh | 7 +++++++
game/main.cc | 2 ++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/game/joystick.hh b/game/joystick.hh
index 5d43daf..45adb38 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -165,6 +165,13 @@ namespace input {
typedef std::map<unsigned, unsigned> Map;
Map map;
};
+#else
+ class MidiDrums {
+ public:
+ MidiDrums() {};
+ void process() {};
+ private:
+ };
#endif
}
diff --git a/game/main.cc b/game/main.cc
index f23bc06..b32ee38 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -359,8 +359,10 @@ int main(int argc, char** argv) try {
std::cout << std::flush;
return 0;
}
+#ifdef USE_PORTMIDI
// Dump a list of MIDI input devices
pm::dumpDevices(true);
+#endif
// Read config files
try {
readConfig();
|
|
From: Lasse Kärkkäi. <tr...@us...> - 2010-01-19 06:36:04
|
Module: performous
Branch: master
Commit: a26eb2f5ed4d2d28c2f75fa6c41b5009f159ddb9
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Jan 19 08:33:09 2010 +0200
Fixed MIDI drums and added autodetection (not tested).
PortMidi wrapper improved and added workarounds for buggy operation of PortMidi.
Program initialization order changed so that graphics is initialized before other parts.
Hacked a "Loading..." indicator and "FATAL ERROR" displayer using flash messages.
Disabled flash message fade-in to make those messages appear, but now the messages don't go away anymore :(
---
data/schema.xml | 12 ++++++------
game/joystick.cc | 14 +++++++++-----
game/joystick.hh | 8 ++++----
game/main.cc | 27 +++++++++++++++++++++++----
game/portmidi.hh | 32 +++++++++++++++++++++++++++++++-
game/screenmanager.cc | 2 +-
6 files changed, 74 insertions(+), 21 deletions(-)
diff --git a/data/schema.xml b/data/schema.xml
index 58cd9c4..8f3e598 100644
--- a/data/schema.xml
+++ b/data/schema.xml
@@ -78,12 +78,6 @@ to save the current settings to XML.
<long>Enable keyboard as dance pad.</long>
</locale>
</entry>
- <entry name="game/midi_drums" type="string">
- <locale name="C">
- <short>MIDI drum mapping</short>
- <long>Mapping of hardware MIDI device: devID:kick,pad1,pad2,pad3,pad4</long>
- </locale>
- </entry>
<entry name="game/instruments" type="string_list">
<!-- Should be SDL_ID:{GUITAR_GUITARHERO|GUITAR_GUITARHERO_XPLORER|GUITAR_ROCKBAND_PS3|GUITAR_ROCKBAND_XB360|DRUMS_GUITARHERO|DRUMS_ROCKBAND_PS3|DRUMS_ROCKBAND_XB360|DRUMS_MIDI|DANCEPAD_GENERIC|DANCEPAD_TIGERGAME}
example:
@@ -223,6 +217,12 @@ to save the current settings to XML.
</entry>
<!-- System preferences -->
+ <entry name="system/midi_input" type="string" value="">
+ <locale name="C">
+ <short>Hardware MIDI input device</short>
+ <long>Part of sound card name or its number or empty to use the first available device. Used currently for MIDI drum controllers. Empty to select the first available device.</long>
+ </locale>
+ </entry>
<entry name="system/path_songs" type="string_list">
<stringvalue>DATADIR/songs/</stringvalue>
<stringvalue>/usr/local/share/games/ultrastar/songs/</stringvalue>
diff --git a/game/joystick.cc b/game/joystick.cc
index 2d17109..588ac4c 100644
--- a/game/joystick.cc
+++ b/game/joystick.cc
@@ -4,28 +4,32 @@
#include <boost/lexical_cast.hpp>
#ifdef USE_PORTMIDI
-input::MidiDrums::MidiDrums(int devId): stream(devId), devnum(0x8000 + devId) {
+input::MidiDrums::MidiDrums(): stream(pm::findDevice(true, config["system/midi_input"].s())), devnum(0x8000) {
+ while (detail::devices.find(devnum) != detail::devices.end()) ++devnum;
detail::devices[devnum] = detail::InputDevPrivate(detail::DRUMS_MIDI);
event.type = Event::PRESS;
for (unsigned int i = 0; i < BUTTONS; ++i) event.pressed[i] = false;
map[35] = map[36] = 0; // Bass drum 1/2
map[38] = map[40] = 1; // Snare 1/2
map[42] = map[46] = 2; // Hi-hat closed/open
+ map[52] = map[57] = 2; // Crash2 1/2
map[41] = map[43] = 3; // Tom low 1/2
map[45] = map[47] = 3; // Tom mid 1/2
map[48] = map[50] = 3; // Tom high 1/2
map[49] = map[51] = 4; // Cymbal crash/ride
}
+#include <iomanip>
+
void input::MidiDrums::process() {
PmEvent ev;
while (Pm_Read(stream, &ev, 1) == 1) {
- if ((ev.message & 0xFF) != 0x99) continue;
- unsigned char ch = ev.message >> 8;
+ if ((ev.message & 0xFF) != 0x99) continue; // 0x99 = channel 10 (percussion) note ON
+ unsigned char note = ev.message >> 8;
//unsigned char vel = ev.message >> 16;
- Map::const_iterator it = map.find(ch);
+ Map::const_iterator it = map.find(note);
if (it == map.end()) {
- std::cout << "Unassigned MIDI drum event: channel " << ch << std::endl;
+ std::cout << "Unassigned MIDI drum event: note " << note << std::endl;
continue;
}
event.button = it->second;
diff --git a/game/joystick.hh b/game/joystick.hh
index e28bf97..5d43daf 100644
--- a/game/joystick.hh
+++ b/game/joystick.hh
@@ -155,10 +155,10 @@ namespace input {
#ifdef USE_PORTMIDI
class MidiDrums {
- public:
- MidiDrums(int devId);
+ public:
+ MidiDrums();
void process();
- private:
+ private:
pm::Input stream;
unsigned int devnum;
Event event;
@@ -167,5 +167,5 @@ namespace input {
};
#endif
-};
+}
diff --git a/game/main.cc b/game/main.cc
index 4843252..f23bc06 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -135,15 +135,22 @@ void audioSetup(Capture& capture, Audio& audio) {
}
void mainLoop(std::string const& songlist) {
+ Window window(config["graphic/window_width"].i(), config["graphic/window_height"].i(), config["graphic/fullscreen"].b());
+ ScreenManager sm;
try {
+ sm.FlashMessage(_("Loading..."));
+ window.blank();
+ sm.FlashMessages();
+ window.swap();
Capture capture;
Audio audio;
audioSetup(capture, audio);
Backgrounds backgrounds;
Database database(getConfigDir() / "database.xml");
Songs songs(database, songlist);
- ScreenManager sm;
- Window window(config["graphic/window_width"].i(), config["graphic/window_height"].i(), config["graphic/fullscreen"].b());
+ boost::scoped_ptr<input::MidiDrums> midiDrums;
+ // TODO: Proper error handling...
+ try { midiDrums.reset(new input::MidiDrums); } catch (std::runtime_error&) {}
sm.addScreen(new ScreenIntro("Intro", audio, capture));
sm.addScreen(new ScreenSongs("Songs", audio, songs, database));
sm.addScreen(new ScreenSing("Sing", audio, capture, database, backgrounds));
@@ -155,6 +162,7 @@ void mainLoop(std::string const& songlist) {
// Main loop
boost::xtime time = now();
unsigned frames = 0;
+ sm.FlashMessage("");
while (!sm.isFinished()) {
if( g_take_screenshot ) {
fs::path filename;
@@ -188,13 +196,20 @@ void mainLoop(std::string const& songlist) {
frames = 0;
}
// Process events for the next frame
+ if (midiDrums) midiDrums->process();
checkEvents_SDL(sm, window);
} catch (std::runtime_error& e) {
std::cerr << "ERROR: " << e.what() << std::endl;
+ sm.FlashMessage(std::string("ERROR: ") + e.what());
}
}
} catch (std::exception& e) {
- std::cout << "FATAL ERROR: " << e.what() << std::endl;
+ std::cerr << "FATAL ERROR: " << e.what() << std::endl;
+ sm.FlashMessage(std::string("FATAL ERROR: ") + e.what());
+ window.blank();
+ sm.FlashMessages();
+ window.swap();
+ boost::thread::sleep(now() + 2.0);
} catch (QuitNow&) {
std::cout << "Terminated." << std::endl;
}
@@ -246,7 +261,7 @@ template <typename Container> void confOverride(Container const& c, std::string
std::copy(c.begin(), c.end(), std::back_inserter(sl));
}
-int main(int argc, char** argv) {
+int main(int argc, char** argv) try {
#ifdef USE_GETTEXT
// initialize gettext
#ifdef _MSC_VER
@@ -344,6 +359,8 @@ int main(int argc, char** argv) {
std::cout << std::flush;
return 0;
}
+ // Dump a list of MIDI input devices
+ pm::dumpDevices(true);
// Read config files
try {
readConfig();
@@ -365,5 +382,7 @@ int main(int argc, char** argv) {
// Run the game init and main loop
mainLoop(songlist);
return 0; // Do not remove. SDL_Main (which this function is called on some platforms) needs return statement.
+} catch (std::exception& e) {
+ std::cerr << "FATAL ERROR: " << e.what() << std::endl;
}
diff --git a/game/portmidi.hh b/game/portmidi.hh
index 848c0f2..8e8b1d7 100644
--- a/game/portmidi.hh
+++ b/game/portmidi.hh
@@ -2,6 +2,7 @@
#include <portmidi.h>
#include <stdexcept>
+#include <iostream>
namespace pm {
struct Initialize {
@@ -15,12 +16,41 @@ namespace pm {
protected:
PortMidiStream* m_handle;
Stream(): m_handle() {}
+ void abort() { Pm_Abort(m_handle); m_handle = NULL; }
~Stream() { if (m_handle) Pm_Close(m_handle); }
};
-
+
+ namespace {
+ void dumpDevices(bool input) {
+ std::cout << "MIDI devices:" << std::endl;
+ for (int devId = Pm_CountDevices(); devId--;) {
+ PmDeviceInfo const* info = Pm_GetDeviceInfo(devId);
+ if (info->input != input) continue;
+ if (info->opened) continue;
+ std::cout << " " << info->name << std::endl;
+ }
+ }
+ int findDevice(bool input, std::string const& name = "") {
+ // Loop in reverse order because the last devices are more likely good ones
+ for (int devId = Pm_CountDevices(); devId--;) {
+ PmDeviceInfo const* info = Pm_GetDeviceInfo(devId);
+ if (info->input != input) continue;
+ if (info->opened) continue;
+ if (!name.empty() && std::string(info->name).find(name) == std::string::npos) continue;
+ return devId;
+ }
+ throw std::runtime_error("No matching PortMidi device found");
+ }
+ }
+
class Input: public Stream {
public:
Input(int devId) {
+ // Errors must be handled here because otherwise PortMidi will just exit() the program...
+ if (devId < 0 || devId >= Pm_CountDevices()) throw std::runtime_error("Invalid PortMidi device ID");
+ PmDeviceInfo const* info = Pm_GetDeviceInfo(devId);
+ if (!info->input) throw std::runtime_error("The PortMidi device is an output device (input device needed)");
+ if (info->opened) throw std::runtime_error("The PortMidi device is already open");
PmError err = Pm_OpenInput(&m_handle, devId, 0, 1024, 0, 0);
if (err) throw std::runtime_error("Pm_OpenInput failed");
}
diff --git a/game/screenmanager.cc b/game/screenmanager.cc
index b45f1e9..bfa17d9 100644
--- a/game/screenmanager.cc
+++ b/game/screenmanager.cc
@@ -6,7 +6,7 @@
template<> ScreenManager* Singleton<ScreenManager>::ms_Singleton = NULL;
ScreenManager::ScreenManager(): m_finished(false), currentScreen(), m_messagePopup(0.0, 1.0), m_textMessage(getThemePath("message_text.svg")) {
- m_timeToFade = 1.0f;
+ m_timeToFade = 0.0f;
m_timeToShow = 3.0f;
m_messagePopup.setTarget(100.0);
|