projects
/
rocksndiamonds.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c9a9a77
)
rnd-20020428-3-src
author
Holger Schemel
<info@artsoft.org>
Sun, 28 Apr 2002 21:51:32 +0000
(23:51 +0200)
committer
Holger Schemel
<info@artsoft.org>
Sat, 30 Aug 2014 08:37:13 +0000
(10:37 +0200)
src/init.c
patch
|
blob
|
history
src/libgame/setup.c
patch
|
blob
|
history
src/libgame/setup.h
patch
|
blob
|
history
src/libgame/sound.c
patch
|
blob
|
history
src/libgame/sound.h
patch
|
blob
|
history
src/libgame/system.c
patch
|
blob
|
history
src/libgame/system.h
patch
|
blob
|
history
src/main.c
patch
|
blob
|
history
src/main.h
patch
|
blob
|
history
src/timestamp.h
patch
|
blob
|
history
diff --git
a/src/init.c
b/src/init.c
index ef6586f701c4f6465f59766db271a4c1a7fb0555..232f37a426733617f104e436b1b5377a2d584bc0 100644
(file)
--- a/
src/init.c
+++ b/
src/init.c
@@
-153,6
+153,7
@@
void InitNetworkServer()
#endif
}
#endif
}
+#if 0
static void ReloadCustomSounds()
{
int i;
static void ReloadCustomSounds()
{
int i;
@@
-161,9
+162,8
@@
static void ReloadCustomSounds()
printf("DEBUG: reloading sounds '%s' ...\n", artwork.sounds_set_current);
#endif
printf("DEBUG: reloading sounds '%s' ...\n", artwork.sounds_set_current);
#endif
-
FreeAllSounds
();
+
LoadSoundsInfo
();
- InitSoundList(NUM_SOUNDS);
for(i=0; i<NUM_SOUNDS; i++)
LoadSoundToList(sound_name[i], i);
}
for(i=0; i<NUM_SOUNDS; i++)
LoadSoundToList(sound_name[i], i);
}
@@
-178,11
+178,15
@@
static void ReloadCustomMusic()
LoadCustomMusic();
}
LoadCustomMusic();
}
+#endif
static void InitSoundServer()
{
OpenAudio();
static void InitSoundServer()
{
OpenAudio();
+#if 0
SetAudioReloadFunctions(ReloadCustomSounds, ReloadCustomMusic);
SetAudioReloadFunctions(ReloadCustomSounds, ReloadCustomMusic);
+#endif
+ InitSoundList(sound_name, NUM_SOUNDS);
StartSoundserver();
}
StartSoundserver();
}
diff --git
a/src/libgame/setup.c
b/src/libgame/setup.c
index f7d30d6431a9d28f66fe6954feddcb4b44d28577..122f1dfe2a8415bdbacc9784e2e9bb4d3d658428 100644
(file)
--- a/
src/libgame/setup.c
+++ b/
src/libgame/setup.c
@@
-1814,6
+1814,25
@@
void LoadArtworkInfo()
#endif
}
#endif
}
+void LoadSoundsInfo()
+{
+#if 0
+ char *filename = getCustomSoundFilename(SOUNDSINFO_FILENAME);
+ struct SetupFileList *setup_file_list = loadSetupFileList(filename);
+
+ if (setup_file_list)
+ {
+#if 0
+ for (i=0; i<NUM_LEVELINFO_TOKENS; i++)
+ setSetupInfo(levelinfo_tokens, i,
+ getTokenValue(setup_file_list, levelinfo_tokens[i].text));
+#endif
+
+ freeSetupFileList(setup_file_list);
+ }
+#endif
+}
+
static void SaveUserLevelInfo()
{
char *filename;
static void SaveUserLevelInfo()
{
char *filename;
diff --git
a/src/libgame/setup.h
b/src/libgame/setup.h
index 4a9fa66be6e441db48c4db259e3f5a1e5a9b1cd5..a1813a4c308df05245635d0c651460f98bce138d 100644
(file)
--- a/
src/libgame/setup.h
+++ b/
src/libgame/setup.h
@@
-187,6
+187,7
@@
char *getSetupLine(struct TokenInfo *, char *, int);
void LoadLevelInfo(void);
void LoadArtworkInfo(void);
void LoadLevelInfo(void);
void LoadArtworkInfo(void);
+void LoadSoundsInfo(void);
void LoadLevelSetup_LastSeries(void);
void SaveLevelSetup_LastSeries(void);
void LoadLevelSetup_SeriesInfo(void);
void LoadLevelSetup_LastSeries(void);
void SaveLevelSetup_LastSeries(void);
void LoadLevelSetup_SeriesInfo(void);
diff --git
a/src/libgame/sound.c
b/src/libgame/sound.c
index 0e90a582ea86c9229d8f34629d3be45bf0caba6a..61644cda859874bddb68ce813da558ddb0174aa6 100644
(file)
--- a/
src/libgame/sound.c
+++ b/
src/libgame/sound.c
@@
-27,6
+27,7
@@
static SoundInfo **Sound = NULL;
static MusicInfo **Music = NULL;
static int num_sounds = 0, num_music = 0;
static SoundInfo **Sound = NULL;
static MusicInfo **Music = NULL;
static int num_sounds = 0, num_music = 0;
+static char **sound_name;
/* ========================================================================= */
/* ========================================================================= */
@@
-70,6
+71,10
@@
static void SoundServer_StopSound(struct SoundControl);
static void SoundServer_StopAllSounds();
#endif
static void SoundServer_StopAllSounds();
#endif
+static void ReloadCustomSounds();
+static void ReloadCustomMusic();
+static void FreeSound(SoundInfo *);
+
#if defined(PLATFORM_UNIX)
static int OpenAudioDevice(char *audio_device_name)
{
#if defined(PLATFORM_UNIX)
static int OpenAudioDevice(char *audio_device_name)
{
@@
-277,12
+282,18
@@
void SoundServer(void)
if (snd_ctrl.reload_sounds)
{
artwork.sounds_set_current = set_name;
if (snd_ctrl.reload_sounds)
{
artwork.sounds_set_current = set_name;
+ ReloadCustomSounds();
+#if 0
audio.func_reload_sounds();
audio.func_reload_sounds();
+#endif
}
else
{
artwork.music_set_current = set_name;
}
else
{
artwork.music_set_current = set_name;
+ ReloadCustomMusic();
+#if 0
audio.func_reload_music();
audio.func_reload_music();
+#endif
}
free(set_name);
}
free(set_name);
@@
-1100,6
+1111,10
@@
static SoundInfo *Load_WAV(char *filename)
if (!audio.sound_available)
return NULL;
if (!audio.sound_available)
return NULL;
+#if 1
+ printf("loading WAV file '%s'\n", filename);
+#endif
+
snd_info = checked_calloc(sizeof(SoundInfo));
#if defined(TARGET_SDL)
snd_info = checked_calloc(sizeof(SoundInfo));
#if defined(TARGET_SDL)
@@
-1203,22
+1218,37
@@
static SoundInfo *Load_WAV(char *filename)
return snd_info;
}
return snd_info;
}
-
SoundInfo *LoadCustomSound(
char *basename)
+
static void LoadCustomSound(SoundInfo **snd_info,
char *basename)
{
char *filename = getCustomSoundFilename(basename);
{
char *filename = getCustomSoundFilename(basename);
- if (filename == NULL)
+ if (filename == NULL)
/* (should never happen) */
{
Error(ERR_WARN, "cannot find sound file '%s'", basename);
{
Error(ERR_WARN, "cannot find sound file '%s'", basename);
- return
FALSE
;
+ return;
}
}
- return Load_WAV(filename);
+ if (*snd_info && strcmp(filename, (*snd_info)->source_filename) == 0)
+ {
+ /* The old and new sound are the same (have the same filename and path).
+ This usually means that this sound does not exist in this sound set
+ and a fallback to the existing sound is done. */
+
+ return;
+ }
+
+ if (*snd_info)
+ FreeSound(*snd_info);
+
+ *snd_info = Load_WAV(filename);
}
}
-void InitSoundList(int num_list_entries)
+void InitSoundList(
char *sound_name_list[],
int num_list_entries)
{
{
- Sound = checked_calloc(num_list_entries * sizeof(SoundInfo *));
+ if (Sound == NULL)
+ Sound = checked_calloc(num_list_entries * sizeof(SoundInfo *));
+
+ sound_name = sound_name_list;
num_sounds = num_list_entries;
}
num_sounds = num_list_entries;
}
@@
-1227,10
+1257,7
@@
void LoadSoundToList(char *basename, int list_pos)
if (Sound == NULL || list_pos >= num_sounds)
return;
if (Sound == NULL || list_pos >= num_sounds)
return;
- if (Sound[list_pos])
- FreeSound(Sound[list_pos]);
-
- Sound[list_pos] = LoadCustomSound(basename);
+ LoadCustomSound(&Sound[list_pos], basename);
}
static MusicInfo *Load_MOD(char *filename)
}
static MusicInfo *Load_MOD(char *filename)
@@
-1507,6
+1534,31
@@
void StopSoundExt(int nr, int method)
#endif
}
#endif
}
+static void ReloadCustomSounds()
+{
+ int i;
+
+#if 1
+ printf("DEBUG: reloading sounds '%s' ...\n", artwork.sounds_set_current);
+#endif
+
+ LoadSoundsInfo();
+
+ for(i=0; i<num_sounds; i++)
+ LoadSoundToList(sound_name[i], i);
+}
+
+static void ReloadCustomMusic()
+{
+#if 1
+ printf("DEBUG: reloading music '%s' ...\n", artwork.music_set_current);
+#endif
+
+ FreeAllMusic();
+
+ LoadCustomMusic();
+}
+
static void InitReloadSoundsOrMusic(char *set_name, int type)
{
#if defined(PLATFORM_UNIX) && !defined(TARGET_SDL)
static void InitReloadSoundsOrMusic(char *set_name, int type)
{
#if defined(PLATFORM_UNIX) && !defined(TARGET_SDL)
diff --git
a/src/libgame/sound.h
b/src/libgame/sound.h
index 146623433f4c2a997e19ee20c99e3be41a3236a4..8f6b123b1930f043374bd9ae223ccc1edab7ff80 100644
(file)
--- a/
src/libgame/sound.h
+++ b/
src/libgame/sound.h
@@
-192,6
+192,19
@@
struct AudioFormatInfo
int fragment_size; /* audio device fragment size in bytes */
};
int fragment_size; /* audio device fragment size in bytes */
};
+#if 0
+struct SoundsInfo
+{
+ int num_sounds;
+ char *sound_name;
+
+#if 0
+ void (*func_reload_sounds)(void);
+ void (*func_reload_music)(void);
+#endif
+}
+#endif
+
struct SampleInfo
{
int type;
struct SampleInfo
{
int type;
@@
-242,12
+255,6
@@
void StartSoundserver(void);
void SoundServer(void);
/* sound client functions */
void SoundServer(void);
/* sound client functions */
-void ReloadSounds(char *);
-void ReloadMusic(char *);
-SoundInfo *LoadCustomSound(char *);
-void InitSoundList(int);
-void LoadSoundToList(char *, int);
-void LoadCustomMusic(void);
void PlayMusic(int);
void PlaySound(int);
void PlaySoundStereo(int, int);
void PlayMusic(int);
void PlaySound(int);
void PlaySoundStereo(int, int);
@@
-261,10
+268,9
@@
void StopMusic(void);
void StopSound(int);
void StopSounds(void);
void StopSoundExt(int, int);
void StopSound(int);
void StopSounds(void);
void StopSoundExt(int, int);
+void InitSoundList(char **, int);
void InitReloadSounds(char *);
void InitReloadMusic(char *);
void InitReloadSounds(char *);
void InitReloadMusic(char *);
-void FreeSound(SoundInfo *);
-void FreeMusic(MusicInfo *);
void FreeAllSounds(void);
void FreeAllMusic(void);
void FreeAllSounds(void);
void FreeAllMusic(void);
diff --git
a/src/libgame/system.c
b/src/libgame/system.c
index 916d92f10f4b19f424de7d3f4c229dc9063701da..0499199253932189b2aea2da1fcf49f3e651c1bf 100644
(file)
--- a/
src/libgame/system.c
+++ b/
src/libgame/system.c
@@
-780,12
+780,14
@@
inline void SetAudioMode(boolean enabled)
audio.sound_enabled = enabled;
}
audio.sound_enabled = enabled;
}
+#if 0
inline void SetAudioReloadFunctions(void (*func_reload_sounds)(void),
void (*func_reload_music)(void))
{
audio.func_reload_sounds = func_reload_sounds;
audio.func_reload_music = func_reload_music;
}
inline void SetAudioReloadFunctions(void (*func_reload_sounds)(void),
void (*func_reload_music)(void))
{
audio.func_reload_sounds = func_reload_sounds;
audio.func_reload_music = func_reload_music;
}
+#endif
/* ========================================================================= */
/* ========================================================================= */
diff --git
a/src/libgame/system.h
b/src/libgame/system.h
index 4d8940d135125a919641ff08b5e94ddc70b31499..46d304bb1aecd57d33b237c7a661a05434cd2662 100644
(file)
--- a/
src/libgame/system.h
+++ b/
src/libgame/system.h
@@
-236,9
+236,6
@@
struct AudioSystemInfo
boolean sound_enabled;
boolean sound_deactivated; /* for temporarily disabling sound */
boolean sound_enabled;
boolean sound_deactivated; /* for temporarily disabling sound */
- void (*func_reload_sounds)(void);
- void (*func_reload_music)(void);
-
int soundserver_pipe[2];
int soundserver_pid;
char *device_name;
int soundserver_pipe[2];
int soundserver_pid;
char *device_name;
@@
-480,8
+477,10
@@
void ReloadCustomImage(Bitmap *, char *);
inline void OpenAudio(void);
inline void CloseAudio(void);
inline void SetAudioMode(boolean);
inline void OpenAudio(void);
inline void CloseAudio(void);
inline void SetAudioMode(boolean);
+#if 0
inline void SetAudioReloadFunctions(void (*func_reload_sounds)(void),
void (*func_reload_music)(void));
inline void SetAudioReloadFunctions(void (*func_reload_sounds)(void),
void (*func_reload_music)(void));
+#endif
inline void InitEventFilter(EventFilter);
inline boolean PendingEvent(void);
inline void InitEventFilter(EventFilter);
inline boolean PendingEvent(void);
diff --git
a/src/main.c
b/src/main.c
index cf78c0cb955dcb0c0bb04548f19e4a00ebb4caff..335cee2329c7b391fb16aee053a089fd2da17502 100644
(file)
--- a/
src/main.c
+++ b/
src/main.c
@@
-136,6
+136,19
@@
char *sound_name[NUM_SOUNDS] =
"gate.wav"
};
"gate.wav"
};
+/* sound effects: setup file identifiers and corresponding default filenames */
+struct
+{
+ char *identifier;
+ char *default_filename;
+}
+sound_effect[NUM_SOUND_EFFECTS] =
+{
+ { "collecting_infotron", "infotron.wav" },
+ { "falling_zonk", "zonkdown.wav" },
+ { "pushing_zonk", "zonkpush.wav" }
+};
+
char *element_info[] =
{
"empty space", /* 0 */
char *element_info[] =
{
"empty space", /* 0 */
diff --git
a/src/main.h
b/src/main.h
index 4769e69bb958e48854b6090cb4c5003611d969cb..18d355d045aad8aabe748ce49aa35874ffcbd327 100644
(file)
--- a/
src/main.h
+++ b/
src/main.h
@@
-1438,6
+1438,15
@@
extern int num_element_info;
#define NUM_SOUNDS 55
#define NUM_SOUNDS 55
+
+/* sound effects */
+#define SND_TEST1 0
+#define SND_TEST2 1
+#define SND_TEST3 2
+
+#define NUM_SOUND_EFFECTS 3
+
+
/* values for game_status */
#define EXITGAME 0
#define MAINMENU 1
/* values for game_status */
#define EXITGAME 0
#define MAINMENU 1
diff --git
a/src/timestamp.h
b/src/timestamp.h
index ccf2e49c5cd59117d222bdc1e1ade13c1e8ebdc3..4abab11cffb0f7fb09a84400c8f43b208e888842 100644
(file)
--- a/
src/timestamp.h
+++ b/
src/timestamp.h
@@
-1
+1
@@
-#define COMPILE_DATE_STRING "[2002-04-2
5 00:14
]"
+#define COMPILE_DATE_STRING "[2002-04-2
8 23:49
]"