[Tux4kids-commits] r1342 - in branches/commonification/tuxtype/trunk: . src

Bolesław Kulbabiński bolekk-guest at alioth.debian.org
Mon Aug 3 17:45:36 UTC 2009


Author: bolekk-guest
Date: 2009-08-03 17:45:36 +0000 (Mon, 03 Aug 2009)
New Revision: 1342

Modified:
   branches/commonification/tuxtype/trunk/
   branches/commonification/tuxtype/trunk/src/audio.c
   branches/commonification/tuxtype/trunk/src/funcs.h
   branches/commonification/tuxtype/trunk/src/globals.h
   branches/commonification/tuxtype/trunk/src/playgame.c
   branches/commonification/tuxtype/trunk/src/titlescreen.c
Log:
audio.c matches its equivalent from t4kcommon


Property changes on: branches/commonification/tuxtype/trunk
___________________________________________________________________
Modified: svn:ignore
   - *~
*.o
Makefile
Makefile.in
autom4te.cache
configure
config.h
config.h.in
config.log
config.status
autoscan.log
t4kcommon
stamp-h1
tuxtype.spec
tuxtype_preview.spec


   + *~
*.o
Makefile
Makefile.in
autom4te.cache
configure
config.h
config.h.in
config.log
config.status
autoscan.log
t4kcommon
stamp-h1
aclocal.m4
tuxtype.spec
tuxtype_preview.spec



Modified: branches/commonification/tuxtype/trunk/src/audio.c
===================================================================
--- branches/commonification/tuxtype/trunk/src/audio.c	2009-08-03 17:14:14 UTC (rev 1341)
+++ branches/commonification/tuxtype/trunk/src/audio.c	2009-08-03 17:45:36 UTC (rev 1342)
@@ -16,6 +16,7 @@
 *                                                                         *
 ***************************************************************************/
 
+#ifndef HAVE_LIBT4KCOMMON
 #include "globals.h"
 #include "funcs.h"
 
@@ -33,7 +34,7 @@
 /* MusicLoad attempts to load and play the music file 
  * Note: loops == -1 means forever
  */
-void MusicLoad(const char* musicFilename, int loops)
+void AudioMusicLoad(const char* musicFilename, int loops)
 {
   Mix_Music* tmp_music = NULL;
 
@@ -44,7 +45,7 @@
 
   if (tmp_music)
   {
-    MusicUnload(); //Unload previous defaultMusic
+    AudioMusicUnload(); //Unload previous defaultMusic
     defaultMusic = tmp_music;
     Mix_PlayMusic(defaultMusic, loops);
   }
@@ -54,7 +55,7 @@
 /* MusicUnload attempts to unload any music data that was
  * loaded using the audioMusicLoad function
  */
-void MusicUnload(void)
+void AudioMusicUnload(void)
 {
   if (!settings.sys_sound) return;
 
@@ -65,7 +66,12 @@
   }
 }
 
+bool IsPlayingMusic()
+{
+    return (defaultMusic != NULL);
+}
 
+
 /* audioMusicPlay attempts to play the passed music data. 
  * if a music file was loaded using the audioMusicLoad
  * it will be stopped and unloaded
@@ -77,6 +83,7 @@
   if (!musicData) return;
 
   /* Stop previous music before playing new one: */
-  MusicUnload();	
+  AudioMusicUnload();	
   Mix_PlayMusic(musicData, loops);
 }
+#endif //HAVE_LIBT4KCOMMON

Modified: branches/commonification/tuxtype/trunk/src/funcs.h
===================================================================
--- branches/commonification/tuxtype/trunk/src/funcs.h	2009-08-03 17:14:14 UTC (rev 1341)
+++ branches/commonification/tuxtype/trunk/src/funcs.h	2009-08-03 17:45:36 UTC (rev 1342)
@@ -24,6 +24,7 @@
 /* NOTE - there is no reason to declare functions using "extern", as all */
 /* non-local functions are visible throughout the program.               */ 
 
+#include "globals.h"
 #include "SDL_extras.h"
 
 /* (still in alphabet.c:) */
@@ -52,12 +53,15 @@
 wchar_t GetLastKey(void);
 
 
+#ifndef HAVE_LIBT4KCOMMON
 /* In audio.c:   */
 void PlaySound(Mix_Chunk* snd);
-void MusicLoad(const char* musicFilename, int repeatQty);
-void MusicUnload(void);
+void AudioMusicLoad(const char* musicFilename, int repeatQty);
+void AudioMusicUnload(void);
 void MusicPlay(Mix_Music* musicData, int repeatQty);
+bool IsPlayingMusic();
 
+#endif //HAVE_LIBT4KCOMMON
 
 /* In laser.c:        */
 int PlayLaserGame(int diff_level);

Modified: branches/commonification/tuxtype/trunk/src/globals.h
===================================================================
--- branches/commonification/tuxtype/trunk/src/globals.h	2009-08-03 17:14:14 UTC (rev 1341)
+++ branches/commonification/tuxtype/trunk/src/globals.h	2009-08-03 17:45:36 UTC (rev 1342)
@@ -20,6 +20,10 @@
 
 #include "config.h"
 
+#ifdef HAVE_LIBT4KCOMMON
+//#include <t4kcommon/tux4kids-common.h>
+#endif
+
 // Translation stuff: 
 #include "gettext.h"
 #include <locale.h>
@@ -28,8 +32,8 @@
 #define _(String) gettext (String)
 #define gettext_noop(String) String
 #define N_(String) gettext_noop (String)
+typedef enum { false, true } bool;
 
-
 /* FIXME don't think this is needed (done elsewhere) */
 #ifdef WIN32 
 #undef DATA_PREFIX

Modified: branches/commonification/tuxtype/trunk/src/playgame.c
===================================================================
--- branches/commonification/tuxtype/trunk/src/playgame.c	2009-08-03 17:14:14 UTC (rev 1341)
+++ branches/commonification/tuxtype/trunk/src/playgame.c	2009-08-03 17:45:36 UTC (rev 1342)
@@ -213,7 +213,7 @@
       if (settings.sys_sound)
       {
         sprintf(filename, "kmus%i.wav", curlevel + 1);
-        MusicLoad( filename, -1 );
+        AudioMusicLoad( filename, -1 );
       }
 
       setup_new_level = 0;

Modified: branches/commonification/tuxtype/trunk/src/titlescreen.c
===================================================================
--- branches/commonification/tuxtype/trunk/src/titlescreen.c	2009-08-03 17:14:14 UTC (rev 1341)
+++ branches/commonification/tuxtype/trunk/src/titlescreen.c	2009-08-03 17:45:36 UTC (rev 1342)
@@ -237,7 +237,7 @@
 
   /* Start playing menu music if desired: */
   if (settings.menu_music)
-    MusicLoad( "tuxi.ogg", -1 );
+    AudioMusicLoad( "tuxi.ogg", -1 );
 
   LOG( "Tux and Title are in place now\n" );
 
@@ -307,13 +307,13 @@
           {
             if (settings.menu_music)
             {
-              MusicUnload();
+              AudioMusicUnload();
               settings.menu_music = 0;
             }
             else
             {
               settings.menu_music = 1;
-              MusicLoad("tuxi.ogg", -1);
+              AudioMusicLoad("tuxi.ogg", -1);
             }
             redraw = 1;
           }
@@ -363,13 +363,13 @@
             {
               if (settings.menu_music)
               {
-                MusicUnload( );
+                AudioMusicUnload( );
                 settings.menu_music = 0;
               }
               else
               {
                 settings.menu_music = 1;
-                MusicLoad("tuxi.ogg", -1);
+                AudioMusicLoad("tuxi.ogg", -1);
               }
               redraw = 1;
               break;
@@ -505,7 +505,7 @@
       unload_media();
 
       if (settings.menu_music)
-        MusicUnload( );
+        AudioMusicUnload( );
 
       TestLesson();
 
@@ -514,7 +514,7 @@
       redraw = 1;
 
       if (settings.menu_music)
-        MusicLoad( "tuxi.ogg", -1 );
+        AudioMusicLoad( "tuxi.ogg", -1 );
     }
 
 
@@ -528,7 +528,7 @@
       redraw = 1;
 
       if (settings.menu_music)
-        MusicLoad( "tuxi.ogg", -1 );
+        AudioMusicLoad( "tuxi.ogg", -1 );
     }
 
 
@@ -548,7 +548,7 @@
       load_media();
 
       if (settings.menu_music)
-        MusicLoad("tuxi.ogg", -1);
+        AudioMusicLoad("tuxi.ogg", -1);
 
       redraw = 1;
     }
@@ -568,7 +568,7 @@
 
 
         if (settings.menu_music)
-          MusicLoad( "tuxi.ogg", -1 );
+          AudioMusicLoad( "tuxi.ogg", -1 );
       }
 
       load_media();
@@ -591,7 +591,7 @@
 
 
         if (settings.menu_music)
-          MusicLoad( "tuxi.ogg", -1 );
+          AudioMusicLoad( "tuxi.ogg", -1 );
       }
 
       load_media();
@@ -613,7 +613,7 @@
         }
 
         if (settings.menu_music)
-          MusicLoad( "tuxi.ogg", -1 );
+          AudioMusicLoad( "tuxi.ogg", -1 );
       }
 
       load_media();
@@ -636,7 +636,7 @@
 //      load_media();
 
 //      if (settings.menu_music)
-//        MusicLoad( "tuxi.ogg", -1 );
+//        AudioMusicLoad( "tuxi.ogg", -1 );
 
       redraw = 1;
     }
@@ -654,7 +654,7 @@
       load_media();
 
       if (settings.menu_music)
-        MusicLoad( "tuxi.ogg", -1 );
+        AudioMusicLoad( "tuxi.ogg", -1 );
 
       redraw = 1;
     }




More information about the Tux4kids-commits mailing list