From 463778af29aada177d4a00c566653b92be3b507a Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Sat, 10 Aug 2002 15:37:55 +0200 Subject: [PATCH] rnd-20020810-2-src --- src/Makefile | 2 +- src/conftime.h | 2 +- src/game.c | 8 ------ src/libgame/misc.c | 33 ++++++------------------- src/libgame/sound.c | 58 ++++++++++++++++++++++---------------------- src/libgame/system.c | 5 +++- 6 files changed, 43 insertions(+), 65 deletions(-) diff --git a/src/Makefile b/src/Makefile index c73420b7..9c22aba9 100644 --- a/src/Makefile +++ b/src/Makefile @@ -171,7 +171,7 @@ libgame_dir: $(LIBGAME): @$(MAKE) -C $(LIBDIR) -$(TIMESTAMP_FILE): $(SRCS) +$(TIMESTAMP_FILE): $(SRCS) $(LIBGAME) @date '+"[%Y-%m-%d %H:%M]"' \ | sed -e 's/^/#define COMPILE_DATE_STRING /' \ > $(TIMESTAMP_FILE) diff --git a/src/conftime.h b/src/conftime.h index 368b8799..371d0366 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2002-08-10 13:13]" +#define COMPILE_DATE_STRING "[2002-08-10 15:36]" diff --git a/src/game.c b/src/game.c index 4fc13171..bc31c194 100644 --- a/src/game.c +++ b/src/game.c @@ -1000,20 +1000,12 @@ void InitGame() OpenDoor(DOOR_OPEN_ALL); -#if 1 - printf("starting game sound/music...\n"); -#endif - PlaySoundStereo(SND_GAME_STARTING, SOUND_MAX_RIGHT); if (setup.sound_music) PlayMusic(level_nr); KeyboardAutoRepeatOff(); -#if 1 - printf("started.\n"); -#endif - if (options.debug) { for (i=0; i<4; i++) diff --git a/src/libgame/misc.c b/src/libgame/misc.c index acada247..8bc69396 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -635,7 +635,7 @@ void Error(int mode, char *format, ...) if (mode & ERR_WARN && !options.verbose) return; -#if !defined(PLATFORM_UNIX) +#if defined(PLATFORM_MSDOS) newline = "\r\n"; if ((error = openErrorFile()) == NULL) @@ -1265,44 +1265,27 @@ boolean FileIsArtworkType(char *basename, int type) /* ========================================================================= */ -/* functions only needed for non-Unix (non-command-line) systems */ +/* functions only needed for non-Unix (non-command-line) systems */ +/* (MS-DOS only; SDL/Windows creates files "stdout.txt" and "stderr.txt") */ /* ========================================================================= */ -#if !defined(PLATFORM_UNIX) +#if defined(PLATFORM_MSDOS) -#define ERROR_FILENAME "error.out" +#define ERROR_FILENAME "stderr.txt" void initErrorFile() { - char *filename; - - InitUserDataDirectory(); - - filename = getPath2(getUserDataDir(), ERROR_FILENAME); - unlink(filename); - free(filename); + unlink(ERROR_FILENAME); } FILE *openErrorFile() { - char *filename; - FILE *error_file; - - filename = getPath2(getUserDataDir(), ERROR_FILENAME); - error_file = fopen(filename, MODE_APPEND); - free(filename); - - return error_file; + return fopen(ERROR_FILENAME, MODE_APPEND); } void dumpErrorFile() { - char *filename; - FILE *error_file; - - filename = getPath2(getUserDataDir(), ERROR_FILENAME); - error_file = fopen(filename, MODE_READ); - free(filename); + FILE *error_file = fopen(ERROR_FILENAME, MODE_READ); if (error_file != NULL) { diff --git a/src/libgame/sound.c b/src/libgame/sound.c index cd34b284..e7cd6461 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -803,11 +803,8 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) int i, k; #if 0 - printf("NEW SOUND %d HAS ARRIVED [%d]\n", snd_ctrl.nr, num_sounds); -#endif - -#if 0 - printf("%d ACTIVE CHANNELS\n", mixer_active_channels); + printf("NEW SOUND %d ARRIVED [%d] [%d ACTIVE CHANNELS]\n", + snd_ctrl.nr, num_sounds, mixer_active_channels); #endif if (IS_MUSIC(snd_ctrl)) @@ -833,10 +830,7 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) /* play music samples on a dedicated music channel */ if (IS_MUSIC(snd_ctrl)) { -#if 0 - printf("PLAY MUSIC WITH VOLUME/STEREO %d/%d\n", - snd_ctrl.volume, snd_ctrl.stereo_position); -#endif + Mixer_StopMusicChannel(); mixer[audio.music_channel] = snd_ctrl; Mixer_PlayMusicChannel(); @@ -921,12 +915,36 @@ static void Mixer_InsertSound(SoundControl snd_ctrl) of the channel's sound sample when compiling with the SDL mixer library, we use the current playing time (in milliseconds) instead. */ +#if DEBUG + /* Channel sanity check -- this should normally not be needed */ + if (mixer_active_channels == + audio.num_channels - (mixer[audio.music_channel].active ? 0 : 1)) + { + for (i=audio.first_sound_channel; idata_len == 0) { printf("THIS SHOULD NEVER HAPPEN! [snd_info->data_len == 0]\n"); } #endif -#endif - -#if 1 - if (IS_MUSIC(snd_ctrl) && i == audio.music_channel && mixer[i].active) - { - printf("THIS SHOULD NEVER HAPPEN! [adding music twice]\n"); - -#if 1 - Mixer_StopChannel(i); -#endif - } -#endif mixer[i] = snd_ctrl; Mixer_PlayChannel(i); diff --git a/src/libgame/system.c b/src/libgame/system.c index cc7dc2aa..5c0b4fbe 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -94,6 +94,9 @@ void InitPlatformDependantStuff(void) #if !defined(PLATFORM_UNIX) program.userdata_directory = "userdata"; +#endif + +#if defined(PLATFORM_MSDOS) initErrorFile(); #endif @@ -105,7 +108,7 @@ void InitPlatformDependantStuff(void) void ClosePlatformDependantStuff(void) { -#if !defined(PLATFORM_UNIX) +#if defined(PLATFORM_MSDOS) dumpErrorFile(); #endif } -- 2.34.1