From 50c422d96b6da2c0412b6bd3763e9d1a029a6014 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 4 Dec 1998 20:33:24 +0100 Subject: [PATCH] rnd-19981204-2 --- src/Makefile | 1 + src/files.c | 17 ++++--- src/init.c | 14 +++--- src/msdos.c | 55 ++--------------------- src/sound.c | 125 ++++++++++++++++++++++++++++++++++++++------------- src/sound.h | 12 ++--- 6 files changed, 122 insertions(+), 102 deletions(-) diff --git a/src/Makefile b/src/Makefile index 3019442b..37352916 100644 --- a/src/Makefile +++ b/src/Makefile @@ -70,6 +70,7 @@ CONFIG = $(CONFIG_GAME_DIR) $(SOUNDS) $(JOYSTICK) \ # DEBUG = -DDEBUG -g -Wall -ansi -pedantic # DEBUG = -DDEBUG -g -Wall +# DEBUG = -O3 -Wall -ansi -pedantic DEBUG = -O3 -Wall # DEBUG = -O3 diff --git a/src/files.c b/src/files.c index 211a38d1..ba39f3f3 100644 --- a/src/files.c +++ b/src/files.c @@ -443,6 +443,17 @@ void LoadTape(int level_nr) int file_version = FILE_VERSION_1_2; /* last version of tape files */ int chunk_length; + /* always start with reliable default values (empty tape) */ + TapeErase(); + + /* default values (also for pre-1.2 tapes) with only the first player */ + tape.player_participates[0] = TRUE; + for(i=1; i 0) - continue; - if (tape.player_participates[j]) tape.pos[i].action[j] = fgetc(file); } diff --git a/src/init.c b/src/init.c index 321875dc..bc72b99a 100644 --- a/src/init.c +++ b/src/init.c @@ -172,8 +172,9 @@ void InitSound() for(i=0; istate; } -void sound_handler(struct SoundControl snd_ctrl) -{ - int i; - - if (snd_ctrl.fade_sound) - { - if (!playing_sounds) - return; - - for (i=0; i=0) @@ -309,14 +319,67 @@ void SoundServer() #endif /* !VOXWARE */ } -#endif +#endif /* !MSDOS */ } -void SoundServer_InsertNewSound(struct SoundControl snd_ctrl) +#ifdef MSDOS +static void sound_handler(struct SoundControl snd_ctrl) { - int i,k; + int i; + + if (snd_ctrl.fade_sound) + { + if (!playing_sounds) + return; - /* wenn voll, ältesten Sound 'rauswerfen */ + for (i=0; i=1 && snd_ctrl.loop) { for(i=0;i=2) { int longest=0, longest_nr=0; - /* den bereits am längsten gespielten (gleichen) Sound suchen */ + /* look for oldest equal sound */ for(i=0;i longword */ boolean LoadSound(struct SoundInfo *snd_info) { - FILE *file; char filename[256]; char *sound_ext = "wav"; #ifndef MSDOS struct SoundHeader_WAV *sound_header; + FILE *file; int i; #endif @@ -641,6 +704,7 @@ boolean LoadSound(struct SoundInfo *snd_info) options.base_directory, SOUNDS_DIRECTORY, snd_info->name, sound_ext); #ifndef MSDOS + if ((file = fopen(filename, "r")) == NULL) { Error(ERR_WARN, "cannot open sound file '%s' - no sounds", filename); @@ -694,9 +758,9 @@ boolean LoadSound(struct SoundInfo *snd_info) if (!snd_info->sample_ptr) { Error(ERR_WARN, "cannot read sound file '%s' - no sounds", filename); - fclose(file); return(FALSE); } + #endif /* MSDOS */ return(TRUE); @@ -704,10 +768,10 @@ boolean LoadSound(struct SoundInfo *snd_info) boolean LoadSound_8SVX(struct SoundInfo *snd_info) { - FILE *file; char filename[256]; #ifndef MSDOS struct SoundHeader_8SVX *sound_header; + FILE *file; char *ptr; char *sound_ext = "8svx"; #else @@ -800,7 +864,6 @@ boolean LoadSound_8SVX(struct SoundInfo *snd_info) if(!snd_info->sample_ptr) { Error(ERR_WARN, "cannot read sound file '%s' - no sounds", filename); - fclose(file); return(FALSE); } return(TRUE); diff --git a/src/sound.h b/src/sound.h index 2c747bd8..ca97ff0a 100644 --- a/src/sound.h +++ b/src/sound.h @@ -159,16 +159,10 @@ struct SoundControl #endif }; -/* sound server functions */ +/* start sound server */ void SoundServer(void); -void SoundServer_InsertNewSound(struct SoundControl); -void SoundServer_StopSound(int); -void SoundServer_StopAllSounds(void); -void HPUX_Audio_Control(void); -unsigned char linear_to_ulaw(int); -int ulaw_to_linear(unsigned char); - -/* application functions */ + +/* client functions */ boolean LoadSound(struct SoundInfo *); void PlaySound(int); void PlaySoundStereo(int, int); -- 2.34.1