From: Holger Schemel Date: Sat, 30 Aug 2014 08:38:06 +0000 (+0200) Subject: Merge branch 'master' into releases X-Git-Tag: 2.1.1 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=refs%2Ftags%2F2.1.1;hp=4f6fe351c7b605d97c1ba8f482fb72e467dc19cb;p=rocksndiamonds.git Merge branch 'master' into releases --- diff --git a/CHANGES b/CHANGES index 6112c0b0..36357767 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,13 @@ +Release Version 2.1.1 [13 AUG 2002] +----------------------------------- + - sound bug (causing crashes) fixed (reported by Keith Peterston) + - support for /dev/sound/dsp (devfs) added (thanks to Christoph Bauer) + - small NetBSD compilation bug fixed (thanks to Adam Ciarcinski) + - default keys for "snap field" and "place bomb" fixed for Mac OS X + - added new contributed levels from the following players: + + Alan Bond + + Gerrit Holl + Release Version 2.1.0 [05 AUG 2002] ----------------------------------- - native Mac OS X port (finally!) diff --git a/src/Makefile b/src/Makefile index e935b51d..609d753f 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 28ed84b5..5cfe6cf0 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2002-08-05 02:26]" +#define COMPILE_DATE_STRING "[2002-08-13 01:52]" 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/platform.h b/src/libgame/platform.h index 94c5c4a8..61ab27f6 100644 --- a/src/libgame/platform.h +++ b/src/libgame/platform.h @@ -66,8 +66,8 @@ #define PLATFORM_BSDI #endif -#if defined(sparc) || defined(sun) -#define PLATFORM_SOLARIS +#if defined(sparc) && defined(sun) +#define PLATFORM_SUNOS #endif #if defined(__APPLE__) && defined(__MACH__) diff --git a/src/libgame/sound.c b/src/libgame/sound.c index cd34b284..6f485766 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -66,6 +66,7 @@ #define MUS_TYPE_MOD 2 #define DEVICENAME_DSP "/dev/dsp" +#define DEVICENAME_SOUND_DSP "/dev/sound/dsp" #define DEVICENAME_AUDIO "/dev/audio" #define DEVICENAME_AUDIOCTL "/dev/audioCtl" @@ -234,6 +235,7 @@ static boolean TestAudioDevices(void) static char *audio_device_name[] = { DEVICENAME_DSP, + DEVICENAME_SOUND_DSP, DEVICENAME_AUDIO }; int audio_device_fd = -1; @@ -350,7 +352,7 @@ static void InitAudioDevice_Linux(struct AudioFormatInfo *afmt) if (ioctl(audio.device_fd, SNDCTL_DSP_SETFRAGMENT, &fragment_spec) < 0) Error(ERR_EXIT_SOUND_SERVER, - "cannot set fragment size of /dev/dsp -- no sounds"); + "cannot set fragment size of audio device -- no sounds"); i = 0; afmt->format = 0; @@ -366,7 +368,7 @@ static void InitAudioDevice_Linux(struct AudioFormatInfo *afmt) if (afmt->format == 0) /* no supported audio format found */ Error(ERR_EXIT_SOUND_SERVER, - "cannot set audio format of /dev/dsp -- no sounds"); + "cannot set audio format of audio device -- no sounds"); /* try if we can use stereo sound */ afmt->stereo = TRUE; @@ -375,15 +377,15 @@ static void InitAudioDevice_Linux(struct AudioFormatInfo *afmt) if (ioctl(audio.device_fd, SNDCTL_DSP_SPEED, &afmt->sample_rate) < 0) Error(ERR_EXIT_SOUND_SERVER, - "cannot set sample rate of /dev/dsp -- no sounds"); + "cannot set sample rate of audio device -- no sounds"); /* get the real fragmentation size; this should return 512 */ if (ioctl(audio.device_fd, SNDCTL_DSP_GETBLKSIZE, &fragment_size_query) < 0) Error(ERR_EXIT_SOUND_SERVER, - "cannot get fragment size of /dev/dsp -- no sounds"); + "cannot get fragment size of audio device -- no sounds"); if (fragment_size_query != afmt->fragment_size) Error(ERR_EXIT_SOUND_SERVER, - "cannot set fragment size of /dev/dsp -- no sounds"); + "cannot set fragment size of audio device -- no sounds"); } #endif /* AUDIO_LINUX_IOCTL */ @@ -397,8 +399,8 @@ static void InitAudioDevice_NetBSD(struct AudioFormatInfo *afmt) a_info.play.encoding = AUDIO_ENCODING_LINEAR8; a_info.play.precision = 8; a_info.play.channels = 2; - a_info.play.sample_rate = sample_rate; - a_info.blocksize = fragment_size; + a_info.play.sample_rate = afmt->sample_rate; + a_info.blocksize = afmt->fragment_size; afmt->format = AUDIO_FORMAT_U8; afmt->stereo = TRUE; @@ -412,7 +414,7 @@ static void InitAudioDevice_NetBSD(struct AudioFormatInfo *afmt) if (ioctl(audio.device_fd, AUDIO_SETINFO, &a_info) < 0) Error(ERR_EXIT_SOUND_SERVER, - "cannot set sample rate of /dev/audio -- no sounds"); + "cannot set sample rate of audio device -- no sounds"); } } #endif /* PLATFORM_NETBSD */ @@ -425,7 +427,7 @@ static void InitAudioDevice_HPUX(struct AudioFormatInfo *afmt) audio_ctl = open("/dev/audioCtl", O_WRONLY | O_NDELAY); if (audio_ctl == -1) - Error(ERR_EXIT_SOUND_SERVER, "cannot open /dev/audioCtl -- no sounds"); + Error(ERR_EXIT_SOUND_SERVER, "cannot open audio device -- no sounds"); if (ioctl(audio_ctl, AUDIO_DESCRIBE, &ainfo) == -1) Error(ERR_EXIT_SOUND_SERVER, "no audio info -- no sounds"); @@ -803,11 +805,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 +832,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 +917,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 allocation sanity check -- should 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 } diff --git a/src/libgame/system.h b/src/libgame/system.h index 0f6d5e2b..743a8b9b 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -51,8 +51,13 @@ #define DEFAULT_KEY_RIGHT KSYM_Right #define DEFAULT_KEY_UP KSYM_Up #define DEFAULT_KEY_DOWN KSYM_Down +#if defined(PLATFORM_MACOSX) +#define DEFAULT_KEY_SNAP KSYM_Control_L +#define DEFAULT_KEY_BOMB KSYM_KP_Enter +#else #define DEFAULT_KEY_SNAP KSYM_Shift_L #define DEFAULT_KEY_BOMB KSYM_Shift_R +#endif #define DEFAULT_KEY_OKAY KSYM_Return #define DEFAULT_KEY_CANCEL KSYM_Escape diff --git a/src/main.h b/src/main.h index 17136765..71cfcdf9 100644 --- a/src/main.h +++ b/src/main.h @@ -1632,8 +1632,8 @@ extern struct SoundEffectInfo sound_effects[]; #define PROGRAM_VERSION_MAJOR 2 #define PROGRAM_VERSION_MINOR 1 -#define PROGRAM_VERSION_PATCH 0 -#define PROGRAM_VERSION_STRING "2.1.0" +#define PROGRAM_VERSION_PATCH 1 +#define PROGRAM_VERSION_STRING "2.1.1" #define PROGRAM_TITLE_STRING "Rocks'n'Diamonds" #define PROGRAM_AUTHOR_STRING "Holger Schemel"