projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
rnd-20020428-3-src
[rocksndiamonds.git]
/
src
/
init.c
diff --git
a/src/init.c
b/src/init.c
index e5a1738b4840f59a4b2cc3c31fac267cd4f40d71..232f37a426733617f104e436b1b5377a2d584bc0 100644
(file)
--- a/
src/init.c
+++ b/
src/init.c
@@
-45,6
+45,7
@@
static void InitPlayerInfo(void);
static void InitLevelInfo(void);
static void InitArtworkInfo(void);
static void InitNetworkServer(void);
static void InitLevelInfo(void);
static void InitArtworkInfo(void);
static void InitNetworkServer(void);
+static void InitSoundServer(void);
static void InitSound(void);
static void InitGfx(void);
static void InitGfxBackground(void);
static void InitSound(void);
static void InitGfx(void);
static void InitGfxBackground(void);
@@
-74,7
+75,7
@@
void OpenAll(void)
InitArtworkInfo(); /* needed before loading gfx, sound & music */
InitCounter();
InitArtworkInfo(); /* needed before loading gfx, sound & music */
InitCounter();
- InitSound();
+ InitSound
Server
();
InitJoysticks();
InitRND(NEW_RANDOMIZE);
InitJoysticks();
InitRND(NEW_RANDOMIZE);
@@
-89,6
+90,7
@@
void OpenAll(void)
InitLevelInfo();
InitGadgets(); /* needs to know number of level series */
InitLevelInfo();
InitGadgets(); /* needs to know number of level series */
+ InitSound(); /* needs to know current level directory */
InitGfxBackground();
InitToons();
InitGfxBackground();
InitToons();
@@
-151,37
+153,59
@@
void InitNetworkServer()
#endif
}
#endif
}
-void InitSound()
+#if 0
+static void ReloadCustomSounds()
{
int i;
{
int i;
- OpenAudio();
+#if 1
+ printf("DEBUG: reloading sounds '%s' ...\n", artwork.sounds_set_current);
+#endif
+
+ LoadSoundsInfo();
for(i=0; i<NUM_SOUNDS; i++)
for(i=0; i<NUM_SOUNDS; i++)
- {
- if (!LoadSound(sound_name[i]))
- {
- audio.sound_available = FALSE;
- audio.loops_available = FALSE;
- audio.sound_enabled = FALSE;
+ LoadSoundToList(sound_name[i], i);
+}
- return;
- }
- }
+static void ReloadCustomMusic()
+{
+#if 1
+ printf("DEBUG: reloading music '%s' ...\n", artwork.music_set_current);
+#endif
- num_bg_loops = LoadMusic();
+ FreeAllMusic();
+
+ LoadCustomMusic();
+}
+#endif
+
+static void InitSoundServer()
+{
+ OpenAudio();
+#if 0
+ SetAudioReloadFunctions(ReloadCustomSounds, ReloadCustomMusic);
+#endif
+ InitSoundList(sound_name, NUM_SOUNDS);
StartSoundserver();
}
StartSoundserver();
}
-void InitTileClipmasks()
+static void InitSound()
+{
+ InitReloadSounds(artwork.snd_current->name);
+ InitReloadMusic(artwork.mus_current->name);
+}
+
+static void InitTileClipmasks()
{
#if defined(TARGET_X11)
{
#if defined(TARGET_X11)
- GC copy_clipmask_gc;
XGCValues clip_gc_values;
unsigned long clip_gc_valuemask;
#if defined(TARGET_X11_NATIVE)
XGCValues clip_gc_values;
unsigned long clip_gc_valuemask;
#if defined(TARGET_X11_NATIVE)
+ GC copy_clipmask_gc;
+
static struct
{
int start;
static struct
{
int start;
@@
-424,14
+448,14
@@
void ReloadCustomArtwork()
if (artwork.sounds_set_current != artwork.snd_current->name)
{
if (artwork.sounds_set_current != artwork.snd_current->name)
{
-
printf("reload sounds ...\n"
);
+
InitReloadSounds(artwork.snd_current->name
);
artwork.sounds_set_current = artwork.snd_current->name;
}
if (artwork.music_set_current != artwork.mus_current->name)
{
artwork.sounds_set_current = artwork.snd_current->name;
}
if (artwork.music_set_current != artwork.mus_current->name)
{
-
printf("reload music ...\n"
);
+
InitReloadMusic(artwork.mus_current->name
);
artwork.music_set_current = artwork.mus_current->name;
}
artwork.music_set_current = artwork.mus_current->name;
}
@@
-1600,8
+1624,9
@@
void CloseAllAndExit(int exit_value)
int i;
StopSounds();
int i;
StopSounds();
- FreeSounds(NUM_SOUNDS);
- CloseAudio();
+ FreeAllSounds();
+ FreeAllMusic();
+ CloseAudio(); /* called after freeing sounds (needed for SDL) */
FreeTileClipmasks();
for(i=0; i<NUM_BITMAPS; i++)
FreeTileClipmasks();
for(i=0; i<NUM_BITMAPS; i++)