[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src pingus_main.cxx,1.32,1.33 screen_mana
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src pingus_main.cxx,1.32,1.33 screen_manager.cxx,1.24,1.25 sound.cxx,1.6,1.7 sound.hxx,1.8,1.9 sound_real.cxx,1.8,1.9 sound_real.hxx,1.6,1.7 |
Date: |
2 Nov 2002 22:10:54 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv12957
Modified Files:
pingus_main.cxx screen_manager.cxx sound.cxx sound.hxx
sound_real.cxx sound_real.hxx
Log Message:
- fixed sound init stuff a bit
- fixed segfault on quit
Index: pingus_main.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/pingus_main.cxx,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- pingus_main.cxx 2 Nov 2002 21:12:16 -0000 1.32
+++ pingus_main.cxx 2 Nov 2002 22:10:52 -0000 1.33
@@ -78,14 +78,13 @@
#include "editor/editor.hxx"
#include "boost/smart_ptr.hpp"
#include "screen_manager.hxx"
-#include "sound_dummy.hxx"
#include "action_data.hxx"
#include "fonts.hxx"
-#include "sound_real.hxx"
#include "xml_helper.hxx"
#include "input_debug_screen.hxx"
#include "pingus_menu_manager.hxx"
#include "pingus_resource.hxx"
+#include "sound.hxx"
using EditorNS::Editor;
@@ -844,10 +843,6 @@
glEnable (GL_BLEND);
}
#endif
-
- CL_Display::clear_display ();
- CL_Display::flip_display ();
-
}
void
@@ -867,21 +862,7 @@
void
PingusMain::init_pingus()
{
- if (verbose)
- {
- std::cout <<
-
_("-----------------------------------------------------------------\n")
- << std::endl;
- std::cout <<
- _(" Verbosity set to: ") << verbose << "\n"
- << std::endl;
- std::cout <<
- _(" If you don't like to get lots of debug messages, than set the\n"
- " verbosity down to 0, like this:\n\n"
- " $ ./pingus --verbose 0\n"
-
"-----------------------------------------------------------------\n")
- << std::endl;
- }
+ PingusSound::init();
PingusResource::init();
Fonts::init();
@@ -895,21 +876,6 @@
pout.add (console);
perr.add (std::cout);
perr.add (console);
-
- if (sound_enabled || music_enabled)
- {
- if (verbose)
- std::cout << "Init Sound" << std::endl;
-
- PingusSound::init (new PingusSoundReal ());
- }
- else
- {
- if (verbose)
- std::cout << "Sound disabled" << std::endl;
- PingusSound::init (new PingusSoundDummy ());
- }
-
}
void
@@ -918,6 +884,7 @@
XMLhelper::deinit();
Fonts::deinit();
PingusResource::deinit();
+ PingusSound::deinit();
}
/* EOF */
Index: screen_manager.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/screen_manager.cxx,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- screen_manager.cxx 26 Oct 2002 17:31:42 -0000 1.24
+++ screen_manager.cxx 2 Nov 2002 22:10:52 -0000 1.25
@@ -85,6 +85,11 @@
real_replace_screen (replace_screen_arg);
cached_action = none;
}
+
+ // FIXME: is there a more gentel way to do that instead of spreading the
checks all around here?
+ // Last screen has poped, so we are going to end here
+ if (screens.empty ())
+ continue;
// skip draw if the screen changed to avoid glitches
if (last_screen == get_current_screen())
@@ -111,6 +116,7 @@
ScreenPtr
ScreenManager::get_current_screen()
{
+ assert(!screens.empty());
return screens.back ();
}
Index: sound.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/sound.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sound.cxx 23 Aug 2002 15:49:50 -0000 1.6
+++ sound.cxx 2 Nov 2002 22:10:52 -0000 1.7
@@ -17,19 +17,46 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#include <iostream>
#include <assert.h>
#include "path_manager.hxx"
#include "sound_dummy.hxx"
+#include "sound_real.hxx"
+#include "globals.hxx"
PingusSound* PingusSound::sound;
void
PingusSound::init (PingusSound* s)
{
- assert (sound == 0);
- sound = s;
+ if (s == 0)
+ {
+ if (sound_enabled || music_enabled)
+ {
+ if (verbose)
+ std::cout << "Init Sound" << std::endl;
+
+ PingusSound::init (new PingusSoundReal ());
+ }
+ else
+ {
+ if (verbose)
+ std::cout << "Sound disabled" << std::endl;
+ PingusSound::init (new PingusSoundDummy ());
+ }
+ }
+ else
+ {
+ sound = s;
+ }
}
+void
+PingusSound::deinit ()
+{
+ delete sound;
+ sound = 0;
+}
/** Load a sound file and play it immediately.
Index: sound.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/sound.hxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- sound.hxx 27 Sep 2002 11:26:44 -0000 1.8
+++ sound.hxx 2 Nov 2002 22:10:52 -0000 1.9
@@ -35,7 +35,8 @@
virtual void real_play_music(const std::string & filename, float volume) =0;
public:
- static void init (PingusSound* s);
+ static void init (PingusSound* s = 0);
+ static void deinit ();
/** Load a sound file and play it immediately.
Index: sound_real.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/sound_real.cxx,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- sound_real.cxx 14 Sep 2002 19:06:33 -0000 1.8
+++ sound_real.cxx 2 Nov 2002 22:10:52 -0000 1.9
@@ -37,8 +37,15 @@
PingusSoundReal::PingusSoundReal ()
: sample (0), music (0)
{
- if (music_enabled || sound_enabled)
- init();
+ pout(PINGUS_DEBUG_SOUND) << "Initializing ClanLib-Sound" << std::endl;
+
+ CL_SetupSound::init();
+
+ pout(PINGUS_DEBUG_SOUND) << "Initializing ClanLib-MikMod" << std::endl;
+
+#ifdef HAVE_LIBCLANMIKMOD
+ CL_SetupMikMod::init();
+#endif
}
PingusSoundReal::~PingusSoundReal()
@@ -53,39 +60,15 @@
for (unsigned int i = 0; i < sound_holder.size(); ++i)
delete sound_holder[i];
- if (is_init) {
-
#ifdef HAVE_LIBCLANMIKMOD
CL_SetupMikMod::deinit();
#endif
-
CL_SetupSound::deinit();
-
- }
-}
-
-
-void
-PingusSoundReal::init()
-{
-
- is_init = true;
-
- pout(PINGUS_DEBUG_SOUND) << "Initializing ClanLib-Sound" << std::endl;
-
- CL_SetupSound::init();
-
- pout(PINGUS_DEBUG_SOUND) << "Initializing ClanLib-MikMod" << std::endl;
-
-#ifdef HAVE_LIBCLANMIKMOD
- CL_SetupMikMod::init();
-#endif
}
void
PingusSoundReal::real_play_sound(const std::string & filename, float volume,
float panning)
{
-
pout(PINGUS_DEBUG_SOUND) << "PingusSoundReal: Playing sound: " << filename
<< "Buffer-Size: " << sound_holder.size() << std::endl;
if (!sound_enabled)
Index: sound_real.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/sound_real.hxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- sound_real.hxx 27 Sep 2002 11:26:44 -0000 1.6
+++ sound_real.hxx 2 Nov 2002 22:10:52 -0000 1.7
@@ -35,23 +35,16 @@
class PingusSoundReal : public PingusSound
{
private:
- ///
- bool is_init;
-
- /// The current music file
+ /** The current music file */
CL_SoundBuffer * sample;
- /// Music Controller Session
+ /** Music Controller Session */
CL_SoundBuffer_Session * music;
- /// Stores all Sound Effects
+ /** Stores all Sound Effects */
std::vector<CL_SoundBuffer_Session *> sound_holder;
- /// Init ClanSound and ClanMikMod
- void init();
-
public:
-
PingusSoundReal ();
virtual ~PingusSoundReal ();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src pingus_main.cxx,1.32,1.33 screen_manager.cxx,1.24,1.25 sound.cxx,1.6,1.7 sound.hxx,1.8,1.9 sound_real.cxx,1.8,1.9 sound_real.hxx,1.6,1.7,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src fonts.cxx,1.1,1.2 fonts.hxx,1.1,1.2 pingus_main.cxx,1.31,1.32 xml_helper.cxx,1.24,1.25 xml_helper.hxx,1.17,1.18
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/actions bomber.cxx,1.22,1.23 faller.cxx,1.31,1.32
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src fonts.cxx,1.1,1.2 fonts.hxx,1.1,1.2 pingus_main.cxx,1.31,1.32 xml_helper.cxx,1.24,1.25 xml_helper.hxx,1.17,1.18
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/actions bomber.cxx,1.22,1.23 faller.cxx,1.31,1.32
- Index(es):